iglooform 2.5.52 → 3.0.0-alpha
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/overrides.less +70 -0
- package/.dumi/tmp/core/EmptyRoute.tsx +9 -0
- package/.dumi/tmp/core/defineApp.ts +17 -0
- package/.dumi/tmp/core/exportStaticRuntimePlugin.ts +11 -0
- package/.dumi/tmp/core/helmet.ts +10 -0
- package/.dumi/tmp/core/helmetContext.ts +4 -0
- package/.dumi/tmp/core/history.ts +66 -0
- package/.dumi/tmp/core/historyIntelli.ts +132 -0
- package/.dumi/tmp/core/plugin.ts +60 -0
- package/.dumi/tmp/core/pluginConfig.ts +292 -0
- package/.dumi/tmp/core/pluginConfigJoi.d.ts +54 -0
- package/.dumi/tmp/core/polyfill.ts +201 -0
- package/.dumi/tmp/core/route.tsx +50 -0
- package/.dumi/tmp/core/terminal.ts +37 -0
- package/.dumi/tmp/dumi/exports.ts +5 -0
- package/.dumi/tmp/dumi/locales/config.ts +87 -0
- package/.dumi/tmp/dumi/locales/runtime.tsx +39 -0
- package/.dumi/tmp/dumi/meta/atoms.ts +4 -0
- package/.dumi/tmp/dumi/meta/index.ts +255 -0
- package/.dumi/tmp/dumi/meta/runtime.ts +31 -0
- package/.dumi/tmp/dumi/meta/tabs.ts +5 -0
- package/.dumi/tmp/dumi/theme/ContextWrapper.tsx +58 -0
- package/.dumi/tmp/dumi/theme/builtins/API.ts +4 -0
- package/.dumi/tmp/dumi/theme/builtins/Badge.ts +4 -0
- package/.dumi/tmp/dumi/theme/builtins/Container.ts +4 -0
- package/.dumi/tmp/dumi/theme/builtins/Previewer.ts +4 -0
- package/.dumi/tmp/dumi/theme/builtins/SourceCode.ts +4 -0
- package/.dumi/tmp/dumi/theme/builtins/Table.ts +4 -0
- package/.dumi/tmp/dumi/theme/builtins/Tree.ts +4 -0
- package/.dumi/tmp/dumi/theme/layouts/DocLayout.ts +4 -0
- package/.dumi/tmp/dumi/theme/nprogress.css +59 -0
- package/.dumi/tmp/dumi/theme/slots/ColorSwitch.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/Content.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/ContentTabs.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/Features.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/Footer.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/Header.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/HeaderExtra.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/Hero.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/HeroTitle.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/LangSwitch.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/Logo.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/Navbar.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/NavbarExtra.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/NotFound.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/PreviewerActions.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/PreviewerActionsExtra.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/RtlSwitch.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/SearchBar.ts +5 -0
- package/.dumi/tmp/dumi/theme/slots/SearchResult.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/Sidebar.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/SocialIcon.ts +4 -0
- package/.dumi/tmp/dumi/theme/slots/Toc.ts +4 -0
- package/.dumi/tmp/exports.ts +17 -0
- package/.dumi/tmp/plugin-antd/runtime.tsx +65 -0
- package/.dumi/tmp/plugin-antd/runtimeConfig.d.ts +6 -0
- package/.dumi/tmp/plugin-antd/types.d.ts +14 -0
- package/.dumi/tmp/plugin-html2sketch/index.ts +35 -0
- package/.dumi/tmp/testBrowser.tsx +90 -0
- package/.dumi/tmp/umi.ts +106 -0
- package/.dumirc.ts +27 -0
- package/es/admin-upload/float.d.ts +2 -2
- package/es/admin-upload/float.js +30 -42
- package/es/admin-upload/index.js +178 -242
- package/es/admin-upload/job-list.js +90 -105
- package/es/admin-upload/modal.d.ts +2 -2
- package/es/admin-upload/modal.js +31 -45
- package/es/admin-upload/style/index.js +1 -1
- package/es/admin-upload/style/index.less +6 -6
- package/es/alert-message/index.js +23 -36
- package/es/alert-message/style/index.js +1 -1
- package/es/alert-message/style/index.less +1 -1
- package/es/amount/index.js +17 -25
- package/es/amount/style/index.d.ts +0 -1
- package/es/amount/style/index.js +0 -1
- package/es/back-top/index.js +18 -32
- package/es/back-top/style/index.js +1 -1
- package/es/back-top/style/index.less +36 -25
- package/es/button/index.js +57 -88
- package/es/button/style/index.js +1 -1
- package/es/button/style/index.less +159 -109
- package/es/card-detail/card-group.d.ts +2 -2
- package/es/card-detail/card-group.js +14 -22
- package/es/card-detail/card-item.d.ts +2 -2
- package/es/card-detail/card-item.js +12 -23
- package/es/card-detail/card-page.js +18 -24
- package/es/card-detail/card.js +21 -32
- package/es/card-detail/index.js +4 -4
- package/es/card-detail/style/index.js +1 -1
- package/es/card-detail/style/index.less +4 -4
- package/es/card-detail/utils.d.ts +2 -2
- package/es/card-detail/utils.js +15 -21
- package/es/checkbox/index.d.ts +3 -2
- package/es/checkbox/index.js +73 -96
- package/es/checkbox/style/index.js +1 -1
- package/es/checkbox/style/index.less +42 -20
- package/es/claim-list/index.d.ts +1 -1
- package/es/claim-list/index.js +83 -129
- package/es/claim-list/style/index.js +1 -1
- package/es/claim-list/style/index.less +14 -8
- package/es/confirmation/index.js +29 -47
- package/es/confirmation/style/index.d.ts +0 -1
- package/es/confirmation/style/index.js +0 -1
- package/es/currency-context/style/index.d.ts +0 -1
- package/es/currency-context/style/index.js +0 -1
- package/es/date-picker/buddhist.js +31 -46
- package/es/date-picker/index.d.ts +2 -2
- package/es/date-picker/index.js +89 -118
- package/es/date-picker/style/index.js +1 -1
- package/es/date-picker/style/index.less +43 -22
- package/es/declaration/index.js +21 -34
- package/es/declaration/style/index.js +1 -1
- package/es/declaration/style/index.less +3 -3
- package/es/detail-panel/index.d.ts +2 -2
- package/es/detail-panel/index.js +48 -67
- package/es/detail-panel/style/index.js +1 -1
- package/es/detail-panel/style/index.less +3 -3
- package/es/documents/index.js +55 -73
- package/es/documents/style/index.js +1 -1
- package/es/filter/checkBox.d.ts +1 -1
- package/es/filter/checkBox.js +43 -64
- package/es/filter/customize.d.ts +1 -1
- package/es/filter/customize.js +8 -10
- package/es/filter/index.d.ts +1 -1
- package/es/filter/index.js +261 -359
- package/es/filter/radioBox.d.ts +1 -1
- package/es/filter/radioBox.js +26 -35
- package/es/filter/rangePicker.d.ts +1 -1
- package/es/filter/rangePicker.js +64 -83
- package/es/filter/style/index.js +1 -1
- package/es/filter/style/index.less +11 -11
- package/es/form/addable-section/index.js +71 -110
- package/es/form/addable-section/style/index.js +1 -1
- package/es/form/divider/index.js +11 -18
- package/es/form/divider/style/index.js +1 -1
- package/es/form/element/index.js +81 -140
- package/es/form/element/style/index.js +1 -1
- package/es/form/element/style/index.less +5 -5
- package/es/form/elements.js +15 -18
- package/es/form/hstep/index.js +53 -77
- package/es/form/hstep/style/index.js +1 -1
- package/es/form/hstep/style/index.less +2 -2
- package/es/form/hsteps/index.js +187 -245
- package/es/form/hsteps/style/index.js +1 -1
- package/es/form/index.js +133 -194
- package/es/form/login/index.js +24 -35
- package/es/form/login/style/index.js +1 -1
- package/es/form/login/style/index.less +1 -1
- package/es/form/page/index.js +42 -60
- package/es/form/page/style/index.js +1 -1
- package/es/form/pages/index.js +102 -139
- package/es/form/pages/style/index.js +1 -1
- package/es/form/render/index.js +12 -17
- package/es/form/render/style/index.js +1 -1
- package/es/form/section/index.js +58 -81
- package/es/form/section/style/index.js +1 -1
- package/es/form/step/index.js +57 -84
- package/es/form/step/style/index.js +1 -1
- package/es/form/step/style/index.less +3 -3
- package/es/form/steps/index.js +129 -174
- package/es/form/steps/style/index.js +1 -1
- package/es/form/style/index.js +1 -1
- package/es/form/style/index.less +1 -1
- package/es/form-context.d.ts +1 -1
- package/es/form-step-context.d.ts +1 -1
- package/es/free-form/addable-section/index.js +79 -137
- package/es/free-form/addable-section/style/index.js +1 -1
- package/es/free-form/element/index.js +63 -115
- package/es/free-form/element/style/index.js +1 -1
- package/es/free-form/element/style/index.less +4 -4
- package/es/free-form/index.d.ts +2 -2
- package/es/free-form/index.js +107 -157
- package/es/free-form/page/index.js +106 -144
- package/es/free-form/page/style/index.js +1 -1
- package/es/free-form/pages/index.js +17 -36
- package/es/free-form/pages/style/index.js +1 -1
- package/es/free-form/section/index.js +49 -87
- package/es/free-form/section/style/index.js +1 -1
- package/es/free-form/step/index.js +141 -197
- package/es/free-form/step/style/index.js +1 -1
- package/es/free-form/step/style/index.less +3 -3
- package/es/free-form/steps/index.d.ts +2 -2
- package/es/free-form/steps/index.js +37 -60
- package/es/free-form/steps/style/index.js +1 -1
- package/es/free-form/style/index.js +1 -1
- package/es/free-form/style/index.less +1 -1
- package/es/global-message/index.d.ts +1 -1
- package/es/global-message/index.js +23 -35
- package/es/global-message/style/index.js +1 -1
- package/es/global-message/style/index.less +4 -0
- package/es/home-menu/index.d.ts +1 -1
- package/es/home-menu/index.js +46 -63
- package/es/home-menu/style/index.js +1 -1
- package/es/home-menu/style/index.less +12 -7
- package/es/index.js +44 -44
- package/es/input/amount.js +28 -44
- package/es/input/credit-card.js +40 -78
- package/es/input/email.js +13 -16
- package/es/input/expiry-date.js +59 -96
- package/es/input/index.js +12 -12
- package/es/input/input-date.js +48 -88
- package/es/input/input-id.js +18 -31
- package/es/input/input-number.js +19 -35
- package/es/input/input.js +17 -27
- package/es/input/otp.d.ts +1 -1
- package/es/input/otp.js +51 -79
- package/es/input/password.js +15 -19
- package/es/input/phone-number.js +31 -50
- package/es/input/style/index.js +1 -1
- package/es/input/style/index.less +68 -70
- package/es/input/text-area.js +31 -55
- package/es/layout/defaultFooter.js +38 -43
- package/es/layout/defaultHeader.js +11 -16
- package/es/layout/footer.js +79 -85
- package/es/layout/header.js +61 -94
- package/es/layout/index.d.ts +2 -3
- package/es/layout/index.js +32 -48
- package/es/layout/style/index.js +1 -1
- package/es/layout/style/index.less +2 -2
- package/es/locale/en-US.js +1 -2
- package/es/locale/format-message.js +2 -6
- package/es/locale/formatted-message.js +2 -3
- package/es/locale/id-ID.js +1 -2
- package/es/locale/index.js +4 -4
- package/es/locale/locale-context.js +2 -4
- package/es/locale/locale-provider.d.ts +2 -1
- package/es/locale/locale-provider.js +20 -28
- package/es/locale/ms-MY.js +1 -2
- package/es/locale/th-TH.js +1 -2
- package/es/locale/vi-VN.js +1 -2
- package/es/locale/zh-CN.js +1 -2
- package/es/locale/zh-TW.js +1 -2
- package/es/login-page/index.d.ts +2 -2
- package/es/login-page/index.js +24 -29
- package/es/login-page/style/index.js +1 -1
- package/es/media/index.js +59 -104
- package/es/media/media.js +27 -45
- package/es/media/preview.js +103 -149
- package/es/media/style/index.js +1 -1
- package/es/media/style/index.less +6 -6
- package/es/mobile-insurer-detail/index.d.ts +1 -1
- package/es/mobile-insurer-detail/index.js +52 -59
- package/es/mobile-insurer-detail/style/index.js +1 -1
- package/es/mobile-insurer-list/index.d.ts +1 -1
- package/es/mobile-insurer-list/index.js +34 -37
- package/es/mobile-insurer-list/style/index.js +1 -1
- package/es/modal/index.d.ts +2 -2
- package/es/modal/index.js +136 -154
- package/es/modal/style/index.js +1 -1
- package/es/modal/style/index.less +59 -51
- package/es/platform/index.js +2 -2
- package/es/platform/platform-card/index.js +18 -29
- package/es/platform/platform-card/style/index.js +1 -1
- package/es/platform/switch-platform/index.js +29 -53
- package/es/platform/switch-platform/style/index.js +1 -1
- package/es/platform/switch-platform/style/index.less +1 -1
- package/es/policy-list/index.d.ts +1 -1
- package/es/policy-list/index.js +21 -30
- package/es/policy-list/policy-card.d.ts +1 -1
- package/es/policy-list/policy-card.js +107 -142
- package/es/policy-list/style/index.js +1 -1
- package/es/policy-list/style/index.less +1 -0
- package/es/radio/index.d.ts +2 -1
- package/es/radio/index.js +65 -85
- package/es/radio/radio-group-with-other.d.ts +3 -2
- package/es/radio/radio-group-with-other.js +30 -55
- package/es/radio/style/index.js +1 -1
- package/es/radio/style/index.less +63 -45
- package/es/search-box/index.js +66 -98
- package/es/search-box/style/index.js +1 -1
- package/es/search-box/style/index.less +2 -2
- package/es/select/attached-select.d.ts +3 -3
- package/es/select/attached-select.js +67 -107
- package/es/select/index.js +3 -3
- package/es/select/select.d.ts +3 -3
- package/es/select/select.js +33 -50
- package/es/select/style/index.js +1 -1
- package/es/select/style/index.less +154 -112
- package/es/select/time-select.js +64 -108
- package/es/status-box/index.d.ts +2 -3
- package/es/status-box/index.js +14 -16
- package/es/status-box/style/index.js +1 -1
- package/es/status-box/style/index.less +2 -2
- package/es/table/index.js +119 -168
- package/es/table/style/index.js +1 -1
- package/es/table/style/index.less +137 -109
- package/es/tabs/index.d.ts +4 -3
- package/es/tabs/index.js +12 -16
- package/es/tabs/style/index.js +1 -1
- package/es/types.d.ts +1 -2
- package/es/types.js +2 -1
- package/es/typography/index.d.ts +2 -1
- package/es/typography/index.js +11 -17
- package/es/typography/style/index.js +1 -1
- package/es/typography/style/index.less +4 -0
- package/es/upload/index.js +253 -335
- package/es/upload/style/index.js +1 -1
- package/es/upload/style/index.less +8 -6
- package/es/upload-photo/index.js +321 -450
- package/es/upload-photo/media.js +16 -29
- package/es/upload-photo/style/index.js +1 -1
- package/es/upload-photo/style/index.less +4 -4
- package/es/upload-preview/index.js +63 -85
- package/es/upload-preview/media.js +42 -77
- package/es/upload-preview/style/index.js +1 -1
- package/es/upload-preview/style/index.less +1 -1
- package/es/utils/form-methods.js +1 -1
- package/es/utils/form-utils.d.ts +9 -8
- package/es/utils/form-utils.js +162 -260
- package/es/utils/option-utils.d.ts +3 -2
- package/es/utils/option-utils.js +106 -163
- package/es/utils/tools.js +0 -8
- package/lib/admin-upload/float.d.ts +2 -2
- package/lib/admin-upload/float.js +27 -46
- package/lib/admin-upload/index.js +171 -251
- package/lib/admin-upload/job-list.js +82 -109
- package/lib/admin-upload/modal.d.ts +2 -2
- package/lib/admin-upload/modal.js +27 -52
- package/lib/admin-upload/style/index.less +6 -6
- package/lib/alert-message/index.js +21 -43
- package/lib/alert-message/style/index.less +1 -1
- package/lib/amount/index.js +15 -31
- package/lib/amount/style/index.d.ts +0 -1
- package/lib/back-top/index.js +17 -39
- package/lib/back-top/style/index.less +36 -25
- package/lib/button/index.js +54 -101
- package/lib/button/style/index.less +159 -109
- package/lib/card-detail/card-group.d.ts +2 -2
- package/lib/card-detail/card-group.js +11 -29
- package/lib/card-detail/card-item.d.ts +2 -2
- package/lib/card-detail/card-item.js +9 -27
- package/lib/card-detail/card-page.js +14 -29
- package/lib/card-detail/card.js +17 -37
- package/lib/card-detail/index.js +0 -5
- package/lib/card-detail/style/index.less +4 -4
- package/lib/card-detail/utils.d.ts +2 -2
- package/lib/card-detail/utils.js +13 -28
- package/lib/checkbox/index.d.ts +3 -2
- package/lib/checkbox/index.js +64 -107
- package/lib/checkbox/style/index.less +42 -20
- package/lib/claim-list/index.d.ts +1 -1
- package/lib/claim-list/index.js +75 -143
- package/lib/claim-list/style/index.less +14 -8
- package/lib/confirmation/index.js +22 -50
- package/lib/confirmation/style/index.d.ts +0 -1
- package/lib/currency-context/index.js +0 -3
- package/lib/currency-context/style/index.d.ts +0 -1
- package/lib/date-picker/buddhist.js +34 -61
- package/lib/date-picker/index.d.ts +2 -2
- package/lib/date-picker/index.js +98 -145
- package/lib/date-picker/style/index.less +43 -22
- package/lib/declaration/index.js +17 -42
- package/lib/declaration/style/index.less +3 -3
- package/lib/detail-panel/index.d.ts +2 -2
- package/lib/detail-panel/index.js +44 -77
- package/lib/detail-panel/style/index.less +3 -3
- package/lib/documents/index.js +56 -78
- package/lib/filter/checkBox.d.ts +1 -1
- package/lib/filter/checkBox.js +40 -74
- package/lib/filter/customize.d.ts +1 -1
- package/lib/filter/customize.js +6 -14
- package/lib/filter/index.d.ts +1 -1
- package/lib/filter/index.js +258 -382
- package/lib/filter/radioBox.d.ts +1 -1
- package/lib/filter/radioBox.js +24 -45
- package/lib/filter/rangePicker.d.ts +1 -1
- package/lib/filter/rangePicker.js +64 -96
- package/lib/filter/style/index.less +11 -11
- package/lib/form/addable-section/index.js +65 -121
- package/lib/form/divider/index.js +9 -24
- package/lib/form/element/index.js +73 -156
- package/lib/form/element/style/index.less +5 -5
- package/lib/form/elements.js +1 -24
- package/lib/form/hstep/index.js +44 -87
- package/lib/form/hstep/style/index.less +2 -2
- package/lib/form/hsteps/index.js +177 -257
- package/lib/form/index.js +124 -201
- package/lib/form/login/index.js +18 -46
- package/lib/form/login/style/index.less +1 -1
- package/lib/form/page/index.js +35 -69
- package/lib/form/pages/index.js +94 -148
- package/lib/form/render/index.js +15 -21
- package/lib/form/section/index.js +52 -92
- package/lib/form/step/index.js +50 -96
- package/lib/form/step/style/index.less +3 -3
- package/lib/form/steps/index.js +125 -179
- package/lib/form/style/index.less +1 -1
- package/lib/form-context.d.ts +1 -1
- package/lib/form-context.js +0 -4
- package/lib/form-step-context.d.ts +1 -1
- package/lib/form-step-context.js +0 -4
- package/lib/free-form/addable-section/index.js +73 -148
- package/lib/free-form/element/index.js +58 -131
- package/lib/free-form/element/style/index.less +4 -4
- package/lib/free-form/index.d.ts +2 -2
- package/lib/free-form/index.js +104 -164
- package/lib/free-form/page/index.js +99 -150
- package/lib/free-form/pages/index.js +18 -39
- package/lib/free-form/section/index.js +46 -94
- package/lib/free-form/step/index.js +135 -209
- package/lib/free-form/step/style/index.less +3 -3
- package/lib/free-form/steps/index.d.ts +2 -2
- package/lib/free-form/steps/index.js +34 -66
- package/lib/free-form/style/index.less +1 -1
- package/lib/global-message/index.d.ts +1 -1
- package/lib/global-message/index.js +22 -40
- package/lib/global-message/style/index.less +4 -0
- package/lib/home-menu/index.d.ts +1 -1
- package/lib/home-menu/index.js +43 -74
- package/lib/home-menu/style/index.less +12 -7
- package/lib/index.js +0 -50
- package/lib/input/amount.js +25 -50
- package/lib/input/credit-card.js +37 -85
- package/lib/input/email.js +11 -20
- package/lib/input/expiry-date.js +54 -102
- package/lib/input/index.js +0 -14
- package/lib/input/input-date.js +46 -98
- package/lib/input/input-id.js +15 -35
- package/lib/input/input-number.js +16 -39
- package/lib/input/input.js +14 -33
- package/lib/input/otp.d.ts +1 -1
- package/lib/input/otp.js +47 -87
- package/lib/input/password.js +14 -25
- package/lib/input/phone-number.js +27 -56
- package/lib/input/style/index.less +68 -70
- package/lib/input/text-area.js +27 -61
- package/lib/layout/defaultFooter.js +33 -49
- package/lib/layout/defaultHeader.js +10 -21
- package/lib/layout/footer.js +74 -93
- package/lib/layout/header.js +56 -110
- package/lib/layout/index.d.ts +2 -3
- package/lib/layout/index.js +26 -52
- package/lib/layout/style/index.less +2 -2
- package/lib/locale/en-US.js +1 -3
- package/lib/locale/format-message.js +1 -7
- package/lib/locale/formatted-message.js +1 -6
- package/lib/locale/id-ID.js +1 -3
- package/lib/locale/index.js +0 -5
- package/lib/locale/locale-context.js +1 -7
- package/lib/locale/locale-provider.d.ts +2 -1
- package/lib/locale/locale-provider.js +18 -49
- package/lib/locale/ms-MY.js +1 -3
- package/lib/locale/th-TH.js +1 -3
- package/lib/locale/vi-VN.js +1 -3
- package/lib/locale/zh-CN.js +1 -3
- package/lib/locale/zh-TW.js +1 -3
- package/lib/login-page/index.d.ts +2 -2
- package/lib/login-page/index.js +22 -34
- package/lib/media/index.js +57 -110
- package/lib/media/media.js +28 -51
- package/lib/media/preview.js +99 -159
- package/lib/media/style/index.less +6 -6
- package/lib/mobile-insurer-detail/index.d.ts +1 -1
- package/lib/mobile-insurer-detail/index.js +46 -62
- package/lib/mobile-insurer-list/index.d.ts +1 -1
- package/lib/mobile-insurer-list/index.js +30 -42
- package/lib/modal/index.d.ts +2 -2
- package/lib/modal/index.js +130 -163
- package/lib/modal/style/index.less +59 -51
- package/lib/platform/index.js +0 -3
- package/lib/platform/platform-card/index.js +15 -34
- package/lib/platform/switch-platform/index.js +26 -64
- package/lib/platform/switch-platform/style/index.less +1 -1
- package/lib/policy-list/index.d.ts +1 -1
- package/lib/policy-list/index.js +18 -35
- package/lib/policy-list/policy-card.d.ts +1 -1
- package/lib/policy-list/policy-card.js +101 -152
- package/lib/policy-list/style/index.less +1 -0
- package/lib/radio/index.d.ts +2 -1
- package/lib/radio/index.js +58 -97
- package/lib/radio/radio-group-with-other.d.ts +3 -2
- package/lib/radio/radio-group-with-other.js +26 -58
- package/lib/radio/style/index.less +63 -45
- package/lib/search-box/index.js +57 -103
- package/lib/search-box/style/index.less +2 -2
- package/lib/select/attached-select.d.ts +3 -3
- package/lib/select/attached-select.js +59 -118
- package/lib/select/index.js +0 -5
- package/lib/select/select.d.ts +3 -3
- package/lib/select/select.js +29 -61
- package/lib/select/style/index.less +154 -112
- package/lib/select/time-select.js +58 -115
- package/lib/status-box/index.d.ts +2 -3
- package/lib/status-box/index.js +12 -19
- package/lib/status-box/style/index.less +2 -2
- package/lib/table/index.js +115 -196
- package/lib/table/style/index.less +137 -109
- package/lib/tabs/index.d.ts +4 -3
- package/lib/tabs/index.js +11 -23
- package/lib/types.d.ts +1 -2
- package/lib/types.js +8 -1
- package/lib/typography/index.d.ts +2 -1
- package/lib/typography/index.js +10 -20
- package/lib/typography/style/index.less +4 -0
- package/lib/upload/index.js +242 -344
- package/lib/upload/style/index.less +8 -6
- package/lib/upload-photo/index.js +309 -467
- package/lib/upload-photo/media.js +18 -32
- package/lib/upload-photo/style/index.less +4 -4
- package/lib/upload-preview/index.js +55 -90
- package/lib/upload-preview/media.js +36 -87
- package/lib/upload-preview/style/index.less +1 -1
- package/lib/utils/agent-detect.js +0 -1
- package/lib/utils/form-methods.js +1 -1
- package/lib/utils/form-utils.d.ts +9 -8
- package/lib/utils/form-utils.js +168 -288
- package/lib/utils/option-utils.d.ts +3 -2
- package/lib/utils/option-utils.js +105 -173
- package/lib/utils/tools.js +0 -11
- package/package.json +15 -18
- package/lib/global.less +0 -63
- /package/{es → .dumi}/global.less +0 -0
package/es/upload-photo/index.js
CHANGED
|
@@ -1,146 +1,108 @@
|
|
|
1
|
-
import "antd/es/badge/style";
|
|
2
|
-
import _Badge from "antd/es/badge";
|
|
3
|
-
import "antd/es/space/style";
|
|
4
|
-
import _Space from "antd/es/space";
|
|
5
|
-
import "antd/es/col/style";
|
|
6
|
-
import _Col from "antd/es/col";
|
|
7
|
-
import "antd/es/row/style";
|
|
8
|
-
import _Row from "antd/es/row";
|
|
9
|
-
import "antd/es/grid/style";
|
|
10
|
-
import _Grid from "antd/es/grid";
|
|
11
|
-
|
|
12
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); }
|
|
13
|
-
|
|
14
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; }
|
|
15
|
-
|
|
16
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; }
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
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); }
|
|
20
7
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
21
|
-
|
|
22
8
|
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."); }
|
|
23
|
-
|
|
24
9
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
25
|
-
|
|
26
10
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
27
|
-
|
|
28
11
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
29
|
-
|
|
30
12
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
31
|
-
|
|
32
13
|
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."); }
|
|
33
|
-
|
|
34
14
|
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); }
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
39
|
-
|
|
15
|
+
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; }
|
|
16
|
+
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; } }
|
|
40
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
41
|
-
|
|
18
|
+
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; }
|
|
42
19
|
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); } }
|
|
43
|
-
|
|
44
20
|
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); }); }; }
|
|
45
|
-
|
|
46
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
47
21
|
import { useState, useEffect, useMemo, useContext, useRef } from 'react';
|
|
48
|
-
import { LocaleContext } from
|
|
49
|
-
import
|
|
50
|
-
import
|
|
51
|
-
import
|
|
22
|
+
import { LocaleContext } from "../locale";
|
|
23
|
+
import { Row, Col, Badge, Space, Grid } from 'antd';
|
|
24
|
+
import Modal from "../modal";
|
|
25
|
+
import "./style/index.less";
|
|
26
|
+
import IglooTypography from "../typography";
|
|
52
27
|
import invariant from 'invariant';
|
|
53
28
|
import classnames from 'classnames';
|
|
54
|
-
import UploadPreview from
|
|
55
|
-
import { isMobileAgent } from
|
|
29
|
+
import UploadPreview from "../upload-preview";
|
|
30
|
+
import { isMobileAgent } from "../utils/agent-detect";
|
|
56
31
|
import { UploadOutlined, LoadingOutlined, ErrorFilled, ShowOutlined, RefreshOutlined } from 'iglooicon';
|
|
57
|
-
import Preview from
|
|
58
|
-
import { classifyType } from
|
|
59
|
-
import MediaItem from
|
|
60
|
-
import FormContext from
|
|
61
|
-
|
|
32
|
+
import Preview from "../upload-preview/media";
|
|
33
|
+
import { classifyType } from "../utils/tools";
|
|
34
|
+
import MediaItem from "./media";
|
|
35
|
+
import FormContext from "../form-context";
|
|
36
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
37
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
38
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
39
|
+
var useBreakpoint = Grid.useBreakpoint;
|
|
62
40
|
var prefix = 'igloo-upload-photo';
|
|
63
|
-
|
|
64
41
|
function ClassifyType(type) {
|
|
65
42
|
if (type.includes('image')) {
|
|
66
43
|
return 'image';
|
|
67
44
|
}
|
|
68
|
-
|
|
69
45
|
if (type.includes('video')) {
|
|
70
46
|
return 'video';
|
|
71
47
|
}
|
|
72
|
-
|
|
73
48
|
if (type.includes('pdf')) {
|
|
74
49
|
return 'pdf';
|
|
75
50
|
}
|
|
76
|
-
|
|
77
51
|
return 'unknown';
|
|
78
52
|
}
|
|
79
|
-
|
|
80
53
|
var getFileType = /*#__PURE__*/function () {
|
|
81
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/
|
|
54
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(src) {
|
|
82
55
|
var r, contentType;
|
|
83
|
-
return
|
|
84
|
-
while (1) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
case 11:
|
|
104
|
-
case "end":
|
|
105
|
-
return _context.stop();
|
|
106
|
-
}
|
|
56
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
57
|
+
while (1) switch (_context.prev = _context.next) {
|
|
58
|
+
case 0:
|
|
59
|
+
_context.prev = 0;
|
|
60
|
+
_context.next = 3;
|
|
61
|
+
return fetch(src, {
|
|
62
|
+
cache: 'force-cache'
|
|
63
|
+
});
|
|
64
|
+
case 3:
|
|
65
|
+
r = _context.sent;
|
|
66
|
+
contentType = r.headers.get('content-type');
|
|
67
|
+
return _context.abrupt("return", ClassifyType(contentType));
|
|
68
|
+
case 8:
|
|
69
|
+
_context.prev = 8;
|
|
70
|
+
_context.t0 = _context["catch"](0);
|
|
71
|
+
return _context.abrupt("return", 'unknown');
|
|
72
|
+
case 11:
|
|
73
|
+
case "end":
|
|
74
|
+
return _context.stop();
|
|
107
75
|
}
|
|
108
76
|
}, _callee, null, [[0, 8]]);
|
|
109
77
|
}));
|
|
110
|
-
|
|
111
78
|
return function getFileType(_x) {
|
|
112
79
|
return _ref.apply(this, arguments);
|
|
113
80
|
};
|
|
114
81
|
}();
|
|
115
|
-
|
|
116
82
|
var UploadPhoto = function UploadPhoto(props) {
|
|
117
83
|
var _classnames3, _classnames4;
|
|
118
|
-
|
|
119
84
|
var limitNumError = useRef();
|
|
120
85
|
var DomRef = useRef();
|
|
121
86
|
var dataUrlRef = useRef([]);
|
|
122
|
-
|
|
123
87
|
var _useContext = useContext(FormContext),
|
|
124
|
-
|
|
125
|
-
|
|
88
|
+
uploadApi = _useContext.uploadApi;
|
|
126
89
|
invariant(typeof props.handleUpload === 'function' || uploadApi, '"handleUpload" should be a function. Or uploadApi should be set at Form/FreeForm');
|
|
127
90
|
invariant(!uploadApi || props.bizKey, '"bizKey" should be set if Upload is used with uploadApi');
|
|
128
91
|
var value = props.value,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
switch (_context2.prev = _context2.next) {
|
|
92
|
+
limit = props.limit,
|
|
93
|
+
limitErrorMessage = props.limitErrorMessage,
|
|
94
|
+
descriptions = props.descriptions,
|
|
95
|
+
buttonText = props.buttonText,
|
|
96
|
+
_props$samples = props.samples,
|
|
97
|
+
samples = _props$samples === void 0 ? [] : _props$samples,
|
|
98
|
+
onChange = props.onChange,
|
|
99
|
+
bizKey = props.bizKey,
|
|
100
|
+
_props$handleUpload = props.handleUpload,
|
|
101
|
+
handleUpload = _props$handleUpload === void 0 ? /*#__PURE__*/function () {
|
|
102
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(file) {
|
|
103
|
+
var formData, response, rst;
|
|
104
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
105
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
144
106
|
case 0:
|
|
145
107
|
formData = new FormData();
|
|
146
108
|
formData.append('file', file);
|
|
@@ -150,97 +112,80 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
150
112
|
method: 'post',
|
|
151
113
|
body: formData
|
|
152
114
|
});
|
|
153
|
-
|
|
154
115
|
case 5:
|
|
155
116
|
response = _context2.sent;
|
|
156
117
|
_context2.next = 8;
|
|
157
118
|
return response.json();
|
|
158
|
-
|
|
159
119
|
case 8:
|
|
160
120
|
rst = _context2.sent;
|
|
161
121
|
return _context2.abrupt("return", rst.url);
|
|
162
|
-
|
|
163
122
|
case 10:
|
|
164
123
|
case "end":
|
|
165
124
|
return _context2.stop();
|
|
166
125
|
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
_props$capture = props.capture,
|
|
180
|
-
capture = _props$capture === void 0 ? false : _props$capture;
|
|
181
|
-
|
|
126
|
+
}, _callee2);
|
|
127
|
+
}));
|
|
128
|
+
return function (_x2) {
|
|
129
|
+
return _ref2.apply(this, arguments);
|
|
130
|
+
};
|
|
131
|
+
}() : _props$handleUpload,
|
|
132
|
+
setFieldError = props.setFieldError,
|
|
133
|
+
className = props.className,
|
|
134
|
+
id = props.id,
|
|
135
|
+
validateField = props.validateField,
|
|
136
|
+
_props$capture = props.capture,
|
|
137
|
+
capture = _props$capture === void 0 ? false : _props$capture;
|
|
182
138
|
var _useContext2 = useContext(LocaleContext),
|
|
183
|
-
|
|
184
|
-
|
|
139
|
+
formatMessage = _useContext2.formatMessage;
|
|
185
140
|
var _useState = useState(isMobileAgent()),
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
141
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
142
|
+
isMobile = _useState2[0];
|
|
189
143
|
var _useState3 = useState([]),
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
144
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
145
|
+
files = _useState4[0],
|
|
146
|
+
setFiles = _useState4[1];
|
|
194
147
|
var _useState5 = useState([]),
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
148
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
149
|
+
masks = _useState6[0],
|
|
150
|
+
setMasks = _useState6[1];
|
|
199
151
|
var _useBreakpoint = useBreakpoint(),
|
|
200
|
-
|
|
201
|
-
|
|
152
|
+
md = _useBreakpoint.md;
|
|
202
153
|
var mapFilesFromValue = function mapFilesFromValue(urls) {
|
|
203
154
|
var _files = [];
|
|
204
155
|
Promise.all(urls.map( /*#__PURE__*/function () {
|
|
205
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/
|
|
156
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(url, index) {
|
|
206
157
|
var type;
|
|
207
|
-
return
|
|
208
|
-
while (1) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
case 4:
|
|
228
|
-
case "end":
|
|
229
|
-
return _context3.stop();
|
|
230
|
-
}
|
|
158
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
159
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
160
|
+
case 0:
|
|
161
|
+
_context3.next = 2;
|
|
162
|
+
return getFileType(url);
|
|
163
|
+
case 2:
|
|
164
|
+
type = _context3.sent;
|
|
165
|
+
_files.push({
|
|
166
|
+
url: url,
|
|
167
|
+
dataUrl: url,
|
|
168
|
+
status: 'success',
|
|
169
|
+
type: type,
|
|
170
|
+
name: "File".concat(index + 1),
|
|
171
|
+
size: 0,
|
|
172
|
+
uid: index
|
|
173
|
+
});
|
|
174
|
+
case 4:
|
|
175
|
+
case "end":
|
|
176
|
+
return _context3.stop();
|
|
231
177
|
}
|
|
232
178
|
}, _callee3);
|
|
233
179
|
}));
|
|
234
|
-
|
|
235
180
|
return function (_x3, _x4) {
|
|
236
181
|
return _ref3.apply(this, arguments);
|
|
237
182
|
};
|
|
238
183
|
}())).then(function () {
|
|
239
184
|
return setFiles(_files);
|
|
240
185
|
});
|
|
241
|
-
};
|
|
242
|
-
|
|
186
|
+
};
|
|
243
187
|
|
|
188
|
+
// 有初始值的处理 (不是初始化)
|
|
244
189
|
useEffect(function () {
|
|
245
190
|
if (Array.isArray(value) && value.length && files.length === 0) {
|
|
246
191
|
mapFilesFromValue(value);
|
|
@@ -248,20 +193,17 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
248
193
|
}, [value]);
|
|
249
194
|
useEffect(function () {
|
|
250
195
|
if (!value && !files.length) return;
|
|
251
|
-
|
|
252
196
|
if (files.length) {
|
|
253
197
|
var urls = files.map(function (f) {
|
|
254
198
|
var status = f.status,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
199
|
+
name = f.name,
|
|
200
|
+
errorMsg = f.errorMsg;
|
|
258
201
|
if (status === 'failed') {
|
|
259
202
|
return {
|
|
260
203
|
name: name,
|
|
261
204
|
errorMsg: errorMsg
|
|
262
205
|
};
|
|
263
206
|
}
|
|
264
|
-
|
|
265
207
|
if (f.url || f.dataUrl) {
|
|
266
208
|
return f.url || f.dataUrl;
|
|
267
209
|
}
|
|
@@ -274,7 +216,7 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
274
216
|
var uploadId = useMemo(function () {
|
|
275
217
|
return "igloo-upload-photo-input-".concat(Math.random());
|
|
276
218
|
}, []);
|
|
277
|
-
var uploadIndex = useRef(
|
|
219
|
+
var uploadIndex = useRef(value !== null && value !== void 0 && value.length ? value.length : 0);
|
|
278
220
|
useEffect(function () {
|
|
279
221
|
return function () {
|
|
280
222
|
dataUrlRef.current.forEach(function (dataUrl) {
|
|
@@ -286,16 +228,13 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
286
228
|
var removeLimitMsg = function removeLimitMsg(e) {
|
|
287
229
|
if (DomRef.current && !DomRef.current.contains(e.target) && limitNumError.current) {
|
|
288
230
|
limitNumError.current = undefined;
|
|
289
|
-
|
|
290
231
|
if (files && files.length) {
|
|
291
232
|
validateField && validateField();
|
|
292
233
|
return;
|
|
293
234
|
}
|
|
294
|
-
|
|
295
235
|
typeof setFieldError === 'function' && setFieldError('');
|
|
296
236
|
}
|
|
297
237
|
};
|
|
298
|
-
|
|
299
238
|
window.addEventListener('click', removeLimitMsg);
|
|
300
239
|
return function () {
|
|
301
240
|
window.removeEventListener('click', removeLimitMsg);
|
|
@@ -307,37 +246,31 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
307
246
|
return;
|
|
308
247
|
}
|
|
309
248
|
});
|
|
310
|
-
|
|
311
249
|
var _useMemo = useMemo(function () {
|
|
312
|
-
|
|
250
|
+
if (!md) {
|
|
251
|
+
return {
|
|
252
|
+
sampleSpan: 12,
|
|
253
|
+
descriptionSpan: (2 - samples.length % 2) * 12
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
var lastRow = samples.length % 4;
|
|
313
257
|
return {
|
|
314
|
-
sampleSpan:
|
|
315
|
-
descriptionSpan:
|
|
258
|
+
sampleSpan: 6,
|
|
259
|
+
descriptionSpan: lastRow > 2 ? 24 : (4 - lastRow) * 6
|
|
316
260
|
};
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
return {
|
|
321
|
-
sampleSpan: 6,
|
|
322
|
-
descriptionSpan: lastRow > 2 ? 24 : (4 - lastRow) * 6
|
|
323
|
-
};
|
|
324
|
-
}, [!md]),
|
|
325
|
-
sampleSpan = _useMemo.sampleSpan,
|
|
326
|
-
descriptionSpan = _useMemo.descriptionSpan;
|
|
327
|
-
|
|
261
|
+
}, [!md]),
|
|
262
|
+
sampleSpan = _useMemo.sampleSpan,
|
|
263
|
+
descriptionSpan = _useMemo.descriptionSpan;
|
|
328
264
|
invariant(limit === undefined || limit > 0, "\"limit\" should be a pasitive number.");
|
|
329
|
-
|
|
330
265
|
var onUpload = function onUpload(e) {
|
|
331
266
|
if (!e.target.files || !e.target.files.length) return;
|
|
332
267
|
var index = 1;
|
|
333
|
-
|
|
334
268
|
var _iterator = _createForOfIteratorHelper(e.target.files),
|
|
335
|
-
|
|
336
|
-
|
|
269
|
+
_step;
|
|
337
270
|
try {
|
|
338
271
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
339
|
-
var
|
|
340
|
-
uploadFile(
|
|
272
|
+
var _file = _step.value;
|
|
273
|
+
uploadFile(_file, files.length + index++);
|
|
341
274
|
}
|
|
342
275
|
} catch (err) {
|
|
343
276
|
_iterator.e(err);
|
|
@@ -345,258 +278,214 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
345
278
|
_iterator.f();
|
|
346
279
|
}
|
|
347
280
|
};
|
|
348
|
-
|
|
349
281
|
var uploadFile = /*#__PURE__*/function () {
|
|
350
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/
|
|
282
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(file, currentIndex) {
|
|
351
283
|
var uid, dataUrl, name, size, mimeType, type, errorMsg, _errorMsg;
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
284
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
285
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
286
|
+
case 0:
|
|
287
|
+
uid = ++uploadIndex.current;
|
|
288
|
+
dataUrl = URL.createObjectURL(file);
|
|
289
|
+
dataUrlRef.current.push(dataUrl);
|
|
290
|
+
name = file.name, size = file.size, mimeType = file.type;
|
|
291
|
+
type = classifyType(mimeType);
|
|
292
|
+
if (!(type === 'unknown')) {
|
|
293
|
+
_context4.next = 10;
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
errorMsg = formatMessage({
|
|
297
|
+
id: 'The file type is not supported.'
|
|
298
|
+
});
|
|
299
|
+
limitNumError.current = errorMsg;
|
|
300
|
+
setFieldError && setFieldError(errorMsg);
|
|
301
|
+
return _context4.abrupt("return", Promise.reject(errorMsg));
|
|
302
|
+
case 10:
|
|
303
|
+
if (!(limit && currentIndex > limit)) {
|
|
304
|
+
_context4.next = 15;
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
_errorMsg = (typeof limitErrorMessage === 'function' ? limitErrorMessage(value) : limitErrorMessage) || formatMessage({
|
|
308
|
+
id: 'Quantity of files should be less than {limit}',
|
|
309
|
+
values: {
|
|
310
|
+
limit: limit
|
|
379
311
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
return
|
|
407
|
-
if (f.uid === uid) {
|
|
408
|
-
return _objectSpread(_objectSpread({}, f), {}, {
|
|
409
|
-
url: url,
|
|
410
|
-
status: 'success'
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
return f;
|
|
415
|
-
});
|
|
312
|
+
});
|
|
313
|
+
limitNumError.current = _errorMsg;
|
|
314
|
+
setFieldError && setFieldError(_errorMsg);
|
|
315
|
+
return _context4.abrupt("return", Promise.reject(_errorMsg));
|
|
316
|
+
case 15:
|
|
317
|
+
limitNumError.current = undefined;
|
|
318
|
+
setFiles(function (files) {
|
|
319
|
+
return [].concat(_toConsumableArray(files), [{
|
|
320
|
+
name: name,
|
|
321
|
+
type: type,
|
|
322
|
+
size: size,
|
|
323
|
+
dataUrl: dataUrl,
|
|
324
|
+
status: 'progress',
|
|
325
|
+
originFile: file,
|
|
326
|
+
uid: uid
|
|
327
|
+
}]);
|
|
328
|
+
});
|
|
329
|
+
return _context4.abrupt("return", handleUploadPromise(file, function (url) {
|
|
330
|
+
return setFiles(function (files) {
|
|
331
|
+
return files.map(function (f) {
|
|
332
|
+
if (f.uid === uid) {
|
|
333
|
+
return _objectSpread(_objectSpread({}, f), {}, {
|
|
334
|
+
url: url,
|
|
335
|
+
status: 'success'
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
return f;
|
|
416
339
|
});
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
});
|
|
340
|
+
});
|
|
341
|
+
}, function (errorMsg) {
|
|
342
|
+
return setFiles(function (files) {
|
|
343
|
+
return files.map(function (f) {
|
|
344
|
+
if (f.uid === uid) {
|
|
345
|
+
return _objectSpread(_objectSpread({}, f), {}, {
|
|
346
|
+
status: 'failed',
|
|
347
|
+
errorMsg: errorMsg
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
return f;
|
|
429
351
|
});
|
|
430
|
-
})
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}
|
|
352
|
+
});
|
|
353
|
+
}));
|
|
354
|
+
case 18:
|
|
355
|
+
case "end":
|
|
356
|
+
return _context4.stop();
|
|
436
357
|
}
|
|
437
358
|
}, _callee4);
|
|
438
359
|
}));
|
|
439
|
-
|
|
440
360
|
return function uploadFile(_x5, _x6) {
|
|
441
361
|
return _ref4.apply(this, arguments);
|
|
442
362
|
};
|
|
443
363
|
}();
|
|
444
|
-
|
|
445
364
|
var handleUploadPromise = /*#__PURE__*/function () {
|
|
446
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/
|
|
365
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(file, onSuccess, onFailed) {
|
|
447
366
|
var rst, errorMsg;
|
|
448
|
-
return
|
|
449
|
-
while (1) {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
case 13:
|
|
469
|
-
case "end":
|
|
470
|
-
return _context5.stop();
|
|
471
|
-
}
|
|
367
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
368
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
369
|
+
case 0:
|
|
370
|
+
_context5.prev = 0;
|
|
371
|
+
_context5.next = 3;
|
|
372
|
+
return handleUpload(file);
|
|
373
|
+
case 3:
|
|
374
|
+
rst = _context5.sent;
|
|
375
|
+
onSuccess(rst);
|
|
376
|
+
return _context5.abrupt("return", Promise.resolve(rst));
|
|
377
|
+
case 8:
|
|
378
|
+
_context5.prev = 8;
|
|
379
|
+
_context5.t0 = _context5["catch"](0);
|
|
380
|
+
errorMsg = _typeof(_context5.t0) === 'object' ? _context5.t0.message : _context5.t0;
|
|
381
|
+
onFailed(errorMsg);
|
|
382
|
+
return _context5.abrupt("return", Promise.reject(errorMsg));
|
|
383
|
+
case 13:
|
|
384
|
+
case "end":
|
|
385
|
+
return _context5.stop();
|
|
472
386
|
}
|
|
473
387
|
}, _callee5, null, [[0, 8]]);
|
|
474
388
|
}));
|
|
475
|
-
|
|
476
389
|
return function handleUploadPromise(_x7, _x8, _x9) {
|
|
477
390
|
return _ref5.apply(this, arguments);
|
|
478
391
|
};
|
|
479
392
|
}();
|
|
480
|
-
|
|
481
393
|
var handleDelete = /*#__PURE__*/function () {
|
|
482
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/
|
|
483
|
-
return
|
|
484
|
-
while (1) {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
return i !== index;
|
|
492
|
-
});
|
|
493
|
-
return newArr;
|
|
394
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(index) {
|
|
395
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
396
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
397
|
+
case 0:
|
|
398
|
+
limitNumError.current = null;
|
|
399
|
+
_context6.next = 3;
|
|
400
|
+
return setFiles(function (files) {
|
|
401
|
+
var newArr = files.filter(function (_, i) {
|
|
402
|
+
return i !== index;
|
|
494
403
|
});
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
404
|
+
return newArr;
|
|
405
|
+
});
|
|
406
|
+
case 3:
|
|
407
|
+
_context6.next = 5;
|
|
408
|
+
return setMasks(function (masks) {
|
|
409
|
+
return masks.filter(function (_, i) {
|
|
410
|
+
return i !== index;
|
|
502
411
|
});
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
}
|
|
412
|
+
});
|
|
413
|
+
case 5:
|
|
414
|
+
case "end":
|
|
415
|
+
return _context6.stop();
|
|
508
416
|
}
|
|
509
417
|
}, _callee6);
|
|
510
418
|
}));
|
|
511
|
-
|
|
512
419
|
return function handleDelete(_x10) {
|
|
513
420
|
return _ref6.apply(this, arguments);
|
|
514
421
|
};
|
|
515
422
|
}();
|
|
516
|
-
|
|
517
423
|
var handleReUpload = /*#__PURE__*/function () {
|
|
518
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/
|
|
424
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(index) {
|
|
519
425
|
var _files$index, originFile, reUpUid, rst;
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
if (originFile) {
|
|
528
|
-
_context7.next = 3;
|
|
529
|
-
break;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
return _context7.abrupt("return");
|
|
533
|
-
|
|
534
|
-
case 3:
|
|
535
|
-
_context7.next = 5;
|
|
536
|
-
return setFiles(function (files) {
|
|
537
|
-
var newFiles = _toConsumableArray(files);
|
|
538
|
-
|
|
539
|
-
newFiles[index].status = 'progress';
|
|
540
|
-
return newFiles;
|
|
541
|
-
});
|
|
542
|
-
|
|
543
|
-
case 5:
|
|
544
|
-
_context7.prev = 5;
|
|
545
|
-
_context7.next = 8;
|
|
546
|
-
return handleUpload(originFile);
|
|
547
|
-
|
|
548
|
-
case 8:
|
|
549
|
-
rst = _context7.sent;
|
|
550
|
-
_context7.next = 11;
|
|
551
|
-
return setFiles(function (files) {
|
|
552
|
-
var newFiles = _toConsumableArray(files);
|
|
553
|
-
|
|
554
|
-
newFiles[index].url = rst;
|
|
555
|
-
newFiles[index].status = 'success';
|
|
556
|
-
return newFiles;
|
|
557
|
-
});
|
|
558
|
-
|
|
559
|
-
case 11:
|
|
560
|
-
_context7.next = 17;
|
|
426
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
427
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
428
|
+
case 0:
|
|
429
|
+
_files$index = files[index], originFile = _files$index.originFile, reUpUid = _files$index.uid;
|
|
430
|
+
if (originFile) {
|
|
431
|
+
_context7.next = 3;
|
|
561
432
|
break;
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
return
|
|
583
|
-
|
|
433
|
+
}
|
|
434
|
+
return _context7.abrupt("return");
|
|
435
|
+
case 3:
|
|
436
|
+
_context7.next = 5;
|
|
437
|
+
return setFiles(function (files) {
|
|
438
|
+
var newFiles = _toConsumableArray(files);
|
|
439
|
+
newFiles[index].status = 'progress';
|
|
440
|
+
return newFiles;
|
|
441
|
+
});
|
|
442
|
+
case 5:
|
|
443
|
+
_context7.prev = 5;
|
|
444
|
+
_context7.next = 8;
|
|
445
|
+
return handleUpload(originFile);
|
|
446
|
+
case 8:
|
|
447
|
+
rst = _context7.sent;
|
|
448
|
+
_context7.next = 11;
|
|
449
|
+
return setFiles(function (files) {
|
|
450
|
+
var newFiles = _toConsumableArray(files);
|
|
451
|
+
newFiles[index].url = rst;
|
|
452
|
+
newFiles[index].status = 'success';
|
|
453
|
+
return newFiles;
|
|
454
|
+
});
|
|
455
|
+
case 11:
|
|
456
|
+
_context7.next = 17;
|
|
457
|
+
break;
|
|
458
|
+
case 13:
|
|
459
|
+
_context7.prev = 13;
|
|
460
|
+
_context7.t0 = _context7["catch"](5);
|
|
461
|
+
_context7.next = 17;
|
|
462
|
+
return setFiles(function (files) {
|
|
463
|
+
var newFiles = _toConsumableArray(files);
|
|
464
|
+
newFiles[index].status = 'failed';
|
|
465
|
+
newFiles[index].errorMsg = _context7.t0;
|
|
466
|
+
return newFiles;
|
|
467
|
+
});
|
|
468
|
+
case 17:
|
|
469
|
+
if (isMobile) {
|
|
470
|
+
closeMask(index);
|
|
471
|
+
}
|
|
472
|
+
case 18:
|
|
473
|
+
case "end":
|
|
474
|
+
return _context7.stop();
|
|
584
475
|
}
|
|
585
476
|
}, _callee7, null, [[5, 13]]);
|
|
586
477
|
}));
|
|
587
|
-
|
|
588
478
|
return function handleReUpload(_x11) {
|
|
589
479
|
return _ref7.apply(this, arguments);
|
|
590
480
|
};
|
|
591
481
|
}();
|
|
592
|
-
|
|
593
482
|
var handlePreview = function handlePreview(index) {
|
|
594
483
|
var _files$index2 = files[index],
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
484
|
+
dataUrl = _files$index2.dataUrl,
|
|
485
|
+
name = _files$index2.name,
|
|
486
|
+
type = _files$index2.type;
|
|
598
487
|
Modal.noFooter({
|
|
599
|
-
content: _jsx(Preview, {
|
|
488
|
+
content: /*#__PURE__*/_jsx(Preview, {
|
|
600
489
|
src: dataUrl,
|
|
601
490
|
type: classifyType(type)
|
|
602
491
|
}),
|
|
@@ -605,27 +494,22 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
605
494
|
maskClosable: true,
|
|
606
495
|
closable: true
|
|
607
496
|
});
|
|
608
|
-
|
|
609
497
|
if (isMobile) {
|
|
610
498
|
closeMask(index);
|
|
611
499
|
}
|
|
612
500
|
};
|
|
613
|
-
|
|
614
501
|
var handleMouseEnter = function handleMouseEnter(index) {
|
|
615
502
|
if (isMobile) return;
|
|
616
503
|
openMask(index);
|
|
617
504
|
};
|
|
618
|
-
|
|
619
505
|
var handleMouseLeave = function handleMouseLeave(index) {
|
|
620
506
|
if (isMobile) return;
|
|
621
507
|
closeMask(index);
|
|
622
508
|
};
|
|
623
|
-
|
|
624
509
|
var handleTouchEnd = function handleTouchEnd(index) {
|
|
625
510
|
if (!isMobile) return;
|
|
626
511
|
openMask(index);
|
|
627
512
|
};
|
|
628
|
-
|
|
629
513
|
var closeMask = function closeMask(index) {
|
|
630
514
|
setMasks(function (masks) {
|
|
631
515
|
var arr = Array.from(masks);
|
|
@@ -633,7 +517,6 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
633
517
|
return arr;
|
|
634
518
|
});
|
|
635
519
|
};
|
|
636
|
-
|
|
637
520
|
var openMask = function openMask(index) {
|
|
638
521
|
setMasks(function (masks) {
|
|
639
522
|
var arr = Array.from(masks);
|
|
@@ -641,15 +524,13 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
641
524
|
return arr;
|
|
642
525
|
});
|
|
643
526
|
};
|
|
644
|
-
|
|
645
527
|
var getBadge = function getBadge(status, index, limit) {
|
|
646
528
|
if (props.disabled) {
|
|
647
529
|
return null;
|
|
648
530
|
}
|
|
649
|
-
|
|
650
531
|
if (status === 'progress') {
|
|
651
|
-
return _jsx("div", {
|
|
652
|
-
children: _jsx(LoadingOutlined, {
|
|
532
|
+
return /*#__PURE__*/_jsx("div", {
|
|
533
|
+
children: /*#__PURE__*/_jsx(LoadingOutlined, {
|
|
653
534
|
spinning: true,
|
|
654
535
|
style: {
|
|
655
536
|
fontSize: 24,
|
|
@@ -658,9 +539,8 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
658
539
|
})
|
|
659
540
|
});
|
|
660
541
|
}
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
children: _jsx(ErrorFilled, {
|
|
542
|
+
return /*#__PURE__*/_jsx("div", {
|
|
543
|
+
children: /*#__PURE__*/_jsx(ErrorFilled, {
|
|
664
544
|
style: {
|
|
665
545
|
color: '#999999',
|
|
666
546
|
cursor: 'pointer',
|
|
@@ -673,48 +553,46 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
673
553
|
})
|
|
674
554
|
});
|
|
675
555
|
};
|
|
676
|
-
|
|
677
|
-
return _jsxs("div", {
|
|
556
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
678
557
|
className: classnames(prefix, className),
|
|
679
558
|
id: id,
|
|
680
559
|
ref: DomRef,
|
|
681
|
-
children: [Boolean(descriptions || samples.length) && _jsx("div", {
|
|
560
|
+
children: [Boolean(descriptions || samples.length) && /*#__PURE__*/_jsx("div", {
|
|
682
561
|
className: "".concat(prefix, "-sample"),
|
|
683
|
-
children: _jsxs(
|
|
562
|
+
children: /*#__PURE__*/_jsxs(Row, {
|
|
684
563
|
gutter: [isMobile ? 16 : 32, 16],
|
|
685
564
|
wrap: true,
|
|
686
565
|
children: [Boolean(samples === null || samples === void 0 ? void 0 : samples.length) && samples.map(function (_ref8, index) {
|
|
687
566
|
var _classnames, _classnames2;
|
|
688
|
-
|
|
689
567
|
var src = _ref8.src,
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
return _jsxs(
|
|
568
|
+
label = _ref8.label,
|
|
569
|
+
type = _ref8.type;
|
|
570
|
+
return /*#__PURE__*/_jsxs(Col, {
|
|
693
571
|
span: sampleSpan,
|
|
694
|
-
children: [_jsx("img", {
|
|
572
|
+
children: [/*#__PURE__*/_jsx("img", {
|
|
695
573
|
src: src,
|
|
696
574
|
alt: "",
|
|
697
575
|
className: "".concat(prefix, "-sample-photos-photo")
|
|
698
|
-
}), _jsx("div", {
|
|
576
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
699
577
|
className: classnames((_classnames = {}, _defineProperty(_classnames, "".concat(prefix, "-sample-photos-good"), type === 'good'), _defineProperty(_classnames, "".concat(prefix, "-sample-photos-bad"), type === 'bad'), _classnames))
|
|
700
|
-
}), label && _jsx("div", {
|
|
578
|
+
}), label && /*#__PURE__*/_jsx("div", {
|
|
701
579
|
className: classnames((_classnames2 = {}, _defineProperty(_classnames2, "".concat(prefix, "-sample-photos-label"), true), _defineProperty(_classnames2, "".concat(prefix, "-sample-photos-label-good"), type === 'good'), _defineProperty(_classnames2, "".concat(prefix, "-sample-photos-label-bad"), type === 'bad'), _classnames2)),
|
|
702
|
-
children: _jsx(IglooTypography, {
|
|
580
|
+
children: /*#__PURE__*/_jsx(IglooTypography, {
|
|
703
581
|
level: "body2",
|
|
704
582
|
children: label
|
|
705
583
|
})
|
|
706
584
|
})]
|
|
707
585
|
}, index);
|
|
708
|
-
}), _jsx(
|
|
586
|
+
}), /*#__PURE__*/_jsx(Col, {
|
|
709
587
|
className: classnames((_classnames3 = {}, _defineProperty(_classnames3, "".concat(prefix, "-sample-descriptions"), true), _defineProperty(_classnames3, "".concat(prefix, "-sample-descriptions-center"), !!md), _classnames3)),
|
|
710
588
|
span: descriptionSpan,
|
|
711
|
-
children: _jsx(IglooTypography, {
|
|
589
|
+
children: /*#__PURE__*/_jsx(IglooTypography, {
|
|
712
590
|
level: "caption2",
|
|
713
591
|
children: descriptions
|
|
714
592
|
})
|
|
715
593
|
})]
|
|
716
594
|
})
|
|
717
|
-
}), _jsx("input", {
|
|
595
|
+
}), /*#__PURE__*/_jsx("input", {
|
|
718
596
|
id: uploadId,
|
|
719
597
|
type: "file",
|
|
720
598
|
style: {
|
|
@@ -725,39 +603,38 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
725
603
|
value: [],
|
|
726
604
|
multiple: true,
|
|
727
605
|
capture: capture
|
|
728
|
-
}), _jsxs(
|
|
606
|
+
}), /*#__PURE__*/_jsxs(Space, {
|
|
729
607
|
className: "".concat(prefix, "-content"),
|
|
730
608
|
size: [16, 16],
|
|
731
609
|
wrap: true,
|
|
732
|
-
children: [_jsxs("label", {
|
|
610
|
+
children: [/*#__PURE__*/_jsxs("label", {
|
|
733
611
|
htmlFor: uploadId,
|
|
734
612
|
className: classnames((_classnames4 = {}, _defineProperty(_classnames4, "".concat(prefix, "-content-button"), true), _defineProperty(_classnames4, 'dont-show-error-status', Array.isArray(value) && value.some(function (file) {
|
|
735
613
|
return typeof file !== 'string' && (file === null || file === void 0 ? void 0 : file.status) === 'failed';
|
|
736
614
|
})), _classnames4)),
|
|
737
|
-
children: [_jsx(UploadOutlined, {
|
|
615
|
+
children: [/*#__PURE__*/_jsx(UploadOutlined, {
|
|
738
616
|
style: {
|
|
739
617
|
fontSize: 24,
|
|
740
618
|
color: '#666666'
|
|
741
619
|
}
|
|
742
|
-
}), _jsx("span", {
|
|
620
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
743
621
|
style: {
|
|
744
622
|
marginTop: 6
|
|
745
623
|
},
|
|
746
|
-
children: _jsx(IglooTypography, {
|
|
624
|
+
children: /*#__PURE__*/_jsx(IglooTypography, {
|
|
747
625
|
level: "body1",
|
|
748
626
|
children: buttonText || 'Upload'
|
|
749
627
|
})
|
|
750
628
|
})]
|
|
751
629
|
}), files.map(function (_ref9, index) {
|
|
752
630
|
var _classnames5;
|
|
753
|
-
|
|
754
631
|
var dataUrl = _ref9.dataUrl,
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
return _jsx(
|
|
632
|
+
status = _ref9.status,
|
|
633
|
+
type = _ref9.type,
|
|
634
|
+
uid = _ref9.uid;
|
|
635
|
+
return /*#__PURE__*/_jsx(Badge, {
|
|
759
636
|
count: getBadge(status, index, limit),
|
|
760
|
-
children: _jsxs("div", {
|
|
637
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
761
638
|
className: classnames((_classnames5 = {}, _defineProperty(_classnames5, "".concat(prefix, "-content-container"), true), _defineProperty(_classnames5, "".concat(prefix, "-content-error"), status === 'failed'), _classnames5)),
|
|
762
639
|
onMouseEnter: function onMouseEnter() {
|
|
763
640
|
return handleMouseEnter(index);
|
|
@@ -769,29 +646,29 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
769
646
|
e.stopPropagation();
|
|
770
647
|
handleTouchEnd(index);
|
|
771
648
|
},
|
|
772
|
-
children: [_jsx(MediaItem, {
|
|
649
|
+
children: [/*#__PURE__*/_jsx(MediaItem, {
|
|
773
650
|
type: type,
|
|
774
651
|
src: dataUrl,
|
|
775
652
|
className: "".concat(prefix, "-content-preview")
|
|
776
|
-
}), (!limit || index < limit) && masks[index] && _jsxs(_Fragment, {
|
|
777
|
-
children: [status === 'failed' && _jsx("div", {
|
|
653
|
+
}), (!limit || index < limit) && masks[index] && /*#__PURE__*/_jsxs(_Fragment, {
|
|
654
|
+
children: [status === 'failed' && /*#__PURE__*/_jsx("div", {
|
|
778
655
|
className: "".concat(prefix, "-content-mask"),
|
|
779
656
|
onClick: function onClick(e) {
|
|
780
657
|
e.stopPropagation();
|
|
781
658
|
handleReUpload(index);
|
|
782
659
|
},
|
|
783
|
-
children: _jsx(RefreshOutlined, {
|
|
660
|
+
children: /*#__PURE__*/_jsx(RefreshOutlined, {
|
|
784
661
|
style: {
|
|
785
662
|
fontSize: 24
|
|
786
663
|
}
|
|
787
664
|
})
|
|
788
|
-
}), status === 'success' && _jsx("div", {
|
|
665
|
+
}), status === 'success' && /*#__PURE__*/_jsx("div", {
|
|
789
666
|
className: "".concat(prefix, "-content-mask"),
|
|
790
667
|
onClick: function onClick(e) {
|
|
791
668
|
e.stopPropagation();
|
|
792
669
|
handlePreview(index);
|
|
793
670
|
},
|
|
794
|
-
children: _jsx(ShowOutlined, {
|
|
671
|
+
children: /*#__PURE__*/_jsx(ShowOutlined, {
|
|
795
672
|
style: {
|
|
796
673
|
fontSize: 24
|
|
797
674
|
}
|
|
@@ -804,31 +681,26 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
804
681
|
})]
|
|
805
682
|
});
|
|
806
683
|
};
|
|
807
|
-
|
|
808
684
|
function checkFileList(value) {
|
|
809
685
|
if (!value) {
|
|
810
686
|
return Promise.resolve();
|
|
811
687
|
}
|
|
812
|
-
|
|
813
688
|
for (var i = 0; i < value.length; i++) {
|
|
814
|
-
var
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
var errorMsg = file.errorMsg;
|
|
689
|
+
var _file2 = value[i];
|
|
690
|
+
if (_typeof(_file2) === 'object') {
|
|
691
|
+
var errorMsg = _file2.errorMsg;
|
|
818
692
|
return Promise.reject(errorMsg);
|
|
819
693
|
}
|
|
820
694
|
}
|
|
821
|
-
|
|
822
695
|
return Promise.resolve();
|
|
823
696
|
}
|
|
824
|
-
|
|
825
697
|
UploadPhoto.formItemPropsHandler = function (_ref10) {
|
|
826
698
|
var limit = _ref10.limit,
|
|
827
|
-
|
|
828
|
-
|
|
699
|
+
previewFormater = _ref10.previewFormater,
|
|
700
|
+
label = _ref10.label;
|
|
829
701
|
return {
|
|
830
702
|
previewFormater: previewFormater || function (value) {
|
|
831
|
-
return _jsx(UploadPreview, {
|
|
703
|
+
return /*#__PURE__*/_jsx(UploadPreview, {
|
|
832
704
|
files: value,
|
|
833
705
|
label: label
|
|
834
706
|
});
|
|
@@ -841,5 +713,4 @@ UploadPhoto.formItemPropsHandler = function (_ref10) {
|
|
|
841
713
|
}]
|
|
842
714
|
};
|
|
843
715
|
};
|
|
844
|
-
|
|
845
716
|
export default UploadPhoto;
|