@oracle/oraclejet-core-pack 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/oj-c/Avatar.json +458 -0
- package/oj-c/Button.json +536 -0
- package/oj-c/Collapsible.json +396 -0
- package/oj-c/FilePicker.json +555 -0
- package/oj-c/InputNumber.json +1321 -0
- package/oj-c/InputPassword.json +1164 -0
- package/oj-c/InputText.json +1411 -0
- package/oj-c/ListItemLayout.json +313 -0
- package/oj-c/MessageToast.json +334 -0
- package/oj-c/MeterBar.json +735 -0
- package/oj-c/MeterCircle.json +797 -0
- package/oj-c/ProgressBar.json +212 -0
- package/oj-c/ProgressCircle.json +223 -0
- package/oj-c/RatingGauge.json +495 -0
- package/oj-c/SelectMultiple.json +1143 -0
- package/oj-c/SelectSingle.json +1450 -0
- package/oj-c/SplitMenuButton.json +495 -0
- package/oj-c/TextArea.json +1283 -0
- package/oj-c/avatar/__webdriver__/AvatarWebElement.js +32 -0
- package/oj-c/avatar/__webdriver__/AvatarWebElementBase.js +87 -0
- package/oj-c/avatar/__webdriver__/index.js +74 -0
- package/oj-c/avatar/avatar-styles.css +10 -0
- package/oj-c/avatar/avatar.js +27 -0
- package/oj-c/avatar/component.json +227 -0
- package/oj-c/avatar/index.js +6 -0
- package/oj-c/avatar.js +6 -0
- package/oj-c/button/__tests__/button.test.js +20 -0
- package/oj-c/button/__webdriver__/ButtonWebElement.js +96 -0
- package/oj-c/button/__webdriver__/ButtonWebElementBase.js +96 -0
- package/oj-c/button/__webdriver__/index.js +74 -0
- package/oj-c/button/button-styles.css +11 -0
- package/oj-c/button/button.js +71 -0
- package/oj-c/button/component.json +243 -0
- package/oj-c/button/index.js +6 -0
- package/oj-c/button.js +6 -0
- package/oj-c/collapsible/__webdriver__/CollapsibleWebElement.js +116 -0
- package/oj-c/collapsible/__webdriver__/CollapsibleWebElementBase.js +60 -0
- package/oj-c/collapsible/__webdriver__/index.js +74 -0
- package/oj-c/collapsible/collapsible-styles.css +11 -0
- package/oj-c/collapsible/collapsible.js +69 -0
- package/oj-c/collapsible/component.json +184 -0
- package/oj-c/collapsible/index.js +6 -0
- package/oj-c/collapsible.js +6 -0
- package/oj-c/component.json +104 -0
- package/oj-c/corepackbundle.js +4049 -0
- package/oj-c/docs/avatar.html +149 -0
- package/oj-c/docs/button.html +149 -0
- package/oj-c/docs/collapsible.html +149 -0
- package/oj-c/docs/file-picker.html +149 -0
- package/oj-c/docs/index.html +168 -0
- package/oj-c/docs/input-number.html +149 -0
- package/oj-c/docs/input-password.html +149 -0
- package/oj-c/docs/input-text.html +149 -0
- package/oj-c/docs/jsDocMd.json +1 -0
- package/oj-c/docs/list-item-layout.html +149 -0
- package/oj-c/docs/message-toast.html +149 -0
- package/oj-c/docs/meter-bar.html +149 -0
- package/oj-c/docs/meter-circle.html +149 -0
- package/oj-c/docs/oj-c.Avatar.html +1778 -0
- package/oj-c/docs/oj-c.Button.html +2065 -0
- package/oj-c/docs/oj-c.Collapsible.html +1990 -0
- package/oj-c/docs/oj-c.FilePicker.html +2380 -0
- package/oj-c/docs/oj-c.InputNumber.html +5850 -0
- package/oj-c/docs/oj-c.InputPassword.html +4891 -0
- package/oj-c/docs/oj-c.InputText.html +5772 -0
- package/oj-c/docs/oj-c.ListItemLayout.html +1549 -0
- package/oj-c/docs/oj-c.MessageToast.html +1574 -0
- package/oj-c/docs/oj-c.MeterBar.html +3193 -0
- package/oj-c/docs/oj-c.MeterCircle.html +3502 -0
- package/oj-c/docs/oj-c.ProgressBar.html +1122 -0
- package/oj-c/docs/oj-c.ProgressCircle.html +1138 -0
- package/oj-c/docs/oj-c.RatingGauge.html +2320 -0
- package/oj-c/docs/oj-c.SelectMultiple.html +4720 -0
- package/oj-c/docs/oj-c.SelectSingle.html +5920 -0
- package/oj-c/docs/oj-c.SplitMenuButton.html +1891 -0
- package/oj-c/docs/oj-c.TextArea.html +5447 -0
- package/oj-c/docs/progress-bar.html +149 -0
- package/oj-c/docs/progress-circle.html +149 -0
- package/oj-c/docs/rating-gauge.html +149 -0
- package/oj-c/docs/scripts/deprecated.js +268 -0
- package/oj-c/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/oj-c/docs/scripts/prettify/lang-css.js +9 -0
- package/oj-c/docs/scripts/prettify/prettify.js +35 -0
- package/oj-c/docs/select-multiple.html +149 -0
- package/oj-c/docs/select-single.html +149 -0
- package/oj-c/docs/split-menu-button.html +149 -0
- package/oj-c/docs/styles/images/bookmark.png +0 -0
- package/oj-c/docs/styles/images/linesarrowup.png +0 -0
- package/oj-c/docs/styles/images/linesarrowup_blue.png +0 -0
- package/oj-c/docs/styles/images/linesarrowup_hov.png +0 -0
- package/oj-c/docs/styles/images/linesarrowup_white.png +0 -0
- package/oj-c/docs/styles/images/oracle_logo_sm.png +0 -0
- package/oj-c/docs/styles/jsdoc-default.css +851 -0
- package/oj-c/docs/styles/prettify-jsdoc.css +111 -0
- package/oj-c/docs/styles/prettify-tomorrow.css +132 -0
- package/oj-c/docs/text-area.html +149 -0
- package/oj-c/editable-value/UNSAFE_useAssistiveText/useAssistiveText.js +57 -0
- package/oj-c/editable-value/UNSAFE_useComponentMessaging/useComponentMessaging.js +80 -0
- package/oj-c/editable-value/UNSAFE_useConverter/useConverter.js +56 -0
- package/oj-c/editable-value/UNSAFE_useConverterLifecycle/useConverterLifecycle.js +26 -0
- package/oj-c/editable-value/UNSAFE_useDeferredValidators/useDeferredValidators.js +22 -0
- package/oj-c/editable-value/UNSAFE_useEditableValue/useEditableValue.js +154 -0
- package/oj-c/editable-value/UNSAFE_useStaleIdentity/useStaleIdentity.js +17 -0
- package/oj-c/editable-value/UNSAFE_useValidationLifecycle/useValidationLifecycle.js +118 -0
- package/oj-c/editable-value/UNSAFE_useValidators/useValidators.js +153 -0
- package/oj-c/editable-value/UNSAFE_useValue/useValue.js +42 -0
- package/oj-c/editable-value/UNSAFE_useValueLifecycle/useValueLifecycle.js +27 -0
- package/oj-c/editable-value/component.json +9 -0
- package/oj-c/editable-value/utils/utils.js +31 -0
- package/oj-c/file-picker/__webdriver__/FilePickerWebElement.js +32 -0
- package/oj-c/file-picker/__webdriver__/FilePickerWebElementBase.js +87 -0
- package/oj-c/file-picker/__webdriver__/index.js +74 -0
- package/oj-c/file-picker/component.json +209 -0
- package/oj-c/file-picker/file-picker-styles.css +17 -0
- package/oj-c/file-picker/file-picker.js +59 -0
- package/oj-c/file-picker/index.js +6 -0
- package/oj-c/file-picker.js +6 -0
- package/oj-c/hooks/UNSAFE_useDataProvider/DataProviderHandler.js +89 -0
- package/oj-c/hooks/UNSAFE_useDataProvider/useDataProvider.js +25 -0
- package/oj-c/hooks/UNSAFE_useDataProvider/utils.js +202 -0
- package/oj-c/hooks/UNSAFE_useListData/__tests__/useListData.test.js +124 -0
- package/oj-c/hooks/UNSAFE_useListData/useListData.js +297 -0
- package/oj-c/hooks/UNSAFE_useTreeData/__tests__/useTreeData.test.js +62 -0
- package/oj-c/hooks/UNSAFE_useTreeData/useTreeData.js +130 -0
- package/oj-c/hooks/component.json +9 -0
- package/oj-c/input-number/__dev__/input-number.doc.mdx +31 -0
- package/oj-c/input-number/__webdriver__/InputNumberWebElement.js +32 -0
- package/oj-c/input-number/__webdriver__/InputNumberWebElementBase.js +339 -0
- package/oj-c/input-number/__webdriver__/index.js +74 -0
- package/oj-c/input-number/component.json +536 -0
- package/oj-c/input-number/index.js +6 -0
- package/oj-c/input-number/input-number-styles.css +13 -0
- package/oj-c/input-number/input-number.js +119 -0
- package/oj-c/input-number/stepBasisUtils.js +76 -0
- package/oj-c/input-number/useImplicitNumberConverter.js +12 -0
- package/oj-c/input-number/useImplicitNumberRangeValidator.js +28 -0
- package/oj-c/input-number/useNumberInputTextPreact.js +153 -0
- package/oj-c/input-number.js +6 -0
- package/oj-c/input-password/__webdriver__/InputPasswordWebElement.js +32 -0
- package/oj-c/input-password/__webdriver__/InputPasswordWebElementBase.js +258 -0
- package/oj-c/input-password/__webdriver__/index.js +74 -0
- package/oj-c/input-password/component.json +488 -0
- package/oj-c/input-password/index.js +6 -0
- package/oj-c/input-password/input-password-styles.css +13 -0
- package/oj-c/input-password/input-password.js +112 -0
- package/oj-c/input-password/useInputPasswordPreact.js +46 -0
- package/oj-c/input-password.js +6 -0
- package/oj-c/input-text/__dev__/input-text.doc.mdx +30 -0
- package/oj-c/input-text/__tests__/input-text.test.js +70 -0
- package/oj-c/input-text/__webdriver__/InputTextWebElement.js +32 -0
- package/oj-c/input-text/__webdriver__/InputTextWebElementBase.js +294 -0
- package/oj-c/input-text/__webdriver__/index.js +74 -0
- package/oj-c/input-text/component.json +580 -0
- package/oj-c/input-text/index.js +6 -0
- package/oj-c/input-text/input-text-styles.css +13 -0
- package/oj-c/input-text/input-text.js +118 -0
- package/oj-c/input-text/useInputTextPreact.js +46 -0
- package/oj-c/input-text.js +6 -0
- package/oj-c/list-item-layout/__webdriver__/ListItemLayoutWebElement.js +32 -0
- package/oj-c/list-item-layout/__webdriver__/ListItemLayoutWebElementBase.js +42 -0
- package/oj-c/list-item-layout/__webdriver__/index.js +74 -0
- package/oj-c/list-item-layout/component.json +139 -0
- package/oj-c/list-item-layout/index.js +6 -0
- package/oj-c/list-item-layout/list-item-layout-styles.css +12 -0
- package/oj-c/list-item-layout/list-item-layout.js +30 -0
- package/oj-c/list-item-layout.js +6 -0
- package/oj-c/message-toast/__webdriver__/MessageToastWebElement.js +32 -0
- package/oj-c/message-toast/__webdriver__/MessageToastWebElementBase.js +78 -0
- package/oj-c/message-toast/__webdriver__/index.js +74 -0
- package/oj-c/message-toast/component.json +244 -0
- package/oj-c/message-toast/index.js +6 -0
- package/oj-c/message-toast/message-toast-styles.css +8 -0
- package/oj-c/message-toast/message-toast.js +35 -0
- package/oj-c/message-toast.js +6 -0
- package/oj-c/metadata/allComponents.json +5552 -0
- package/oj-c/meter-bar/__webdriver__/MeterBarWebElement.js +32 -0
- package/oj-c/meter-bar/__webdriver__/MeterBarWebElementBase.js +195 -0
- package/oj-c/meter-bar/__webdriver__/index.js +74 -0
- package/oj-c/meter-bar/component.json +246 -0
- package/oj-c/meter-bar/index.js +6 -0
- package/oj-c/meter-bar/meter-bar-styles.css +21 -0
- package/oj-c/meter-bar/meter-bar.js +44 -0
- package/oj-c/meter-bar.js +6 -0
- package/oj-c/meter-circle/__webdriver__/MeterCircleWebElement.js +32 -0
- package/oj-c/meter-circle/__webdriver__/MeterCircleWebElementBase.js +213 -0
- package/oj-c/meter-circle/__webdriver__/index.js +74 -0
- package/oj-c/meter-circle/component.json +289 -0
- package/oj-c/meter-circle/index.js +6 -0
- package/oj-c/meter-circle/meter-circle-styles.css +14 -0
- package/oj-c/meter-circle/meter-circle.js +47 -0
- package/oj-c/meter-circle.js +6 -0
- package/oj-c/min/avatar/avatar-styles.css +10 -0
- package/oj-c/min/avatar.js +2 -0
- package/oj-c/min/avatar.js.map +1 -0
- package/oj-c/min/button/button-styles.css +11 -0
- package/oj-c/min/button.js +2 -0
- package/oj-c/min/button.js.map +1 -0
- package/oj-c/min/collapsible/collapsible-styles.css +11 -0
- package/oj-c/min/collapsible.js +2 -0
- package/oj-c/min/collapsible.js.map +1 -0
- package/oj-c/min/corepackbundle.css +226 -0
- package/oj-c/min/corepackbundle.js +6 -0
- package/oj-c/min/corepackbundle.js.map +1 -0
- package/oj-c/min/editable-value/UNSAFE_useAssistiveText/useAssistiveText.d.ts +32 -0
- package/oj-c/min/editable-value/UNSAFE_useAssistiveText/useAssistiveText.js +57 -0
- package/oj-c/min/editable-value/UNSAFE_useComponentMessaging/useComponentMessaging.d.ts +24 -0
- package/oj-c/min/editable-value/UNSAFE_useComponentMessaging/useComponentMessaging.js +80 -0
- package/oj-c/min/editable-value/UNSAFE_useConverter/useConverter.d.ts +14 -0
- package/oj-c/min/editable-value/UNSAFE_useConverter/useConverter.js +56 -0
- package/oj-c/min/editable-value/UNSAFE_useConverterLifecycle/useConverterLifecycle.d.ts +11 -0
- package/oj-c/min/editable-value/UNSAFE_useConverterLifecycle/useConverterLifecycle.js +26 -0
- package/oj-c/min/editable-value/UNSAFE_useDeferredValidators/useDeferredValidators.d.ts +8 -0
- package/oj-c/min/editable-value/UNSAFE_useDeferredValidators/useDeferredValidators.js +22 -0
- package/oj-c/min/editable-value/UNSAFE_useEditableValue/useEditableValue.d.ts +47 -0
- package/oj-c/min/editable-value/UNSAFE_useEditableValue/useEditableValue.js +154 -0
- package/oj-c/min/editable-value/UNSAFE_useStaleIdentity/useStaleIdentity.d.ts +5 -0
- package/oj-c/min/editable-value/UNSAFE_useStaleIdentity/useStaleIdentity.js +17 -0
- package/oj-c/min/editable-value/UNSAFE_useValidationLifecycle/useValidationLifecycle.d.ts +15 -0
- package/oj-c/min/editable-value/UNSAFE_useValidationLifecycle/useValidationLifecycle.js +118 -0
- package/oj-c/min/editable-value/UNSAFE_useValidators/useValidators.d.ts +35 -0
- package/oj-c/min/editable-value/UNSAFE_useValidators/useValidators.js +153 -0
- package/oj-c/min/editable-value/UNSAFE_useValue/useValue.d.ts +23 -0
- package/oj-c/min/editable-value/UNSAFE_useValue/useValue.js +42 -0
- package/oj-c/min/editable-value/UNSAFE_useValueLifecycle/useValueLifecycle.d.ts +9 -0
- package/oj-c/min/editable-value/UNSAFE_useValueLifecycle/useValueLifecycle.js +27 -0
- package/oj-c/min/editable-value/component.json +9 -0
- package/oj-c/min/editable-value/utils/utils.d.ts +6 -0
- package/oj-c/min/editable-value/utils/utils.js +31 -0
- package/oj-c/min/file-picker/file-picker-styles.css +17 -0
- package/oj-c/min/file-picker.js +2 -0
- package/oj-c/min/file-picker.js.map +1 -0
- package/oj-c/min/hooks/UNSAFE_useDataProvider/DataProviderHandler.d.ts +18 -0
- package/oj-c/min/hooks/UNSAFE_useDataProvider/DataProviderHandler.js +89 -0
- package/oj-c/min/hooks/UNSAFE_useDataProvider/useDataProvider.d.ts +10 -0
- package/oj-c/min/hooks/UNSAFE_useDataProvider/useDataProvider.js +25 -0
- package/oj-c/min/hooks/UNSAFE_useDataProvider/utils.d.ts +3 -0
- package/oj-c/min/hooks/UNSAFE_useDataProvider/utils.js +202 -0
- package/oj-c/min/hooks/UNSAFE_useListData/__tests__/useListData.test.d.ts +1 -0
- package/oj-c/min/hooks/UNSAFE_useListData/__tests__/useListData.test.js +124 -0
- package/oj-c/min/hooks/UNSAFE_useListData/useListData.d.ts +21 -0
- package/oj-c/min/hooks/UNSAFE_useListData/useListData.js +297 -0
- package/oj-c/min/hooks/UNSAFE_useTreeData/__tests__/useTreeData.test.d.ts +1 -0
- package/oj-c/min/hooks/UNSAFE_useTreeData/__tests__/useTreeData.test.js +62 -0
- package/oj-c/min/hooks/UNSAFE_useTreeData/useTreeData.d.ts +27 -0
- package/oj-c/min/hooks/UNSAFE_useTreeData/useTreeData.js +130 -0
- package/oj-c/min/hooks/component.json +9 -0
- package/oj-c/min/input-number/input-number-styles.css +13 -0
- package/oj-c/min/input-number.js +2 -0
- package/oj-c/min/input-number.js.map +1 -0
- package/oj-c/min/input-password/input-password-styles.css +13 -0
- package/oj-c/min/input-password.js +2 -0
- package/oj-c/min/input-password.js.map +1 -0
- package/oj-c/min/input-text/input-text-styles.css +13 -0
- package/oj-c/min/input-text.js +2 -0
- package/oj-c/min/input-text.js.map +1 -0
- package/oj-c/min/list-item-layout/list-item-layout-styles.css +12 -0
- package/oj-c/min/list-item-layout.js +2 -0
- package/oj-c/min/list-item-layout.js.map +1 -0
- package/oj-c/min/message-toast/message-toast-styles.css +8 -0
- package/oj-c/min/message-toast.js +2 -0
- package/oj-c/min/message-toast.js.map +1 -0
- package/oj-c/min/meter-bar/meter-bar-styles.css +21 -0
- package/oj-c/min/meter-bar.js +2 -0
- package/oj-c/min/meter-bar.js.map +1 -0
- package/oj-c/min/meter-circle/meter-circle-styles.css +14 -0
- package/oj-c/min/meter-circle.js +2 -0
- package/oj-c/min/meter-circle.js.map +1 -0
- package/oj-c/min/progress-bar/progress-bar-styles.css +11 -0
- package/oj-c/min/progress-bar.js +2 -0
- package/oj-c/min/progress-bar.js.map +1 -0
- package/oj-c/min/progress-circle/progress-circle-styles.css +14 -0
- package/oj-c/min/progress-circle.js +2 -0
- package/oj-c/min/progress-circle.js.map +1 -0
- package/oj-c/min/rating-gauge/rating-gauge-styles.css +12 -0
- package/oj-c/min/rating-gauge.js +2 -0
- package/oj-c/min/rating-gauge.js.map +1 -0
- package/oj-c/min/select-common/UNSAFE_useDataProviderListeners/index.d.ts +2 -0
- package/oj-c/min/select-common/UNSAFE_useDataProviderListeners/index.js +6 -0
- package/oj-c/min/select-common/UNSAFE_useDataProviderListeners/useDataProviderListeners.d.ts +13 -0
- package/oj-c/min/select-common/UNSAFE_useDataProviderListeners/useDataProviderListeners.js +96 -0
- package/oj-c/min/select-common/UNSAFE_useWrapDataProvider/index.d.ts +1 -0
- package/oj-c/min/select-common/UNSAFE_useWrapDataProvider/index.js +6 -0
- package/oj-c/min/select-common/UNSAFE_useWrapDataProvider/useWrapDataProvider.d.ts +3 -0
- package/oj-c/min/select-common/UNSAFE_useWrapDataProvider/useWrapDataProvider.js +16 -0
- package/oj-c/min/select-common/UNSAFE_useWrapValueState/index.d.ts +1 -0
- package/oj-c/min/select-common/UNSAFE_useWrapValueState/index.js +6 -0
- package/oj-c/min/select-common/UNSAFE_useWrapValueState/useWrapValueState.d.ts +23 -0
- package/oj-c/min/select-common/UNSAFE_useWrapValueState/useWrapValueState.js +23 -0
- package/oj-c/min/select-common/component.json +9 -0
- package/oj-c/min/select-common/utils/utils.d.ts +10 -0
- package/oj-c/min/select-common/utils/utils.js +19 -0
- package/oj-c/min/select-multiple/select-multiple-styles.css +13 -0
- package/oj-c/min/select-multiple.js +3 -0
- package/oj-c/min/select-multiple.js.map +1 -0
- package/oj-c/min/select-single/select-single-styles.css +22 -0
- package/oj-c/min/select-single.js +3 -0
- package/oj-c/min/select-single.js.map +1 -0
- package/oj-c/min/split-menu-button/split-menu-button-styles.css +11 -0
- package/oj-c/min/split-menu-button.js +2 -0
- package/oj-c/min/split-menu-button.js.map +1 -0
- package/oj-c/min/text-area/text-area-styles.css +13 -0
- package/oj-c/min/text-area.js +2 -0
- package/oj-c/min/text-area.js.map +1 -0
- package/oj-c/min/utils/UNSAFE_focusTabUtils/focusUtils.d.ts +2 -0
- package/oj-c/min/utils/UNSAFE_focusTabUtils/focusUtils.js +23 -0
- package/oj-c/min/utils/UNSAFE_focusTabUtils/index.d.ts +1 -0
- package/oj-c/min/utils/UNSAFE_focusTabUtils/index.js +6 -0
- package/oj-c/min/utils/UNSAFE_keyUtils/index.d.ts +1 -0
- package/oj-c/min/utils/UNSAFE_keyUtils/index.js +19 -0
- package/oj-c/min/utils/UNSAFE_keyUtils/keySetUtils.d.ts +4 -0
- package/oj-c/min/utils/UNSAFE_keyUtils/keySetUtils.js +33 -0
- package/oj-c/min/utils/UNSAFE_meterUtils/index.d.ts +1 -0
- package/oj-c/min/utils/UNSAFE_meterUtils/index.js +6 -0
- package/oj-c/min/utils/UNSAFE_meterUtils/meterUtils.d.ts +2 -0
- package/oj-c/min/utils/UNSAFE_meterUtils/meterUtils.js +12 -0
- package/oj-c/min/utils/component.json +9 -0
- package/oj-c/progress-bar/__webdriver__/ProgressBarWebElement.js +32 -0
- package/oj-c/progress-bar/__webdriver__/ProgressBarWebElementBase.js +60 -0
- package/oj-c/progress-bar/__webdriver__/index.js +74 -0
- package/oj-c/progress-bar/component.json +123 -0
- package/oj-c/progress-bar/index.js +6 -0
- package/oj-c/progress-bar/progress-bar-styles.css +11 -0
- package/oj-c/progress-bar/progress-bar.js +26 -0
- package/oj-c/progress-bar.js +6 -0
- package/oj-c/progress-circle/__webdriver__/ProgressCircleWebElement.js +32 -0
- package/oj-c/progress-circle/__webdriver__/ProgressCircleWebElementBase.js +60 -0
- package/oj-c/progress-circle/__webdriver__/index.js +74 -0
- package/oj-c/progress-circle/component.json +128 -0
- package/oj-c/progress-circle/index.js +6 -0
- package/oj-c/progress-circle/progress-circle-styles.css +14 -0
- package/oj-c/progress-circle/progress-circle.js +26 -0
- package/oj-c/progress-circle.js +6 -0
- package/oj-c/rating-gauge/__webdriver__/RatingGaugeWebElement.js +32 -0
- package/oj-c/rating-gauge/__webdriver__/RatingGaugeWebElementBase.js +168 -0
- package/oj-c/rating-gauge/__webdriver__/index.js +74 -0
- package/oj-c/rating-gauge/component.json +188 -0
- package/oj-c/rating-gauge/index.js +6 -0
- package/oj-c/rating-gauge/rating-gauge-styles.css +12 -0
- package/oj-c/rating-gauge/rating-gauge.js +44 -0
- package/oj-c/rating-gauge.js +6 -0
- package/oj-c/select-common/UNSAFE_useDataProviderListeners/index.js +6 -0
- package/oj-c/select-common/UNSAFE_useDataProviderListeners/useDataProviderListeners.js +96 -0
- package/oj-c/select-common/UNSAFE_useWrapDataProvider/index.js +6 -0
- package/oj-c/select-common/UNSAFE_useWrapDataProvider/useWrapDataProvider.js +16 -0
- package/oj-c/select-common/UNSAFE_useWrapValueState/index.js +6 -0
- package/oj-c/select-common/UNSAFE_useWrapValueState/useWrapValueState.js +23 -0
- package/oj-c/select-common/component.json +9 -0
- package/oj-c/select-common/utils/utils.js +19 -0
- package/oj-c/select-multiple/__dev__/select-multiple.doc.mdx +30 -0
- package/oj-c/select-multiple/__webdriver__/SelectMultipleWebElement.js +32 -0
- package/oj-c/select-multiple/__webdriver__/SelectMultipleWebElementBase.js +258 -0
- package/oj-c/select-multiple/__webdriver__/index.js +74 -0
- package/oj-c/select-multiple/component.json +475 -0
- package/oj-c/select-multiple/index.js +6 -0
- package/oj-c/select-multiple/select-multiple-styles.css +13 -0
- package/oj-c/select-multiple/select-multiple.js +108 -0
- package/oj-c/select-multiple/useSelectMultiplePreact.js +123 -0
- package/oj-c/select-multiple/useSyncValueAndValueItems.js +125 -0
- package/oj-c/select-multiple/useValueItems.js +22 -0
- package/oj-c/select-multiple.js +6 -0
- package/oj-c/select-single/__dev__/select-single.doc.mdx +30 -0
- package/oj-c/select-single/__webdriver__/SelectSingleWebElement.js +32 -0
- package/oj-c/select-single/__webdriver__/SelectSingleWebElementBase.js +258 -0
- package/oj-c/select-single/__webdriver__/index.js +74 -0
- package/oj-c/select-single/component.json +545 -0
- package/oj-c/select-single/index.js +6 -0
- package/oj-c/select-single/select-single-styles.css +22 -0
- package/oj-c/select-single/select-single.js +108 -0
- package/oj-c/select-single/useSelectSinglePreact.js +157 -0
- package/oj-c/select-single/useSyncValueAndValueItem.js +110 -0
- package/oj-c/select-single/useValueItem.js +18 -0
- package/oj-c/select-single.js +6 -0
- package/oj-c/split-menu-button/__dev__/split-menu-button.doc.mdx +32 -0
- package/oj-c/split-menu-button/__tests__/split-menu-button.test.js +17 -0
- package/oj-c/split-menu-button/__webdriver__/SplitMenuButtonWebElement.js +32 -0
- package/oj-c/split-menu-button/__webdriver__/SplitMenuButtonWebElementBase.js +87 -0
- package/oj-c/split-menu-button/__webdriver__/index.js +74 -0
- package/oj-c/split-menu-button/component.json +205 -0
- package/oj-c/split-menu-button/index.js +6 -0
- package/oj-c/split-menu-button/split-menu-button-styles.css +11 -0
- package/oj-c/split-menu-button/split-menu-button.js +76 -0
- package/oj-c/split-menu-button.js +6 -0
- package/oj-c/text-area/__webdriver__/TextAreaWebElement.js +32 -0
- package/oj-c/text-area/__webdriver__/TextAreaWebElementBase.js +285 -0
- package/oj-c/text-area/__webdriver__/index.js +74 -0
- package/oj-c/text-area/component.json +497 -0
- package/oj-c/text-area/index.js +6 -0
- package/oj-c/text-area/text-area-styles.css +13 -0
- package/oj-c/text-area/text-area.js +138 -0
- package/oj-c/text-area/useTextAreaAutosizePreact.js +44 -0
- package/oj-c/text-area/useTextAreaPreact.js +46 -0
- package/oj-c/text-area.js +6 -0
- package/oj-c/types/avatar/avatar.d.ts +68 -0
- package/oj-c/types/avatar/index.d.ts +2 -0
- package/oj-c/types/button/__tests__/button.test.d.ts +1 -0
- package/oj-c/types/button/button.d.ts +91 -0
- package/oj-c/types/button/index.d.ts +2 -0
- package/oj-c/types/collapsible/collapsible.d.ts +88 -0
- package/oj-c/types/collapsible/index.d.ts +2 -0
- package/oj-c/types/editable-value/UNSAFE_useAssistiveText/useAssistiveText.d.ts +32 -0
- package/oj-c/types/editable-value/UNSAFE_useComponentMessaging/useComponentMessaging.d.ts +24 -0
- package/oj-c/types/editable-value/UNSAFE_useConverter/useConverter.d.ts +14 -0
- package/oj-c/types/editable-value/UNSAFE_useConverterLifecycle/useConverterLifecycle.d.ts +11 -0
- package/oj-c/types/editable-value/UNSAFE_useDeferredValidators/useDeferredValidators.d.ts +8 -0
- package/oj-c/types/editable-value/UNSAFE_useEditableValue/useEditableValue.d.ts +47 -0
- package/oj-c/types/editable-value/UNSAFE_useStaleIdentity/useStaleIdentity.d.ts +5 -0
- package/oj-c/types/editable-value/UNSAFE_useValidationLifecycle/useValidationLifecycle.d.ts +15 -0
- package/oj-c/types/editable-value/UNSAFE_useValidators/useValidators.d.ts +35 -0
- package/oj-c/types/editable-value/UNSAFE_useValue/useValue.d.ts +23 -0
- package/oj-c/types/editable-value/UNSAFE_useValueLifecycle/useValueLifecycle.d.ts +9 -0
- package/oj-c/types/editable-value/utils/utils.d.ts +6 -0
- package/oj-c/types/file-picker/file-picker.d.ts +103 -0
- package/oj-c/types/file-picker/index.d.ts +2 -0
- package/oj-c/types/hooks/UNSAFE_useDataProvider/DataProviderHandler.d.ts +18 -0
- package/oj-c/types/hooks/UNSAFE_useDataProvider/useDataProvider.d.ts +10 -0
- package/oj-c/types/hooks/UNSAFE_useDataProvider/utils.d.ts +3 -0
- package/oj-c/types/hooks/UNSAFE_useListData/__tests__/useListData.test.d.ts +1 -0
- package/oj-c/types/hooks/UNSAFE_useListData/useListData.d.ts +21 -0
- package/oj-c/types/hooks/UNSAFE_useTreeData/__tests__/useTreeData.test.d.ts +1 -0
- package/oj-c/types/hooks/UNSAFE_useTreeData/useTreeData.d.ts +27 -0
- package/oj-c/types/input-number/index.d.ts +2 -0
- package/oj-c/types/input-number/input-number.d.ts +231 -0
- package/oj-c/types/input-number/stepBasisUtils.d.ts +1 -0
- package/oj-c/types/input-number/useImplicitNumberConverter.d.ts +10 -0
- package/oj-c/types/input-number/useImplicitNumberRangeValidator.d.ts +17 -0
- package/oj-c/types/input-number/useNumberInputTextPreact.d.ts +54 -0
- package/oj-c/types/input-password/index.d.ts +2 -0
- package/oj-c/types/input-password/input-password.d.ts +183 -0
- package/oj-c/types/input-password/useInputPasswordPreact.d.ts +40 -0
- package/oj-c/types/input-text/__tests__/input-text.test.d.ts +1 -0
- package/oj-c/types/input-text/index.d.ts +2 -0
- package/oj-c/types/input-text/input-text.d.ts +212 -0
- package/oj-c/types/input-text/useInputTextPreact.d.ts +47 -0
- package/oj-c/types/list-item-layout/index.d.ts +2 -0
- package/oj-c/types/list-item-layout/list-item-layout.d.ts +53 -0
- package/oj-c/types/message-toast/index.d.ts +2 -0
- package/oj-c/types/message-toast/message-toast.d.ts +83 -0
- package/oj-c/types/meter-bar/index.d.ts +2 -0
- package/oj-c/types/meter-bar/meter-bar.d.ts +133 -0
- package/oj-c/types/meter-circle/index.d.ts +2 -0
- package/oj-c/types/meter-circle/meter-circle.d.ts +148 -0
- package/oj-c/types/progress-bar/index.d.ts +2 -0
- package/oj-c/types/progress-bar/progress-bar.d.ts +53 -0
- package/oj-c/types/progress-circle/index.d.ts +2 -0
- package/oj-c/types/progress-circle/progress-circle.d.ts +53 -0
- package/oj-c/types/rating-gauge/index.d.ts +2 -0
- package/oj-c/types/rating-gauge/rating-gauge.d.ts +109 -0
- package/oj-c/types/select-common/UNSAFE_useDataProviderListeners/index.d.ts +2 -0
- package/oj-c/types/select-common/UNSAFE_useDataProviderListeners/useDataProviderListeners.d.ts +13 -0
- package/oj-c/types/select-common/UNSAFE_useWrapDataProvider/index.d.ts +1 -0
- package/oj-c/types/select-common/UNSAFE_useWrapDataProvider/useWrapDataProvider.d.ts +3 -0
- package/oj-c/types/select-common/UNSAFE_useWrapValueState/index.d.ts +1 -0
- package/oj-c/types/select-common/UNSAFE_useWrapValueState/useWrapValueState.d.ts +23 -0
- package/oj-c/types/select-common/utils/utils.d.ts +10 -0
- package/oj-c/types/select-multiple/index.d.ts +2 -0
- package/oj-c/types/select-multiple/select-multiple.d.ts +176 -0
- package/oj-c/types/select-multiple/useSelectMultiplePreact.d.ts +42 -0
- package/oj-c/types/select-multiple/useSyncValueAndValueItems.d.ts +17 -0
- package/oj-c/types/select-multiple/useValueItems.d.ts +6 -0
- package/oj-c/types/select-single/index.d.ts +2 -0
- package/oj-c/types/select-single/select-single.d.ts +186 -0
- package/oj-c/types/select-single/useSelectSinglePreact.d.ts +42 -0
- package/oj-c/types/select-single/useSyncValueAndValueItem.d.ts +17 -0
- package/oj-c/types/select-single/useValueItem.d.ts +5 -0
- package/oj-c/types/split-menu-button/__tests__/split-menu-button.test.d.ts +1 -0
- package/oj-c/types/split-menu-button/index.d.ts +2 -0
- package/oj-c/types/split-menu-button/split-menu-button.d.ts +93 -0
- package/oj-c/types/text-area/index.d.ts +2 -0
- package/oj-c/types/text-area/text-area.d.ts +209 -0
- package/oj-c/types/text-area/useTextAreaAutosizePreact.d.ts +44 -0
- package/oj-c/types/text-area/useTextAreaPreact.d.ts +44 -0
- package/oj-c/types/utils/UNSAFE_focusTabUtils/focusUtils.d.ts +2 -0
- package/oj-c/types/utils/UNSAFE_focusTabUtils/index.d.ts +1 -0
- package/oj-c/types/utils/UNSAFE_keyUtils/index.d.ts +1 -0
- package/oj-c/types/utils/UNSAFE_keyUtils/keySetUtils.d.ts +4 -0
- package/oj-c/types/utils/UNSAFE_meterUtils/index.d.ts +1 -0
- package/oj-c/types/utils/UNSAFE_meterUtils/meterUtils.d.ts +2 -0
- package/oj-c/utils/UNSAFE_focusTabUtils/focusUtils.js +23 -0
- package/oj-c/utils/UNSAFE_focusTabUtils/index.js +6 -0
- package/oj-c/utils/UNSAFE_keyUtils/index.js +19 -0
- package/oj-c/utils/UNSAFE_keyUtils/keySetUtils.js +33 -0
- package/oj-c/utils/UNSAFE_meterUtils/index.js +6 -0
- package/oj-c/utils/UNSAFE_meterUtils/meterUtils.js +12 -0
- package/oj-c/utils/component.json +9 -0
- package/package.json +22 -0
- package/webdriver/docs/.nojekyll +1 -0
- package/webdriver/docs/assets/highlight.css +78 -0
- package/webdriver/docs/assets/icons.css +1043 -0
- package/webdriver/docs/assets/icons.png +0 -0
- package/webdriver/docs/assets/icons@2x.png +0 -0
- package/webdriver/docs/assets/main.js +52 -0
- package/webdriver/docs/assets/search.js +1 -0
- package/webdriver/docs/assets/style.css +1414 -0
- package/webdriver/docs/assets/widgets.png +0 -0
- package/webdriver/docs/assets/widgets@2x.png +0 -0
- package/webdriver/docs/classes/AvatarWebElement.html +117 -0
- package/webdriver/docs/classes/ButtonWebElement.html +163 -0
- package/webdriver/docs/classes/CollapsibleWebElement.html +111 -0
- package/webdriver/docs/classes/FilePickerWebElement.html +117 -0
- package/webdriver/docs/classes/InputNumberWebElement.html +231 -0
- package/webdriver/docs/classes/InputPasswordWebElement.html +195 -0
- package/webdriver/docs/classes/InputTextWebElement.html +211 -0
- package/webdriver/docs/classes/ListItemLayoutWebElement.html +97 -0
- package/webdriver/docs/classes/MessageToastWebElement.html +113 -0
- package/webdriver/docs/classes/MeterBarWebElement.html +153 -0
- package/webdriver/docs/classes/MeterCircleWebElement.html +159 -0
- package/webdriver/docs/classes/ProgressBarWebElement.html +105 -0
- package/webdriver/docs/classes/ProgressCircleWebElement.html +105 -0
- package/webdriver/docs/classes/RatingGaugeWebElement.html +147 -0
- package/webdriver/docs/classes/SelectMultipleWebElement.html +196 -0
- package/webdriver/docs/classes/SelectSingleWebElement.html +196 -0
- package/webdriver/docs/classes/SplitMenuButtonWebElement.html +117 -0
- package/webdriver/docs/classes/TextAreaWebElement.html +207 -0
- package/webdriver/docs/index.html +16 -0
- package/webdriver/docs/modules.html +181 -0
- package/webdriver/index.js +34 -0
- package/webdriver/index.ts +18 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="ojconverter" />
|
|
2
|
+
import Converter from 'ojs/ojconverter';
|
|
3
|
+
import { ValidationState } from '../UNSAFE_useValidators/useValidators';
|
|
4
|
+
declare type UseConverterLifecycleProps<V> = {
|
|
5
|
+
converter?: Converter<V>;
|
|
6
|
+
validationState: ValidationState<V>;
|
|
7
|
+
refreshDisplayValue: () => void;
|
|
8
|
+
runFullValidationAndUpdateValue: () => Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
export declare function useConverterLifecycle<V>({ converter, validationState, refreshDisplayValue, runFullValidationAndUpdateValue }: UseConverterLifecycleProps<V>): void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
define(["require", "exports", "preact/hooks"], function (require, exports, hooks_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useConverterLifecycle = void 0;
|
|
5
|
+
function useConverterLifecycle({ converter, validationState, refreshDisplayValue, runFullValidationAndUpdateValue }) {
|
|
6
|
+
const prevConverterRef = (0, hooks_1.useRef)(converter);
|
|
7
|
+
(0, hooks_1.useEffect)(() => {
|
|
8
|
+
if (prevConverterRef.current === converter) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
prevConverterRef.current = converter;
|
|
12
|
+
const { valid } = validationState;
|
|
13
|
+
switch (valid) {
|
|
14
|
+
case 'invalidShown':
|
|
15
|
+
runFullValidationAndUpdateValue();
|
|
16
|
+
break;
|
|
17
|
+
case 'valid':
|
|
18
|
+
case 'invalidHidden':
|
|
19
|
+
default:
|
|
20
|
+
refreshDisplayValue();
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}, [converter, validationState, refreshDisplayValue, runFullValidationAndUpdateValue]);
|
|
24
|
+
}
|
|
25
|
+
exports.useConverterLifecycle = useConverterLifecycle;
|
|
26
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ValidatorLike } from '../UNSAFE_useValidators/useValidators';
|
|
2
|
+
declare type UseDeferredValidatorsProps = {
|
|
3
|
+
labelHint?: string;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
requiredMessageDetail?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function useDeferredValidators<V>({ labelHint, required, requiredMessageDetail }: UseDeferredValidatorsProps): ValidatorLike<V>[];
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3
|
+
};
|
|
4
|
+
define(["require", "exports", "ojs/ojvalidator-required", "preact/hooks"], function (require, exports, ojvalidator_required_1, hooks_1) {
|
|
5
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.useDeferredValidators = void 0;
|
|
8
|
+
ojvalidator_required_1 = __importDefault(ojvalidator_required_1);
|
|
9
|
+
function useDeferredValidators({ labelHint, required, requiredMessageDetail }) {
|
|
10
|
+
const requiredValidator = (0, hooks_1.useMemo)(() => {
|
|
11
|
+
if (required) {
|
|
12
|
+
return new ojvalidator_required_1.default({
|
|
13
|
+
label: labelHint,
|
|
14
|
+
messageDetail: requiredMessageDetail
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}, [required]);
|
|
19
|
+
return (0, hooks_1.useMemo)(() => [requiredValidator].filter(Boolean), [requiredValidator]);
|
|
20
|
+
}
|
|
21
|
+
exports.useDeferredValidators = useDeferredValidators;
|
|
22
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ValueUpdateDetail } from '@oracle/oraclejet-preact/utils/UNSAFE_valueUpdateDetail';
|
|
2
|
+
import { UseComponentMessagingProps } from '../UNSAFE_useComponentMessaging/useComponentMessaging';
|
|
3
|
+
import { ConverterErrorSymbol, UseConverterProps } from '../UNSAFE_useConverter/useConverter';
|
|
4
|
+
import { UseValidatorsProps, ValidationResult } from '../UNSAFE_useValidators/useValidators';
|
|
5
|
+
import { UseValueProps, ValueState } from '../UNSAFE_useValue/useValue';
|
|
6
|
+
import { ValidatorLike } from '../UNSAFE_useValidators/useValidators';
|
|
7
|
+
declare type PickedComponentMessagingProps = Pick<UseComponentMessagingProps, 'messagesCustom' | 'onMessagesCustomChanged'>;
|
|
8
|
+
declare type PickedConverterProps<V> = Pick<UseConverterProps<V>, 'converter'>;
|
|
9
|
+
declare type PickedValidatorsProps<V> = Pick<UseValidatorsProps<V>, 'validators' | 'addBusyState' | 'onValidChanged'>;
|
|
10
|
+
declare type PickedValueProps<V> = Pick<UseValueProps<V>, 'onRawValueChanged' | 'onTransientValueChanged' | 'onValueChanged' | 'value'>;
|
|
11
|
+
declare type AriaProps = {
|
|
12
|
+
ariaDescribedBy?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare type UseEditableValueProps<V> = PickedComponentMessagingProps & PickedConverterProps<V> & PickedValidatorsProps<V> & PickedValueProps<V> & AriaProps & {
|
|
15
|
+
displayOptions?: {
|
|
16
|
+
messages?: 'display' | 'none';
|
|
17
|
+
};
|
|
18
|
+
implicitComponentValidator?: ValidatorLike<V>;
|
|
19
|
+
labelHint?: string;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
requiredMessageDetail?: string;
|
|
22
|
+
shouldNormalizeValueOnCommit?: boolean;
|
|
23
|
+
wrapValueState?: (valueState: ValueState<V>) => ValueState<V>;
|
|
24
|
+
};
|
|
25
|
+
export declare function useEditableValue<V>({ ariaDescribedBy, converter, displayOptions, implicitComponentValidator, labelHint, messagesCustom, required, requiredMessageDetail, shouldNormalizeValueOnCommit, validators, value: valueProp, addBusyState, onMessagesCustomChanged, onRawValueChanged, onValidChanged, onValueChanged, onTransientValueChanged, wrapValueState }: UseEditableValueProps<V>): {
|
|
26
|
+
value: V;
|
|
27
|
+
setValue: import("preact/hooks").StateUpdater<V>;
|
|
28
|
+
displayValue: string;
|
|
29
|
+
setDisplayValue: import("preact/hooks").StateUpdater<string>;
|
|
30
|
+
setTransientValue: import("preact/hooks").StateUpdater<V>;
|
|
31
|
+
methods: {
|
|
32
|
+
reset: () => void;
|
|
33
|
+
validate: () => Promise<'valid' | 'invalid'>;
|
|
34
|
+
showMessages: () => void;
|
|
35
|
+
};
|
|
36
|
+
textFieldProps: {
|
|
37
|
+
messages: import("@oracle/oraclejet-preact/UNSAFE_ComponentMessage").ComponentMessageItem[] | undefined;
|
|
38
|
+
value: string;
|
|
39
|
+
ariaDescribedBy: string | undefined;
|
|
40
|
+
onCommit: ({ value }: ValueUpdateDetail<string>) => Promise<void>;
|
|
41
|
+
onInput: ({ value }: ValueUpdateDetail<string>) => void;
|
|
42
|
+
};
|
|
43
|
+
onCommitValue: (value: V, doCommitOnValid?: boolean) => Promise<ValidationResult>;
|
|
44
|
+
format: (value: V, shouldSuppressError?: boolean) => string | null | undefined;
|
|
45
|
+
normalizeAndParseValue: (value: string) => typeof ConverterErrorSymbol | V | null;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
define(["require", "exports", "preact/hooks", "../UNSAFE_useComponentMessaging/useComponentMessaging", "../UNSAFE_useConverter/useConverter", "../UNSAFE_useConverterLifecycle/useConverterLifecycle", "../UNSAFE_useDeferredValidators/useDeferredValidators", "../UNSAFE_useValidationLifecycle/useValidationLifecycle", "../UNSAFE_useValidators/useValidators", "../UNSAFE_useValue/useValue", "../UNSAFE_useValueLifecycle/useValueLifecycle", "../utils/utils"], function (require, exports, hooks_1, useComponentMessaging_1, useConverter_1, useConverterLifecycle_1, useDeferredValidators_1, useValidationLifecycle_1, useValidators_1, useValue_1, useValueLifecycle_1, utils_1) {
|
|
11
|
+
"use strict";
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.useEditableValue = void 0;
|
|
14
|
+
function useEditableValue({ ariaDescribedBy, converter, displayOptions, implicitComponentValidator, labelHint, messagesCustom, required, requiredMessageDetail, shouldNormalizeValueOnCommit = true, validators, value: valueProp, addBusyState, onMessagesCustomChanged, onRawValueChanged, onValidChanged, onValueChanged, onTransientValueChanged, wrapValueState }) {
|
|
15
|
+
const componentMessagingState = (0, useComponentMessaging_1.useComponentMessaging)({
|
|
16
|
+
messagesCustom,
|
|
17
|
+
onMessagesCustomChanged
|
|
18
|
+
});
|
|
19
|
+
const { clearAllMessages, visibleMessages } = componentMessagingState;
|
|
20
|
+
const deferredValidators = (0, useDeferredValidators_1.useDeferredValidators)({
|
|
21
|
+
labelHint,
|
|
22
|
+
required,
|
|
23
|
+
requiredMessageDetail
|
|
24
|
+
});
|
|
25
|
+
const combinedValidators = !implicitComponentValidator
|
|
26
|
+
? validators
|
|
27
|
+
: validators
|
|
28
|
+
? [implicitComponentValidator, ...validators]
|
|
29
|
+
: [implicitComponentValidator];
|
|
30
|
+
const validationState = (0, useValidators_1.useValidators)({
|
|
31
|
+
componentMessagingState,
|
|
32
|
+
defaultValidState: 'valid',
|
|
33
|
+
deferredValidators,
|
|
34
|
+
validators: combinedValidators,
|
|
35
|
+
addBusyState,
|
|
36
|
+
onValidChanged
|
|
37
|
+
});
|
|
38
|
+
const { validateValueOnExternalChange, validateValueOnInternalChange } = validationState;
|
|
39
|
+
const { format, parse } = (0, useConverter_1.useConverter)({
|
|
40
|
+
componentMessagingState,
|
|
41
|
+
converter,
|
|
42
|
+
validationState
|
|
43
|
+
});
|
|
44
|
+
const defaultValueState = (0, useValue_1.useValue)({
|
|
45
|
+
value: valueProp,
|
|
46
|
+
format,
|
|
47
|
+
parse,
|
|
48
|
+
onRawValueChanged,
|
|
49
|
+
onTransientValueChanged,
|
|
50
|
+
onValueChanged
|
|
51
|
+
});
|
|
52
|
+
const valueState = wrapValueState ? wrapValueState(defaultValueState) : defaultValueState;
|
|
53
|
+
const { displayValue, value, getValueForValidation, setValueAfterValidation, refreshDisplayValue, setDisplayValue, setTransientValue, setValue } = valueState;
|
|
54
|
+
const { runFullValidationAndUpdateValue } = (0, useValidationLifecycle_1.useValidationLifecycle)({
|
|
55
|
+
componentMessagingState,
|
|
56
|
+
validationState,
|
|
57
|
+
deferredValidators,
|
|
58
|
+
validators,
|
|
59
|
+
getValueForValidation,
|
|
60
|
+
setValueAfterValidation
|
|
61
|
+
});
|
|
62
|
+
(0, useConverterLifecycle_1.useConverterLifecycle)({
|
|
63
|
+
converter,
|
|
64
|
+
validationState,
|
|
65
|
+
refreshDisplayValue,
|
|
66
|
+
runFullValidationAndUpdateValue
|
|
67
|
+
});
|
|
68
|
+
(0, useValueLifecycle_1.useValueLifecycle)({
|
|
69
|
+
value: valueProp,
|
|
70
|
+
valueState,
|
|
71
|
+
format,
|
|
72
|
+
validateValueOnExternalChange
|
|
73
|
+
});
|
|
74
|
+
const normalizeAndParseValue = (0, hooks_1.useCallback)((value) => {
|
|
75
|
+
return parse(shouldNormalizeValueOnCommit ? (0, utils_1.normalizeValue)(value) : value);
|
|
76
|
+
}, [shouldNormalizeValueOnCommit, parse]);
|
|
77
|
+
const onCommitValue = (0, hooks_1.useCallback)((value, doCommitOnValid = true) => __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
const validationResult = yield validateValueOnInternalChange(value);
|
|
79
|
+
if (validationResult === useValidators_1.ValidationResult.VALID && doCommitOnValid) {
|
|
80
|
+
setValue(value);
|
|
81
|
+
}
|
|
82
|
+
return validationResult;
|
|
83
|
+
}), [validateValueOnInternalChange]);
|
|
84
|
+
const onCommit = (0, hooks_1.useCallback)(({ value }) => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
const parsedValueOrSymbol = normalizeAndParseValue(value);
|
|
86
|
+
if (parsedValueOrSymbol === useConverter_1.ConverterErrorSymbol) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const parsedValue = parsedValueOrSymbol;
|
|
90
|
+
const validationResult = yield onCommitValue(parsedValue);
|
|
91
|
+
if (validationResult === useValidators_1.ValidationResult.VALID) {
|
|
92
|
+
setDisplayValue(format(parsedValue));
|
|
93
|
+
}
|
|
94
|
+
}), [format, onCommitValue, normalizeAndParseValue]);
|
|
95
|
+
const onInput = (0, hooks_1.useCallback)(({ value }) => {
|
|
96
|
+
setDisplayValue(value !== null && value !== void 0 ? value : '');
|
|
97
|
+
}, []);
|
|
98
|
+
const reset = (0, hooks_1.useCallback)(() => {
|
|
99
|
+
clearAllMessages();
|
|
100
|
+
validateValueOnExternalChange(value);
|
|
101
|
+
refreshDisplayValue();
|
|
102
|
+
}, [value, clearAllMessages, refreshDisplayValue, validateValueOnExternalChange]);
|
|
103
|
+
const validate = (0, hooks_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
const { fullValidate } = validationState;
|
|
105
|
+
const { displayValue, value, setValueAfterValidation } = valueState;
|
|
106
|
+
const newValueOrSymbol = normalizeAndParseValue(displayValue);
|
|
107
|
+
if (newValueOrSymbol === useConverter_1.ConverterErrorSymbol) {
|
|
108
|
+
return 'invalid';
|
|
109
|
+
}
|
|
110
|
+
const newValue = newValueOrSymbol;
|
|
111
|
+
const resolver = addBusyState === null || addBusyState === void 0 ? void 0 : addBusyState('running component method validate');
|
|
112
|
+
const validateResult = yield fullValidate(newValue);
|
|
113
|
+
resolver === null || resolver === void 0 ? void 0 : resolver();
|
|
114
|
+
if (validateResult) {
|
|
115
|
+
if (newValue !== value) {
|
|
116
|
+
setValueAfterValidation(newValue);
|
|
117
|
+
}
|
|
118
|
+
return 'valid';
|
|
119
|
+
}
|
|
120
|
+
return 'invalid';
|
|
121
|
+
}), [validationState, valueState, addBusyState, normalizeAndParseValue]);
|
|
122
|
+
const showMessages = (0, hooks_1.useCallback)(() => {
|
|
123
|
+
const { hasHiddenMessages, showHiddenMessages } = componentMessagingState;
|
|
124
|
+
const { setValid } = validationState;
|
|
125
|
+
if (hasHiddenMessages()) {
|
|
126
|
+
showHiddenMessages();
|
|
127
|
+
setValid('invalidShown');
|
|
128
|
+
}
|
|
129
|
+
}, [componentMessagingState, validationState]);
|
|
130
|
+
return {
|
|
131
|
+
value,
|
|
132
|
+
setValue,
|
|
133
|
+
displayValue,
|
|
134
|
+
setDisplayValue,
|
|
135
|
+
setTransientValue,
|
|
136
|
+
methods: {
|
|
137
|
+
reset,
|
|
138
|
+
validate,
|
|
139
|
+
showMessages
|
|
140
|
+
},
|
|
141
|
+
textFieldProps: {
|
|
142
|
+
messages: (displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.messages) !== 'none' ? visibleMessages : undefined,
|
|
143
|
+
value: displayValue,
|
|
144
|
+
ariaDescribedBy,
|
|
145
|
+
onCommit,
|
|
146
|
+
onInput
|
|
147
|
+
},
|
|
148
|
+
onCommitValue,
|
|
149
|
+
format,
|
|
150
|
+
normalizeAndParseValue
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
exports.useEditableValue = useEditableValue;
|
|
154
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
define(["require", "exports", "preact/hooks"], function (require, exports, hooks_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useStaleIdentity = void 0;
|
|
5
|
+
function useStaleIdentity() {
|
|
6
|
+
const staleIdentityMap = (0, hooks_1.useRef)(new Map());
|
|
7
|
+
const setStaleIdentity = (0, hooks_1.useCallback)((id) => {
|
|
8
|
+
const localStaleIdentity = Symbol();
|
|
9
|
+
staleIdentityMap.current.set(id, localStaleIdentity);
|
|
10
|
+
return {
|
|
11
|
+
isStale: () => localStaleIdentity !== staleIdentityMap.current.get(id)
|
|
12
|
+
};
|
|
13
|
+
}, []);
|
|
14
|
+
return { setStaleIdentity };
|
|
15
|
+
}
|
|
16
|
+
exports.useStaleIdentity = useStaleIdentity;
|
|
17
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentMessagingState } from '../UNSAFE_useComponentMessaging/useComponentMessaging';
|
|
2
|
+
import { ConverterErrorSymbol } from '../UNSAFE_useConverter/useConverter';
|
|
3
|
+
import { UseValidatorsProps, ValidationState, ValidState } from '../UNSAFE_useValidators/useValidators';
|
|
4
|
+
declare type PickedUseValidatorsProps<V> = Pick<UseValidatorsProps<V>, 'deferredValidators' | 'validators'>;
|
|
5
|
+
declare type UseValidationLifecycleProps<V> = PickedUseValidatorsProps<V> & {
|
|
6
|
+
componentMessagingState: ComponentMessagingState;
|
|
7
|
+
validationState: ValidationState<V>;
|
|
8
|
+
addBusyState?: (desc?: string) => () => void;
|
|
9
|
+
getValueForValidation: (valid: ValidState) => V | typeof ConverterErrorSymbol;
|
|
10
|
+
setValueAfterValidation: (value: V) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare function useValidationLifecycle<V>({ componentMessagingState, deferredValidators, validationState, validators, getValueForValidation, setValueAfterValidation }: UseValidationLifecycleProps<V>): {
|
|
13
|
+
runFullValidationAndUpdateValue: () => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
define(["require", "exports", "preact/hooks", "../UNSAFE_useConverter/useConverter", "../UNSAFE_useValidators/useValidators", "../utils/utils"], function (require, exports, hooks_1, useConverter_1, useValidators_1, utils_1) {
|
|
11
|
+
"use strict";
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.useValidationLifecycle = void 0;
|
|
14
|
+
function useValidationLifecycle({ componentMessagingState, deferredValidators, validationState, validators, getValueForValidation, setValueAfterValidation }) {
|
|
15
|
+
const prevDeferredValidatorsRef = (0, hooks_1.useRef)(deferredValidators);
|
|
16
|
+
const prevValidatorsRef = (0, hooks_1.useRef)(validators);
|
|
17
|
+
const prevMessagesCustomRef = (0, hooks_1.useRef)(componentMessagingState.messagesCustom);
|
|
18
|
+
const runFullValidationAndUpdateValue = (0, hooks_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const { valid, validateValueOnInternalChange } = validationState;
|
|
20
|
+
const value = getValueForValidation(valid);
|
|
21
|
+
if (value === useConverter_1.ConverterErrorSymbol) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const validationResult = yield validateValueOnInternalChange(value, {
|
|
25
|
+
doNotClearMessagesCustom: true
|
|
26
|
+
});
|
|
27
|
+
if (validationResult === useValidators_1.ValidationResult.VALID) {
|
|
28
|
+
setValueAfterValidation(value);
|
|
29
|
+
}
|
|
30
|
+
}), [validationState, getValueForValidation, setValueAfterValidation]);
|
|
31
|
+
(0, hooks_1.useEffect)(() => {
|
|
32
|
+
const value = getValueForValidation('valid');
|
|
33
|
+
if (value === useConverter_1.ConverterErrorSymbol) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const { deferredValidate, setValid } = validationState;
|
|
37
|
+
const { hasCustomErrorMessages, setDeferredComponentMessages } = componentMessagingState;
|
|
38
|
+
const maybeErrors = deferredValidate(value);
|
|
39
|
+
if (maybeErrors) {
|
|
40
|
+
setDeferredComponentMessages(maybeErrors);
|
|
41
|
+
setValid('invalidHidden');
|
|
42
|
+
}
|
|
43
|
+
if (hasCustomErrorMessages()) {
|
|
44
|
+
setValid('invalidShown');
|
|
45
|
+
}
|
|
46
|
+
}, []);
|
|
47
|
+
(0, hooks_1.useEffect)(() => {
|
|
48
|
+
if (prevDeferredValidatorsRef.current === deferredValidators) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const { valid, deferredValidate, setValid } = validationState;
|
|
52
|
+
const { clearDeferredComponentMessages, setDeferredComponentMessages } = componentMessagingState;
|
|
53
|
+
prevDeferredValidatorsRef.current = deferredValidators;
|
|
54
|
+
switch (valid) {
|
|
55
|
+
case 'valid':
|
|
56
|
+
const value = getValueForValidation(valid);
|
|
57
|
+
if (value !== useConverter_1.ConverterErrorSymbol) {
|
|
58
|
+
const maybeErrors = deferredValidate(value);
|
|
59
|
+
if (maybeErrors) {
|
|
60
|
+
setDeferredComponentMessages(maybeErrors);
|
|
61
|
+
setValid('invalidHidden');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
case 'invalidHidden':
|
|
66
|
+
if (deferredValidators.length === 0) {
|
|
67
|
+
setValid('valid');
|
|
68
|
+
clearDeferredComponentMessages();
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
case 'invalidShown':
|
|
72
|
+
runFullValidationAndUpdateValue();
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}, [
|
|
76
|
+
deferredValidators,
|
|
77
|
+
componentMessagingState,
|
|
78
|
+
validationState,
|
|
79
|
+
getValueForValidation,
|
|
80
|
+
runFullValidationAndUpdateValue
|
|
81
|
+
]);
|
|
82
|
+
(0, hooks_1.useEffect)(() => {
|
|
83
|
+
if (prevValidatorsRef.current === validators) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
prevValidatorsRef.current = validators;
|
|
87
|
+
switch (validationState.valid) {
|
|
88
|
+
case 'invalidShown':
|
|
89
|
+
runFullValidationAndUpdateValue();
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}, [validators, validationState]);
|
|
93
|
+
(0, hooks_1.useEffect)(() => {
|
|
94
|
+
if ((0, utils_1.isShallowEqual)(prevMessagesCustomRef.current, componentMessagingState.messagesCustom)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const { messagesCustom, hasCustomErrorMessages, hasHiddenMessages, hasNoErrorMessages } = componentMessagingState;
|
|
98
|
+
const { valid, setValid } = validationState;
|
|
99
|
+
prevMessagesCustomRef.current = messagesCustom;
|
|
100
|
+
if (hasCustomErrorMessages()) {
|
|
101
|
+
setValid('invalidShown');
|
|
102
|
+
}
|
|
103
|
+
else if (valid === 'pending') {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
else if (hasNoErrorMessages()) {
|
|
107
|
+
setValid('valid');
|
|
108
|
+
}
|
|
109
|
+
else if (hasHiddenMessages()) {
|
|
110
|
+
setValid('invalidHidden');
|
|
111
|
+
}
|
|
112
|
+
}, [componentMessagingState, validationState]);
|
|
113
|
+
return {
|
|
114
|
+
runFullValidationAndUpdateValue
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
exports.useValidationLifecycle = useValidationLifecycle;
|
|
118
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="ojvalidator" />
|
|
2
|
+
/// <reference types="ojvalidator-async" />
|
|
3
|
+
import { ComponentMessageItem } from '@oracle/oraclejet-preact/UNSAFE_ComponentMessage';
|
|
4
|
+
import Validator from 'ojs/ojvalidator';
|
|
5
|
+
import AsyncValidator from 'ojs/ojvalidator-async';
|
|
6
|
+
import { StateUpdater } from 'preact/hooks';
|
|
7
|
+
import { ComponentMessagingState } from '../UNSAFE_useComponentMessaging/useComponentMessaging';
|
|
8
|
+
export declare const ValidationResult: {
|
|
9
|
+
readonly VALID: "VALID";
|
|
10
|
+
readonly INVALID: "INVALID";
|
|
11
|
+
readonly STALE: "STALE";
|
|
12
|
+
};
|
|
13
|
+
export declare type ValidationResult = typeof ValidationResult[keyof typeof ValidationResult];
|
|
14
|
+
export declare type ValidState = 'valid' | 'pending' | 'invalidHidden' | 'invalidShown';
|
|
15
|
+
export declare type ValidatorLike<V> = Validator<V> | AsyncValidator<V>;
|
|
16
|
+
export declare type ValidationOptions = {
|
|
17
|
+
doNotClearMessagesCustom?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare type ValidationState<V> = {
|
|
20
|
+
valid: ValidState;
|
|
21
|
+
setValid: StateUpdater<ValidState>;
|
|
22
|
+
deferredValidate: (value: V) => void | ComponentMessageItem[];
|
|
23
|
+
fullValidate: (value: V, options?: ValidationOptions) => Promise<boolean>;
|
|
24
|
+
validateValueOnInternalChange: (value: V, options?: ValidationOptions) => Promise<ValidationResult>;
|
|
25
|
+
validateValueOnExternalChange: (value: V) => ValidationResult;
|
|
26
|
+
};
|
|
27
|
+
export declare type UseValidatorsProps<V> = {
|
|
28
|
+
componentMessagingState: ComponentMessagingState;
|
|
29
|
+
defaultValidState?: ValidState;
|
|
30
|
+
deferredValidators?: ValidatorLike<V>[];
|
|
31
|
+
validators?: ValidatorLike<V>[];
|
|
32
|
+
addBusyState?: (desc?: string) => () => void;
|
|
33
|
+
onValidChanged?: (valid: ValidState) => void;
|
|
34
|
+
};
|
|
35
|
+
export declare function useValidators<V>({ componentMessagingState, defaultValidState, deferredValidators, validators, addBusyState, onValidChanged }: UseValidatorsProps<V>): ValidationState<V>;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
define(["require", "exports", "@oracle/oraclejet-preact/hooks/UNSAFE_useUncontrolledState", "preact/hooks", "../UNSAFE_useStaleIdentity/useStaleIdentity", "../utils/utils"], function (require, exports, UNSAFE_useUncontrolledState_1, hooks_1, useStaleIdentity_1, utils_1) {
|
|
11
|
+
"use strict";
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.useValidators = exports.ValidationResult = void 0;
|
|
14
|
+
exports.ValidationResult = {
|
|
15
|
+
VALID: 'VALID',
|
|
16
|
+
INVALID: 'INVALID',
|
|
17
|
+
STALE: 'STALE'
|
|
18
|
+
};
|
|
19
|
+
function useValidators({ componentMessagingState, defaultValidState, deferredValidators = [], validators = [], addBusyState, onValidChanged }) {
|
|
20
|
+
const [valid, setValid] = (0, UNSAFE_useUncontrolledState_1.useUncontrolledState)(defaultValidState, onValidChanged);
|
|
21
|
+
const { setStaleIdentity } = (0, useStaleIdentity_1.useStaleIdentity)();
|
|
22
|
+
(0, hooks_1.useLayoutEffect)(() => {
|
|
23
|
+
if (defaultValidState !== undefined) {
|
|
24
|
+
onValidChanged === null || onValidChanged === void 0 ? void 0 : onValidChanged(defaultValidState);
|
|
25
|
+
}
|
|
26
|
+
}, []);
|
|
27
|
+
const fullValidate = (0, hooks_1.useCallback)((value, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const { addComponentMessage, clearAllComponentMessages, clearAllMessages, hasCustomErrorMessages, setComponentMessages } = componentMessagingState;
|
|
29
|
+
const { doNotClearMessagesCustom = false } = options;
|
|
30
|
+
const hadCustomErrorMessages = hasCustomErrorMessages();
|
|
31
|
+
setValid('pending');
|
|
32
|
+
if (doNotClearMessagesCustom) {
|
|
33
|
+
clearAllComponentMessages();
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
clearAllMessages();
|
|
37
|
+
}
|
|
38
|
+
if (validators.length === 0 && deferredValidators.length === 0) {
|
|
39
|
+
if (hadCustomErrorMessages && doNotClearMessagesCustom) {
|
|
40
|
+
setValid('invalidShown');
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
setValid('valid');
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
const errors = [];
|
|
48
|
+
const maybeErrorsPromise = [];
|
|
49
|
+
for (const validator of [...deferredValidators, ...validators]) {
|
|
50
|
+
try {
|
|
51
|
+
const validateResult = validator.validate(value);
|
|
52
|
+
if (validateResult instanceof Promise) {
|
|
53
|
+
maybeErrorsPromise.push(validateResult.then(() => { }, (error) => (0, utils_1.createMessageFromError)(error)));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
errors.push((0, utils_1.createMessageFromError)(error));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (!errors.length && !maybeErrorsPromise.length) {
|
|
61
|
+
if (hadCustomErrorMessages && doNotClearMessagesCustom) {
|
|
62
|
+
setValid('invalidShown');
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
setValid('valid');
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
const hasSyncError = errors.length !== 0;
|
|
70
|
+
if (hasSyncError) {
|
|
71
|
+
setComponentMessages(errors);
|
|
72
|
+
setValid('invalidShown');
|
|
73
|
+
}
|
|
74
|
+
if (!maybeErrorsPromise.length) {
|
|
75
|
+
return !hasSyncError;
|
|
76
|
+
}
|
|
77
|
+
const resolver = addBusyState === null || addBusyState === void 0 ? void 0 : addBusyState('running validation');
|
|
78
|
+
const { isStale } = setStaleIdentity('useValidators-validate');
|
|
79
|
+
let hasAsyncError = false;
|
|
80
|
+
for (const asyncValidationResult of maybeErrorsPromise) {
|
|
81
|
+
const maybeValidationError = yield asyncValidationResult;
|
|
82
|
+
if (maybeValidationError && !isStale()) {
|
|
83
|
+
addComponentMessage(maybeValidationError);
|
|
84
|
+
setValid('invalidShown');
|
|
85
|
+
hasAsyncError = true;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (!hasSyncError && !hasAsyncError && !isStale()) {
|
|
89
|
+
if (hadCustomErrorMessages && doNotClearMessagesCustom) {
|
|
90
|
+
setValid('invalidShown');
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
setValid('valid');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
resolver === null || resolver === void 0 ? void 0 : resolver();
|
|
97
|
+
return !hasSyncError && !hasAsyncError;
|
|
98
|
+
}), [componentMessagingState, deferredValidators, validators]);
|
|
99
|
+
const deferredValidate = (0, hooks_1.useCallback)((value) => {
|
|
100
|
+
const errors = [];
|
|
101
|
+
for (const validator of deferredValidators) {
|
|
102
|
+
try {
|
|
103
|
+
validator.validate(value);
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
errors.push((0, utils_1.createMessageFromError)(error));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (errors.length) {
|
|
110
|
+
return errors;
|
|
111
|
+
}
|
|
112
|
+
return undefined;
|
|
113
|
+
}, [deferredValidators]);
|
|
114
|
+
const validateValueOnInternalChange = (0, hooks_1.useCallback)((value, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const { isStale } = setStaleIdentity('useValidationLifeCycle-validateValueOnInternalChange');
|
|
116
|
+
const resolver = addBusyState === null || addBusyState === void 0 ? void 0 : addBusyState('running validateValueOnInternalChange');
|
|
117
|
+
const validationResult = yield fullValidate(value, options);
|
|
118
|
+
resolver === null || resolver === void 0 ? void 0 : resolver();
|
|
119
|
+
if (isStale()) {
|
|
120
|
+
return exports.ValidationResult.STALE;
|
|
121
|
+
}
|
|
122
|
+
return validationResult ? exports.ValidationResult.VALID : exports.ValidationResult.INVALID;
|
|
123
|
+
}), [addBusyState, fullValidate]);
|
|
124
|
+
const validateValueOnExternalChange = (0, hooks_1.useCallback)((value) => {
|
|
125
|
+
const { clearAllMessages, setDeferredComponentMessages } = componentMessagingState;
|
|
126
|
+
clearAllMessages();
|
|
127
|
+
const maybeErrors = deferredValidate(value);
|
|
128
|
+
if (maybeErrors) {
|
|
129
|
+
setDeferredComponentMessages(maybeErrors);
|
|
130
|
+
setValid('invalidHidden');
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
setValid('valid');
|
|
134
|
+
}
|
|
135
|
+
return exports.ValidationResult.VALID;
|
|
136
|
+
}, [componentMessagingState, deferredValidate]);
|
|
137
|
+
return (0, hooks_1.useMemo)(() => ({
|
|
138
|
+
valid,
|
|
139
|
+
setValid,
|
|
140
|
+
deferredValidate,
|
|
141
|
+
fullValidate,
|
|
142
|
+
validateValueOnExternalChange,
|
|
143
|
+
validateValueOnInternalChange
|
|
144
|
+
}), [
|
|
145
|
+
valid,
|
|
146
|
+
deferredValidate,
|
|
147
|
+
fullValidate,
|
|
148
|
+
validateValueOnExternalChange,
|
|
149
|
+
validateValueOnInternalChange
|
|
150
|
+
]);
|
|
151
|
+
}
|
|
152
|
+
exports.useValidators = useValidators;
|
|
153
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StateUpdater } from 'preact/hooks';
|
|
2
|
+
import { ConverterErrorSymbol } from '../UNSAFE_useConverter/useConverter';
|
|
3
|
+
import { ValidState } from '../UNSAFE_useValidators/useValidators';
|
|
4
|
+
export declare type ValueState<V> = {
|
|
5
|
+
displayValue: string;
|
|
6
|
+
transientValue: V;
|
|
7
|
+
value: V;
|
|
8
|
+
getValueForValidation: (valid: ValidState) => V | typeof ConverterErrorSymbol;
|
|
9
|
+
setValueAfterValidation: (value: V) => void;
|
|
10
|
+
setDisplayValue: StateUpdater<string>;
|
|
11
|
+
setTransientValue: StateUpdater<V>;
|
|
12
|
+
setValue: StateUpdater<V>;
|
|
13
|
+
refreshDisplayValue: () => void;
|
|
14
|
+
};
|
|
15
|
+
export declare type UseValueProps<V> = {
|
|
16
|
+
value?: V;
|
|
17
|
+
format: (value: V, shouldSuppressError?: boolean) => string;
|
|
18
|
+
parse: (value: string) => V | typeof ConverterErrorSymbol;
|
|
19
|
+
onRawValueChanged?: (rawValue: string) => void;
|
|
20
|
+
onTransientValueChanged?: (transientValue: V | null | undefined) => void;
|
|
21
|
+
onValueChanged?: (value: V | null | undefined) => void;
|
|
22
|
+
};
|
|
23
|
+
export declare function useValue<V>({ value: valueProp, format, parse, onRawValueChanged, onTransientValueChanged, onValueChanged }: UseValueProps<V>): ValueState<V>;
|