vap1 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/basetype.d.ts +62 -0
- package/basetype.js +2 -0
- package/components/Box/Box.d.ts +118 -0
- package/components/Box/Box.js +150 -0
- package/components/Box/SelectBar.d.ts +90 -0
- package/components/Box/SelectBar.js +93 -0
- package/components/Box/_register.d.ts +49 -0
- package/components/Box/_register.js +29 -0
- package/components/Box/index.d.ts +9 -0
- package/components/Box/index.js +6 -0
- package/components/Lists/SList.d.ts +58 -0
- package/components/Lists/SList.js +167 -0
- package/components/SearchBar/ActionButtons.d.ts +49 -0
- package/components/SearchBar/ActionButtons.js +96 -0
- package/components/SearchBar/ByField.d.ts +3 -0
- package/components/SearchBar/ByField.js +193 -0
- package/components/SearchBar/ByKeyword.d.ts +3 -0
- package/components/SearchBar/ByKeyword.js +34 -0
- package/components/SearchBar/SearchField.d.ts +15 -0
- package/components/SearchBar/SearchField.js +25 -0
- package/components/SearchBar/SearchTags.d.ts +2 -0
- package/components/SearchBar/SearchTags.js +18 -0
- package/components/SearchBar/_FieldType.d.ts +8 -0
- package/components/SearchBar/_FieldType.js +45 -0
- package/components/SearchBar/_register.d.ts +65 -0
- package/components/SearchBar/_register.js +29 -0
- package/components/SearchBar/index.d.ts +134 -0
- package/components/SearchBar/index.js +33 -0
- package/components/Tables/ApiTable.d.ts +18 -0
- package/components/Tables/ApiTable.js +48 -0
- package/components/Tables/ApiTableModal.d.ts +22 -0
- package/components/Tables/ApiTableModal.js +73 -0
- package/components/Tables/Components/ActionBar.d.ts +56 -0
- package/components/Tables/Components/ActionBar.js +100 -0
- package/components/Tables/Components/Actions.d.ts +47 -0
- package/components/Tables/Components/Actions.js +91 -0
- package/components/Tables/Components/Summary.d.ts +11 -0
- package/components/Tables/Components/Summary.js +11 -0
- package/components/Tables/Components/index.d.ts +17 -0
- package/components/Tables/Components/index.js +19 -0
- package/components/Tables/STable.d.ts +5 -0
- package/components/Tables/STable.js +37 -0
- package/components/Tables/TopTable.d.ts +24 -0
- package/components/Tables/TopTable.js +157 -0
- package/components/Tables/TopTableModal.d.ts +5 -0
- package/components/Tables/TopTableModal.js +20 -0
- package/components/Tables/Util.d.ts +3 -0
- package/components/Tables/Util.js +41 -0
- package/components/Tables/VTable.d.ts +11 -0
- package/components/Tables/VTable.js +237 -0
- package/components/Tables/index.d.ts +81 -0
- package/components/Tables/index.js +20 -0
- package/components/TreeSelect/BaseTreeSelect.d.ts +33 -0
- package/components/TreeSelect/BaseTreeSelect.js +190 -0
- package/components/TreeSelect/DTreeSelect.d.ts +24 -0
- package/components/TreeSelect/DTreeSelect.js +66 -0
- package/components/TreeSelect/FTreeSelect.d.ts +11 -0
- package/components/TreeSelect/FTreeSelect.js +39 -0
- package/components/TreeSelect/STreeSelect.d.ts +14 -0
- package/components/TreeSelect/STreeSelect.js +52 -0
- package/components/TreeSelect/index.d.ts +94 -0
- package/components/TreeSelect/index.js +9 -0
- package/components/Trees/ActionTree.d.ts +54 -0
- package/components/Trees/ActionTree.js +657 -0
- package/components/Trees/BaseTree.d.ts +31 -0
- package/components/Trees/BaseTree.js +185 -0
- package/components/Trees/DTree.d.ts +48 -0
- package/components/Trees/DTree.js +142 -0
- package/components/Trees/FTree.d.ts +33 -0
- package/components/Trees/FTree.js +79 -0
- package/components/Trees/STree.d.ts +21 -0
- package/components/Trees/STree.js +92 -0
- package/components/Trees/index.d.ts +134 -0
- package/components/Trees/index.js +9 -0
- package/components/UForm/FormWrapper.d.ts +22 -0
- package/components/UForm/FormWrapper.js +270 -0
- package/components/UForm/UDescriptions.d.ts +5 -0
- package/components/UForm/UDescriptions.js +134 -0
- package/components/UForm/UForm.d.ts +33 -0
- package/components/UForm/UForm.js +484 -0
- package/components/UForm/UFormModal.d.ts +3 -0
- package/components/UForm/UFormModal.js +149 -0
- package/components/UForm/UInfo.d.ts +10 -0
- package/components/UForm/UInfo.js +75 -0
- package/components/UForm/UInfoModal.d.ts +3 -0
- package/components/UForm/UInfoModal.js +50 -0
- package/components/UForm/UModal.d.ts +3 -0
- package/components/UForm/UModal.js +24 -0
- package/components/UForm/_FieldType.d.ts +8 -0
- package/components/UForm/_FieldType.js +100 -0
- package/components/UForm/_FormUtils.d.ts +5 -0
- package/components/UForm/_FormUtils.js +75 -0
- package/components/UForm/_input.d.ts +59 -0
- package/components/UForm/_input.js +147 -0
- package/components/UForm/_register.d.ts +87 -0
- package/components/UForm/_register.js +44 -0
- package/components/UForm/index.d.ts +387 -0
- package/components/UForm/index.js +15 -0
- package/components/Upload/UploadFile.d.ts +3 -0
- package/components/Upload/UploadFile.js +40 -0
- package/components/Upload/UploadImage.d.ts +24 -0
- package/components/Upload/UploadImage.js +93 -0
- package/components/Upload/UploadModal.d.ts +50 -0
- package/components/Upload/UploadModal.js +140 -0
- package/components/Upload/index.d.ts +77 -0
- package/components/Upload/index.js +9 -0
- package/components/Upload/useUpload.d.ts +15 -0
- package/components/Upload/useUpload.js +93 -0
- package/components/_RegisterUtil.d.ts +1 -0
- package/components/_RegisterUtil.js +25 -0
- package/components/_adapt/Alert.d.ts +11 -0
- package/components/_adapt/Alert.js +43 -0
- package/components/_adapt/Button.d.ts +20 -0
- package/components/_adapt/Button.js +26 -0
- package/components/_adapt/Col.d.ts +53 -0
- package/components/_adapt/Col.js +90 -0
- package/components/_adapt/Collapse.d.ts +30 -0
- package/components/_adapt/Collapse.js +33 -0
- package/components/_adapt/Drawer.d.ts +12 -0
- package/components/_adapt/Drawer.js +11 -0
- package/components/_adapt/Dropdown.d.ts +15 -0
- package/components/_adapt/Dropdown.js +38 -0
- package/components/_adapt/Icon.d.ts +14 -0
- package/components/_adapt/Icon.js +34 -0
- package/components/_adapt/Image.d.ts +4 -0
- package/components/_adapt/Image.js +11 -0
- package/components/_adapt/Menu.d.ts +32 -0
- package/components/_adapt/Menu.js +25 -0
- package/components/_adapt/Modal.d.ts +23 -0
- package/components/_adapt/Modal.js +69 -0
- package/components/_adapt/Popconfirm.d.ts +5 -0
- package/components/_adapt/Popconfirm.js +34 -0
- package/components/_adapt/Popover.d.ts +5 -0
- package/components/_adapt/Popover.js +34 -0
- package/components/_adapt/Progress.d.ts +14 -0
- package/components/_adapt/Progress.js +56 -0
- package/components/_adapt/Row.d.ts +10 -0
- package/components/_adapt/Row.js +23 -0
- package/components/_adapt/Select.d.ts +14 -0
- package/components/_adapt/Select.js +47 -0
- package/components/_adapt/Tag.d.ts +7 -0
- package/components/_adapt/Tag.js +12 -0
- package/components/_adapt/Tooltip.d.ts +5 -0
- package/components/_adapt/Tooltip.js +11 -0
- package/components/_adapt/todo/ColorPicker.d.ts +3 -0
- package/components/_adapt/todo/ColorPicker.js +42 -0
- package/components/_adapt/todo/FloatButton.d.ts +2 -0
- package/components/_adapt/todo/FloatButton.js +6 -0
- package/components/_adapt/todo/Image.d.ts +2 -0
- package/components/_adapt/todo/Image.js +6 -0
- package/components/_adapt/todo/Segmented.d.ts +2 -0
- package/components/_adapt/todo/Segmented.js +6 -0
- package/components/_adapt/todo/Space.d.ts +2 -0
- package/components/_adapt/todo/Space.js +6 -0
- package/components/_adapt/utils.d.ts +12 -0
- package/components/_adapt/utils.js +93 -0
- package/components/_common/AutoComplete.d.ts +32 -0
- package/components/_common/AutoComplete.js +87 -0
- package/components/_common/CountUp.d.ts +38 -0
- package/components/_common/CountUp.js +60 -0
- package/components/_common/DateRange.d.ts +52 -0
- package/components/_common/DateRange.js +108 -0
- package/components/_common/HighLight.d.ts +15 -0
- package/components/_common/HighLight.js +37 -0
- package/components/_common/I18N.d.ts +7 -0
- package/components/_common/I18N.js +6 -0
- package/components/_common/Loading.d.ts +9 -0
- package/components/_common/Loading.js +52 -0
- package/components/_common/MonthRange.d.ts +46 -0
- package/components/_common/MonthRange.js +130 -0
- package/components/_common/PromiseLabel.d.ts +11 -0
- package/components/_common/PromiseLabel.js +34 -0
- package/components/_common/Role.d.ts +5 -0
- package/components/_common/Role.js +11 -0
- package/components/_common/Upagination.d.ts +21 -0
- package/components/_common/Upagination.js +106 -0
- package/components/_setup/Const.d.ts +205 -0
- package/components/_setup/Const.js +112 -0
- package/components/_setup/I18N/enUS.d.ts +1 -0
- package/components/_setup/I18N/enUS.js +106 -0
- package/components/_setup/I18N/index.d.ts +3 -0
- package/components/_setup/I18N/index.js +5 -0
- package/components/_setup/I18N/zhCN.d.ts +3 -0
- package/components/_setup/I18N/zhCN.js +109 -0
- package/components/_setup/I18N/zhHK.d.ts +1 -0
- package/components/_setup/I18N/zhHK.js +107 -0
- package/components/_setup/ICON/IconTypes.d.ts +1 -0
- package/components/_setup/ICON/IconTypes.js +10 -0
- package/components/_setup/SearchField/SearchFieldAdvance.d.ts +1 -0
- package/components/_setup/SearchField/SearchFieldAdvance.js +57 -0
- package/components/_setup/SearchField/SearchFieldDate.d.ts +1 -0
- package/components/_setup/SearchField/SearchFieldDate.js +186 -0
- package/components/_setup/SearchField/SearchFieldInput.d.ts +3 -0
- package/components/_setup/SearchField/SearchFieldInput.js +20 -0
- package/components/_setup/SearchField/SearchFieldSelect.d.ts +1 -0
- package/components/_setup/SearchField/SearchFieldSelect.js +106 -0
- package/components/_setup/SearchField/SearchFieldTree.d.ts +1 -0
- package/components/_setup/SearchField/SearchFieldTree.js +191 -0
- package/components/_setup/SelectBar/SelectList.d.ts +1 -0
- package/components/_setup/SelectBar/SelectList.js +21 -0
- package/components/_setup/SelectBar/SelectTree.d.ts +1 -0
- package/components/_setup/SelectBar/SelectTree.js +11 -0
- package/components/_setup/UForm/UFormAdvanceInput.d.ts +1 -0
- package/components/_setup/UForm/UFormAdvanceInput.js +300 -0
- package/components/_setup/UForm/UFormAdvanceSelect.d.ts +0 -0
- package/components/_setup/UForm/UFormAdvanceSelect.js +26 -0
- package/components/_setup/UForm/UFormCrontab.d.ts +1 -0
- package/components/_setup/UForm/UFormCrontab.js +199 -0
- package/components/_setup/UForm/UFormDate.d.ts +1 -0
- package/components/_setup/UForm/UFormDate.js +313 -0
- package/components/_setup/UForm/UFormInput.d.ts +1 -0
- package/components/_setup/UForm/UFormInput.js +159 -0
- package/components/_setup/UForm/UFormJSON.d.ts +1 -0
- package/components/_setup/UForm/UFormJSON.js +219 -0
- package/components/_setup/UForm/UFormOrg.d.ts +1 -0
- package/components/_setup/UForm/UFormOrg.js +121 -0
- package/components/_setup/UForm/UFormRole.d.ts +1 -0
- package/components/_setup/UForm/UFormRole.js +47 -0
- package/components/_setup/UForm/UFormSearch.d.ts +0 -0
- package/components/_setup/UForm/UFormSearch.js +35 -0
- package/components/_setup/UForm/UFormSelect.d.ts +1 -0
- package/components/_setup/UForm/UFormSelect.js +179 -0
- package/components/_setup/UForm/UFormTree.d.ts +0 -0
- package/components/_setup/UForm/UFormTree.js +134 -0
- package/components/_setup/UForm/UFormUpload.d.ts +1 -0
- package/components/_setup/UForm/UFormUpload.js +173 -0
- package/components/_setup/UForm/_utils.d.ts +11 -0
- package/components/_setup/UForm/_utils.js +41 -0
- package/components/_setup/index.d.ts +21 -0
- package/components/_setup/index.js +25 -0
- package/components/index.d.ts +7 -0
- package/components/index.js +16 -0
- package/deps/JsonView.d.ts +6 -0
- package/deps/JsonView.js +57 -0
- package/deps/SpringBoot.d.ts +4 -0
- package/deps/SpringBoot.js +18 -0
- package/deps/SpringCloud.d.ts +14 -0
- package/deps/SpringCloud.js +29 -0
- package/deps/_editor/advance/_Audio.d.ts +0 -0
- package/deps/_editor/advance/_Audio.js +1 -0
- package/deps/_editor/advance/_Image.d.ts +2 -0
- package/deps/_editor/advance/_Image.js +89 -0
- package/deps/_editor/advance/_Table.d.ts +0 -0
- package/deps/_editor/advance/_Table.js +1 -0
- package/deps/_editor/advance/_Video.d.ts +0 -0
- package/deps/_editor/advance/_Video.js +1 -0
- package/deps/_editor/base/Element.d.ts +5 -0
- package/deps/_editor/base/Element.js +43 -0
- package/deps/_editor/base/Leaf.d.ts +3 -0
- package/deps/_editor/base/Leaf.js +36 -0
- package/deps/_editor/base/Support.d.ts +2 -0
- package/deps/_editor/base/Support.js +78 -0
- package/deps/_editor/base/types.d.ts +156 -0
- package/deps/_editor/base/types.js +10 -0
- package/deps/_editor/i18n.d.ts +1 -0
- package/deps/_editor/i18n.js +31 -0
- package/deps/_editor/tools/Button.d.ts +6 -0
- package/deps/_editor/tools/Button.js +86 -0
- package/deps/_editor/tools/ToolBar.d.ts +8 -0
- package/deps/_editor/tools/ToolBar.js +10 -0
- package/deps/_editor/tools/_BlockButton.d.ts +4 -0
- package/deps/_editor/tools/_BlockButton.js +77 -0
- package/deps/_editor/tools/_InsertButton.d.ts +6 -0
- package/deps/_editor/tools/_InsertButton.js +65 -0
- package/deps/_editor/tools/_MarkButton.d.ts +6 -0
- package/deps/_editor/tools/_MarkButton.js +45 -0
- package/deps/_editor/tools/_TxtButton.d.ts +7 -0
- package/deps/_editor/tools/_TxtButton.js +187 -0
- package/deps/_editor/utils/ParseHtml.d.ts +0 -0
- package/deps/_editor/utils/ParseHtml.js +220 -0
- package/deps/api-audit.d.ts +1 -0
- package/deps/api-audit.js +6 -0
- package/deps/api-data.d.ts +0 -0
- package/deps/api-data.js +1 -0
- package/deps/apis/useSource.d.ts +0 -0
- package/deps/apis/useSource.js +152 -0
- package/deps/echarts.d.ts +26 -0
- package/deps/echarts.js +71 -0
- package/deps/editor.d.ts +34 -0
- package/deps/editor.js +111 -0
- package/deps/registerEditor.d.ts +1 -0
- package/deps/registerEditor.js +15 -0
- package/hooks/_list.d.ts +87 -0
- package/hooks/_list.js +13 -0
- package/hooks/index.d.ts +14 -0
- package/hooks/index.js +49 -0
- package/hooks/useAjax.d.ts +14 -0
- package/hooks/useAjax.js +43 -0
- package/hooks/useAjaxAction.d.ts +13 -0
- package/hooks/useAjaxAction.js +42 -0
- package/hooks/useAjaxQuery.d.ts +40 -0
- package/hooks/useAjaxQuery.js +81 -0
- package/hooks/useApi.d.ts +69 -0
- package/hooks/useApi.js +352 -0
- package/hooks/useApiGlobal.d.ts +0 -0
- package/hooks/useApiGlobal.js +5 -0
- package/hooks/useApp.d.ts +243 -0
- package/hooks/useApp.js +17 -0
- package/hooks/useArray.d.ts +21 -0
- package/hooks/useArray.js +182 -0
- package/hooks/useCounter.d.ts +0 -0
- package/hooks/useCounter.js +82 -0
- package/hooks/useDefault.d.ts +6 -0
- package/hooks/useDefault.js +16 -0
- package/hooks/useDoLoad.d.ts +17 -0
- package/hooks/useDoLoad.js +44 -0
- package/hooks/useEffectFunction.d.ts +8 -0
- package/hooks/useEffectFunction.js +16 -0
- package/hooks/useEffectOnce.d.ts +5 -0
- package/hooks/useEffectOnce.js +23 -0
- package/hooks/useError.d.ts +5 -0
- package/hooks/useError.js +21 -0
- package/hooks/useFirstMountState.d.ts +6 -0
- package/hooks/useFirstMountState.js +18 -0
- package/hooks/useGenkey.d.ts +2 -0
- package/hooks/useGenkey.js +16 -0
- package/hooks/useGetSet.d.ts +11 -0
- package/hooks/useGetSet.js +27 -0
- package/hooks/useGlobal.d.ts +19 -0
- package/hooks/useGlobal.js +62 -0
- package/hooks/useGlobal_back.d.ts +1 -0
- package/hooks/useGlobal_back.js +11 -0
- package/hooks/useHover.d.ts +8 -0
- package/hooks/useHover.js +49 -0
- package/hooks/useMemoPromise.d.ts +6 -0
- package/hooks/useMemoPromise.js +42 -0
- package/hooks/useModals.d.ts +40 -0
- package/hooks/useModals.js +98 -0
- package/hooks/useMountedState.d.ts +5 -0
- package/hooks/useMountedState.js +20 -0
- package/hooks/useOpenState.d.ts +28 -0
- package/hooks/useOpenState.js +23 -0
- package/hooks/usePromise.d.ts +7 -0
- package/hooks/usePromise.js +22 -0
- package/hooks/useQueue.d.ts +12 -0
- package/hooks/useQueue.js +34 -0
- package/hooks/useSetState.d.ts +9 -0
- package/hooks/useSetState.js +26 -0
- package/hooks/useStateList.d.ts +13 -0
- package/hooks/useStateList.js +59 -0
- package/hooks/useToggle.d.ts +6 -0
- package/hooks/useToggle.js +12 -0
- package/hooks/useUnmountPromise.d.ts +6 -0
- package/hooks/useUnmountPromise.js +36 -0
- package/hooks/useUpdate.d.ts +7 -0
- package/hooks/useUpdate.js +15 -0
- package/hooks/useUpdateEffect.d.ts +6 -0
- package/hooks/useUpdateEffect.js +18 -0
- package/index.d.ts +139 -0
- package/index.js +161 -0
- package/login/Base65.d.ts +8 -0
- package/login/Base65.js +65 -0
- package/login/Password.d.ts +61 -0
- package/login/Password.js +124 -0
- package/login/SM4.d.ts +20 -0
- package/login/SM4.js +193 -0
- package/login/cems/index.d.ts +10 -0
- package/login/cems/index.js +17 -0
- package/login/jit/index.d.ts +32 -0
- package/login/jit/index.js +180 -0
- package/login/jit/pnxclient.d.ts +54 -0
- package/login/jit/pnxclient.js +575 -0
- package/login/sso/index.d.ts +0 -0
- package/login/sso/index.js +0 -0
- package/login/vap/index.d.ts +1 -0
- package/login/vap/index.js +6 -0
- package/login/xrtx/index.d.ts +2 -0
- package/login/xrtx/index.js +33 -0
- package/package.json +1 -0
- package/screen/Comment.d.ts +31 -0
- package/screen/Comment.js +29 -0
- package/screen/EchartContent.d.ts +0 -0
- package/screen/EchartContent.js +63 -0
- package/screen/Page.d.ts +13 -0
- package/screen/Page.js +74 -0
- package/screen/index.d.ts +3 -0
- package/screen/index.js +9 -0
- package/screen/render.d.ts +5 -0
- package/screen/render.js +10 -0
- package/utils/Ajax.d.ts +85 -0
- package/utils/Ajax.js +147 -0
- package/utils/ArrayUtil.d.ts +22 -0
- package/utils/ArrayUtil.js +51 -0
- package/utils/CacheUtil.d.ts +20 -0
- package/utils/CacheUtil.js +86 -0
- package/utils/Const.d.ts +14 -0
- package/utils/Const.js +37 -0
- package/utils/CustomApp.d.ts +242 -0
- package/utils/CustomApp.js +18 -0
- package/utils/EventUtil.d.ts +22 -0
- package/utils/EventUtil.js +63 -0
- package/utils/Format.d.ts +28 -0
- package/utils/Format.js +206 -0
- package/utils/Global.d.ts +276 -0
- package/utils/Global.js +125 -0
- package/utils/Logger.d.ts +5 -0
- package/utils/Logger.js +32 -0
- package/utils/PageUtil.d.ts +24 -0
- package/utils/PageUtil.js +87 -0
- package/utils/Renders/ApiGetRender.d.ts +23 -0
- package/utils/Renders/ApiGetRender.js +192 -0
- package/utils/Renders/ApiPostRender.d.ts +17 -0
- package/utils/Renders/ApiPostRender.js +161 -0
- package/utils/Renders/DateRender.d.ts +8 -0
- package/utils/Renders/DateRender.js +35 -0
- package/utils/Renders/DictRender.d.ts +23 -0
- package/utils/Renders/DictRender.js +258 -0
- package/utils/Renders/FileRender.d.ts +3 -0
- package/utils/Renders/FileRender.js +46 -0
- package/utils/Renders/ListRender.d.ts +23 -0
- package/utils/Renders/ListRender.js +111 -0
- package/utils/Renders/NumberRender.d.ts +19 -0
- package/utils/Renders/NumberRender.js +65 -0
- package/utils/Renders/StatusRender.d.ts +12 -0
- package/utils/Renders/StatusRender.js +68 -0
- package/utils/Renders/StringRender.d.ts +14 -0
- package/utils/Renders/StringRender.js +194 -0
- package/utils/Renders/_define.d.ts +26 -0
- package/utils/Renders/_define.js +64 -0
- package/utils/Renders/index.d.ts +9 -0
- package/utils/Renders/index.js +42 -0
- package/utils/StringUtil.d.ts +124 -0
- package/utils/StringUtil.js +352 -0
- package/utils/TreeUtil.d.ts +42 -0
- package/utils/TreeUtil.js +69 -0
- package/utils/VAP.d.ts +16 -0
- package/utils/VAP.js +78 -0
- package/utils/XHR.d.ts +9 -0
- package/utils/XHR.js +53 -0
- package/utils/_AjaxUtil.d.ts +11 -0
- package/utils/_AjaxUtil.js +45 -0
- package/utils/_Support.d.ts +22 -0
- package/utils/_Support.js +106 -0
- package/utils/i18n.d.ts +60 -0
- package/utils/i18n.js +184 -0
- package/utils/index.d.ts +19 -0
- package/utils/index.js +54 -0
- package/utils/screenful.d.ts +15 -0
- package/utils/screenful.js +64 -0
- package/widget/index.d.ts +39 -0
- package/widget/index.js +21 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.VTable = exports.getHeightByTagName = void 0;
|
|
30
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
31
|
+
const react_1 = __importStar(require("react"));
|
|
32
|
+
const antd_1 = require("antd");
|
|
33
|
+
const ActionBar_1 = require("./Components/ActionBar");
|
|
34
|
+
const utils_1 = require("../../utils");
|
|
35
|
+
const Util_1 = require("./Util");
|
|
36
|
+
const HighLight_1 = require("../_common/HighLight");
|
|
37
|
+
const hooks_1 = require("../../hooks");
|
|
38
|
+
const Box_1 = require("../Box/Box");
|
|
39
|
+
const getHeightByTagName = (root, tagName) => {
|
|
40
|
+
if (root == null)
|
|
41
|
+
return 0;
|
|
42
|
+
let els = root.getElementsByTagName(tagName);
|
|
43
|
+
if (els.length) {
|
|
44
|
+
return els[0].getBoundingClientRect().height;
|
|
45
|
+
}
|
|
46
|
+
return 0;
|
|
47
|
+
};
|
|
48
|
+
exports.getHeightByTagName = getHeightByTagName;
|
|
49
|
+
const _VTable = react_1.default.forwardRef((props, ref) => {
|
|
50
|
+
const update = (0, hooks_1.useUpdate)();
|
|
51
|
+
const { state, root, resize } = (0, Box_1.useBox)();
|
|
52
|
+
const [scroll, setScroll] = (0, react_1.useState)(undefined);
|
|
53
|
+
const { rowKey, list, isQuerying, pageNo, pageSize, orderBy, query } = props.model;
|
|
54
|
+
let start = (0, react_1.useRef)(0);
|
|
55
|
+
const tableProps = {};
|
|
56
|
+
(0, react_1.useEffect)(() => {
|
|
57
|
+
var _a;
|
|
58
|
+
if (state.selected == null)
|
|
59
|
+
return;
|
|
60
|
+
if (lodash_1.default.isFunction((_a = props.selectBar) === null || _a === void 0 ? void 0 : _a.onSelect)) {
|
|
61
|
+
let param = props.selectBar.onSelect(...state.selected);
|
|
62
|
+
query(Object.assign(Object.assign({}, props.default), param));
|
|
63
|
+
}
|
|
64
|
+
}, [state.selected]);
|
|
65
|
+
// 更新页数
|
|
66
|
+
(0, react_1.useEffect)(() => { start.current = pageSize * (pageNo - 1); }, [pageSize, pageNo]);
|
|
67
|
+
// 计算 clolum
|
|
68
|
+
const columns = (0, react_1.useMemo)(() => {
|
|
69
|
+
let cols = [];
|
|
70
|
+
if (props.showIndex !== false)
|
|
71
|
+
cols.push((0, Util_1.getIdxColumn)(start, props.showIndex));
|
|
72
|
+
let HighKeys = new Set();
|
|
73
|
+
if (!utils_1.GLOBAL.CONFIG.SEARCHBAR.DISABLE_KEYWORD && lodash_1.default.has(props, 'searchBar.keyword')) {
|
|
74
|
+
if (lodash_1.default.isObject(props.searchBar.keyword)) {
|
|
75
|
+
(props.searchBar.keyword.highlight || []).map(key => HighKeys.add(key));
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
props.columns.map(col => {
|
|
79
|
+
if (lodash_1.default.isString(col.dataIndex))
|
|
80
|
+
HighKeys.add(col.dataIndex);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
props.columns.map(col => {
|
|
85
|
+
if (col.roleCode && !utils_1.PageUtil.hasRole(col.roleCode))
|
|
86
|
+
return;
|
|
87
|
+
let item = Object.assign({}, col);
|
|
88
|
+
if (col.ik) {
|
|
89
|
+
let title = utils_1.i18n.txt(col.ik);
|
|
90
|
+
item.title = title == '' ? item.title : title;
|
|
91
|
+
}
|
|
92
|
+
if (HighKeys.has(item.dataIndex) && item.render == null) {
|
|
93
|
+
item.render = (record) => {
|
|
94
|
+
if (!lodash_1.default.isString(record))
|
|
95
|
+
return record;
|
|
96
|
+
let keyword = '';
|
|
97
|
+
if (record && keyword) {
|
|
98
|
+
return react_1.default.createElement(HighLight_1.HighLight, { text: record, keyword: keyword });
|
|
99
|
+
}
|
|
100
|
+
return record;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (!lodash_1.default.has(item, 'ellipsis'))
|
|
104
|
+
item.ellipsis = true;
|
|
105
|
+
if (!lodash_1.default.has(item, 'width') && lodash_1.default.isString(item.title)) {
|
|
106
|
+
let clz = item.title.length + (item.sorter ? 2 : 0);
|
|
107
|
+
if (col.className) {
|
|
108
|
+
item.className = 'c-table-col-' + clz + ' ' + col.className;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
item.className = 'c-table-col-' + clz;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
cols.push(item);
|
|
115
|
+
});
|
|
116
|
+
return cols;
|
|
117
|
+
}, [props.columns]);
|
|
118
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
119
|
+
resize();
|
|
120
|
+
}, [columns]);
|
|
121
|
+
(0, react_1.useEffect)(() => {
|
|
122
|
+
if (props.autoLoad === false)
|
|
123
|
+
return;
|
|
124
|
+
// @ts-ignore
|
|
125
|
+
if (lodash_1.default.has(props.selectBar, 'config.mustSelect') && props.selectBar.config['mustSelect'])
|
|
126
|
+
return;
|
|
127
|
+
query(props.default || {});
|
|
128
|
+
}, []);
|
|
129
|
+
// 更新高度 table 需要把 head 排除设置滚动
|
|
130
|
+
(0, react_1.useEffect)(() => {
|
|
131
|
+
if (props.scroll === null)
|
|
132
|
+
return;
|
|
133
|
+
if (props.mode == undefined || props.mode == 'common')
|
|
134
|
+
return;
|
|
135
|
+
let height = state === null || state === void 0 ? void 0 : state.height;
|
|
136
|
+
if (!height)
|
|
137
|
+
return;
|
|
138
|
+
setTimeout(() => {
|
|
139
|
+
height -= (0, exports.getHeightByTagName)(root.current, 'thead');
|
|
140
|
+
setScroll({ y: Math.ceil(height), x: true });
|
|
141
|
+
}, 2);
|
|
142
|
+
}, [state === null || state === void 0 ? void 0 : state.height]);
|
|
143
|
+
// @ts-ignore
|
|
144
|
+
const effectKey = props.model.effect;
|
|
145
|
+
(0, react_1.useEffect)(() => {
|
|
146
|
+
if (effectKey == null)
|
|
147
|
+
return;
|
|
148
|
+
let effectRow = effectKey;
|
|
149
|
+
if (lodash_1.default.isString(effectKey) && lodash_1.default.startsWith(effectKey, '_'))
|
|
150
|
+
effectRow = effectRow.substring(1);
|
|
151
|
+
const trs = root.current.getElementsByClassName('ant-table-row');
|
|
152
|
+
let size = trs.length;
|
|
153
|
+
if (size <= 0)
|
|
154
|
+
return;
|
|
155
|
+
for (let i = 0; i < size; i++) {
|
|
156
|
+
let tr = trs.item(i);
|
|
157
|
+
let key = tr.getAttribute('data-row-key');
|
|
158
|
+
if (key == effectRow) {
|
|
159
|
+
if (tr.classList.contains('c-table-high')) {
|
|
160
|
+
tr.classList.remove('c-table-high');
|
|
161
|
+
}
|
|
162
|
+
setTimeout(() => tr.classList.add('c-table-high'), 2);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}, [effectKey]);
|
|
166
|
+
if (props.select) {
|
|
167
|
+
tableProps.rowSelection = {
|
|
168
|
+
selectedRowKeys: ref.current.selected[0],
|
|
169
|
+
onChange: (selectedRowKeys, selectedObjects) => {
|
|
170
|
+
ref.current.selected = [selectedRowKeys, selectedObjects];
|
|
171
|
+
ref.current.onSelected();
|
|
172
|
+
update();
|
|
173
|
+
},
|
|
174
|
+
getCheckboxProps: record => {
|
|
175
|
+
if (!lodash_1.default.has(record, rowKey))
|
|
176
|
+
return { disabled: true };
|
|
177
|
+
return { disabled: false };
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
return react_1.default.createElement(antd_1.Table, Object.assign({ rowKey: props.rowKey || rowKey, scroll: scroll, tableLayout: "fixed",
|
|
182
|
+
// showSorterTooltip={false}
|
|
183
|
+
size: utils_1.GLOBAL.CONFIG.TABLE.SIZE }, props, tableProps, { className: utils_1.StringUtil.className(['c-table'], props.className), pagination: false, columns: columns, locale: { emptyText: react_1.default.createElement(antd_1.Empty, { style: { marginTop: 24 } }) }, dataSource: list, loading: isQuerying, onChange: (x, y, field) => {
|
|
184
|
+
if (field.column) {
|
|
185
|
+
orderBy(field.field, field.order == 'ascend' ? 'asc' : 'desc');
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
orderBy(null, 'desc');
|
|
189
|
+
}
|
|
190
|
+
} }));
|
|
191
|
+
});
|
|
192
|
+
const VTable = (props) => {
|
|
193
|
+
const { isQuerying, pageNo, pageSize, total, totalAcc, param, pageTo, query, cost } = props.model;
|
|
194
|
+
// 通过 ref 方式交互,后续扩展方法实现定制联页选择
|
|
195
|
+
const selectedRef = (0, react_1.useRef)({ selected: [[], []], onSelected: () => { }, });
|
|
196
|
+
let boxProps = lodash_1.default.pick(props, ['selectBar', 'style', 'className', 'default', 'mode']);
|
|
197
|
+
if (props.searchBar) {
|
|
198
|
+
boxProps.searchBar = Object.assign(Object.assign({}, props.searchBar), { disabled: isQuerying, onSearch: (data) => {
|
|
199
|
+
let queryParam = lodash_1.default.extend({}, param, data);
|
|
200
|
+
query(queryParam, true);
|
|
201
|
+
selectedRef.current.selected = [[], []];
|
|
202
|
+
selectedRef.current.onSelected();
|
|
203
|
+
} });
|
|
204
|
+
}
|
|
205
|
+
if (props.actionBar) {
|
|
206
|
+
if (lodash_1.default.isArray(props.actionBar)) {
|
|
207
|
+
if (props.actionBar.length) {
|
|
208
|
+
boxProps.actionBar = react_1.default.createElement(ActionBar_1.ActionBar, { buttons: props.actionBar, queryParam: param, selectedRef: selectedRef });
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
boxProps.actionBar = props.actionBar;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (props.pagination !== false) {
|
|
216
|
+
boxProps.pagination = {
|
|
217
|
+
disabled: isQuerying,
|
|
218
|
+
current: pageNo,
|
|
219
|
+
pageSize: pageSize,
|
|
220
|
+
total: total,
|
|
221
|
+
cost: cost,
|
|
222
|
+
totalAcc: totalAcc,
|
|
223
|
+
onChange: pageTo,
|
|
224
|
+
};
|
|
225
|
+
if (props.pagination) {
|
|
226
|
+
if (props.pagination.hideOnSinglePage) {
|
|
227
|
+
boxProps.pagination.hideOnSinglePage = true;
|
|
228
|
+
}
|
|
229
|
+
if (props.pagination.className) {
|
|
230
|
+
boxProps.pagination.className = props.pagination.className;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return react_1.default.createElement(Box_1.Box, Object.assign({}, boxProps),
|
|
235
|
+
react_1.default.createElement(_VTable, Object.assign({}, lodash_1.default.omit(props, ['className', 'style']), { ref: selectedRef })));
|
|
236
|
+
};
|
|
237
|
+
exports.VTable = VTable;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TableDefined } from './Components';
|
|
3
|
+
import type { ForwardRefExoticComponent, ExoticComponent } from 'react';
|
|
4
|
+
import type { TableProps } from 'antd/es/table';
|
|
5
|
+
import type { ColumnProps } from 'antd/es/table/interface';
|
|
6
|
+
import type { SearchBarProps } from '../SearchBar/index';
|
|
7
|
+
import type { TableActionButton } from './Components/ActionBar';
|
|
8
|
+
import type { PlainObject, BaseItem, ApiModel } from '../../basetype';
|
|
9
|
+
import type { BoxMode } from '../Box/Box';
|
|
10
|
+
import type { SelectBarProps } from '../Box/SelectBar';
|
|
11
|
+
export type TableColumn = BaseItem & ColumnProps<PlainObject>;
|
|
12
|
+
/**
|
|
13
|
+
* 说明:为保持各应用 一致性 与 简单性
|
|
14
|
+
* 所有VAP组装 Table 排除一些自定义属性
|
|
15
|
+
*/
|
|
16
|
+
export type TableDefine = Omit<TableProps<PlainObject>, 'size' | 'columns' | 'dataSource' | 'bordered' | 'tableLayout' | 'rowKey' | 'title' | 'loading' | 'onChange' | 'rowSelection' | 'getPopupContainer' | 'sortDirections' | 'showSorterTooltip' | 'internalHooks' | 'transformColumns' | 'internalRefs'>;
|
|
17
|
+
export type BaseTableProps = TableDefine & {
|
|
18
|
+
mode?: BoxMode;
|
|
19
|
+
/**
|
|
20
|
+
* 列
|
|
21
|
+
*/
|
|
22
|
+
columns: TableColumn[];
|
|
23
|
+
/**
|
|
24
|
+
* 序号字段
|
|
25
|
+
* 1. 不传 :显示序号 , 支持国际化
|
|
26
|
+
* 2. 传 false :不显示 序号
|
|
27
|
+
* 3. 传指定标题 :显示指定标题
|
|
28
|
+
*/
|
|
29
|
+
showIndex?: false | string;
|
|
30
|
+
/**
|
|
31
|
+
* 说明:强制使用 String 类型 ROW KEY
|
|
32
|
+
*/
|
|
33
|
+
rowKey?: string;
|
|
34
|
+
/**
|
|
35
|
+
* 允许选择, 默认不允许
|
|
36
|
+
*
|
|
37
|
+
* 说明
|
|
38
|
+
* 1. 传 true 或 DEFAULT 时,为默认选择模式
|
|
39
|
+
* 2. 说明:后续支持 : 传 QUERY 时,为查询内选择 : 即:“翻页连选”,当查询条件变化时会清除已选项
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
select?: true | 'DEFAULT' | 'QUERY';
|
|
43
|
+
/**
|
|
44
|
+
* 禁止选中的条件return true 禁止选中
|
|
45
|
+
*/
|
|
46
|
+
selectDisabled?: (record: any) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 表格操作区域
|
|
49
|
+
*/
|
|
50
|
+
actionBar?: (TableActionButton[]) | React.ReactNode;
|
|
51
|
+
/**
|
|
52
|
+
* 表格选择区域
|
|
53
|
+
*/
|
|
54
|
+
selectBar?: SelectBarProps;
|
|
55
|
+
/**
|
|
56
|
+
* 表格搜索区域
|
|
57
|
+
*/
|
|
58
|
+
searchBar?: Omit<SearchBarProps, 'onChange' | 'onSearch'>;
|
|
59
|
+
/**
|
|
60
|
+
* 默认查询参数
|
|
61
|
+
*/
|
|
62
|
+
default?: PlainObject;
|
|
63
|
+
/**
|
|
64
|
+
* 是否自动查询,默认为TRUE
|
|
65
|
+
*/
|
|
66
|
+
autoLoad?: false;
|
|
67
|
+
};
|
|
68
|
+
import type { ApiTableProps } from './ApiTable';
|
|
69
|
+
export type ApiTable = ForwardRefExoticComponent<ApiTableProps & React.RefAttributes<ApiModel>> & TableDefined;
|
|
70
|
+
export declare const ApiTable: ApiTable;
|
|
71
|
+
import type { VTableProps } from './VTable';
|
|
72
|
+
export type VTable = ExoticComponent<VTableProps> & TableDefined;
|
|
73
|
+
export declare const VTable: VTable;
|
|
74
|
+
import type { STableProps } from './STable';
|
|
75
|
+
export type STable = ExoticComponent<STableProps> & TableDefined;
|
|
76
|
+
export declare const STable: STable;
|
|
77
|
+
import type { TopTableProps } from './TopTable';
|
|
78
|
+
export type TopTable = ExoticComponent<TopTableProps> & TableDefined;
|
|
79
|
+
export declare const TopTable: TopTable;
|
|
80
|
+
export { TopTableModal } from './TopTableModal';
|
|
81
|
+
export { ApiTableModal } from './ApiTableModal';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiTableModal = exports.TopTableModal = exports.TopTable = exports.STable = exports.VTable = exports.ApiTable = void 0;
|
|
4
|
+
const Components_1 = require("./Components");
|
|
5
|
+
const ApiTable_1 = require("./ApiTable");
|
|
6
|
+
exports.ApiTable = ApiTable_1.ApiTable;
|
|
7
|
+
(0, Components_1.defineTable)(exports.ApiTable);
|
|
8
|
+
const VTable_1 = require("./VTable");
|
|
9
|
+
exports.VTable = VTable_1.VTable;
|
|
10
|
+
(0, Components_1.defineTable)(exports.VTable);
|
|
11
|
+
const STable_1 = require("./STable");
|
|
12
|
+
exports.STable = STable_1.STable;
|
|
13
|
+
(0, Components_1.defineTable)(exports.STable);
|
|
14
|
+
const TopTable_1 = require("./TopTable");
|
|
15
|
+
exports.TopTable = TopTable_1.TopTable;
|
|
16
|
+
(0, Components_1.defineTable)(exports.TopTable);
|
|
17
|
+
var TopTableModal_1 = require("./TopTableModal");
|
|
18
|
+
Object.defineProperty(exports, "TopTableModal", { enumerable: true, get: function () { return TopTableModal_1.TopTableModal; } });
|
|
19
|
+
var ApiTableModal_1 = require("./ApiTableModal");
|
|
20
|
+
Object.defineProperty(exports, "ApiTableModal", { enumerable: true, get: function () { return ApiTableModal_1.ApiTableModal; } });
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Language } from '../../utils/_Support';
|
|
3
|
+
import type { TreeNodeData } from '../../utils/TreeUtil';
|
|
4
|
+
import type { TreeSelectProps } from 'antd/es/tree-select';
|
|
5
|
+
import type { AntTreeNodeProps } from 'antd/es/tree';
|
|
6
|
+
import type { PropsWithChildren } from 'react';
|
|
7
|
+
import type { BaseTreeSelectProps } from './index';
|
|
8
|
+
import type { PlainObject } from '../../basetype';
|
|
9
|
+
export type BaseTreeSelectState = {
|
|
10
|
+
baseProps: TreeSelectProps<any>;
|
|
11
|
+
treeData: TreeNodeData[];
|
|
12
|
+
keyField: string;
|
|
13
|
+
titleField: string;
|
|
14
|
+
valueField: string;
|
|
15
|
+
rootCode?: string | number;
|
|
16
|
+
langs: {
|
|
17
|
+
lang: Language;
|
|
18
|
+
field: string;
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
type BaseTreeSelectContext = {
|
|
22
|
+
treeState: BaseTreeSelectState;
|
|
23
|
+
setTreeData: (treeData: TreeNodeData[]) => void;
|
|
24
|
+
onSelect: TreeSelectProps<any>['onSelect'];
|
|
25
|
+
onChange: TreeSelectProps<any>['onChange'];
|
|
26
|
+
};
|
|
27
|
+
declare const BaseTreeSelectContext: React.Context<BaseTreeSelectContext>;
|
|
28
|
+
export declare const useBaseTree: () => BaseTreeSelectContext;
|
|
29
|
+
export declare const BaseTreeSelect: React.FC<PropsWithChildren<BaseTreeSelectProps>>;
|
|
30
|
+
export declare const getNodeParam: (node: any, state: BaseTreeSelectState, disabledNode: (node: PlainObject) => boolean) => AntTreeNodeProps;
|
|
31
|
+
export declare const renderRoot: (props: BaseTreeSelectProps, state: BaseTreeSelectState) => React.ReactNode;
|
|
32
|
+
export declare const getData: (api: string, notCache: boolean) => Promise<PlainObject[]>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.getData = exports.renderRoot = exports.getNodeParam = exports.BaseTreeSelect = exports.useBaseTree = void 0;
|
|
39
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
41
|
+
const antd_1 = require("antd");
|
|
42
|
+
const utils_1 = require("../../utils");
|
|
43
|
+
const hooks_1 = require("../../hooks");
|
|
44
|
+
const _Support_1 = require("../../utils/_Support");
|
|
45
|
+
const BaseTreeSelectContext = (0, react_1.createContext)(null);
|
|
46
|
+
const useBaseTree = () => (0, react_1.useContext)(BaseTreeSelectContext);
|
|
47
|
+
exports.useBaseTree = useBaseTree;
|
|
48
|
+
const BaseTreeSelect = (props) => {
|
|
49
|
+
const clazz = utils_1.StringUtil.className(['c-tree'], props.className);
|
|
50
|
+
const basePropsKeys = [
|
|
51
|
+
'defaultValue',
|
|
52
|
+
'multiple',
|
|
53
|
+
'treeDefaultExpandAll',
|
|
54
|
+
'treeCheckable',
|
|
55
|
+
'disabled',
|
|
56
|
+
'showSearch',
|
|
57
|
+
'style'
|
|
58
|
+
];
|
|
59
|
+
const stateKeys = [
|
|
60
|
+
'rootCode',
|
|
61
|
+
'keyField',
|
|
62
|
+
'valueField',
|
|
63
|
+
// 'parentField'
|
|
64
|
+
];
|
|
65
|
+
const DEFAULT = {
|
|
66
|
+
baseProps: {
|
|
67
|
+
dropdownStyle: { maxHeight: 400, overflow: 'auto' },
|
|
68
|
+
showSearch: true,
|
|
69
|
+
allowClear: true,
|
|
70
|
+
className: clazz,
|
|
71
|
+
style: { width: '300px' },
|
|
72
|
+
treeNodeFilterProp: 'title',
|
|
73
|
+
},
|
|
74
|
+
treeData: [],
|
|
75
|
+
rootCode: '0',
|
|
76
|
+
titleField: 'name',
|
|
77
|
+
keyField: 'id',
|
|
78
|
+
valueField: null,
|
|
79
|
+
// parentField: null,
|
|
80
|
+
langs: null,
|
|
81
|
+
};
|
|
82
|
+
lodash_1.default.forEach(stateKeys, (k) => {
|
|
83
|
+
if (props[k] != null) {
|
|
84
|
+
DEFAULT[k] = props[k];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
lodash_1.default.forEach(basePropsKeys, (k) => {
|
|
88
|
+
if (props[k] != null) {
|
|
89
|
+
DEFAULT.baseProps[k] = props[k];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
if (lodash_1.default.isString(props.titleField)) {
|
|
93
|
+
DEFAULT.titleField = props.titleField;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
let langs = [];
|
|
97
|
+
if (props.titleField.zhCN) {
|
|
98
|
+
langs.push({ lang: _Support_1.Language.ZH_CN, field: props.titleField.zhCN });
|
|
99
|
+
if (utils_1.GLOBAL.CONFIG.APP.LANG == _Support_1.Language.ZH_CN) {
|
|
100
|
+
DEFAULT.titleField = props.titleField.zhCN;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (props.titleField.enUS) {
|
|
104
|
+
langs.push({ lang: _Support_1.Language.EN_US, field: props.titleField.enUS });
|
|
105
|
+
if (utils_1.GLOBAL.CONFIG.APP.LANG == _Support_1.Language.EN_US) {
|
|
106
|
+
DEFAULT.titleField = props.titleField.enUS;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (props.titleField.zhHK) {
|
|
110
|
+
langs.push({ lang: _Support_1.Language.ZH_HK, field: props.titleField.zhHK });
|
|
111
|
+
if (utils_1.GLOBAL.CONFIG.APP.LANG == _Support_1.Language.ZH_HK) {
|
|
112
|
+
DEFAULT.titleField = props.titleField.zhHK;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (langs.length > 1) {
|
|
116
|
+
DEFAULT.langs = langs;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const [state, setState] = (0, hooks_1.useSetState)(DEFAULT);
|
|
120
|
+
const setTreeData = (treeData) => setState({ treeData: [...treeData] });
|
|
121
|
+
const onSelect = (0, react_1.useCallback)((value, info, extra) => {
|
|
122
|
+
const data = info.data.node;
|
|
123
|
+
if (props.onSelect) {
|
|
124
|
+
props.onSelect(value, data[DEFAULT.keyField], data);
|
|
125
|
+
}
|
|
126
|
+
}, [state.treeData]);
|
|
127
|
+
const onChange = (0, react_1.useCallback)((value, labelList, extra) => {
|
|
128
|
+
let nodes = [];
|
|
129
|
+
if (value.length > 0) {
|
|
130
|
+
const allCheckedNodes = extra.allCheckedNodes;
|
|
131
|
+
allCheckedNodes.forEach(({ pos, node }) => {
|
|
132
|
+
nodes.push(Object.assign({ pos }, node.props.data.node));
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
if (lodash_1.default.isFunction(props.onChange)) {
|
|
136
|
+
props.onChange(value, labelList, nodes);
|
|
137
|
+
}
|
|
138
|
+
}, [state.treeData]);
|
|
139
|
+
return react_1.default.createElement(BaseTreeSelectContext.Provider, { value: { treeState: state, setTreeData, onSelect, onChange } }, props.children);
|
|
140
|
+
};
|
|
141
|
+
exports.BaseTreeSelect = BaseTreeSelect;
|
|
142
|
+
const getNodeParam = (node, state, disabledNode) => {
|
|
143
|
+
const { titleField, keyField, valueField, } = state;
|
|
144
|
+
let param = { key: node[keyField], data: { node }, value: node[valueField] };
|
|
145
|
+
param.title = node[titleField];
|
|
146
|
+
if (lodash_1.default.isFunction(disabledNode)) {
|
|
147
|
+
if (disabledNode(node)) {
|
|
148
|
+
param.disabled = true;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return param;
|
|
152
|
+
};
|
|
153
|
+
exports.getNodeParam = getNodeParam;
|
|
154
|
+
const renderNode = (node, state, props) => {
|
|
155
|
+
const param = (0, exports.getNodeParam)(node, state, props.disabledNode);
|
|
156
|
+
if (lodash_1.default.isArray(node.children) && node.children.length) {
|
|
157
|
+
return react_1.default.createElement(antd_1.TreeSelect.TreeNode, Object.assign({}, param, { isLeaf: false }), renderNodes(node.children, state, props));
|
|
158
|
+
}
|
|
159
|
+
let isLeaf = true;
|
|
160
|
+
if (props.checkField) {
|
|
161
|
+
isLeaf = !node[props.checkField];
|
|
162
|
+
}
|
|
163
|
+
return react_1.default.createElement(antd_1.TreeSelect.TreeNode, Object.assign({}, param, { isLeaf: isLeaf }));
|
|
164
|
+
};
|
|
165
|
+
const renderNodes = (data, state, props) => data.map((item) => renderNode(item, state, props));
|
|
166
|
+
const renderRoot = (props, state) => renderNodes(state.treeData, state, props);
|
|
167
|
+
exports.renderRoot = renderRoot;
|
|
168
|
+
const getResponseList = (resp) => {
|
|
169
|
+
let data;
|
|
170
|
+
if (lodash_1.default.has(resp, 'data')) {
|
|
171
|
+
data = resp.data;
|
|
172
|
+
}
|
|
173
|
+
else if (lodash_1.default.has(resp, 'list')) {
|
|
174
|
+
data = resp.list;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
data = [];
|
|
178
|
+
}
|
|
179
|
+
if (lodash_1.default.isArray(data)) {
|
|
180
|
+
return data;
|
|
181
|
+
}
|
|
182
|
+
return [data];
|
|
183
|
+
};
|
|
184
|
+
const getData = (api, notCache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
185
|
+
if (!notCache)
|
|
186
|
+
utils_1.Ajax.SESSION(api);
|
|
187
|
+
const resp = yield utils_1.Ajax.GET(api);
|
|
188
|
+
return getResponseList(resp);
|
|
189
|
+
});
|
|
190
|
+
exports.getData = getData;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BaseTreeSelectProps } from './index';
|
|
3
|
+
import type { Key, PlainObject } from '../../basetype';
|
|
4
|
+
export type DTreeProps = {
|
|
5
|
+
/**
|
|
6
|
+
* 根节点API 与rootCode 二选一
|
|
7
|
+
*/
|
|
8
|
+
rootApi?: string;
|
|
9
|
+
/**
|
|
10
|
+
* 展开子节点:
|
|
11
|
+
*
|
|
12
|
+
* 方式一:传一个 api 接口地址,必须返回 VData<Array<Object>> 格式
|
|
13
|
+
*
|
|
14
|
+
* 方式二:传一个方法 ,接收一个父节点参数,必须返回 Promise<TreeNodeData[]> (不要返回 children, 仅返回一级)
|
|
15
|
+
*/
|
|
16
|
+
childApi: string | ((parentId: Key) => Promise<PlainObject[]>);
|
|
17
|
+
/**
|
|
18
|
+
* 接口是否缓存
|
|
19
|
+
*/
|
|
20
|
+
notCache?: boolean;
|
|
21
|
+
};
|
|
22
|
+
type DTreeSelectProps = BaseTreeSelectProps & DTreeProps;
|
|
23
|
+
export declare const DTreeSelect: React.FC<DTreeSelectProps>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.DTreeSelect = void 0;
|
|
16
|
+
const react_1 = __importDefault(require("react"));
|
|
17
|
+
const antd_1 = require("antd");
|
|
18
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
19
|
+
const BaseTreeSelect_1 = require("./BaseTreeSelect");
|
|
20
|
+
const hooks_1 = require("../../hooks");
|
|
21
|
+
const _DTreeSelect = (props) => {
|
|
22
|
+
const { treeState, setTreeData, onChange, onSelect } = (0, BaseTreeSelect_1.useBaseTree)();
|
|
23
|
+
const { rootApi, notCache, childApi } = props;
|
|
24
|
+
(0, hooks_1.useEffectFunction)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
let treeData = [];
|
|
26
|
+
if (rootApi) {
|
|
27
|
+
treeData = yield (0, BaseTreeSelect_1.getData)(rootApi, notCache);
|
|
28
|
+
}
|
|
29
|
+
else if (lodash_1.default.isFunction(props.childApi)) {
|
|
30
|
+
treeData = yield props.childApi(treeState.rootCode);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
treeData = yield (0, BaseTreeSelect_1.getData)(childApi + treeState.rootCode, notCache);
|
|
34
|
+
}
|
|
35
|
+
if (treeData.length == 1) {
|
|
36
|
+
treeData[0].children = yield (0, BaseTreeSelect_1.getData)(childApi + treeData[0][treeState.keyField], notCache);
|
|
37
|
+
}
|
|
38
|
+
setTreeData(treeData);
|
|
39
|
+
}), []);
|
|
40
|
+
const treeProps = {};
|
|
41
|
+
if (treeState.treeData.length == 1) {
|
|
42
|
+
// 如果根节点只有一个,则自动展开这个根结点
|
|
43
|
+
const key = treeState.treeData[0][treeState.keyField];
|
|
44
|
+
treeProps.treeDefaultExpandedKeys = [key];
|
|
45
|
+
// treeProps.treeLoadedKeys = [key];
|
|
46
|
+
}
|
|
47
|
+
const loadData = (dataNode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
+
return new Promise((r) => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
const { node } = dataNode.data;
|
|
50
|
+
const API = props.childApi + node[treeState.keyField];
|
|
51
|
+
const children = yield (0, BaseTreeSelect_1.getData)(API, notCache);
|
|
52
|
+
console.log('dataNode', dataNode);
|
|
53
|
+
const pathArr = dataNode.pos.split('-');
|
|
54
|
+
pathArr.splice(0, 1);
|
|
55
|
+
let nodePath = pathArr.map(i => `[${i}]`).join('.children');
|
|
56
|
+
const data = lodash_1.default.get(treeState.treeData, nodePath);
|
|
57
|
+
data.children = children;
|
|
58
|
+
setTreeData(treeState.treeData);
|
|
59
|
+
r(undefined);
|
|
60
|
+
}));
|
|
61
|
+
});
|
|
62
|
+
return react_1.default.createElement(antd_1.TreeSelect, Object.assign({}, treeState.baseProps, treeProps, { disabled: props.disabled, loadData: loadData, onChange: onChange, onSelect: onSelect }), (0, BaseTreeSelect_1.renderRoot)(props, treeState));
|
|
63
|
+
};
|
|
64
|
+
const DTreeSelect = (props) => react_1.default.createElement(BaseTreeSelect_1.BaseTreeSelect, Object.assign({}, props),
|
|
65
|
+
react_1.default.createElement(_DTreeSelect, Object.assign({}, props)));
|
|
66
|
+
exports.DTreeSelect = DTreeSelect;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BaseTreeSelectProps } from './index';
|
|
3
|
+
export type FTreeFetch = {
|
|
4
|
+
/**
|
|
5
|
+
* 获取数据的接口地址
|
|
6
|
+
*/
|
|
7
|
+
api?: string;
|
|
8
|
+
};
|
|
9
|
+
type FTreeSelectProps = BaseTreeSelectProps & FTreeFetch;
|
|
10
|
+
export declare const FTreeSelect: React.FC<FTreeSelectProps>;
|
|
11
|
+
export {};
|