Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge the long-lived RJSF v5 branch to master (#3055)
* Packages/utils (#2863) * Implemented the utils package - Refactored the `packages/core/src/utils.js` file into separate typescript files in the new `packages/utils/src` * - More changes * - Added all of the non-validation-based utilities and many of the tests * - removed schema related files temporarily * - Added missing tests to get test coverage up to 100% for all but `getWidget()` - Also did some cleanup in the `src` files, moving types into `types.ts`, and exporting all the types * - Fixed getWidget tests * - Update README.md * - update the target to for typescript in * - revert `package-lock.json` for antd, core and playground * - fix build issues * - Added the `rjsf-v5` branch to the `ci.yml` - Added a new `RJSFSchema` as a redefine of `JSONSchema7` to make changing schemas everywhere else easier - Updated all the utils and tests to change `JSONSchema7` to `RJSFSchema` - Fixed test breaks by casting e to Error * - changed tabs to spaces in package.json, fixed bug in deepEquals * - Add `tsdx` to `package.json` to enable running `npm run test` inside of the `packages/utils` directory - Bumped `@types/jest` to match the version in use by `tsdx` - Fixed the `utcToLocal()` test by mocking the `getDate()` and `getHours()` functions to be UTC + 2 hours to avoid server vs local timezone issues * - Began adding documentation to the utility functions - Reordered the logic in `asNumber` to avoid converting to number until we have to - Updated `findSchemaDefinition()` to handle the case where a `$ref` in a schema also contains additional props - Updated `getSubmitButtonOptions()` to export its `DEFAULT_OPTIONS` for testing purposes - Updated `getUiOptions()` to no longer support `ui:widget` objects as it has been deprecated for years - Made some other test fixes * - Finished adding documentation to all of the remaining utils methods * - Minor documentation changes, and allow `findSchemaDefinition()` to support undefined ref name * - Responded to self-review comments * Packages/utils/schema (#2877) * Implemented the utils package - Refactored the `packages/core/src/utils.js` file into separate typescript files in the new `packages/utils/src` * - More changes * - Added all of the non-validation-based utilities and many of the tests * - removed schema related files temporarily * - revert `package-lock.json` for antd, core and playground * - The schema utilities that require validation * - More changes * - completed conversion to Typescript with some changes that were needed * - Updated various files to make some parameters optional, to add generics typing where missed - Created an `index.ts` in the `schema` subdirectory that exports all of the schema related functions - Updated `types.ts` to add the new `SchemaUtilsType` interface - Implemented a `createSchemaUtils()` function that returns a `SchemaUtilsType` interface given a `ValidatorType` and a `rootSchema` * - Implemented createSchemaUtils - Began testing the schema-based utils * - More fixes and adding missing generics * - Converted all the schema based tests over still missing 100% coverage * - Completed 100% unit testing * - Added documentation for most of the files and cleaned up some optionality on some arguments * - Completed all of the documentation of the schema-based utils * - Changed the `_NAME` constants to `_KEY` * - Added missing generics on a few types * - Added `ERRORS_KEY` constant for use in validation * - Fixed types based on implementation of validator * - Added missing generic to the `ValidationData` type for `ErrorSchema` * - Fixed tests for the missing generic type * - Incorporated #2876 by making props for UISchemaSubmitButtonOptions optional * - Added generic `<T>` to the return value of `toIdSchema()` and `toPathSchema()` * Refactored schema to support running schema tests from other packages (#2899) * Refactored schema to support runnings from other packages - Fixed the import of `types` in `mergeSchemas.ts` - Renamed all of the `xxx.test.ts` to `xxxTest.ts` and wrapped them in an outer `xxxTest()` function that takes a `TestValidatorType` - Added a `types.ts` file in the `schema` directory to provide the `TestValidatorType` and `TestValidatorParams` interfaces - Added an `index.ts` file in the `schema` directory to export all of the `xxxTest` functions - Updated `getTestValidator()` to import the types from the `schema/types` - Added a `test/schema.test.ts` to create a `TestValidator` and run all of the `xxxTest()` functions from `schema` * - Fixed the tests based on using the real validator * - Removed the use of `xxx.hasOwnProperty('y')` in favor `'y' in xxx` to eliminate lint warnings - Fixed bug in `stubExistingAdditionalProperties()` related to the `additionalProperties: true` case, adding new test to verify fix * - Removed console.log statement * - Moved `stubExistingAdditionalProperties()` into the `retrieveSchema.ts` file to eliminate a circular dependency - Did the same for the `stubExistingAdditionalPropertiesTest()` function - Updated the `index.ts` files to remove the `stubExistingAdditionalProperties[Test]()` functions - Updated `SchemaUtilsType` and `createSchemaUtils` to remove the `stubExistingAdditionalProperties()` function * Validator ajv6 (#2891) * Added new package for validator-ajv6 - Refactored `packages/core/src/validate.js` into this new package * - Switched to the new `@rjsf/utils` library and types * - Finished types conversion to @rjsf/utils - Began adding tests * - Completed conversion for validator class-based tests. Just need to get to 100% 1 * - Finished 100% test coverage and documentation of the `AJV6Validator` * - Completed the documentation of the remaining methods and types for the library * - Responded to self-review feedback and also fixed tests to hopefully get it to pass * - Fixed the build (this time hopefully) * - Switched to just passing `stack` instead of the whole empty object * - Added hacky run of tests from within the utils directory * - Fixed a few little things * - Fixed bug in custom validation, including adding a test to detect it * - Removed schema utils test for `stubExistingAdditionalPropertiesTest()` as it no longer exists * - Fixed self-review feedback and the import in the `test/createAjvInstance.test.ts` - Also bumped all the packages that made sense * Update utils based on core refactor and update package.jsons (#2903) * Update utils based on core refactor and update package.jsons - Updated the main `package.json` to bump typescript - Updated the utils `package.json` to bump everything but react - Updated `SchemaUtilsType` to add the `getValidator()` and `doesSchemaUtilsDiffer()` functions - Updated `createSchemaUtils()` to implement the new functions and the tests to validate them - Also updated other types to deal with issues found during core refactor - Changed `FormValidation` to `ErrorSchema` as needed - Updated the `Registry` type to remove `definitions` as it is never used and added the `xxxTemplate` props - Updated many interfaces to make previously required props to be optional - Switched to using the `React.ComponentType` which incorporates the `FunctionComponent` and `ClassComponent` both - Fixed a bug in `getDefaultFormState()` by making the `array` defaults use effectively the same logic as it did in `core` but refactored to a function for type safety - Updated the tests to add one that verifies the bug is fixed * - rollback typescript to previous version due to `fluent-ui` issue * - Fixed bug in `getSchemaType()` related to incorrectly defaulting to `string` when no type exists * - Made `uiSchema` optional in `canExpand()`, `getSubmitButtonOptions()` and `getUiOptions()` - Updated the required-ness of a smattering of props in interfaces * - Made all callbacks be required again * - Made label required again * - More updates to make `uiSchema` optional * - Added new `processSelectValue()` utility, refactored from core's `SelectWidget`, with full tests - Also updated the `UIOptionsType` to add optional `title` and `description` props, typed to `string` to eliminate the need to type cast them * - Added documentation for the `[key: string]` prop * - Responded to reviewer feedback * Updated semantic-ui theme to use new @rjsf/utils and @rjsf/validator (#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 * Added ajvOptionsOverrides to support user-provided AJV options overriding (#2929) - Updated `CustomValidatorOptionsType` to add `ajvOptionsOverrides` - Updated the `createAjvInstance()` function to spread any `ajvOptionsOverrides` on top of the `AJV_CONFIG` - Updated `AJV6Validator` constructor to pass `ajvOptionsOverrides` to `createAjvInstance()` - Updated tests to add test-case for the `$data` flag mentioned in #1668 * Optimized and updated imports in core package.json (#2931) * Optimized and updated imports in core package.json - Updated `tsdx` build to also run umd, eliminating the need for the one-off webpack version build - Deleted the `test-old` and `build-umd` scripts - Added `@rjsf/utils` to `peerDependencies` - Removed all of the webpack and cross-env related packages no longer needed for the one-off build - Also removed `express`, `gh-pages`, `estraverse*` and `husky` - Updated a bunch of the `peerDependencies` package versions to the latest - Deleted the now unnecessary `webpack.config.dist.js` * - Removed `prettier` from `package.json` as it differs from the version used in the main `package.json` - Ran `cs-format` to fix all of the prettier errors reported by `cs-check` * - Bumped `prettier` to pickup latest typescript support - Switched from `jsxBracketSameLine: true` to `bracketSameLine: false` - Ran `cs-format` over `playground` as well * Added support for node 16, formatting and linting (validator-ajv6) (#2932) * Added support for node 16 and linting - Regenerated the `package-lock.json` file with node-16 - Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file * - Ran `cs-format` on the `validator-ajv6` source to fix build * - Switched the `no-unused-vars` rule to `@typescript-eslint/no-unused-vars` in `.eslintrc` * Added support for node 16, formatting and linting (utils) (#2933) * Added support for node 16, formatting and linting - Regenerated the `package-lock.json` file with node-16 - Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file - Ran `cs-format` over the `src` and `test` directories to fix the build * - Switched the `no-unused-vars` rule to `@typescript-eslint/no-unused-vars` in `.eslintrc` * Added support for node 16, formatting and linting (bootstrap-4) (#2936) * Added support for node 16, formatting and linting - Regenerated the `package-lock.json` file with node-16 - Also added packages to support linting - Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file - Ran `eslint --fix` and `cs-format` over the `src` and `test` directories to fix the build - Added a slight adaptation of the `.eslintrc` file from `core` to this package * - Fixed build * Added support for node 16, formatting and linting (fluent-ui) (#2938) * Added support for node 16, formatting and linting - Regenerated the `package-lock.json` file with node-16 - Also added packages to support linting - Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file - Ran `eslint --fix` and `cs-format` over the `src` and `test` directories to fix the build - Added a slight adaptation of the `.eslintrc` file from `core` to this package * - Fix build, hopefully * Added support for node 16, formatting and linting (semantic-ui) (#2939) - Regenerated the `package-lock.json` file with node-16 - Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file - Ran `cs-format` over the `src` and `test` directories to fix the build * Added support for node 16, formatting and linting (#2937) - Regenerated the `package-lock.json` file with node-16 - Also added packages to support linting - Explicity added the latest `prettier` because it in implicitly picking up the wrong one - Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file - Ran `eslint --fix` and `cs-format` over the `src` and `test` directories to fix the build - Added a slight adaptation of the `.eslintrc` file from `core` to this package - Added `.npmrc` to enable `legacy-peer-deps` to allow things to work with node 16 - Deleted `.prettierrc` since the override is no longer needed * Added support for node 16, formatting and linting (antd) (#2935) * Added support for node 16, formatting and linting - Regenerated the `package-lock.json` file with node-16 - Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file - Added `@babel/eslint-parser` and removed `babel-parser` - Ran `cs-format` over the `src` and `test` directories to fix the build - Updated `.eslintrc` to switch to using the `@babel/eslint-parser` with the necessary `parserOptions` * - Fix `package.json` formatting * Updated the playground to allow a validator selection (#2941) * Updated the playground to allow a validator selection - Defaults to the `ajv6` validator - Updated `package*.json` to add `@rjsf/utils` and `@rjsf/validator-ajv6` - Also removed a bunch of unnecessary packages - Bumped a bunch of other packages to the latest minor and patch version - Bumped a few select packages to the latest major version - Updated `.eslintrc` to switch from `babel-eslint` to `@babel/eslint-parser` - Updated the `index.js` file to add a `validators` object containing the `AJV6` validator choice, passing it into `Playground` - Updated the `app.js` file to get `shouldRender()` from `@rjsf/utils` instead of copying it from core - Also extracted `validators` from the props for `Playground`, storing `validator` in the state, initially set to `AJV6` - Added a `ValidatorSelector` component that is used to update the selected `validator` in state - Rendered a `ValidagtorSelector` just before the `CopyLink` component - Passed `validators[validator]` as the `validator` prop on `FormComponent` * - Ran `cs-format` to fix formatting issues and fix the build * Split out material-ui v5 theme as @rjsf/mui (#2948) * Split out material-ui v5 theme as @rjsf/mui - Copied the `material-ui` directory and removed the `@material-ui` dependencies - Deleted the `MuiComponentContext`, `MuiForm5`, `Theme5` and `ThemeCommon` directories (moving the contents of `ThemeCommon/index.js` directly into `Theme`) - Deleted the `MaterialUIContext` and `MaterialUIContextProps` files and everything in `Theme.tsx` that related to them - Replaced all fetching of the Material UI components from the `useMuiComponent()` hook with actual imports from `@mui/material` and `@mui/icons-material` - Regenerated the `package-lock.json` file with node-16 - Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file - Copied the `.eslintrc` file from `core` - This involved adding `@typescript-eslint`, `eslint` and `eslint-plugin-*` - Ran `eslint --fix` and `cs-format` over the `src` and `test` directories to fix the build * - Fix build by fixing a few little things * - Fixed playground imports to read from new repo * Made @rjsf/material-ui only be for Material UI 4 (#2949) - Deleted the `MuiComponentContext`, `MuiForm5`, `Theme5` and `ThemeCommon` directories (moving the contents of `ThemeCommon/index.js` directly into `Theme`) - Deleted the `MaterialUIContext` and `MaterialUIContextProps` files and everything in `Theme.tsx` that related to them - Replaced all fetching of the Material UI components from the `useMuiComponent()` hook with actual imports from `@material-ui/core` and `@material-ui/icons` - Deleted the `tests/mui-5` directory and fixed up the tests to work with the simple `Form` - Regenerated the `package-lock.json` file with node-16 - Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file - Copied the `.eslintrc` file from `core` - This involved adding `@typescript-eslint`, `eslint` and `eslint-plugin-*` - Ran `eslint --fix` and `cs-format` over the `src` and `test` directories to fix the build * Get node 16 build working, centralize lint configs and switch to dts-cli (#2951) * Get node 16 build working and centralize lint configs - Added `.eslintrc-javascript` for the common configs needed for `antd`, `playground` and `semantic-ui` - Added `.eslintrc-typescript` for the common configs needed for the rest of the packages - Updated `.github/workflows/ci.yml` to add node 16 and to build the playground using it instead of 14 - Updated `.gitignore` to add the few items from the `.gitignore` files in sub-packages - Removed the `.gitignore` in the sub-packages, along with the two `.editorconfig` files - Updated all of the `.eslintrc` files in the packages to extend the appropriate `.eslintrc-*script` file - Left the `plugins` array definitions in each `.eslintrc` file - Avoids an issue where eslint found the base and sub-package implementation of the plugins and complained when they were in the base - Updated the main `package*.json` to add the packages needed for linting so that they can be removed in the sub-packages - Updated each sub-package `package*.json` files to remove all but the `eslint` package (leaving it locally so that it can be run in the subdirectory) - Also bumped any out-of-date packages related to `babel` or `eslint` * - Replaced `tsdx` with its most current forked cousin `dts-cli` - This removed the need for the `.npmrc` file in `chakra-ui` * - Re-ran `npm run cs-format` due to prettier upgrades provided by `dts-cli` - Also fixed some typescript issues in `fluent-ui` related to object spreading by casting `options.props as object` * - Fixed tests due to change to `dts-cli` - Added `jest-environment-jsdom` and `ts-jest` that matches the jest version `dts-cli` uses in the main `package.json` - Updated `package.json`s to remove incompatible jest related packages - Updated and/or moved `jest.config.js` files to add `testEnvironment` and `testEnvironmentOptions` for `jsdom` - Updated `chakra-ui` and `mui` to add missing libraries for emotion and jest - Redid the `mui` snapshots after changes * - Rollback `semantic-ui` so that it still uses `tsdx` due to test failures using `dts-cli` * - Bumped `eslint` to 8.20 * Bumped the dependencies for semantic-ui (#2972) - Fixed react 16.14 adding >=17 in peer dependencies - Didn't bump to react 17 officially to avoid peer dependencies issues with `semantic-ui` which is stuck on 16 - Bumped nanoid to the latest minor version * Bump dependencies for both material-ui themes (#2971) - In `material-ui`, fixed react 16.14 in peer dependencies - In `mui`, bumped `@mui/material` to the latest - Removed `react-dom` and `@types/react` from the peer dependencies - Bumped eslint to latest release - Removed the types for jest as it was unnecessary * Bumped fluent-ui dependencies (#2970) - Bumped to latest minor version for `fluent-ui` - Bumped react to 17, fixing react 16.14 in peer dependencies - Removed unnecessary types for jest - Updated `SelectWidget` to properly use the right `defaultSelectedKey[s]` prop based on multiple flag - Updated test snapshots due to dependency bumps * Bumping dependencies for utils (#2969) - Bumped react to 17, fixing react 16.14 in peer dependencies - Removed `react-dom` because it wasn't needed * Bumping dependencies for core (#2968) - Bumped nanoid to latest - Bumped react to 17, fixing react 16.14 in peer dependencies * Bumped the dependencies for bootstrap-4 (#2967) - Can't bump to bootstrap-2, so bumped to latest 1.x version - Bumped react to 17, fixing react 16.14 in peer dependencies - Bumped `react-icons` to latest - Updated test snapshots due to changes from bumps * Bumped some of the dependencies for chakra-ui (#2965) - Can't upgrade to chakra-ui 2.0 because it requires react 18 - Locked peerDependencies for react to ^16.14.0 or >=17 - Bumped minor versions of `react-select`, `chakra-react-select` and `framer-motion` - Updated test snapshot as a result * Upgraded to latest antd code (#2963) * Upgraded to latest antd code - Added an additional test for the custom `DatePicker` - Fixed the `tests` for checkboxes in array that broke with upgrade by implementing a required ref - Updated all the test snapshots due to upgrade changes * - Fix build by running `cs-format` * - Bumped react to 17, fixing react 16.14 in peer dependencies * Switched playground to webpack 5 and other small fixes (#2958) * Switched playground to webpack 5 and other small fixes - Updated `.github/workflows/release.yml` to use node 16 - Updated the main `package.json` to remove `webpack` and `webpack-cli` as they are only needed by `playground` - Updated all of the `package.json` files for the themes to fix the `build` script to change `--format cjs,es,umd` to `--format cjs,esm,umd` - This is because `dts-cli` changed `es` to `esm` - Also updated `material-ui` to add that missing flag to `build` - Updated `.babelrc` to get it working with webpack 5 - Updated `package.json` for playground to update (or remove) `webpack` and all of its plugins and utilities - Explicitly added `ajv8` since `webpack-dev-server` uses it and the `validator-ajv6` has an earlier version - Updated the `webpack.config.*.js` files to support webpack 5 - Updated the `index.js` for playground to organize the themes in alphabetical order (after default) * - Bumped `antd` libraries to latest * - Updated theme libraries to match the ones in the updated theme `package.json` files * Update package-locks (#2973) - After merging all the package.json cleanups, some of the package-lock.json files were a bit out of date, updating them * Updated documentation for the v5 release (#2974) * Updated documentation for the v5 release - Updated `/latest/` with `/stable` for all `.md` files, mirroring changes made on master - Changed all uses of `<Form schema={schema} />` in existing documentation to add the required `validator` from `@rjsf/validator-ajv6` - Updated the `validation.md` docs to cover v5 changes and additions - Added a new `utility-function.md` to document the `@rjsf/utils` function, constants and types - Deleted the `customizing-material-ui.md` file since we split apart the two theme versions - Added the version 5 migration document - Updated `@rjsf/utils` to add or improve documentation - Also refactored out the `TemplateTypes` interfaces to help support future work related to expanding templates - Added a utility type, `MakeUIType` and refactored out `UIOptionsBaseType` in order to dry out the `UiOptionsType` and `UiSchema` types - Updated `Form` in `@rjsf/core` to move the `IChangeEvent` type from `utils` extending it from `FormState` - The props `validate` was renamed to `customValidate` - Also, updated `FormProps` to extend the new `TemplatesType` interface - Updated `withTheme` to add the missing generics onto `Form` * - Added placeholders for `core`'s missing documentation on the Typescript files * - Completed the documentation of all the Typescript based files in `core` - Responded to reviewer feedback - Added a few more constants in `@rjsf/utils`, using them as appropriate in utils and core * Fix the docs for formElement in Form (#2983) - Added an explanation for why the `any` type is specified * fix: core SubmitButton button option props * chore: remove duplicate settings from semantic-ui package.json * fix: missing error class on semantic-ui fields * Consolidate templates into a single location in registry (#2981) * Consolidate templates into a single location in registry - Updated `.eslint-typescript` to turn off two warnings that were noisy - Updated the `@rjsf/utils` types as follows to support a consolidated `templates` object: - Updated the `Registry` type to no longer extend `TemplateTypes`, but instead have it as a new `templates` property. - Updated the `TemplateTypes` type to consolidate more templates as follows: - Made all but `ArrayFieldTemplate` required - Refactored `ErrorList` from the `FormProps` as `ErrorListTemplate` - Added `TitleFieldTemplate` and `DescriptionFieldTemplate` - Updated `TitleFieldProps` to `registry` since all templates require a back-pointer to the `registry` - Also added `uiSchema` to support capabilities in use by several themes - Updated `DescriptionFieldProps` to add `registry` since all templates require a back-pointer to the `registry` - Updated the `ArrayFieldTemplateProps` and `ObjectFieldTemplateProps` to remove `TitleField` and `DescriptionField` since they can now be obtained from the `templates` - Also, updated `UiSchema` to add `Partial<>` around `TemplateTypes`, since we want the `ui:` versions to all be optional - Updated `@rjsf/core` to add `templates` to `Form` and `makeTheme` props - Removed the `ErrorList`, `ArrayFieldTemplate`, `ObjectFieldTemplate` and `FieldTemplate` from the props - Also modified `Form` to pull `ErrorListTemplate` from the `templates` prop - Created a new `templates` directory, moving in `TitleField` and `DescriptionField` from the `fields` directory - Created a `templates/FieldTemplate` directory, refactoring out the `FieldTemplate`, `Label` and `WrapIfAdditional` components from the `SchemaField.js` file - Converted these components to Typescript - Inlined the code from `LabelInput` directly into `WrapIfAdditional` - Updated `SchemaField.js` to pull `FieldTemplate` from `registry.templates` - Moved the `ErrorList.tsx` file into this directory - Refactored `ObjectFieldTemplate` component from the `ObjectField.js` file - Converted this to Typescript - Updated `ObjectField.js` to pull `DescriptionFieldTemplate`, `ObjectFieldTemplate` and `TitleFieldTemplate` from `registry.templates`, passing in `registry` - Updated `ArrayField.ts` to pull `DescriptionFieldTemplate` and `TitleFieldTemplate` from `registry.templates`, passing in `registry` - Updated `BooleanField` to no longer pass `DescriptionField` to the `Widget` - Updated `CheckboxWidget` to pull `DescriptionFieldTemplate` from `registry.templates`, passing in `registry` - Updated `getDefaultRegistry()` to import the new `templates` directory `index.ts` instead of all the separate templates, exporting it on the default `registry` - Fixed up all the tests to deal with this consolidation - Updated `@rjsf/antd` to consolidate `templates` as follows: - Moved `ErrorList.js` into the `templates/ErrorList` directory as `index.js` - Moved `DescriptionField` and `TitleField` into the `templates` directory - Removed the now, unnecessary commented out `FieldProps` from `DescriptionField` and `TitleField` - Also extracted `formContext` out of `registry` in `TitleField` - Updated the base `index.js` file to export `templates` by combining default `templates` with the files from the `templates` directories - Updated `@rjsf/bootstrap-4` to consolidate `templates` as follows: - Updated `DescriptionField` and `TitleField` to use the `DescriptionFieldProps` and `TitleFieldProps` from `@rjsf/utils` instead of `Partial<FieldProps>` - Updated `ArrayFieldTemplate.tsx` and `ObjectFieldTemplate.tsx` to pull `DescriptionFieldTemplate` and `TitleFieldTemplate` from `registry.templates` - Also, pass `registry` (and `uiSchema`) to the `DescriptionFieldTemplate` and `TitleFieldTemplate` - Renamed `Fields/Fields.ts` to `Templates/Templates.ts` - Also added `ArrayFieldTemplate`, `ErrorList` (as `ErrorListTemplate`), `FieldTemplate` and `ObjectFieldTemplate` to the `Templates` - Updated `Theme` to export `templates` from the `Templates` directory - Updated tests to deal with the consolidation - Updated `@rjsf/chakra-ui` to consolidate `templates` as follows: - Updated `DescriptionField` and `TitleField` to use the `DescriptionFieldProps` and `TitleFieldProps` from `@rjsf/utils` instead of `Partial<FieldProps>` - Updated `ArrayFieldTemplate.tsx` and `ObjectFieldTemplate.tsx` to pull `DescriptionFieldTemplate` and `TitleFieldTemplate` from `registry.templates` - Also, pass `registry` to the `DescriptionFieldTemplate` and `TitleFieldTemplate` - Renamed `Fields/Fields.ts` to `Templates/Templates.ts` - Also added `ArrayFieldTemplate`, `ErrorList` (as `ErrorListTemplate`), `FieldTemplate` and `ObjectFieldTemplate` to the `Templates` - Updated `Theme` to export `templates` from the `Templates` directory - Updated the base `index.ts` file to export the `Templates` directory in place of the `Fields` and individual templates, as well as fixed the `Form` export - Updated `@rjsf/fluent-ui` to consolidate `templates` as follows: - Updated `DescriptionField` and `TitleField` to use the `DescriptionFieldProps` and `TitleFieldProps` from `@rjsf/utils` instead of `Partial<FieldProps>` - Updated `ArrayFieldTemplate.tsx` and `ObjectFieldTemplate.tsx` to pull `DescriptionFieldTemplate` and `TitleFieldTemplate` from `registry.templates` - Also, pass `registry` to the `DescriptionFieldTemplate` and `TitleFieldTemplate` - Renamed `Fields/Fields.ts` to `Templates/Templates.ts` - Also added `ArrayFieldTemplate`, `ErrorList` (as `ErrorListTemplate`), `FieldTemplate` and `ObjectFieldTemplate` to the `Templates` - Updated `Theme` to export `templates` from the `Templates` directory - Updated the base `index.ts` file to export the `Templates` directory in place of the `Fields` and individual templates, as well as fixed the `Form` export - Updated `@rsjf/material-ui` and `@rjsf/mui` to considate `templates` as follows: - Updated `DescriptionField` and `TitleField` to use the `DescriptionFieldProps` and `TitleFieldProps` from `@rjsf/utils` instead of `Partial<FieldProps>` - Updated `ArrayFieldTemplate.tsx` and `ObjectFieldTemplate.tsx` to pull `DescriptionFieldTemplate` and `TitleFieldTemplate` from `registry.templates` - Also, pass `registry` to the `DescriptionFieldTemplate` and `TitleFieldTemplate` - Renamed `Fields/Fields.ts` to `Templates/Templates.ts` - Also added `ArrayFieldTemplate`, `ErrorList` (as `ErrorListTemplate`), `FieldTemplate` and `ObjectFieldTemplate` to the `Templates` - Updated `Theme` to export `templates` from the `Templates` directory - Updated the base `index.ts` file to export the `Templates` directory in place of the `Fields` and individual templates, as well as fixed the `Form` export - Fixed the tests as well - Updated the `@rjsf/semantic-ui` to consolidate `templates` as follows: - Updated `ArrayFieldTemplate.tsx` and `ObjectFieldTemplate.tsx` to pull `DescriptionFieldTemplate` and `TitleFieldTemplate` from `registry.templates` - Also, pass `registry` (and `uiSchema`) to the `DescriptionFieldTemplate` and `TitleFieldTemplate` - Renamed `Fields/Fields.ts` to `Templates/Templates.ts` - Also added `ArrayFieldTemplate`, `ErrorList` (as `ErrorListTemplate`), `FieldTemplate` and `ObjectFieldTemplate` to the `Templates` - Updated `FieldTemplate` to get the `DescriptionFieldTemplate` from `registry.templates` - Updated `Theme` to export `templates` from the `Templates` directory - Updated `TitleField` to get the `ui:options` from the `uiSchema` instead of having them passed directly - Updated the base `index.ts` file to export the `Templates` directory in place of the `Fields` and individual templates, as well as fixed the `Form` export * - Changed the name of `DescriptionField` and `TitleField` to append `Template` onto it only in association with the `templates` - Also, made them both render `id` for all the themes - Updated tests and snapshots accordingly * - Added documentation for the new typescript files in `core` * - Responded to self and other reviewer feedback * - Fixed bad commit in core imported by rebase * Prepare utils and tests for upcoming BaseInputTemplate work (#2986) * Prepare utils and tests for upcoming BaseInputTemplate work - Added the `BaseInputTemplate` type into the `TemplatesType` - Refactored code from `BaseInput` in `@rjsf/core` as `getInputProps()` - Added 100% unit tests - Consolidated all the various tests in different themes into all of the other themes - Updated the snapshots for all the new tests in all themes * - Fixed up test for material-ui themes by adding missing ref's required by the components - Also, for `material-ui` 4, add mock of `findDOMNode()` so that tests are all successful * - Updated all the snapshot due to the new and fixed tests in all the themes * - Fix chakra-ui's `WrapIfAdditional`, `CheckboxesWidget` and `RadioWidget` to generate stable label ids - Updated snapshots accordingly * - Updated `RadioWidget` in semantic UI to generate a stable names * Implement BaseInputTemplate in core (#2987) * Implement BaseInputTemplate in core - Updated `TemplateType` to make `BaseInputTemplate` required now - Refactored the `TextWidget.js` file into `BaseInputTemplate.tsx`, adding support for number transforms - Refactored (and converted to Typescript) the following widgets to use the `BaseInputTemplate` for their implementations - `ColorWidget`, `DateTimeWidget`, `DateWidget`, `EmailWidget`, `PasswordWidget`, `RangeWidget`, `TextWidget`, `URLWidget` and `UpDownWidget` - Updated all of the tests to use `BaseInputWidget` in `templates` instead of `BaseInput` in `widgets` - Updated `bootstrap-4`, `material-ui` and `mui` themes to add `TextWidget` as the `BaseInputTemplate` temporarily to fix tests * - Updated `semantic-ui` test snapshot due to changes in core * Remove Node 12, use Node 16 as default engine, add Node 18 to build (#2996) * Deprecate Node 12, use Node 16 as default engine * Add engine to validator-ajv6 * Implement BaseInputTemplate in bootstrap-4 (#2990) - Refactored `TextWidget` as `BaseInputTemplate`, using the `getInputProps()` to implement `core` feature - Deleted the following widgets because they are now just duplicate code to what is implemented with the template in `core` - `ColorWidget`, `DateTimeWidget`, `DateWidget`, `EmailWidget`, `PasswordWidget`, `URLWidget`, `UpDownWidget` - Updated the `widgets` overrides in `Widgets.js` to remove the deleted class references - Updated `WrapIfAdditional` to add missing `htmlFor` - Updated `FileWidget` and `RangeWidget` to use the `BaseInputTemplate` - Updated the test snapshots to match the subtle little changes caused by the `getInputProps()` feature and increased use of the `BaseInputTemplate` - Also deleted some tests and snapshots that were for now deleted widgets * Implement BaseInputTemplate in chakra-ui (#2991) - Refactored `TextWidget` as `BaseInputTemplate`, using the `getInputProps()` to implement `core` feature - Deleted the following widgets because they are now just duplicate code to what is implemented with the template in `core` - `ColorWidget`, `DateTimeWidget`, `DateWidget`, `EmailWidget`, `PasswordWidget`, `URLWidget` - Updated the `widgets` overrides in `Widgets.tsx` to remove the deleted class references - Updated the test snapshots to match the subtle little changes caused by the `getInputProps()` feature and increased use of the `BaseInputTemplate` * Implement BaseInputTemplate in fluent-ui (#2992) - Refactored `TextWidget` as `BaseInputTemplate`, using the `getInputProps()` to implement `core` feature - Deleted the following widgets because they are now just duplicate code to what is implemented with the template in `core` - `AltDateTimeWidget`, `AltDateWidget`, `EmailWidget`, `PasswordWidget`, `URLWidget` - Updated the `widgets` overrides in `Widgets.tsx` to remove the deleted class references - Updated `TextareaWidget` to use the `BaseInputTemplate` - Updated the test snapshots to match the subtle little changes caused by the `getInputProps()` feature and increased use of the `BaseInputTemplate` * Implement BaseInputTemplate in material-ui (#2993) - Refactored `TextWidget` as `BaseInputTemplate`, using the `getInputProps()` to implement `core` feature - Deleted the following widgets because they are now just duplicate code to what is implemented with the template in `core` - `ColorWidget`, `EmailWidget`, `PasswordWidget`, `URLWidget`, `UpDownWidget` - Updated the `widgets` overrides in `Widgets.tsx` to remove the deleted class references - Updated `CheckboxesWidget`, `RadioWidget` to add missing `id` associated with the `htmlFor` - Updated `DateTimeWidget` `DateWidget` and `TextareaWidget` to use the `BaseInputTemplate` - Updated the test snapshots to match the subtle little changes caused by the `getInputProps()` feature and increased use of the `BaseInputTemplate` - Also deleted some tests and snapshots that were for now deleted widgets * Implement BaseInputTemplate in mui (#2994) - Refactored `TextWidget` as `BaseInputTemplate`, using the `getInputProps()` to implement `core` feature - Deleted the following widgets because they are now just duplicate code to what is implemented with the template in `core` - `ColorWidget`, `EmailWidget`, `PasswordWidget`, `URLWidget`, `UpDownWidget` - Updated the `widgets` overrides in `Widgets.tsx` to remove the deleted class references - Updated `CheckboxesWidget`, `RadioWidget` to add missing `id` associated with the `htmlFor` - Updated `DateTimeWidget` `DateWidget` and `TextareaWidget` to use the `BaseInputTemplate` - Updated the test snapshots to match the subtle little changes caused by the `getInputProps()` feature and increased use of the `BaseInputTemplate` - Also deleted some tests and snapshots that were for now deleted widgets * Implement BaseInputTemplate in semantic-ui (#2995) - Refactored `TextWidget` as `BaseInputTemplate`, using the `getInputProps()` to implement `core` feature - Yes, git thinks it was the `EmailWidget` but it was actually `TextWidget` - Deleted the following widgets because they are now just duplicate code to what is implemented with the template in `core` - `DateTimeWidget`, `DateWidget`, `EmailWidget`, `PasswordWidget`, `URLWidget`, `UpDownWidget` - Updated the `widgets` overrides in `Widgets.tsx` to remove the deleted class references - Updated `RadioWidget` to improve the name of the `Radio` buttons - Updated the test snapshots to match the subtle little changes caused by the `getInputProps()` feature and increased use of the `BaseInputTemplate` - Also deleted some tests and snapshots that were for now deleted widgets * Implement BaseInputTemplate in antd (#2989) - Refactored `TextWidget` as `BaseInputTemplate`, using the `getInputProps()` to implement `core` feature - Deleted the following widgets because they are now just duplicate code to what is implemented with the template in `core` - `ColorWidget`, `EmailWidget`, `URLWidget`, `UpDownWidget` - Updated the `widgets` overrides in `index.js` to remove the deleted class references - Updated the test snapshots to match the subtle little changes caused by the `getInputProps()` feature and increased use of the `BaseInputTemplate` * Add precommit script to all packages missing it (#3004) - Copied the `precommit: lint-staged` from `core` into all of the packages missing it - Also updated to husky v8 and lint-staged to v13 * Remove unnecessary lodash uses (#2997) * Remove unnecessary lodash dependencies * revert some changes * readd newline * Refactored the ArrayFieldTemplate into 4 templates (#3001) * Refactored the ArrayFieldTemplate into 4 templates - Updated the `types` in `@rjsf/utils` to make `ArrayFieldTemplate` required as well as adding the following 3 new templates: - `ArrayFieldDescriptionTemplate`, `ArrayFieldItemTemplate` and `ArrayFieldTitleTemplate` - Also added to new types `ArrayFieldDescriptionProps` and `ArrayFieldTitleProps` - Updated the `core` theme to support the updated `ArrayFeildTemplate`s as follows: - Refactored the `ArrayFieldDescription` and `ArrayFieldTitle` from `ArrayField.js` as `ArrayFieldDescriptionTemplate` and `ArrayFieldTitleTemplate` - These new Typescript classes were added into the `Templates` directory - These two new templates were essentially the same across all themes, but made a template just in case and so they can be used in all themes - Refactored the `DefaultArrayItem` component from `ArrayField.js` as `ArrayFieldItemTemplate` as a new Typescript file in the `Templates` directory - Refactored the `DefaultNormalArrayFieldTemplate` from `ArrayField.js` as `ArrayFieldTemplate` as a new Typescript file in the `Templates` directory - Turns out the `DefaultFixedArrayFieldTemplate` was essentially the same as the other template (and was never customized in any of the themes) - As a result, this template was deemed unnecessary - Updated the `antd` theme to support the updated `ArrayFieldTemplate`s as follows: - Renamed the `ArrayFieldTemplateItem` component as `ArrayFieldItemTemplate` in its own directory - Renamed the `NormalArrayFieldTemplate` as `ArrayFieldTemplate` (ignore git) - Switched to using the `ArrayFieldDescriptionTemplate`, `ArrayFieldItemTemplate` and `ArrayFieldTitleTemplate` from the templates directory - Deleted the main `ArrayFieldTemplate/index.js` and `FixedArrayFieldTemplate.js` files from the directory - Updated the `Templates.tsx` file to add the `ArrayFieldItemTemplate` into the `templates` object - Updated the `bootstrap-4` theme to support the updated `ArrayFieldTemplates`s as follows: - Refactored the `DefaultArrayItem` component from `ArrayFieldTemplate` as `ArrayFieldItemTemplate` in its own directory - Updated `ArrayFieldTemplate` by deleting all the unnecessary code, turning the `DefaultNormalArrayFieldTemplate` into the `ArrayFieldTemplate` - Used the `ArrayFieldDescriptionTemplate`, `ArrayFieldItemTemplate` and `ArrayFieldTitleTemplate` from `registry.templates` - Updated the `Templates.tsx` file to add the `ArrayFieldItemTemplate` into the `templates` object - Deleted the test and snapshot for `ArrayFieldTemplates` since it was already covered elsewhere - Updated the `registry` mock to pull `templates` from the `getDefaultRegistry()`, overriding with the theme `Templates` - Updated the `chakra-ui` theme to support the updated `ArrayFieldTemplates`s as follows: - Refactored the `DefaultArrayItem` component from `ArrayFieldTemplate` as `ArrayFieldItemTemplate` in its own directory - Updated `ArrayFieldTemplate` by deleting all the unnecessary code, turning the `DefaultNormalArrayFieldTemplate` into the `ArrayFieldTemplate` - Used the `ArrayFieldDescriptionTemplate`, `ArrayFieldItemTemplate` and `ArrayFieldTitleTemplate` from `registry.templates` - Updated the `Templates.tsx` file to add the `ArrayFieldItemTemplate` into the `templates` object - Updated the `chakra-ui` theme to support the updated `ArrayFieldTemplates`s as follows: - Refactored the `DefaultArrayItem` component from `ArrayFieldTemplate` as `ArrayFieldItemTemplate` in its own directory - Updated `ArrayFieldTemplate` by deleting all the unnecessary code, turning the `DefaultNormalArrayFieldTemplate` into the `ArrayFieldTemplate` - Used the `ArrayFieldDescriptionTemplate`, `ArrayFieldItemTemplate` and `ArrayFieldTitleTemplate` from `registry.templates` - Updated the `Templates.tsx` file to add the `ArrayFieldItemTemplate` into the `templates` object - Updated the snapshot for the array templates to pick up the little changes from the refactor - Updated the `material-ui` and `mui` themes to support the updated `ArrayFieldTemplates`s as follows: - Refactored the `DefaultArrayItem` component from `ArrayFieldTemplate` as `ArrayFieldItemTemplate` in its own directory - Updated `ArrayFieldTemplate` by deleting all the unnecessary code, turning the `DefaultNormalArrayFieldTemplate` into the `ArrayFieldTemplate` - Used the `ArrayFieldDescriptionTemplate`, `ArrayFieldItemTemplate` and `ArrayFieldTitleTemplate` from `registry.templates` - Updated the `Templates.tsx` file to add the `ArrayFieldItemTemplate` into the `templates` object - Deleted the `UpDownWidget` tests and snapshots because they are duplicated in the `Form` tests - Updated the `semantic-ui` theme to support the updated `ArrayFieldTemplates`s as follows: - Refactored the `DefaultArrayItem` component from `ArrayFieldTemplate` as `ArrayFieldItemTemplate` in its own directory - Updated `ArrayFieldTemplate` by deleting all the unnecessary code, turning the `DefaultNormalArrayFieldTemplate` into the `ArrayFieldTemplate` - Used the `ArrayFieldDescriptionTemplate`, `ArrayFieldItemTemplate` and `ArrayFieldTitleTemplate` from `registry.templates` - Updated the `Templates.tsx` file to add the `ArrayFieldItemTemplate` into the `templates` object * - Responded to reviewer feedback * add nx to monorepo (#2998) * add nx to monorepo * fixed lockfile issue * remove nx cloud access token Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com> Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com> * Migrate core widget folder to typescript (#3006) * Migrate core widget folder to typescript * Adressed PR feedback * Addressed additional PR comments * Addressed additional PR comments * fix : semantic-ui error class on fields (#3009) * Converted core fields to Typescript (#3007) * Converted the fields to Typescript - Updated the `@rjsf/utils` types and functions based on necessary changes needed for the conversion as follows: - In `types.ts` some improvements and new types were discovered as follows: - Modified the `RJSFSchema` to add the non-standard `enumNames` property onto the `JSONSchema7` to support the `Field`s - Added a new `EnumOptionsType` required for some of the fields - Added a new `UnsupportedFieldProps` type for the new `UnsupportedFieldTemplate` on `TemplatesType` - Removed the `fields` property on `FieldTemplateProps` since that data can be easily obtained from the `registry` - Added the `rawErrors` property to `ArrayFieldTemplateProps` since it was needed `ArrayField` - Added the missing `T` generic on a few uses of `IdSchema` properties on a few types - Updated the `WidgetProps` type to combine the `options` property with an additional, optional `enumOptions` property as needed by widgets - Updated the `UIOptionsBaseType` to have it combined with the `TemplatesType` making it require the `T` and `F` generics as well as adding the following new properties: - `classNames` was added as a breaking change (it used to simply be `classNames` in `UiSchema` but now it will be `ui:classNames` or `ui:options: { classNames }` - This makes `classNames` consistent with all the other ui options - `orderable` and `removable` were added to support the `ArrayField` - `widget` was added to support many of the `Field`s - Updated `UIOptionsType` to also take the `T` and `F` generics - Updated `SchemaUtilsType.retrieveSchema()` to make the `formData` parameter optional, like it already is on the wrapped function - Updated the `getUiOptions()` function to add the `T` and `F` generics to the return value type - Updated `getWidget()` to make the `widget` property optional, updating the tests accordingly - Updated `isCustomWidget()` to make `uiSchema` default to an empty object if missing, updating the tests accordingly - Updated `optionsList` to remove the `enumNames` hack and to return the new `EnumOptionsType[] | undefined` type - Updated `FieldTemplate` for `antd` to remove the commented out `fields` variable since it was removed from the `FieldTemplateProps` - Refactored `ArrayField.js` to `ArrayField.tsx` converting things to typescript - Made the `FieldProps` use the `T[]` generic based on the `ArrayField`'s `T` generic since `formData` should always be an array - There were many places where type safety checks were required along with custom casts to deal with `T` vs `T[]` issues - Exported `ArrayField` cast as a `Field` to allow it to be used properly in the `index.ts` - Refactored `BooleanField.js` to `BooleanField.tsx` converting things to typescript - Refactored `MultiSchemaField.js` to `MultiSchemaField.tsx` converting things to typescript - Refactored `NullField.js` to `NullField.tsx` converting things to typescript - Refactored `NumberField.js` to `NumberField.tsx` converting things to typescript as well as making it a stateless functional component with `useState()` instead of a class - Refactored `ObjectField.js` to `ObjectField.tsx` converting things to typescript - Refactored `SchemaField.js` to `SchemaField.tsx` converting things to typescript - Updated the code to deal with the `classNames` now coming from `ui:` options, including updating tests accordingly adding a new one for the new case inside of `ui:options` - Refactored `StringField.js` to `StringField.tsx` converting things to typescript - Refactored `fields/index.js` to `fields/index.ts` adding the proper type for the returned object - Updated `ArrayFieldTemplate` to add the missing `T` and `F` generics required for `getUiOptions()` - Updated `ObjectFieldTemplate` to add the `T` and `F` generics ont…
- Loading branch information