@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,4049 @@
|
|
|
1
|
+
define('oj-c/editable-value/UNSAFE_useAssistiveText/useAssistiveText',["require", "exports", "preact/hooks"], function (require, exports, hooks_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useAssistiveText = void 0;
|
|
5
|
+
function determineAssistiveText(help, validatorHint, helpHints, converterHint, displayOptions) {
|
|
6
|
+
return ((help === null || help === void 0 ? void 0 : help.instruction) ||
|
|
7
|
+
((displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.validatorHint) === 'none' ? undefined : validatorHint) ||
|
|
8
|
+
(helpHints === null || helpHints === void 0 ? void 0 : helpHints.definition) ||
|
|
9
|
+
((displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.converterHint) === 'none' ? undefined : converterHint));
|
|
10
|
+
}
|
|
11
|
+
function determineSyncValidatorHints(validators) {
|
|
12
|
+
if (!validators.length) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const syncHints = validators
|
|
16
|
+
.map((validator) => typeof validator.getHint === 'function'
|
|
17
|
+
? validator.getHint()
|
|
18
|
+
: undefined)
|
|
19
|
+
.filter(Boolean);
|
|
20
|
+
return syncHints.join('\n');
|
|
21
|
+
}
|
|
22
|
+
function useAssistiveText({ addBusyState, converter, displayOptions, help, helpHints, validators }) {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
const [validatorHint, setValidatorHint] = (0, hooks_1.useState)(!validators || !validators.length ? undefined : determineSyncValidatorHints(validators));
|
|
25
|
+
const staleIdentity = (0, hooks_1.useRef)();
|
|
26
|
+
(0, hooks_1.useEffect)(() => {
|
|
27
|
+
if (!validators || !validators.length) {
|
|
28
|
+
setValidatorHint(undefined);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
setValidatorHint(determineSyncValidatorHints(validators));
|
|
32
|
+
const asyncHints = validators
|
|
33
|
+
.map((validator) => validator.hint)
|
|
34
|
+
.filter(Boolean);
|
|
35
|
+
const localStaleIdentity = (staleIdentity.current = Symbol());
|
|
36
|
+
const resolver = addBusyState === null || addBusyState === void 0 ? void 0 : addBusyState('resolving the async validator hints');
|
|
37
|
+
Promise.allSettled(asyncHints).then((hints) => {
|
|
38
|
+
setValidatorHint((currentHints) => {
|
|
39
|
+
const treatedHints = hints
|
|
40
|
+
.map((result) => (result.status === 'fulfilled' ? result.value : undefined))
|
|
41
|
+
.filter(Boolean);
|
|
42
|
+
if (localStaleIdentity !== staleIdentity.current || !treatedHints.length) {
|
|
43
|
+
return currentHints;
|
|
44
|
+
}
|
|
45
|
+
return [currentHints, ...treatedHints].join('\n');
|
|
46
|
+
});
|
|
47
|
+
resolver === null || resolver === void 0 ? void 0 : resolver();
|
|
48
|
+
});
|
|
49
|
+
}, [validators]);
|
|
50
|
+
return {
|
|
51
|
+
assistiveText: determineAssistiveText(help, validatorHint, helpHints, (_b = (_a = converter === null || converter === void 0 ? void 0 : converter.getHint) === null || _a === void 0 ? void 0 : _a.call(converter)) !== null && _b !== void 0 ? _b : undefined, displayOptions),
|
|
52
|
+
helpSourceLink: helpHints === null || helpHints === void 0 ? void 0 : helpHints.source,
|
|
53
|
+
helpSourceText: helpHints === null || helpHints === void 0 ? void 0 : helpHints.sourceText
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
exports.useAssistiveText = useAssistiveText;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
define('oj-c/editable-value/utils/utils',["require", "exports"], function (require, exports) {
|
|
60
|
+
"use strict";
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
exports.isShallowEqual = exports.normalizeValue = exports.treatNull = exports.createMessageFromError = void 0;
|
|
63
|
+
function createMessageFromError(error) {
|
|
64
|
+
if (typeof error.getMessage === 'function') {
|
|
65
|
+
return {
|
|
66
|
+
severity: 'error',
|
|
67
|
+
detail: error.getMessage().detail
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return { severity: 'error', detail: error.message };
|
|
71
|
+
}
|
|
72
|
+
exports.createMessageFromError = createMessageFromError;
|
|
73
|
+
function treatNull(value, defaultValue) {
|
|
74
|
+
if (value === null) {
|
|
75
|
+
return defaultValue;
|
|
76
|
+
}
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
exports.treatNull = treatNull;
|
|
80
|
+
function normalizeValue(value) {
|
|
81
|
+
if (typeof value === 'string' && value === '') {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
exports.normalizeValue = normalizeValue;
|
|
87
|
+
const isShallowEqual = (a, b) => a === b || (a.length === b.length && a.every((v, i) => v === b[i]));
|
|
88
|
+
exports.isShallowEqual = isShallowEqual;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
define('oj-c/editable-value/UNSAFE_useComponentMessaging/useComponentMessaging',["require", "exports", "@oracle/oraclejet-preact/hooks/UNSAFE_useUncontrolledState", "preact/hooks", "../utils/utils"], function (require, exports, UNSAFE_useUncontrolledState_1, hooks_1, utils_1) {
|
|
92
|
+
"use strict";
|
|
93
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
94
|
+
exports.useComponentMessaging = void 0;
|
|
95
|
+
function useComponentMessaging({ messagesCustom: messagesCustomProp = [], onMessagesCustomChanged }) {
|
|
96
|
+
const [messagesCustom, setMessagesCustom] = (0, UNSAFE_useUncontrolledState_1.useUncontrolledState)(messagesCustomProp, onMessagesCustomChanged);
|
|
97
|
+
const [componentMessages, setComponentMessages] = (0, hooks_1.useState)([]);
|
|
98
|
+
const [deferredComponentMessages, setDeferredComponentMessages] = (0, hooks_1.useState)([]);
|
|
99
|
+
const prevMessagesCustomPropRef = (0, hooks_1.useRef)(messagesCustomProp);
|
|
100
|
+
const addComponentMessage = (0, hooks_1.useCallback)((...messages) => {
|
|
101
|
+
setComponentMessages((prevMessages) => [...prevMessages, ...messages]);
|
|
102
|
+
}, []);
|
|
103
|
+
const addDeferredComponentMessage = (0, hooks_1.useCallback)((message) => {
|
|
104
|
+
setComponentMessages((prevMessages) => [...prevMessages, message]);
|
|
105
|
+
}, []);
|
|
106
|
+
const clearAllComponentMessages = (0, hooks_1.useCallback)(() => {
|
|
107
|
+
setComponentMessages([]);
|
|
108
|
+
setDeferredComponentMessages([]);
|
|
109
|
+
}, []);
|
|
110
|
+
const clearDeferredComponentMessages = (0, hooks_1.useCallback)(() => {
|
|
111
|
+
setDeferredComponentMessages([]);
|
|
112
|
+
}, []);
|
|
113
|
+
const clearAllMessages = (0, hooks_1.useCallback)(() => {
|
|
114
|
+
setComponentMessages([]);
|
|
115
|
+
setDeferredComponentMessages([]);
|
|
116
|
+
setMessagesCustom([]);
|
|
117
|
+
}, []);
|
|
118
|
+
const hasCustomErrorMessages = (0, hooks_1.useCallback)(() => {
|
|
119
|
+
return messagesCustom.some((message) => message.severity === 'error');
|
|
120
|
+
}, [messagesCustom]);
|
|
121
|
+
const hasNoErrorMessages = (0, hooks_1.useCallback)(() => {
|
|
122
|
+
return (componentMessages.length === 0 &&
|
|
123
|
+
deferredComponentMessages.length === 0 &&
|
|
124
|
+
hasCustomErrorMessages() === false);
|
|
125
|
+
}, [componentMessages, deferredComponentMessages, hasCustomErrorMessages]);
|
|
126
|
+
const hasHiddenMessages = (0, hooks_1.useCallback)(() => {
|
|
127
|
+
return deferredComponentMessages.length !== 0;
|
|
128
|
+
}, [deferredComponentMessages]);
|
|
129
|
+
const showHiddenMessages = (0, hooks_1.useCallback)(() => {
|
|
130
|
+
setComponentMessages((prevMessages) => [...prevMessages, ...deferredComponentMessages]);
|
|
131
|
+
setDeferredComponentMessages([]);
|
|
132
|
+
}, [deferredComponentMessages]);
|
|
133
|
+
(0, hooks_1.useEffect)(() => {
|
|
134
|
+
if (prevMessagesCustomPropRef.current === messagesCustomProp) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
prevMessagesCustomPropRef.current = messagesCustomProp;
|
|
138
|
+
if ((0, utils_1.isShallowEqual)(messagesCustom, messagesCustomProp)) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
setMessagesCustom(messagesCustomProp);
|
|
142
|
+
}, [messagesCustom, messagesCustomProp]);
|
|
143
|
+
return (0, hooks_1.useMemo)(() => ({
|
|
144
|
+
componentMessages,
|
|
145
|
+
deferredComponentMessages,
|
|
146
|
+
messagesCustom,
|
|
147
|
+
visibleMessages: [...messagesCustom, ...componentMessages],
|
|
148
|
+
addComponentMessage,
|
|
149
|
+
addDeferredComponentMessage,
|
|
150
|
+
clearAllComponentMessages,
|
|
151
|
+
clearAllMessages,
|
|
152
|
+
clearDeferredComponentMessages,
|
|
153
|
+
hasCustomErrorMessages,
|
|
154
|
+
hasHiddenMessages,
|
|
155
|
+
hasNoErrorMessages,
|
|
156
|
+
setComponentMessages,
|
|
157
|
+
setDeferredComponentMessages,
|
|
158
|
+
showHiddenMessages
|
|
159
|
+
}), [
|
|
160
|
+
componentMessages,
|
|
161
|
+
deferredComponentMessages,
|
|
162
|
+
messagesCustom,
|
|
163
|
+
hasCustomErrorMessages,
|
|
164
|
+
hasHiddenMessages,
|
|
165
|
+
hasNoErrorMessages,
|
|
166
|
+
showHiddenMessages
|
|
167
|
+
]);
|
|
168
|
+
}
|
|
169
|
+
exports.useComponentMessaging = useComponentMessaging;
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
define('oj-c/editable-value/UNSAFE_useConverter/useConverter',["require", "exports", "ojs/ojconverter-nativenumber", "preact/hooks", "@oracle/oraclejet-preact/hooks/UNSAFE_useTranslationBundle", "../utils/utils"], function (require, exports, ojconverter_nativenumber_1, hooks_1, UNSAFE_useTranslationBundle_1, utils_1) {
|
|
173
|
+
"use strict";
|
|
174
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
175
|
+
exports.useConverter = exports.ConverterErrorSymbol = void 0;
|
|
176
|
+
exports.ConverterErrorSymbol = Symbol('ConverterError');
|
|
177
|
+
function shouldSkipParse(value) {
|
|
178
|
+
return value === '' || value === null;
|
|
179
|
+
}
|
|
180
|
+
function shouldSkipFormat(value) {
|
|
181
|
+
return value === null;
|
|
182
|
+
}
|
|
183
|
+
function useConverter({ componentMessagingState, validationState, converter }) {
|
|
184
|
+
const translations = (0, UNSAFE_useTranslationBundle_1.useTranslationBundle)('@oracle/oraclejet-preact');
|
|
185
|
+
const converterParseError = translations.inputNumber_converterParseError();
|
|
186
|
+
const parse = (0, hooks_1.useCallback)((displayValue) => {
|
|
187
|
+
if (!converter || shouldSkipParse(displayValue)) {
|
|
188
|
+
return displayValue;
|
|
189
|
+
}
|
|
190
|
+
try {
|
|
191
|
+
return converter.parse(displayValue);
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
const errorMsg = (error === null || error === void 0 ? void 0 : error.cause) === ojconverter_nativenumber_1.USER_INPUT_ERROR
|
|
195
|
+
? {
|
|
196
|
+
severity: 'error',
|
|
197
|
+
detail: converterParseError
|
|
198
|
+
}
|
|
199
|
+
: (0, utils_1.createMessageFromError)(error);
|
|
200
|
+
componentMessagingState.setComponentMessages([errorMsg]);
|
|
201
|
+
validationState.setValid('invalidShown');
|
|
202
|
+
return exports.ConverterErrorSymbol;
|
|
203
|
+
}
|
|
204
|
+
}, [converter, componentMessagingState, validationState]);
|
|
205
|
+
const format = (0, hooks_1.useCallback)((value, shouldSuppressError = false) => {
|
|
206
|
+
var _a;
|
|
207
|
+
if (!converter || shouldSkipFormat(value)) {
|
|
208
|
+
return (_a = (0, utils_1.treatNull)(value, '')) !== null && _a !== void 0 ? _a : '';
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
return converter.format(value);
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
if (!shouldSuppressError) {
|
|
215
|
+
componentMessagingState.setComponentMessages([(0, utils_1.createMessageFromError)(error)]);
|
|
216
|
+
validationState.setValid('invalidShown');
|
|
217
|
+
}
|
|
218
|
+
return (0, utils_1.treatNull)(value, '');
|
|
219
|
+
}
|
|
220
|
+
}, [converter, componentMessagingState, validationState]);
|
|
221
|
+
return (0, hooks_1.useMemo)(() => ({
|
|
222
|
+
format,
|
|
223
|
+
parse
|
|
224
|
+
}), [format, parse]);
|
|
225
|
+
}
|
|
226
|
+
exports.useConverter = useConverter;
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
define('oj-c/editable-value/UNSAFE_useConverterLifecycle/useConverterLifecycle',["require", "exports", "preact/hooks"], function (require, exports, hooks_1) {
|
|
230
|
+
"use strict";
|
|
231
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
232
|
+
exports.useConverterLifecycle = void 0;
|
|
233
|
+
function useConverterLifecycle({ converter, validationState, refreshDisplayValue, runFullValidationAndUpdateValue }) {
|
|
234
|
+
const prevConverterRef = (0, hooks_1.useRef)(converter);
|
|
235
|
+
(0, hooks_1.useEffect)(() => {
|
|
236
|
+
if (prevConverterRef.current === converter) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
prevConverterRef.current = converter;
|
|
240
|
+
const { valid } = validationState;
|
|
241
|
+
switch (valid) {
|
|
242
|
+
case 'invalidShown':
|
|
243
|
+
runFullValidationAndUpdateValue();
|
|
244
|
+
break;
|
|
245
|
+
case 'valid':
|
|
246
|
+
case 'invalidHidden':
|
|
247
|
+
default:
|
|
248
|
+
refreshDisplayValue();
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
}, [converter, validationState, refreshDisplayValue, runFullValidationAndUpdateValue]);
|
|
252
|
+
}
|
|
253
|
+
exports.useConverterLifecycle = useConverterLifecycle;
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
257
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
258
|
+
};
|
|
259
|
+
define('oj-c/editable-value/UNSAFE_useDeferredValidators/useDeferredValidators',["require", "exports", "ojs/ojvalidator-required", "preact/hooks"], function (require, exports, ojvalidator_required_1, hooks_1) {
|
|
260
|
+
"use strict";
|
|
261
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
262
|
+
exports.useDeferredValidators = void 0;
|
|
263
|
+
ojvalidator_required_1 = __importDefault(ojvalidator_required_1);
|
|
264
|
+
function useDeferredValidators({ labelHint, required, requiredMessageDetail }) {
|
|
265
|
+
const requiredValidator = (0, hooks_1.useMemo)(() => {
|
|
266
|
+
if (required) {
|
|
267
|
+
return new ojvalidator_required_1.default({
|
|
268
|
+
label: labelHint,
|
|
269
|
+
messageDetail: requiredMessageDetail
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
return null;
|
|
273
|
+
}, [required]);
|
|
274
|
+
return (0, hooks_1.useMemo)(() => [requiredValidator].filter(Boolean), [requiredValidator]);
|
|
275
|
+
}
|
|
276
|
+
exports.useDeferredValidators = useDeferredValidators;
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
define('oj-c/editable-value/UNSAFE_useStaleIdentity/useStaleIdentity',["require", "exports", "preact/hooks"], function (require, exports, hooks_1) {
|
|
280
|
+
"use strict";
|
|
281
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
282
|
+
exports.useStaleIdentity = void 0;
|
|
283
|
+
function useStaleIdentity() {
|
|
284
|
+
const staleIdentityMap = (0, hooks_1.useRef)(new Map());
|
|
285
|
+
const setStaleIdentity = (0, hooks_1.useCallback)((id) => {
|
|
286
|
+
const localStaleIdentity = Symbol();
|
|
287
|
+
staleIdentityMap.current.set(id, localStaleIdentity);
|
|
288
|
+
return {
|
|
289
|
+
isStale: () => localStaleIdentity !== staleIdentityMap.current.get(id)
|
|
290
|
+
};
|
|
291
|
+
}, []);
|
|
292
|
+
return { setStaleIdentity };
|
|
293
|
+
}
|
|
294
|
+
exports.useStaleIdentity = useStaleIdentity;
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
298
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
299
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
300
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
301
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
302
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
303
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
304
|
+
});
|
|
305
|
+
};
|
|
306
|
+
define('oj-c/editable-value/UNSAFE_useValidators/useValidators',["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) {
|
|
307
|
+
"use strict";
|
|
308
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
309
|
+
exports.useValidators = exports.ValidationResult = void 0;
|
|
310
|
+
exports.ValidationResult = {
|
|
311
|
+
VALID: 'VALID',
|
|
312
|
+
INVALID: 'INVALID',
|
|
313
|
+
STALE: 'STALE'
|
|
314
|
+
};
|
|
315
|
+
function useValidators({ componentMessagingState, defaultValidState, deferredValidators = [], validators = [], addBusyState, onValidChanged }) {
|
|
316
|
+
const [valid, setValid] = (0, UNSAFE_useUncontrolledState_1.useUncontrolledState)(defaultValidState, onValidChanged);
|
|
317
|
+
const { setStaleIdentity } = (0, useStaleIdentity_1.useStaleIdentity)();
|
|
318
|
+
(0, hooks_1.useLayoutEffect)(() => {
|
|
319
|
+
if (defaultValidState !== undefined) {
|
|
320
|
+
onValidChanged === null || onValidChanged === void 0 ? void 0 : onValidChanged(defaultValidState);
|
|
321
|
+
}
|
|
322
|
+
}, []);
|
|
323
|
+
const fullValidate = (0, hooks_1.useCallback)((value, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
324
|
+
const { addComponentMessage, clearAllComponentMessages, clearAllMessages, hasCustomErrorMessages, setComponentMessages } = componentMessagingState;
|
|
325
|
+
const { doNotClearMessagesCustom = false } = options;
|
|
326
|
+
const hadCustomErrorMessages = hasCustomErrorMessages();
|
|
327
|
+
setValid('pending');
|
|
328
|
+
if (doNotClearMessagesCustom) {
|
|
329
|
+
clearAllComponentMessages();
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
clearAllMessages();
|
|
333
|
+
}
|
|
334
|
+
if (validators.length === 0 && deferredValidators.length === 0) {
|
|
335
|
+
if (hadCustomErrorMessages && doNotClearMessagesCustom) {
|
|
336
|
+
setValid('invalidShown');
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
setValid('valid');
|
|
340
|
+
}
|
|
341
|
+
return true;
|
|
342
|
+
}
|
|
343
|
+
const errors = [];
|
|
344
|
+
const maybeErrorsPromise = [];
|
|
345
|
+
for (const validator of [...deferredValidators, ...validators]) {
|
|
346
|
+
try {
|
|
347
|
+
const validateResult = validator.validate(value);
|
|
348
|
+
if (validateResult instanceof Promise) {
|
|
349
|
+
maybeErrorsPromise.push(validateResult.then(() => { }, (error) => (0, utils_1.createMessageFromError)(error)));
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
catch (error) {
|
|
353
|
+
errors.push((0, utils_1.createMessageFromError)(error));
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (!errors.length && !maybeErrorsPromise.length) {
|
|
357
|
+
if (hadCustomErrorMessages && doNotClearMessagesCustom) {
|
|
358
|
+
setValid('invalidShown');
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
setValid('valid');
|
|
362
|
+
}
|
|
363
|
+
return true;
|
|
364
|
+
}
|
|
365
|
+
const hasSyncError = errors.length !== 0;
|
|
366
|
+
if (hasSyncError) {
|
|
367
|
+
setComponentMessages(errors);
|
|
368
|
+
setValid('invalidShown');
|
|
369
|
+
}
|
|
370
|
+
if (!maybeErrorsPromise.length) {
|
|
371
|
+
return !hasSyncError;
|
|
372
|
+
}
|
|
373
|
+
const resolver = addBusyState === null || addBusyState === void 0 ? void 0 : addBusyState('running validation');
|
|
374
|
+
const { isStale } = setStaleIdentity('useValidators-validate');
|
|
375
|
+
let hasAsyncError = false;
|
|
376
|
+
for (const asyncValidationResult of maybeErrorsPromise) {
|
|
377
|
+
const maybeValidationError = yield asyncValidationResult;
|
|
378
|
+
if (maybeValidationError && !isStale()) {
|
|
379
|
+
addComponentMessage(maybeValidationError);
|
|
380
|
+
setValid('invalidShown');
|
|
381
|
+
hasAsyncError = true;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (!hasSyncError && !hasAsyncError && !isStale()) {
|
|
385
|
+
if (hadCustomErrorMessages && doNotClearMessagesCustom) {
|
|
386
|
+
setValid('invalidShown');
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
setValid('valid');
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
resolver === null || resolver === void 0 ? void 0 : resolver();
|
|
393
|
+
return !hasSyncError && !hasAsyncError;
|
|
394
|
+
}), [componentMessagingState, deferredValidators, validators]);
|
|
395
|
+
const deferredValidate = (0, hooks_1.useCallback)((value) => {
|
|
396
|
+
const errors = [];
|
|
397
|
+
for (const validator of deferredValidators) {
|
|
398
|
+
try {
|
|
399
|
+
validator.validate(value);
|
|
400
|
+
}
|
|
401
|
+
catch (error) {
|
|
402
|
+
errors.push((0, utils_1.createMessageFromError)(error));
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
if (errors.length) {
|
|
406
|
+
return errors;
|
|
407
|
+
}
|
|
408
|
+
return undefined;
|
|
409
|
+
}, [deferredValidators]);
|
|
410
|
+
const validateValueOnInternalChange = (0, hooks_1.useCallback)((value, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
411
|
+
const { isStale } = setStaleIdentity('useValidationLifeCycle-validateValueOnInternalChange');
|
|
412
|
+
const resolver = addBusyState === null || addBusyState === void 0 ? void 0 : addBusyState('running validateValueOnInternalChange');
|
|
413
|
+
const validationResult = yield fullValidate(value, options);
|
|
414
|
+
resolver === null || resolver === void 0 ? void 0 : resolver();
|
|
415
|
+
if (isStale()) {
|
|
416
|
+
return exports.ValidationResult.STALE;
|
|
417
|
+
}
|
|
418
|
+
return validationResult ? exports.ValidationResult.VALID : exports.ValidationResult.INVALID;
|
|
419
|
+
}), [addBusyState, fullValidate]);
|
|
420
|
+
const validateValueOnExternalChange = (0, hooks_1.useCallback)((value) => {
|
|
421
|
+
const { clearAllMessages, setDeferredComponentMessages } = componentMessagingState;
|
|
422
|
+
clearAllMessages();
|
|
423
|
+
const maybeErrors = deferredValidate(value);
|
|
424
|
+
if (maybeErrors) {
|
|
425
|
+
setDeferredComponentMessages(maybeErrors);
|
|
426
|
+
setValid('invalidHidden');
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
setValid('valid');
|
|
430
|
+
}
|
|
431
|
+
return exports.ValidationResult.VALID;
|
|
432
|
+
}, [componentMessagingState, deferredValidate]);
|
|
433
|
+
return (0, hooks_1.useMemo)(() => ({
|
|
434
|
+
valid,
|
|
435
|
+
setValid,
|
|
436
|
+
deferredValidate,
|
|
437
|
+
fullValidate,
|
|
438
|
+
validateValueOnExternalChange,
|
|
439
|
+
validateValueOnInternalChange
|
|
440
|
+
}), [
|
|
441
|
+
valid,
|
|
442
|
+
deferredValidate,
|
|
443
|
+
fullValidate,
|
|
444
|
+
validateValueOnExternalChange,
|
|
445
|
+
validateValueOnInternalChange
|
|
446
|
+
]);
|
|
447
|
+
}
|
|
448
|
+
exports.useValidators = useValidators;
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
452
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
453
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
454
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
455
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
456
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
457
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
458
|
+
});
|
|
459
|
+
};
|
|
460
|
+
define('oj-c/editable-value/UNSAFE_useValidationLifecycle/useValidationLifecycle',["require", "exports", "preact/hooks", "../UNSAFE_useConverter/useConverter", "../UNSAFE_useValidators/useValidators", "../utils/utils"], function (require, exports, hooks_1, useConverter_1, useValidators_1, utils_1) {
|
|
461
|
+
"use strict";
|
|
462
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
463
|
+
exports.useValidationLifecycle = void 0;
|
|
464
|
+
function useValidationLifecycle({ componentMessagingState, deferredValidators, validationState, validators, getValueForValidation, setValueAfterValidation }) {
|
|
465
|
+
const prevDeferredValidatorsRef = (0, hooks_1.useRef)(deferredValidators);
|
|
466
|
+
const prevValidatorsRef = (0, hooks_1.useRef)(validators);
|
|
467
|
+
const prevMessagesCustomRef = (0, hooks_1.useRef)(componentMessagingState.messagesCustom);
|
|
468
|
+
const runFullValidationAndUpdateValue = (0, hooks_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
|
|
469
|
+
const { valid, validateValueOnInternalChange } = validationState;
|
|
470
|
+
const value = getValueForValidation(valid);
|
|
471
|
+
if (value === useConverter_1.ConverterErrorSymbol) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
const validationResult = yield validateValueOnInternalChange(value, {
|
|
475
|
+
doNotClearMessagesCustom: true
|
|
476
|
+
});
|
|
477
|
+
if (validationResult === useValidators_1.ValidationResult.VALID) {
|
|
478
|
+
setValueAfterValidation(value);
|
|
479
|
+
}
|
|
480
|
+
}), [validationState, getValueForValidation, setValueAfterValidation]);
|
|
481
|
+
(0, hooks_1.useEffect)(() => {
|
|
482
|
+
const value = getValueForValidation('valid');
|
|
483
|
+
if (value === useConverter_1.ConverterErrorSymbol) {
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
const { deferredValidate, setValid } = validationState;
|
|
487
|
+
const { hasCustomErrorMessages, setDeferredComponentMessages } = componentMessagingState;
|
|
488
|
+
const maybeErrors = deferredValidate(value);
|
|
489
|
+
if (maybeErrors) {
|
|
490
|
+
setDeferredComponentMessages(maybeErrors);
|
|
491
|
+
setValid('invalidHidden');
|
|
492
|
+
}
|
|
493
|
+
if (hasCustomErrorMessages()) {
|
|
494
|
+
setValid('invalidShown');
|
|
495
|
+
}
|
|
496
|
+
}, []);
|
|
497
|
+
(0, hooks_1.useEffect)(() => {
|
|
498
|
+
if (prevDeferredValidatorsRef.current === deferredValidators) {
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
const { valid, deferredValidate, setValid } = validationState;
|
|
502
|
+
const { clearDeferredComponentMessages, setDeferredComponentMessages } = componentMessagingState;
|
|
503
|
+
prevDeferredValidatorsRef.current = deferredValidators;
|
|
504
|
+
switch (valid) {
|
|
505
|
+
case 'valid':
|
|
506
|
+
const value = getValueForValidation(valid);
|
|
507
|
+
if (value !== useConverter_1.ConverterErrorSymbol) {
|
|
508
|
+
const maybeErrors = deferredValidate(value);
|
|
509
|
+
if (maybeErrors) {
|
|
510
|
+
setDeferredComponentMessages(maybeErrors);
|
|
511
|
+
setValid('invalidHidden');
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
break;
|
|
515
|
+
case 'invalidHidden':
|
|
516
|
+
if (deferredValidators.length === 0) {
|
|
517
|
+
setValid('valid');
|
|
518
|
+
clearDeferredComponentMessages();
|
|
519
|
+
}
|
|
520
|
+
break;
|
|
521
|
+
case 'invalidShown':
|
|
522
|
+
runFullValidationAndUpdateValue();
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
}, [
|
|
526
|
+
deferredValidators,
|
|
527
|
+
componentMessagingState,
|
|
528
|
+
validationState,
|
|
529
|
+
getValueForValidation,
|
|
530
|
+
runFullValidationAndUpdateValue
|
|
531
|
+
]);
|
|
532
|
+
(0, hooks_1.useEffect)(() => {
|
|
533
|
+
if (prevValidatorsRef.current === validators) {
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
prevValidatorsRef.current = validators;
|
|
537
|
+
switch (validationState.valid) {
|
|
538
|
+
case 'invalidShown':
|
|
539
|
+
runFullValidationAndUpdateValue();
|
|
540
|
+
break;
|
|
541
|
+
}
|
|
542
|
+
}, [validators, validationState]);
|
|
543
|
+
(0, hooks_1.useEffect)(() => {
|
|
544
|
+
if ((0, utils_1.isShallowEqual)(prevMessagesCustomRef.current, componentMessagingState.messagesCustom)) {
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
const { messagesCustom, hasCustomErrorMessages, hasHiddenMessages, hasNoErrorMessages } = componentMessagingState;
|
|
548
|
+
const { valid, setValid } = validationState;
|
|
549
|
+
prevMessagesCustomRef.current = messagesCustom;
|
|
550
|
+
if (hasCustomErrorMessages()) {
|
|
551
|
+
setValid('invalidShown');
|
|
552
|
+
}
|
|
553
|
+
else if (valid === 'pending') {
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
else if (hasNoErrorMessages()) {
|
|
557
|
+
setValid('valid');
|
|
558
|
+
}
|
|
559
|
+
else if (hasHiddenMessages()) {
|
|
560
|
+
setValid('invalidHidden');
|
|
561
|
+
}
|
|
562
|
+
}, [componentMessagingState, validationState]);
|
|
563
|
+
return {
|
|
564
|
+
runFullValidationAndUpdateValue
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
exports.useValidationLifecycle = useValidationLifecycle;
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
define('oj-c/editable-value/UNSAFE_useValue/useValue',["require", "exports", "@oracle/oraclejet-preact/hooks/UNSAFE_useUncontrolledState", "preact/hooks", "../utils/utils"], function (require, exports, UNSAFE_useUncontrolledState_1, hooks_1, utils_1) {
|
|
571
|
+
"use strict";
|
|
572
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
573
|
+
exports.useValue = void 0;
|
|
574
|
+
function useValue({ value: valueProp, format, parse, onRawValueChanged, onTransientValueChanged, onValueChanged }) {
|
|
575
|
+
const [displayValue, setDisplayValue] = (0, UNSAFE_useUncontrolledState_1.useUncontrolledState)(format(valueProp, true), onRawValueChanged);
|
|
576
|
+
const [value, setValue] = (0, UNSAFE_useUncontrolledState_1.useUncontrolledState)(valueProp, onValueChanged);
|
|
577
|
+
(0, hooks_1.useEffect)(() => {
|
|
578
|
+
if (displayValue !== undefined) {
|
|
579
|
+
onRawValueChanged === null || onRawValueChanged === void 0 ? void 0 : onRawValueChanged(displayValue);
|
|
580
|
+
}
|
|
581
|
+
}, []);
|
|
582
|
+
const [transientValue, setTransientValue] = (0, UNSAFE_useUncontrolledState_1.useUncontrolledState)(valueProp, onTransientValueChanged);
|
|
583
|
+
(0, hooks_1.useEffect)(() => {
|
|
584
|
+
if (valueProp !== undefined) {
|
|
585
|
+
onTransientValueChanged === null || onTransientValueChanged === void 0 ? void 0 : onTransientValueChanged(valueProp);
|
|
586
|
+
}
|
|
587
|
+
}, []);
|
|
588
|
+
return {
|
|
589
|
+
displayValue,
|
|
590
|
+
transientValue,
|
|
591
|
+
value,
|
|
592
|
+
getValueForValidation: (0, hooks_1.useCallback)((valid) => {
|
|
593
|
+
if (valid !== 'invalidShown') {
|
|
594
|
+
return value;
|
|
595
|
+
}
|
|
596
|
+
return parse((0, utils_1.normalizeValue)(displayValue));
|
|
597
|
+
}, [displayValue, value, parse]),
|
|
598
|
+
setValueAfterValidation: (0, hooks_1.useCallback)((value) => {
|
|
599
|
+
setValue(value);
|
|
600
|
+
setDisplayValue(format(value));
|
|
601
|
+
}, [format]),
|
|
602
|
+
setDisplayValue,
|
|
603
|
+
setTransientValue,
|
|
604
|
+
setValue,
|
|
605
|
+
refreshDisplayValue: (0, hooks_1.useCallback)(() => {
|
|
606
|
+
setDisplayValue(format(value));
|
|
607
|
+
}, [value, format])
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
exports.useValue = useValue;
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
define('oj-c/editable-value/UNSAFE_useValueLifecycle/useValueLifecycle',["require", "exports", "preact/hooks", "../UNSAFE_useValidators/useValidators"], function (require, exports, hooks_1, useValidators_1) {
|
|
614
|
+
"use strict";
|
|
615
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
616
|
+
exports.useValueLifecycle = void 0;
|
|
617
|
+
function useValueLifecycle({ value, valueState, format, validateValueOnExternalChange }) {
|
|
618
|
+
const previousValueRef = (0, hooks_1.useRef)(value);
|
|
619
|
+
(0, hooks_1.useEffect)(() => {
|
|
620
|
+
const { value, setDisplayValue } = valueState;
|
|
621
|
+
setDisplayValue(format(value));
|
|
622
|
+
}, []);
|
|
623
|
+
(0, hooks_1.useEffect)(() => {
|
|
624
|
+
if (previousValueRef.current === value) {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
previousValueRef.current = value;
|
|
628
|
+
if (value !== undefined && value !== valueState.value) {
|
|
629
|
+
const { setDisplayValue, setValue } = valueState;
|
|
630
|
+
const validationResult = validateValueOnExternalChange(value);
|
|
631
|
+
if (validationResult === useValidators_1.ValidationResult.VALID) {
|
|
632
|
+
setValue(value);
|
|
633
|
+
setDisplayValue(format(value));
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}, [value, valueState, format]);
|
|
637
|
+
}
|
|
638
|
+
exports.useValueLifecycle = useValueLifecycle;
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
642
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
643
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
644
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
645
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
646
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
647
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
648
|
+
});
|
|
649
|
+
};
|
|
650
|
+
define('oj-c/editable-value/UNSAFE_useEditableValue/useEditableValue',["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) {
|
|
651
|
+
"use strict";
|
|
652
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
653
|
+
exports.useEditableValue = void 0;
|
|
654
|
+
function useEditableValue({ ariaDescribedBy, converter, displayOptions, implicitComponentValidator, labelHint, messagesCustom, required, requiredMessageDetail, shouldNormalizeValueOnCommit = true, validators, value: valueProp, addBusyState, onMessagesCustomChanged, onRawValueChanged, onValidChanged, onValueChanged, onTransientValueChanged, wrapValueState }) {
|
|
655
|
+
const componentMessagingState = (0, useComponentMessaging_1.useComponentMessaging)({
|
|
656
|
+
messagesCustom,
|
|
657
|
+
onMessagesCustomChanged
|
|
658
|
+
});
|
|
659
|
+
const { clearAllMessages, visibleMessages } = componentMessagingState;
|
|
660
|
+
const deferredValidators = (0, useDeferredValidators_1.useDeferredValidators)({
|
|
661
|
+
labelHint,
|
|
662
|
+
required,
|
|
663
|
+
requiredMessageDetail
|
|
664
|
+
});
|
|
665
|
+
const combinedValidators = !implicitComponentValidator
|
|
666
|
+
? validators
|
|
667
|
+
: validators
|
|
668
|
+
? [implicitComponentValidator, ...validators]
|
|
669
|
+
: [implicitComponentValidator];
|
|
670
|
+
const validationState = (0, useValidators_1.useValidators)({
|
|
671
|
+
componentMessagingState,
|
|
672
|
+
defaultValidState: 'valid',
|
|
673
|
+
deferredValidators,
|
|
674
|
+
validators: combinedValidators,
|
|
675
|
+
addBusyState,
|
|
676
|
+
onValidChanged
|
|
677
|
+
});
|
|
678
|
+
const { validateValueOnExternalChange, validateValueOnInternalChange } = validationState;
|
|
679
|
+
const { format, parse } = (0, useConverter_1.useConverter)({
|
|
680
|
+
componentMessagingState,
|
|
681
|
+
converter,
|
|
682
|
+
validationState
|
|
683
|
+
});
|
|
684
|
+
const defaultValueState = (0, useValue_1.useValue)({
|
|
685
|
+
value: valueProp,
|
|
686
|
+
format,
|
|
687
|
+
parse,
|
|
688
|
+
onRawValueChanged,
|
|
689
|
+
onTransientValueChanged,
|
|
690
|
+
onValueChanged
|
|
691
|
+
});
|
|
692
|
+
const valueState = wrapValueState ? wrapValueState(defaultValueState) : defaultValueState;
|
|
693
|
+
const { displayValue, value, getValueForValidation, setValueAfterValidation, refreshDisplayValue, setDisplayValue, setTransientValue, setValue } = valueState;
|
|
694
|
+
const { runFullValidationAndUpdateValue } = (0, useValidationLifecycle_1.useValidationLifecycle)({
|
|
695
|
+
componentMessagingState,
|
|
696
|
+
validationState,
|
|
697
|
+
deferredValidators,
|
|
698
|
+
validators,
|
|
699
|
+
getValueForValidation,
|
|
700
|
+
setValueAfterValidation
|
|
701
|
+
});
|
|
702
|
+
(0, useConverterLifecycle_1.useConverterLifecycle)({
|
|
703
|
+
converter,
|
|
704
|
+
validationState,
|
|
705
|
+
refreshDisplayValue,
|
|
706
|
+
runFullValidationAndUpdateValue
|
|
707
|
+
});
|
|
708
|
+
(0, useValueLifecycle_1.useValueLifecycle)({
|
|
709
|
+
value: valueProp,
|
|
710
|
+
valueState,
|
|
711
|
+
format,
|
|
712
|
+
validateValueOnExternalChange
|
|
713
|
+
});
|
|
714
|
+
const normalizeAndParseValue = (0, hooks_1.useCallback)((value) => {
|
|
715
|
+
return parse(shouldNormalizeValueOnCommit ? (0, utils_1.normalizeValue)(value) : value);
|
|
716
|
+
}, [shouldNormalizeValueOnCommit, parse]);
|
|
717
|
+
const onCommitValue = (0, hooks_1.useCallback)((value, doCommitOnValid = true) => __awaiter(this, void 0, void 0, function* () {
|
|
718
|
+
const validationResult = yield validateValueOnInternalChange(value);
|
|
719
|
+
if (validationResult === useValidators_1.ValidationResult.VALID && doCommitOnValid) {
|
|
720
|
+
setValue(value);
|
|
721
|
+
}
|
|
722
|
+
return validationResult;
|
|
723
|
+
}), [validateValueOnInternalChange]);
|
|
724
|
+
const onCommit = (0, hooks_1.useCallback)(({ value }) => __awaiter(this, void 0, void 0, function* () {
|
|
725
|
+
const parsedValueOrSymbol = normalizeAndParseValue(value);
|
|
726
|
+
if (parsedValueOrSymbol === useConverter_1.ConverterErrorSymbol) {
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
const parsedValue = parsedValueOrSymbol;
|
|
730
|
+
const validationResult = yield onCommitValue(parsedValue);
|
|
731
|
+
if (validationResult === useValidators_1.ValidationResult.VALID) {
|
|
732
|
+
setDisplayValue(format(parsedValue));
|
|
733
|
+
}
|
|
734
|
+
}), [format, onCommitValue, normalizeAndParseValue]);
|
|
735
|
+
const onInput = (0, hooks_1.useCallback)(({ value }) => {
|
|
736
|
+
setDisplayValue(value !== null && value !== void 0 ? value : '');
|
|
737
|
+
}, []);
|
|
738
|
+
const reset = (0, hooks_1.useCallback)(() => {
|
|
739
|
+
clearAllMessages();
|
|
740
|
+
validateValueOnExternalChange(value);
|
|
741
|
+
refreshDisplayValue();
|
|
742
|
+
}, [value, clearAllMessages, refreshDisplayValue, validateValueOnExternalChange]);
|
|
743
|
+
const validate = (0, hooks_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
|
|
744
|
+
const { fullValidate } = validationState;
|
|
745
|
+
const { displayValue, value, setValueAfterValidation } = valueState;
|
|
746
|
+
const newValueOrSymbol = normalizeAndParseValue(displayValue);
|
|
747
|
+
if (newValueOrSymbol === useConverter_1.ConverterErrorSymbol) {
|
|
748
|
+
return 'invalid';
|
|
749
|
+
}
|
|
750
|
+
const newValue = newValueOrSymbol;
|
|
751
|
+
const resolver = addBusyState === null || addBusyState === void 0 ? void 0 : addBusyState('running component method validate');
|
|
752
|
+
const validateResult = yield fullValidate(newValue);
|
|
753
|
+
resolver === null || resolver === void 0 ? void 0 : resolver();
|
|
754
|
+
if (validateResult) {
|
|
755
|
+
if (newValue !== value) {
|
|
756
|
+
setValueAfterValidation(newValue);
|
|
757
|
+
}
|
|
758
|
+
return 'valid';
|
|
759
|
+
}
|
|
760
|
+
return 'invalid';
|
|
761
|
+
}), [validationState, valueState, addBusyState, normalizeAndParseValue]);
|
|
762
|
+
const showMessages = (0, hooks_1.useCallback)(() => {
|
|
763
|
+
const { hasHiddenMessages, showHiddenMessages } = componentMessagingState;
|
|
764
|
+
const { setValid } = validationState;
|
|
765
|
+
if (hasHiddenMessages()) {
|
|
766
|
+
showHiddenMessages();
|
|
767
|
+
setValid('invalidShown');
|
|
768
|
+
}
|
|
769
|
+
}, [componentMessagingState, validationState]);
|
|
770
|
+
return {
|
|
771
|
+
value,
|
|
772
|
+
setValue,
|
|
773
|
+
displayValue,
|
|
774
|
+
setDisplayValue,
|
|
775
|
+
setTransientValue,
|
|
776
|
+
methods: {
|
|
777
|
+
reset,
|
|
778
|
+
validate,
|
|
779
|
+
showMessages
|
|
780
|
+
},
|
|
781
|
+
textFieldProps: {
|
|
782
|
+
messages: (displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.messages) !== 'none' ? visibleMessages : undefined,
|
|
783
|
+
value: displayValue,
|
|
784
|
+
ariaDescribedBy,
|
|
785
|
+
onCommit,
|
|
786
|
+
onInput
|
|
787
|
+
},
|
|
788
|
+
onCommitValue,
|
|
789
|
+
format,
|
|
790
|
+
normalizeAndParseValue
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
exports.useEditableValue = useEditableValue;
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
define('oj-c/input-number/useImplicitNumberConverter',["require", "exports", "ojs/ojconverter-nativenumber", "preact/hooks"], function (require, exports, ojconverter_nativenumber_1, hooks_1) {
|
|
797
|
+
"use strict";
|
|
798
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
799
|
+
exports.useImplicitNumberConverter = void 0;
|
|
800
|
+
function useImplicitNumberConverter({ converter }) {
|
|
801
|
+
const implicitConverter = (0, hooks_1.useMemo)(() => {
|
|
802
|
+
return converter !== null && converter !== void 0 ? converter : new ojconverter_nativenumber_1.NumberConverter();
|
|
803
|
+
}, [converter]);
|
|
804
|
+
return implicitConverter;
|
|
805
|
+
}
|
|
806
|
+
exports.useImplicitNumberConverter = useImplicitNumberConverter;
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
810
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
811
|
+
};
|
|
812
|
+
define('oj-c/input-number/useImplicitNumberRangeValidator',["require", "exports", "preact/hooks", "ojs/ojvalidator-numberrange"], function (require, exports, hooks_1, ojvalidator_numberrange_1) {
|
|
813
|
+
"use strict";
|
|
814
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
815
|
+
exports.useImplicitNumberRangeValidator = void 0;
|
|
816
|
+
ojvalidator_numberrange_1 = __importDefault(ojvalidator_numberrange_1);
|
|
817
|
+
function useImplicitNumberRangeValidator({ converter, max, min, numberRangeExactMessageDetail, numberRangeOverflowMessageDetail, numberRangeUnderflowMessageDetail }) {
|
|
818
|
+
const numberRangeValidator = (0, hooks_1.useMemo)(() => {
|
|
819
|
+
if (min !== undefined || max !== undefined) {
|
|
820
|
+
return new ojvalidator_numberrange_1.default({
|
|
821
|
+
converter,
|
|
822
|
+
max,
|
|
823
|
+
min,
|
|
824
|
+
messageDetail: {
|
|
825
|
+
exact: numberRangeExactMessageDetail,
|
|
826
|
+
rangeOverflow: numberRangeOverflowMessageDetail,
|
|
827
|
+
rangeUnderflow: numberRangeUnderflowMessageDetail
|
|
828
|
+
}
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
return null;
|
|
832
|
+
}, [converter, min, max]);
|
|
833
|
+
return numberRangeValidator;
|
|
834
|
+
}
|
|
835
|
+
exports.useImplicitNumberRangeValidator = useImplicitNumberRangeValidator;
|
|
836
|
+
});
|
|
837
|
+
|
|
838
|
+
define('oj-c/input-number/stepBasisUtils',["require", "exports"], function (require, exports) {
|
|
839
|
+
"use strict";
|
|
840
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
841
|
+
exports.determineSteppedValue = void 0;
|
|
842
|
+
function determineSteppedValue(step, stepOpt, currentParsedValue, initialValue, maxOpt, minOpt) {
|
|
843
|
+
const precision = _precision(stepOpt, initialValue, minOpt);
|
|
844
|
+
if (precision > 0) {
|
|
845
|
+
const power = Math.pow(10, precision);
|
|
846
|
+
const minOptPower = minOpt !== undefined ? Math.round(minOpt * power) : minOpt;
|
|
847
|
+
const maxOptPower = maxOpt != null ? Math.round(maxOpt * power) : maxOpt;
|
|
848
|
+
const stepOptPower = Math.round(stepOpt * power);
|
|
849
|
+
const adjustValuePower = _adjustValueForZeroPrecision(Math.round(step * power), stepOptPower, Math.round(currentParsedValue * power), initialValue !== undefined && initialValue !== null
|
|
850
|
+
? Math.round(initialValue * power)
|
|
851
|
+
: initialValue, maxOptPower, minOptPower);
|
|
852
|
+
return adjustValuePower / power;
|
|
853
|
+
}
|
|
854
|
+
return _adjustValueForZeroPrecision(step, stepOpt, currentParsedValue, initialValue, maxOpt, minOpt);
|
|
855
|
+
}
|
|
856
|
+
exports.determineSteppedValue = determineSteppedValue;
|
|
857
|
+
function _adjustValueForZeroPrecision(step, stepOpt, currentParsedValue, initialValue, maxOpt, minOpt) {
|
|
858
|
+
let stepBase = minOpt != null ? minOpt : initialValue;
|
|
859
|
+
if (stepBase === null || stepBase === undefined) {
|
|
860
|
+
stepBase = 0;
|
|
861
|
+
}
|
|
862
|
+
try {
|
|
863
|
+
currentParsedValue = parseFloat(currentParsedValue.toFixed(0));
|
|
864
|
+
}
|
|
865
|
+
catch (e) {
|
|
866
|
+
if (e instanceof TypeError) {
|
|
867
|
+
currentParsedValue = +currentParsedValue;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
let aboveMin = currentParsedValue - stepBase;
|
|
871
|
+
let rounded = Math.round(aboveMin / stepOpt) * stepOpt;
|
|
872
|
+
rounded = parseFloat(rounded.toFixed(0));
|
|
873
|
+
const multiple = rounded === aboveMin;
|
|
874
|
+
let newValue;
|
|
875
|
+
if (!multiple) {
|
|
876
|
+
if (step < 0) {
|
|
877
|
+
aboveMin = Math.ceil(aboveMin / stepOpt) * stepOpt;
|
|
878
|
+
}
|
|
879
|
+
else {
|
|
880
|
+
aboveMin = Math.floor(aboveMin / stepOpt) * stepOpt;
|
|
881
|
+
}
|
|
882
|
+
newValue = stepBase + aboveMin + step;
|
|
883
|
+
}
|
|
884
|
+
else {
|
|
885
|
+
newValue = currentParsedValue + step;
|
|
886
|
+
}
|
|
887
|
+
newValue = parseFloat(newValue.toFixed(0));
|
|
888
|
+
if (minOpt != null && newValue < minOpt) {
|
|
889
|
+
return minOpt;
|
|
890
|
+
}
|
|
891
|
+
if (maxOpt != null && newValue > maxOpt) {
|
|
892
|
+
let validMax = Math.floor((maxOpt - stepBase) / stepOpt) * stepOpt + stepBase;
|
|
893
|
+
validMax = parseFloat(validMax.toFixed(0));
|
|
894
|
+
return validMax;
|
|
895
|
+
}
|
|
896
|
+
return newValue;
|
|
897
|
+
}
|
|
898
|
+
function _precision(stepOpt, initialValue, minOpt) {
|
|
899
|
+
let precision = _precisionOf(stepOpt);
|
|
900
|
+
if (minOpt != null) {
|
|
901
|
+
precision = Math.max(precision, _precisionOf(minOpt));
|
|
902
|
+
}
|
|
903
|
+
if (initialValue != null) {
|
|
904
|
+
precision = Math.max(precision, _precisionOf(initialValue));
|
|
905
|
+
}
|
|
906
|
+
return precision;
|
|
907
|
+
}
|
|
908
|
+
function _precisionOf(num) {
|
|
909
|
+
const str = num.toString();
|
|
910
|
+
const decimal = str.indexOf('.');
|
|
911
|
+
return decimal === -1 ? 0 : str.length - decimal - 1;
|
|
912
|
+
}
|
|
913
|
+
});
|
|
914
|
+
|
|
915
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
916
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
917
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
918
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
919
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
920
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
921
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
922
|
+
});
|
|
923
|
+
};
|
|
924
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
925
|
+
var t = {};
|
|
926
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
927
|
+
t[p] = s[p];
|
|
928
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
929
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
930
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
931
|
+
t[p[i]] = s[p[i]];
|
|
932
|
+
}
|
|
933
|
+
return t;
|
|
934
|
+
};
|
|
935
|
+
define('oj-c/input-number/useNumberInputTextPreact',["require", "exports", "oj-c/editable-value/UNSAFE_useEditableValue/useEditableValue", "oj-c/editable-value/UNSAFE_useValidators/useValidators", "./useImplicitNumberConverter", "./useImplicitNumberRangeValidator", "preact/hooks", "oj-c/editable-value/utils/utils", "./stepBasisUtils"], function (require, exports, useEditableValue_1, useValidators_1, useImplicitNumberConverter_1, useImplicitNumberRangeValidator_1, hooks_1, utils_1, stepBasisUtils_1) {
|
|
936
|
+
"use strict";
|
|
937
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
938
|
+
exports.useNumberInputTextPreact = void 0;
|
|
939
|
+
function useNumberInputTextPreact(_a, addBusyState) {
|
|
940
|
+
var { autocomplete = 'on', autofocus, converter: propConverter, disabled, displayOptions, inputPrefix, inputSuffix, labelEdge, labelHint, labelStartWidth, max, messagesCustom, min, numberRangeExactMessageDetail, numberRangeOverflowMessageDetail, numberRangeUnderflowMessageDetail, placeholder, readonly, required, requiredMessageDetail, step, textAlign, userAssistanceDensity, validators, value: propValue, virtualKeyboard, onMessagesCustomChanged, onRawValueChanged, onTransientValueChanged, onValidChanged, onValueChanged } = _a, otherProps = __rest(_a, ["autocomplete", "autofocus", "converter", "disabled", "displayOptions", "inputPrefix", "inputSuffix", "labelEdge", "labelHint", "labelStartWidth", "max", "messagesCustom", "min", "numberRangeExactMessageDetail", "numberRangeOverflowMessageDetail", "numberRangeUnderflowMessageDetail", "placeholder", "readonly", "required", "requiredMessageDetail", "step", "textAlign", "userAssistanceDensity", "validators", "value", "virtualKeyboard", "onMessagesCustomChanged", "onRawValueChanged", "onTransientValueChanged", "onValidChanged", "onValueChanged"]);
|
|
941
|
+
const minTreatNull = (0, utils_1.treatNull)(min);
|
|
942
|
+
const maxTreatNull = (0, utils_1.treatNull)(max);
|
|
943
|
+
const converter = (0, useImplicitNumberConverter_1.useImplicitNumberConverter)({
|
|
944
|
+
converter: propConverter
|
|
945
|
+
});
|
|
946
|
+
const implicitComponentValidator = (0, useImplicitNumberRangeValidator_1.useImplicitNumberRangeValidator)({
|
|
947
|
+
converter,
|
|
948
|
+
max: maxTreatNull,
|
|
949
|
+
min: minTreatNull,
|
|
950
|
+
numberRangeExactMessageDetail,
|
|
951
|
+
numberRangeOverflowMessageDetail,
|
|
952
|
+
numberRangeUnderflowMessageDetail
|
|
953
|
+
});
|
|
954
|
+
const { onCommitValue, format, normalizeAndParseValue, methods, textFieldProps, value, setValue, displayValue, setDisplayValue, setTransientValue } = (0, useEditableValue_1.useEditableValue)({
|
|
955
|
+
ariaDescribedBy: otherProps['aria-describedby'],
|
|
956
|
+
converter,
|
|
957
|
+
displayOptions,
|
|
958
|
+
implicitComponentValidator,
|
|
959
|
+
messagesCustom,
|
|
960
|
+
required,
|
|
961
|
+
requiredMessageDetail,
|
|
962
|
+
validators,
|
|
963
|
+
value: propValue,
|
|
964
|
+
addBusyState,
|
|
965
|
+
onMessagesCustomChanged,
|
|
966
|
+
onRawValueChanged,
|
|
967
|
+
onTransientValueChanged,
|
|
968
|
+
onValidChanged,
|
|
969
|
+
onValueChanged
|
|
970
|
+
});
|
|
971
|
+
const hasMin = minTreatNull !== undefined;
|
|
972
|
+
const hasMax = maxTreatNull !== undefined;
|
|
973
|
+
const initialValue = (0, hooks_1.useRef)((0, utils_1.treatNull)(propValue));
|
|
974
|
+
if (propValue !== value) {
|
|
975
|
+
initialValue.current = (0, utils_1.treatNull)(propValue);
|
|
976
|
+
}
|
|
977
|
+
const [valueNow, setValueNow] = (0, hooks_1.useState)((0, utils_1.treatNull)(value) || undefined);
|
|
978
|
+
(0, hooks_1.useEffect)(() => {
|
|
979
|
+
setValueNow((0, utils_1.treatNull)(value));
|
|
980
|
+
setTransientValue(value);
|
|
981
|
+
}, [value]);
|
|
982
|
+
const [valueText, setValueText] = (0, hooks_1.useState)(displayValue || undefined);
|
|
983
|
+
(0, hooks_1.useEffect)(() => {
|
|
984
|
+
if (value === null) {
|
|
985
|
+
setValueText(undefined);
|
|
986
|
+
}
|
|
987
|
+
else {
|
|
988
|
+
const formattedValue = format(value);
|
|
989
|
+
setValueText(formattedValue);
|
|
990
|
+
}
|
|
991
|
+
}, [value, converter]);
|
|
992
|
+
const onCommit = (0, hooks_1.useCallback)(({ value }) => __awaiter(this, void 0, void 0, function* () {
|
|
993
|
+
const parsedValueOrSymbol = normalizeAndParseValue(value);
|
|
994
|
+
const parsedValue = parsedValueOrSymbol;
|
|
995
|
+
if (typeof parsedValueOrSymbol === 'symbol') {
|
|
996
|
+
setValueNow(undefined);
|
|
997
|
+
setValueText(value);
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
const validationResult = yield onCommitValue(parsedValue);
|
|
1001
|
+
if (validationResult === useValidators_1.ValidationResult.VALID) {
|
|
1002
|
+
const formattedValue = format(parsedValue);
|
|
1003
|
+
setDisplayValue(formattedValue);
|
|
1004
|
+
}
|
|
1005
|
+
else {
|
|
1006
|
+
setValueNow(parsedValue);
|
|
1007
|
+
setValueText(value);
|
|
1008
|
+
}
|
|
1009
|
+
}), [format, normalizeAndParseValue, onCommitValue]);
|
|
1010
|
+
const textFieldPropsWithOverride = Object.assign(Object.assign({}, textFieldProps), { onCommit });
|
|
1011
|
+
const doStep = (0, hooks_1.useCallback)((direction, doCommit) => __awaiter(this, void 0, void 0, function* () {
|
|
1012
|
+
if (step === undefined) {
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
const displayValueToStep = displayValue || '0';
|
|
1016
|
+
const parsedValueOrSymbol = normalizeAndParseValue(displayValueToStep);
|
|
1017
|
+
if (typeof parsedValueOrSymbol === 'symbol') {
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
const parsedValue = parsedValueOrSymbol;
|
|
1021
|
+
let newSteppedValue;
|
|
1022
|
+
if (direction !== undefined) {
|
|
1023
|
+
const stepValue = direction === 'increase' ? step : -1 * step;
|
|
1024
|
+
newSteppedValue = (0, stepBasisUtils_1.determineSteppedValue)(stepValue, step, parsedValue, initialValue.current, maxTreatNull, minTreatNull);
|
|
1025
|
+
}
|
|
1026
|
+
else {
|
|
1027
|
+
newSteppedValue = parsedValue;
|
|
1028
|
+
}
|
|
1029
|
+
const validationResult = yield onCommitValue(newSteppedValue, doCommit);
|
|
1030
|
+
if (validationResult === useValidators_1.ValidationResult.VALID) {
|
|
1031
|
+
setTransientValue(newSteppedValue);
|
|
1032
|
+
}
|
|
1033
|
+
const formattedValue = format(newSteppedValue);
|
|
1034
|
+
setDisplayValue(formattedValue);
|
|
1035
|
+
setValueText(formattedValue);
|
|
1036
|
+
setValueNow(newSteppedValue);
|
|
1037
|
+
}), [value, displayValue, format, normalizeAndParseValue, onCommitValue]);
|
|
1038
|
+
const handleStep = (0, hooks_1.useCallback)(({ direction }) => __awaiter(this, void 0, void 0, function* () {
|
|
1039
|
+
const doCommit = true;
|
|
1040
|
+
doStep(direction, doCommit);
|
|
1041
|
+
}), [doStep]);
|
|
1042
|
+
const handleSpin = (0, hooks_1.useCallback)(({ direction }) => __awaiter(this, void 0, void 0, function* () {
|
|
1043
|
+
const doCommit = false;
|
|
1044
|
+
doStep(direction, doCommit);
|
|
1045
|
+
}), [doStep]);
|
|
1046
|
+
const handleSpinComplete = (0, hooks_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
|
|
1047
|
+
const doCommit = true;
|
|
1048
|
+
doStep(undefined, doCommit);
|
|
1049
|
+
}), [displayValue, normalizeAndParseValue, onCommitValue]);
|
|
1050
|
+
return {
|
|
1051
|
+
value,
|
|
1052
|
+
setValue,
|
|
1053
|
+
methods,
|
|
1054
|
+
inputNumberProps: Object.assign({ ariaValueMax: maxTreatNull, ariaValueMin: minTreatNull, ariaValueNow: valueNow !== null && valueNow !== void 0 ? valueNow : undefined, ariaValueText: valueText !== '' ? valueText : undefined, autoComplete: autocomplete, autoFocus: autofocus, hasSteppers: step !== undefined && step > 0, isDisabled: disabled, isReadonly: readonly, isRequired: required, isRequiredShown: required && (0, utils_1.treatNull)(value) === undefined, label: labelHint, labelEdge,
|
|
1055
|
+
labelStartWidth, onSpin: step ? handleSpin : undefined, onSpinComplete: step ? handleSpinComplete : undefined, onStep: step ? handleStep : undefined, placeholder, prefix: inputPrefix, suffix: inputSuffix, isStepDownDisabled: disabled ||
|
|
1056
|
+
(hasMin &&
|
|
1057
|
+
((valueNow !== undefined && valueNow <= minTreatNull) ||
|
|
1058
|
+
(displayValue === '' && minTreatNull === 0))), isStepUpDisabled: disabled ||
|
|
1059
|
+
(hasMax &&
|
|
1060
|
+
((valueNow !== undefined && valueNow >= maxTreatNull) ||
|
|
1061
|
+
(displayValue === '' && maxTreatNull === 0))), textAlign,
|
|
1062
|
+
userAssistanceDensity,
|
|
1063
|
+
virtualKeyboard }, textFieldPropsWithOverride)
|
|
1064
|
+
};
|
|
1065
|
+
}
|
|
1066
|
+
exports.useNumberInputTextPreact = useNumberInputTextPreact;
|
|
1067
|
+
});
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1071
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1072
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1073
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1074
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1075
|
+
};
|
|
1076
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1077
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1078
|
+
};
|
|
1079
|
+
define('oj-c/input-number/input-number',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/hooks/UNSAFE_useFormContext", "@oracle/oraclejet-preact/hooks/UNSAFE_useFormVariantContext", "@oracle/oraclejet-preact/hooks/UNSAFE_useTabbableMode", "@oracle/oraclejet-preact/UNSAFE_NumberInputText", "oj-c/editable-value/UNSAFE_useAssistiveText/useAssistiveText", "ojs/ojcontext", "ojs/ojvcomponent", "ojs/ojvcomponent-binding", "preact", "preact/compat", "preact/hooks", "./useNumberInputTextPreact", "css!oj-c/input-number/input-number-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_useFormContext_1, UNSAFE_useFormVariantContext_1, UNSAFE_useTabbableMode_1, UNSAFE_NumberInputText_1, useAssistiveText_1, ojcontext_1, ojvcomponent_1, ojvcomponent_binding_1, preact_1, compat_1, hooks_1, useNumberInputTextPreact_1) {
|
|
1080
|
+
"use strict";
|
|
1081
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1082
|
+
exports.InputNumber = void 0;
|
|
1083
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
1084
|
+
ojcontext_1 = __importDefault(ojcontext_1);
|
|
1085
|
+
const FunctionalInputNumber = (0, compat_1.forwardRef)((props, ref) => {
|
|
1086
|
+
const { busyContextRef, converter, displayOptions, help, helpHints, validators } = props;
|
|
1087
|
+
const inputNumberRef = (0, hooks_1.useRef)();
|
|
1088
|
+
const addBusyState = (0, hooks_1.useCallback)((desc) => {
|
|
1089
|
+
var _a;
|
|
1090
|
+
return (_a = busyContextRef.current) === null || _a === void 0 ? void 0 : _a.addBusyState({
|
|
1091
|
+
description: `oj-c-input-number id=${props.id} is ${desc}`
|
|
1092
|
+
});
|
|
1093
|
+
}, []);
|
|
1094
|
+
const { inputNumberProps, methods } = (0, useNumberInputTextPreact_1.useNumberInputTextPreact)(props, addBusyState);
|
|
1095
|
+
(0, hooks_1.useImperativeHandle)(ref, () => (Object.assign({ blur: () => { var _a; return (_a = inputNumberRef.current) === null || _a === void 0 ? void 0 : _a.blur(); }, focus: () => { var _a; return (_a = inputNumberRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } }, methods)), [methods]);
|
|
1096
|
+
const assistiveTextProps = (0, useAssistiveText_1.useAssistiveText)({
|
|
1097
|
+
converter,
|
|
1098
|
+
displayOptions,
|
|
1099
|
+
help,
|
|
1100
|
+
helpHints,
|
|
1101
|
+
validators
|
|
1102
|
+
});
|
|
1103
|
+
const variant = (0, UNSAFE_useFormVariantContext_1.useFormVariantContext)();
|
|
1104
|
+
return ((0, jsx_runtime_1.jsx)(UNSAFE_NumberInputText_1.NumberInputText, Object.assign({ ref: inputNumberRef }, assistiveTextProps, inputNumberProps, { variant: variant })));
|
|
1105
|
+
});
|
|
1106
|
+
let InputNumber = class InputNumber extends preact_1.Component {
|
|
1107
|
+
constructor() {
|
|
1108
|
+
super(...arguments);
|
|
1109
|
+
this.busyContextRef = (0, preact_1.createRef)();
|
|
1110
|
+
this.inputNumberRef = (0, preact_1.createRef)();
|
|
1111
|
+
this.rootRef = (0, preact_1.createRef)();
|
|
1112
|
+
}
|
|
1113
|
+
componentDidMount() {
|
|
1114
|
+
this.busyContextRef.current = ojcontext_1.default.getContext(this.rootRef.current).getBusyContext();
|
|
1115
|
+
}
|
|
1116
|
+
render(props) {
|
|
1117
|
+
const containerProps = {
|
|
1118
|
+
isFormLayout: props.containerReadonly !== undefined,
|
|
1119
|
+
isReadonly: props.containerReadonly,
|
|
1120
|
+
labelWrapping: props.labelWrapping
|
|
1121
|
+
};
|
|
1122
|
+
if (props.step !== undefined && props.step < 0) {
|
|
1123
|
+
throw new Error('step must be a positive number');
|
|
1124
|
+
}
|
|
1125
|
+
if (props.min != null && props.max != null && props.max < props.min) {
|
|
1126
|
+
throw new Error('max cannot be less than min');
|
|
1127
|
+
}
|
|
1128
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, Object.assign({ id: props.id, ref: this.rootRef }, { children: (0, jsx_runtime_1.jsx)(UNSAFE_useFormContext_1.FormContext.Provider, Object.assign({ value: containerProps }, { children: (0, jsx_runtime_1.jsx)(FunctionalInputNumber, Object.assign({ busyContextRef: this.busyContextRef, ref: this.inputNumberRef }, props)) })) })));
|
|
1129
|
+
}
|
|
1130
|
+
componentWillUnmount() {
|
|
1131
|
+
this.busyContextRef.current = null;
|
|
1132
|
+
}
|
|
1133
|
+
reset() {
|
|
1134
|
+
var _a;
|
|
1135
|
+
(_a = this.inputNumberRef.current) === null || _a === void 0 ? void 0 : _a.reset();
|
|
1136
|
+
}
|
|
1137
|
+
showMessages() {
|
|
1138
|
+
var _a;
|
|
1139
|
+
(_a = this.inputNumberRef.current) === null || _a === void 0 ? void 0 : _a.showMessages();
|
|
1140
|
+
}
|
|
1141
|
+
validate() {
|
|
1142
|
+
var _a;
|
|
1143
|
+
return (_a = this.inputNumberRef.current) === null || _a === void 0 ? void 0 : _a.validate();
|
|
1144
|
+
}
|
|
1145
|
+
blur() {
|
|
1146
|
+
var _a;
|
|
1147
|
+
(_a = this.inputNumberRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
1148
|
+
}
|
|
1149
|
+
focus() {
|
|
1150
|
+
var _a;
|
|
1151
|
+
(_a = this.inputNumberRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1152
|
+
}
|
|
1153
|
+
};
|
|
1154
|
+
InputNumber.defaultProps = {
|
|
1155
|
+
autocomplete: 'on',
|
|
1156
|
+
converter: null,
|
|
1157
|
+
disabled: false,
|
|
1158
|
+
displayOptions: {
|
|
1159
|
+
converterHint: 'display',
|
|
1160
|
+
messages: 'display',
|
|
1161
|
+
validatorHint: 'display'
|
|
1162
|
+
},
|
|
1163
|
+
help: {
|
|
1164
|
+
instruction: ''
|
|
1165
|
+
},
|
|
1166
|
+
helpHints: {
|
|
1167
|
+
definition: '',
|
|
1168
|
+
source: '',
|
|
1169
|
+
sourceText: undefined
|
|
1170
|
+
},
|
|
1171
|
+
messagesCustom: [],
|
|
1172
|
+
readonly: false,
|
|
1173
|
+
required: false,
|
|
1174
|
+
userAssistanceDensity: 'reflow',
|
|
1175
|
+
validators: [],
|
|
1176
|
+
value: null,
|
|
1177
|
+
virtualKeyboard: 'auto'
|
|
1178
|
+
};
|
|
1179
|
+
InputNumber._metadata = { "properties": { "autocomplete": { "type": "string" }, "containerReadonly": { "type": "boolean", "binding": { "consume": { "name": "containerReadonly" } } }, "converter": { "type": "object|null" }, "disabled": { "type": "boolean" }, "displayOptions": { "type": "object", "properties": { "converterHint": { "type": "string", "enumValues": ["display", "none"] }, "messages": { "type": "string", "enumValues": ["display", "none"] }, "validatorHint": { "type": "string", "enumValues": ["display", "none"] } } }, "help": { "type": "object", "properties": { "instruction": { "type": "string" } } }, "helpHints": { "type": "object", "properties": { "definition": { "type": "string" }, "source": { "type": "string" }, "sourceText": { "type": "string" } } }, "inputPrefix": { "type": "string" }, "inputSuffix": { "type": "string" }, "labelEdge": { "type": "string", "enumValues": ["start", "none", "top", "inside"], "binding": { "consume": { "name": "containerLabelEdge" } } }, "labelHint": { "type": "string" }, "labelStartWidth": { "type": "string", "binding": { "consume": { "name": "labelWidth" } } }, "labelWrapping": { "type": "string", "enumValues": ["wrap", "truncate"], "binding": { "consume": { "name": "labelWrapping" } } }, "max": { "type": "number|null" }, "min": { "type": "number|null" }, "messagesCustom": { "type": "Array<object>", "writeback": true }, "numberRangeExactMessageDetail": { "type": "string" }, "numberRangeOverflowMessageDetail": { "type": "string" }, "numberRangeUnderflowMessageDetail": { "type": "string" }, "placeholder": { "type": "string" }, "readonly": { "type": "boolean", "binding": { "consume": { "name": "containerReadonly" } } }, "required": { "type": "boolean" }, "requiredMessageDetail": { "type": "string" }, "step": { "type": "number" }, "textAlign": { "type": "string", "enumValues": ["start", "right", "end"] }, "userAssistanceDensity": { "type": "string", "enumValues": ["reflow", "efficient"], "binding": { "consume": { "name": "containerUserAssistanceDensity" } } }, "validators": { "type": "Array<object>|null" }, "value": { "type": "number|null", "writeback": true }, "virtualKeyboard": { "type": "string", "enumValues": ["number", "text", "auto"] }, "rawValue": { "type": "string", "readOnly": true, "writeback": true }, "transientValue": { "type": "number", "readOnly": true, "writeback": true }, "valid": { "type": "string", "enumValues": ["valid", "pending", "invalidHidden", "invalidShown"], "readOnly": true, "writeback": true } }, "extension": { "_WRITEBACK_PROPS": ["messagesCustom", "rawValue", "transientValue", "valid", "value"], "_READ_ONLY_PROPS": ["rawValue", "transientValue", "valid"], "_OBSERVED_GLOBAL_PROPS": ["aria-describedby", "autofocus", "id"] }, "methods": { "reset": {}, "showMessages": {}, "validate": {}, "blur": {}, "focus": {} } };
|
|
1180
|
+
InputNumber._translationBundleMap = {
|
|
1181
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
1182
|
+
};
|
|
1183
|
+
InputNumber._consumedContexts = [UNSAFE_useFormVariantContext_1.FormVariantContext, UNSAFE_useTabbableMode_1.TabbableModeContext];
|
|
1184
|
+
InputNumber = __decorate([
|
|
1185
|
+
(0, ojvcomponent_1.customElement)('oj-c-input-number')
|
|
1186
|
+
], InputNumber);
|
|
1187
|
+
exports.InputNumber = InputNumber;
|
|
1188
|
+
});
|
|
1189
|
+
|
|
1190
|
+
define('oj-c/input-number',["require", "exports", "./input-number/input-number"], function (require, exports, input_number_1) {
|
|
1191
|
+
"use strict";
|
|
1192
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1193
|
+
exports.InputNumber = void 0;
|
|
1194
|
+
Object.defineProperty(exports, "InputNumber", { enumerable: true, get: function () { return input_number_1.InputNumber; } });
|
|
1195
|
+
});
|
|
1196
|
+
|
|
1197
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
1198
|
+
var t = {};
|
|
1199
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1200
|
+
t[p] = s[p];
|
|
1201
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1202
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1203
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1204
|
+
t[p[i]] = s[p[i]];
|
|
1205
|
+
}
|
|
1206
|
+
return t;
|
|
1207
|
+
};
|
|
1208
|
+
define('oj-c/input-password/useInputPasswordPreact',["require", "exports", "oj-c/editable-value/UNSAFE_useEditableValue/useEditableValue"], function (require, exports, useEditableValue_1) {
|
|
1209
|
+
"use strict";
|
|
1210
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1211
|
+
exports.useInputPasswordPreact = void 0;
|
|
1212
|
+
function useInputPasswordPreact(_a, addBusyState) {
|
|
1213
|
+
var { autocomplete = 'on', autofocus, clearIcon = 'never', disabled, displayOptions, labelEdge, labelHint, labelStartWidth, maskIcon, messagesCustom, placeholder, readonly, required, requiredMessageDetail, textAlign, userAssistanceDensity, validators, value: propValue, onMessagesCustomChanged, onRawValueChanged, onValidChanged, onValueChanged } = _a, otherProps = __rest(_a, ["autocomplete", "autofocus", "clearIcon", "disabled", "displayOptions", "labelEdge", "labelHint", "labelStartWidth", "maskIcon", "messagesCustom", "placeholder", "readonly", "required", "requiredMessageDetail", "textAlign", "userAssistanceDensity", "validators", "value", "onMessagesCustomChanged", "onRawValueChanged", "onValidChanged", "onValueChanged"]);
|
|
1214
|
+
const { methods, textFieldProps, value, setValue } = (0, useEditableValue_1.useEditableValue)({
|
|
1215
|
+
ariaDescribedBy: otherProps['aria-describedby'],
|
|
1216
|
+
displayOptions,
|
|
1217
|
+
messagesCustom,
|
|
1218
|
+
required,
|
|
1219
|
+
requiredMessageDetail,
|
|
1220
|
+
validators,
|
|
1221
|
+
value: propValue,
|
|
1222
|
+
addBusyState,
|
|
1223
|
+
onMessagesCustomChanged,
|
|
1224
|
+
onRawValueChanged,
|
|
1225
|
+
onValidChanged,
|
|
1226
|
+
onValueChanged
|
|
1227
|
+
});
|
|
1228
|
+
const hasNoValue = value === null || (typeof value === 'string' && value === '');
|
|
1229
|
+
const hasClearIcon = clearIcon === 'conditional' ? 'conditionally' : clearIcon;
|
|
1230
|
+
const hasRevealToggle = maskIcon === 'hidden' ? 'never' : 'always';
|
|
1231
|
+
return {
|
|
1232
|
+
value,
|
|
1233
|
+
setValue,
|
|
1234
|
+
methods,
|
|
1235
|
+
inputPasswordProps: Object.assign({ autoComplete: autocomplete, autoFocus: autofocus, hasClearIcon: hasClearIcon, hasRevealToggle, isDisabled: disabled, isReadonly: readonly, isRequired: required, isRequiredShown: required && hasNoValue, label: labelHint, labelEdge: labelEdge, labelStartWidth,
|
|
1236
|
+
placeholder,
|
|
1237
|
+
textAlign,
|
|
1238
|
+
userAssistanceDensity }, textFieldProps)
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
exports.useInputPasswordPreact = useInputPasswordPreact;
|
|
1242
|
+
});
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1246
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1247
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1248
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1249
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1250
|
+
};
|
|
1251
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1252
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1253
|
+
};
|
|
1254
|
+
define('oj-c/input-password/input-password',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/hooks/UNSAFE_useFormContext", "@oracle/oraclejet-preact/hooks/UNSAFE_useFormVariantContext", "@oracle/oraclejet-preact/hooks/UNSAFE_useTabbableMode", "@oracle/oraclejet-preact/UNSAFE_InputPassword", "oj-c/editable-value/UNSAFE_useAssistiveText/useAssistiveText", "ojs/ojcontext", "ojs/ojvcomponent", "ojs/ojvcomponent-binding", "preact", "preact/compat", "preact/hooks", "./useInputPasswordPreact", "css!oj-c/input-password/input-password-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_useFormContext_1, UNSAFE_useFormVariantContext_1, UNSAFE_useTabbableMode_1, UNSAFE_InputPassword_1, useAssistiveText_1, ojcontext_1, ojvcomponent_1, ojvcomponent_binding_1, preact_1, compat_1, hooks_1, useInputPasswordPreact_1) {
|
|
1255
|
+
"use strict";
|
|
1256
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1257
|
+
exports.InputPassword = void 0;
|
|
1258
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
1259
|
+
ojcontext_1 = __importDefault(ojcontext_1);
|
|
1260
|
+
const FunctionalInputPassword = (0, compat_1.forwardRef)((props, ref) => {
|
|
1261
|
+
const { busyContextRef, displayOptions, help, helpHints, validators } = props;
|
|
1262
|
+
const inputPasswordRef = (0, hooks_1.useRef)();
|
|
1263
|
+
const addBusyState = (0, hooks_1.useCallback)((desc) => {
|
|
1264
|
+
var _a;
|
|
1265
|
+
return (_a = busyContextRef.current) === null || _a === void 0 ? void 0 : _a.addBusyState({
|
|
1266
|
+
description: `oj-c-input-password id=${props.id} is ${desc}`
|
|
1267
|
+
});
|
|
1268
|
+
}, [props.id]);
|
|
1269
|
+
const { inputPasswordProps, methods } = (0, useInputPasswordPreact_1.useInputPasswordPreact)(props, addBusyState);
|
|
1270
|
+
(0, hooks_1.useImperativeHandle)(ref, () => (Object.assign({ blur: () => { var _a; return (_a = inputPasswordRef.current) === null || _a === void 0 ? void 0 : _a.blur(); }, focus: () => { var _a; return (_a = inputPasswordRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } }, methods)), [methods]);
|
|
1271
|
+
const assistiveTextProps = (0, useAssistiveText_1.useAssistiveText)({
|
|
1272
|
+
displayOptions,
|
|
1273
|
+
help,
|
|
1274
|
+
helpHints,
|
|
1275
|
+
validators
|
|
1276
|
+
});
|
|
1277
|
+
const variant = (0, UNSAFE_useFormVariantContext_1.useFormVariantContext)();
|
|
1278
|
+
return ((0, jsx_runtime_1.jsx)(UNSAFE_InputPassword_1.InputPassword, Object.assign({ ref: inputPasswordRef }, assistiveTextProps, inputPasswordProps, { variant: variant })));
|
|
1279
|
+
});
|
|
1280
|
+
let InputPassword = class InputPassword extends preact_1.Component {
|
|
1281
|
+
constructor() {
|
|
1282
|
+
super(...arguments);
|
|
1283
|
+
this.busyContextRef = (0, preact_1.createRef)();
|
|
1284
|
+
this.inputPasswordRef = (0, preact_1.createRef)();
|
|
1285
|
+
this.rootRef = (0, preact_1.createRef)();
|
|
1286
|
+
}
|
|
1287
|
+
componentDidMount() {
|
|
1288
|
+
this.busyContextRef.current = ojcontext_1.default.getContext(this.rootRef.current).getBusyContext();
|
|
1289
|
+
}
|
|
1290
|
+
render(props) {
|
|
1291
|
+
const containerProps = {
|
|
1292
|
+
isFormLayout: props.containerReadonly !== undefined,
|
|
1293
|
+
isReadonly: props.containerReadonly,
|
|
1294
|
+
labelWrapping: props.labelWrapping
|
|
1295
|
+
};
|
|
1296
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, Object.assign({ id: props.id, ref: this.rootRef }, { children: (0, jsx_runtime_1.jsx)(UNSAFE_useFormContext_1.FormContext.Provider, Object.assign({ value: containerProps }, { children: (0, jsx_runtime_1.jsx)(FunctionalInputPassword, Object.assign({ busyContextRef: this.busyContextRef, ref: this.inputPasswordRef }, props)) })) })));
|
|
1297
|
+
}
|
|
1298
|
+
componentWillUnmount() {
|
|
1299
|
+
this.busyContextRef.current = null;
|
|
1300
|
+
}
|
|
1301
|
+
reset() {
|
|
1302
|
+
var _a;
|
|
1303
|
+
(_a = this.inputPasswordRef.current) === null || _a === void 0 ? void 0 : _a.reset();
|
|
1304
|
+
}
|
|
1305
|
+
showMessages() {
|
|
1306
|
+
var _a;
|
|
1307
|
+
(_a = this.inputPasswordRef.current) === null || _a === void 0 ? void 0 : _a.showMessages();
|
|
1308
|
+
}
|
|
1309
|
+
validate() {
|
|
1310
|
+
var _a;
|
|
1311
|
+
return (_a = this.inputPasswordRef.current) === null || _a === void 0 ? void 0 : _a.validate();
|
|
1312
|
+
}
|
|
1313
|
+
blur() {
|
|
1314
|
+
var _a;
|
|
1315
|
+
(_a = this.inputPasswordRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
1316
|
+
}
|
|
1317
|
+
focus() {
|
|
1318
|
+
var _a;
|
|
1319
|
+
(_a = this.inputPasswordRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1320
|
+
}
|
|
1321
|
+
};
|
|
1322
|
+
InputPassword.defaultProps = {
|
|
1323
|
+
autocomplete: 'on',
|
|
1324
|
+
clearIcon: 'never',
|
|
1325
|
+
maskIcon: 'visible',
|
|
1326
|
+
disabled: false,
|
|
1327
|
+
displayOptions: {
|
|
1328
|
+
converterHint: 'display',
|
|
1329
|
+
messages: 'display',
|
|
1330
|
+
validatorHint: 'display'
|
|
1331
|
+
},
|
|
1332
|
+
help: {
|
|
1333
|
+
instruction: ''
|
|
1334
|
+
},
|
|
1335
|
+
helpHints: {
|
|
1336
|
+
definition: '',
|
|
1337
|
+
source: '',
|
|
1338
|
+
sourceText: undefined
|
|
1339
|
+
},
|
|
1340
|
+
messagesCustom: [],
|
|
1341
|
+
readonly: false,
|
|
1342
|
+
required: false,
|
|
1343
|
+
userAssistanceDensity: 'reflow',
|
|
1344
|
+
validators: [],
|
|
1345
|
+
value: null
|
|
1346
|
+
};
|
|
1347
|
+
InputPassword._metadata = { "properties": { "autocomplete": { "type": "string" }, "clearIcon": { "type": "string", "enumValues": ["always", "never", "conditional"] }, "containerReadonly": { "type": "boolean", "binding": { "consume": { "name": "containerReadonly" } } }, "disabled": { "type": "boolean" }, "displayOptions": { "type": "object", "properties": { "converterHint": { "type": "string", "enumValues": ["display", "none"] }, "messages": { "type": "string", "enumValues": ["display", "none"] }, "validatorHint": { "type": "string", "enumValues": ["display", "none"] } } }, "help": { "type": "object", "properties": { "instruction": { "type": "string" } } }, "helpHints": { "type": "object", "properties": { "definition": { "type": "string" }, "source": { "type": "string" }, "sourceText": { "type": "string" } } }, "labelEdge": { "type": "string", "enumValues": ["start", "none", "top", "inside"], "binding": { "consume": { "name": "containerLabelEdge" } } }, "labelHint": { "type": "string" }, "labelStartWidth": { "type": "string", "binding": { "consume": { "name": "labelWidth" } } }, "labelWrapping": { "type": "string", "enumValues": ["wrap", "truncate"], "binding": { "consume": { "name": "labelWrapping" } } }, "maskIcon": { "type": "string", "enumValues": ["hidden", "visible"] }, "messagesCustom": { "type": "Array<object>", "writeback": true }, "placeholder": { "type": "string" }, "readonly": { "type": "boolean", "binding": { "consume": { "name": "containerReadonly" } } }, "required": { "type": "boolean" }, "requiredMessageDetail": { "type": "string" }, "textAlign": { "type": "string", "enumValues": ["start", "right", "end"] }, "userAssistanceDensity": { "type": "string", "enumValues": ["reflow", "efficient"], "binding": { "consume": { "name": "containerUserAssistanceDensity" } } }, "validators": { "type": "Array<object>|null" }, "value": { "type": "string|null", "writeback": true }, "rawValue": { "type": "string", "readOnly": true, "writeback": true }, "valid": { "type": "string", "enumValues": ["valid", "pending", "invalidHidden", "invalidShown"], "readOnly": true, "writeback": true } }, "extension": { "_WRITEBACK_PROPS": ["messagesCustom", "rawValue", "valid", "value"], "_READ_ONLY_PROPS": ["rawValue", "valid"], "_OBSERVED_GLOBAL_PROPS": ["aria-describedby", "autofocus", "id"] }, "methods": { "reset": {}, "showMessages": {}, "validate": {}, "blur": {}, "focus": {} } };
|
|
1348
|
+
InputPassword._translationBundleMap = {
|
|
1349
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
1350
|
+
};
|
|
1351
|
+
InputPassword._consumedContexts = [UNSAFE_useFormVariantContext_1.FormVariantContext, UNSAFE_useTabbableMode_1.TabbableModeContext];
|
|
1352
|
+
InputPassword = __decorate([
|
|
1353
|
+
(0, ojvcomponent_1.customElement)('oj-c-input-password')
|
|
1354
|
+
], InputPassword);
|
|
1355
|
+
exports.InputPassword = InputPassword;
|
|
1356
|
+
});
|
|
1357
|
+
|
|
1358
|
+
define('oj-c/input-password',["require", "exports", "./input-password/input-password"], function (require, exports, input_password_1) {
|
|
1359
|
+
"use strict";
|
|
1360
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1361
|
+
exports.InputPassword = void 0;
|
|
1362
|
+
Object.defineProperty(exports, "InputPassword", { enumerable: true, get: function () { return input_password_1.InputPassword; } });
|
|
1363
|
+
});
|
|
1364
|
+
|
|
1365
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
1366
|
+
var t = {};
|
|
1367
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1368
|
+
t[p] = s[p];
|
|
1369
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1370
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1371
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1372
|
+
t[p[i]] = s[p[i]];
|
|
1373
|
+
}
|
|
1374
|
+
return t;
|
|
1375
|
+
};
|
|
1376
|
+
define('oj-c/input-text/useInputTextPreact',["require", "exports", "oj-c/editable-value/utils/utils", "oj-c/editable-value/UNSAFE_useEditableValue/useEditableValue"], function (require, exports, utils_1, useEditableValue_1) {
|
|
1377
|
+
"use strict";
|
|
1378
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1379
|
+
exports.useInputTextPreact = void 0;
|
|
1380
|
+
function useInputTextPreact(_a, addBusyState) {
|
|
1381
|
+
var { autocomplete = 'on', autofocus, clearIcon = 'never', converter, disabled, displayOptions, end, inputPrefix, inputSuffix, labelEdge, labelHint, labelStartWidth, length, messagesCustom, placeholder, readonly, required, requiredMessageDetail, start, textAlign, userAssistanceDensity, validators, value: propValue, virtualKeyboard, onMessagesCustomChanged, onRawValueChanged, onValidChanged, onValueChanged } = _a, otherProps = __rest(_a, ["autocomplete", "autofocus", "clearIcon", "converter", "disabled", "displayOptions", "end", "inputPrefix", "inputSuffix", "labelEdge", "labelHint", "labelStartWidth", "length", "messagesCustom", "placeholder", "readonly", "required", "requiredMessageDetail", "start", "textAlign", "userAssistanceDensity", "validators", "value", "virtualKeyboard", "onMessagesCustomChanged", "onRawValueChanged", "onValidChanged", "onValueChanged"]);
|
|
1382
|
+
const { methods, textFieldProps, value, setValue } = (0, useEditableValue_1.useEditableValue)({
|
|
1383
|
+
ariaDescribedBy: otherProps['aria-describedby'],
|
|
1384
|
+
converter,
|
|
1385
|
+
displayOptions,
|
|
1386
|
+
messagesCustom,
|
|
1387
|
+
required,
|
|
1388
|
+
requiredMessageDetail,
|
|
1389
|
+
validators,
|
|
1390
|
+
value: propValue,
|
|
1391
|
+
addBusyState,
|
|
1392
|
+
onMessagesCustomChanged,
|
|
1393
|
+
onRawValueChanged,
|
|
1394
|
+
onValidChanged,
|
|
1395
|
+
onValueChanged
|
|
1396
|
+
});
|
|
1397
|
+
const hasNoValue = value === null || (typeof value === 'string' && value === '');
|
|
1398
|
+
const hasClearIcon = clearIcon === 'conditional' ? 'conditionally' : clearIcon;
|
|
1399
|
+
return {
|
|
1400
|
+
value,
|
|
1401
|
+
setValue,
|
|
1402
|
+
methods,
|
|
1403
|
+
inputTextProps: Object.assign({ autoComplete: autocomplete, autoFocus: autofocus, hasClearIcon, endContent: end, isDisabled: disabled, isReadonly: readonly, isRequired: required, isRequiredShown: required && hasNoValue, label: labelHint, labelEdge,
|
|
1404
|
+
labelStartWidth, maxLength: (0, utils_1.treatNull)(length === null || length === void 0 ? void 0 : length.max), maxLengthUnit: length === null || length === void 0 ? void 0 : length.countBy, placeholder, prefix: inputPrefix, startContent: start, suffix: inputSuffix, textAlign,
|
|
1405
|
+
userAssistanceDensity,
|
|
1406
|
+
virtualKeyboard }, textFieldProps)
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
exports.useInputTextPreact = useInputTextPreact;
|
|
1410
|
+
});
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1414
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1415
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1416
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1417
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1418
|
+
};
|
|
1419
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1420
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1421
|
+
};
|
|
1422
|
+
define('oj-c/input-text/input-text',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/hooks/UNSAFE_useFormContext", "@oracle/oraclejet-preact/hooks/UNSAFE_useFormVariantContext", "@oracle/oraclejet-preact/hooks/UNSAFE_useTabbableMode", "@oracle/oraclejet-preact/UNSAFE_InputText", "oj-c/editable-value/UNSAFE_useAssistiveText/useAssistiveText", "ojs/ojcontext", "ojs/ojvcomponent", "ojs/ojvcomponent-binding", "preact", "preact/compat", "preact/hooks", "./useInputTextPreact", "css!oj-c/input-text/input-text-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_useFormContext_1, UNSAFE_useFormVariantContext_1, UNSAFE_useTabbableMode_1, UNSAFE_InputText_1, useAssistiveText_1, ojcontext_1, ojvcomponent_1, ojvcomponent_binding_1, preact_1, compat_1, hooks_1, useInputTextPreact_1) {
|
|
1423
|
+
"use strict";
|
|
1424
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1425
|
+
exports.InputText = void 0;
|
|
1426
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
1427
|
+
ojcontext_1 = __importDefault(ojcontext_1);
|
|
1428
|
+
const FunctionalInputText = (0, compat_1.forwardRef)((props, ref) => {
|
|
1429
|
+
const { busyContextRef, converter, displayOptions, help, helpHints, validators } = props;
|
|
1430
|
+
const inputTextRef = (0, hooks_1.useRef)();
|
|
1431
|
+
const addBusyState = (0, hooks_1.useCallback)((desc) => {
|
|
1432
|
+
var _a;
|
|
1433
|
+
return (_a = busyContextRef.current) === null || _a === void 0 ? void 0 : _a.addBusyState({
|
|
1434
|
+
description: `oj-c-input-text id=${props.id} is ${desc}`
|
|
1435
|
+
});
|
|
1436
|
+
}, []);
|
|
1437
|
+
const { inputTextProps, methods } = (0, useInputTextPreact_1.useInputTextPreact)(props, addBusyState);
|
|
1438
|
+
(0, hooks_1.useImperativeHandle)(ref, () => (Object.assign({ blur: () => { var _a; return (_a = inputTextRef.current) === null || _a === void 0 ? void 0 : _a.blur(); }, focus: () => { var _a; return (_a = inputTextRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } }, methods)), [methods]);
|
|
1439
|
+
const assistiveTextProps = (0, useAssistiveText_1.useAssistiveText)({
|
|
1440
|
+
converter,
|
|
1441
|
+
displayOptions,
|
|
1442
|
+
help,
|
|
1443
|
+
helpHints,
|
|
1444
|
+
validators
|
|
1445
|
+
});
|
|
1446
|
+
const variant = (0, UNSAFE_useFormVariantContext_1.useFormVariantContext)();
|
|
1447
|
+
return ((0, jsx_runtime_1.jsx)(UNSAFE_InputText_1.InputText, Object.assign({ ref: inputTextRef }, assistiveTextProps, inputTextProps, { variant: variant })));
|
|
1448
|
+
});
|
|
1449
|
+
let InputText = class InputText extends preact_1.Component {
|
|
1450
|
+
constructor() {
|
|
1451
|
+
super(...arguments);
|
|
1452
|
+
this.busyContextRef = (0, preact_1.createRef)();
|
|
1453
|
+
this.inputTextRef = (0, preact_1.createRef)();
|
|
1454
|
+
this.rootRef = (0, preact_1.createRef)();
|
|
1455
|
+
}
|
|
1456
|
+
componentDidMount() {
|
|
1457
|
+
this.busyContextRef.current = ojcontext_1.default.getContext(this.rootRef.current).getBusyContext();
|
|
1458
|
+
}
|
|
1459
|
+
render(props) {
|
|
1460
|
+
const containerProps = {
|
|
1461
|
+
isFormLayout: props.containerReadonly !== undefined,
|
|
1462
|
+
isReadonly: props.containerReadonly,
|
|
1463
|
+
labelWrapping: props.labelWrapping
|
|
1464
|
+
};
|
|
1465
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, Object.assign({ id: props.id, ref: this.rootRef }, { children: (0, jsx_runtime_1.jsx)(UNSAFE_useFormContext_1.FormContext.Provider, Object.assign({ value: containerProps }, { children: (0, jsx_runtime_1.jsx)(FunctionalInputText, Object.assign({ busyContextRef: this.busyContextRef, ref: this.inputTextRef }, props)) })) })));
|
|
1466
|
+
}
|
|
1467
|
+
componentWillUnmount() {
|
|
1468
|
+
this.busyContextRef.current = null;
|
|
1469
|
+
}
|
|
1470
|
+
reset() {
|
|
1471
|
+
var _a;
|
|
1472
|
+
(_a = this.inputTextRef.current) === null || _a === void 0 ? void 0 : _a.reset();
|
|
1473
|
+
}
|
|
1474
|
+
showMessages() {
|
|
1475
|
+
var _a;
|
|
1476
|
+
(_a = this.inputTextRef.current) === null || _a === void 0 ? void 0 : _a.showMessages();
|
|
1477
|
+
}
|
|
1478
|
+
validate() {
|
|
1479
|
+
var _a;
|
|
1480
|
+
return (_a = this.inputTextRef.current) === null || _a === void 0 ? void 0 : _a.validate();
|
|
1481
|
+
}
|
|
1482
|
+
blur() {
|
|
1483
|
+
var _a;
|
|
1484
|
+
(_a = this.inputTextRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
1485
|
+
}
|
|
1486
|
+
focus() {
|
|
1487
|
+
var _a;
|
|
1488
|
+
(_a = this.inputTextRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1489
|
+
}
|
|
1490
|
+
};
|
|
1491
|
+
InputText.defaultProps = {
|
|
1492
|
+
autocomplete: 'on',
|
|
1493
|
+
clearIcon: 'never',
|
|
1494
|
+
converter: null,
|
|
1495
|
+
disabled: false,
|
|
1496
|
+
displayOptions: {
|
|
1497
|
+
converterHint: 'display',
|
|
1498
|
+
messages: 'display',
|
|
1499
|
+
validatorHint: 'display'
|
|
1500
|
+
},
|
|
1501
|
+
help: {
|
|
1502
|
+
instruction: ''
|
|
1503
|
+
},
|
|
1504
|
+
helpHints: {
|
|
1505
|
+
definition: '',
|
|
1506
|
+
source: '',
|
|
1507
|
+
sourceText: undefined
|
|
1508
|
+
},
|
|
1509
|
+
length: {
|
|
1510
|
+
countBy: 'codePoint',
|
|
1511
|
+
max: null
|
|
1512
|
+
},
|
|
1513
|
+
messagesCustom: [],
|
|
1514
|
+
readonly: false,
|
|
1515
|
+
required: false,
|
|
1516
|
+
userAssistanceDensity: 'reflow',
|
|
1517
|
+
validators: [],
|
|
1518
|
+
value: null,
|
|
1519
|
+
virtualKeyboard: 'auto'
|
|
1520
|
+
};
|
|
1521
|
+
InputText._metadata = { "properties": { "autocomplete": { "type": "string" }, "clearIcon": { "type": "string", "enumValues": ["always", "never", "conditional"] }, "containerReadonly": { "type": "boolean", "binding": { "consume": { "name": "containerReadonly" } } }, "converter": { "type": "object|null" }, "disabled": { "type": "boolean" }, "displayOptions": { "type": "object", "properties": { "converterHint": { "type": "string", "enumValues": ["display", "none"] }, "messages": { "type": "string", "enumValues": ["display", "none"] }, "validatorHint": { "type": "string", "enumValues": ["display", "none"] } } }, "help": { "type": "object", "properties": { "instruction": { "type": "string" } } }, "helpHints": { "type": "object", "properties": { "definition": { "type": "string" }, "source": { "type": "string" }, "sourceText": { "type": "string" } } }, "inputPrefix": { "type": "string" }, "inputSuffix": { "type": "string" }, "labelEdge": { "type": "string", "enumValues": ["start", "none", "top", "inside"], "binding": { "consume": { "name": "containerLabelEdge" } } }, "labelHint": { "type": "string" }, "labelStartWidth": { "type": "string", "binding": { "consume": { "name": "labelWidth" } } }, "labelWrapping": { "type": "string", "enumValues": ["wrap", "truncate"], "binding": { "consume": { "name": "labelWrapping" } } }, "length": { "type": "object", "properties": { "countBy": { "type": "string", "enumValues": ["codePoint", "codeUnit"] }, "max": { "type": "number|null" } } }, "messagesCustom": { "type": "Array<object>", "writeback": true }, "placeholder": { "type": "string" }, "readonly": { "type": "boolean", "binding": { "consume": { "name": "containerReadonly" } } }, "required": { "type": "boolean" }, "requiredMessageDetail": { "type": "string" }, "textAlign": { "type": "string", "enumValues": ["start", "right", "end"] }, "userAssistanceDensity": { "type": "string", "enumValues": ["reflow", "efficient"], "binding": { "consume": { "name": "containerUserAssistanceDensity" } } }, "validators": { "type": "Array<object>|null" }, "value": { "type": "any", "writeback": true }, "virtualKeyboard": { "type": "string", "enumValues": ["number", "text", "auto", "search", "email", "tel", "url"] }, "rawValue": { "type": "string", "readOnly": true, "writeback": true }, "valid": { "type": "string", "enumValues": ["valid", "pending", "invalidHidden", "invalidShown"], "readOnly": true, "writeback": true } }, "slots": { "end": {}, "start": {} }, "extension": { "_WRITEBACK_PROPS": ["messagesCustom", "rawValue", "valid", "value"], "_READ_ONLY_PROPS": ["rawValue", "valid"], "_OBSERVED_GLOBAL_PROPS": ["aria-describedby", "autofocus", "id"] }, "methods": { "reset": {}, "showMessages": {}, "validate": {}, "blur": {}, "focus": {} } };
|
|
1522
|
+
InputText._translationBundleMap = {
|
|
1523
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
1524
|
+
};
|
|
1525
|
+
InputText._consumedContexts = [UNSAFE_useFormVariantContext_1.FormVariantContext, UNSAFE_useTabbableMode_1.TabbableModeContext];
|
|
1526
|
+
InputText = __decorate([
|
|
1527
|
+
(0, ojvcomponent_1.customElement)('oj-c-input-text')
|
|
1528
|
+
], InputText);
|
|
1529
|
+
exports.InputText = InputText;
|
|
1530
|
+
});
|
|
1531
|
+
|
|
1532
|
+
define('oj-c/input-text',["require", "exports", "./input-text/input-text"], function (require, exports, input_text_1) {
|
|
1533
|
+
"use strict";
|
|
1534
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1535
|
+
exports.InputText = void 0;
|
|
1536
|
+
Object.defineProperty(exports, "InputText", { enumerable: true, get: function () { return input_text_1.InputText; } });
|
|
1537
|
+
});
|
|
1538
|
+
|
|
1539
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1540
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1541
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1542
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1543
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1544
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1545
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1546
|
+
});
|
|
1547
|
+
};
|
|
1548
|
+
define('oj-c/hooks/UNSAFE_useDataProvider/utils',["require", "exports"], function (require, exports) {
|
|
1549
|
+
"use strict";
|
|
1550
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1551
|
+
exports.getUpdatedItemsFromMutationDetail = void 0;
|
|
1552
|
+
function getUpdatedItemsFromMutationDetail(detail, currentData, dataProvider) {
|
|
1553
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1554
|
+
const { add, remove, update } = detail !== null && detail !== void 0 ? detail : {};
|
|
1555
|
+
const keyIndexMap = new Map();
|
|
1556
|
+
for (const [index, item] of currentData.entries()) {
|
|
1557
|
+
keyIndexMap.set(item.key, index);
|
|
1558
|
+
}
|
|
1559
|
+
let mutatedData = [...currentData];
|
|
1560
|
+
if (remove) {
|
|
1561
|
+
mutatedData = removeItemsFromDetail(remove, mutatedData, keyIndexMap);
|
|
1562
|
+
}
|
|
1563
|
+
if (add) {
|
|
1564
|
+
mutatedData = yield addItemsFromDetail(add, mutatedData, keyIndexMap, dataProvider);
|
|
1565
|
+
}
|
|
1566
|
+
if (update) {
|
|
1567
|
+
mutatedData = yield updateItemsFromDetail(update, mutatedData, keyIndexMap, dataProvider);
|
|
1568
|
+
}
|
|
1569
|
+
return mutatedData;
|
|
1570
|
+
});
|
|
1571
|
+
}
|
|
1572
|
+
exports.getUpdatedItemsFromMutationDetail = getUpdatedItemsFromMutationDetail;
|
|
1573
|
+
function addItemsAtEnd(itemsToAdd, itemMetadataToAdd, items) {
|
|
1574
|
+
const indices = new Array(itemsToAdd.length).fill(-1);
|
|
1575
|
+
return addItemsAtIndices(indices, itemsToAdd, itemMetadataToAdd, items);
|
|
1576
|
+
}
|
|
1577
|
+
function addItemsAtIndices(indices, itemsToAdd, itemMetadataToAdd, items) {
|
|
1578
|
+
const returnItems = [...items];
|
|
1579
|
+
indices.forEach((addAtIndex, index) => {
|
|
1580
|
+
var _a;
|
|
1581
|
+
const addItem = {
|
|
1582
|
+
data: itemsToAdd[index],
|
|
1583
|
+
key: (_a = itemMetadataToAdd[index]) === null || _a === void 0 ? void 0 : _a.key,
|
|
1584
|
+
metadata: itemMetadataToAdd[index]
|
|
1585
|
+
};
|
|
1586
|
+
if (addAtIndex >= 0) {
|
|
1587
|
+
returnItems.splice(addAtIndex, 0, addItem);
|
|
1588
|
+
}
|
|
1589
|
+
else {
|
|
1590
|
+
returnItems.push(addItem);
|
|
1591
|
+
}
|
|
1592
|
+
});
|
|
1593
|
+
return returnItems;
|
|
1594
|
+
}
|
|
1595
|
+
function addItemsBeforeKeys(beforeKeys, itemsToAdd, items, keyIndexMap) {
|
|
1596
|
+
const addIndices = [];
|
|
1597
|
+
const itemMetadataToAdd = [];
|
|
1598
|
+
beforeKeys.forEach((key) => {
|
|
1599
|
+
addIndices.push(getIndexByKey(keyIndexMap, key));
|
|
1600
|
+
itemMetadataToAdd.push({ key });
|
|
1601
|
+
});
|
|
1602
|
+
return addItemsAtIndices(addIndices, itemsToAdd, itemMetadataToAdd, items);
|
|
1603
|
+
}
|
|
1604
|
+
function addItemsFromDetail(detail, items, keyIndexMap, dataProvider) {
|
|
1605
|
+
var _a;
|
|
1606
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1607
|
+
const { addBeforeKeys, data, indexes, keys, metadata } = detail;
|
|
1608
|
+
let mutatedData = [...items];
|
|
1609
|
+
let treatedData = data || [];
|
|
1610
|
+
let treatedMetaData = metadata || [];
|
|
1611
|
+
if (treatedData.length === 0 && (keys === null || keys === void 0 ? void 0 : keys.size)) {
|
|
1612
|
+
const fetchResults = (_a = (yield fetchDataByKeys(dataProvider, keys))) !== null && _a !== void 0 ? _a : [];
|
|
1613
|
+
treatedData = fetchResults.map((itemContext) => itemContext.data);
|
|
1614
|
+
treatedMetaData = fetchResults.map((itemContext) => itemContext.metadata);
|
|
1615
|
+
}
|
|
1616
|
+
if (treatedMetaData.length === 0 && (keys === null || keys === void 0 ? void 0 : keys.size)) {
|
|
1617
|
+
treatedMetaData = [...keys].map((key) => ({ key }));
|
|
1618
|
+
}
|
|
1619
|
+
if (treatedData.length) {
|
|
1620
|
+
if (indexes === null || indexes === void 0 ? void 0 : indexes.length) {
|
|
1621
|
+
mutatedData = addItemsAtIndices(indexes, treatedData, treatedMetaData, mutatedData);
|
|
1622
|
+
}
|
|
1623
|
+
else if (addBeforeKeys === null || addBeforeKeys === void 0 ? void 0 : addBeforeKeys.length) {
|
|
1624
|
+
mutatedData = addItemsBeforeKeys(addBeforeKeys, treatedData, mutatedData, keyIndexMap);
|
|
1625
|
+
}
|
|
1626
|
+
else {
|
|
1627
|
+
mutatedData = addItemsAtEnd(treatedData, treatedMetaData, mutatedData);
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
return mutatedData;
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
function fetchDataByKeys(dataProvider, keys) {
|
|
1634
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1635
|
+
const fetchedData = [];
|
|
1636
|
+
const results = (yield dataProvider.fetchByKeys({ keys })).results;
|
|
1637
|
+
for (const key of keys) {
|
|
1638
|
+
if (results.has(key)) {
|
|
1639
|
+
const result = results.get(key);
|
|
1640
|
+
fetchedData.push(Object.assign(Object.assign({}, result), { key }));
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
return fetchedData;
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
function getIndexByKey(keyIndexMap, key) {
|
|
1647
|
+
if (keyIndexMap.has(key)) {
|
|
1648
|
+
return keyIndexMap.get(key);
|
|
1649
|
+
}
|
|
1650
|
+
return -1;
|
|
1651
|
+
}
|
|
1652
|
+
function removeItemsAtIndices(indices, items) {
|
|
1653
|
+
const returnItems = [...items];
|
|
1654
|
+
indices.sort((a, b) => b - a);
|
|
1655
|
+
indices.forEach((index) => {
|
|
1656
|
+
if (index < returnItems.length) {
|
|
1657
|
+
returnItems.splice(index, 1);
|
|
1658
|
+
}
|
|
1659
|
+
});
|
|
1660
|
+
return returnItems;
|
|
1661
|
+
}
|
|
1662
|
+
function removeItemsAtKeys(keys, items, keyIndexMap) {
|
|
1663
|
+
const indicesToRemove = [];
|
|
1664
|
+
keys.forEach((key) => {
|
|
1665
|
+
const index = getIndexByKey(keyIndexMap, key);
|
|
1666
|
+
if (index !== -1) {
|
|
1667
|
+
indicesToRemove.push(index);
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1670
|
+
return removeItemsAtIndices(indicesToRemove, items);
|
|
1671
|
+
}
|
|
1672
|
+
function removeItemsFromDetail(detail, items, keyIndexMap) {
|
|
1673
|
+
const { indexes, keys } = detail;
|
|
1674
|
+
let mutatedData = [...items];
|
|
1675
|
+
if (indexes === null || indexes === void 0 ? void 0 : indexes.length) {
|
|
1676
|
+
mutatedData = removeItemsAtIndices(indexes, mutatedData);
|
|
1677
|
+
}
|
|
1678
|
+
else if (keys === null || keys === void 0 ? void 0 : keys.size) {
|
|
1679
|
+
mutatedData = removeItemsAtKeys(keys, mutatedData, keyIndexMap);
|
|
1680
|
+
}
|
|
1681
|
+
return mutatedData;
|
|
1682
|
+
}
|
|
1683
|
+
function updateItemsAtIndices(indices, itemsToUpdate, itemMetadataToUpdate, items) {
|
|
1684
|
+
const returnItems = [...items];
|
|
1685
|
+
indices.forEach((updateAtIndex, index) => {
|
|
1686
|
+
var _a;
|
|
1687
|
+
if (returnItems[updateAtIndex]) {
|
|
1688
|
+
const addItem = {
|
|
1689
|
+
data: itemsToUpdate[index],
|
|
1690
|
+
key: (_a = itemMetadataToUpdate[index]) === null || _a === void 0 ? void 0 : _a.key,
|
|
1691
|
+
metadata: itemMetadataToUpdate[index]
|
|
1692
|
+
};
|
|
1693
|
+
returnItems.splice(updateAtIndex, 1, addItem);
|
|
1694
|
+
}
|
|
1695
|
+
});
|
|
1696
|
+
return returnItems;
|
|
1697
|
+
}
|
|
1698
|
+
function updateItemsAtKeys(keys, itemsToUpdate, itemMetadataToUpdate, items, keyIndexMap) {
|
|
1699
|
+
const returnItems = [...items];
|
|
1700
|
+
keys.forEach((key) => {
|
|
1701
|
+
var _a;
|
|
1702
|
+
const index = getIndexByKey(keyIndexMap, key);
|
|
1703
|
+
const addItem = {
|
|
1704
|
+
data: itemsToUpdate[index],
|
|
1705
|
+
key: (_a = itemMetadataToUpdate[index]) === null || _a === void 0 ? void 0 : _a.key,
|
|
1706
|
+
metadata: itemMetadataToUpdate[index]
|
|
1707
|
+
};
|
|
1708
|
+
if (index >= 0) {
|
|
1709
|
+
returnItems.splice(index, 1, addItem);
|
|
1710
|
+
}
|
|
1711
|
+
});
|
|
1712
|
+
return returnItems;
|
|
1713
|
+
}
|
|
1714
|
+
function updateItemsFromDetail(detail, items, keyIndexMap, dataProvider) {
|
|
1715
|
+
var _a;
|
|
1716
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1717
|
+
const { data, indexes, keys, metadata } = detail;
|
|
1718
|
+
let mutatedData = [...items];
|
|
1719
|
+
let treatedData = data || [];
|
|
1720
|
+
let treatedMetaData = metadata || [];
|
|
1721
|
+
if (treatedData.length === 0 && (keys === null || keys === void 0 ? void 0 : keys.size)) {
|
|
1722
|
+
const fetchResults = (_a = (yield fetchDataByKeys(dataProvider, keys))) !== null && _a !== void 0 ? _a : [];
|
|
1723
|
+
treatedData = fetchResults.map((itemContext) => itemContext.data);
|
|
1724
|
+
treatedMetaData = fetchResults.map((itemContext) => itemContext.metadata);
|
|
1725
|
+
}
|
|
1726
|
+
if (treatedMetaData.length === 0 && (keys === null || keys === void 0 ? void 0 : keys.size)) {
|
|
1727
|
+
treatedMetaData = [...keys].map((key) => ({ key }));
|
|
1728
|
+
}
|
|
1729
|
+
if (treatedData.length) {
|
|
1730
|
+
if (indexes === null || indexes === void 0 ? void 0 : indexes.length) {
|
|
1731
|
+
mutatedData = updateItemsAtIndices(indexes, treatedData, treatedMetaData, mutatedData);
|
|
1732
|
+
}
|
|
1733
|
+
else if (keys === null || keys === void 0 ? void 0 : keys.size) {
|
|
1734
|
+
mutatedData = updateItemsAtKeys(keys, treatedData, treatedMetaData, mutatedData, keyIndexMap);
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
return mutatedData;
|
|
1738
|
+
});
|
|
1739
|
+
}
|
|
1740
|
+
});
|
|
1741
|
+
|
|
1742
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1743
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1744
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1745
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1746
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1747
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1748
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1749
|
+
});
|
|
1750
|
+
};
|
|
1751
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
1752
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
1753
|
+
var m = o[Symbol.asyncIterator], i;
|
|
1754
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
1755
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
1756
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
1757
|
+
};
|
|
1758
|
+
define('oj-c/hooks/UNSAFE_useDataProvider/DataProviderHandler',["require", "exports", "./utils"], function (require, exports, utils_1) {
|
|
1759
|
+
"use strict";
|
|
1760
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1761
|
+
exports.DataProviderHandler = void 0;
|
|
1762
|
+
class DataProviderHandler {
|
|
1763
|
+
constructor(dataProvider, addBusyState, callback) {
|
|
1764
|
+
this.handleMutateEvent = (event) => __awaiter(this, void 0, void 0, function* () {
|
|
1765
|
+
var _a, _b;
|
|
1766
|
+
const { detail } = event;
|
|
1767
|
+
const resolver = this.addBusyState('updating data from mutation event');
|
|
1768
|
+
const updatedData = yield (0, utils_1.getUpdatedItemsFromMutationDetail)(detail, this.currentData, this.dataProvider);
|
|
1769
|
+
resolver === null || resolver === void 0 ? void 0 : resolver();
|
|
1770
|
+
this.currentData = updatedData;
|
|
1771
|
+
(_b = (_a = this.callback) === null || _a === void 0 ? void 0 : _a.onDataUpdated) === null || _b === void 0 ? void 0 : _b.call(_a, updatedData);
|
|
1772
|
+
});
|
|
1773
|
+
this.handleRefreshEvent = () => {
|
|
1774
|
+
this._fetchDataAndNotify();
|
|
1775
|
+
};
|
|
1776
|
+
this.addBusyState = addBusyState;
|
|
1777
|
+
this.callback = callback;
|
|
1778
|
+
this.dataProvider = dataProvider;
|
|
1779
|
+
this.currentData = [];
|
|
1780
|
+
dataProvider.addEventListener('refresh', this.handleRefreshEvent);
|
|
1781
|
+
dataProvider.addEventListener('mutate', this.handleMutateEvent);
|
|
1782
|
+
this._fetchDataAndNotify();
|
|
1783
|
+
}
|
|
1784
|
+
destroy() {
|
|
1785
|
+
this.callback = undefined;
|
|
1786
|
+
this.currentData = [];
|
|
1787
|
+
this.dataProvider.removeEventListener('refresh', this.handleRefreshEvent);
|
|
1788
|
+
this.dataProvider.removeEventListener('mutate', this.handleMutateEvent);
|
|
1789
|
+
}
|
|
1790
|
+
_fetchData() {
|
|
1791
|
+
var e_1, _a;
|
|
1792
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1793
|
+
const fetchedData = [];
|
|
1794
|
+
const asyncIterable = this.dataProvider.fetchFirst({ size: -1 });
|
|
1795
|
+
try {
|
|
1796
|
+
for (var asyncIterable_1 = __asyncValues(asyncIterable), asyncIterable_1_1; asyncIterable_1_1 = yield asyncIterable_1.next(), !asyncIterable_1_1.done;) {
|
|
1797
|
+
const results = asyncIterable_1_1.value;
|
|
1798
|
+
const contextArray = results.data.map((item, index) => {
|
|
1799
|
+
return {
|
|
1800
|
+
data: item,
|
|
1801
|
+
key: results.metadata[index].key,
|
|
1802
|
+
metadata: results.metadata[index]
|
|
1803
|
+
};
|
|
1804
|
+
});
|
|
1805
|
+
fetchedData.push(...contextArray);
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1809
|
+
finally {
|
|
1810
|
+
try {
|
|
1811
|
+
if (asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return)) yield _a.call(asyncIterable_1);
|
|
1812
|
+
}
|
|
1813
|
+
finally { if (e_1) throw e_1.error; }
|
|
1814
|
+
}
|
|
1815
|
+
this.currentData = fetchedData.slice();
|
|
1816
|
+
return fetchedData;
|
|
1817
|
+
});
|
|
1818
|
+
}
|
|
1819
|
+
_fetchDataAndNotify() {
|
|
1820
|
+
var _a, _b;
|
|
1821
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1822
|
+
const resolver = this.addBusyState('fetching data');
|
|
1823
|
+
const fetchedData = yield this._fetchData();
|
|
1824
|
+
(_b = (_a = this.callback) === null || _a === void 0 ? void 0 : _a.onDataUpdated) === null || _b === void 0 ? void 0 : _b.call(_a, fetchedData);
|
|
1825
|
+
resolver();
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
exports.DataProviderHandler = DataProviderHandler;
|
|
1830
|
+
});
|
|
1831
|
+
|
|
1832
|
+
define('oj-c/hooks/UNSAFE_useDataProvider/useDataProvider',["require", "exports", "preact/hooks", "./DataProviderHandler"], function (require, exports, hooks_1, DataProviderHandler_1) {
|
|
1833
|
+
"use strict";
|
|
1834
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1835
|
+
exports.useDataProvider = void 0;
|
|
1836
|
+
function useDataProvider({ addBusyState, data }) {
|
|
1837
|
+
const [fetchedData, setFetchedData] = (0, hooks_1.useState)([]);
|
|
1838
|
+
const dataProviderHandler = (0, hooks_1.useRef)();
|
|
1839
|
+
(0, hooks_1.useEffect)(() => {
|
|
1840
|
+
if (data !== undefined) {
|
|
1841
|
+
dataProviderHandler.current = new DataProviderHandler_1.DataProviderHandler(data, addBusyState, {
|
|
1842
|
+
onDataUpdated: setFetchedData
|
|
1843
|
+
});
|
|
1844
|
+
}
|
|
1845
|
+
return () => {
|
|
1846
|
+
var _a;
|
|
1847
|
+
(_a = dataProviderHandler.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
1848
|
+
dataProviderHandler.current = undefined;
|
|
1849
|
+
};
|
|
1850
|
+
}, [data, addBusyState]);
|
|
1851
|
+
return {
|
|
1852
|
+
data: fetchedData
|
|
1853
|
+
};
|
|
1854
|
+
}
|
|
1855
|
+
exports.useDataProvider = useDataProvider;
|
|
1856
|
+
});
|
|
1857
|
+
|
|
1858
|
+
|
|
1859
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1860
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1861
|
+
};
|
|
1862
|
+
define('oj-c/message-toast/message-toast',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/hooks/UNSAFE_useMessagesContext", "@oracle/oraclejet-preact/UNSAFE_MessageToast", "oj-c/hooks/UNSAFE_useDataProvider/useDataProvider", "ojs/ojcontext", "ojs/ojvcomponent", "preact/hooks", "css!./message-toast-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_useMessagesContext_1, UNSAFE_MessageToast_1, useDataProvider_1, ojcontext_1, ojvcomponent_1, hooks_1) {
|
|
1863
|
+
"use strict";
|
|
1864
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1865
|
+
exports.MessageToast = void 0;
|
|
1866
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
1867
|
+
ojcontext_1 = __importDefault(ojcontext_1);
|
|
1868
|
+
exports.MessageToast = (0, ojvcomponent_1.registerCustomElement)('oj-c-message-toast', ({ data, detailTemplateValue, iconTemplateValue, messageTemplates, offset = 0, position = 'bottom', onOjClose }) => {
|
|
1869
|
+
const initialRender = (0, hooks_1.useRef)(true);
|
|
1870
|
+
const rootRef = (0, hooks_1.useRef)();
|
|
1871
|
+
const [dpKey, setDpKey] = (0, hooks_1.useState)(Symbol());
|
|
1872
|
+
const addBusyState = (0, hooks_1.useCallback)((description = 'MessageToast: busyState') => {
|
|
1873
|
+
return rootRef.current
|
|
1874
|
+
? ojcontext_1.default.getContext(rootRef.current).getBusyContext().addBusyState({ description })
|
|
1875
|
+
: () => { };
|
|
1876
|
+
}, []);
|
|
1877
|
+
(0, hooks_1.useEffect)(() => {
|
|
1878
|
+
if (initialRender.current) {
|
|
1879
|
+
initialRender.current = false;
|
|
1880
|
+
return;
|
|
1881
|
+
}
|
|
1882
|
+
setDpKey(Symbol());
|
|
1883
|
+
}, [data]);
|
|
1884
|
+
const { data: dataArr } = (0, useDataProvider_1.useDataProvider)({
|
|
1885
|
+
data,
|
|
1886
|
+
addBusyState
|
|
1887
|
+
});
|
|
1888
|
+
const messagesContext = (0, hooks_1.useMemo)(() => ({ addBusyState }), []);
|
|
1889
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, Object.assign({ ref: rootRef }, { children: (0, jsx_runtime_1.jsx)(UNSAFE_useMessagesContext_1.MessagesContext.Provider, Object.assign({ value: messagesContext }, { children: (0, jsx_runtime_1.jsx)(UNSAFE_MessageToast_1.MessageToast, { data: dataArr, detailRendererKey: detailTemplateValue, iconRendererKey: iconTemplateValue, offset: offset, onClose: onOjClose, position: position, renderers: messageTemplates }, dpKey) })) })));
|
|
1890
|
+
}, "MessageToast", { "properties": { "data": { "type": "object" }, "detailTemplateValue": { "type": "string|function" }, "iconTemplateValue": { "type": "string|function" }, "offset": { "type": "number|object" }, "position": { "type": "string", "enumValues": ["bottom", "top", "top-start", "top-end", "bottom-start", "bottom-end", "top-left", "top-right", "bottom-left", "bottom-right"] } }, "extension": { "_DYNAMIC_SLOT": { "prop": "messageTemplates", "isTemplate": 1 } }, "events": { "ojClose": {} } }, { "offset": 0, "position": "bottom" }, {
|
|
1891
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
1892
|
+
});
|
|
1893
|
+
});
|
|
1894
|
+
|
|
1895
|
+
define('oj-c/message-toast',["require", "exports", "./message-toast/message-toast"], function (require, exports, message_toast_1) {
|
|
1896
|
+
"use strict";
|
|
1897
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1898
|
+
exports.MessageToast = void 0;
|
|
1899
|
+
Object.defineProperty(exports, "MessageToast", { enumerable: true, get: function () { return message_toast_1.MessageToast; } });
|
|
1900
|
+
});
|
|
1901
|
+
|
|
1902
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
1903
|
+
var t = {};
|
|
1904
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1905
|
+
t[p] = s[p];
|
|
1906
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1907
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1908
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1909
|
+
t[p[i]] = s[p[i]];
|
|
1910
|
+
}
|
|
1911
|
+
return t;
|
|
1912
|
+
};
|
|
1913
|
+
define('oj-c/text-area/useTextAreaAutosizePreact',["require", "exports", "oj-c/editable-value/UNSAFE_useEditableValue/useEditableValue"], function (require, exports, useEditableValue_1) {
|
|
1914
|
+
"use strict";
|
|
1915
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1916
|
+
exports.useTextAreaAutosizePreact = void 0;
|
|
1917
|
+
function useTextAreaAutosizePreact(_a, addBusyState) {
|
|
1918
|
+
var { autocomplete = 'on', autofocus, converter, disabled, displayOptions, labelEdge, labelHint, labelStartWidth, length, maxRows, messagesCustom, placeholder, readonly, required, requiredMessageDetail, resizeBehavior, rows, textAlign, userAssistanceDensity, validators, value: propValue, onMessagesCustomChanged, onRawValueChanged, onValidChanged, onValueChanged } = _a, otherProps = __rest(_a, ["autocomplete", "autofocus", "converter", "disabled", "displayOptions", "labelEdge", "labelHint", "labelStartWidth", "length", "maxRows", "messagesCustom", "placeholder", "readonly", "required", "requiredMessageDetail", "resizeBehavior", "rows", "textAlign", "userAssistanceDensity", "validators", "value", "onMessagesCustomChanged", "onRawValueChanged", "onValidChanged", "onValueChanged"]);
|
|
1919
|
+
const { methods, textFieldProps, value, setValue } = (0, useEditableValue_1.useEditableValue)({
|
|
1920
|
+
ariaDescribedBy: otherProps['aria-describedby'],
|
|
1921
|
+
converter,
|
|
1922
|
+
displayOptions,
|
|
1923
|
+
messagesCustom,
|
|
1924
|
+
required,
|
|
1925
|
+
requiredMessageDetail,
|
|
1926
|
+
validators,
|
|
1927
|
+
value: propValue,
|
|
1928
|
+
addBusyState,
|
|
1929
|
+
onMessagesCustomChanged,
|
|
1930
|
+
onRawValueChanged,
|
|
1931
|
+
onValidChanged,
|
|
1932
|
+
onValueChanged
|
|
1933
|
+
});
|
|
1934
|
+
const hasNoValue = value === null || (typeof value === 'string' && value === '');
|
|
1935
|
+
return {
|
|
1936
|
+
value,
|
|
1937
|
+
setValue,
|
|
1938
|
+
methods,
|
|
1939
|
+
textAreaProps: Object.assign({ autoComplete: autocomplete, autoFocus: autofocus, isDisabled: disabled, isReadonly: readonly, isRequired: required, isRequiredShown: required && hasNoValue, label: labelHint, labelEdge,
|
|
1940
|
+
labelStartWidth, maxLength: (length === null || length === void 0 ? void 0 : length.max) ? length.max : undefined, maxLengthCounter: length === null || length === void 0 ? void 0 : length.counter, maxLengthUnit: length === null || length === void 0 ? void 0 : length.countBy, maxRows: maxRows === -1 ? undefined : maxRows, minRows: rows, placeholder, resize: resizeBehavior, textAlign,
|
|
1941
|
+
userAssistanceDensity }, textFieldProps)
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1944
|
+
exports.useTextAreaAutosizePreact = useTextAreaAutosizePreact;
|
|
1945
|
+
});
|
|
1946
|
+
|
|
1947
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
1948
|
+
var t = {};
|
|
1949
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1950
|
+
t[p] = s[p];
|
|
1951
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1952
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1953
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1954
|
+
t[p[i]] = s[p[i]];
|
|
1955
|
+
}
|
|
1956
|
+
return t;
|
|
1957
|
+
};
|
|
1958
|
+
define('oj-c/text-area/useTextAreaPreact',["require", "exports", "oj-c/editable-value/UNSAFE_useEditableValue/useEditableValue"], function (require, exports, useEditableValue_1) {
|
|
1959
|
+
"use strict";
|
|
1960
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1961
|
+
exports.useTextAreaPreact = void 0;
|
|
1962
|
+
function useTextAreaPreact(_a, addBusyState) {
|
|
1963
|
+
var { autocomplete = 'on', autofocus, converter, disabled, displayOptions, labelEdge, labelHint, labelStartWidth, length, messagesCustom, placeholder, readonly, required, requiredMessageDetail, resizeBehavior, rows, textAlign, userAssistanceDensity, validators, value: propValue, onMessagesCustomChanged, onRawValueChanged, onValueChanged, onValidChanged } = _a, otherProps = __rest(_a, ["autocomplete", "autofocus", "converter", "disabled", "displayOptions", "labelEdge", "labelHint", "labelStartWidth", "length", "messagesCustom", "placeholder", "readonly", "required", "requiredMessageDetail", "resizeBehavior", "rows", "textAlign", "userAssistanceDensity", "validators", "value", "onMessagesCustomChanged", "onRawValueChanged", "onValueChanged", "onValidChanged"]);
|
|
1964
|
+
const { methods, textFieldProps, value, setValue } = (0, useEditableValue_1.useEditableValue)({
|
|
1965
|
+
ariaDescribedBy: otherProps['aria-describedby'],
|
|
1966
|
+
converter,
|
|
1967
|
+
displayOptions,
|
|
1968
|
+
messagesCustom,
|
|
1969
|
+
required,
|
|
1970
|
+
requiredMessageDetail,
|
|
1971
|
+
validators,
|
|
1972
|
+
value: propValue,
|
|
1973
|
+
addBusyState,
|
|
1974
|
+
onMessagesCustomChanged,
|
|
1975
|
+
onRawValueChanged,
|
|
1976
|
+
onValidChanged,
|
|
1977
|
+
onValueChanged
|
|
1978
|
+
});
|
|
1979
|
+
const hasNoValue = value === null || (typeof value === 'string' && value === '');
|
|
1980
|
+
return {
|
|
1981
|
+
value,
|
|
1982
|
+
setValue,
|
|
1983
|
+
methods,
|
|
1984
|
+
textAreaProps: Object.assign({ autoComplete: autocomplete, autoFocus: autofocus, isDisabled: disabled, isReadonly: readonly, isRequired: required, isRequiredShown: required && hasNoValue, label: labelHint, labelEdge,
|
|
1985
|
+
labelStartWidth, maxLength: (length === null || length === void 0 ? void 0 : length.max) ? length.max : undefined, maxLengthUnit: length === null || length === void 0 ? void 0 : length.countBy, maxLengthCounter: length === null || length === void 0 ? void 0 : length.counter, resize: resizeBehavior != 'none' ? resizeBehavior : undefined, rows,
|
|
1986
|
+
placeholder,
|
|
1987
|
+
textAlign,
|
|
1988
|
+
userAssistanceDensity }, textFieldProps)
|
|
1989
|
+
};
|
|
1990
|
+
}
|
|
1991
|
+
exports.useTextAreaPreact = useTextAreaPreact;
|
|
1992
|
+
});
|
|
1993
|
+
|
|
1994
|
+
|
|
1995
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1996
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1997
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1998
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1999
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2000
|
+
};
|
|
2001
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2002
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2003
|
+
};
|
|
2004
|
+
define('oj-c/text-area/text-area',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/hooks/UNSAFE_useFormContext", "@oracle/oraclejet-preact/hooks/UNSAFE_useFormVariantContext", "@oracle/oraclejet-preact/hooks/UNSAFE_useTabbableMode", "@oracle/oraclejet-preact/UNSAFE_TextArea", "@oracle/oraclejet-preact/UNSAFE_TextAreaAutosize", "oj-c/editable-value/UNSAFE_useAssistiveText/useAssistiveText", "ojs/ojcontext", "ojs/ojvcomponent", "ojs/ojvcomponent-binding", "preact", "preact/compat", "preact/hooks", "./useTextAreaAutosizePreact", "./useTextAreaPreact", "css!oj-c/text-area/text-area-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_useFormContext_1, UNSAFE_useFormVariantContext_1, UNSAFE_useTabbableMode_1, UNSAFE_TextArea_1, UNSAFE_TextAreaAutosize_1, useAssistiveText_1, ojcontext_1, ojvcomponent_1, ojvcomponent_binding_1, preact_1, compat_1, hooks_1, useTextAreaAutosizePreact_1, useTextAreaPreact_1) {
|
|
2005
|
+
"use strict";
|
|
2006
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2007
|
+
exports.TextArea = void 0;
|
|
2008
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
2009
|
+
ojcontext_1 = __importDefault(ojcontext_1);
|
|
2010
|
+
const FunctionalTextArea = (0, compat_1.forwardRef)((props, ref) => {
|
|
2011
|
+
const { busyContextRef, converter, displayOptions, help, helpHints, validators } = props;
|
|
2012
|
+
const textAreaRef = (0, hooks_1.useRef)();
|
|
2013
|
+
const addBusyState = (0, hooks_1.useCallback)((desc) => {
|
|
2014
|
+
var _a;
|
|
2015
|
+
return (_a = busyContextRef.current) === null || _a === void 0 ? void 0 : _a.addBusyState({
|
|
2016
|
+
description: `oj-c-text-area id=${props.id} is ${desc}`
|
|
2017
|
+
});
|
|
2018
|
+
}, []);
|
|
2019
|
+
const { textAreaProps, methods } = (0, useTextAreaPreact_1.useTextAreaPreact)(props, addBusyState);
|
|
2020
|
+
(0, hooks_1.useImperativeHandle)(ref, () => (Object.assign({ blur: () => { var _a; return (_a = textAreaRef.current) === null || _a === void 0 ? void 0 : _a.blur(); }, focus: () => { var _a; return (_a = textAreaRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } }, methods)), [methods]);
|
|
2021
|
+
const assistiveTextProps = (0, useAssistiveText_1.useAssistiveText)({
|
|
2022
|
+
converter,
|
|
2023
|
+
displayOptions,
|
|
2024
|
+
help,
|
|
2025
|
+
helpHints,
|
|
2026
|
+
validators
|
|
2027
|
+
});
|
|
2028
|
+
const variant = (0, UNSAFE_useFormVariantContext_1.useFormVariantContext)();
|
|
2029
|
+
return ((0, jsx_runtime_1.jsx)(UNSAFE_TextArea_1.TextArea, Object.assign({ ref: textAreaRef }, assistiveTextProps, textAreaProps, { variant: variant })));
|
|
2030
|
+
});
|
|
2031
|
+
const FunctionalTextAreaAutosize = (0, compat_1.forwardRef)((props, ref) => {
|
|
2032
|
+
const { busyContextRef, converter, help, helpHints, validators } = props;
|
|
2033
|
+
const textAreaAutosizeRef = (0, hooks_1.useRef)();
|
|
2034
|
+
const addBusyState = (0, hooks_1.useCallback)((desc) => {
|
|
2035
|
+
var _a;
|
|
2036
|
+
return (_a = busyContextRef.current) === null || _a === void 0 ? void 0 : _a.addBusyState({
|
|
2037
|
+
description: `oj-c-text-area id=${props.id} is ${desc}`
|
|
2038
|
+
});
|
|
2039
|
+
}, []);
|
|
2040
|
+
const { textAreaProps, methods } = (0, useTextAreaAutosizePreact_1.useTextAreaAutosizePreact)(props, addBusyState);
|
|
2041
|
+
(0, hooks_1.useImperativeHandle)(ref, () => (Object.assign({ blur: () => { var _a; return (_a = textAreaAutosizeRef.current) === null || _a === void 0 ? void 0 : _a.blur(); }, focus: () => { var _a; return (_a = textAreaAutosizeRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } }, methods)), [methods]);
|
|
2042
|
+
const assistiveTextProps = (0, useAssistiveText_1.useAssistiveText)({
|
|
2043
|
+
converter,
|
|
2044
|
+
help,
|
|
2045
|
+
helpHints,
|
|
2046
|
+
validators
|
|
2047
|
+
});
|
|
2048
|
+
const variant = (0, UNSAFE_useFormVariantContext_1.useFormVariantContext)();
|
|
2049
|
+
return ((0, jsx_runtime_1.jsx)(UNSAFE_TextAreaAutosize_1.TextAreaAutosize, Object.assign({ ref: textAreaAutosizeRef }, assistiveTextProps, textAreaProps, { variant: variant })));
|
|
2050
|
+
});
|
|
2051
|
+
let TextArea = class TextArea extends preact_1.Component {
|
|
2052
|
+
constructor() {
|
|
2053
|
+
super(...arguments);
|
|
2054
|
+
this.busyContextRef = (0, preact_1.createRef)();
|
|
2055
|
+
this.textAreaRef = (0, preact_1.createRef)();
|
|
2056
|
+
this.rootRef = (0, preact_1.createRef)();
|
|
2057
|
+
}
|
|
2058
|
+
componentDidMount() {
|
|
2059
|
+
this.busyContextRef.current = ojcontext_1.default.getContext(this.rootRef.current).getBusyContext();
|
|
2060
|
+
}
|
|
2061
|
+
render(props) {
|
|
2062
|
+
const containerProps = {
|
|
2063
|
+
isFormLayout: props.containerReadonly !== undefined,
|
|
2064
|
+
isReadonly: props.containerReadonly,
|
|
2065
|
+
labelWrapping: props.labelWrapping
|
|
2066
|
+
};
|
|
2067
|
+
const FunctionalComp = props.maxRows ? FunctionalTextAreaAutosize : FunctionalTextArea;
|
|
2068
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, Object.assign({ id: props.id, ref: this.rootRef }, { children: (0, jsx_runtime_1.jsx)(UNSAFE_useFormContext_1.FormContext.Provider, Object.assign({ value: containerProps }, { children: (0, jsx_runtime_1.jsx)(FunctionalComp, Object.assign({ busyContextRef: this.busyContextRef, ref: this.textAreaRef }, props)) })) })));
|
|
2069
|
+
}
|
|
2070
|
+
componentWillUnmount() {
|
|
2071
|
+
this.busyContextRef.current = null;
|
|
2072
|
+
}
|
|
2073
|
+
reset() {
|
|
2074
|
+
var _a;
|
|
2075
|
+
(_a = this.textAreaRef.current) === null || _a === void 0 ? void 0 : _a.reset();
|
|
2076
|
+
}
|
|
2077
|
+
showMessages() {
|
|
2078
|
+
var _a;
|
|
2079
|
+
(_a = this.textAreaRef.current) === null || _a === void 0 ? void 0 : _a.showMessages();
|
|
2080
|
+
}
|
|
2081
|
+
validate() {
|
|
2082
|
+
var _a;
|
|
2083
|
+
return (_a = this.textAreaRef.current) === null || _a === void 0 ? void 0 : _a.validate();
|
|
2084
|
+
}
|
|
2085
|
+
blur() {
|
|
2086
|
+
var _a;
|
|
2087
|
+
(_a = this.textAreaRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
2088
|
+
}
|
|
2089
|
+
focus() {
|
|
2090
|
+
var _a;
|
|
2091
|
+
(_a = this.textAreaRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
2092
|
+
}
|
|
2093
|
+
};
|
|
2094
|
+
TextArea.defaultProps = {
|
|
2095
|
+
autocomplete: 'on',
|
|
2096
|
+
converter: null,
|
|
2097
|
+
disabled: false,
|
|
2098
|
+
displayOptions: {
|
|
2099
|
+
converterHint: 'display',
|
|
2100
|
+
messages: 'display',
|
|
2101
|
+
validatorHint: 'display'
|
|
2102
|
+
},
|
|
2103
|
+
help: {
|
|
2104
|
+
instruction: ''
|
|
2105
|
+
},
|
|
2106
|
+
helpHints: {
|
|
2107
|
+
definition: '',
|
|
2108
|
+
source: '',
|
|
2109
|
+
sourceText: undefined
|
|
2110
|
+
},
|
|
2111
|
+
length: {
|
|
2112
|
+
countBy: 'codePoint',
|
|
2113
|
+
max: null
|
|
2114
|
+
},
|
|
2115
|
+
messagesCustom: [],
|
|
2116
|
+
readonly: false,
|
|
2117
|
+
required: false,
|
|
2118
|
+
resizeBehavior: 'none',
|
|
2119
|
+
userAssistanceDensity: 'reflow',
|
|
2120
|
+
validators: [],
|
|
2121
|
+
value: null
|
|
2122
|
+
};
|
|
2123
|
+
TextArea._metadata = { "properties": { "autocomplete": { "type": "string" }, "containerReadonly": { "type": "boolean", "binding": { "consume": { "name": "containerReadonly" } } }, "converter": { "type": "object|null" }, "disabled": { "type": "boolean" }, "displayOptions": { "type": "object", "properties": { "converterHint": { "type": "string", "enumValues": ["display", "none"] }, "messages": { "type": "string", "enumValues": ["display", "none"] }, "validatorHint": { "type": "string", "enumValues": ["display", "none"] } } }, "help": { "type": "object", "properties": { "instruction": { "type": "string" } } }, "helpHints": { "type": "object", "properties": { "definition": { "type": "string" }, "source": { "type": "string" }, "sourceText": { "type": "string" } } }, "labelEdge": { "type": "string", "enumValues": ["start", "none", "top", "inside"], "binding": { "consume": { "name": "containerLabelEdge" } } }, "labelHint": { "type": "string" }, "labelStartWidth": { "type": "string", "binding": { "consume": { "name": "labelWidth" } } }, "labelWrapping": { "type": "string", "enumValues": ["wrap", "truncate"], "binding": { "consume": { "name": "labelWrapping" } } }, "length": { "type": "object", "properties": { "countBy": { "type": "string", "enumValues": ["codePoint", "codeUnit"] }, "counter": { "type": "string", "enumValues": ["none", "remaining"] }, "max": { "type": "number|null" } } }, "maxRows": { "type": "number" }, "messagesCustom": { "type": "Array<object>", "writeback": true }, "placeholder": { "type": "string" }, "readonly": { "type": "boolean", "binding": { "consume": { "name": "containerReadonly" } } }, "required": { "type": "boolean" }, "requiredMessageDetail": { "type": "string" }, "resizeBehavior": { "type": "string", "enumValues": ["none", "vertical", "horizontal", "both"] }, "rows": { "type": "number" }, "textAlign": { "type": "string", "enumValues": ["start", "right", "end"] }, "userAssistanceDensity": { "type": "string", "enumValues": ["reflow", "efficient"], "binding": { "consume": { "name": "containerUserAssistanceDensity" } } }, "validators": { "type": "Array<object>|null" }, "value": { "type": "any", "writeback": true }, "rawValue": { "type": "string", "readOnly": true, "writeback": true }, "valid": { "type": "string", "enumValues": ["valid", "pending", "invalidHidden", "invalidShown"], "readOnly": true, "writeback": true } }, "extension": { "_WRITEBACK_PROPS": ["messagesCustom", "rawValue", "valid", "value"], "_READ_ONLY_PROPS": ["rawValue", "valid"], "_OBSERVED_GLOBAL_PROPS": ["aria-describedby", "autofocus", "id"] }, "methods": { "reset": {}, "showMessages": {}, "validate": {}, "blur": {}, "focus": {} } };
|
|
2124
|
+
TextArea._translationBundleMap = {
|
|
2125
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
2126
|
+
};
|
|
2127
|
+
TextArea._consumedContexts = [UNSAFE_useFormVariantContext_1.FormVariantContext, UNSAFE_useTabbableMode_1.TabbableModeContext];
|
|
2128
|
+
TextArea = __decorate([
|
|
2129
|
+
(0, ojvcomponent_1.customElement)('oj-c-text-area')
|
|
2130
|
+
], TextArea);
|
|
2131
|
+
exports.TextArea = TextArea;
|
|
2132
|
+
});
|
|
2133
|
+
|
|
2134
|
+
define('oj-c/text-area',["require", "exports", "./text-area/text-area"], function (require, exports, text_area_1) {
|
|
2135
|
+
"use strict";
|
|
2136
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2137
|
+
exports.TextArea = void 0;
|
|
2138
|
+
Object.defineProperty(exports, "TextArea", { enumerable: true, get: function () { return text_area_1.TextArea; } });
|
|
2139
|
+
});
|
|
2140
|
+
|
|
2141
|
+
|
|
2142
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2143
|
+
var t = {};
|
|
2144
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2145
|
+
t[p] = s[p];
|
|
2146
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2147
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2148
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2149
|
+
t[p[i]] = s[p[i]];
|
|
2150
|
+
}
|
|
2151
|
+
return t;
|
|
2152
|
+
};
|
|
2153
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2154
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2155
|
+
};
|
|
2156
|
+
define('oj-c/progress-bar/progress-bar',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/UNSAFE_ProgressBar", "ojs/ojvcomponent", "css!oj-c/progress-bar/progress-bar-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_ProgressBar_1, ojvcomponent_1) {
|
|
2157
|
+
"use strict";
|
|
2158
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2159
|
+
exports.ProgressBar = void 0;
|
|
2160
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
2161
|
+
exports.ProgressBar = (0, ojvcomponent_1.registerCustomElement)('oj-c-progress-bar', (_a) => {
|
|
2162
|
+
var { max = 100, value = 0, edge = 'none' } = _a, otherProps = __rest(_a, ["max", "value", "edge"]);
|
|
2163
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, { children: (0, jsx_runtime_1.jsx)(UNSAFE_ProgressBar_1.ProgressBar, { value: value === -1 ? 'indeterminate' : value, max: max, edge: edge, accessibleLabel: otherProps['aria-valuetext'] }) }));
|
|
2164
|
+
}, "ProgressBar", { "properties": { "max": { "type": "number" }, "value": { "type": "number" }, "edge": { "type": "string", "enumValues": ["none", "top"] } }, "extension": { "_OBSERVED_GLOBAL_PROPS": ["aria-valuetext"] } }, { "max": 100, "value": 0, "edge": "none" }, {
|
|
2165
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
2166
|
+
});
|
|
2167
|
+
});
|
|
2168
|
+
|
|
2169
|
+
define('oj-c/progress-bar',["require", "exports", "./progress-bar/progress-bar"], function (require, exports, progress_bar_1) {
|
|
2170
|
+
"use strict";
|
|
2171
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2172
|
+
exports.ProgressBar = void 0;
|
|
2173
|
+
Object.defineProperty(exports, "ProgressBar", { enumerable: true, get: function () { return progress_bar_1.ProgressBar; } });
|
|
2174
|
+
});
|
|
2175
|
+
|
|
2176
|
+
|
|
2177
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2178
|
+
var t = {};
|
|
2179
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2180
|
+
t[p] = s[p];
|
|
2181
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2182
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2183
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2184
|
+
t[p[i]] = s[p[i]];
|
|
2185
|
+
}
|
|
2186
|
+
return t;
|
|
2187
|
+
};
|
|
2188
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2189
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2190
|
+
};
|
|
2191
|
+
define('oj-c/progress-circle/progress-circle',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/UNSAFE_ProgressCircle", "ojs/ojvcomponent", "css!oj-c/progress-circle/progress-circle-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_ProgressCircle_1, ojvcomponent_1) {
|
|
2192
|
+
"use strict";
|
|
2193
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2194
|
+
exports.ProgressCircle = void 0;
|
|
2195
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
2196
|
+
exports.ProgressCircle = (0, ojvcomponent_1.registerCustomElement)('oj-c-progress-circle', (_a) => {
|
|
2197
|
+
var { max = 100, value = 0, size = 'md' } = _a, otherProps = __rest(_a, ["max", "value", "size"]);
|
|
2198
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, { children: (0, jsx_runtime_1.jsx)(UNSAFE_ProgressCircle_1.ProgressCircle, { value: value === -1 ? 'indeterminate' : value, max: max, size: size, accessibleLabel: otherProps['aria-valuetext'] }) }));
|
|
2199
|
+
}, "ProgressCircle", { "properties": { "max": { "type": "number" }, "value": { "type": "number" }, "size": { "type": "string", "enumValues": ["sm", "md", "lg"] } }, "extension": { "_OBSERVED_GLOBAL_PROPS": ["aria-valuetext"] } }, { "max": 100, "value": 0, "size": "md" }, {
|
|
2200
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
2201
|
+
});
|
|
2202
|
+
});
|
|
2203
|
+
|
|
2204
|
+
define('oj-c/progress-circle',["require", "exports", "./progress-circle/progress-circle"], function (require, exports, progress_circle_1) {
|
|
2205
|
+
"use strict";
|
|
2206
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2207
|
+
exports.ProgressCircle = void 0;
|
|
2208
|
+
Object.defineProperty(exports, "ProgressCircle", { enumerable: true, get: function () { return progress_circle_1.ProgressCircle; } });
|
|
2209
|
+
});
|
|
2210
|
+
|
|
2211
|
+
|
|
2212
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2213
|
+
var t = {};
|
|
2214
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2215
|
+
t[p] = s[p];
|
|
2216
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2217
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2218
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2219
|
+
t[p[i]] = s[p[i]];
|
|
2220
|
+
}
|
|
2221
|
+
return t;
|
|
2222
|
+
};
|
|
2223
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2224
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2225
|
+
};
|
|
2226
|
+
define('oj-c/avatar/avatar',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/UNSAFE_Avatar", "ojs/ojvcomponent", "css!oj-c/avatar/avatar-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_Avatar_1, ojvcomponent_1) {
|
|
2227
|
+
"use strict";
|
|
2228
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2229
|
+
exports.Avatar = void 0;
|
|
2230
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
2231
|
+
exports.Avatar = (0, ojvcomponent_1.registerCustomElement)('oj-c-avatar', (_a) => {
|
|
2232
|
+
var { src, iconClass, initials, shape = 'square', background = 'neutral', size = 'md' } = _a, otherProps = __rest(_a, ["src", "iconClass", "initials", "shape", "background", "size"]);
|
|
2233
|
+
const icon = iconClass ? (0, jsx_runtime_1.jsx)("span", { class: iconClass }) : null;
|
|
2234
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, { children: (0, jsx_runtime_1.jsx)(UNSAFE_Avatar_1.Avatar, Object.assign({ src: src !== null && src !== void 0 ? src : undefined, background: background, size: size, initials: initials !== null && initials !== void 0 ? initials : undefined, shape: shape, accessibleLabel: otherProps['aria-label'] }, { children: icon })) }));
|
|
2235
|
+
}, "Avatar", { "properties": { "background": { "type": "string", "enumValues": ["neutral", "orange", "green", "teal", "blue", "slate", "pink", "purple", "lilac", "gray"] }, "initials": { "type": "string|null" }, "size": { "type": "string", "enumValues": ["2xs", "xs", "sm", "md", "lg", "xl", "2xl"] }, "src": { "type": "string|null" }, "iconClass": { "type": "string" }, "shape": { "type": "string", "enumValues": ["circle", "square"] } }, "extension": { "_OBSERVED_GLOBAL_PROPS": ["aria-label"] } }, { "shape": "square", "background": "neutral", "size": "md" }, {
|
|
2236
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
2237
|
+
});
|
|
2238
|
+
});
|
|
2239
|
+
|
|
2240
|
+
define('oj-c/avatar',["require", "exports", "./avatar/avatar"], function (require, exports, avatar_1) {
|
|
2241
|
+
"use strict";
|
|
2242
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2243
|
+
exports.Avatar = void 0;
|
|
2244
|
+
Object.defineProperty(exports, "Avatar", { enumerable: true, get: function () { return avatar_1.Avatar; } });
|
|
2245
|
+
});
|
|
2246
|
+
|
|
2247
|
+
|
|
2248
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2249
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2250
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2251
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2252
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2253
|
+
};
|
|
2254
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2255
|
+
var t = {};
|
|
2256
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2257
|
+
t[p] = s[p];
|
|
2258
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2259
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2260
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2261
|
+
t[p[i]] = s[p[i]];
|
|
2262
|
+
}
|
|
2263
|
+
return t;
|
|
2264
|
+
};
|
|
2265
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2266
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2267
|
+
};
|
|
2268
|
+
define('oj-c/button/button',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/UNSAFE_Button", "@oracle/oraclejet-preact/hooks/UNSAFE_useTabbableMode", "preact", "preact/hooks", "preact/compat", "ojs/ojvcomponent", "css!oj-c/button/button-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_Button_1, UNSAFE_useTabbableMode_1, preact_1, hooks_1, compat_1, ojvcomponent_1) {
|
|
2269
|
+
"use strict";
|
|
2270
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2271
|
+
exports.Button = void 0;
|
|
2272
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
2273
|
+
const FunctionalButton = (0, compat_1.forwardRef)((props, ref) => {
|
|
2274
|
+
const buttonRef = (0, hooks_1.useRef)();
|
|
2275
|
+
(0, hooks_1.useImperativeHandle)(ref, () => ({
|
|
2276
|
+
focus: () => { var _a; return (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.focus(); },
|
|
2277
|
+
blur: () => { var _a; return (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.blur(); }
|
|
2278
|
+
}), []);
|
|
2279
|
+
return (0, jsx_runtime_1.jsx)(UNSAFE_Button_1.Button, Object.assign({ ref: buttonRef }, props));
|
|
2280
|
+
});
|
|
2281
|
+
let Button = class Button extends preact_1.Component {
|
|
2282
|
+
constructor() {
|
|
2283
|
+
super(...arguments);
|
|
2284
|
+
this.buttonRef = (0, preact_1.createRef)();
|
|
2285
|
+
}
|
|
2286
|
+
render(props) {
|
|
2287
|
+
const widthSize = { width: props.edge === 'bottom' ? '100%' : props.width };
|
|
2288
|
+
const _a = Object.assign({}, props), { chroming: variant, disabled: isDisabled, onOjAction: onAction, 'aria-label': accessibleLabel, width: throwAwayWidth } = _a, otherProps = __rest(_a, ["chroming", "disabled", "onOjAction", 'aria-label', "width"]);
|
|
2289
|
+
return props.width || props.edge !== 'none' ? ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, Object.assign({ style: widthSize }, { children: (0, jsx_runtime_1.jsx)(FunctionalButton, Object.assign({ ref: this.buttonRef, variant: variant, isDisabled: isDisabled, width: '100%', onAction: onAction, accessibleLabel: accessibleLabel }, otherProps)) }))) : ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, { children: (0, jsx_runtime_1.jsx)(FunctionalButton, Object.assign({ ref: this.buttonRef, variant: variant, isDisabled: isDisabled, width: '100%', onAction: onAction, accessibleLabel: accessibleLabel }, otherProps)) }));
|
|
2290
|
+
}
|
|
2291
|
+
blur() {
|
|
2292
|
+
var _a;
|
|
2293
|
+
(_a = this.buttonRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
2294
|
+
}
|
|
2295
|
+
focus() {
|
|
2296
|
+
var _a;
|
|
2297
|
+
(_a = this.buttonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
2298
|
+
}
|
|
2299
|
+
};
|
|
2300
|
+
Button.defaultProps = {
|
|
2301
|
+
chroming: 'outlined',
|
|
2302
|
+
disabled: false,
|
|
2303
|
+
size: 'md',
|
|
2304
|
+
display: 'all',
|
|
2305
|
+
endIcon: null,
|
|
2306
|
+
startIcon: null,
|
|
2307
|
+
edge: 'none'
|
|
2308
|
+
};
|
|
2309
|
+
Button._metadata = { "properties": { "label": { "type": "string" }, "disabled": { "type": "boolean" }, "width": { "type": "number|string" }, "display": { "type": "string", "enumValues": ["label", "icons", "all"] }, "size": { "type": "string", "enumValues": ["sm", "md", "lg"] }, "edge": { "type": "string", "enumValues": ["none", "bottom"] }, "chroming": { "type": "string", "enumValues": ["borderless", "outlined", "solid", "callToAction", "danger"] } }, "slots": { "startIcon": {}, "endIcon": {} }, "events": { "ojAction": { "bubbles": true } }, "extension": { "_OBSERVED_GLOBAL_PROPS": ["title", "aria-label"] }, "methods": { "blur": {}, "focus": {} } };
|
|
2310
|
+
Button._translationBundleMap = {
|
|
2311
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
2312
|
+
};
|
|
2313
|
+
Button._consumedContexts = [UNSAFE_useTabbableMode_1.TabbableModeContext];
|
|
2314
|
+
Button = __decorate([
|
|
2315
|
+
(0, ojvcomponent_1.customElement)('oj-c-button')
|
|
2316
|
+
], Button);
|
|
2317
|
+
exports.Button = Button;
|
|
2318
|
+
});
|
|
2319
|
+
|
|
2320
|
+
define('oj-c/button',["require", "exports", "./button/button"], function (require, exports, button_1) {
|
|
2321
|
+
"use strict";
|
|
2322
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2323
|
+
exports.Button = void 0;
|
|
2324
|
+
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return button_1.Button; } });
|
|
2325
|
+
});
|
|
2326
|
+
|
|
2327
|
+
|
|
2328
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2329
|
+
var t = {};
|
|
2330
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2331
|
+
t[p] = s[p];
|
|
2332
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2333
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2334
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2335
|
+
t[p[i]] = s[p[i]];
|
|
2336
|
+
}
|
|
2337
|
+
return t;
|
|
2338
|
+
};
|
|
2339
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2340
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2341
|
+
};
|
|
2342
|
+
define('oj-c/rating-gauge/rating-gauge',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/UNSAFE_RatingGauge", "ojs/ojvcomponent", "preact/hooks", "@oracle/oraclejet-preact/hooks/UNSAFE_useTabbableMode", "css!oj-c/rating-gauge/rating-gauge-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_RatingGauge_1, ojvcomponent_1, hooks_1, UNSAFE_useTabbableMode_1) {
|
|
2343
|
+
"use strict";
|
|
2344
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2345
|
+
exports.RatingGauge = void 0;
|
|
2346
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
2347
|
+
exports.RatingGauge = (0, ojvcomponent_1.registerCustomElement)('oj-c-rating-gauge', (_a) => {
|
|
2348
|
+
var _b, _c, _d;
|
|
2349
|
+
var { max = 5, value = 0, size = 'md', color = 'neutral', step = 1, readonly = false, disabled = false, changed = false } = _a, otherProps = __rest(_a, ["max", "value", "size", "color", "step", "readonly", "disabled", "changed"]);
|
|
2350
|
+
const [val, setVal] = (0, hooks_1.useState)(value);
|
|
2351
|
+
const [hoveredVal, setHoveredVal] = (0, hooks_1.useState)();
|
|
2352
|
+
const inputHandler = (detail) => {
|
|
2353
|
+
var _a;
|
|
2354
|
+
setHoveredVal(detail.value);
|
|
2355
|
+
(_a = otherProps.onTransientValueChanged) === null || _a === void 0 ? void 0 : _a.call(otherProps, detail.value);
|
|
2356
|
+
};
|
|
2357
|
+
const commitHandler = (detail) => {
|
|
2358
|
+
var _a, _b;
|
|
2359
|
+
setVal(detail.value);
|
|
2360
|
+
(_a = otherProps.onValueChanged) === null || _a === void 0 ? void 0 : _a.call(otherProps, detail.value);
|
|
2361
|
+
if (!changed) {
|
|
2362
|
+
(_b = otherProps.onChangedChanged) === null || _b === void 0 ? void 0 : _b.call(otherProps, true);
|
|
2363
|
+
}
|
|
2364
|
+
};
|
|
2365
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, { children: (0, jsx_runtime_1.jsx)(UNSAFE_RatingGauge_1.RatingGauge, { isReadonly: readonly, isDisabled: disabled, value: (hoveredVal != undefined ? hoveredVal : val), step: step, max: max, size: size, color: color, tooltip: otherProps.tooltip, datatip: (_b = otherProps.datatip) === null || _b === void 0 ? void 0 : _b.call(otherProps, {
|
|
2366
|
+
value: hoveredVal != undefined ? hoveredVal : val
|
|
2367
|
+
}), onCommit: commitHandler, onInput: inputHandler, accessibleLabel: otherProps['aria-label'], ariaLabelledBy: (_c = otherProps.labelledBy) !== null && _c !== void 0 ? _c : undefined, ariaDescribedBy: (_d = otherProps.describedBy) !== null && _d !== void 0 ? _d : undefined }) }));
|
|
2368
|
+
}, "RatingGauge", { "properties": { "max": { "type": "number" }, "readonly": { "type": "boolean" }, "disabled": { "type": "boolean" }, "changed": { "type": "boolean", "writeback": true }, "value": { "type": "number|null", "writeback": true }, "step": { "type": "number" }, "describedBy": { "type": "string|null" }, "labelledBy": { "type": "string|null" }, "size": { "type": "string", "enumValues": ["sm", "md", "lg"] }, "color": { "type": "string", "enumValues": ["neutral", "gold"] }, "datatip": { "type": "function" }, "tooltip": { "type": "string" }, "transientValue": { "type": "number", "readOnly": true, "writeback": true } }, "extension": { "_WRITEBACK_PROPS": ["changed", "value", "transientValue"], "_READ_ONLY_PROPS": ["transientValue"], "_OBSERVED_GLOBAL_PROPS": ["aria-label"] } }, { "max": 5, "value": 0, "size": "md", "color": "neutral", "step": 1, "readonly": false, "disabled": false, "changed": false }, {
|
|
2369
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
2370
|
+
}, { consume: [UNSAFE_useTabbableMode_1.TabbableModeContext] });
|
|
2371
|
+
});
|
|
2372
|
+
|
|
2373
|
+
define('oj-c/rating-gauge',["require", "exports", "./rating-gauge/rating-gauge"], function (require, exports, rating_gauge_1) {
|
|
2374
|
+
"use strict";
|
|
2375
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2376
|
+
exports.RatingGauge = void 0;
|
|
2377
|
+
Object.defineProperty(exports, "RatingGauge", { enumerable: true, get: function () { return rating_gauge_1.RatingGauge; } });
|
|
2378
|
+
});
|
|
2379
|
+
|
|
2380
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2381
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2382
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2383
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2384
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2385
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2386
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2387
|
+
});
|
|
2388
|
+
};
|
|
2389
|
+
define('oj-c/hooks/UNSAFE_useListData/useListData',["require", "exports", "ojs/ojdataproviderfactory", "preact/hooks"], function (require, exports, ojdataproviderfactory_1, hooks_1) {
|
|
2390
|
+
"use strict";
|
|
2391
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2392
|
+
exports.useListData = void 0;
|
|
2393
|
+
const initialState = Object.freeze({
|
|
2394
|
+
status: 'loading',
|
|
2395
|
+
data: null
|
|
2396
|
+
});
|
|
2397
|
+
const defaultOptions = {
|
|
2398
|
+
isInitialFetchDeferred: false
|
|
2399
|
+
};
|
|
2400
|
+
const DEFAULT_FETCH_SIZE = 25;
|
|
2401
|
+
const useListData = (data, options = defaultOptions) => {
|
|
2402
|
+
const fetchNextRef = (0, hooks_1.useRef)(null);
|
|
2403
|
+
const totalSizeRef = (0, hooks_1.useRef)(0);
|
|
2404
|
+
const isDoneRef = (0, hooks_1.useRef)(false);
|
|
2405
|
+
const iteratorRef = (0, hooks_1.useRef)(null);
|
|
2406
|
+
const fetchSize = options.fetchSize && options.fetchSize > 0 ? options.fetchSize : DEFAULT_FETCH_SIZE;
|
|
2407
|
+
if (!data) {
|
|
2408
|
+
const emptyListState = getEmptyState('exact');
|
|
2409
|
+
return [emptyListState, (_) => Promise.resolve()];
|
|
2410
|
+
}
|
|
2411
|
+
const dataProvider = (0, hooks_1.useMemo)(() => wrapData(data), [data]);
|
|
2412
|
+
const [state, dispatch] = (0, hooks_1.useReducer)(reducer, initialState);
|
|
2413
|
+
const fetchRange = (0, hooks_1.useCallback)((range) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2414
|
+
const fetchOptions = {
|
|
2415
|
+
attributes: options.attributes,
|
|
2416
|
+
sortCriteria: options.sortCriteria,
|
|
2417
|
+
filterCriterion: options.filterCriterion,
|
|
2418
|
+
offset: range.offset,
|
|
2419
|
+
size: range.count
|
|
2420
|
+
};
|
|
2421
|
+
try {
|
|
2422
|
+
const result = yield dataProvider.fetchByOffset(fetchOptions);
|
|
2423
|
+
const results = result['results'];
|
|
2424
|
+
const sizePrecision = isDoneRef.current === true ? 'exact' : 'atLeast';
|
|
2425
|
+
dispatch({
|
|
2426
|
+
status: 'success',
|
|
2427
|
+
data: {
|
|
2428
|
+
offset: range.offset,
|
|
2429
|
+
data: results,
|
|
2430
|
+
totalSize: totalSizeRef.current,
|
|
2431
|
+
sizePrecision: sizePrecision
|
|
2432
|
+
}
|
|
2433
|
+
});
|
|
2434
|
+
}
|
|
2435
|
+
catch (error) {
|
|
2436
|
+
dispatch({
|
|
2437
|
+
status: 'error',
|
|
2438
|
+
error: error
|
|
2439
|
+
});
|
|
2440
|
+
}
|
|
2441
|
+
}), [dataProvider, options.attributes, options.filterCriterion, options.sortCriteria]);
|
|
2442
|
+
const loadInitial = (0, hooks_1.useCallback)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
2443
|
+
dispatch({ status: 'loading', data: null });
|
|
2444
|
+
const iterator = dataProvider
|
|
2445
|
+
.fetchFirst({
|
|
2446
|
+
attributes: options.attributes,
|
|
2447
|
+
sortCriteria: options.sortCriteria,
|
|
2448
|
+
filterCriterion: options.filterCriterion,
|
|
2449
|
+
size: fetchSize
|
|
2450
|
+
})[Symbol.asyncIterator]();
|
|
2451
|
+
iteratorRef.current = iterator;
|
|
2452
|
+
try {
|
|
2453
|
+
const result = yield iterator.next();
|
|
2454
|
+
totalSizeRef.current = result.value.data.length;
|
|
2455
|
+
if (result.done !== undefined) {
|
|
2456
|
+
isDoneRef.current = result.done;
|
|
2457
|
+
}
|
|
2458
|
+
const initialFetchSize = options.initialRowsFetched && options.initialRowsFetched > 0
|
|
2459
|
+
? options.initialRowsFetched
|
|
2460
|
+
: fetchSize;
|
|
2461
|
+
fetchRange({ offset: 0, count: Math.min(totalSizeRef.current, initialFetchSize) });
|
|
2462
|
+
}
|
|
2463
|
+
catch (error) {
|
|
2464
|
+
dispatch({
|
|
2465
|
+
status: 'error',
|
|
2466
|
+
error: error
|
|
2467
|
+
});
|
|
2468
|
+
iteratorRef.current = null;
|
|
2469
|
+
}
|
|
2470
|
+
}), [
|
|
2471
|
+
dataProvider,
|
|
2472
|
+
fetchRange,
|
|
2473
|
+
options.attributes,
|
|
2474
|
+
options.filterCriterion,
|
|
2475
|
+
options.sortCriteria,
|
|
2476
|
+
options.fetchSize
|
|
2477
|
+
]);
|
|
2478
|
+
const loadRange = (0, hooks_1.useCallback)((range) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2479
|
+
if (iteratorRef.current === null) {
|
|
2480
|
+
loadInitial();
|
|
2481
|
+
}
|
|
2482
|
+
else {
|
|
2483
|
+
const endIndex = range.offset + range.count;
|
|
2484
|
+
if (endIndex > totalSizeRef.current) {
|
|
2485
|
+
if (fetchNextRef.current == null) {
|
|
2486
|
+
const promise = fetchNextUntilThresholdOrDone(iteratorRef, totalSizeRef.current, endIndex);
|
|
2487
|
+
fetchNextRef.current = promise;
|
|
2488
|
+
try {
|
|
2489
|
+
const value = yield promise;
|
|
2490
|
+
if (value.done !== undefined) {
|
|
2491
|
+
isDoneRef.current = value.done;
|
|
2492
|
+
}
|
|
2493
|
+
const total = value.total;
|
|
2494
|
+
if (total > 0) {
|
|
2495
|
+
totalSizeRef.current = total;
|
|
2496
|
+
fetchRange({
|
|
2497
|
+
offset: range.offset,
|
|
2498
|
+
count: Math.min(totalSizeRef.current - range.offset, range.count)
|
|
2499
|
+
});
|
|
2500
|
+
}
|
|
2501
|
+
fetchNextRef.current = null;
|
|
2502
|
+
}
|
|
2503
|
+
catch (error) {
|
|
2504
|
+
dispatch({
|
|
2505
|
+
status: 'error',
|
|
2506
|
+
error: error
|
|
2507
|
+
});
|
|
2508
|
+
fetchNextRef.current = null;
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
else {
|
|
2513
|
+
fetchRange(range);
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
}), [state, loadInitial, fetchRange]);
|
|
2517
|
+
const resetAndLoad = (0, hooks_1.useCallback)(() => {
|
|
2518
|
+
iteratorRef.current = null;
|
|
2519
|
+
fetchNextRef.current = null;
|
|
2520
|
+
totalSizeRef.current = 0;
|
|
2521
|
+
isDoneRef.current = false;
|
|
2522
|
+
if (options.initialRowsFetched === 0) {
|
|
2523
|
+
dispatch(getEmptyState('atLeast'));
|
|
2524
|
+
}
|
|
2525
|
+
else if (!options.isInitialFetchDeferred) {
|
|
2526
|
+
loadInitial();
|
|
2527
|
+
}
|
|
2528
|
+
else {
|
|
2529
|
+
dispatch({ status: 'loading', data: null });
|
|
2530
|
+
}
|
|
2531
|
+
}, [loadInitial, options.isInitialFetchDeferred, options.initialRowsFetched]);
|
|
2532
|
+
(0, hooks_1.useEffect)(() => {
|
|
2533
|
+
resetAndLoad();
|
|
2534
|
+
}, [resetAndLoad]);
|
|
2535
|
+
const handleMutation = (0, hooks_1.useCallback)((event) => {
|
|
2536
|
+
if (state.status === 'success' && state.data) {
|
|
2537
|
+
const dataState = state.data;
|
|
2538
|
+
let shouldUpdate = false;
|
|
2539
|
+
if (event.detail.add) {
|
|
2540
|
+
const itemsInserted = handleAddRemoveMutation(event.detail.add, dataState, options, true);
|
|
2541
|
+
totalSizeRef.current = totalSizeRef.current + itemsInserted;
|
|
2542
|
+
shouldUpdate = itemsInserted > 0 || dataState.sizePrecision === 'exact';
|
|
2543
|
+
if (itemsInserted === 0) {
|
|
2544
|
+
isDoneRef.current = false;
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
if (event.detail.remove) {
|
|
2548
|
+
const itemsRemoved = handleAddRemoveMutation(event.detail.remove, dataState, options, false);
|
|
2549
|
+
totalSizeRef.current = totalSizeRef.current - itemsRemoved;
|
|
2550
|
+
shouldUpdate = shouldUpdate || itemsRemoved > 0;
|
|
2551
|
+
}
|
|
2552
|
+
if (event.detail.update) {
|
|
2553
|
+
shouldUpdate =
|
|
2554
|
+
shouldUpdate || handleUpdateMutation(event.detail.update, dataState, options);
|
|
2555
|
+
}
|
|
2556
|
+
if (shouldUpdate) {
|
|
2557
|
+
fetchRange({ offset: dataState.offset, count: dataState.data.length });
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
}, [state, options, fetchRange]);
|
|
2561
|
+
const handleRefresh = (0, hooks_1.useCallback)((event) => {
|
|
2562
|
+
var _a;
|
|
2563
|
+
let adjustment = -1;
|
|
2564
|
+
const disregardAfterKey = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.disregardAfterKey;
|
|
2565
|
+
if (disregardAfterKey && state.status === 'success') {
|
|
2566
|
+
const index = state.data.data.findIndex((value) => {
|
|
2567
|
+
return value.metadata.key === disregardAfterKey;
|
|
2568
|
+
});
|
|
2569
|
+
if (index > -1) {
|
|
2570
|
+
adjustment = state.data.data.length - index - 1;
|
|
2571
|
+
}
|
|
2572
|
+
if (adjustment === 0 && state.data.data.length >= fetchSize) {
|
|
2573
|
+
return;
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
if (adjustment > -1 && state.status === 'success') {
|
|
2577
|
+
totalSizeRef.current = totalSizeRef.current - adjustment;
|
|
2578
|
+
loadRange({
|
|
2579
|
+
offset: state.data.offset,
|
|
2580
|
+
count: Math.max(state.data.data.length, fetchSize)
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2583
|
+
else {
|
|
2584
|
+
resetAndLoad();
|
|
2585
|
+
}
|
|
2586
|
+
}, [state, resetAndLoad]);
|
|
2587
|
+
(0, hooks_1.useEffect)(() => {
|
|
2588
|
+
dataProvider.addEventListener('refresh', handleRefresh);
|
|
2589
|
+
dataProvider.addEventListener('mutate', handleMutation);
|
|
2590
|
+
return () => {
|
|
2591
|
+
dataProvider.removeEventListener('refresh', handleRefresh);
|
|
2592
|
+
dataProvider.removeEventListener('mutate', handleMutation);
|
|
2593
|
+
};
|
|
2594
|
+
}, [dataProvider, resetAndLoad, handleMutation]);
|
|
2595
|
+
return [state, loadRange];
|
|
2596
|
+
};
|
|
2597
|
+
exports.useListData = useListData;
|
|
2598
|
+
const wrapData = (data) => {
|
|
2599
|
+
const configuration = {
|
|
2600
|
+
fetchFirst: { caching: 'visitedByCurrentIterator' }
|
|
2601
|
+
};
|
|
2602
|
+
return (0, ojdataproviderfactory_1.getEnhancedDataProvider)(data, configuration);
|
|
2603
|
+
};
|
|
2604
|
+
const reducer = (state, action) => {
|
|
2605
|
+
if (state.status === action.status && action.status === 'loading') {
|
|
2606
|
+
return state;
|
|
2607
|
+
}
|
|
2608
|
+
return action;
|
|
2609
|
+
};
|
|
2610
|
+
const fetchNextUntilThresholdOrDone = (iteratorRef, current, threshold) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2611
|
+
return yield fetchNextRecursive(iteratorRef, current, threshold);
|
|
2612
|
+
});
|
|
2613
|
+
const fetchNextRecursive = (iteratorRef, currentCount, threshold) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2614
|
+
const currentIterator = iteratorRef.current;
|
|
2615
|
+
if (currentIterator === null) {
|
|
2616
|
+
return { total: -1, done: undefined };
|
|
2617
|
+
}
|
|
2618
|
+
const result = yield currentIterator.next();
|
|
2619
|
+
if (currentIterator === iteratorRef.current) {
|
|
2620
|
+
currentCount += result.value.data.length;
|
|
2621
|
+
if (currentCount >= threshold || result.done) {
|
|
2622
|
+
return { total: currentCount, done: result.done };
|
|
2623
|
+
}
|
|
2624
|
+
return fetchNextRecursive(iteratorRef, currentCount, threshold);
|
|
2625
|
+
}
|
|
2626
|
+
return { total: -1, done: undefined };
|
|
2627
|
+
});
|
|
2628
|
+
const getEmptyState = (precision) => {
|
|
2629
|
+
return {
|
|
2630
|
+
status: 'success',
|
|
2631
|
+
data: {
|
|
2632
|
+
offset: 0,
|
|
2633
|
+
data: [],
|
|
2634
|
+
totalSize: 0,
|
|
2635
|
+
sizePrecision: precision
|
|
2636
|
+
}
|
|
2637
|
+
};
|
|
2638
|
+
};
|
|
2639
|
+
const handleAddRemoveMutation = (detail, dataState, options, isAdd) => {
|
|
2640
|
+
var _a;
|
|
2641
|
+
let itemCount = 0;
|
|
2642
|
+
if (isIndexesAvailable(detail, options)) {
|
|
2643
|
+
const indexes = isAdd ? (_a = detail.indexes) === null || _a === void 0 ? void 0 : _a.sort() : detail.indexes;
|
|
2644
|
+
let endIndex = dataState.totalSize - 1;
|
|
2645
|
+
indexes === null || indexes === void 0 ? void 0 : indexes.forEach((index) => {
|
|
2646
|
+
if (index <= endIndex) {
|
|
2647
|
+
itemCount = itemCount += 1;
|
|
2648
|
+
if (isAdd) {
|
|
2649
|
+
endIndex = endIndex += 1;
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
});
|
|
2653
|
+
}
|
|
2654
|
+
else {
|
|
2655
|
+
}
|
|
2656
|
+
return itemCount;
|
|
2657
|
+
};
|
|
2658
|
+
const handleUpdateMutation = (detail, dataState, options) => {
|
|
2659
|
+
if (isIndexesAvailable(detail, options)) {
|
|
2660
|
+
const indexes = detail.indexes ? detail.indexes : [];
|
|
2661
|
+
const startIndex = dataState.offset;
|
|
2662
|
+
const endIndex = startIndex + dataState.data.length;
|
|
2663
|
+
for (let i = 0; i < indexes.length; i++) {
|
|
2664
|
+
if (indexes[i] >= startIndex && indexes[i] < endIndex) {
|
|
2665
|
+
return true;
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
else {
|
|
2670
|
+
}
|
|
2671
|
+
return false;
|
|
2672
|
+
};
|
|
2673
|
+
const isIndexesAvailable = (detail, options) => {
|
|
2674
|
+
return detail.indexes && options.sortCriteria == null && options.filterCriterion == null;
|
|
2675
|
+
};
|
|
2676
|
+
});
|
|
2677
|
+
|
|
2678
|
+
define('oj-c/select-common/utils/utils',["require", "exports"], function (require, exports) {
|
|
2679
|
+
"use strict";
|
|
2680
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2681
|
+
exports.isEmpty = exports.DEFAULT_VALUE_ITEMS = exports.DEFAULT_VALUE_ITEM = exports.DEFAULT_VALUE = exports.DEFAULT_ITEM_CONTEXT = void 0;
|
|
2682
|
+
exports.DEFAULT_ITEM_CONTEXT = null;
|
|
2683
|
+
exports.DEFAULT_VALUE = null;
|
|
2684
|
+
exports.DEFAULT_VALUE_ITEM = null;
|
|
2685
|
+
exports.DEFAULT_VALUE_ITEMS = null;
|
|
2686
|
+
function isEmpty(value) {
|
|
2687
|
+
if (!value)
|
|
2688
|
+
return true;
|
|
2689
|
+
if (Array.isArray(value))
|
|
2690
|
+
return value.length === 0;
|
|
2691
|
+
if (value instanceof Set || value instanceof Map)
|
|
2692
|
+
return value.size === 0;
|
|
2693
|
+
return false;
|
|
2694
|
+
}
|
|
2695
|
+
exports.isEmpty = isEmpty;
|
|
2696
|
+
});
|
|
2697
|
+
|
|
2698
|
+
define('oj-c/select-common/UNSAFE_useDataProviderListeners/useDataProviderListeners',["require", "exports", "@oracle/oraclejet-preact/utils/UNSAFE_logger", "preact/hooks", "../utils/utils"], function (require, exports, UNSAFE_logger_1, hooks_1, utils_1) {
|
|
2699
|
+
"use strict";
|
|
2700
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2701
|
+
exports.useDataProviderListeners = void 0;
|
|
2702
|
+
function cloneValue(value) {
|
|
2703
|
+
return value instanceof Set ? new Set(value.values()) : value;
|
|
2704
|
+
}
|
|
2705
|
+
function cloneValueItem(valueItem) {
|
|
2706
|
+
return valueItem instanceof Map ? new Map(valueItem.entries()) : Object.assign({}, valueItem);
|
|
2707
|
+
}
|
|
2708
|
+
function compareValues(value, valueToCompare) {
|
|
2709
|
+
if ((value instanceof Set && valueToCompare instanceof Set) ||
|
|
2710
|
+
(value instanceof Map && valueToCompare instanceof Map)) {
|
|
2711
|
+
return value.size === valueToCompare.size;
|
|
2712
|
+
}
|
|
2713
|
+
if (typeof value === 'object' && typeof valueToCompare === 'object') {
|
|
2714
|
+
return value.key === valueToCompare.key;
|
|
2715
|
+
}
|
|
2716
|
+
return value === valueToCompare;
|
|
2717
|
+
}
|
|
2718
|
+
function containsValue(value, query) {
|
|
2719
|
+
return value instanceof Set ? value.has(query) : value != null && value === query;
|
|
2720
|
+
}
|
|
2721
|
+
function deleteFromValue(value, toDelete) {
|
|
2722
|
+
if (value instanceof Set || value instanceof Map) {
|
|
2723
|
+
value.delete(toDelete);
|
|
2724
|
+
return value;
|
|
2725
|
+
}
|
|
2726
|
+
if (typeof value === 'number' || typeof value === 'string') {
|
|
2727
|
+
if (value === toDelete) {
|
|
2728
|
+
return utils_1.DEFAULT_VALUE;
|
|
2729
|
+
}
|
|
2730
|
+
return value;
|
|
2731
|
+
}
|
|
2732
|
+
if (typeof value === 'object' && value.key === toDelete) {
|
|
2733
|
+
return utils_1.DEFAULT_VALUE_ITEMS;
|
|
2734
|
+
}
|
|
2735
|
+
return value;
|
|
2736
|
+
}
|
|
2737
|
+
function useDataProviderListeners({ dataProvider, setValue, setValueToSync, setValueItemsToSync, value, valueItems }) {
|
|
2738
|
+
const isSelectMultiple = value instanceof Set;
|
|
2739
|
+
const handleRefresh = (0, hooks_1.useCallback)(() => {
|
|
2740
|
+
if (!(0, utils_1.isEmpty)(value)) {
|
|
2741
|
+
setValueToSync(cloneValue(value));
|
|
2742
|
+
setValueItemsToSync(utils_1.DEFAULT_VALUE_ITEMS);
|
|
2743
|
+
}
|
|
2744
|
+
}, [value]);
|
|
2745
|
+
const handleMutation = (0, hooks_1.useCallback)((event) => {
|
|
2746
|
+
if ((0, utils_1.isEmpty)(value)) {
|
|
2747
|
+
return;
|
|
2748
|
+
}
|
|
2749
|
+
let newVal = cloneValue(value);
|
|
2750
|
+
if (event.detail.remove != null) {
|
|
2751
|
+
const keys = event.detail.remove.keys;
|
|
2752
|
+
keys.forEach((key) => {
|
|
2753
|
+
if (containsValue(newVal, key)) {
|
|
2754
|
+
newVal = deleteFromValue(newVal, key);
|
|
2755
|
+
UNSAFE_logger_1.Logger.warn(`
|
|
2756
|
+
${isSelectMultiple ? 'SelectMultiple' : 'SelectSingle'}: selected value removed from data provider: ${key}`);
|
|
2757
|
+
}
|
|
2758
|
+
});
|
|
2759
|
+
if (compareValues(newVal, value)) {
|
|
2760
|
+
setValue(!(0, utils_1.isEmpty)(newVal) ? newVal : utils_1.DEFAULT_VALUE);
|
|
2761
|
+
setValueToSync(!(0, utils_1.isEmpty)(newVal) ? newVal : utils_1.DEFAULT_VALUE);
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
if ((0, utils_1.isEmpty)(newVal)) {
|
|
2765
|
+
return;
|
|
2766
|
+
}
|
|
2767
|
+
if (event.detail.update != null) {
|
|
2768
|
+
const keys = event.detail.update.keys;
|
|
2769
|
+
let newValueItems = (0, utils_1.isEmpty)(valueItems)
|
|
2770
|
+
? valueItems
|
|
2771
|
+
: cloneValueItem(valueItems);
|
|
2772
|
+
keys.forEach((key) => {
|
|
2773
|
+
if (containsValue(newVal, key)) {
|
|
2774
|
+
newValueItems = deleteFromValue(newValueItems, key);
|
|
2775
|
+
}
|
|
2776
|
+
});
|
|
2777
|
+
if (compareValues(newValueItems, valueItems)) {
|
|
2778
|
+
setValueToSync(newVal);
|
|
2779
|
+
setValueItemsToSync(!(0, utils_1.isEmpty)(newValueItems) ? newValueItems : utils_1.DEFAULT_VALUE_ITEMS);
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
}, [value, valueItems]);
|
|
2783
|
+
(0, hooks_1.useEffect)(() => {
|
|
2784
|
+
dataProvider === null || dataProvider === void 0 ? void 0 : dataProvider.addEventListener('refresh', handleRefresh);
|
|
2785
|
+
dataProvider === null || dataProvider === void 0 ? void 0 : dataProvider.addEventListener('mutate', handleMutation);
|
|
2786
|
+
return () => {
|
|
2787
|
+
dataProvider === null || dataProvider === void 0 ? void 0 : dataProvider.removeEventListener('refresh', handleRefresh);
|
|
2788
|
+
dataProvider === null || dataProvider === void 0 ? void 0 : dataProvider.removeEventListener('mutate', handleMutation);
|
|
2789
|
+
};
|
|
2790
|
+
}, [dataProvider, handleMutation, handleRefresh]);
|
|
2791
|
+
}
|
|
2792
|
+
exports.useDataProviderListeners = useDataProviderListeners;
|
|
2793
|
+
});
|
|
2794
|
+
|
|
2795
|
+
define('oj-c/select-common/UNSAFE_useWrapDataProvider/useWrapDataProvider',["require", "exports", "ojs/ojdataproviderfactory", "preact/hooks"], function (require, exports, ojdataproviderfactory_1, hooks_1) {
|
|
2796
|
+
"use strict";
|
|
2797
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2798
|
+
exports.useWrapDataProvider = void 0;
|
|
2799
|
+
function useWrapDataProvider(data) {
|
|
2800
|
+
const dataProvider = (0, hooks_1.useMemo)(() => {
|
|
2801
|
+
return data
|
|
2802
|
+
? (0, ojdataproviderfactory_1.getEnhancedDataProvider)(data, {
|
|
2803
|
+
fetchFirst: { caching: 'visitedByCurrentIterator' }
|
|
2804
|
+
})
|
|
2805
|
+
: data;
|
|
2806
|
+
}, [data]);
|
|
2807
|
+
return dataProvider;
|
|
2808
|
+
}
|
|
2809
|
+
exports.useWrapDataProvider = useWrapDataProvider;
|
|
2810
|
+
});
|
|
2811
|
+
|
|
2812
|
+
define('oj-c/select-common/UNSAFE_useWrapValueState/useWrapValueState',["require", "exports", "preact/hooks", "../utils/utils"], function (require, exports, hooks_1, utils_1) {
|
|
2813
|
+
"use strict";
|
|
2814
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2815
|
+
exports.useWrapValueState = void 0;
|
|
2816
|
+
function useWrapValueState({ arItemContexts, isLoading, preactValueItems, setPreactValueItems }) {
|
|
2817
|
+
const getValueForValidationFunc = (0, hooks_1.useCallback)((valueForValidation) => {
|
|
2818
|
+
return (valid) => {
|
|
2819
|
+
if (valid === 'invalidShown' && !isLoading) {
|
|
2820
|
+
return (0, utils_1.isEmpty)(preactValueItems) ? null : valueForValidation;
|
|
2821
|
+
}
|
|
2822
|
+
return valueForValidation;
|
|
2823
|
+
};
|
|
2824
|
+
}, [isLoading, preactValueItems]);
|
|
2825
|
+
const refreshDisplayValue = (0, hooks_1.useCallback)(() => {
|
|
2826
|
+
setPreactValueItems(arItemContexts);
|
|
2827
|
+
}, [arItemContexts]);
|
|
2828
|
+
const wrapValueState = (0, hooks_1.useCallback)((valueState) => {
|
|
2829
|
+
return Object.assign(Object.assign({}, valueState), { getValueForValidation: getValueForValidationFunc(valueState.value), refreshDisplayValue });
|
|
2830
|
+
}, [getValueForValidationFunc, refreshDisplayValue]);
|
|
2831
|
+
return { wrapValueState };
|
|
2832
|
+
}
|
|
2833
|
+
exports.useWrapValueState = useWrapValueState;
|
|
2834
|
+
});
|
|
2835
|
+
|
|
2836
|
+
define('oj-c/select-multiple/useSyncValueAndValueItems',["require", "exports", "@oracle/oraclejet-preact/utils/UNSAFE_logger", "oj-c/select-common/utils/utils", "preact/hooks"], function (require, exports, UNSAFE_logger_1, utils_1, hooks_1) {
|
|
2837
|
+
"use strict";
|
|
2838
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2839
|
+
exports.useSyncValueAndValueItems = void 0;
|
|
2840
|
+
function useSyncValueAndValueItems({ addBusyState, dataProvider, setIsLoading, setValue, setValueItems, value, valueItems }) {
|
|
2841
|
+
const prevValueRef = (0, hooks_1.useRef)(value);
|
|
2842
|
+
const prevValueItemsRef = (0, hooks_1.useRef)(valueItems);
|
|
2843
|
+
const hasValue = value && value instanceof Set && value.size > 0;
|
|
2844
|
+
const hasValueItems = valueItems && valueItems.size > 0;
|
|
2845
|
+
const latestFetchRef = (0, hooks_1.useRef)(null);
|
|
2846
|
+
const syncValueItemsToValue = (0, hooks_1.useCallback)(() => {
|
|
2847
|
+
if (!hasValue) {
|
|
2848
|
+
if (hasValueItems) {
|
|
2849
|
+
setValueItems(utils_1.DEFAULT_VALUE_ITEMS);
|
|
2850
|
+
}
|
|
2851
|
+
return;
|
|
2852
|
+
}
|
|
2853
|
+
const arValues = Array.from(value.keys());
|
|
2854
|
+
const valuesToFetch = arValues.reduce((accum, currKey) => {
|
|
2855
|
+
if (!hasValueItems || !valueItems.has(currKey)) {
|
|
2856
|
+
accum.push(currKey);
|
|
2857
|
+
}
|
|
2858
|
+
return accum;
|
|
2859
|
+
}, []);
|
|
2860
|
+
if (valuesToFetch.length === 0) {
|
|
2861
|
+
const newValItems = new Map();
|
|
2862
|
+
value.forEach((currKey) => {
|
|
2863
|
+
newValItems.set(currKey, valueItems.get(currKey));
|
|
2864
|
+
});
|
|
2865
|
+
setValueItems(newValItems);
|
|
2866
|
+
return;
|
|
2867
|
+
}
|
|
2868
|
+
setIsLoading(true);
|
|
2869
|
+
const resolveBusyState = addBusyState('useSyncValueItems: calling fetchByKeys');
|
|
2870
|
+
const latestFetch = {};
|
|
2871
|
+
latestFetchRef.current = latestFetch;
|
|
2872
|
+
dataProvider
|
|
2873
|
+
.fetchByKeys({ keys: new Set(valuesToFetch) })
|
|
2874
|
+
.then((fbkResults) => {
|
|
2875
|
+
if (latestFetch === latestFetchRef.current) {
|
|
2876
|
+
const newValueItems = handleFetchByKeysResults(value, valueItems, fbkResults.results);
|
|
2877
|
+
setValueItems(newValueItems);
|
|
2878
|
+
}
|
|
2879
|
+
})
|
|
2880
|
+
.catch((reason) => {
|
|
2881
|
+
if (latestFetch === latestFetchRef.current) {
|
|
2882
|
+
UNSAFE_logger_1.Logger.error(`SelectMultiple: fetchByKeys promise rejected: ${reason}`);
|
|
2883
|
+
}
|
|
2884
|
+
})
|
|
2885
|
+
.finally(() => {
|
|
2886
|
+
if (latestFetch === latestFetchRef.current) {
|
|
2887
|
+
setIsLoading(false);
|
|
2888
|
+
}
|
|
2889
|
+
resolveBusyState();
|
|
2890
|
+
});
|
|
2891
|
+
}, [dataProvider, hasValue, hasValueItems, value, valueItems]);
|
|
2892
|
+
const syncValueToValueItems = (0, hooks_1.useCallback)(() => {
|
|
2893
|
+
if (!hasValueItems) {
|
|
2894
|
+
if (hasValue) {
|
|
2895
|
+
setValue(utils_1.DEFAULT_VALUE);
|
|
2896
|
+
}
|
|
2897
|
+
return;
|
|
2898
|
+
}
|
|
2899
|
+
const arValueItemsKeys = Array.from(valueItems.keys());
|
|
2900
|
+
const valueItemsKeys = new Set(arValueItemsKeys);
|
|
2901
|
+
if (!value || !(value instanceof Set) || value.size !== valueItemsKeys.size) {
|
|
2902
|
+
setValue(valueItemsKeys);
|
|
2903
|
+
return;
|
|
2904
|
+
}
|
|
2905
|
+
const arValueKeys = Array.from(value.keys());
|
|
2906
|
+
const isDifferent = arValueItemsKeys.some((key, index) => key !== arValueKeys[index]);
|
|
2907
|
+
if (isDifferent) {
|
|
2908
|
+
setValue(valueItemsKeys);
|
|
2909
|
+
}
|
|
2910
|
+
}, [hasValue, hasValueItems, value, valueItems]);
|
|
2911
|
+
(0, hooks_1.useEffect)(() => {
|
|
2912
|
+
if (hasValue) {
|
|
2913
|
+
syncValueItemsToValue();
|
|
2914
|
+
}
|
|
2915
|
+
else if (hasValueItems) {
|
|
2916
|
+
syncValueToValueItems();
|
|
2917
|
+
}
|
|
2918
|
+
}, []);
|
|
2919
|
+
(0, hooks_1.useEffect)(() => {
|
|
2920
|
+
if (value !== prevValueRef.current && valueItems !== prevValueItemsRef.current) {
|
|
2921
|
+
prevValueRef.current = value;
|
|
2922
|
+
prevValueItemsRef.current = valueItems;
|
|
2923
|
+
if (value) {
|
|
2924
|
+
syncValueItemsToValue();
|
|
2925
|
+
}
|
|
2926
|
+
else {
|
|
2927
|
+
syncValueToValueItems();
|
|
2928
|
+
}
|
|
2929
|
+
}
|
|
2930
|
+
else if (value !== prevValueRef.current) {
|
|
2931
|
+
prevValueRef.current = value;
|
|
2932
|
+
syncValueItemsToValue();
|
|
2933
|
+
}
|
|
2934
|
+
else if (valueItems !== prevValueItemsRef.current) {
|
|
2935
|
+
prevValueItemsRef.current = valueItems;
|
|
2936
|
+
syncValueToValueItems();
|
|
2937
|
+
}
|
|
2938
|
+
}, [value, valueItems]);
|
|
2939
|
+
}
|
|
2940
|
+
exports.useSyncValueAndValueItems = useSyncValueAndValueItems;
|
|
2941
|
+
function handleFetchByKeysResults(value, valueItems, fetchByKeysResults) {
|
|
2942
|
+
const arKeys = Array.from(value.keys());
|
|
2943
|
+
return arKeys.reduce((accumMap, currKey) => {
|
|
2944
|
+
if (valueItems && valueItems.has(currKey)) {
|
|
2945
|
+
accumMap.set(currKey, valueItems.get(currKey));
|
|
2946
|
+
return accumMap;
|
|
2947
|
+
}
|
|
2948
|
+
const item = fetchByKeysResults.get(currKey);
|
|
2949
|
+
if (!item) {
|
|
2950
|
+
throw new Error(`oj-c-select-multiple: could not fetch data for key ${currKey}`);
|
|
2951
|
+
}
|
|
2952
|
+
accumMap.set(currKey, {
|
|
2953
|
+
key: currKey,
|
|
2954
|
+
data: item.data,
|
|
2955
|
+
metadata: item.metadata ? item.metadata : { currKey }
|
|
2956
|
+
});
|
|
2957
|
+
return accumMap;
|
|
2958
|
+
}, new Map());
|
|
2959
|
+
}
|
|
2960
|
+
});
|
|
2961
|
+
|
|
2962
|
+
define('oj-c/select-multiple/useValueItems',["require", "exports", "@oracle/oraclejet-preact/hooks/UNSAFE_useUncontrolledState", "preact/hooks"], function (require, exports, UNSAFE_useUncontrolledState_1, hooks_1) {
|
|
2963
|
+
"use strict";
|
|
2964
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2965
|
+
exports.useValueItems = void 0;
|
|
2966
|
+
function useValueItems(propValueItems, onValueItemsChanged) {
|
|
2967
|
+
const [valueItems, setValueItems] = (0, UNSAFE_useUncontrolledState_1.useUncontrolledState)(propValueItems, onValueItemsChanged);
|
|
2968
|
+
(0, hooks_1.useEffect)(() => {
|
|
2969
|
+
if (valueItems !== propValueItems) {
|
|
2970
|
+
setValueItems(propValueItems);
|
|
2971
|
+
}
|
|
2972
|
+
}, [propValueItems]);
|
|
2973
|
+
const preactValueItems = (0, hooks_1.useMemo)(() => {
|
|
2974
|
+
return valueItems ? Array.from(valueItems.values()) : undefined;
|
|
2975
|
+
}, [valueItems]);
|
|
2976
|
+
return {
|
|
2977
|
+
valueItems,
|
|
2978
|
+
setValueItems,
|
|
2979
|
+
preactValueItems
|
|
2980
|
+
};
|
|
2981
|
+
}
|
|
2982
|
+
exports.useValueItems = useValueItems;
|
|
2983
|
+
});
|
|
2984
|
+
|
|
2985
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2986
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2987
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2988
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2989
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2990
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2991
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2992
|
+
});
|
|
2993
|
+
};
|
|
2994
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2995
|
+
var t = {};
|
|
2996
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2997
|
+
t[p] = s[p];
|
|
2998
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2999
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3000
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3001
|
+
t[p[i]] = s[p[i]];
|
|
3002
|
+
}
|
|
3003
|
+
return t;
|
|
3004
|
+
};
|
|
3005
|
+
define('oj-c/select-multiple/useSelectMultiplePreact',["require", "exports", "oj-c/editable-value/UNSAFE_useEditableValue/useEditableValue", "oj-c/editable-value/UNSAFE_useValidators/useValidators", "oj-c/hooks/UNSAFE_useListData/useListData", "oj-c/select-common/UNSAFE_useDataProviderListeners/useDataProviderListeners", "oj-c/select-common/UNSAFE_useWrapDataProvider/useWrapDataProvider", "oj-c/select-common/UNSAFE_useWrapValueState/useWrapValueState", "oj-c/select-common/utils/utils", "ojs/ojdataprovider", "preact/hooks", "./useSyncValueAndValueItems", "./useValueItems"], function (require, exports, useEditableValue_1, useValidators_1, useListData_1, useDataProviderListeners_1, useWrapDataProvider_1, useWrapValueState_1, utils_1, ojdataprovider_1, hooks_1, useSyncValueAndValueItems_1, useValueItems_1) {
|
|
3006
|
+
"use strict";
|
|
3007
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3008
|
+
exports.useSelectMultiplePreact = void 0;
|
|
3009
|
+
function useSelectMultiplePreact(_a, addBusyState) {
|
|
3010
|
+
var { data: propData, disabled, displayOptions, itemText, labelEdge, labelHint, labelStartWidth, messagesCustom, placeholder, readonly, required, textAlign, userAssistanceDensity, value: propValue, valueItems: propValueItems, virtualKeyboard, onMessagesCustomChanged, onValidChanged, onValueChanged, onValueItemsChanged } = _a, otherProps = __rest(_a, ["data", "disabled", "displayOptions", "itemText", "labelEdge", "labelHint", "labelStartWidth", "messagesCustom", "placeholder", "readonly", "required", "textAlign", "userAssistanceDensity", "value", "valueItems", "virtualKeyboard", "onMessagesCustomChanged", "onValidChanged", "onValueChanged", "onValueItemsChanged"]);
|
|
3011
|
+
const [filterCriterion, setFilterCriterion] = (0, hooks_1.useState)(undefined);
|
|
3012
|
+
const [isLoading, setIsLoading] = (0, hooks_1.useState)(false);
|
|
3013
|
+
const { valueItems, setValueItems, preactValueItems: arItemContexts } = (0, useValueItems_1.useValueItems)(propValueItems, onValueItemsChanged);
|
|
3014
|
+
const [preactValueItems, setPreactValueItems] = (0, hooks_1.useState)(arItemContexts);
|
|
3015
|
+
(0, hooks_1.useEffect)(() => {
|
|
3016
|
+
setPreactValueItems(arItemContexts);
|
|
3017
|
+
}, [arItemContexts]);
|
|
3018
|
+
const { wrapValueState } = (0, useWrapValueState_1.useWrapValueState)({
|
|
3019
|
+
arItemContexts,
|
|
3020
|
+
isLoading,
|
|
3021
|
+
preactValueItems,
|
|
3022
|
+
setPreactValueItems
|
|
3023
|
+
});
|
|
3024
|
+
const { methods, onCommitValue, setValue, textFieldProps, value } = (0, useEditableValue_1.useEditableValue)({
|
|
3025
|
+
ariaDescribedBy: otherProps['aria-describedby'],
|
|
3026
|
+
displayOptions,
|
|
3027
|
+
messagesCustom,
|
|
3028
|
+
required,
|
|
3029
|
+
value: propValue,
|
|
3030
|
+
addBusyState,
|
|
3031
|
+
onMessagesCustomChanged,
|
|
3032
|
+
onValidChanged,
|
|
3033
|
+
onValueChanged,
|
|
3034
|
+
wrapValueState
|
|
3035
|
+
});
|
|
3036
|
+
const { ariaDescribedBy, messages } = textFieldProps;
|
|
3037
|
+
const hasNoValue = value === null || (value instanceof Set && value.size === 0);
|
|
3038
|
+
const dataProvider = (0, useWrapDataProvider_1.useWrapDataProvider)(propData);
|
|
3039
|
+
const [valueToSync, setValueToSync] = (0, hooks_1.useState)(value);
|
|
3040
|
+
const [valueItemsToSync, setValueItemsToSync] = (0, hooks_1.useState)(valueItems);
|
|
3041
|
+
(0, hooks_1.useEffect)(() => {
|
|
3042
|
+
setValueToSync(value);
|
|
3043
|
+
}, [value]);
|
|
3044
|
+
(0, hooks_1.useEffect)(() => {
|
|
3045
|
+
setValueItemsToSync(valueItems);
|
|
3046
|
+
}, [valueItems]);
|
|
3047
|
+
(0, useDataProviderListeners_1.useDataProviderListeners)({
|
|
3048
|
+
dataProvider,
|
|
3049
|
+
setValue: setValue,
|
|
3050
|
+
setValueToSync: setValueToSync,
|
|
3051
|
+
setValueItemsToSync,
|
|
3052
|
+
value: value,
|
|
3053
|
+
valueItems
|
|
3054
|
+
});
|
|
3055
|
+
(0, useSyncValueAndValueItems_1.useSyncValueAndValueItems)({
|
|
3056
|
+
addBusyState,
|
|
3057
|
+
dataProvider: dataProvider,
|
|
3058
|
+
setIsLoading,
|
|
3059
|
+
setValue: setValue,
|
|
3060
|
+
setValueItems,
|
|
3061
|
+
value: valueToSync,
|
|
3062
|
+
valueItems: valueItemsToSync
|
|
3063
|
+
});
|
|
3064
|
+
const [listDataState, onLoadRange] = (0, useListData_1.useListData)(dataProvider, {
|
|
3065
|
+
filterCriterion,
|
|
3066
|
+
initialRowsFetched: 0
|
|
3067
|
+
});
|
|
3068
|
+
const onCommit = (0, hooks_1.useCallback)((detail) => __awaiter(this, void 0, void 0, function* () {
|
|
3069
|
+
const validationResult = yield onCommitValue((detail.value && detail.value.size > 0 ? detail.value : utils_1.DEFAULT_VALUE));
|
|
3070
|
+
if (validationResult === useValidators_1.ValidationResult.INVALID) {
|
|
3071
|
+
setPreactValueItems(undefined);
|
|
3072
|
+
}
|
|
3073
|
+
}), [onCommitValue]);
|
|
3074
|
+
const onFilter = (0, hooks_1.useCallback)(({ searchText }) => {
|
|
3075
|
+
const fc = searchText && searchText.length > 0
|
|
3076
|
+
? ojdataprovider_1.FilterFactory.getFilter({ filterDef: { text: searchText } })
|
|
3077
|
+
: undefined;
|
|
3078
|
+
setFilterCriterion(fc);
|
|
3079
|
+
}, []);
|
|
3080
|
+
return {
|
|
3081
|
+
methods,
|
|
3082
|
+
selectMultipleProps: {
|
|
3083
|
+
ariaDescribedBy,
|
|
3084
|
+
data: listDataState.data,
|
|
3085
|
+
isDisabled: disabled,
|
|
3086
|
+
isLoading,
|
|
3087
|
+
isReadonly: readonly,
|
|
3088
|
+
isRequired: required,
|
|
3089
|
+
isRequiredShown: required && hasNoValue,
|
|
3090
|
+
itemText,
|
|
3091
|
+
label: labelHint,
|
|
3092
|
+
labelEdge,
|
|
3093
|
+
labelStartWidth,
|
|
3094
|
+
messages,
|
|
3095
|
+
onCommit,
|
|
3096
|
+
onFilter,
|
|
3097
|
+
onLoadRange,
|
|
3098
|
+
placeholder,
|
|
3099
|
+
textAlign,
|
|
3100
|
+
userAssistanceDensity,
|
|
3101
|
+
valueItems: preactValueItems,
|
|
3102
|
+
virtualKeyboard
|
|
3103
|
+
}
|
|
3104
|
+
};
|
|
3105
|
+
}
|
|
3106
|
+
exports.useSelectMultiplePreact = useSelectMultiplePreact;
|
|
3107
|
+
});
|
|
3108
|
+
|
|
3109
|
+
|
|
3110
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3111
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3112
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3113
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3114
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3115
|
+
};
|
|
3116
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3117
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3118
|
+
};
|
|
3119
|
+
define('oj-c/select-multiple/select-multiple',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/UNSAFE_SelectMultiple", "@oracle/oraclejet-preact/hooks/UNSAFE_useTabbableMode", "ojs/ojcontext", "ojs/ojvcomponent", "ojs/ojvcomponent-binding", "preact", "preact/compat", "preact/hooks", "oj-c/editable-value/UNSAFE_useAssistiveText/useAssistiveText", "./useSelectMultiplePreact", "@oracle/oraclejet-preact/hooks/UNSAFE_useFormContext", "@oracle/oraclejet-preact/hooks/UNSAFE_useFormVariantContext", "css!oj-c/select-multiple/select-multiple-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_SelectMultiple_1, UNSAFE_useTabbableMode_1, ojcontext_1, ojvcomponent_1, ojvcomponent_binding_1, preact_1, compat_1, hooks_1, useAssistiveText_1, useSelectMultiplePreact_1, UNSAFE_useFormContext_1, UNSAFE_useFormVariantContext_1) {
|
|
3120
|
+
"use strict";
|
|
3121
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3122
|
+
exports.SelectMultiple = void 0;
|
|
3123
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
3124
|
+
ojcontext_1 = __importDefault(ojcontext_1);
|
|
3125
|
+
const FunctionalSelectMultiple = (0, compat_1.forwardRef)((props, ref) => {
|
|
3126
|
+
const { busyContextRef, displayOptions, help, helpHints } = props;
|
|
3127
|
+
const selectMultipleRef = (0, hooks_1.useRef)();
|
|
3128
|
+
const addBusyState = (0, hooks_1.useCallback)((desc) => {
|
|
3129
|
+
var _a;
|
|
3130
|
+
return (_a = busyContextRef.current) === null || _a === void 0 ? void 0 : _a.addBusyState({
|
|
3131
|
+
description: `oj-c-select-multiple id=${props.id}: ${desc}`
|
|
3132
|
+
});
|
|
3133
|
+
}, []);
|
|
3134
|
+
const { selectMultipleProps, methods } = (0, useSelectMultiplePreact_1.useSelectMultiplePreact)(props, addBusyState);
|
|
3135
|
+
(0, hooks_1.useImperativeHandle)(ref, () => (Object.assign({ blur: () => { var _a; return (_a = selectMultipleRef.current) === null || _a === void 0 ? void 0 : _a.blur(); }, focus: () => { var _a; return (_a = selectMultipleRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } }, methods)), [methods]);
|
|
3136
|
+
const assistiveTextProps = (0, useAssistiveText_1.useAssistiveText)({
|
|
3137
|
+
displayOptions,
|
|
3138
|
+
help,
|
|
3139
|
+
helpHints
|
|
3140
|
+
});
|
|
3141
|
+
const variant = (0, UNSAFE_useFormVariantContext_1.useFormVariantContext)();
|
|
3142
|
+
return ((0, jsx_runtime_1.jsx)(UNSAFE_SelectMultiple_1.SelectMultiple, Object.assign({ ref: selectMultipleRef }, assistiveTextProps, selectMultipleProps, { variant: variant })));
|
|
3143
|
+
});
|
|
3144
|
+
let SelectMultiple = class SelectMultiple extends preact_1.Component {
|
|
3145
|
+
constructor() {
|
|
3146
|
+
super(...arguments);
|
|
3147
|
+
this.busyContextRef = (0, preact_1.createRef)();
|
|
3148
|
+
this.selectMultipleRef = (0, preact_1.createRef)();
|
|
3149
|
+
this.rootRef = (0, preact_1.createRef)();
|
|
3150
|
+
}
|
|
3151
|
+
componentDidMount() {
|
|
3152
|
+
this.busyContextRef.current = ojcontext_1.default.getContext(this.rootRef.current).getBusyContext();
|
|
3153
|
+
}
|
|
3154
|
+
render(props) {
|
|
3155
|
+
const containerProps = {
|
|
3156
|
+
isFormLayout: props.containerReadonly !== undefined,
|
|
3157
|
+
isReadonly: props.containerReadonly,
|
|
3158
|
+
labelWrapping: props.labelWrapping
|
|
3159
|
+
};
|
|
3160
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, Object.assign({ id: props.id, ref: this.rootRef }, { children: (0, jsx_runtime_1.jsx)(UNSAFE_useFormContext_1.FormContext.Provider, Object.assign({ value: containerProps }, { children: (0, jsx_runtime_1.jsx)(FunctionalSelectMultiple, Object.assign({ busyContextRef: this.busyContextRef, ref: this.selectMultipleRef }, props)) })) })));
|
|
3161
|
+
}
|
|
3162
|
+
componentWillUnmount() {
|
|
3163
|
+
this.busyContextRef.current = null;
|
|
3164
|
+
}
|
|
3165
|
+
reset() {
|
|
3166
|
+
var _a;
|
|
3167
|
+
(_a = this.selectMultipleRef.current) === null || _a === void 0 ? void 0 : _a.reset();
|
|
3168
|
+
}
|
|
3169
|
+
showMessages() {
|
|
3170
|
+
var _a;
|
|
3171
|
+
(_a = this.selectMultipleRef.current) === null || _a === void 0 ? void 0 : _a.showMessages();
|
|
3172
|
+
}
|
|
3173
|
+
validate() {
|
|
3174
|
+
var _a;
|
|
3175
|
+
return (_a = this.selectMultipleRef.current) === null || _a === void 0 ? void 0 : _a.validate();
|
|
3176
|
+
}
|
|
3177
|
+
blur() {
|
|
3178
|
+
var _a;
|
|
3179
|
+
(_a = this.selectMultipleRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
3180
|
+
}
|
|
3181
|
+
focus() {
|
|
3182
|
+
var _a;
|
|
3183
|
+
(_a = this.selectMultipleRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
3184
|
+
}
|
|
3185
|
+
};
|
|
3186
|
+
SelectMultiple.defaultProps = {
|
|
3187
|
+
data: null,
|
|
3188
|
+
disabled: false,
|
|
3189
|
+
displayOptions: {
|
|
3190
|
+
messages: 'display'
|
|
3191
|
+
},
|
|
3192
|
+
help: {
|
|
3193
|
+
instruction: ''
|
|
3194
|
+
},
|
|
3195
|
+
helpHints: {
|
|
3196
|
+
definition: '',
|
|
3197
|
+
source: '',
|
|
3198
|
+
sourceText: undefined
|
|
3199
|
+
},
|
|
3200
|
+
messagesCustom: [],
|
|
3201
|
+
readonly: false,
|
|
3202
|
+
required: false,
|
|
3203
|
+
userAssistanceDensity: 'reflow',
|
|
3204
|
+
value: null,
|
|
3205
|
+
valueItems: null,
|
|
3206
|
+
virtualKeyboard: 'auto'
|
|
3207
|
+
};
|
|
3208
|
+
SelectMultiple._metadata = { "properties": { "containerReadonly": { "type": "boolean", "binding": { "consume": { "name": "containerReadonly" } } }, "data": { "type": "object|null" }, "disabled": { "type": "boolean" }, "displayOptions": { "type": "object", "properties": { "messages": { "type": "string", "enumValues": ["display", "none"] } } }, "help": { "type": "object", "properties": { "instruction": { "type": "string" } } }, "helpHints": { "type": "object", "properties": { "definition": { "type": "string" }, "source": { "type": "string" }, "sourceText": { "type": "string" } } }, "itemText": { "type": "string|number|function" }, "labelEdge": { "type": "string", "enumValues": ["start", "none", "top", "inside"], "binding": { "consume": { "name": "containerLabelEdge" } } }, "labelHint": { "type": "string" }, "labelStartWidth": { "type": "string", "binding": { "consume": { "name": "labelWidth" } } }, "labelWrapping": { "type": "string", "enumValues": ["wrap", "truncate"], "binding": { "consume": { "name": "labelWrapping" } } }, "messagesCustom": { "type": "Array<object>", "writeback": true }, "placeholder": { "type": "string" }, "readonly": { "type": "boolean", "binding": { "consume": { "name": "containerReadonly" } } }, "required": { "type": "boolean" }, "requiredMessageDetail": { "type": "string" }, "textAlign": { "type": "string", "enumValues": ["start", "right", "end"] }, "userAssistanceDensity": { "type": "string", "enumValues": ["reflow", "efficient"], "binding": { "consume": { "name": "containerUserAssistanceDensity" } } }, "value": { "type": "object|null", "writeback": true }, "valueItems": { "type": "object|null", "writeback": true }, "virtualKeyboard": { "type": "string", "enumValues": ["number", "text", "auto", "search", "email", "tel", "url"] }, "valid": { "type": "string", "enumValues": ["valid", "pending", "invalidHidden", "invalidShown"], "readOnly": true, "writeback": true } }, "extension": { "_WRITEBACK_PROPS": ["messagesCustom", "valid", "value", "valueItems"], "_READ_ONLY_PROPS": ["valid"], "_OBSERVED_GLOBAL_PROPS": ["aria-describedby", "id"] }, "methods": { "reset": {}, "showMessages": {}, "validate": {}, "blur": {}, "focus": {} } };
|
|
3209
|
+
SelectMultiple._translationBundleMap = {
|
|
3210
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
3211
|
+
};
|
|
3212
|
+
SelectMultiple._consumedContexts = [UNSAFE_useFormVariantContext_1.FormVariantContext, UNSAFE_useTabbableMode_1.TabbableModeContext];
|
|
3213
|
+
SelectMultiple = __decorate([
|
|
3214
|
+
(0, ojvcomponent_1.customElement)('oj-c-select-multiple')
|
|
3215
|
+
], SelectMultiple);
|
|
3216
|
+
exports.SelectMultiple = SelectMultiple;
|
|
3217
|
+
});
|
|
3218
|
+
|
|
3219
|
+
define('oj-c/select-multiple',["require", "exports", "./select-multiple/select-multiple"], function (require, exports, select_multiple_1) {
|
|
3220
|
+
"use strict";
|
|
3221
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3222
|
+
exports.SelectMultiple = void 0;
|
|
3223
|
+
Object.defineProperty(exports, "SelectMultiple", { enumerable: true, get: function () { return select_multiple_1.SelectMultiple; } });
|
|
3224
|
+
});
|
|
3225
|
+
|
|
3226
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3227
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3228
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3229
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
3230
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
3231
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
3232
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3233
|
+
});
|
|
3234
|
+
};
|
|
3235
|
+
define('oj-c/select-single/useSyncValueAndValueItem',["require", "exports", "@oracle/oraclejet-preact/utils/UNSAFE_logger", "oj-c/editable-value/UNSAFE_useStaleIdentity/useStaleIdentity", "oj-c/select-common/utils/utils", "preact/hooks"], function (require, exports, UNSAFE_logger_1, useStaleIdentity_1, utils_1, hooks_1) {
|
|
3236
|
+
"use strict";
|
|
3237
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3238
|
+
exports.useSyncValueAndValueItem = void 0;
|
|
3239
|
+
function useSyncValueAndValueItem({ addBusyState, dataProvider, setIsLoading, setValue, setValueItem, value, valueItem }) {
|
|
3240
|
+
const prevValueRef = (0, hooks_1.useRef)(value);
|
|
3241
|
+
const prevValueItemsRef = (0, hooks_1.useRef)(valueItem);
|
|
3242
|
+
const { setStaleIdentity } = (0, useStaleIdentity_1.useStaleIdentity)();
|
|
3243
|
+
const hasValue = value != null;
|
|
3244
|
+
const hasValueItem = valueItem != null;
|
|
3245
|
+
const syncValueItemToValue = (0, hooks_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
|
|
3246
|
+
if (!hasValue) {
|
|
3247
|
+
if (hasValueItem) {
|
|
3248
|
+
setValueItem(utils_1.DEFAULT_VALUE_ITEM);
|
|
3249
|
+
}
|
|
3250
|
+
return;
|
|
3251
|
+
}
|
|
3252
|
+
if (value != null && valueItem != null && valueItem.key === value) {
|
|
3253
|
+
setValueItem(Object.assign({}, valueItem));
|
|
3254
|
+
return;
|
|
3255
|
+
}
|
|
3256
|
+
if (!dataProvider) {
|
|
3257
|
+
return;
|
|
3258
|
+
}
|
|
3259
|
+
setIsLoading(true);
|
|
3260
|
+
const resolveBusyState = addBusyState('useSyncValueItem: calling fetchByKeys');
|
|
3261
|
+
const { isStale } = setStaleIdentity('useSyncValueItem:fetchByKeys');
|
|
3262
|
+
try {
|
|
3263
|
+
const fetchResults = yield dataProvider.fetchByKeys({ keys: new Set([value]) });
|
|
3264
|
+
if (!isStale()) {
|
|
3265
|
+
const newValueItems = handleFetchByKeysResults(value, valueItem, fetchResults.results);
|
|
3266
|
+
setValueItem(newValueItems);
|
|
3267
|
+
}
|
|
3268
|
+
}
|
|
3269
|
+
catch (reason) {
|
|
3270
|
+
if (!isStale()) {
|
|
3271
|
+
UNSAFE_logger_1.Logger.error(`SelectMultiple: fetchByKeys promise rejected: ${reason}`);
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
3274
|
+
if (!isStale()) {
|
|
3275
|
+
setIsLoading(false);
|
|
3276
|
+
}
|
|
3277
|
+
resolveBusyState();
|
|
3278
|
+
}), [dataProvider, hasValue, hasValueItem, value, valueItem]);
|
|
3279
|
+
const syncValueToValueItem = (0, hooks_1.useCallback)(() => {
|
|
3280
|
+
if (!hasValueItem) {
|
|
3281
|
+
if (hasValue) {
|
|
3282
|
+
setValue(utils_1.DEFAULT_VALUE);
|
|
3283
|
+
}
|
|
3284
|
+
return;
|
|
3285
|
+
}
|
|
3286
|
+
if (valueItem.key !== value) {
|
|
3287
|
+
setValue(valueItem.key);
|
|
3288
|
+
return;
|
|
3289
|
+
}
|
|
3290
|
+
}, [hasValue, hasValueItem, value, valueItem]);
|
|
3291
|
+
(0, hooks_1.useEffect)(() => {
|
|
3292
|
+
if (hasValue) {
|
|
3293
|
+
syncValueItemToValue();
|
|
3294
|
+
}
|
|
3295
|
+
else if (hasValueItem) {
|
|
3296
|
+
syncValueToValueItem();
|
|
3297
|
+
}
|
|
3298
|
+
}, []);
|
|
3299
|
+
(0, hooks_1.useEffect)(() => {
|
|
3300
|
+
if (value !== prevValueRef.current && valueItem !== prevValueItemsRef.current) {
|
|
3301
|
+
prevValueRef.current = value;
|
|
3302
|
+
prevValueItemsRef.current = valueItem;
|
|
3303
|
+
if (value) {
|
|
3304
|
+
syncValueItemToValue();
|
|
3305
|
+
}
|
|
3306
|
+
else {
|
|
3307
|
+
syncValueToValueItem();
|
|
3308
|
+
}
|
|
3309
|
+
}
|
|
3310
|
+
else if (value !== prevValueRef.current) {
|
|
3311
|
+
prevValueRef.current = value;
|
|
3312
|
+
syncValueItemToValue();
|
|
3313
|
+
}
|
|
3314
|
+
else if (valueItem !== prevValueItemsRef.current) {
|
|
3315
|
+
prevValueItemsRef.current = valueItem;
|
|
3316
|
+
syncValueToValueItem();
|
|
3317
|
+
}
|
|
3318
|
+
}, [value, valueItem]);
|
|
3319
|
+
}
|
|
3320
|
+
exports.useSyncValueAndValueItem = useSyncValueAndValueItem;
|
|
3321
|
+
function handleFetchByKeysResults(value, valueItem, fetchByKeysResults) {
|
|
3322
|
+
if (valueItem && valueItem.key === value) {
|
|
3323
|
+
return valueItem;
|
|
3324
|
+
}
|
|
3325
|
+
const item = fetchByKeysResults.get(value);
|
|
3326
|
+
if (!item) {
|
|
3327
|
+
throw new Error(`oj-c-select-single: could not fetch data for key ${value}`);
|
|
3328
|
+
}
|
|
3329
|
+
return {
|
|
3330
|
+
key: value,
|
|
3331
|
+
data: item.data,
|
|
3332
|
+
metadata: item.metadata ? item.metadata : { key: value }
|
|
3333
|
+
};
|
|
3334
|
+
}
|
|
3335
|
+
});
|
|
3336
|
+
|
|
3337
|
+
define('oj-c/select-single/useValueItem',["require", "exports", "@oracle/oraclejet-preact/hooks/UNSAFE_useUncontrolledState", "preact/hooks"], function (require, exports, UNSAFE_useUncontrolledState_1, hooks_1) {
|
|
3338
|
+
"use strict";
|
|
3339
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3340
|
+
exports.useValueItem = void 0;
|
|
3341
|
+
function useValueItem(propValueItem, onValueItemsChanged) {
|
|
3342
|
+
const [valueItem, setValueItem] = (0, UNSAFE_useUncontrolledState_1.useUncontrolledState)(propValueItem, onValueItemsChanged);
|
|
3343
|
+
(0, hooks_1.useEffect)(() => {
|
|
3344
|
+
if (valueItem !== propValueItem) {
|
|
3345
|
+
setValueItem(propValueItem);
|
|
3346
|
+
}
|
|
3347
|
+
}, [propValueItem]);
|
|
3348
|
+
return {
|
|
3349
|
+
valueItem,
|
|
3350
|
+
setValueItem
|
|
3351
|
+
};
|
|
3352
|
+
}
|
|
3353
|
+
exports.useValueItem = useValueItem;
|
|
3354
|
+
});
|
|
3355
|
+
|
|
3356
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3357
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3358
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3359
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
3360
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
3361
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
3362
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3363
|
+
});
|
|
3364
|
+
};
|
|
3365
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3366
|
+
var t = {};
|
|
3367
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3368
|
+
t[p] = s[p];
|
|
3369
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3370
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3371
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3372
|
+
t[p[i]] = s[p[i]];
|
|
3373
|
+
}
|
|
3374
|
+
return t;
|
|
3375
|
+
};
|
|
3376
|
+
define('oj-c/select-single/useSelectSinglePreact',["require", "exports", "oj-c/editable-value/UNSAFE_useEditableValue/useEditableValue", "oj-c/editable-value/UNSAFE_useValidators/useValidators", "oj-c/editable-value/utils/utils", "oj-c/hooks/UNSAFE_useListData/useListData", "oj-c/select-common/UNSAFE_useDataProviderListeners/useDataProviderListeners", "oj-c/select-common/UNSAFE_useWrapDataProvider/useWrapDataProvider", "oj-c/select-common/UNSAFE_useWrapValueState/useWrapValueState", "oj-c/select-common/utils/utils", "ojs/ojdataprovider", "preact/hooks", "./useSyncValueAndValueItem", "./useValueItem"], function (require, exports, useEditableValue_1, useValidators_1, utils_1, useListData_1, useDataProviderListeners_1, useWrapDataProvider_1, useWrapValueState_1, utils_2, ojdataprovider_1, hooks_1, useSyncValueAndValueItem_1, useValueItem_1) {
|
|
3377
|
+
"use strict";
|
|
3378
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3379
|
+
exports.useSelectSinglePreact = void 0;
|
|
3380
|
+
function useSelectSinglePreact(_a, addBusyState) {
|
|
3381
|
+
var { data: propData, disabled, displayOptions, itemText, labelEdge, labelHint, labelStartWidth, messagesCustom, placeholder, readonly, required, textAlign, userAssistanceDensity, value: propValue, valueItem: propValueItem, virtualKeyboard, onMessagesCustomChanged, onOjValueAction, onValidChanged, onValueChanged, onValueItemChanged } = _a, otherProps = __rest(_a, ["data", "disabled", "displayOptions", "itemText", "labelEdge", "labelHint", "labelStartWidth", "messagesCustom", "placeholder", "readonly", "required", "textAlign", "userAssistanceDensity", "value", "valueItem", "virtualKeyboard", "onMessagesCustomChanged", "onOjValueAction", "onValidChanged", "onValueChanged", "onValueItemChanged"]);
|
|
3382
|
+
const [filterCriterion, setFilterCriterion] = (0, hooks_1.useState)(undefined);
|
|
3383
|
+
const [isLoading, setIsLoading] = (0, hooks_1.useState)(false);
|
|
3384
|
+
const { valueItem, setValueItem } = (0, useValueItem_1.useValueItem)(propValueItem, onValueItemChanged);
|
|
3385
|
+
const [preactValueItem, setPreactValueItem] = (0, hooks_1.useState)(valueItem);
|
|
3386
|
+
(0, hooks_1.useEffect)(() => {
|
|
3387
|
+
setPreactValueItem(valueItem);
|
|
3388
|
+
}, [valueItem]);
|
|
3389
|
+
const { wrapValueState } = (0, useWrapValueState_1.useWrapValueState)({
|
|
3390
|
+
arItemContexts: valueItem,
|
|
3391
|
+
isLoading,
|
|
3392
|
+
preactValueItems: preactValueItem,
|
|
3393
|
+
setPreactValueItems: setPreactValueItem
|
|
3394
|
+
});
|
|
3395
|
+
const { methods, onCommitValue, setValue, textFieldProps, value } = (0, useEditableValue_1.useEditableValue)({
|
|
3396
|
+
ariaDescribedBy: otherProps['aria-describedby'],
|
|
3397
|
+
displayOptions,
|
|
3398
|
+
messagesCustom,
|
|
3399
|
+
required,
|
|
3400
|
+
value: propValue,
|
|
3401
|
+
addBusyState,
|
|
3402
|
+
onMessagesCustomChanged,
|
|
3403
|
+
onValidChanged,
|
|
3404
|
+
onValueChanged,
|
|
3405
|
+
wrapValueState
|
|
3406
|
+
});
|
|
3407
|
+
const { ariaDescribedBy, messages } = textFieldProps;
|
|
3408
|
+
const hasNoValue = value === null;
|
|
3409
|
+
const dataProvider = (0, useWrapDataProvider_1.useWrapDataProvider)(propData);
|
|
3410
|
+
const [valueToSync, setValueToSync] = (0, hooks_1.useState)(value);
|
|
3411
|
+
const [valueItemToSync, setValueItemToSync] = (0, hooks_1.useState)(valueItem);
|
|
3412
|
+
(0, hooks_1.useEffect)(() => {
|
|
3413
|
+
setValueToSync(value);
|
|
3414
|
+
}, [value]);
|
|
3415
|
+
(0, hooks_1.useEffect)(() => {
|
|
3416
|
+
setValueItemToSync(valueItem);
|
|
3417
|
+
}, [valueItem]);
|
|
3418
|
+
(0, useDataProviderListeners_1.useDataProviderListeners)({
|
|
3419
|
+
dataProvider,
|
|
3420
|
+
setValue,
|
|
3421
|
+
setValueToSync,
|
|
3422
|
+
setValueItemsToSync: setValueItemToSync,
|
|
3423
|
+
value,
|
|
3424
|
+
valueItems: valueItem
|
|
3425
|
+
});
|
|
3426
|
+
(0, useSyncValueAndValueItem_1.useSyncValueAndValueItem)({
|
|
3427
|
+
addBusyState,
|
|
3428
|
+
dataProvider: dataProvider,
|
|
3429
|
+
setIsLoading,
|
|
3430
|
+
setValue,
|
|
3431
|
+
setValueItem,
|
|
3432
|
+
value: valueToSync,
|
|
3433
|
+
valueItem: valueItemToSync
|
|
3434
|
+
});
|
|
3435
|
+
const [listDataState, onLoadRange] = (0, useListData_1.useListData)(dataProvider, {
|
|
3436
|
+
filterCriterion,
|
|
3437
|
+
initialRowsFetched: 0
|
|
3438
|
+
});
|
|
3439
|
+
const onCommit = (0, hooks_1.useCallback)(({ previousValue, value }) => __awaiter(this, void 0, void 0, function* () {
|
|
3440
|
+
const validationResult = yield onCommitValue(value != null ? value : utils_2.DEFAULT_VALUE);
|
|
3441
|
+
if (validationResult === useValidators_1.ValidationResult.INVALID) {
|
|
3442
|
+
setPreactValueItem(undefined);
|
|
3443
|
+
}
|
|
3444
|
+
else if (validationResult === useValidators_1.ValidationResult.VALID && listDataState.status === 'success') {
|
|
3445
|
+
if (value == null) {
|
|
3446
|
+
onOjValueAction === null || onOjValueAction === void 0 ? void 0 : onOjValueAction({
|
|
3447
|
+
itemContext: utils_2.DEFAULT_ITEM_CONTEXT,
|
|
3448
|
+
previousValue: previousValue !== null && previousValue !== void 0 ? previousValue : utils_2.DEFAULT_VALUE,
|
|
3449
|
+
value: utils_2.DEFAULT_VALUE
|
|
3450
|
+
});
|
|
3451
|
+
}
|
|
3452
|
+
else if (value === (valueItem === null || valueItem === void 0 ? void 0 : valueItem.key)) {
|
|
3453
|
+
onOjValueAction === null || onOjValueAction === void 0 ? void 0 : onOjValueAction({
|
|
3454
|
+
itemContext: valueItem,
|
|
3455
|
+
previousValue: previousValue !== null && previousValue !== void 0 ? previousValue : utils_2.DEFAULT_VALUE,
|
|
3456
|
+
value
|
|
3457
|
+
});
|
|
3458
|
+
}
|
|
3459
|
+
else {
|
|
3460
|
+
const data = listDataState.data.data;
|
|
3461
|
+
let item = data.find((item) => item.metadata.key === value);
|
|
3462
|
+
if (item === undefined) {
|
|
3463
|
+
const fetchResults = yield dataProvider.fetchByKeys({ keys: new Set([value]) });
|
|
3464
|
+
item = fetchResults.results.get(value);
|
|
3465
|
+
}
|
|
3466
|
+
const itemContext = {
|
|
3467
|
+
data: item.data,
|
|
3468
|
+
key: item.metadata.key,
|
|
3469
|
+
metadata: item.metadata
|
|
3470
|
+
};
|
|
3471
|
+
onOjValueAction === null || onOjValueAction === void 0 ? void 0 : onOjValueAction({
|
|
3472
|
+
itemContext: itemContext,
|
|
3473
|
+
previousValue: previousValue !== null && previousValue !== void 0 ? previousValue : utils_2.DEFAULT_VALUE,
|
|
3474
|
+
value: value !== null && value !== void 0 ? value : utils_2.DEFAULT_VALUE
|
|
3475
|
+
});
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
}), [dataProvider, listDataState, valueItem, onCommitValue, onOjValueAction]);
|
|
3479
|
+
const onFilter = (0, hooks_1.useCallback)(({ searchText }) => {
|
|
3480
|
+
const fc = searchText && searchText.length > 0
|
|
3481
|
+
? ojdataprovider_1.FilterFactory.getFilter({ filterDef: { text: searchText } })
|
|
3482
|
+
: undefined;
|
|
3483
|
+
setFilterCriterion(fc);
|
|
3484
|
+
}, []);
|
|
3485
|
+
return {
|
|
3486
|
+
methods,
|
|
3487
|
+
selectSingleProps: {
|
|
3488
|
+
ariaDescribedBy,
|
|
3489
|
+
data: listDataState.data,
|
|
3490
|
+
isDisabled: disabled,
|
|
3491
|
+
isLoading,
|
|
3492
|
+
isReadonly: readonly,
|
|
3493
|
+
isRequired: required,
|
|
3494
|
+
isRequiredShown: required && hasNoValue,
|
|
3495
|
+
itemText,
|
|
3496
|
+
label: labelHint,
|
|
3497
|
+
labelEdge,
|
|
3498
|
+
labelStartWidth,
|
|
3499
|
+
messages,
|
|
3500
|
+
onCommit,
|
|
3501
|
+
onFilter,
|
|
3502
|
+
onLoadRange,
|
|
3503
|
+
placeholder,
|
|
3504
|
+
textAlign,
|
|
3505
|
+
userAssistanceDensity,
|
|
3506
|
+
valueItem: (0, utils_1.treatNull)(preactValueItem, undefined),
|
|
3507
|
+
virtualKeyboard
|
|
3508
|
+
}
|
|
3509
|
+
};
|
|
3510
|
+
}
|
|
3511
|
+
exports.useSelectSinglePreact = useSelectSinglePreact;
|
|
3512
|
+
});
|
|
3513
|
+
|
|
3514
|
+
|
|
3515
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3516
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3517
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3518
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3519
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3520
|
+
};
|
|
3521
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3522
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3523
|
+
};
|
|
3524
|
+
define('oj-c/select-single/select-single',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/hooks/UNSAFE_useFormContext", "@oracle/oraclejet-preact/hooks/UNSAFE_useFormVariantContext", "@oracle/oraclejet-preact/hooks/UNSAFE_useTabbableMode", "@oracle/oraclejet-preact/UNSAFE_SelectSingle", "oj-c/editable-value/UNSAFE_useAssistiveText/useAssistiveText", "ojs/ojcontext", "ojs/ojvcomponent", "ojs/ojvcomponent-binding", "preact", "preact/compat", "preact/hooks", "./useSelectSinglePreact", "css!./select-single-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_useFormContext_1, UNSAFE_useFormVariantContext_1, UNSAFE_useTabbableMode_1, UNSAFE_SelectSingle_1, useAssistiveText_1, ojcontext_1, ojvcomponent_1, ojvcomponent_binding_1, preact_1, compat_1, hooks_1, useSelectSinglePreact_1) {
|
|
3525
|
+
"use strict";
|
|
3526
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3527
|
+
exports.SelectSingle = void 0;
|
|
3528
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
3529
|
+
ojcontext_1 = __importDefault(ojcontext_1);
|
|
3530
|
+
const FunctionalSelectSingle = (0, compat_1.forwardRef)((props, ref) => {
|
|
3531
|
+
const { busyContextRef, displayOptions, help, helpHints } = props;
|
|
3532
|
+
const selectSingleRef = (0, hooks_1.useRef)();
|
|
3533
|
+
const addBusyState = (0, hooks_1.useCallback)((desc) => {
|
|
3534
|
+
var _a;
|
|
3535
|
+
return (_a = busyContextRef.current) === null || _a === void 0 ? void 0 : _a.addBusyState({
|
|
3536
|
+
description: `oj-c-select-single id=${props.id}: ${desc}`
|
|
3537
|
+
});
|
|
3538
|
+
}, []);
|
|
3539
|
+
const { selectSingleProps, methods } = (0, useSelectSinglePreact_1.useSelectSinglePreact)(props, addBusyState);
|
|
3540
|
+
(0, hooks_1.useImperativeHandle)(ref, () => (Object.assign({ blur: () => { var _a; return (_a = selectSingleRef.current) === null || _a === void 0 ? void 0 : _a.blur(); }, focus: () => { var _a; return (_a = selectSingleRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } }, methods)), [methods]);
|
|
3541
|
+
const assistiveTextProps = (0, useAssistiveText_1.useAssistiveText)({
|
|
3542
|
+
displayOptions,
|
|
3543
|
+
help,
|
|
3544
|
+
helpHints
|
|
3545
|
+
});
|
|
3546
|
+
const variant = (0, UNSAFE_useFormVariantContext_1.useFormVariantContext)();
|
|
3547
|
+
return ((0, jsx_runtime_1.jsx)(UNSAFE_SelectSingle_1.SelectSingle, Object.assign({ ref: selectSingleRef }, assistiveTextProps, selectSingleProps, { variant: variant })));
|
|
3548
|
+
});
|
|
3549
|
+
let SelectSingle = class SelectSingle extends preact_1.Component {
|
|
3550
|
+
constructor() {
|
|
3551
|
+
super(...arguments);
|
|
3552
|
+
this.busyContextRef = (0, preact_1.createRef)();
|
|
3553
|
+
this.selectSingleRef = (0, preact_1.createRef)();
|
|
3554
|
+
this.rootRef = (0, preact_1.createRef)();
|
|
3555
|
+
}
|
|
3556
|
+
componentDidMount() {
|
|
3557
|
+
this.busyContextRef.current = ojcontext_1.default.getContext(this.rootRef.current).getBusyContext();
|
|
3558
|
+
}
|
|
3559
|
+
render(props) {
|
|
3560
|
+
const containerProps = {
|
|
3561
|
+
isFormLayout: props.containerReadonly !== undefined,
|
|
3562
|
+
isReadonly: props.containerReadonly,
|
|
3563
|
+
labelWrapping: props.labelWrapping
|
|
3564
|
+
};
|
|
3565
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, Object.assign({ id: props.id, ref: this.rootRef }, { children: (0, jsx_runtime_1.jsx)(UNSAFE_useFormContext_1.FormContext.Provider, Object.assign({ value: containerProps }, { children: (0, jsx_runtime_1.jsx)(FunctionalSelectSingle, Object.assign({ busyContextRef: this.busyContextRef, ref: this.selectSingleRef }, props)) })) })));
|
|
3566
|
+
}
|
|
3567
|
+
componentWillUnmount() {
|
|
3568
|
+
this.busyContextRef.current = null;
|
|
3569
|
+
}
|
|
3570
|
+
reset() {
|
|
3571
|
+
var _a;
|
|
3572
|
+
(_a = this.selectSingleRef.current) === null || _a === void 0 ? void 0 : _a.reset();
|
|
3573
|
+
}
|
|
3574
|
+
showMessages() {
|
|
3575
|
+
var _a;
|
|
3576
|
+
(_a = this.selectSingleRef.current) === null || _a === void 0 ? void 0 : _a.showMessages();
|
|
3577
|
+
}
|
|
3578
|
+
validate() {
|
|
3579
|
+
var _a;
|
|
3580
|
+
return (_a = this.selectSingleRef.current) === null || _a === void 0 ? void 0 : _a.validate();
|
|
3581
|
+
}
|
|
3582
|
+
blur() {
|
|
3583
|
+
var _a;
|
|
3584
|
+
(_a = this.selectSingleRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
3585
|
+
}
|
|
3586
|
+
focus() {
|
|
3587
|
+
var _a;
|
|
3588
|
+
(_a = this.selectSingleRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
3589
|
+
}
|
|
3590
|
+
};
|
|
3591
|
+
SelectSingle.defaultProps = {
|
|
3592
|
+
data: null,
|
|
3593
|
+
disabled: false,
|
|
3594
|
+
displayOptions: {
|
|
3595
|
+
messages: 'display'
|
|
3596
|
+
},
|
|
3597
|
+
help: {
|
|
3598
|
+
instruction: ''
|
|
3599
|
+
},
|
|
3600
|
+
helpHints: {
|
|
3601
|
+
definition: '',
|
|
3602
|
+
source: '',
|
|
3603
|
+
sourceText: undefined
|
|
3604
|
+
},
|
|
3605
|
+
messagesCustom: [],
|
|
3606
|
+
readonly: false,
|
|
3607
|
+
required: false,
|
|
3608
|
+
userAssistanceDensity: 'reflow',
|
|
3609
|
+
value: null,
|
|
3610
|
+
valueItem: null,
|
|
3611
|
+
virtualKeyboard: 'auto'
|
|
3612
|
+
};
|
|
3613
|
+
SelectSingle._metadata = { "properties": { "containerReadonly": { "type": "boolean", "binding": { "consume": { "name": "containerReadonly" } } }, "data": { "type": "object|null" }, "disabled": { "type": "boolean" }, "displayOptions": { "type": "object", "properties": { "messages": { "type": "string", "enumValues": ["display", "none"] } } }, "help": { "type": "object", "properties": { "instruction": { "type": "string" } } }, "helpHints": { "type": "object", "properties": { "definition": { "type": "string" }, "source": { "type": "string" }, "sourceText": { "type": "string" } } }, "itemText": { "type": "string|number|function" }, "labelEdge": { "type": "string", "enumValues": ["start", "none", "top", "inside"], "binding": { "consume": { "name": "containerLabelEdge" } } }, "labelHint": { "type": "string" }, "labelStartWidth": { "type": "string", "binding": { "consume": { "name": "labelWidth" } } }, "labelWrapping": { "type": "string", "enumValues": ["wrap", "truncate"], "binding": { "consume": { "name": "labelWrapping" } } }, "messagesCustom": { "type": "Array<object>", "writeback": true }, "placeholder": { "type": "string" }, "readonly": { "type": "boolean", "binding": { "consume": { "name": "containerReadonly" } } }, "required": { "type": "boolean" }, "requiredMessageDetail": { "type": "string" }, "textAlign": { "type": "string", "enumValues": ["start", "right", "end"] }, "userAssistanceDensity": { "type": "string", "enumValues": ["reflow", "efficient"], "binding": { "consume": { "name": "containerUserAssistanceDensity" } } }, "value": { "type": "any", "writeback": true }, "valueItem": { "type": "object|null", "properties": { "data": { "type": "any" }, "key": { "type": "any" }, "metadata": { "type": "object", "properties": { "indexFromParent": { "type": "number" }, "isLeaf": { "type": "boolean" }, "key": { "type": "any" }, "message": { "type": "object", "properties": { "detail": { "type": "string" }, "severity": { "type": "number|string", "enumValues": ["error", "confirmation", "info", "warning", "fatal"] }, "summary": { "type": "string" } } }, "parentKey": { "type": "any" }, "suggestion": { "type": "object" }, "treeDepth": { "type": "number" } } } }, "writeback": true }, "virtualKeyboard": { "type": "string", "enumValues": ["number", "text", "auto", "search", "email", "tel", "url"] }, "valid": { "type": "string", "enumValues": ["valid", "pending", "invalidHidden", "invalidShown"], "readOnly": true, "writeback": true } }, "events": { "ojValueAction": {} }, "extension": { "_WRITEBACK_PROPS": ["messagesCustom", "valid", "value", "valueItem"], "_READ_ONLY_PROPS": ["valid"], "_OBSERVED_GLOBAL_PROPS": ["aria-describedby", "id"] }, "methods": { "reset": {}, "showMessages": {}, "validate": {}, "blur": {}, "focus": {} } };
|
|
3614
|
+
SelectSingle._translationBundleMap = {
|
|
3615
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
3616
|
+
};
|
|
3617
|
+
SelectSingle._consumedContexts = [UNSAFE_useFormVariantContext_1.FormVariantContext, UNSAFE_useTabbableMode_1.TabbableModeContext];
|
|
3618
|
+
SelectSingle = __decorate([
|
|
3619
|
+
(0, ojvcomponent_1.customElement)('oj-c-select-single')
|
|
3620
|
+
], SelectSingle);
|
|
3621
|
+
exports.SelectSingle = SelectSingle;
|
|
3622
|
+
});
|
|
3623
|
+
|
|
3624
|
+
define('oj-c/select-single',["require", "exports", "./select-single/select-single"], function (require, exports, select_single_1) {
|
|
3625
|
+
"use strict";
|
|
3626
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3627
|
+
exports.SelectSingle = void 0;
|
|
3628
|
+
Object.defineProperty(exports, "SelectSingle", { enumerable: true, get: function () { return select_single_1.SelectSingle; } });
|
|
3629
|
+
});
|
|
3630
|
+
|
|
3631
|
+
|
|
3632
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3633
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3634
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3635
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
3636
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
3637
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
3638
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3639
|
+
});
|
|
3640
|
+
};
|
|
3641
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3642
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3643
|
+
};
|
|
3644
|
+
define('oj-c/collapsible/collapsible',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/UNSAFE_Collapsible", "ojs/ojvcomponent", "preact/hooks", "ojs/ojcontext", "css!oj-c/collapsible/collapsible-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_Collapsible_1, ojvcomponent_1, hooks_1, ojcontext_1) {
|
|
3645
|
+
"use strict";
|
|
3646
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3647
|
+
exports.Collapsible = void 0;
|
|
3648
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
3649
|
+
ojcontext_1 = __importDefault(ojcontext_1);
|
|
3650
|
+
exports.Collapsible = (0, ojvcomponent_1.registerCustomElement)('oj-c-collapsible', (props) => {
|
|
3651
|
+
const { id, children, disabled, expanded, iconPosition, variant, header } = props;
|
|
3652
|
+
const rootRef = (0, hooks_1.useRef)(null);
|
|
3653
|
+
const didMountRef = (0, hooks_1.useRef)(false);
|
|
3654
|
+
const resolveBusyState = (0, hooks_1.useRef)();
|
|
3655
|
+
const addBusyState = (0, hooks_1.useCallback)((desc) => {
|
|
3656
|
+
var _a;
|
|
3657
|
+
return (_a = ojcontext_1.default.getContext(rootRef.current)
|
|
3658
|
+
.getBusyContext()) === null || _a === void 0 ? void 0 : _a.addBusyState({
|
|
3659
|
+
description: `oj-c-collapsible: id='${id}' is ${desc}.`
|
|
3660
|
+
});
|
|
3661
|
+
}, []);
|
|
3662
|
+
(0, hooks_1.useEffect)(() => {
|
|
3663
|
+
if (!didMountRef.current) {
|
|
3664
|
+
didMountRef.current = true;
|
|
3665
|
+
return;
|
|
3666
|
+
}
|
|
3667
|
+
if (resolveBusyState.current) {
|
|
3668
|
+
resolveBusyState.current();
|
|
3669
|
+
}
|
|
3670
|
+
resolveBusyState.current = addBusyState('animating');
|
|
3671
|
+
}, [expanded]);
|
|
3672
|
+
const toggleHandler = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3673
|
+
var _a;
|
|
3674
|
+
let target = event.target;
|
|
3675
|
+
for (; target && target !== (rootRef === null || rootRef === void 0 ? void 0 : rootRef.current); target = target.parentElement) {
|
|
3676
|
+
if (target.getAttribute('data-oj-clickthrough') === 'disabled') {
|
|
3677
|
+
return;
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3680
|
+
const beforeProp = event.value ? props.onOjBeforeExpand : props.onOjBeforeCollapse;
|
|
3681
|
+
try {
|
|
3682
|
+
yield (beforeProp === null || beforeProp === void 0 ? void 0 : beforeProp(event));
|
|
3683
|
+
(_a = props.onExpandedChanged) === null || _a === void 0 ? void 0 : _a.call(props, event.value);
|
|
3684
|
+
}
|
|
3685
|
+
catch (_) {
|
|
3686
|
+
}
|
|
3687
|
+
});
|
|
3688
|
+
const transitionEndHandler = (event) => {
|
|
3689
|
+
const expandedProp = event.value ? props.onOjExpand : props.onOjCollapse;
|
|
3690
|
+
expandedProp === null || expandedProp === void 0 ? void 0 : expandedProp(event);
|
|
3691
|
+
if (resolveBusyState.current) {
|
|
3692
|
+
resolveBusyState.current();
|
|
3693
|
+
resolveBusyState.current = undefined;
|
|
3694
|
+
}
|
|
3695
|
+
};
|
|
3696
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, Object.assign({ id: id, ref: rootRef }, { children: (0, jsx_runtime_1.jsx)(UNSAFE_Collapsible_1.Collapsible, Object.assign({ header: header, iconPosition: iconPosition, variant: variant, isExpanded: expanded, isDisabled: disabled, onToggle: toggleHandler, onTransitionEnd: transitionEndHandler }, { children: children })) })));
|
|
3697
|
+
}, "Collapsible", { "slots": { "": {}, "header": {} }, "properties": { "disabled": { "type": "boolean" }, "expanded": { "type": "boolean", "writeback": true }, "iconPosition": { "type": "string", "enumValues": ["start", "end"] }, "variant": { "type": "string", "enumValues": ["basic", "horizontal-rule"] } }, "events": { "ojBeforeCollapse": { "cancelable": true }, "ojBeforeExpand": { "cancelable": true }, "ojCollapse": {}, "ojExpand": {} }, "extension": { "_WRITEBACK_PROPS": ["expanded"], "_READ_ONLY_PROPS": [], "_OBSERVED_GLOBAL_PROPS": ["id"] } }, undefined, {
|
|
3698
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
3699
|
+
});
|
|
3700
|
+
});
|
|
3701
|
+
|
|
3702
|
+
define('oj-c/collapsible',["require", "exports", "./collapsible/collapsible"], function (require, exports, collapsible_1) {
|
|
3703
|
+
"use strict";
|
|
3704
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3705
|
+
exports.Collapsible = void 0;
|
|
3706
|
+
Object.defineProperty(exports, "Collapsible", { enumerable: true, get: function () { return collapsible_1.Collapsible; } });
|
|
3707
|
+
});
|
|
3708
|
+
|
|
3709
|
+
define('oj-c/utils/UNSAFE_focusTabUtils/focusUtils',["require", "exports"], function (require, exports) {
|
|
3710
|
+
"use strict";
|
|
3711
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3712
|
+
exports.getFirstTabStop = exports.focusFirstTabStop = void 0;
|
|
3713
|
+
const focusFirstTabStop = (element) => {
|
|
3714
|
+
if (!element)
|
|
3715
|
+
return;
|
|
3716
|
+
const focusElement = (0, exports.getFirstTabStop)(element);
|
|
3717
|
+
if (focusElement) {
|
|
3718
|
+
focusElement.focus();
|
|
3719
|
+
}
|
|
3720
|
+
return focusElement;
|
|
3721
|
+
};
|
|
3722
|
+
exports.focusFirstTabStop = focusFirstTabStop;
|
|
3723
|
+
const getFirstTabStop = (element) => {
|
|
3724
|
+
const tabbable = element.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
3725
|
+
if (tabbable && tabbable.length > 0) {
|
|
3726
|
+
return tabbable[0];
|
|
3727
|
+
}
|
|
3728
|
+
return null;
|
|
3729
|
+
};
|
|
3730
|
+
exports.getFirstTabStop = getFirstTabStop;
|
|
3731
|
+
});
|
|
3732
|
+
|
|
3733
|
+
|
|
3734
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3735
|
+
var t = {};
|
|
3736
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3737
|
+
t[p] = s[p];
|
|
3738
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3739
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3740
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3741
|
+
t[p[i]] = s[p[i]];
|
|
3742
|
+
}
|
|
3743
|
+
return t;
|
|
3744
|
+
};
|
|
3745
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3746
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3747
|
+
};
|
|
3748
|
+
define('oj-c/file-picker/file-picker',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/UNSAFE_FilePicker", "preact/hooks", "preact/compat", "ojs/ojvcomponent", "@oracle/oraclejet-preact/hooks/UNSAFE_useTabbableMode", "../utils/UNSAFE_focusTabUtils/focusUtils", "css!oj-c/file-picker/file-picker-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_FilePicker_1, hooks_1, compat_1, ojvcomponent_1, UNSAFE_useTabbableMode_1, focusUtils_1) {
|
|
3749
|
+
"use strict";
|
|
3750
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3751
|
+
exports.FilePicker = void 0;
|
|
3752
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
3753
|
+
const getPrimaryText = (primaryText) => {
|
|
3754
|
+
if (typeof primaryText === 'function') {
|
|
3755
|
+
return primaryText();
|
|
3756
|
+
}
|
|
3757
|
+
return primaryText;
|
|
3758
|
+
};
|
|
3759
|
+
const getSecondaryText = (secondaryText, selectionMode) => {
|
|
3760
|
+
if (typeof secondaryText === 'function') {
|
|
3761
|
+
return secondaryText({ selectionMode: selectionMode });
|
|
3762
|
+
}
|
|
3763
|
+
return secondaryText;
|
|
3764
|
+
};
|
|
3765
|
+
exports.FilePicker = (0, ojvcomponent_1.registerCustomElement)('oj-c-file-picker', (0, compat_1.forwardRef)((_a, ref) => {
|
|
3766
|
+
var { capture = 'none', disabled = false, selectionMode = 'multiple' } = _a, otherProps = __rest(_a, ["capture", "disabled", "selectionMode"]);
|
|
3767
|
+
const onCommit = (0, hooks_1.useCallback)((event) => {
|
|
3768
|
+
var _a;
|
|
3769
|
+
(_a = otherProps.onOjBeforeSelect) === null || _a === void 0 ? void 0 : _a.call(otherProps, { files: event.files }).then(() => {
|
|
3770
|
+
var _a;
|
|
3771
|
+
(_a = otherProps.onOjSelect) === null || _a === void 0 ? void 0 : _a.call(otherProps, { files: event.files });
|
|
3772
|
+
}, (messages) => {
|
|
3773
|
+
var _a;
|
|
3774
|
+
(_a = otherProps.onOjInvalidSelect) === null || _a === void 0 ? void 0 : _a.call(otherProps, { messages: messages, until: null });
|
|
3775
|
+
});
|
|
3776
|
+
}, [otherProps.onOjBeforeSelect, otherProps.onOjSelect, otherProps.onOjInvalidSelect]);
|
|
3777
|
+
(0, hooks_1.useImperativeHandle)(ref, () => ({
|
|
3778
|
+
focus: () => (0, focusUtils_1.focusFirstTabStop)(rootRef.current),
|
|
3779
|
+
blur: () => {
|
|
3780
|
+
var _a;
|
|
3781
|
+
const focusElement = document.activeElement;
|
|
3782
|
+
if ((_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.contains(focusElement)) {
|
|
3783
|
+
focusElement.blur();
|
|
3784
|
+
}
|
|
3785
|
+
}
|
|
3786
|
+
}));
|
|
3787
|
+
const rootRef = (0, hooks_1.useRef)(null);
|
|
3788
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, Object.assign({ ref: rootRef, class: otherProps.trigger ? 'oj-c-file-picker-with-trigger' : undefined }, { children: (0, jsx_runtime_1.jsx)(UNSAFE_FilePicker_1.FilePicker, Object.assign({ capture: capture, isDisabled: disabled, selectionMode: selectionMode, onCommit: onCommit, onReject: otherProps.onOjInvalidSelect, accept: otherProps.accept, primaryText: getPrimaryText(otherProps.primaryText), secondaryText: getSecondaryText(otherProps.secondaryText, selectionMode), accessibleLabel: otherProps['aria-label'], width: "100%" }, { children: otherProps.trigger })) })));
|
|
3789
|
+
}), "FilePicker", { "properties": { "accept": { "type": "Array<string>" }, "capture": { "type": "string", "enumValues": ["none", "user", "environment", "implementation"] }, "disabled": { "type": "boolean" }, "primaryText": { "type": "string|function" }, "secondaryText": { "type": "string|function" }, "selectionMode": { "type": "string", "enumValues": ["multiple", "single"] } }, "slots": { "trigger": {} }, "events": { "ojBeforeSelect": { "cancelable": true }, "ojInvalidSelect": {}, "ojSelect": {} }, "extension": { "_OBSERVED_GLOBAL_PROPS": ["aria-label"] }, "methods": { "focus": {}, "blur": {} } }, { "capture": "none", "disabled": false, "selectionMode": "multiple" }, {
|
|
3790
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
3791
|
+
}, { consume: [UNSAFE_useTabbableMode_1.TabbableModeContext] });
|
|
3792
|
+
});
|
|
3793
|
+
|
|
3794
|
+
define('oj-c/file-picker',["require", "exports", "./file-picker/file-picker"], function (require, exports, file_picker_1) {
|
|
3795
|
+
"use strict";
|
|
3796
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3797
|
+
exports.FilePicker = void 0;
|
|
3798
|
+
Object.defineProperty(exports, "FilePicker", { enumerable: true, get: function () { return file_picker_1.FilePicker; } });
|
|
3799
|
+
});
|
|
3800
|
+
|
|
3801
|
+
define('oj-c/utils/UNSAFE_meterUtils/meterUtils',["require", "exports"], function (require, exports) {
|
|
3802
|
+
"use strict";
|
|
3803
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3804
|
+
exports.getThresholdColorByIndex = void 0;
|
|
3805
|
+
const THRESHOLD_COLORS = ['#D63B25', '#CF7C00', '#508223'];
|
|
3806
|
+
const getThresholdColorByIndex = (threshold, index) => {
|
|
3807
|
+
if (threshold.color)
|
|
3808
|
+
return threshold.color;
|
|
3809
|
+
return THRESHOLD_COLORS[index % THRESHOLD_COLORS.length];
|
|
3810
|
+
};
|
|
3811
|
+
exports.getThresholdColorByIndex = getThresholdColorByIndex;
|
|
3812
|
+
});
|
|
3813
|
+
|
|
3814
|
+
|
|
3815
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3816
|
+
var t = {};
|
|
3817
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3818
|
+
t[p] = s[p];
|
|
3819
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3820
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3821
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3822
|
+
t[p[i]] = s[p[i]];
|
|
3823
|
+
}
|
|
3824
|
+
return t;
|
|
3825
|
+
};
|
|
3826
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3827
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3828
|
+
};
|
|
3829
|
+
define('oj-c/meter-bar/meter-bar',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/UNSAFE_MeterBar", "ojs/ojvcomponent", "preact/hooks", "@oracle/oraclejet-preact/hooks/UNSAFE_useTabbableMode", "../utils/UNSAFE_meterUtils/meterUtils", "css!oj-c/meter-bar/meter-bar-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_MeterBar_1, ojvcomponent_1, hooks_1, UNSAFE_useTabbableMode_1, meterUtils_1) {
|
|
3830
|
+
"use strict";
|
|
3831
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3832
|
+
exports.MeterBar = void 0;
|
|
3833
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
3834
|
+
exports.MeterBar = (0, ojvcomponent_1.registerCustomElement)('oj-c-meter-bar', (_a) => {
|
|
3835
|
+
var _b, _c, _d, _e, _f;
|
|
3836
|
+
var { max = 100, value = 0, min = 0, size = 'md', orientation = 'horizontal', step = 1, indicatorSize = 1, readonly = false, thresholdDisplay = 'indicator' } = _a, props = __rest(_a, ["max", "value", "min", "size", "orientation", "step", "indicatorSize", "readonly", "thresholdDisplay"]);
|
|
3837
|
+
const [hoveredVal, setHoveredVal] = (0, hooks_1.useState)();
|
|
3838
|
+
const inputHandler = (detail) => {
|
|
3839
|
+
var _a;
|
|
3840
|
+
setHoveredVal(detail.value);
|
|
3841
|
+
(_a = props.onTransientValueChanged) === null || _a === void 0 ? void 0 : _a.call(props, detail.value);
|
|
3842
|
+
};
|
|
3843
|
+
const commitHandler = (detail) => {
|
|
3844
|
+
var _a;
|
|
3845
|
+
(_a = props.onValueChanged) === null || _a === void 0 ? void 0 : _a.call(props, detail.value);
|
|
3846
|
+
};
|
|
3847
|
+
const thresholds = (_b = props.thresholds) === null || _b === void 0 ? void 0 : _b.map((threshold, index) => {
|
|
3848
|
+
return Object.assign(Object.assign({}, threshold), { color: (0, meterUtils_1.getThresholdColorByIndex)(threshold, index) });
|
|
3849
|
+
});
|
|
3850
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, Object.assign({ class: `oj-c-meter-bar-${orientation}` }, { children: (0, jsx_runtime_1.jsx)(UNSAFE_MeterBar_1.MeterBar, { value: (hoveredVal != undefined ? hoveredVal : value), step: step, max: max, min: min, size: size, orientation: orientation, indicatorSize: indicatorSize, datatip: props.datatip
|
|
3851
|
+
? props.datatip({
|
|
3852
|
+
value: hoveredVal != undefined ? hoveredVal : value
|
|
3853
|
+
})
|
|
3854
|
+
: props.datatip, onCommit: readonly ? undefined : commitHandler, onInput: readonly ? undefined : inputHandler, length: '100%', thresholds: thresholds, referenceLines: props.referenceLines, thresholdDisplay: thresholdDisplay === 'plotArea' ? 'track' : thresholdDisplay, indicatorColor: props.color, trackColor: (_c = props.plotArea) === null || _c === void 0 ? void 0 : _c.color, isTrackRendered: ((_d = props.plotArea) === null || _d === void 0 ? void 0 : _d.rendered) !== 'off', accessibleLabel: props['aria-label'], ariaLabelledBy: (_e = props.labelledBy) !== null && _e !== void 0 ? _e : undefined, ariaDescribedBy: (_f = props.describedBy) !== null && _f !== void 0 ? _f : undefined }) })));
|
|
3855
|
+
}, "MeterBar", { "properties": { "max": { "type": "number" }, "min": { "type": "number" }, "readonly": { "type": "boolean" }, "value": { "type": "number|null", "writeback": true }, "step": { "type": "number" }, "color": { "type": "string" }, "indicatorSize": { "type": "number" }, "plotArea": { "type": "object", "properties": { "color": { "type": "string" }, "rendered": { "type": "string", "enumValues": ["on", "off"] } } }, "orientation": { "type": "string", "enumValues": ["vertical", "horizontal"] }, "referenceLines": { "type": "Array<object>" }, "thresholdDisplay": { "type": "string", "enumValues": ["all", "plotArea", "indicator"] }, "thresholds": { "type": "Array<object>" }, "describedBy": { "type": "string|null" }, "labelledBy": { "type": "string|null" }, "size": { "type": "string", "enumValues": ["sm", "md", "lg"] }, "datatip": { "type": "function" }, "transientValue": { "type": "number", "readOnly": true, "writeback": true } }, "extension": { "_WRITEBACK_PROPS": ["value", "transientValue"], "_READ_ONLY_PROPS": ["transientValue"], "_OBSERVED_GLOBAL_PROPS": ["aria-label"] } }, { "max": 100, "value": 0, "min": 0, "size": "md", "orientation": "horizontal", "step": 1, "indicatorSize": 1, "readonly": false, "thresholdDisplay": "indicator" }, {
|
|
3856
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
3857
|
+
}, { consume: [UNSAFE_useTabbableMode_1.TabbableModeContext] });
|
|
3858
|
+
});
|
|
3859
|
+
|
|
3860
|
+
define('oj-c/meter-bar',["require", "exports", "./meter-bar/meter-bar"], function (require, exports, meter_bar_1) {
|
|
3861
|
+
"use strict";
|
|
3862
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3863
|
+
exports.MeterBar = void 0;
|
|
3864
|
+
Object.defineProperty(exports, "MeterBar", { enumerable: true, get: function () { return meter_bar_1.MeterBar; } });
|
|
3865
|
+
});
|
|
3866
|
+
|
|
3867
|
+
|
|
3868
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3869
|
+
var t = {};
|
|
3870
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3871
|
+
t[p] = s[p];
|
|
3872
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3873
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3874
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3875
|
+
t[p[i]] = s[p[i]];
|
|
3876
|
+
}
|
|
3877
|
+
return t;
|
|
3878
|
+
};
|
|
3879
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3880
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3881
|
+
};
|
|
3882
|
+
define('oj-c/meter-circle/meter-circle',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/UNSAFE_MeterCircle", "ojs/ojvcomponent", "preact/hooks", "@oracle/oraclejet-preact/hooks/UNSAFE_useTabbableMode", "../utils/UNSAFE_meterUtils/meterUtils", "css!oj-c/meter-circle/meter-circle-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_MeterCircle_1, ojvcomponent_1, hooks_1, UNSAFE_useTabbableMode_1, meterUtils_1) {
|
|
3883
|
+
"use strict";
|
|
3884
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3885
|
+
exports.MeterCircle = void 0;
|
|
3886
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
3887
|
+
exports.MeterCircle = (0, ojvcomponent_1.registerCustomElement)('oj-c-meter-circle', (_a) => {
|
|
3888
|
+
var _b, _c, _d, _e, _f;
|
|
3889
|
+
var { max = 100, value = 0, min = 0, size = 'md', step = 1, readonly = false, startAngle = 90, indicatorSize = 1, angleExtent = 360, thresholdDisplay = 'indicator' } = _a, props = __rest(_a, ["max", "value", "min", "size", "step", "readonly", "startAngle", "indicatorSize", "angleExtent", "thresholdDisplay"]);
|
|
3890
|
+
const [hoveredVal, setHoveredVal] = (0, hooks_1.useState)();
|
|
3891
|
+
const inputHandler = (detail) => {
|
|
3892
|
+
var _a;
|
|
3893
|
+
setHoveredVal(detail.value);
|
|
3894
|
+
(_a = props.onTransientValueChanged) === null || _a === void 0 ? void 0 : _a.call(props, detail.value);
|
|
3895
|
+
};
|
|
3896
|
+
const commitHandler = (detail) => {
|
|
3897
|
+
var _a;
|
|
3898
|
+
(_a = props.onValueChanged) === null || _a === void 0 ? void 0 : _a.call(props, detail.value);
|
|
3899
|
+
};
|
|
3900
|
+
const thresholds = (_b = props.thresholds) === null || _b === void 0 ? void 0 : _b.map((threshold, index) => {
|
|
3901
|
+
return Object.assign(Object.assign({}, threshold), { color: (0, meterUtils_1.getThresholdColorByIndex)(threshold, index) });
|
|
3902
|
+
});
|
|
3903
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, { children: (0, jsx_runtime_1.jsx)(UNSAFE_MeterCircle_1.MeterCircle, Object.assign({ value: (hoveredVal != undefined ? hoveredVal : value), step: step, max: max, min: min, size: size, angleExtent: angleExtent, startAngle: startAngle, indicatorSize: indicatorSize, innerRadius: props.innerRadius, datatip: props.datatip
|
|
3904
|
+
? props.datatip({
|
|
3905
|
+
value: hoveredVal != undefined ? hoveredVal : value
|
|
3906
|
+
})
|
|
3907
|
+
: props.datatip, onCommit: readonly ? undefined : commitHandler, onInput: readonly ? undefined : inputHandler, thresholds: thresholds, trackColor: (_c = props.plotArea) === null || _c === void 0 ? void 0 : _c.color, indicatorColor: props.color, isTrackRendered: ((_d = props.plotArea) === null || _d === void 0 ? void 0 : _d.rendered) !== 'off', referenceLines: props.referenceLines, thresholdDisplay: thresholdDisplay === 'plotArea' ? 'track' : thresholdDisplay, accessibleLabel: props['aria-label'], ariaLabelledBy: (_e = props.labelledBy) !== null && _e !== void 0 ? _e : undefined, ariaDescribedBy: (_f = props.describedBy) !== null && _f !== void 0 ? _f : undefined }, { children: (context) => {
|
|
3908
|
+
var _a;
|
|
3909
|
+
return (_a = props.centerTemplate) === null || _a === void 0 ? void 0 : _a.call(props, Object.assign({ value }, context));
|
|
3910
|
+
} })) }));
|
|
3911
|
+
}, "MeterCircle", { "properties": { "max": { "type": "number" }, "min": { "type": "number" }, "readonly": { "type": "boolean" }, "value": { "type": "number|null", "writeback": true }, "step": { "type": "number" }, "color": { "type": "string" }, "indicatorSize": { "type": "number" }, "innerRadius": { "type": "number" }, "plotArea": { "type": "object", "properties": { "color": { "type": "string" }, "rendered": { "type": "string", "enumValues": ["on", "off"] } } }, "angleExtent": { "type": "number" }, "startAngle": { "type": "number" }, "referenceLines": { "type": "Array<object>" }, "thresholdDisplay": { "type": "string", "enumValues": ["all", "plotArea", "indicator"] }, "thresholds": { "type": "Array<object>" }, "describedBy": { "type": "string|null" }, "labelledBy": { "type": "string|null" }, "size": { "type": "string", "enumValues": ["sm", "md", "lg"] }, "datatip": { "type": "function" }, "transientValue": { "type": "number", "readOnly": true, "writeback": true } }, "slots": { "centerTemplate": { "data": {} } }, "extension": { "_WRITEBACK_PROPS": ["value", "transientValue"], "_READ_ONLY_PROPS": ["transientValue"], "_OBSERVED_GLOBAL_PROPS": ["aria-label"] } }, { "max": 100, "value": 0, "min": 0, "size": "md", "step": 1, "readonly": false, "startAngle": 90, "indicatorSize": 1, "angleExtent": 360, "thresholdDisplay": "indicator" }, {
|
|
3912
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
3913
|
+
}, { consume: [UNSAFE_useTabbableMode_1.TabbableModeContext] });
|
|
3914
|
+
});
|
|
3915
|
+
|
|
3916
|
+
define('oj-c/meter-circle',["require", "exports", "./meter-circle/meter-circle"], function (require, exports, meter_circle_1) {
|
|
3917
|
+
"use strict";
|
|
3918
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3919
|
+
exports.MeterCircle = void 0;
|
|
3920
|
+
Object.defineProperty(exports, "MeterCircle", { enumerable: true, get: function () { return meter_circle_1.MeterCircle; } });
|
|
3921
|
+
});
|
|
3922
|
+
|
|
3923
|
+
|
|
3924
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3925
|
+
var t = {};
|
|
3926
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3927
|
+
t[p] = s[p];
|
|
3928
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3929
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3930
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3931
|
+
t[p[i]] = s[p[i]];
|
|
3932
|
+
}
|
|
3933
|
+
return t;
|
|
3934
|
+
};
|
|
3935
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3936
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3937
|
+
};
|
|
3938
|
+
define('oj-c/list-item-layout/list-item-layout',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/UNSAFE_ListItemLayout", "ojs/ojvcomponent", "css!oj-c/list-item-layout/list-item-layout-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_ListItemLayout_1, ojvcomponent_1) {
|
|
3939
|
+
"use strict";
|
|
3940
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3941
|
+
exports.ListItemLayout = void 0;
|
|
3942
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
3943
|
+
exports.ListItemLayout = (0, ojvcomponent_1.registerCustomElement)('oj-c-list-item-layout', (_a) => {
|
|
3944
|
+
var { children } = _a, otherProps = __rest(_a, ["children"]);
|
|
3945
|
+
const primary = children;
|
|
3946
|
+
const insetStyle = { padding: otherProps.inset === 'none' ? '0' : '12px 16px' };
|
|
3947
|
+
const actionSlot = otherProps.action ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ "data-oj-clickthrough": "disabled" }, { children: otherProps.action }))) : undefined;
|
|
3948
|
+
const navSlot = otherProps.navigation ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ "data-oj-clickthrough": "disabled" }, { children: otherProps.navigation }))) : undefined;
|
|
3949
|
+
return ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ style: insetStyle }, { children: (0, jsx_runtime_1.jsx)(UNSAFE_ListItemLayout_1.ListItemLayout, { primary: primary, overline: otherProps.overline, selector: otherProps.selector, leading: otherProps.leading, secondary: otherProps.secondary, tertiary: otherProps.tertiary, metadata: otherProps.metadata, trailing: otherProps.trailing, action: actionSlot, quaternary: otherProps.quaternary, navigation: navSlot }) })) }));
|
|
3950
|
+
}, "ListItemLayout", { "slots": { "": {}, "overline": {}, "selector": {}, "leading": {}, "secondary": {}, "tertiary": {}, "metadata": {}, "trailing": {}, "action": {}, "quaternary": {}, "navigation": {} }, "properties": { "inset": { "type": "string", "enumValues": ["none", "listInset"] } }, "extension": { "_OBSERVED_GLOBAL_PROPS": ["aria-label"] } }, undefined, {
|
|
3951
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
3952
|
+
});
|
|
3953
|
+
});
|
|
3954
|
+
|
|
3955
|
+
define('oj-c/list-item-layout',["require", "exports", "./list-item-layout/list-item-layout"], function (require, exports, list_item_layout_1) {
|
|
3956
|
+
"use strict";
|
|
3957
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3958
|
+
exports.ListItemLayout = void 0;
|
|
3959
|
+
Object.defineProperty(exports, "ListItemLayout", { enumerable: true, get: function () { return list_item_layout_1.ListItemLayout; } });
|
|
3960
|
+
});
|
|
3961
|
+
|
|
3962
|
+
|
|
3963
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3964
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3965
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3966
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3967
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3968
|
+
};
|
|
3969
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3970
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3971
|
+
};
|
|
3972
|
+
define('oj-c/split-menu-button/split-menu-button',["require", "exports", "preact/jsx-runtime", '@oracle/oraclejet-preact/translationBundle', "@oracle/oraclejet-preact/UNSAFE_SplitMenuButton", "@oracle/oraclejet-preact/UNSAFE_Menu", "@oracle/oraclejet-preact/hooks/UNSAFE_useTabbableMode", "preact", "preact/hooks", "preact/compat", "ojs/ojvcomponent", "css!oj-c/split-menu-button/split-menu-button-styles.css"], function (require, exports, jsx_runtime_1, translationBundle_1, UNSAFE_SplitMenuButton_1, UNSAFE_Menu_1, UNSAFE_useTabbableMode_1, preact_1, hooks_1, compat_1, ojvcomponent_1) {
|
|
3973
|
+
"use strict";
|
|
3974
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3975
|
+
exports.SplitMenuButton = void 0;
|
|
3976
|
+
translationBundle_1 = __importDefault(translationBundle_1);
|
|
3977
|
+
const FunctionalSplitMenuButton = (0, compat_1.forwardRef)((props, ref) => {
|
|
3978
|
+
const buttonRef = (0, hooks_1.useRef)(null);
|
|
3979
|
+
(0, hooks_1.useImperativeHandle)(ref, () => ({
|
|
3980
|
+
focus: () => { var _a; return (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.focus(); },
|
|
3981
|
+
blur: () => { var _a; return (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.blur(); },
|
|
3982
|
+
doAction: () => { var _a; return (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new Event('ojAction', { bubbles: true })); }
|
|
3983
|
+
}), []);
|
|
3984
|
+
return (0, jsx_runtime_1.jsx)(UNSAFE_SplitMenuButton_1.SplitMenuButton, Object.assign({ ref: buttonRef }, props));
|
|
3985
|
+
});
|
|
3986
|
+
let SplitMenuButton = class SplitMenuButton extends preact_1.Component {
|
|
3987
|
+
constructor() {
|
|
3988
|
+
super(...arguments);
|
|
3989
|
+
this.buttonRef = (0, preact_1.createRef)();
|
|
3990
|
+
this.renderMenu = (items) => {
|
|
3991
|
+
return items.map((item) => {
|
|
3992
|
+
if (item && item.type === 'divider') {
|
|
3993
|
+
return (0, jsx_runtime_1.jsx)(UNSAFE_Menu_1.MenuDivider, {});
|
|
3994
|
+
}
|
|
3995
|
+
else if (item.label) {
|
|
3996
|
+
return ((0, jsx_runtime_1.jsx)(UNSAFE_Menu_1.MenuItem, { label: item.label, isDisabled: item.disabled, onAction: item.onAction }));
|
|
3997
|
+
}
|
|
3998
|
+
else {
|
|
3999
|
+
return;
|
|
4000
|
+
}
|
|
4001
|
+
});
|
|
4002
|
+
};
|
|
4003
|
+
}
|
|
4004
|
+
render(props) {
|
|
4005
|
+
const { chroming, label, disabled, size, onOjAction: onAction, items } = Object.assign({}, props);
|
|
4006
|
+
const widthSize = { width: props.width };
|
|
4007
|
+
return props.width ? ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, Object.assign({ style: widthSize }, { children: (0, jsx_runtime_1.jsx)(FunctionalSplitMenuButton, Object.assign({ label: label, ref: this.buttonRef, variant: chroming, size: size, width: '100%', isDisabled: disabled, onAction: onAction }, { children: this.renderMenu(items) })) }))) : ((0, jsx_runtime_1.jsx)(ojvcomponent_1.Root, { children: (0, jsx_runtime_1.jsx)(FunctionalSplitMenuButton, Object.assign({ label: label, ref: this.buttonRef, variant: chroming, size: size, width: '100%', isDisabled: disabled, onAction: onAction }, { children: this.renderMenu(items) })) }));
|
|
4008
|
+
}
|
|
4009
|
+
blur() {
|
|
4010
|
+
var _a;
|
|
4011
|
+
(_a = this.buttonRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
4012
|
+
}
|
|
4013
|
+
focus() {
|
|
4014
|
+
var _a;
|
|
4015
|
+
(_a = this.buttonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4016
|
+
}
|
|
4017
|
+
doAction() {
|
|
4018
|
+
var _a;
|
|
4019
|
+
(_a = this.buttonRef.current) === null || _a === void 0 ? void 0 : _a.doAction();
|
|
4020
|
+
}
|
|
4021
|
+
};
|
|
4022
|
+
SplitMenuButton.defaultProps = {
|
|
4023
|
+
label: '',
|
|
4024
|
+
chroming: 'outlined',
|
|
4025
|
+
disabled: false,
|
|
4026
|
+
size: 'md',
|
|
4027
|
+
items: []
|
|
4028
|
+
};
|
|
4029
|
+
SplitMenuButton._metadata = { "properties": { "label": { "type": "string" }, "items": { "type": "Array<object>" }, "disabled": { "type": "boolean" }, "size": { "type": "string", "enumValues": ["sm", "md", "lg"] }, "width": { "type": "number|string" }, "chroming": { "type": "string", "enumValues": ["outlined", "solid", "callToAction"] } }, "events": { "ojAction": { "bubbles": true } }, "extension": { "_OBSERVED_GLOBAL_PROPS": ["title"] }, "methods": { "blur": {}, "focus": {}, "doAction": {} } };
|
|
4030
|
+
SplitMenuButton._translationBundleMap = {
|
|
4031
|
+
'@oracle/oraclejet-preact': translationBundle_1.default
|
|
4032
|
+
};
|
|
4033
|
+
SplitMenuButton._consumedContexts = [UNSAFE_useTabbableMode_1.TabbableModeContext];
|
|
4034
|
+
SplitMenuButton = __decorate([
|
|
4035
|
+
(0, ojvcomponent_1.customElement)('oj-c-split-menu-button')
|
|
4036
|
+
], SplitMenuButton);
|
|
4037
|
+
exports.SplitMenuButton = SplitMenuButton;
|
|
4038
|
+
});
|
|
4039
|
+
|
|
4040
|
+
define('oj-c/split-menu-button',["require", "exports", "./split-menu-button/split-menu-button"], function (require, exports, split_menu_button_1) {
|
|
4041
|
+
"use strict";
|
|
4042
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4043
|
+
exports.SplitMenuButton = void 0;
|
|
4044
|
+
Object.defineProperty(exports, "SplitMenuButton", { enumerable: true, get: function () { return split_menu_button_1.SplitMenuButton; } });
|
|
4045
|
+
});
|
|
4046
|
+
|
|
4047
|
+
require(["oj-c/input-number","oj-c/input-password","oj-c/input-text","oj-c/message-toast","oj-c/text-area","oj-c/progress-bar","oj-c/progress-circle","oj-c/avatar","oj-c/button","oj-c/rating-gauge","oj-c/select-multiple","oj-c/select-single","oj-c/collapsible","oj-c/file-picker","oj-c/meter-bar","oj-c/meter-circle","oj-c/list-item-layout","oj-c/split-menu-button"], function(){});
|
|
4048
|
+
define("corepackbundle", function(){});
|
|
4049
|
+
|