iglooform 3.2.7 → 3.3.1
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/.dumi/tmp/core/defineApp.ts +1 -1
- package/.dumi/tmp/core/helmet.ts +1 -1
- package/.dumi/tmp/core/history.ts +1 -1
- package/.dumi/tmp/core/historyIntelli.ts +1 -1
- package/.dumi/tmp/core/plugin.ts +2 -2
- package/.dumi/tmp/core/polyfill.ts +197 -197
- package/.dumi/tmp/core/route.tsx +33 -33
- package/.dumi/tmp/dumi/exports.ts +1 -1
- package/.dumi/tmp/dumi/locales/runtime.tsx +2 -2
- package/.dumi/tmp/dumi/meta/index.ts +33 -33
- package/.dumi/tmp/dumi/meta/runtime.ts +1 -1
- package/.dumi/tmp/dumi/theme/ContextWrapper.tsx +2 -2
- package/.dumi/tmp/dumi/theme/builtins/API.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Badge.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Container.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Previewer.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/SourceCode.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Table.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Tree.ts +1 -1
- package/.dumi/tmp/dumi/theme/layouts/DocLayout.ts +1 -1
- package/.dumi/tmp/dumi/theme/loading.tsx +1 -1
- package/.dumi/tmp/dumi/theme/slots/ColorSwitch.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Content.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/ContentFooter.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/ContentTabs.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Features.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Footer.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Header.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/HeaderExtra.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Hero.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/HeroTitle.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/LangSwitch.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Logo.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Navbar.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/NavbarExtra.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/NotFound.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/PreviewerActions.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/PreviewerActionsExtra.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/RtlSwitch.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/SearchBar.ts +2 -2
- package/.dumi/tmp/dumi/theme/slots/SearchResult.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Sidebar.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/SocialIcon.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Toc.ts +1 -1
- package/.dumi/tmp/exports.ts +5 -5
- package/.dumi/tmp/testBrowser.tsx +3 -3
- package/.dumi/tmp/umi.ts +4 -4
- package/.dumirc.ts +1 -1
- package/es/form/index.js +3 -1
- package/es/form/step-items-selection/components/checkbox-group-items/index.js +110 -0
- package/es/form/step-items-selection/components/checkbox-group-items/style/index.js +1 -0
- package/es/form/step-items-selection/components/checkbox-group-items/style/index.less +9 -0
- package/es/form/step-items-selection/components/index.js +2 -0
- package/es/form/step-items-selection/components/item-info/index.js +62 -0
- package/es/form/step-items-selection/components/item-info/style/index.js +1 -0
- package/es/form/step-items-selection/components/item-info/style/index.less +31 -0
- package/es/form/step-items-selection/components/section-of-item-condition/hooks/index.js +1 -0
- package/es/form/step-items-selection/components/section-of-item-condition/hooks/useElements.d.ts +5 -0
- package/es/form/step-items-selection/components/section-of-item-condition/hooks/useElements.js +73 -0
- package/es/form/step-items-selection/components/section-of-item-condition/index.js +89 -0
- package/es/form/step-items-selection/components/section-of-item-condition/style/index.js +1 -0
- package/es/form/step-items-selection/components/section-of-item-condition/style/index.less +17 -0
- package/es/form/step-items-selection/config.js +5 -0
- package/es/form/step-items-selection/index.js +227 -0
- package/es/form/step-items-selection/types.js +1 -0
- package/es/form/steps/index.js +86 -24
- package/es/input/input-number/basic.js +34 -0
- package/es/input/{input-number.js → input-number/index.js} +67 -31
- package/es/input/input-number/stepper/index.js +69 -0
- package/es/input/input-number/stepper/index.less +99 -0
- package/es/input/style/common.less +1 -0
- package/es/locale/en-US/messages.json +9 -3
- package/es/locale/id-ID/messages.json +9 -3
- package/es/locale/th-TH/messages.json +9 -3
- package/es/locale/vi-VN/messages.json +9 -3
- package/es/locale/zh-CN/messages.json +9 -3
- package/es/locale/zh-TW/messages.json +9 -3
- package/lib/form/index.js +3 -1
- package/lib/form/step-items-selection/components/checkbox-group-items/index.js +117 -0
- package/lib/form/step-items-selection/components/checkbox-group-items/style/index.js +3 -0
- package/lib/form/step-items-selection/components/checkbox-group-items/style/index.less +9 -0
- package/lib/form/step-items-selection/components/index.js +19 -0
- package/lib/form/step-items-selection/components/item-info/index.js +69 -0
- package/lib/form/step-items-selection/components/item-info/style/index.js +3 -0
- package/lib/form/step-items-selection/components/item-info/style/index.less +31 -0
- package/lib/form/step-items-selection/components/section-of-item-condition/hooks/index.js +16 -0
- package/lib/form/step-items-selection/components/section-of-item-condition/hooks/useElements.d.ts +5 -0
- package/lib/form/step-items-selection/components/section-of-item-condition/hooks/useElements.js +80 -0
- package/lib/form/step-items-selection/components/section-of-item-condition/index.js +96 -0
- package/lib/form/step-items-selection/components/section-of-item-condition/style/index.js +3 -0
- package/lib/form/step-items-selection/components/section-of-item-condition/style/index.less +17 -0
- package/lib/form/step-items-selection/config.js +16 -0
- package/lib/form/step-items-selection/index.js +234 -0
- package/lib/form/step-items-selection/types.js +5 -0
- package/lib/form/steps/index.js +84 -23
- package/lib/input/input-number/basic.js +42 -0
- package/lib/input/{input-number.js → input-number/index.js} +68 -32
- package/lib/input/input-number/stepper/index.js +75 -0
- package/lib/input/input-number/stepper/index.less +99 -0
- package/lib/input/style/common.less +1 -0
- package/lib/locale/en-US/messages.json +9 -3
- package/lib/locale/id-ID/messages.json +9 -3
- package/lib/locale/th-TH/messages.json +9 -3
- package/lib/locale/vi-VN/messages.json +9 -3
- package/lib/locale/zh-CN/messages.json +9 -3
- package/lib/locale/zh-TW/messages.json +9 -3
- package/package.json +1 -2
- package/.idea/codeStyles/Project.xml +0 -59
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/iglooform.iml +0 -12
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/es/admin-amount/style/index.d.ts +0 -0
- package/es/admin-upload/index.d.ts +0 -37
- package/es/admin-upload/style/index.d.ts +0 -1
- package/es/alert-message/style/index.d.ts +0 -1
- package/es/app/context.d.ts +0 -9
- package/es/app/index.d.ts +0 -8
- package/es/babel-plugin-import-option.d.ts +0 -7
- package/es/back-top/index.d.ts +0 -5
- package/es/back-top/style/index.d.ts +0 -1
- package/es/button/style/index.d.ts +0 -1
- package/es/card-detail/card-page.d.ts +0 -12
- package/es/card-detail/card.d.ts +0 -10
- package/es/card-detail/style/index.d.ts +0 -1
- package/es/checkbox/style/index.d.ts +0 -1
- package/es/claim-list/style/index.d.ts +0 -1
- package/es/config-provider.d.ts +0 -9
- package/es/confirmation/index.d.ts +0 -16
- package/es/confirmation/style/index.d.ts +0 -1
- package/es/currency-context/index.d.ts +0 -8
- package/es/currency-context/style/index.d.ts +0 -0
- package/es/date-picker/buddhist.d.ts +0 -6
- package/es/date-picker/index.d.ts +0 -13
- package/es/date-picker/style/index.d.ts +0 -1
- package/es/declaration/style/index.d.ts +0 -1
- package/es/detail-panel/style/index.d.ts +0 -1
- package/es/documents/index.d.ts +0 -15
- package/es/documents/style/index.d.ts +0 -1
- package/es/filter/index.d.ts +0 -52
- package/es/filter/style/index.d.ts +0 -1
- package/es/form/addable-section/index.d.ts +0 -20
- package/es/form/addable-section/style/index.d.ts +0 -1
- package/es/form/divider/style/index.d.ts +0 -1
- package/es/form/element/index.d.ts +0 -12
- package/es/form/element/style/index.d.ts +0 -1
- package/es/form/elements.d.ts +0 -8
- package/es/form/hstep/style/index.d.ts +0 -1
- package/es/form/hsteps/index.d.ts +0 -21
- package/es/form/hsteps/style/index.d.ts +0 -1
- package/es/form/index.d.ts +0 -4
- package/es/form/login/style/index.d.ts +0 -1
- package/es/form/messages.d.ts +0 -48
- package/es/form/page/style/index.d.ts +0 -1
- package/es/form/pages/style/index.d.ts +0 -1
- package/es/form/render/style/index.d.ts +0 -1
- package/es/form/section/index.d.ts +0 -16
- package/es/form/section/style/index.d.ts +0 -1
- package/es/form/step/style/index.d.ts +0 -1
- package/es/form/steps/index.d.ts +0 -10
- package/es/form/steps/style/index.d.ts +0 -1
- package/es/form/style/index.d.ts +0 -1
- package/es/form-context.d.ts +0 -28
- package/es/free-form/addable-section/index.d.ts +0 -19
- package/es/free-form/addable-section/style/index.d.ts +0 -1
- package/es/free-form/element/index.d.ts +0 -11
- package/es/free-form/element/style/index.d.ts +0 -1
- package/es/free-form/index.d.ts +0 -11
- package/es/free-form/messages.d.ts +0 -48
- package/es/free-form/page/style/index.d.ts +0 -1
- package/es/free-form/pages/style/index.d.ts +0 -1
- package/es/free-form/section/index.d.ts +0 -13
- package/es/free-form/section/style/index.d.ts +0 -1
- package/es/free-form/step/index.d.ts +0 -21
- package/es/free-form/step/style/index.d.ts +0 -1
- package/es/free-form/steps/index.d.ts +0 -12
- package/es/free-form/steps/style/index.d.ts +0 -1
- package/es/free-form/style/index.d.ts +0 -1
- package/es/home-menu/style/index.d.ts +0 -1
- package/es/hooks/ocr/index.d.ts +0 -3
- package/es/hooks/ocr/micro-blink.d.ts +0 -10
- package/es/index.d.ts +0 -49
- package/es/input/amount.d.ts +0 -14
- package/es/input/expiry-date.d.ts +0 -16
- package/es/input/input-date.d.ts +0 -8
- package/es/input/input-number.d.ts +0 -6
- package/es/input/phone-number.d.ts +0 -14
- package/es/input/style/amount/index.d.ts +0 -2
- package/es/input/style/index.d.ts +0 -2
- package/es/input/style/input-date/index.d.ts +0 -2
- package/es/input/style/otp/index.d.ts +0 -2
- package/es/input/style/phone-number/index.d.ts +0 -2
- package/es/input/style/text-area/index.d.ts +0 -2
- package/es/layout/defaultFooter.d.ts +0 -4
- package/es/layout/defaultHeader.d.ts +0 -4
- package/es/layout/style/index.d.ts +0 -1
- package/es/locale/en-US.d.ts +0 -2
- package/es/locale/format-message.d.ts +0 -10
- package/es/locale/formatted-message.d.ts +0 -6
- package/es/locale/id-ID.d.ts +0 -2
- package/es/locale/index.d.ts +0 -4
- package/es/locale/locale-context.d.ts +0 -12
- package/es/locale/locale-provider.d.ts +0 -13
- package/es/locale/ms-MY.d.ts +0 -2
- package/es/locale/th-TH.d.ts +0 -2
- package/es/locale/vi-VN.d.ts +0 -2
- package/es/locale/zh-CN.d.ts +0 -2
- package/es/locale/zh-TW.d.ts +0 -2
- package/es/login-page/index.d.ts +0 -7
- package/es/login-page/style/index.d.ts +0 -1
- package/es/media/file-icon.d.ts +0 -9
- package/es/media/index.d.ts +0 -29
- package/es/media/media.d.ts +0 -11
- package/es/media/preview.d.ts +0 -12
- package/es/media/style/index.d.ts +0 -1
- package/es/message/index.d.ts +0 -14
- package/es/message/style/index.d.ts +0 -1
- package/es/message/useMessage.d.ts +0 -6
- package/es/mobile-insurer-detail/style/index.d.ts +0 -1
- package/es/mobile-insurer-list/style/index.d.ts +0 -1
- package/es/modal/index.d.ts +0 -33
- package/es/modal/style/index.d.ts +0 -1
- package/es/modal/useModal.d.ts +0 -12
- package/es/ocr/index.d.ts +0 -15
- package/es/ocr/micro-blink/index.d.ts +0 -8
- package/es/ocr/micro-blink/style/index.d.ts +0 -1
- package/es/platform/index.d.ts +0 -2
- package/es/platform/platform-card/index.d.ts +0 -12
- package/es/platform/platform-card/style/index.d.ts +0 -1
- package/es/platform/switch-platform/index.d.ts +0 -12
- package/es/platform/switch-platform/style/index.d.ts +0 -1
- package/es/policy-list/style/index.d.ts +0 -1
- package/es/radio/index.d.ts +0 -24
- package/es/radio/radio-group-with-other.d.ts +0 -7
- package/es/radio/style/index.d.ts +0 -1
- package/es/search-box/style/index.d.ts +0 -1
- package/es/select/style/index.d.ts +0 -1
- package/es/status-box/style/index.d.ts +0 -1
- package/es/table/style/index.d.ts +0 -1
- package/es/tabs/index.d.ts +0 -15
- package/es/tabs/style/index.d.ts +0 -1
- package/es/types.d.ts +0 -187
- package/es/typography/style/index.d.ts +0 -1
- package/es/upload/index.d.ts +0 -16
- package/es/upload/style/index.d.ts +0 -1
- package/es/upload-photo/index.d.ts +0 -28
- package/es/upload-photo/media.d.ts +0 -7
- package/es/upload-photo/style/index.d.ts +0 -1
- package/es/upload-preview/index.d.ts +0 -9
- package/es/upload-preview/media.d.ts +0 -7
- package/es/upload-preview/style/index.d.ts +0 -1
- package/es/utils/agent-detect.d.ts +0 -1
- package/es/utils/form-utils.d.ts +0 -79
- package/es/utils/option-utils.d.ts +0 -29
- package/es/utils/tools.d.ts +0 -5
- package/es/utils/useAsyncEffect.d.ts +0 -3
- package/lib/admin-amount/style/index.d.ts +0 -0
- package/lib/admin-upload/index.d.ts +0 -37
- package/lib/admin-upload/style/index.d.ts +0 -1
- package/lib/alert-message/style/index.d.ts +0 -1
- package/lib/app/context.d.ts +0 -9
- package/lib/app/index.d.ts +0 -8
- package/lib/babel-plugin-import-option.d.ts +0 -7
- package/lib/back-top/index.d.ts +0 -5
- package/lib/back-top/style/index.d.ts +0 -1
- package/lib/button/style/index.d.ts +0 -1
- package/lib/card-detail/card-page.d.ts +0 -12
- package/lib/card-detail/card.d.ts +0 -10
- package/lib/card-detail/style/index.d.ts +0 -1
- package/lib/checkbox/style/index.d.ts +0 -1
- package/lib/claim-list/style/index.d.ts +0 -1
- package/lib/config-provider.d.ts +0 -9
- package/lib/confirmation/index.d.ts +0 -16
- package/lib/confirmation/style/index.d.ts +0 -1
- package/lib/currency-context/index.d.ts +0 -8
- package/lib/currency-context/style/index.d.ts +0 -0
- package/lib/date-picker/buddhist.d.ts +0 -6
- package/lib/date-picker/index.d.ts +0 -13
- package/lib/date-picker/style/index.d.ts +0 -1
- package/lib/declaration/style/index.d.ts +0 -1
- package/lib/detail-panel/style/index.d.ts +0 -1
- package/lib/documents/index.d.ts +0 -15
- package/lib/documents/style/index.d.ts +0 -1
- package/lib/filter/index.d.ts +0 -52
- package/lib/filter/style/index.d.ts +0 -1
- package/lib/form/addable-section/index.d.ts +0 -20
- package/lib/form/addable-section/style/index.d.ts +0 -1
- package/lib/form/divider/style/index.d.ts +0 -1
- package/lib/form/element/index.d.ts +0 -12
- package/lib/form/element/style/index.d.ts +0 -1
- package/lib/form/elements.d.ts +0 -8
- package/lib/form/hstep/style/index.d.ts +0 -1
- package/lib/form/hsteps/index.d.ts +0 -21
- package/lib/form/hsteps/style/index.d.ts +0 -1
- package/lib/form/index.d.ts +0 -4
- package/lib/form/login/style/index.d.ts +0 -1
- package/lib/form/messages.d.ts +0 -48
- package/lib/form/page/style/index.d.ts +0 -1
- package/lib/form/pages/style/index.d.ts +0 -1
- package/lib/form/render/style/index.d.ts +0 -1
- package/lib/form/section/index.d.ts +0 -16
- package/lib/form/section/style/index.d.ts +0 -1
- package/lib/form/step/style/index.d.ts +0 -1
- package/lib/form/steps/index.d.ts +0 -10
- package/lib/form/steps/style/index.d.ts +0 -1
- package/lib/form/style/index.d.ts +0 -1
- package/lib/form-context.d.ts +0 -28
- package/lib/free-form/addable-section/index.d.ts +0 -19
- package/lib/free-form/addable-section/style/index.d.ts +0 -1
- package/lib/free-form/element/index.d.ts +0 -11
- package/lib/free-form/element/style/index.d.ts +0 -1
- package/lib/free-form/index.d.ts +0 -11
- package/lib/free-form/messages.d.ts +0 -48
- package/lib/free-form/page/style/index.d.ts +0 -1
- package/lib/free-form/pages/style/index.d.ts +0 -1
- package/lib/free-form/section/index.d.ts +0 -13
- package/lib/free-form/section/style/index.d.ts +0 -1
- package/lib/free-form/step/index.d.ts +0 -21
- package/lib/free-form/step/style/index.d.ts +0 -1
- package/lib/free-form/steps/index.d.ts +0 -12
- package/lib/free-form/steps/style/index.d.ts +0 -1
- package/lib/free-form/style/index.d.ts +0 -1
- package/lib/home-menu/style/index.d.ts +0 -1
- package/lib/hooks/ocr/index.d.ts +0 -3
- package/lib/hooks/ocr/micro-blink.d.ts +0 -10
- package/lib/index.d.ts +0 -49
- package/lib/input/amount.d.ts +0 -14
- package/lib/input/expiry-date.d.ts +0 -16
- package/lib/input/input-date.d.ts +0 -8
- package/lib/input/input-number.d.ts +0 -6
- package/lib/input/phone-number.d.ts +0 -14
- package/lib/input/style/amount/index.d.ts +0 -2
- package/lib/input/style/index.d.ts +0 -2
- package/lib/input/style/input-date/index.d.ts +0 -2
- package/lib/input/style/otp/index.d.ts +0 -2
- package/lib/input/style/phone-number/index.d.ts +0 -2
- package/lib/input/style/text-area/index.d.ts +0 -2
- package/lib/layout/defaultFooter.d.ts +0 -4
- package/lib/layout/defaultHeader.d.ts +0 -4
- package/lib/layout/style/index.d.ts +0 -1
- package/lib/locale/en-US.d.ts +0 -2
- package/lib/locale/format-message.d.ts +0 -10
- package/lib/locale/formatted-message.d.ts +0 -6
- package/lib/locale/id-ID.d.ts +0 -2
- package/lib/locale/index.d.ts +0 -4
- package/lib/locale/locale-context.d.ts +0 -12
- package/lib/locale/locale-provider.d.ts +0 -13
- package/lib/locale/ms-MY.d.ts +0 -2
- package/lib/locale/th-TH.d.ts +0 -2
- package/lib/locale/vi-VN.d.ts +0 -2
- package/lib/locale/zh-CN.d.ts +0 -2
- package/lib/locale/zh-TW.d.ts +0 -2
- package/lib/login-page/index.d.ts +0 -7
- package/lib/login-page/style/index.d.ts +0 -1
- package/lib/media/file-icon.d.ts +0 -9
- package/lib/media/index.d.ts +0 -29
- package/lib/media/media.d.ts +0 -11
- package/lib/media/preview.d.ts +0 -12
- package/lib/media/style/index.d.ts +0 -1
- package/lib/message/index.d.ts +0 -14
- package/lib/message/style/index.d.ts +0 -1
- package/lib/message/useMessage.d.ts +0 -6
- package/lib/mobile-insurer-detail/style/index.d.ts +0 -1
- package/lib/mobile-insurer-list/style/index.d.ts +0 -1
- package/lib/modal/index.d.ts +0 -33
- package/lib/modal/style/index.d.ts +0 -1
- package/lib/modal/useModal.d.ts +0 -12
- package/lib/ocr/index.d.ts +0 -15
- package/lib/ocr/micro-blink/index.d.ts +0 -8
- package/lib/ocr/micro-blink/style/index.d.ts +0 -1
- package/lib/platform/index.d.ts +0 -2
- package/lib/platform/platform-card/index.d.ts +0 -12
- package/lib/platform/platform-card/style/index.d.ts +0 -1
- package/lib/platform/switch-platform/index.d.ts +0 -12
- package/lib/platform/switch-platform/style/index.d.ts +0 -1
- package/lib/policy-list/style/index.d.ts +0 -1
- package/lib/radio/index.d.ts +0 -24
- package/lib/radio/radio-group-with-other.d.ts +0 -7
- package/lib/radio/style/index.d.ts +0 -1
- package/lib/search-box/style/index.d.ts +0 -1
- package/lib/select/style/index.d.ts +0 -1
- package/lib/status-box/style/index.d.ts +0 -1
- package/lib/table/style/index.d.ts +0 -1
- package/lib/tabs/index.d.ts +0 -15
- package/lib/tabs/style/index.d.ts +0 -1
- package/lib/types.d.ts +0 -187
- package/lib/typography/style/index.d.ts +0 -1
- package/lib/upload/index.d.ts +0 -16
- package/lib/upload/style/index.d.ts +0 -1
- package/lib/upload-photo/index.d.ts +0 -28
- package/lib/upload-photo/media.d.ts +0 -7
- package/lib/upload-photo/style/index.d.ts +0 -1
- package/lib/upload-preview/index.d.ts +0 -9
- package/lib/upload-preview/media.d.ts +0 -7
- package/lib/upload-preview/style/index.d.ts +0 -1
- package/lib/utils/agent-detect.d.ts +0 -1
- package/lib/utils/form-utils.d.ts +0 -79
- package/lib/utils/option-utils.d.ts +0 -29
- package/lib/utils/tools.d.ts +0 -5
- package/lib/utils/useAsyncEffect.d.ts +0 -3
- package/yarn-error.log +0 -16168
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["name", "itemsData", "itemsDataConfig", "elements"];
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
9
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
10
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
11
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
12
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
13
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
18
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
+
import { useState, useContext, useEffect, useRef } from 'react';
|
|
20
|
+
import Step from "../step";
|
|
21
|
+
import { calcNamePath } from "../../utils/form-utils";
|
|
22
|
+
import FormContext from "../../form-context";
|
|
23
|
+
import { LocaleContext } from "../../locale";
|
|
24
|
+
import { CheckboxGroupItems, SectionOfItemCondition } from "./components";
|
|
25
|
+
import { KEY_STEP1, KEY_STEP2, KEY_ITEM_ID } from "./config";
|
|
26
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
28
|
+
var STEP_COUNT = 2;
|
|
29
|
+
var StepItemsSelection = function StepItemsSelection(props) {
|
|
30
|
+
var _form$getFieldValue;
|
|
31
|
+
var _useState = useState(0),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
current = _useState2[0],
|
|
34
|
+
setCurrent = _useState2[1];
|
|
35
|
+
var _useState3 = useState(false),
|
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
+
shouldScrollState = _useState4[0],
|
|
38
|
+
setShouldScrollState = _useState4[1];
|
|
39
|
+
var _useContext = useContext(FormContext),
|
|
40
|
+
form = _useContext.form;
|
|
41
|
+
var _useContext2 = useContext(LocaleContext),
|
|
42
|
+
formatMessage = _useContext2.formatMessage;
|
|
43
|
+
var refs = useRef([]);
|
|
44
|
+
var parentName = props.parentName,
|
|
45
|
+
config = props.config,
|
|
46
|
+
indexProp = props.index,
|
|
47
|
+
total = props.total,
|
|
48
|
+
preview = props.preview,
|
|
49
|
+
edit = props.edit,
|
|
50
|
+
handleNextProp = props.handleNext,
|
|
51
|
+
handleEditProp = props.handleEdit,
|
|
52
|
+
showLastIndex = props.showLastIndex,
|
|
53
|
+
shouldScrollProp = props.shouldScroll,
|
|
54
|
+
_props$currentStep = props.currentStep,
|
|
55
|
+
currentStep = _props$currentStep === void 0 ? 0 : _props$currentStep;
|
|
56
|
+
var nameProp = config.name,
|
|
57
|
+
_config$itemsData = config.itemsData,
|
|
58
|
+
itemsData = _config$itemsData === void 0 ? [] : _config$itemsData,
|
|
59
|
+
itemsDataConfig = config.itemsDataConfig,
|
|
60
|
+
elements = config.elements,
|
|
61
|
+
restConfig = _objectWithoutProperties(config, _excluded);
|
|
62
|
+
useEffect(function () {
|
|
63
|
+
if (currentStep === undefined || currentStep === current) return;
|
|
64
|
+
setCurrent(currentStep);
|
|
65
|
+
}, [currentStep]);
|
|
66
|
+
var _elements = _slicedToArray(elements, 2),
|
|
67
|
+
step1 = _elements[0],
|
|
68
|
+
step2 = _elements[1];
|
|
69
|
+
var namePath = calcNamePath(parentName, nameProp);
|
|
70
|
+
var shouldScroll = shouldScrollProp || shouldScrollState;
|
|
71
|
+
var selectedIdList = (_form$getFieldValue = form === null || form === void 0 ? void 0 : form.getFieldValue(calcNamePath(namePath, KEY_STEP1))) !== null && _form$getFieldValue !== void 0 ? _form$getFieldValue : [];
|
|
72
|
+
var calculateStep2Values = function calculateStep2Values() {
|
|
73
|
+
var _ref, _ref2;
|
|
74
|
+
var step1Values = (_ref = form === null || form === void 0 ? void 0 : form.getFieldValue(calcNamePath(namePath, KEY_STEP1))) !== null && _ref !== void 0 ? _ref : [];
|
|
75
|
+
var step2Values = (_ref2 = form === null || form === void 0 ? void 0 : form.getFieldValue(calcNamePath(namePath, KEY_STEP2))) !== null && _ref2 !== void 0 ? _ref2 : [];
|
|
76
|
+
var newStep2Values = step1Values.map(function (item) {
|
|
77
|
+
var found = step2Values.find(function (item2) {
|
|
78
|
+
return item2[KEY_ITEM_ID] === item;
|
|
79
|
+
});
|
|
80
|
+
return found;
|
|
81
|
+
});
|
|
82
|
+
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
83
|
+
name: calcNamePath(namePath, KEY_STEP2),
|
|
84
|
+
value: newStep2Values
|
|
85
|
+
}]);
|
|
86
|
+
};
|
|
87
|
+
var _handleNext = /*#__PURE__*/function () {
|
|
88
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(index) {
|
|
89
|
+
var _allFields$filter, allFields, fields, validateSuccess, _refs$current;
|
|
90
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
91
|
+
while (1) switch (_context.prev = _context.next) {
|
|
92
|
+
case 0:
|
|
93
|
+
if (!(index === 0)) {
|
|
94
|
+
_context.next = 17;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
allFields = (form === null || form === void 0 ? void 0 : form.getFieldsError()) || [];
|
|
98
|
+
fields = allFields === null || allFields === void 0 ? void 0 : (_allFields$filter = allFields.filter(function (_ref4) {
|
|
99
|
+
var name = _ref4.name;
|
|
100
|
+
return name.join().startsWith(namePath === null || namePath === void 0 ? void 0 : namePath.join());
|
|
101
|
+
})) === null || _allFields$filter === void 0 ? void 0 : _allFields$filter.map(function (_ref5) {
|
|
102
|
+
var name = _ref5.name;
|
|
103
|
+
return name;
|
|
104
|
+
});
|
|
105
|
+
_context.prev = 3;
|
|
106
|
+
_context.next = 6;
|
|
107
|
+
return form === null || form === void 0 ? void 0 : form.validateFields(fields);
|
|
108
|
+
case 6:
|
|
109
|
+
_context.next = 12;
|
|
110
|
+
break;
|
|
111
|
+
case 8:
|
|
112
|
+
_context.prev = 8;
|
|
113
|
+
_context.t0 = _context["catch"](3);
|
|
114
|
+
form === null || form === void 0 ? void 0 : form.scrollToField(_context.t0.errorFields[0].name);
|
|
115
|
+
return _context.abrupt("return");
|
|
116
|
+
case 12:
|
|
117
|
+
setCurrent(function (n) {
|
|
118
|
+
return n + 1;
|
|
119
|
+
});
|
|
120
|
+
setShouldScrollState(true);
|
|
121
|
+
// 对Steps从重新赋表单值
|
|
122
|
+
calculateStep2Values();
|
|
123
|
+
_context.next = 21;
|
|
124
|
+
break;
|
|
125
|
+
case 17:
|
|
126
|
+
_context.next = 19;
|
|
127
|
+
return handleNextProp === null || handleNextProp === void 0 ? void 0 : handleNextProp();
|
|
128
|
+
case 19:
|
|
129
|
+
validateSuccess = _context.sent;
|
|
130
|
+
if (validateSuccess !== undefined && validateSuccess === false) {
|
|
131
|
+
(_refs$current = refs.current) === null || _refs$current === void 0 ? void 0 : _refs$current.forEach(function (cu) {
|
|
132
|
+
return cu.unfold();
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
case 21:
|
|
136
|
+
case "end":
|
|
137
|
+
return _context.stop();
|
|
138
|
+
}
|
|
139
|
+
}, _callee, null, [[3, 8]]);
|
|
140
|
+
}));
|
|
141
|
+
return function handleNext(_x2) {
|
|
142
|
+
return _ref3.apply(this, arguments);
|
|
143
|
+
};
|
|
144
|
+
}();
|
|
145
|
+
var _handleEdit = function handleEdit(index) {
|
|
146
|
+
setCurrent(index);
|
|
147
|
+
setShouldScrollState(true);
|
|
148
|
+
typeof handleEditProp === 'function' && handleEditProp(indexProp);
|
|
149
|
+
};
|
|
150
|
+
var configOfStep1 = _objectSpread(_objectSpread({}, restConfig), {}, {
|
|
151
|
+
label: step1.label,
|
|
152
|
+
elements: [{
|
|
153
|
+
name: KEY_STEP1,
|
|
154
|
+
requiredMessage: formatMessage({
|
|
155
|
+
id: 'Please select at least one item to continue.'
|
|
156
|
+
}),
|
|
157
|
+
render: function render(preview, _, value, onChange) {
|
|
158
|
+
return /*#__PURE__*/_jsx(CheckboxGroupItems, {
|
|
159
|
+
itemsData: itemsData,
|
|
160
|
+
itemsDataConfig: itemsDataConfig,
|
|
161
|
+
value: value,
|
|
162
|
+
onChange: onChange,
|
|
163
|
+
preview: preview
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}]
|
|
167
|
+
});
|
|
168
|
+
var elementsOfStep2 = (itemsData === null || itemsData === void 0 ? void 0 : itemsData.length) === 0 ? [{
|
|
169
|
+
name: KEY_STEP2,
|
|
170
|
+
requiredMessage: formatMessage({
|
|
171
|
+
id: 'Select at least one item to continue'
|
|
172
|
+
}),
|
|
173
|
+
render: function render() {
|
|
174
|
+
return /*#__PURE__*/_jsx("em", {
|
|
175
|
+
children: "Data exception: No Items Data."
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}] : itemsData.filter(function (item) {
|
|
179
|
+
return selectedIdList.includes(item[KEY_ITEM_ID]);
|
|
180
|
+
}).map(function (item, index) {
|
|
181
|
+
return {
|
|
182
|
+
name: index,
|
|
183
|
+
render: function render(preview) {
|
|
184
|
+
return /*#__PURE__*/_jsx(SectionOfItemCondition, {
|
|
185
|
+
ref: function ref(r) {
|
|
186
|
+
if (r && refs.current) {
|
|
187
|
+
refs.current[index] = r;
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
index: index,
|
|
191
|
+
itemData: item,
|
|
192
|
+
itemsDataConfig: itemsDataConfig,
|
|
193
|
+
elements: step2.elements,
|
|
194
|
+
parentName: calcNamePath(namePath, [KEY_STEP2, index]),
|
|
195
|
+
preview: preview
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
});
|
|
200
|
+
var configOfStep2 = _objectSpread(_objectSpread({}, restConfig), {}, {
|
|
201
|
+
label: step2.label,
|
|
202
|
+
name: KEY_STEP2,
|
|
203
|
+
elements: elementsOfStep2
|
|
204
|
+
});
|
|
205
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
206
|
+
children: [configOfStep1, configOfStep2].map(function (config, idx) {
|
|
207
|
+
return /*#__PURE__*/_jsx(Step, {
|
|
208
|
+
config: config,
|
|
209
|
+
parentName: namePath,
|
|
210
|
+
index: indexProp + idx,
|
|
211
|
+
total: total,
|
|
212
|
+
preview: current > idx || preview,
|
|
213
|
+
edit: current === idx && edit,
|
|
214
|
+
handleNext: function handleNext() {
|
|
215
|
+
return _handleNext(idx);
|
|
216
|
+
},
|
|
217
|
+
handleEdit: function handleEdit() {
|
|
218
|
+
return _handleEdit(idx);
|
|
219
|
+
},
|
|
220
|
+
showLastIndex: showLastIndex,
|
|
221
|
+
shouldScroll: shouldScroll
|
|
222
|
+
}, idx);
|
|
223
|
+
})
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
StepItemsSelection.STEP_COUNT = STEP_COUNT;
|
|
227
|
+
export default StepItemsSelection;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/form/steps/index.js
CHANGED
|
@@ -2,22 +2,33 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2
2
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
3
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
4
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
11
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
13
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
14
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
15
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
16
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
17
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
18
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
-
import React, { useState, useContext, useEffect, useReducer, useRef } from 'react';
|
|
20
|
+
import React, { useState, useContext, useEffect, useReducer, useRef, useMemo } from 'react';
|
|
12
21
|
import invariant from 'invariant';
|
|
13
22
|
import classnames from 'classnames';
|
|
14
23
|
import Step from "../step";
|
|
24
|
+
import StepItemsSelection from "../step-items-selection";
|
|
15
25
|
import { calcNamePath, getRuleValidation, calcShouldRender } from "../../utils/form-utils";
|
|
16
26
|
import FormContext from "../../form-context";
|
|
17
27
|
import StepContext from "../../form-step-context";
|
|
18
28
|
import { LocaleContext } from "../../locale";
|
|
19
29
|
import "./style";
|
|
20
30
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
31
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
32
|
var Steps = function Steps(_ref) {
|
|
22
33
|
var parentName = _ref.parentName,
|
|
23
34
|
_ref$config = _ref.config,
|
|
@@ -35,11 +46,14 @@ var Steps = function Steps(_ref) {
|
|
|
35
46
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36
47
|
current = _useState2[0],
|
|
37
48
|
setCurrent = _useState2[1];
|
|
38
|
-
|
|
39
|
-
var _useState3 = useState(false),
|
|
49
|
+
var _useState3 = useState(0),
|
|
40
50
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
currentStepInner = _useState4[0],
|
|
52
|
+
setCurrentStepInner = _useState4[1];
|
|
53
|
+
var _useState5 = useState(false),
|
|
54
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
55
|
+
shouldScroll = _useState6[0],
|
|
56
|
+
setShouldScroll = _useState6[1];
|
|
43
57
|
var _useReducer = useReducer(function (r) {
|
|
44
58
|
return r + 1;
|
|
45
59
|
}, 0),
|
|
@@ -75,10 +89,6 @@ var Steps = function Steps(_ref) {
|
|
|
75
89
|
});
|
|
76
90
|
dependentField.length && registerDependencies(dependentField, dispatch);
|
|
77
91
|
}, []);
|
|
78
|
-
useEffect(function () {
|
|
79
|
-
if (currentStep === undefined || currentStep === current) return;
|
|
80
|
-
setCurrent(currentStep);
|
|
81
|
-
}, [currentStep]);
|
|
82
92
|
var renderElements = elements.filter(function (_ref5) {
|
|
83
93
|
var curName = _ref5.name,
|
|
84
94
|
dependencies = _ref5.dependencies,
|
|
@@ -87,6 +97,33 @@ var Steps = function Steps(_ref) {
|
|
|
87
97
|
shouldRenderCode = _ref5.shouldRenderCode;
|
|
88
98
|
return calcShouldRender(calcNamePath(_parentName, curName), _parentName, dependencies, asserts, shouldRender, shouldRenderCode, form);
|
|
89
99
|
});
|
|
100
|
+
var realRenderElements = renderElements.reduce(function (prev, cur, index) {
|
|
101
|
+
var _prev = _toConsumableArray(prev);
|
|
102
|
+
if (cur.type === 'Step') {
|
|
103
|
+
_prev.push(_objectSpread(_objectSpread({}, cur), {}, {
|
|
104
|
+
index: index
|
|
105
|
+
}));
|
|
106
|
+
} else {
|
|
107
|
+
_prev.push.apply(_prev, _toConsumableArray(Array.from({
|
|
108
|
+
length: StepItemsSelection.STEP_COUNT
|
|
109
|
+
}).map(function (_, idx) {
|
|
110
|
+
return _objectSpread(_objectSpread({}, cur), {}, {
|
|
111
|
+
index: index,
|
|
112
|
+
innerIndex: idx
|
|
113
|
+
});
|
|
114
|
+
})));
|
|
115
|
+
}
|
|
116
|
+
return _prev;
|
|
117
|
+
}, []);
|
|
118
|
+
useEffect(function () {
|
|
119
|
+
if (currentStep === undefined || currentStep === current || !realRenderElements[currentStep]) return;
|
|
120
|
+
var _realRenderElements$c = realRenderElements[currentStep],
|
|
121
|
+
index = _realRenderElements$c.index,
|
|
122
|
+
_realRenderElements$c2 = _realRenderElements$c.innerIndex,
|
|
123
|
+
innerIndex = _realRenderElements$c2 === void 0 ? 0 : _realRenderElements$c2;
|
|
124
|
+
setCurrentStepInner(innerIndex);
|
|
125
|
+
setCurrent(index);
|
|
126
|
+
}, [currentStep]);
|
|
90
127
|
var handleNext = /*#__PURE__*/function () {
|
|
91
128
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
92
129
|
var _allFields$filter;
|
|
@@ -115,7 +152,7 @@ var Steps = function Steps(_ref) {
|
|
|
115
152
|
_context.prev = 10;
|
|
116
153
|
_context.t0 = _context["catch"](5);
|
|
117
154
|
form === null || form === void 0 ? void 0 : form.scrollToField(_context.t0.errorFields[0].name);
|
|
118
|
-
return _context.abrupt("return");
|
|
155
|
+
return _context.abrupt("return", false);
|
|
119
156
|
case 14:
|
|
120
157
|
if (!(validationRule && getRuleValidationApi)) {
|
|
121
158
|
_context.next = 28;
|
|
@@ -132,7 +169,7 @@ var Steps = function Steps(_ref) {
|
|
|
132
169
|
}
|
|
133
170
|
form === null || form === void 0 ? void 0 : form.setFields(res);
|
|
134
171
|
form === null || form === void 0 ? void 0 : form.scrollToField(res[0].name);
|
|
135
|
-
return _context.abrupt("return");
|
|
172
|
+
return _context.abrupt("return", false);
|
|
136
173
|
case 23:
|
|
137
174
|
_context.next = 28;
|
|
138
175
|
break;
|
|
@@ -185,29 +222,54 @@ var Steps = function Steps(_ref) {
|
|
|
185
222
|
var registerSection = function registerSection(name, toggle) {
|
|
186
223
|
sections.current.set(name, toggle);
|
|
187
224
|
};
|
|
225
|
+
var getIndex = function getIndex(index) {
|
|
226
|
+
var prevElements = renderElements.slice(0, index);
|
|
227
|
+
if (prevElements.find(function (ele) {
|
|
228
|
+
return ele.type === 'StepItemsSelection';
|
|
229
|
+
})) {
|
|
230
|
+
return index + (StepItemsSelection.STEP_COUNT - 1);
|
|
231
|
+
}
|
|
232
|
+
return index;
|
|
233
|
+
};
|
|
234
|
+
var total = useMemo(function () {
|
|
235
|
+
return renderElements.reduce(function (prev, cur) {
|
|
236
|
+
if (cur.type === 'StepItemsSelection') {
|
|
237
|
+
return prev + StepItemsSelection.STEP_COUNT;
|
|
238
|
+
}
|
|
239
|
+
return prev + 1;
|
|
240
|
+
}, 0);
|
|
241
|
+
}, [renderElements]);
|
|
188
242
|
return /*#__PURE__*/_jsx("div", {
|
|
189
243
|
className: classnames('igloo-steps-container', className),
|
|
190
244
|
children: /*#__PURE__*/_jsx("div", {
|
|
191
245
|
className: 'igloo-steps-content',
|
|
192
246
|
children: renderElements.map(function (child, index) {
|
|
193
|
-
invariant(child.type === 'Step', 'Child of steps should be Step');
|
|
247
|
+
invariant(child.type === 'Step' || child.type === 'StepItemsSelection', 'Child of steps should be Step or StepItemsSelection');
|
|
248
|
+
invariant(renderElements.filter(function (item) {
|
|
249
|
+
return item.type === 'StepItemsSelection';
|
|
250
|
+
}).length <= 1, 'Only one StepItemsSelection is allowed');
|
|
194
251
|
invariant(!child.validationRule || getRuleValidationApi, 'Please provide getRuleValidationApi in Form props');
|
|
195
|
-
|
|
252
|
+
var stepProps = {
|
|
253
|
+
parentName: _parentName,
|
|
254
|
+
index: getIndex(index),
|
|
255
|
+
total: total,
|
|
256
|
+
preview: current > index,
|
|
257
|
+
edit: current === index,
|
|
258
|
+
handleNext: handleNext,
|
|
259
|
+
handleEdit: handleEdit,
|
|
260
|
+
showLastIndex: showLastIndex,
|
|
261
|
+
shouldScroll: shouldScroll
|
|
262
|
+
};
|
|
263
|
+
return /*#__PURE__*/_jsxs(StepContext.Provider, {
|
|
196
264
|
value: {
|
|
197
265
|
registerSection: registerSection
|
|
198
266
|
},
|
|
199
|
-
children: /*#__PURE__*/_jsx(
|
|
267
|
+
children: [child.type === 'StepItemsSelection' && /*#__PURE__*/_jsx(StepItemsSelection, _objectSpread(_objectSpread({}, stepProps), {}, {
|
|
200
268
|
config: child,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
edit: current === index,
|
|
206
|
-
handleNext: handleNext,
|
|
207
|
-
handleEdit: handleEdit,
|
|
208
|
-
showLastIndex: showLastIndex,
|
|
209
|
-
shouldScroll: shouldScroll
|
|
210
|
-
})
|
|
269
|
+
currentStep: currentStepInner
|
|
270
|
+
})), child.type === 'Step' && /*#__PURE__*/_jsx(Step, _objectSpread(_objectSpread({}, stepProps), {}, {
|
|
271
|
+
config: child
|
|
272
|
+
}))]
|
|
211
273
|
}, child.key || (Array.isArray(child.name) ? child.name.join() : child.name) || index);
|
|
212
274
|
})
|
|
213
275
|
})
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { Input } from 'antd';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import omit from 'omit.js';
|
|
11
|
+
import formMethods from "../../utils/form-methods";
|
|
12
|
+
import "../style/index";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
var BasicInput = function BasicInput(props) {
|
|
15
|
+
var handleOnBlur = function handleOnBlur(e) {
|
|
16
|
+
var value = props.value,
|
|
17
|
+
onChange = props.onChange;
|
|
18
|
+
if (typeof value === 'string') {
|
|
19
|
+
if (value.endsWith('.')) {
|
|
20
|
+
e.target.value = value.replace('.', '');
|
|
21
|
+
}
|
|
22
|
+
if (value.endsWith('0') && value.includes('.')) {
|
|
23
|
+
e.target.value = value.replace(/[0]+$/, '');
|
|
24
|
+
}
|
|
25
|
+
onChange && onChange(e);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return /*#__PURE__*/_jsx(Input, _objectSpread(_objectSpread({}, omit(props, formMethods)), {}, {
|
|
29
|
+
onBlur: handleOnBlur,
|
|
30
|
+
type: "number",
|
|
31
|
+
className: classNames('igloo-input', props.className)
|
|
32
|
+
}));
|
|
33
|
+
};
|
|
34
|
+
export default BasicInput;
|
|
@@ -1,44 +1,79 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["mode"];
|
|
2
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
7
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { staticFormatMessage as formatMessage } from "../locale";
|
|
13
|
-
import "./style/index";
|
|
8
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
+
import { staticFormatMessage as formatMessage } from "../../locale";
|
|
11
|
+
import NumberStepper from "./stepper";
|
|
12
|
+
import BasicInput from "./basic";
|
|
14
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
14
|
var IglooInputNumber = function IglooInputNumber(props) {
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (value.endsWith('0') && value.includes('.')) {
|
|
24
|
-
e.target.value = value.replace(/[0]+$/, '');
|
|
25
|
-
}
|
|
26
|
-
onChange && onChange(e);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
return /*#__PURE__*/_jsx(Input, _objectSpread(_objectSpread({}, omit(props, formMethods)), {}, {
|
|
30
|
-
onBlur: handleOnBlur,
|
|
31
|
-
type: "number",
|
|
32
|
-
className: classNames('igloo-input', props.className)
|
|
33
|
-
}));
|
|
15
|
+
var _props$mode = props.mode,
|
|
16
|
+
mode = _props$mode === void 0 ? 'default' : _props$mode,
|
|
17
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
18
|
+
if (mode === 'step') {
|
|
19
|
+
return /*#__PURE__*/_jsx(NumberStepper, _objectSpread({}, rest));
|
|
20
|
+
}
|
|
21
|
+
return /*#__PURE__*/_jsx(BasicInput, _objectSpread({}, rest));
|
|
34
22
|
};
|
|
35
23
|
IglooInputNumber.formItemPropsHandler = function (config) {
|
|
36
|
-
var
|
|
24
|
+
var max = config.max,
|
|
25
|
+
min = config.min,
|
|
26
|
+
length = config.length,
|
|
37
27
|
maxLength = config.maxLength,
|
|
38
28
|
minLength = config.minLength,
|
|
39
29
|
label = config.label,
|
|
40
|
-
pattern = config.pattern
|
|
30
|
+
pattern = config.pattern,
|
|
31
|
+
_config$mode = config.mode,
|
|
32
|
+
mode = _config$mode === void 0 ? 'default' : _config$mode;
|
|
41
33
|
var rules = [];
|
|
34
|
+
if (min !== undefined && max === undefined) {
|
|
35
|
+
rules.push({
|
|
36
|
+
validator: function validator(_, value) {
|
|
37
|
+
if (value === undefined || value === null || Number(value) >= min) return Promise.resolve();
|
|
38
|
+
return Promise.reject(formatMessage({
|
|
39
|
+
id: '{label} must be greater than {min}.',
|
|
40
|
+
values: {
|
|
41
|
+
min: min,
|
|
42
|
+
label: label
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (max !== undefined && min === undefined) {
|
|
49
|
+
rules.push({
|
|
50
|
+
validator: function validator(_, value) {
|
|
51
|
+
if (value === undefined || value === null || Number(value) <= max) return Promise.resolve();
|
|
52
|
+
return Promise.reject(formatMessage({
|
|
53
|
+
id: '{label} must be less than {max}.',
|
|
54
|
+
values: {
|
|
55
|
+
max: max,
|
|
56
|
+
label: label
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (min !== undefined && max !== undefined) {
|
|
63
|
+
rules.push({
|
|
64
|
+
validator: function validator(_, value) {
|
|
65
|
+
if (Number(value) >= min && Number(value) <= max) return Promise.resolve();
|
|
66
|
+
return Promise.reject(formatMessage({
|
|
67
|
+
id: '{label} must be between {min} and {max}.',
|
|
68
|
+
values: {
|
|
69
|
+
min: min,
|
|
70
|
+
max: max,
|
|
71
|
+
label: label
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
42
77
|
if (length !== undefined) {
|
|
43
78
|
rules.push({
|
|
44
79
|
validator: function validator(_, value) {
|
|
@@ -110,7 +145,9 @@ IglooInputNumber.formItemPropsHandler = function (config) {
|
|
|
110
145
|
}
|
|
111
146
|
});
|
|
112
147
|
}
|
|
113
|
-
return {
|
|
148
|
+
return Object.assign({
|
|
149
|
+
rules: rules
|
|
150
|
+
}, mode === 'default' ? {
|
|
114
151
|
getValueFromEvent: function getValueFromEvent(e) {
|
|
115
152
|
var value = e.target.value;
|
|
116
153
|
var str = value.replaceAll(/[^0-9\.-]/g, '');
|
|
@@ -118,8 +155,7 @@ IglooInputNumber.formItemPropsHandler = function (config) {
|
|
|
118
155
|
return str;
|
|
119
156
|
}
|
|
120
157
|
return str ? parseFloat(str) : undefined;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
};
|
|
158
|
+
}
|
|
159
|
+
} : {});
|
|
124
160
|
};
|
|
125
161
|
export default IglooInputNumber;
|