Skip to content

Commit

Permalink
Updated semantic-ui theme to use new @rjsf/utils and @rjsf/validator (r…
Browse files Browse the repository at this point in the history
…jsf-team#2920)

* Updated @rjsf/core to use the new `utils` and `validator-ajv6` libraries
- Removed the `index.d.ts` file since all the types are now exported in `@rjsf/utils`
- Updated `package*.json` to make changes consistent with pulling utils and validator-ajv6 libraries
  - Removed `core-js-pure`, `json-schema-merge-allof`, `jsonpointer` and `react-is` from `dependencies` in favor of `@rjsf/utils`
  - Moved `ajv` and `@types/json-schema` into the `devDependencies`
  - Added `@rjsf/validator-ajv6`, `@types/lodash` and `tsdx`
  - Also, removed all mentions of `index.d.ts`
- Converted `ErrorList` to typescript, pulling types from `@rjsf/utils`
- Converted `Form` to typescript
  - Built `FormProps` and `FormState` props which are exported
  - Pulled in all the types from `@rjsf/utils` functions
  - Removed the `additionalMetaSchemas` and `customFormats` props in favor of the new, required `validator: ValidatorType` prop
  - Updated `getStateFromProps()` to create a `SchemaUtilsType` object and put it into both the state and the registry as `schemaUtils`
  - Switched to using the `schemaUtils.getValidator()` to access the `validateFormData()` and `toErrorList()` calls
  - Switched to using `schemaUtils` to access `getDefaultFormState()`, `toIdSchema()`, `toPathSchema()` and `retrieveSchema()`
- Updated `ArrayField` to use the `@rjsf/utils` functions
  - Also, switched to the `includes` function from `lodash`
  - Pull the `schemaUtils` from the `registry` and used it for `getDefaultFormState()`, `isMultiSelect()`, `isFilesArray()`, `retrieveSchema()` and `toIdSchema()`
  - Switched from `xxx.hadOwnProperty('y')` to `'y' in xxx` to remove an eslint warning
- Updated `BooleanField`, `NumberField`, `CheckboxWidget`, `DateTimeWidget`, `FileWidget`, `RangeWidget`, `SelectWidget` and `UpDownWidget` to pull utility functions from `@rjsf/utils`
- Updated `MultiSchemaField` to use the `@rjsf/utils` functions
  - Pulled the `schemaUtils` from the `registry` and used it for `getDefaultFormState()` and `getMatchingOption()`
  - Switched from `xxx.hadOwnProperty('y')` to `'y' in xxx` to remove an eslint warning
- Updated `ObjectField` to use the `@rjsf/utils` functions
  - Pulled the `schemaUtils` from the `registry` and used it for `retrieveSchema()`
  - Switched from `xxx.hadOwnProperty('y')` to `'y' in xxx` to remove an eslint warning
- Updated `SchemaField` to use the `@rjsf/utils` functions
  - Pulled the `schemaUtils` from the `registry` and used it for `getDisplayLabel()`, `isSelect()`, `retrieveSchema()` and `toIdSchema()`
  - Switched from `xxx.hadOwnProperty('y')` to `'y' in xxx` to remove an eslint warning
- Updated `StringField` to use the `@rjsf/utils` functions
  - Pulled the `schemaUtils` from the `registry` and used it for `isSelect()`
- Updated `AltDateWidget` to use the `@rjsf/utils` functions
  - Removed `prevState` from `componentDidUpdate()` because it is not used, removing lint error
- Updated `TextWidget` to add `bool` as a type for the value to avoid a React error that failed tests
- Converted `SubmitButton` to typescript, pulling types from `@rjsf/utils` and exporting it's props type
- Converted `getDefaultRegistry()` to typescript, pulling types from `@rjsf/utils`
  - Changed the export to be `default`
  - Temporarily needing to cast `fields` and `widgets` to the proper type until they are converted
- Converted `withTheme()` to typescript, pulling types from `@rjsf/utils` and the typescript `Form`
- Converted the `src/index.js` file to Typescript, exporting both the `Form` and its types along with `withTheme()`, `getDefaultRegistry()`
- Updated the `types.js` file to remove `definitions` and add in `schemaUtils` ffor the `registry` type.
- Deleted the `src/utils.js`, `src/validate.js` files since they have been replaced with `@rjsf/utils/` and `@rjsf/validator-ajv6`
  - Removed the `utils_test.js` file entirely and only kept the `Form` integration part of the `validate_test.js`
- Updated the tests as follows to make things work with `@rjsf/utils` and `@rjsf/validator-ajv6`
  - Updated `test_utils.js` to import the default `validator` from `@rjsf/validator-ajv6` and add it to the props for `createFormComponent()`
  - Updated the `Form_test.js` to import the default `validator` and the `customizeValidator()` function and passed `validator` into props for `<Form>...</Form>`
    - Updated the checking of `onChangeProp` to add `schemaValidationErrors`, `schemaValidationErrorSchema` and `schemaUtils` to the `calledWith()` check
    - Updated the checking of `onError` to add `schemaValidationErrors`, `schemaValidationErrorSchema` to the match
    - Deleted any tests that dealt with the now removed deprecated features
    - Replaced tests the used the `customFormats` or `additionalMetaSchemas` props with a customized validator with those values set on it
      - In one place, removed a piece of a test that was reverting the old props since they don't exist anymore
  - Updated the `SchemaField_test.js` file to check the `registry` in the received props to have `schemaUtils` instead of `definitions`
    - Fixed the import of `getDefaultRegistry()`
    - Also removed the test related to `empty definitions` since that isn't in the registry anymore
  - Updated the `StringField_test.js` to import the utility functions from `@rjsf/utils`
  - Updated the `uiSchema_test.js` file to deal with the removal of deprecated `ui:widget: {component, options}` feature in `@rjsf/utils`
    - Switched from `warn` to `error` for spying
    - Removed the deprecated `ui:widget` configurations in the tests, moving the options into the `ui:options` block instead`
    - Verified the proper error (instead of warning) is returned

* - Temporarily restore `index.d.ts` until next PR when it gets removed

* - Export `WithThemeProps` from core

* - Converted `AddButton` to Typescript
- Switched `SubmitButton` to use `WidgetProps`
- Removed `schemaUtils` as a param for `getDefaultRegistry()`
- Set generic defaults on `WithThemeProps`
- Fixed cast of `SubmitButton` in `Form`

* - Updated the type for `withTheme()`

* - Refactored `processValue` out of `SelectWidget` and used the new `processSelectValue()` method in utils

* - Fixed a few more things found while finishing up the themes conversion

* Updated antd theme to use new @rjsf/utils and @rjsf/validator
- Updated `package*.json` to add `@rjsf/utils` and `@rjsf/validator` to dev and peer dependencies
  - Also, Removed a bunch of packages that were never used since the conversion to `tsdx`
  - Finally, bumped most of the dev dependencies that made sense to the latest version, except for those that cause breaking tests
- Removed the `webpack.config.*.js` files since they are no longer needed since the conversion to `tsdx`
- Updated all uses of non-schema utilities methods to `@rjsf/utils` and switched to using `registry.schemaUtils.XXX()` for those schema-based utilities
- Updated the import of `getDefaultRegistry()` to be directly from `@rjsf/core`
- Modified `SelectWidget` to use the new `processSelectValue()` function from `@rjsf/utils`
- Updated the tests to import the `validator` from `@rjsf/validator` to pass to the `Form`
  - Also updated the snapshots via the `test:update` script to deal with the little differences from the conversion

* Updated bootstrap-4 theme to use new @rjsf/utils and @rjsf/validator
- Updated `package*.json` to add `@rjsf/utils` to dev and peer dependencies and `@rjsf/validator-ajv6` to dev dependencies
  - Also, Removed a bunch of packages that were never used since the conversion to `tsdx`
  - Finally, bumped most of the dev dependencies that made sense to the latest version, except for those that cause breaking tests
- Updated all uses of non-schema utilities methods to `@rjsf/utils` and switched to using `registry.schemaUtils.XXX()` for those schema-based utilities
- Updated the import of `getDefaultRegistry()` to be directly from `@rjsf/core`
- Updated components that used the `uiSchema['ui:xxx']` notation to get the `uiOptions` using `getUiOptions(uiSchema)` then doing `uiOptions.xxx` instead
- Updated the use of `React.FC` with `React.ComponentType` in `AddButton` and `SubmitButton`
- Updated `ArrayFieldTitleProps` and `ArrayFieldDescriptionProps` to make `title`, `required` and `description` optional in the `ArrayFieldTemplate.tsx` file
  - Also fixed the indentation of components
- Updated `WrapIfAdditionalProps` to pick props from `FieldTemplateProps` joining it with `children` to fix type issues
- Updated `Form` to use `React.ComponentType`
- Modified `SelectWidget` to use the new `processSelectValue()` function from `@rjsf/utils`
- Updated the tests to change to using `RJSFSchema` rather than `JSON7Schema` and import the `validator` from `@rjsf/validator` to pass to the `Form`
  - Also updated the snapshots via the `test:update` script to deal with the little differences from the conversion

* Updated chakra-ui theme to use new @rjsf/utils and @rjsf/validator
- Updated `package*.json` to add `@rjsf/utils` to dev and peer dependencies and `@rjsf/validator-ajv6` to dev dependencies
  - Also, Removed a bunch of packages that were never used since the conversion to `tsdx`
  - Finally, bumped most of the dev dependencies that made sense to the latest version, except for those that cause breaking tests
- Updated all uses of non-schema utilities methods to `@rjsf/utils` and switched to using `registry.schemaUtils.XXX()` for those schema-based utilities
- Updated the import of `getDefaultRegistry()` to be directly from `@rjsf/core`
- Updated components that used the `uiSchema['ui:xxx']` notation to get the `uiOptions` using `getUiOptions(uiSchema)` then doing `uiOptions.xxx` instead
- Updated the use of `React.FC` with `React.ComponentType` in `AddButton` and `SubmitButton`
- Updated `AltDateWidget` to extend the `AltDateStateType` object from the `DateObject`
- Updated `ArrayFieldTitleProps` and `ArrayFieldDescriptionProps` to make `title`, `required` and `description` optional in the `ArrayFieldTemplate.tsx` file
  - Also fixed the indentation of components
- Updated `WrapIfAdditionalProps` to pick props from `FieldTemplateProps` joining it with `children` to fix type issues
- Updated `Form` to use `React.ComponentType`
- Modified `SelectWidget` to use the new `processSelectValue()` function from `@rjsf/utils`
- Updated `utils.js` to remove the custom `ThemeProps` in favor of the new `WithThemeProps` from `@rjsf/core`
- Updated the tests to change to using `RJSFSchema` rather than `JSON7Schema` and import the `validator` from `@rjsf/validator` to pass to the `Form`
  - Also updated the snapshots via the `test:update` script to deal with the little differences from the conversion

* Updated fluent-ui theme to use new @rjsf/utils and @rjsf/validator
- Updated `package*.json` to add `@rjsf/utils` to dev and peer dependencies and `@rjsf/validator-ajv6` to dev dependencies
  - Also, Removed a bunch of packages that were never used since the conversion to `tsdx`
  - Finally, bumped most of the dev dependencies that made sense to the latest version, except for those that cause breaking tests
- Updated all uses of non-schema utilities methods to `@rjsf/utils` and switched to using `registry.schemaUtils.XXX()` for those schema-based utilities
- Updated the import of `getDefaultRegistry()` to be directly from `@rjsf/core`
- Updated `ArrayFieldTitleProps` and `ArrayFieldDescriptionProps` to make `title`, `required` and `description` optional in the `ArrayFieldTemplate.tsx` file
  - Also fixed the indentation of components
- Updated `WrapIfAdditionalProps` to pick props from `FieldTemplateProps` joining it with `children` to fix type issues
- Updated `FuiForm` to use `React.ComponentType`
- Modified `SelectWidget` to use the new `processSelectValue()` function from `@rjsf/utils`
- Updated the tests to change to using `RJSFSchema` rather than `JSON7Schema` and import the `validator` from `@rjsf/validator` to pass to the `Form`
  - Also updated the snapshots via the `test:update` script to deal with the little differences from the conversion

* Updated material-ui theme to use new @rjsf/utils and @rjsf/validator
- Updated `package*.json` to add `@rjsf/utils` to dev and peer dependencies and `@rjsf/validator-ajv6` to dev dependencies
  - Also, Removed a bunch of packages that were never used since the conversion to `tsdx`
  - Finally, bumped most of the dev dependencies that made sense to the latest version, except for those that cause breaking tests
- Updated all uses of non-schema utilities methods to `@rjsf/utils` and switched to using `registry.schemaUtils.XXX()` for those schema-based utilities
- Updated the import of `getDefaultRegistry()` to be directly from `@rjsf/core`
- Updated components that used the `uiSchema['ui:xxx']` notation to get the `uiOptions` using `getUiOptions(uiSchema)` then doing `uiOptions.xxx` instead
- Updated the use of `React.FC` with `React.ComponentType` in `AddButton` and `SubmitButton`
- Updated `ArrayFieldTitleProps` and `ArrayFieldDescriptionProps` to make `title`, `required` and `description` optional in the `ArrayFieldTemplate.tsx` file
  - Also fixed the indentation of components
- Updated `WrapIfAdditionalProps` to pick props from `FieldTemplateProps` joining it with `children` to fix type issues
- Updated `MuiForm` and `MuiForm5` to use `React.ComponentType`
- Modified `SelectWidget` to use the new `processSelectValue()` function from `@rjsf/utils`
- Updated the tests to change to using `RJSFSchema` rather than `JSON7Schema` and import the `validator` from `@rjsf/validator` to pass to the `Form`
  - Also updated the snapshots via the `test:update` script to deal with the little differences from the conversion

* Updated semantic-ui theme to use new @rjsf/utils and @rjsf/validator
- Bumped the main `package.json` to use the latest version of `Typescript`
- Updated `.eslintrc` with what was needed to support the latest eslint version
- Updated `package*.json` to add `@rjsf/utils` to dev and peer dependencies and `@rjsf/validator-ajv6` to dev dependencies
  - Also, Removed a bunch of packages that were never used since the conversion to `tsdx`
  - Finally, bumped most of the dev dependencies that made sense to the latest version, except for those that cause breaking tests
- Updated all uses of non-schema utilities methods to `@rjsf/utils` and switched to using `registry.schemaUtils.XXX()` for those schema-based utilities
- Updated the import of `getDefaultRegistry()` to be directly from `@rjsf/core`
- Modified `SelectWidget` to use the new `processSelectValue()` function from `@rjsf/utils`
- Updated the tests to import the `validator` from `@rjsf/validator` to pass to the `Form`
  - Also updated the snapshots via the `test:update` script to deal with the little differences from the conversion

* - Fixed material-ui build to no longer generate the v4 and v5 versions since the theme will soon be separated into two packages

* - Update material-ui package-lock.json to match package.json
  • Loading branch information
heath-freenome committed Aug 27, 2022
1 parent 704799f commit 8fc91a3
Show file tree
Hide file tree
Showing 240 changed files with 109,682 additions and 128,909 deletions.
21,324 changes: 21,293 additions & 31 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -34,7 +34,7 @@
"ts-loader": "^8.4.0",
"tsdx": "^0.14.1",
"tslib": "^2.4.0",
"typescript": "^4.6.4",
"typescript": "^4.7.4",
"webpack": "^4.46.0"
},
"husky": {
Expand Down

0 comments on commit 8fc91a3

Please sign in to comment.