tntd 2.6.1 → 2.6.3
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/es/affix/index.js +2 -1
- package/es/alert/index.js +2 -1
- package/es/anchor/index.js +2 -1
- package/es/array-input/icon.js +6 -24
- package/es/array-input/index.js +119 -203
- package/es/auth-context/index.js +2 -1
- package/es/auto-complete/index.js +2 -1
- package/es/avatar/index.js +2 -1
- package/es/back-top/index.js +2 -1
- package/es/badge/index.js +2 -1
- package/es/breadcrumb/index.js +2 -1
- package/es/button/index.js +2 -1
- package/es/calendar/index.js +2 -1
- package/es/card/index.js +2 -1
- package/es/carousel/index.js +2 -1
- package/es/cascader/index.js +2 -1
- package/es/checkbox/index.js +2 -1
- package/es/col/index.js +2 -1
- package/es/collapse/index.js +2 -1
- package/es/color-picker/ColorPicker.js +80 -126
- package/es/color-picker/index.js +5 -8
- package/es/columns/index.js +30 -66
- package/es/columns/style/index.js +2 -1
- package/es/comment/index.js +2 -1
- package/es/config-provider/config-provider.js +2 -1
- package/es/config-provider/index.js +2 -1
- package/es/date-picker/index.js +2 -1
- package/es/descriptions/descriptions.js +30 -38
- package/es/descriptions/index.js +2 -1
- package/es/development-login/LoginModal.js +46 -81
- package/es/development-login/index.js +8 -17
- package/es/divider/index.js +2 -1
- package/es/drawer/drawer.js +20 -27
- package/es/drawer/index.js +2 -1
- package/es/dropdown/index.js +2 -1
- package/es/ellipsis/Svg/CopySVG.js +16 -63
- package/es/ellipsis/Svg/TickSVG.js +11 -41
- package/es/ellipsis/index.js +78 -115
- package/es/ellipsis/index.less +7 -2
- package/es/empty/empty.js +48 -58
- package/es/empty/empty.stories.js +6 -5
- package/es/empty/index.js +2 -1
- package/es/exception/exception.js +19 -32
- package/es/exception/index.js +2 -1
- package/es/form/index.js +2 -1
- package/es/handle/index.js +71 -110
- package/es/icon/index.js +2 -1
- package/es/icon-list/index.js +120 -1
- package/es/img/Contain.js +39 -60
- package/es/img/Cover.js +72 -98
- package/es/img/index.js +32 -48
- package/es/index.js +2 -1
- package/es/input/index.js +2 -1
- package/es/input/input.js +47 -83
- package/es/input-number/index.js +2 -1
- package/es/label/index.js +98 -115
- package/es/layout/index.js +2 -1
- package/es/list/index.js +2 -1
- package/es/loading-button/index.js +28 -33
- package/es/locale/default.js +4 -3
- package/es/locale/en_US.js +31 -30
- package/es/locale/index.js +2 -1
- package/es/locale/zh_CN.js +31 -30
- package/es/locale-provider/index.js +3 -2
- package/es/mentions/index.js +2 -1
- package/es/menu/index.js +2 -1
- package/es/message/index.js +2 -1
- package/es/modal/index.js +2 -1
- package/es/modal/modal.js +17 -20
- package/es/notification/index.js +2 -1
- package/es/page/Box.js +33 -49
- package/es/page/index.js +84 -119
- package/es/page/utils.js +14 -12
- package/es/page-header/index.js +2 -1
- package/es/pagination/index.js +2 -1
- package/es/popconfirm/index.js +2 -1
- package/es/popover/index.js +2 -1
- package/es/prev-locale.js +47 -49
- package/es/progress/index.js +2 -1
- package/es/query-form/Field/Checkbox.js +17 -20
- package/es/query-form/Field/Select.js +39 -54
- package/es/query-form/Field/SelectInput.js +45 -63
- package/es/query-form/Field/fieldsMap.js +20 -19
- package/es/query-form/Field/index.js +66 -104
- package/es/query-form/createActions.js +46 -46
- package/es/query-form/index.js +247 -327
- package/es/query-form/useForm.js +4 -3
- package/es/query-list-scene/List.js +255 -321
- package/es/query-list-scene/QueryForm.js +94 -132
- package/es/query-list-scene/QueryListScene.js +21 -29
- package/es/query-list-scene/Title.js +4 -6
- package/es/query-list-scene/Toolbar.js +15 -21
- package/es/query-list-scene/createActions.js +60 -60
- package/es/query-list-scene/index.js +2 -1
- package/es/query-list-scene/useActions.js +4 -3
- package/es/radio/index.js +2 -1
- package/es/rate/index.js +2 -1
- package/es/render-empty/index.js +2 -1
- package/es/render-empty/render-empty.js +16 -19
- package/es/result/index.js +2 -1
- package/es/row/index.js +2 -1
- package/es/select/index.js +2 -1
- package/es/select/select.js +19 -23
- package/es/skeleton/index.js +2 -1
- package/es/slider/index.js +2 -1
- package/es/spin/index.js +2 -1
- package/es/statistic/index.js +2 -1
- package/es/steps/index.js +2 -1
- package/es/steps/steps.js +35 -51
- package/es/svg-components/illustration-403.js +58 -206
- package/es/svg-components/illustration-404.js +75 -290
- package/es/svg-components/illustration-500.js +83 -321
- package/es/svg-components/illustration-empty.js +15 -54
- package/es/svg-components/illustration-failure.js +36 -112
- package/es/svg-components/illustration-no-access.js +35 -114
- package/es/svg-components/illustration-no-chart.js +37 -134
- package/es/svg-components/illustration-no-result.js +32 -92
- package/es/svg-components/illustration-offline.js +43 -131
- package/es/svg-components/illustration-success.js +43 -137
- package/es/svg-components/index.js +2 -1
- package/es/switch/index.js +2 -1
- package/es/table/assets/image-loading-background.js +17 -45
- package/es/table/assets/image-loading.js +5 -26
- package/es/table/constants.js +2 -1
- package/es/table/context.js +2 -1
- package/es/table/hooks/index.js +2 -1
- package/es/table/hooks/use-column-setting.js +16 -13
- package/es/table/index.js +2 -1
- package/es/table/table.js +55 -80
- package/es/table/table.stories.js +139 -148
- package/es/table/utils.js +18 -17
- package/es/tabs/index.js +2 -1
- package/es/tag/index.js +2 -1
- package/es/tag/tag.less +61 -0
- package/es/time-picker/index.js +2 -1
- package/es/timeline/index.js +2 -1
- package/es/title/index.js +20 -34
- package/es/tntd-cascader/AntdCascader/component/DisabledContext.js +5 -9
- package/es/tntd-cascader/AntdCascader/component/FormItemInputContext.js +2 -1
- package/es/tntd-cascader/AntdCascader/component/SizeContext.js +2 -1
- package/es/tntd-cascader/AntdCascader/component/context.js +7 -5
- package/es/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +10 -22
- package/es/tntd-cascader/AntdCascader/component/getIcons.js +50 -72
- package/es/tntd-cascader/AntdCascader/component/useCompactItemContext.js +20 -22
- package/es/tntd-cascader/AntdCascader/config/utils.js +18 -17
- package/es/tntd-cascader/AntdCascader/config/warning.js +10 -9
- package/es/tntd-cascader/AntdCascader/index.js +118 -189
- package/es/tntd-cascader/AntdCascader/interface.js +2 -1
- package/es/tntd-cascader/index.js +2 -1
- package/es/tntd-cascader/rc-cascader/Cascader.js +239 -256
- package/es/tntd-cascader/rc-cascader/OptionList/Checkbox.js +11 -21
- package/es/tntd-cascader/rc-cascader/OptionList/Column.js +116 -175
- package/es/tntd-cascader/rc-cascader/OptionList/index.js +128 -180
- package/es/tntd-cascader/rc-cascader/OptionList/useActive.js +19 -22
- package/es/tntd-cascader/rc-cascader/OptionList/useKeyboard.js +137 -144
- package/es/tntd-cascader/rc-cascader/context.js +2 -1
- package/es/tntd-cascader/rc-cascader/hooks/useDisplayValues.js +37 -44
- package/es/tntd-cascader/rc-cascader/hooks/useEntities.js +24 -25
- package/es/tntd-cascader/rc-cascader/hooks/useMissingValues.js +17 -15
- package/es/tntd-cascader/rc-cascader/hooks/useRefFunc.js +8 -7
- package/es/tntd-cascader/rc-cascader/hooks/useSearchConfig.js +21 -20
- package/es/tntd-cascader/rc-cascader/hooks/useSearchOptions.js +41 -51
- package/es/tntd-cascader/rc-cascader/index.js +2 -1
- package/es/tntd-cascader/rc-cascader/utils/commonUtil.js +27 -33
- package/es/tntd-cascader/rc-cascader/utils/treeUtil.js +32 -29
- package/es/tntd-cascader/rc-cascader/utils/warningPropsUtil.js +23 -26
- package/es/tntd-form/TntdForm/components/Item.js +30 -42
- package/es/tntd-form/TntdForm/components/ItemComp.js +158 -167
- package/es/tntd-form/TntdForm/components/List.js +78 -89
- package/es/tntd-form/TntdForm/index.js +33 -38
- package/es/tntd-form/TntdForm/interface.js +2 -1
- package/es/tntd-form/TntdForm/store.js +2 -1
- package/es/tntd-form/TntdForm/utils.js +168 -158
- package/es/tntd-form/index.js +2 -1
- package/es/tntd-icon/fonts/iconfont.js +53 -36
- package/es/tntd-icon/index.js +17 -23
- package/es/tntd-layout/ActionsContext.js +2 -1
- package/es/tntd-layout/AppList.js +77 -135
- package/es/tntd-layout/Application.js +29 -42
- package/es/tntd-layout/Avatar.js +42 -80
- package/es/tntd-layout/CompatibleLanguage.js +56 -93
- package/es/tntd-layout/EnterpriseLayout/Avatar.js +47 -93
- package/es/tntd-layout/EnterpriseLayout/Language.js +34 -56
- package/es/tntd-layout/EnterpriseLayout/Theme.js +24 -45
- package/es/tntd-layout/EnterpriseLayout/index.js +9 -17
- package/es/tntd-layout/GlobalNavigation/NavigationPopup.js +153 -212
- package/es/tntd-layout/GlobalNavigation/index.js +50 -84
- package/es/tntd-layout/Header.js +26 -59
- package/es/tntd-layout/HeaderActions.js +34 -83
- package/es/tntd-layout/HeaderNavs.js +35 -46
- package/es/tntd-layout/HeaderTabs.js +140 -176
- package/es/tntd-layout/Iconfont.js +2 -1
- package/es/tntd-layout/Language.js +33 -55
- package/es/tntd-layout/Layout.js +78 -176
- package/es/tntd-layout/Logo.js +40 -52
- package/es/tntd-layout/OrgAppList.js +139 -208
- package/es/tntd-layout/SideMenu.js +160 -230
- package/es/tntd-layout/Theme.js +29 -47
- package/es/tntd-layout/createActions.js +29 -28
- package/es/tntd-layout/images/index.js +32 -31
- package/es/tntd-layout/index.js +60 -92
- package/es/tntd-layout/paaslayout/CompactSideMenu.js +65 -109
- package/es/tntd-layout/paaslayout/Header.js +14 -37
- package/es/tntd-layout/paaslayout/Logo.js +3 -2
- package/es/tntd-layout/paaslayout/SideMenu.js +63 -109
- package/es/tntd-layout/paaslayout/index.js +79 -159
- package/es/tntd-layout/storage.js +11 -18
- package/es/tntd-modal/index.js +32 -73
- package/es/tntd-second-page/index.js +24 -47
- package/es/tntd-select/DropDownWrap.js +52 -73
- package/es/tntd-select/index.js +494 -581
- package/es/tntd-select/index.js.map +1 -1
- package/es/tooltip/index.js +2 -1
- package/es/transfer/index.js +2 -1
- package/es/tree/index.js +2 -1
- package/es/tree-select/index.js +2 -1
- package/es/typography/index.js +2 -1
- package/es/upload/index.js +2 -1
- package/es/utils/checkAuth.js +21 -24
- package/es/utils/findMenuInfoByPath.js +30 -33
- package/es/utils/index.js +59 -65
- package/es/version/index.js +2 -1
- package/lib/affix/index.d.ts +3 -3
- package/lib/affix/index.js +19 -24
- package/lib/affix/index.js.map +1 -1
- package/lib/alert/index.d.ts +3 -3
- package/lib/alert/index.js +19 -24
- package/lib/alert/index.js.map +1 -1
- package/lib/anchor/index.d.ts +3 -3
- package/lib/anchor/index.js +19 -24
- package/lib/anchor/index.js.map +1 -1
- package/lib/array-input/icon.js +12 -33
- package/lib/array-input/index.js +146 -254
- package/lib/auth-context/index.js +4 -10
- package/lib/auto-complete/index.d.ts +3 -3
- package/lib/auto-complete/index.js +19 -24
- package/lib/auto-complete/index.js.map +1 -1
- package/lib/avatar/index.d.ts +3 -3
- package/lib/avatar/index.js +19 -24
- package/lib/avatar/index.js.map +1 -1
- package/lib/back-top/index.d.ts +3 -3
- package/lib/back-top/index.js +19 -24
- package/lib/back-top/index.js.map +1 -1
- package/lib/badge/index.d.ts +3 -3
- package/lib/badge/index.js +19 -24
- package/lib/badge/index.js.map +1 -1
- package/lib/breadcrumb/index.d.ts +3 -3
- package/lib/breadcrumb/index.js +19 -24
- package/lib/breadcrumb/index.js.map +1 -1
- package/lib/button/index.d.ts +3 -3
- package/lib/button/index.js +19 -24
- package/lib/button/index.js.map +1 -1
- package/lib/calendar/index.d.ts +3 -3
- package/lib/calendar/index.js +19 -24
- package/lib/calendar/index.js.map +1 -1
- package/lib/card/index.d.ts +3 -3
- package/lib/card/index.js +19 -24
- package/lib/card/index.js.map +1 -1
- package/lib/carousel/index.d.ts +3 -3
- package/lib/carousel/index.js +19 -24
- package/lib/carousel/index.js.map +1 -1
- package/lib/cascader/index.d.ts +3 -3
- package/lib/cascader/index.js +19 -24
- package/lib/cascader/index.js.map +1 -1
- package/lib/checkbox/index.d.ts +3 -3
- package/lib/checkbox/index.js +19 -24
- package/lib/checkbox/index.js.map +1 -1
- package/lib/col/index.d.ts +3 -3
- package/lib/col/index.js +19 -24
- package/lib/col/index.js.map +1 -1
- package/lib/collapse/index.d.ts +3 -3
- package/lib/collapse/index.js +20 -25
- package/lib/collapse/index.js.map +1 -1
- package/lib/color-picker/ColorPicker.js +109 -156
- package/lib/color-picker/index.js +14 -18
- package/lib/color-picker/index.js.map +1 -1
- package/lib/columns/index.js +41 -81
- package/lib/columns/style/index.js +2 -1
- package/lib/comment/index.d.ts +3 -3
- package/lib/comment/index.js +19 -24
- package/lib/comment/index.js.map +1 -1
- package/lib/config-provider/config-provider.d.ts +1 -1
- package/lib/config-provider/config-provider.js +8 -12
- package/lib/config-provider/config-provider.js.map +1 -1
- package/lib/config-provider/index.d.ts +3 -3
- package/lib/config-provider/index.js +19 -24
- package/lib/config-provider/index.js.map +1 -1
- package/lib/date-picker/index.d.ts +3 -3
- package/lib/date-picker/index.js +19 -24
- package/lib/date-picker/index.js.map +1 -1
- package/lib/descriptions/descriptions.d.ts +4 -4
- package/lib/descriptions/descriptions.d.ts.map +1 -1
- package/lib/descriptions/descriptions.js +51 -64
- package/lib/descriptions/descriptions.js.map +1 -1
- package/lib/descriptions/index.d.ts +1 -1
- package/lib/descriptions/index.js +18 -23
- package/lib/descriptions/index.js.map +1 -1
- package/lib/development-login/LoginModal.js +75 -110
- package/lib/development-login/index.js +31 -42
- package/lib/divider/index.d.ts +3 -3
- package/lib/divider/index.js +19 -24
- package/lib/divider/index.js.map +1 -1
- package/lib/drawer/drawer.d.ts +1 -1
- package/lib/drawer/drawer.js +30 -41
- package/lib/drawer/drawer.js.map +1 -1
- package/lib/drawer/index.d.ts +2 -2
- package/lib/drawer/index.js +16 -22
- package/lib/drawer/index.js.map +1 -1
- package/lib/dropdown/index.d.ts +3 -3
- package/lib/dropdown/index.js +19 -24
- package/lib/dropdown/index.js.map +1 -1
- package/lib/ellipsis/Svg/CopySVG.js +20 -70
- package/lib/ellipsis/Svg/TickSVG.js +15 -48
- package/lib/ellipsis/index.js +111 -146
- package/lib/ellipsis/index.less +7 -2
- package/lib/empty/empty.d.ts +2 -2
- package/lib/empty/empty.js +71 -90
- package/lib/empty/empty.js.map +1 -1
- package/lib/empty/empty.stories.js +18 -19
- package/lib/empty/index.d.ts +1 -1
- package/lib/empty/index.js +16 -21
- package/lib/empty/index.js.map +1 -1
- package/lib/exception/exception.js +31 -46
- package/lib/exception/exception.js.map +1 -1
- package/lib/exception/index.js +15 -20
- package/lib/form/index.d.ts +3 -3
- package/lib/form/index.js +19 -24
- package/lib/form/index.js.map +1 -1
- package/lib/handle/index.js +100 -140
- package/lib/handle/index.js.map +1 -1
- package/lib/icon/index.d.ts +3 -3
- package/lib/icon/index.js +19 -24
- package/lib/icon/index.js.map +1 -1
- package/lib/icon-list/index.js +121 -7
- package/lib/img/Contain.js +44 -69
- package/lib/img/Cover.js +78 -117
- package/lib/img/index.js +56 -74
- package/lib/index.js +186 -621
- package/lib/input/index.d.ts +1 -1
- package/lib/input/index.js +16 -21
- package/lib/input/index.js.map +1 -1
- package/lib/input/input.d.ts +1 -1
- package/lib/input/input.js +56 -74
- package/lib/input/input.js.map +1 -1
- package/lib/input-number/index.d.ts +3 -3
- package/lib/input-number/index.js +19 -24
- package/lib/input-number/index.js.map +1 -1
- package/lib/label/index.d.ts +2 -2
- package/lib/label/index.js +133 -134
- package/lib/label/index.js.map +1 -1
- package/lib/layout/index.d.ts +3 -3
- package/lib/layout/index.js +19 -24
- package/lib/layout/index.js.map +1 -1
- package/lib/list/index.d.ts +3 -3
- package/lib/list/index.js +19 -24
- package/lib/list/index.js.map +1 -1
- package/lib/loading-button/index.js +51 -58
- package/lib/locale/default.js +10 -12
- package/lib/locale/default.js.map +1 -1
- package/lib/locale/en_US.js +36 -38
- package/lib/locale/en_US.js.map +1 -1
- package/lib/locale/index.js +15 -37
- package/lib/locale/zh_CN.js +36 -38
- package/lib/locale/zh_CN.js.map +1 -1
- package/lib/locale-provider/index.d.ts +3 -3
- package/lib/locale-provider/index.js +22 -27
- package/lib/locale-provider/index.js.map +1 -1
- package/lib/mentions/index.d.ts +3 -3
- package/lib/mentions/index.js +19 -24
- package/lib/mentions/index.js.map +1 -1
- package/lib/menu/index.d.ts +3 -3
- package/lib/menu/index.js +19 -24
- package/lib/menu/index.js.map +1 -1
- package/lib/message/index.d.ts +3 -3
- package/lib/message/index.js +19 -24
- package/lib/message/index.js.map +1 -1
- package/lib/modal/index.d.ts +1 -1
- package/lib/modal/index.js +18 -23
- package/lib/modal/index.js.map +1 -1
- package/lib/modal/modal.d.ts +9 -9
- package/lib/modal/modal.js +45 -53
- package/lib/modal/modal.js.map +1 -1
- package/lib/notification/index.d.ts +3 -3
- package/lib/notification/index.js +19 -24
- package/lib/notification/index.js.map +1 -1
- package/lib/page/Box.js +40 -66
- package/lib/page/index.js +95 -147
- package/lib/page/utils.js +16 -22
- package/lib/page-header/index.d.ts +3 -3
- package/lib/page-header/index.js +19 -24
- package/lib/page-header/index.js.map +1 -1
- package/lib/pagination/index.d.ts +3 -3
- package/lib/pagination/index.js +19 -24
- package/lib/pagination/index.js.map +1 -1
- package/lib/popconfirm/index.d.ts +3 -3
- package/lib/popconfirm/index.js +19 -24
- package/lib/popconfirm/index.js.map +1 -1
- package/lib/popover/index.d.ts +3 -3
- package/lib/popover/index.js +19 -24
- package/lib/popover/index.js.map +1 -1
- package/lib/prev-locale.js +53 -67
- package/lib/progress/index.d.ts +3 -3
- package/lib/progress/index.js +19 -24
- package/lib/progress/index.js.map +1 -1
- package/lib/query-form/Field/Checkbox.js +22 -28
- package/lib/query-form/Field/Select.js +64 -79
- package/lib/query-form/Field/SelectInput.js +69 -85
- package/lib/query-form/Field/fieldsMap.d.ts +1 -1
- package/lib/query-form/Field/fieldsMap.js +32 -34
- package/lib/query-form/Field/index.js +91 -139
- package/lib/query-form/createActions.js +50 -53
- package/lib/query-form/index.js +282 -377
- package/lib/query-form/useForm.js +11 -11
- package/lib/query-list-scene/List.js +285 -360
- package/lib/query-list-scene/QueryForm.js +103 -161
- package/lib/query-list-scene/QueryListScene.js +31 -66
- package/lib/query-list-scene/Title.js +9 -15
- package/lib/query-list-scene/Toolbar.js +20 -31
- package/lib/query-list-scene/createActions.js +64 -79
- package/lib/query-list-scene/index.js +24 -28
- package/lib/query-list-scene/useActions.js +11 -11
- package/lib/radio/index.d.ts +3 -3
- package/lib/radio/index.js +19 -24
- package/lib/radio/index.js.map +1 -1
- package/lib/rate/index.d.ts +3 -3
- package/lib/rate/index.js +19 -24
- package/lib/rate/index.js.map +1 -1
- package/lib/render-empty/index.js +4 -8
- package/lib/render-empty/render-empty.js +22 -28
- package/lib/render-empty/render-empty.js.map +1 -1
- package/lib/result/index.d.ts +3 -3
- package/lib/result/index.js +19 -24
- package/lib/result/index.js.map +1 -1
- package/lib/row/index.d.ts +3 -3
- package/lib/row/index.js +19 -24
- package/lib/row/index.js.map +1 -1
- package/lib/select/index.d.ts +2 -2
- package/lib/select/index.js +16 -22
- package/lib/select/index.js.map +1 -1
- package/lib/select/select.d.ts +4 -4
- package/lib/select/select.d.ts.map +1 -1
- package/lib/select/select.js +29 -35
- package/lib/select/select.js.map +1 -1
- package/lib/skeleton/index.d.ts +3 -3
- package/lib/skeleton/index.js +19 -24
- package/lib/skeleton/index.js.map +1 -1
- package/lib/slider/index.d.ts +3 -3
- package/lib/slider/index.js +19 -24
- package/lib/slider/index.js.map +1 -1
- package/lib/spin/index.d.ts +3 -3
- package/lib/spin/index.js +19 -24
- package/lib/spin/index.js.map +1 -1
- package/lib/statistic/index.d.ts +3 -3
- package/lib/statistic/index.js +19 -24
- package/lib/statistic/index.js.map +1 -1
- package/lib/steps/index.d.ts +1 -1
- package/lib/steps/index.js +16 -21
- package/lib/steps/index.js.map +1 -1
- package/lib/steps/steps.d.ts +3 -3
- package/lib/steps/steps.js +55 -72
- package/lib/steps/steps.js.map +1 -1
- package/lib/svg-components/illustration-403.d.ts +1 -1
- package/lib/svg-components/illustration-403.js +80 -217
- package/lib/svg-components/illustration-404.d.ts +1 -1
- package/lib/svg-components/illustration-404.js +97 -301
- package/lib/svg-components/illustration-500.d.ts +1 -1
- package/lib/svg-components/illustration-500.js +105 -332
- package/lib/svg-components/illustration-empty.d.ts +1 -1
- package/lib/svg-components/illustration-empty.js +37 -65
- package/lib/svg-components/illustration-failure.d.ts +1 -1
- package/lib/svg-components/illustration-failure.js +58 -123
- package/lib/svg-components/illustration-no-access.d.ts +1 -1
- package/lib/svg-components/illustration-no-access.js +57 -125
- package/lib/svg-components/illustration-no-chart.d.ts +1 -1
- package/lib/svg-components/illustration-no-chart.js +59 -145
- package/lib/svg-components/illustration-no-result.d.ts +1 -1
- package/lib/svg-components/illustration-no-result.js +54 -103
- package/lib/svg-components/illustration-offline.d.ts +1 -1
- package/lib/svg-components/illustration-offline.js +65 -142
- package/lib/svg-components/illustration-success.d.ts +1 -1
- package/lib/svg-components/illustration-success.js +65 -148
- package/lib/svg-components/index.js +26 -75
- package/lib/switch/index.d.ts +3 -3
- package/lib/switch/index.js +19 -24
- package/lib/switch/index.js.map +1 -1
- package/lib/table/assets/image-loading-background.d.ts +1 -1
- package/lib/table/assets/image-loading-background.js +39 -56
- package/lib/table/assets/image-loading.d.ts +1 -1
- package/lib/table/assets/image-loading.js +27 -37
- package/lib/table/constants.js +3 -6
- package/lib/table/context.js +4 -7
- package/lib/table/hooks/index.js +13 -15
- package/lib/table/hooks/use-column-setting.d.ts +1 -1
- package/lib/table/hooks/use-column-setting.js +20 -37
- package/lib/table/hooks/use-column-setting.js.map +1 -1
- package/lib/table/index.d.ts +1 -1
- package/lib/table/index.js +16 -21
- package/lib/table/index.js.map +1 -1
- package/lib/table/table.d.ts +3 -3
- package/lib/table/table.js +90 -114
- package/lib/table/table.js.map +1 -1
- package/lib/table/table.stories.js +154 -182
- package/lib/table/utils.d.ts +1 -1
- package/lib/table/utils.js +25 -24
- package/lib/table/utils.js.map +1 -1
- package/lib/tabs/index.d.ts +3 -3
- package/lib/tabs/index.js +19 -24
- package/lib/tabs/index.js.map +1 -1
- package/lib/tag/index.d.ts +3 -3
- package/lib/tag/index.js +19 -24
- package/lib/tag/index.js.map +1 -1
- package/lib/tag/tag.less +61 -0
- package/lib/time-picker/index.d.ts +3 -3
- package/lib/time-picker/index.js +19 -24
- package/lib/time-picker/index.js.map +1 -1
- package/lib/timeline/index.d.ts +3 -3
- package/lib/timeline/index.js +19 -24
- package/lib/timeline/index.js.map +1 -1
- package/lib/title/index.js +26 -45
- package/lib/tntd-cascader/AntdCascader/component/DisabledContext.js +27 -18
- package/lib/tntd-cascader/AntdCascader/component/FormItemInputContext.js +22 -9
- package/lib/tntd-cascader/AntdCascader/component/SizeContext.js +22 -9
- package/lib/tntd-cascader/AntdCascader/component/context.js +16 -18
- package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +35 -36
- package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js.map +1 -1
- package/lib/tntd-cascader/AntdCascader/component/getIcons.js +71 -81
- package/lib/tntd-cascader/AntdCascader/component/useCompactItemContext.js +46 -31
- package/lib/tntd-cascader/AntdCascader/config/utils.d.ts +1 -1
- package/lib/tntd-cascader/AntdCascader/config/utils.js +27 -29
- package/lib/tntd-cascader/AntdCascader/config/warning.js +31 -19
- package/lib/tntd-cascader/AntdCascader/index.js +158 -216
- package/lib/tntd-cascader/AntdCascader/interface.js +6 -13
- package/lib/tntd-cascader/img/no-data-s.png +0 -0
- package/lib/tntd-cascader/index.js +8 -12
- package/lib/tntd-cascader/rc-cascader/Cascader.js +280 -325
- package/lib/tntd-cascader/rc-cascader/OptionList/Checkbox.js +37 -30
- package/lib/tntd-cascader/rc-cascader/OptionList/Column.js +148 -198
- package/lib/tntd-cascader/rc-cascader/OptionList/index.js +159 -223
- package/lib/tntd-cascader/rc-cascader/OptionList/useActive.js +44 -40
- package/lib/tntd-cascader/rc-cascader/OptionList/useKeyboard.js +162 -179
- package/lib/tntd-cascader/rc-cascader/context.js +23 -11
- package/lib/tntd-cascader/rc-cascader/hooks/useDisplayValues.js +59 -62
- package/lib/tntd-cascader/rc-cascader/hooks/useEntities.js +45 -39
- package/lib/tntd-cascader/rc-cascader/hooks/useMissingValues.js +37 -26
- package/lib/tntd-cascader/rc-cascader/hooks/useRefFunc.js +29 -16
- package/lib/tntd-cascader/rc-cascader/hooks/useSearchConfig.js +47 -30
- package/lib/tntd-cascader/rc-cascader/hooks/useSearchOptions.js +61 -75
- package/lib/tntd-cascader/rc-cascader/index.js +7 -9
- package/lib/tntd-cascader/rc-cascader/utils/commonUtil.js +38 -49
- package/lib/tntd-cascader/rc-cascader/utils/treeUtil.js +39 -42
- package/lib/tntd-cascader/rc-cascader/utils/warningPropsUtil.js +30 -34
- package/lib/tntd-form/TntdForm/components/Item.js +57 -55
- package/lib/tntd-form/TntdForm/components/ItemComp.js +186 -203
- package/lib/tntd-form/TntdForm/components/List.js +107 -118
- package/lib/tntd-form/TntdForm/index.js +63 -61
- package/lib/tntd-form/TntdForm/interface.js +2 -4
- package/lib/tntd-form/TntdForm/store.js +7 -8
- package/lib/tntd-form/TntdForm/utils.js +184 -182
- package/lib/tntd-form/index.js +8 -12
- package/lib/tntd-icon/fonts/iconfont.js +53 -36
- package/lib/tntd-icon/index.js +25 -40
- package/lib/tntd-layout/ActionsContext.js +4 -8
- package/lib/tntd-layout/AppList.js +220 -173
- package/lib/tntd-layout/Application.js +107 -75
- package/lib/tntd-layout/Avatar.js +131 -100
- package/lib/tntd-layout/CompatibleLanguage.js +176 -128
- package/lib/tntd-layout/EnterpriseLayout/Avatar.js +142 -117
- package/lib/tntd-layout/EnterpriseLayout/Language.js +86 -73
- package/lib/tntd-layout/EnterpriseLayout/Theme.js +98 -69
- package/lib/tntd-layout/EnterpriseLayout/index.js +17 -28
- package/lib/tntd-layout/GlobalNavigation/NavigationPopup.js +272 -283
- package/lib/tntd-layout/GlobalNavigation/index.js +111 -108
- package/lib/tntd-layout/Header.js +132 -77
- package/lib/tntd-layout/HeaderActions.js +102 -105
- package/lib/tntd-layout/HeaderNavs.js +103 -78
- package/lib/tntd-layout/HeaderTabs.js +312 -224
- package/lib/tntd-layout/Iconfont.js +7 -11
- package/lib/tntd-layout/Language.js +72 -69
- package/lib/tntd-layout/Layout.js +167 -214
- package/lib/tntd-layout/Logo.js +140 -69
- package/lib/tntd-layout/OrgAppList.js +384 -238
- package/lib/tntd-layout/SideMenu.js +404 -269
- package/lib/tntd-layout/Theme.js +89 -75
- package/lib/tntd-layout/createActions.js +34 -45
- package/lib/tntd-layout/images/avatar/empty.png +0 -0
- package/lib/tntd-layout/images/avatar/female1.png +0 -0
- package/lib/tntd-layout/images/avatar/female2.png +0 -0
- package/lib/tntd-layout/images/avatar/female3.png +0 -0
- package/lib/tntd-layout/images/avatar/female4.png +0 -0
- package/lib/tntd-layout/images/avatar/female5.png +0 -0
- package/lib/tntd-layout/images/avatar/female6.png +0 -0
- package/lib/tntd-layout/images/avatar/male1.png +0 -0
- package/lib/tntd-layout/images/avatar/male2.png +0 -0
- package/lib/tntd-layout/images/avatar/male3.png +0 -0
- package/lib/tntd-layout/images/avatar/male4.png +0 -0
- package/lib/tntd-layout/images/avatar/male5.png +0 -0
- package/lib/tntd-layout/images/avatar/male6.png +0 -0
- package/lib/tntd-layout/images/index.js +66 -68
- package/lib/tntd-layout/index.js +91 -137
- package/lib/tntd-layout/paaslayout/CompactSideMenu.js +178 -131
- package/lib/tntd-layout/paaslayout/Header.js +75 -51
- package/lib/tntd-layout/paaslayout/Logo.js +30 -15
- package/lib/tntd-layout/paaslayout/SideMenu.js +143 -131
- package/lib/tntd-layout/paaslayout/index.js +137 -205
- package/lib/tntd-layout/storage.js +30 -58
- package/lib/tntd-modal/index.js +58 -98
- package/lib/tntd-second-page/index.js +33 -60
- package/lib/tntd-second-page/index.js.map +1 -1
- package/lib/tntd-select/DropDownWrap.js +74 -102
- package/lib/tntd-select/index.d.ts +1 -1
- package/lib/tntd-select/index.js +528 -625
- package/lib/tntd-select/index.js.map +1 -1
- package/lib/tooltip/index.d.ts +3 -3
- package/lib/tooltip/index.js +19 -24
- package/lib/tooltip/index.js.map +1 -1
- package/lib/transfer/index.d.ts +3 -3
- package/lib/transfer/index.js +19 -24
- package/lib/transfer/index.js.map +1 -1
- package/lib/tree/index.d.ts +3 -3
- package/lib/tree/index.js +19 -24
- package/lib/tree/index.js.map +1 -1
- package/lib/tree-select/index.d.ts +3 -3
- package/lib/tree-select/index.js +19 -24
- package/lib/tree-select/index.js.map +1 -1
- package/lib/typography/index.d.ts +3 -3
- package/lib/typography/index.js +19 -24
- package/lib/typography/index.js.map +1 -1
- package/lib/upload/index.d.ts +3 -3
- package/lib/upload/index.js +19 -24
- package/lib/upload/index.js.map +1 -1
- package/lib/utils/checkAuth.js +23 -34
- package/lib/utils/findMenuInfoByPath.js +34 -41
- package/lib/utils/index.js +76 -117
- package/lib/version/index.d.ts +3 -3
- package/lib/version/index.js +19 -24
- package/lib/version/index.js.map +1 -1
- package/package.json +1 -1
- package/lib/tntd-form/CustomForm/components/Item.js +0 -50
- package/lib/tntd-form/CustomForm/components/ItemComp.js +0 -169
- package/lib/tntd-form/CustomForm/components/List.js +0 -96
- package/lib/tntd-form/CustomForm/index.js +0 -66
- package/lib/tntd-form/CustomForm/interface.js +0 -5
- package/lib/tntd-form/CustomForm/store.js +0 -10
- package/lib/tntd-form/CustomForm/utils.js +0 -235
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _utils = require("../utils");
|
|
10
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
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); }
|
|
14
|
-
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; }
|
|
15
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
16
|
-
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); }
|
|
17
|
-
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
|
18
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
19
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20
|
-
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."); }
|
|
21
|
-
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); }
|
|
22
|
-
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; }
|
|
23
|
-
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; } }
|
|
24
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
|
-
var ItemComp = function ItemComp(_ref) {
|
|
26
|
-
var form = _ref.form,
|
|
27
|
-
name = _ref.name,
|
|
28
|
-
children = _ref.children,
|
|
29
|
-
style = _ref.style,
|
|
30
|
-
initialValues = _ref.initialValues,
|
|
31
|
-
initialValue = _ref.initialValue,
|
|
32
|
-
rules = _ref.rules,
|
|
33
|
-
setCurrentChangeKeys = _ref.setCurrentChangeKeys;
|
|
34
|
-
var _useState = (0, _react.useState)(undefined),
|
|
35
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
-
value = _useState2[0],
|
|
37
|
-
setValue = _useState2[1];
|
|
38
|
-
var _useState3 = (0, _react.useState)(undefined),
|
|
39
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
40
|
-
errorMsg = _useState4[0],
|
|
41
|
-
setErrorMsg = _useState4[1];
|
|
42
|
-
/**
|
|
43
|
-
* 动态修改form内部的值,为啥不在useEffect里面处理的原因是子组件的useEffect会比父组件useEffect先执行,需要保证在子组件useEffect监听value变化的时候获取到的formData永远是最新的
|
|
44
|
-
* @param name
|
|
45
|
-
* @param value
|
|
46
|
-
* @returns
|
|
47
|
-
*/
|
|
48
|
-
var generateFormData = function generateFormData(name, value) {
|
|
49
|
-
if (!name || !form) return;
|
|
50
|
-
var _name = _toArray(name),
|
|
51
|
-
str = _name[0],
|
|
52
|
-
rest = _name.slice(1);
|
|
53
|
-
rest.forEach(function (i) {
|
|
54
|
-
if (form.formData[str]) {
|
|
55
|
-
form.formData[str][i].value = value;
|
|
56
|
-
form.formData[str][i].checkItem = function () {
|
|
57
|
-
var error = (0, _utils.handleCheckItem)(value, rules);
|
|
58
|
-
setErrorMsg(error);
|
|
59
|
-
return error;
|
|
60
|
-
};
|
|
61
|
-
} else {
|
|
62
|
-
form.formData[str] = _defineProperty({}, i, {
|
|
63
|
-
value: value,
|
|
64
|
-
checkItem: function checkItem() {
|
|
65
|
-
var error = (0, _utils.handleCheckItem)(value, rules);
|
|
66
|
-
setErrorMsg(error);
|
|
67
|
-
return error;
|
|
68
|
-
},
|
|
69
|
-
setItemValue: function setItemValue() {},
|
|
70
|
-
errorMsg: undefined
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
// 为了给最外层提供方法去校验,比如保存的时候.
|
|
76
|
-
// 这里依赖不要添加value,因为子组件的useEffect会比父组件useEffect先执行,如果添加了依赖value会导致子组件获取到的formData永远是上一次的
|
|
77
|
-
(0, _react.useEffect)(function () {
|
|
78
|
-
if (!name || !form) return;
|
|
79
|
-
var _name2 = _toArray(name),
|
|
80
|
-
str = _name2[0],
|
|
81
|
-
rest = _name2.slice(1);
|
|
82
|
-
var addItem = {
|
|
83
|
-
setItemValue: function setItemValue(_val, callback) {
|
|
84
|
-
var error = (0, _utils.handleCheckItem)(_val, rules);
|
|
85
|
-
setValue(_val);
|
|
86
|
-
setErrorMsg(error);
|
|
87
|
-
callback === null || callback === void 0 ? void 0 : callback();
|
|
88
|
-
},
|
|
89
|
-
checkItem: function checkItem() {
|
|
90
|
-
var error = (0, _utils.handleCheckItem)(value, rules);
|
|
91
|
-
setErrorMsg(error);
|
|
92
|
-
return error;
|
|
93
|
-
},
|
|
94
|
-
value: value,
|
|
95
|
-
errorMsg: errorMsg
|
|
96
|
-
};
|
|
97
|
-
rest.forEach(function (i) {
|
|
98
|
-
if (form.formData[str]) {
|
|
99
|
-
form.formData[str][i] = addItem;
|
|
100
|
-
} else {
|
|
101
|
-
form.formData[str] = _defineProperty({}, i, addItem);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}, [rules, name, errorMsg, form]);
|
|
105
|
-
/** 这段代码不能删除,当增加/删除列的时候有些默认值需要更新 */
|
|
106
|
-
(0, _react.useEffect)(function () {
|
|
107
|
-
if (initialValue) {
|
|
108
|
-
setValue(initialValue);
|
|
109
|
-
generateFormData(name, initialValue);
|
|
110
|
-
}
|
|
111
|
-
}, [initialValue]);
|
|
112
|
-
// 初始化设置默认值,
|
|
113
|
-
(0, _react.useEffect)(function () {
|
|
114
|
-
var _a;
|
|
115
|
-
var initValue = (0, _utils.getInitValue)(initialValues, name);
|
|
116
|
-
// @ts-ignore
|
|
117
|
-
var _value = ['', null, undefined].includes(initValue) ? initialValue : initValue;
|
|
118
|
-
setValue(_value);
|
|
119
|
-
generateFormData(name, _value);
|
|
120
|
-
if (name) {
|
|
121
|
-
setCurrentChangeKeys([(_a = (0, _utils.getNames)(name)) === null || _a === void 0 ? void 0 : _a.join('.')]);
|
|
122
|
-
}
|
|
123
|
-
}, []);
|
|
124
|
-
// 默认方法
|
|
125
|
-
var handleChange = function handleChange(e) {
|
|
126
|
-
var _a, _b;
|
|
127
|
-
var val;
|
|
128
|
-
if (_typeof(e) === 'object') {
|
|
129
|
-
val = (_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.value;
|
|
130
|
-
} else {
|
|
131
|
-
val = e;
|
|
132
|
-
}
|
|
133
|
-
setValue(val);
|
|
134
|
-
generateFormData(name, val);
|
|
135
|
-
var error = (0, _utils.handleCheckItem)(val, rules);
|
|
136
|
-
setErrorMsg(error);
|
|
137
|
-
if (name) {
|
|
138
|
-
setCurrentChangeKeys([(_b = (0, _utils.getNames)(name)) === null || _b === void 0 ? void 0 : _b.join('.')]);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
return _react["default"].createElement("div", {
|
|
142
|
-
className: errorMsg ? 'has-error custom-form-item-wrapper' : 'custom-form-item-wrapper',
|
|
143
|
-
style: style
|
|
144
|
-
}, _react["default"].Children.map(children, function (child) {
|
|
145
|
-
var _a;
|
|
146
|
-
if (_react["default"].isValidElement(child)) {
|
|
147
|
-
return _react["default"].cloneElement(child, Object.assign({
|
|
148
|
-
value: value,
|
|
149
|
-
form: form,
|
|
150
|
-
onChange: handleChange,
|
|
151
|
-
'data-key': (_a = (0, _utils.getNames)(name)) === null || _a === void 0 ? void 0 : _a.join('.')
|
|
152
|
-
}, child.props));
|
|
153
|
-
}
|
|
154
|
-
return null;
|
|
155
|
-
}), errorMsg && _react["default"].createElement("div", {
|
|
156
|
-
className: "ant-form-explain ant-form-item-explain-error"
|
|
157
|
-
}, errorMsg));
|
|
158
|
-
};
|
|
159
|
-
function arePropsEqual(prevProps, nextProps) {
|
|
160
|
-
if (Array.isArray(nextProps.currentChangeKeys) && nextProps.currentChangeKeys.length && (0, _isEqual2["default"])(prevProps.initialValues, nextProps.initialValues) && !nextProps.currentChangeKeys.includes((0, _utils.getNames)(nextProps.name).join('.')) && !nextProps.shouldUpdate && Array.isArray(nextProps.dependencies) && nextProps.dependencies.every(function (i) {
|
|
161
|
-
var _a;
|
|
162
|
-
return !((_a = nextProps.currentChangeKeys) === null || _a === void 0 ? void 0 : _a.includes((0, _utils.getNames)(i).join('.')));
|
|
163
|
-
})) {
|
|
164
|
-
return true;
|
|
165
|
-
}
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
var _default = (0, _react.memo)(ItemComp, arePropsEqual);
|
|
169
|
-
exports["default"] = _default;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
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); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = void 0;
|
|
8
|
-
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
9
|
-
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _utils = require("../utils");
|
|
12
|
-
var _store = require("../store");
|
|
13
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
|
-
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; } } }; }
|
|
17
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
-
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."); }
|
|
19
|
-
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); }
|
|
20
|
-
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; }
|
|
21
|
-
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; } }
|
|
22
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
-
var List = function List(_ref) {
|
|
24
|
-
var name = _ref.name,
|
|
25
|
-
children = _ref.children;
|
|
26
|
-
var maxRef = (0, _react.useRef)(-1);
|
|
27
|
-
var _useContext = (0, _react.useContext)(_store.FormContext),
|
|
28
|
-
form = _useContext.form,
|
|
29
|
-
initialValues = _useContext.initialValues;
|
|
30
|
-
var _useState = (0, _react.useState)([]),
|
|
31
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
-
dataLevel = _useState2[0],
|
|
33
|
-
setDataLevel = _useState2[1];
|
|
34
|
-
(0, _react.useEffect)(function () {
|
|
35
|
-
var key = Array.isArray(name) ? name === null || name === void 0 ? void 0 : name[0] : name;
|
|
36
|
-
if (form && form.dataLevel) {
|
|
37
|
-
form.dataLevel[key] = dataLevel;
|
|
38
|
-
}
|
|
39
|
-
}, [form, dataLevel, name]);
|
|
40
|
-
/** 根据默认数值自动生成dataLevel */
|
|
41
|
-
(0, _react.useEffect)(function () {
|
|
42
|
-
var dataSource = initialValues;
|
|
43
|
-
var attrs = (0, _utils.getNames)(name);
|
|
44
|
-
var _iterator = _createForOfIteratorHelper(attrs),
|
|
45
|
-
_step;
|
|
46
|
-
try {
|
|
47
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
48
|
-
var key = _step.value;
|
|
49
|
-
dataSource = (dataSource === null || dataSource === void 0 ? void 0 : dataSource[key]) || [{}];
|
|
50
|
-
}
|
|
51
|
-
} catch (err) {
|
|
52
|
-
_iterator.e(err);
|
|
53
|
-
} finally {
|
|
54
|
-
_iterator.f();
|
|
55
|
-
}
|
|
56
|
-
if (Array.isArray(dataSource)) {
|
|
57
|
-
var _level = dataSource.map(function (i, index) {
|
|
58
|
-
return {
|
|
59
|
-
key: index,
|
|
60
|
-
name: "".concat(attrs.join('.'), ".").concat(index)
|
|
61
|
-
};
|
|
62
|
-
});
|
|
63
|
-
setDataLevel(_level);
|
|
64
|
-
maxRef.current = dataSource.length - 1;
|
|
65
|
-
}
|
|
66
|
-
}, [initialValues, name]);
|
|
67
|
-
/** 新增一列 */
|
|
68
|
-
var handleAdd = function handleAdd(index) {
|
|
69
|
-
var tempDataLevel = (0, _cloneDeep2["default"])(dataLevel);
|
|
70
|
-
maxRef.current++;
|
|
71
|
-
var attrs = (0, _utils.getNames)(name);
|
|
72
|
-
tempDataLevel.splice(index + 1, 0, {
|
|
73
|
-
key: maxRef.current,
|
|
74
|
-
name: "".concat(attrs === null || attrs === void 0 ? void 0 : attrs.join('.'), ".").concat(maxRef.current)
|
|
75
|
-
});
|
|
76
|
-
setDataLevel(tempDataLevel);
|
|
77
|
-
};
|
|
78
|
-
/** 删除一列 */
|
|
79
|
-
var handleDel = function handleDel(index) {
|
|
80
|
-
var temp = (0, _cloneDeep2["default"])(dataLevel);
|
|
81
|
-
temp.splice(index, 1);
|
|
82
|
-
setDataLevel(temp);
|
|
83
|
-
};
|
|
84
|
-
return _react["default"].createElement(_react["default"].Fragment, null, children === null || children === void 0 ? void 0 : children(dataLevel, {
|
|
85
|
-
add: handleAdd,
|
|
86
|
-
remove: handleDel
|
|
87
|
-
}));
|
|
88
|
-
};
|
|
89
|
-
// name 没有改变就不需要重复render
|
|
90
|
-
var _default = (0, _react.memo)(List, function (nextProps, prevProps) {
|
|
91
|
-
if ((0, _isEqual2["default"])(nextProps.name, prevProps.name) && !!prevProps.name) {
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
return false;
|
|
95
|
-
});
|
|
96
|
-
exports["default"] = _default;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
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); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = void 0;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _utils = require("./utils");
|
|
10
|
-
var _store = require("./store");
|
|
11
|
-
var _List = _interopRequireDefault(require("./components/List"));
|
|
12
|
-
var _Item = _interopRequireDefault(require("./components/Item"));
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
-
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."); }
|
|
18
|
-
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); }
|
|
19
|
-
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; }
|
|
20
|
-
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; } }
|
|
21
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
-
var CustomForm = function CustomForm(_ref) {
|
|
23
|
-
var form = _ref.form,
|
|
24
|
-
initialValues = _ref.initialValues,
|
|
25
|
-
children = _ref.children;
|
|
26
|
-
// 这个是为了获取当前是哪一个单元格在输入
|
|
27
|
-
var _useState = (0, _react.useState)([]),
|
|
28
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
-
currentChangeKeys = _useState2[0],
|
|
30
|
-
setCurrentChangeKeys = _useState2[1];
|
|
31
|
-
return _react["default"].createElement(_store.FormContext.Provider, {
|
|
32
|
-
value: {
|
|
33
|
-
form: form,
|
|
34
|
-
initialValues: initialValues,
|
|
35
|
-
currentChangeKeys: currentChangeKeys,
|
|
36
|
-
setCurrentChangeKeys: setCurrentChangeKeys
|
|
37
|
-
}
|
|
38
|
-
}, children);
|
|
39
|
-
};
|
|
40
|
-
CustomForm.useForm = function () {
|
|
41
|
-
var form = (0, _react.useRef)({
|
|
42
|
-
dataLevel: [],
|
|
43
|
-
formData: {},
|
|
44
|
-
validateFields: function validateFields() {
|
|
45
|
-
return (0, _utils.validateFields)(form.current);
|
|
46
|
-
},
|
|
47
|
-
getFieldsValue: function getFieldsValue() {
|
|
48
|
-
return (0, _utils.getFieldsValue)(form.current);
|
|
49
|
-
},
|
|
50
|
-
getFieldValue: function getFieldValue(field) {
|
|
51
|
-
return (0, _utils.getFieldValue)(form.current, field);
|
|
52
|
-
},
|
|
53
|
-
setFieldsValue: function setFieldsValue(obj) {
|
|
54
|
-
for (var i in obj) {
|
|
55
|
-
for (var attr in obj[i]) {
|
|
56
|
-
form.current.formData[i][attr].setItemValue(obj[i][attr]);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
return [form.current];
|
|
62
|
-
};
|
|
63
|
-
CustomForm.List = _List["default"];
|
|
64
|
-
CustomForm.Item = _Item["default"];
|
|
65
|
-
var _default = CustomForm;
|
|
66
|
-
exports["default"] = _default;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.FormContext = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
-
var FormContext = _react["default"].createContext({});
|
|
10
|
-
exports.FormContext = FormContext;
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.validateFields = exports.recursionSort = exports.recursionCheck = exports.isValidKey = exports.handleCheckItem = exports.getNames = exports.getInitValue = exports.getFieldsValue = exports.getFieldValue = void 0;
|
|
7
|
-
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
|
8
|
-
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."); }
|
|
9
|
-
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); }
|
|
10
|
-
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; }
|
|
11
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
/**
|
|
14
|
-
* 将xx.xx.xx 转换为数组
|
|
15
|
-
* @param {*} name
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
var getNames = function getNames(name) {
|
|
19
|
-
var attrs = [];
|
|
20
|
-
if (Array.isArray(name)) {
|
|
21
|
-
var _name = _toArray(name),
|
|
22
|
-
str = _name[0],
|
|
23
|
-
rest = _name.slice(1);
|
|
24
|
-
attrs = str.split('.').concat(rest);
|
|
25
|
-
} else {
|
|
26
|
-
attrs = typeof name === 'string' ? name.split('.') : [];
|
|
27
|
-
}
|
|
28
|
-
return attrs;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* 对数据进行校验
|
|
32
|
-
* @param {*} list
|
|
33
|
-
* @param {*} dataLevel
|
|
34
|
-
* @param {*} formData
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
exports.getNames = getNames;
|
|
38
|
-
var recursionCheck = function recursionCheck(list, dataLevel, formData) {
|
|
39
|
-
var errorList = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
40
|
-
try {
|
|
41
|
-
if (Array.isArray(list)) {
|
|
42
|
-
list.forEach(function (item) {
|
|
43
|
-
var key = item.name;
|
|
44
|
-
var attrs = Object.keys(formData[key]);
|
|
45
|
-
attrs.forEach(function (attr) {
|
|
46
|
-
var _a;
|
|
47
|
-
var error = (_a = formData[item.name][attr]) === null || _a === void 0 ? void 0 : _a.checkItem();
|
|
48
|
-
if (error) {
|
|
49
|
-
errorList.push("".concat([item.name + '.' + attr], ":"), error);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
if (dataLevel[key]) {
|
|
53
|
-
recursionCheck(dataLevel[key], dataLevel, formData, errorList);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
return errorList;
|
|
58
|
-
} catch (e) {
|
|
59
|
-
if (typeof e === 'string') {
|
|
60
|
-
throw e.toUpperCase();
|
|
61
|
-
} else if (e instanceof Error) {
|
|
62
|
-
throw e.message;
|
|
63
|
-
}
|
|
64
|
-
throw e;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* 将数据进行排序
|
|
69
|
-
* @param {*} list
|
|
70
|
-
* @param {*} dataLevel
|
|
71
|
-
* @param {*} formData
|
|
72
|
-
* @param {*} errorList
|
|
73
|
-
* @returns
|
|
74
|
-
*/
|
|
75
|
-
exports.recursionCheck = recursionCheck;
|
|
76
|
-
var recursionSort = function recursionSort(list, dataLevel, formData) {
|
|
77
|
-
try {
|
|
78
|
-
if (Array.isArray(list)) {
|
|
79
|
-
var values = list.reduce(function (total, item, index) {
|
|
80
|
-
var attrObj = {};
|
|
81
|
-
var key = item.name;
|
|
82
|
-
var prefixs = key.split('.');
|
|
83
|
-
var attrs = Object.keys(formData[key]);
|
|
84
|
-
attrs.forEach(function (attr) {
|
|
85
|
-
var _a;
|
|
86
|
-
attrObj[attr] = (_a = formData[key][attr]) === null || _a === void 0 ? void 0 : _a.value;
|
|
87
|
-
});
|
|
88
|
-
var children = [];
|
|
89
|
-
if (dataLevel[key]) {
|
|
90
|
-
children = recursionSort(dataLevel[key], dataLevel, formData);
|
|
91
|
-
}
|
|
92
|
-
var len = prefixs.length - 2;
|
|
93
|
-
if (total[prefixs[len]]) {
|
|
94
|
-
total[prefixs[len]][index] = Object.assign(Object.assign({}, attrObj), children || []);
|
|
95
|
-
} else {
|
|
96
|
-
total[prefixs[len]] = [Object.assign(Object.assign({}, attrObj), children || [])];
|
|
97
|
-
}
|
|
98
|
-
return total;
|
|
99
|
-
}, {});
|
|
100
|
-
return values;
|
|
101
|
-
}
|
|
102
|
-
} catch (e) {
|
|
103
|
-
if (typeof e === 'string') {
|
|
104
|
-
console.error(e.toUpperCase());
|
|
105
|
-
throw e.toUpperCase();
|
|
106
|
-
} else if (e instanceof Error) {
|
|
107
|
-
console.error(e.message);
|
|
108
|
-
throw e.message;
|
|
109
|
-
}
|
|
110
|
-
throw e;
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* 获取form表单的value
|
|
115
|
-
* @param {*} formCurrent
|
|
116
|
-
* @returns
|
|
117
|
-
*/
|
|
118
|
-
exports.recursionSort = recursionSort;
|
|
119
|
-
var getFieldsValue = function getFieldsValue(formCurrent) {
|
|
120
|
-
try {
|
|
121
|
-
var formData = formCurrent.formData,
|
|
122
|
-
dataLevel = formCurrent.dataLevel;
|
|
123
|
-
var firstKey = '';
|
|
124
|
-
// 这里不直接用Object.keys的原因是Object.keys并不能保证一定是按照属性顺序
|
|
125
|
-
for (var i in dataLevel) {
|
|
126
|
-
firstKey = i;
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
var recursionStart = dataLevel[firstKey];
|
|
130
|
-
var values = recursionSort(recursionStart, dataLevel, formData);
|
|
131
|
-
return values;
|
|
132
|
-
} catch (e) {
|
|
133
|
-
if (typeof e === 'string') {
|
|
134
|
-
console.error(e.toUpperCase());
|
|
135
|
-
return e.toUpperCase();
|
|
136
|
-
} else if (e instanceof Error) {
|
|
137
|
-
console.error(e.message);
|
|
138
|
-
return e.message;
|
|
139
|
-
}
|
|
140
|
-
return e;
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
/**
|
|
144
|
-
* 获取form表单的value
|
|
145
|
-
* @param {*} formCurrent
|
|
146
|
-
* @returns
|
|
147
|
-
*/
|
|
148
|
-
exports.getFieldsValue = getFieldsValue;
|
|
149
|
-
var getFieldValue = function getFieldValue(formCurrent, field) {
|
|
150
|
-
var _a, _b;
|
|
151
|
-
try {
|
|
152
|
-
var formData = formCurrent.formData;
|
|
153
|
-
return formData && ((_b = (_a = formData === null || formData === void 0 ? void 0 : formData[field[0]]) === null || _a === void 0 ? void 0 : _a[field[1]]) === null || _b === void 0 ? void 0 : _b.value);
|
|
154
|
-
} catch (e) {
|
|
155
|
-
if (typeof e === 'string') {
|
|
156
|
-
return e.toUpperCase();
|
|
157
|
-
} else if (e instanceof Error) {
|
|
158
|
-
return e.message;
|
|
159
|
-
}
|
|
160
|
-
return e;
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
/**
|
|
164
|
-
* 提交时候校验的方法
|
|
165
|
-
* @param {*} formCurrent
|
|
166
|
-
* @returns
|
|
167
|
-
*/
|
|
168
|
-
exports.getFieldValue = getFieldValue;
|
|
169
|
-
var validateFields = function validateFields(formCurrent) {
|
|
170
|
-
return new Promise(function (resolve) {
|
|
171
|
-
var formData = formCurrent.formData,
|
|
172
|
-
dataLevel = formCurrent.dataLevel;
|
|
173
|
-
var firstKey = '';
|
|
174
|
-
// 这里不直接用Object.keys的原因是Object.keys并不能保证一定是按照属性顺序
|
|
175
|
-
for (var i in dataLevel) {
|
|
176
|
-
firstKey = i;
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
var recursionStart = dataLevel[firstKey];
|
|
180
|
-
var errorList = recursionCheck(recursionStart, dataLevel, formData);
|
|
181
|
-
if (Array.isArray(errorList) && errorList.length) {
|
|
182
|
-
console.error(JSON.stringify(errorList));
|
|
183
|
-
} else {
|
|
184
|
-
resolve(recursionSort(recursionStart, dataLevel, formData));
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
|
-
/** 获取初始化的值 */
|
|
189
|
-
exports.validateFields = validateFields;
|
|
190
|
-
var getInitValue = function getInitValue(initialValues, names) {
|
|
191
|
-
var keys;
|
|
192
|
-
if (Array.isArray(names)) {
|
|
193
|
-
var _names = _toArray(names),
|
|
194
|
-
str = _names[0],
|
|
195
|
-
rest = _names.slice(1);
|
|
196
|
-
keys = str.split('.').concat(rest);
|
|
197
|
-
}
|
|
198
|
-
if (Array.isArray(keys)) {
|
|
199
|
-
keys.forEach(function (i) {
|
|
200
|
-
initialValues = ['', null, undefined].includes(initialValues === null || initialValues === void 0 ? void 0 : initialValues[i]) ? undefined : initialValues === null || initialValues === void 0 ? void 0 : initialValues[i];
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
return initialValues;
|
|
204
|
-
};
|
|
205
|
-
/** 校验表单是否正确的方法 */
|
|
206
|
-
exports.getInitValue = getInitValue;
|
|
207
|
-
var handleCheckItem = function handleCheckItem(value, rules) {
|
|
208
|
-
try {
|
|
209
|
-
if (Array.isArray(rules)) {
|
|
210
|
-
rules.forEach(function (i) {
|
|
211
|
-
// @ts-ignore
|
|
212
|
-
if (i.required && ['', null, undefined].includes(value)) {
|
|
213
|
-
throw new Error((i === null || i === void 0 ? void 0 : i.message) || 'error');
|
|
214
|
-
}
|
|
215
|
-
if (i === null || i === void 0 ? void 0 : i.validator) {
|
|
216
|
-
i.validator(rules, value, function (_errorMsg) {
|
|
217
|
-
throw new Error(_errorMsg);
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
return;
|
|
223
|
-
} catch (e) {
|
|
224
|
-
if (typeof e === 'string') {
|
|
225
|
-
return e.toUpperCase();
|
|
226
|
-
} else if (e instanceof Error) {
|
|
227
|
-
return e.message;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
exports.handleCheckItem = handleCheckItem;
|
|
232
|
-
var isValidKey = function isValidKey(key, object) {
|
|
233
|
-
return key in object;
|
|
234
|
-
};
|
|
235
|
-
exports.isValidKey = isValidKey;
|