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,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Language } from '../../utils/_Support';
|
|
3
|
+
import type { BaseTreeOpts, SearchResult, TreeNodeData } from '../../utils/TreeUtil';
|
|
4
|
+
import type { AntTreeNodeProps, TreeProps } from 'antd/es/tree';
|
|
5
|
+
import type { PropsWithChildren, ReactNode } from 'react';
|
|
6
|
+
import type { BaseTreeProps } from './index';
|
|
7
|
+
import type { PlainObject } from '../../basetype';
|
|
8
|
+
export type BaseTreeState = Required<BaseTreeOpts> & {
|
|
9
|
+
className: string;
|
|
10
|
+
baseProps: TreeProps;
|
|
11
|
+
treeData: TreeNodeData[];
|
|
12
|
+
search: SearchResult;
|
|
13
|
+
selectedKeys: string[];
|
|
14
|
+
selectedNode: PlainObject;
|
|
15
|
+
titleField: string;
|
|
16
|
+
iconField: string | ((item: any) => ReactNode);
|
|
17
|
+
langs: {
|
|
18
|
+
lang: Language;
|
|
19
|
+
field: string;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
type BaseTreeContext = {
|
|
23
|
+
treeState: BaseTreeState;
|
|
24
|
+
onSelect: TreeProps['onSelect'];
|
|
25
|
+
setTreeData: (treeData: TreeNodeData[]) => void;
|
|
26
|
+
};
|
|
27
|
+
declare const BaseTreeContext: React.Context<BaseTreeContext>;
|
|
28
|
+
export declare const useBaseTree: () => BaseTreeContext;
|
|
29
|
+
export declare const BaseTree: React.FC<PropsWithChildren<BaseTreeProps>>;
|
|
30
|
+
export declare const getNodeParam: (node: any, position: number[], state: BaseTreeState, search: SearchResult, disabledNode: (node: PlainObject) => boolean) => AntTreeNodeProps;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,185 @@
|
|
|
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.getNodeParam = exports.BaseTree = exports.useBaseTree = void 0;
|
|
30
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
31
|
+
const react_1 = __importStar(require("react"));
|
|
32
|
+
const utils_1 = require("../../utils");
|
|
33
|
+
const HighLight_1 = require("../_common/HighLight");
|
|
34
|
+
const Icon_1 = require("../_adapt/Icon");
|
|
35
|
+
const hooks_1 = require("../../hooks");
|
|
36
|
+
const _Support_1 = require("../../utils/_Support");
|
|
37
|
+
// 搜索事件延时
|
|
38
|
+
const SEARCH_DELAY = 200;
|
|
39
|
+
const BaseTreeContext = (0, react_1.createContext)(null);
|
|
40
|
+
const useBaseTree = () => (0, react_1.useContext)(BaseTreeContext);
|
|
41
|
+
exports.useBaseTree = useBaseTree;
|
|
42
|
+
const BaseTree = (props) => {
|
|
43
|
+
const clazz = utils_1.StringUtil.className(['c-tree'], props.className);
|
|
44
|
+
const DEFAULT = {
|
|
45
|
+
className: clazz,
|
|
46
|
+
baseProps: {
|
|
47
|
+
showLine: true,
|
|
48
|
+
checkable: false,
|
|
49
|
+
blockNode: true,
|
|
50
|
+
showIcon: props.iconField != null,
|
|
51
|
+
},
|
|
52
|
+
treeData: [],
|
|
53
|
+
selectedKeys: null,
|
|
54
|
+
selectedNode: null,
|
|
55
|
+
rootCode: '0',
|
|
56
|
+
search: { word: null, keyword: null, match: null },
|
|
57
|
+
titleField: 'name',
|
|
58
|
+
keyField: 'id',
|
|
59
|
+
iconField: null,
|
|
60
|
+
sortField: null,
|
|
61
|
+
parentField: null,
|
|
62
|
+
langs: null,
|
|
63
|
+
};
|
|
64
|
+
if (props.rootCode)
|
|
65
|
+
DEFAULT.rootCode = props.rootCode;
|
|
66
|
+
if (props.keyField)
|
|
67
|
+
DEFAULT.keyField = props.keyField;
|
|
68
|
+
if (props.iconField)
|
|
69
|
+
DEFAULT.iconField = props.iconField;
|
|
70
|
+
if (props.sortField)
|
|
71
|
+
DEFAULT.sortField = props.sortField;
|
|
72
|
+
if (props.parentField)
|
|
73
|
+
DEFAULT.parentField = props.parentField;
|
|
74
|
+
// if(props.searchValue) DEFAULT.searchValue = props.searchValue;
|
|
75
|
+
// Support I18N Title Field
|
|
76
|
+
if (lodash_1.default.isString(props.titleField)) {
|
|
77
|
+
DEFAULT.titleField = props.titleField;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
let langs = [];
|
|
81
|
+
if (props.titleField.zhCN) {
|
|
82
|
+
langs.push({ lang: _Support_1.Language.ZH_CN, field: props.titleField.zhCN });
|
|
83
|
+
if (utils_1.GLOBAL.CONFIG.APP.LANG == _Support_1.Language.ZH_CN) {
|
|
84
|
+
DEFAULT.titleField = props.titleField.zhCN;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (props.titleField.enUS) {
|
|
88
|
+
langs.push({ lang: _Support_1.Language.EN_US, field: props.titleField.enUS });
|
|
89
|
+
if (utils_1.GLOBAL.CONFIG.APP.LANG == _Support_1.Language.EN_US) {
|
|
90
|
+
DEFAULT.titleField = props.titleField.enUS;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (props.titleField.zhHK) {
|
|
94
|
+
langs.push({ lang: _Support_1.Language.ZH_HK, field: props.titleField.zhHK });
|
|
95
|
+
if (utils_1.GLOBAL.CONFIG.APP.LANG == _Support_1.Language.ZH_HK) {
|
|
96
|
+
DEFAULT.titleField = props.titleField.zhHK;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (langs.length > 1) {
|
|
100
|
+
DEFAULT.langs = langs;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const [state, setState] = (0, hooks_1.useSetState)(DEFAULT);
|
|
104
|
+
const PID = (0, react_1.useRef)(null);
|
|
105
|
+
const searchByKeyWord = (0, react_1.useCallback)((word) => {
|
|
106
|
+
clearTimeout(PID.current);
|
|
107
|
+
if (word == '') {
|
|
108
|
+
setState({ search: { word: null, keyword: null, match: null }, className: clazz });
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
PID.current = setTimeout(() => setState({
|
|
112
|
+
search: utils_1.TreeUtil.search(state.treeData, word, state.titleField),
|
|
113
|
+
className: word ? (clazz + ' c-tree-searching') : clazz
|
|
114
|
+
}), SEARCH_DELAY);
|
|
115
|
+
}, [state.treeData]);
|
|
116
|
+
const setTreeData = (treeData) => setState({ treeData: [...treeData] });
|
|
117
|
+
(0, react_1.useEffect)(() => searchByKeyWord(props.searchValue), [props.searchValue]);
|
|
118
|
+
const onSelect = (0, react_1.useCallback)((selectedKeys, evt) => {
|
|
119
|
+
utils_1.PageUtil.stopEvent(evt === null || evt === void 0 ? void 0 : evt.nativeEvent);
|
|
120
|
+
if (props.mustSelect && selectedKeys.length == 0)
|
|
121
|
+
return;
|
|
122
|
+
if (selectedKeys.length == 0) {
|
|
123
|
+
if (state.selectedNode == null)
|
|
124
|
+
return;
|
|
125
|
+
setState({ selectedKeys: [], selectedNode: null, });
|
|
126
|
+
if (lodash_1.default.isFunction(props.onSelect)) {
|
|
127
|
+
props.onSelect(null, null, null, null, null);
|
|
128
|
+
}
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const { node, position } = evt.selectedNodes[0].props.data;
|
|
132
|
+
if (state.selectedNode != null && state.selectedNode[state.keyField] == node[state.keyField])
|
|
133
|
+
return;
|
|
134
|
+
setState({ selectedKeys, selectedNode: lodash_1.default.omit(node, 'children') });
|
|
135
|
+
if (lodash_1.default.isFunction(props.onSelect)) {
|
|
136
|
+
let crumb = [];
|
|
137
|
+
let key = '';
|
|
138
|
+
for (let idx of position) {
|
|
139
|
+
key += `[${idx}]`;
|
|
140
|
+
// crumb.push(_.omit(_.get(tree || state.treeData, key), 'children'));
|
|
141
|
+
key += `.children`;
|
|
142
|
+
}
|
|
143
|
+
props.onSelect(selectedKeys[0], crumb[crumb.length - 1], crumb.length > 1 ? crumb[crumb.length - 2] : null, crumb, position);
|
|
144
|
+
}
|
|
145
|
+
}, [state.selectedNode, state.treeData]);
|
|
146
|
+
return react_1.default.createElement(BaseTreeContext.Provider, { value: { treeState: state, onSelect, setTreeData } }, props.children);
|
|
147
|
+
};
|
|
148
|
+
exports.BaseTree = BaseTree;
|
|
149
|
+
const getNodeParam = (node, position, state, search, disabledNode) => {
|
|
150
|
+
const { titleField, keyField, iconField, } = state;
|
|
151
|
+
let param = { key: node[keyField], data: { node, position } };
|
|
152
|
+
if (search.keyword) {
|
|
153
|
+
param.title = react_1.default.createElement(HighLight_1.HighLight, { keyword: search.keyword, text: node[titleField] });
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
param.title = node[titleField];
|
|
157
|
+
}
|
|
158
|
+
if (lodash_1.default.isFunction(disabledNode)) {
|
|
159
|
+
if (disabledNode(node)) {
|
|
160
|
+
param.disabled = true;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (iconField != null) {
|
|
164
|
+
if (lodash_1.default.isString(iconField)) {
|
|
165
|
+
let icon = node[iconField];
|
|
166
|
+
if (icon) {
|
|
167
|
+
if (icon.indexOf('/') >= 0 || lodash_1.default.startsWith(icon, 'http://') || lodash_1.default.startsWith(icon, 'https://')) {
|
|
168
|
+
param.icon = react_1.default.createElement("span", { style: { lineHeight: '24px' } },
|
|
169
|
+
react_1.default.createElement("img", { style: { marginTop: -4 }, src: node[iconField] }));
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
param.icon = react_1.default.createElement(Icon_1.Icon, { type: node[iconField] });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else if (lodash_1.default.isFunction(iconField)) {
|
|
177
|
+
let icon = iconField(node);
|
|
178
|
+
if (icon) {
|
|
179
|
+
param.icon = icon;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return param;
|
|
184
|
+
};
|
|
185
|
+
exports.getNodeParam = getNodeParam;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BaseTreeProps, ActionProps, ActionRef } from './index';
|
|
3
|
+
import type { Key, PlainObject } from '../../basetype';
|
|
4
|
+
export type DTreeFetch = {
|
|
5
|
+
/**
|
|
6
|
+
* 根节点API 与rootCode 二选一
|
|
7
|
+
*/
|
|
8
|
+
rootApi?: string;
|
|
9
|
+
/**
|
|
10
|
+
* 是否存在子节点,如果有些属性,则根据此值不必多点一次加号
|
|
11
|
+
*/
|
|
12
|
+
checkField?: string;
|
|
13
|
+
/**
|
|
14
|
+
* 展开子节点:
|
|
15
|
+
*
|
|
16
|
+
* 方式一:传一个 api 接口地址,必须返回 VData<Array<Object>> 格式
|
|
17
|
+
*
|
|
18
|
+
* 方式二:传一个方法 ,接收一个父节点参数,必须返回 Promise<TreeNodeData[]> (不要返回 children, 仅返回一级)
|
|
19
|
+
*/
|
|
20
|
+
childApi: string | ((parentId: Key) => Promise<PlainObject[]>);
|
|
21
|
+
};
|
|
22
|
+
export type DTreeProps = BaseTreeProps & ActionProps & DTreeFetch;
|
|
23
|
+
/**
|
|
24
|
+
* 动态树
|
|
25
|
+
* CRUD : 支持
|
|
26
|
+
* 动态加载 : 支持
|
|
27
|
+
* 搜索 : 仅支持已加载的节点
|
|
28
|
+
* 数据 :
|
|
29
|
+
* 1. 必传 childApi
|
|
30
|
+
* 2. 可选 rootCode,默认为 0
|
|
31
|
+
* 3. 可选 rootApi 传 rootApi 根节点数据将调用 rootApi获取,不传 rootApi时,将由 childApi + rootCode 获取
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
export declare const DTree: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("../../utils/TreeUtil").BaseTreeOpts & {
|
|
35
|
+
className?: string;
|
|
36
|
+
iconField?: string | ((item: any) => React.ReactNode);
|
|
37
|
+
titleField: string | {
|
|
38
|
+
zhCN?: string;
|
|
39
|
+
enUS?: string;
|
|
40
|
+
zhHK?: string;
|
|
41
|
+
};
|
|
42
|
+
defaultExpandAll?: boolean;
|
|
43
|
+
mustSelect?: boolean;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
disabledNode?: (node: PlainObject) => boolean;
|
|
46
|
+
onSelect?: (key: Key, node: PlainObject, parentNode: PlainObject, crumb: PlainObject[], pos: number[]) => void;
|
|
47
|
+
searchValue?: string;
|
|
48
|
+
} & ActionProps & DTreeFetch & React.RefAttributes<ActionRef>>>;
|
|
@@ -0,0 +1,142 @@
|
|
|
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.DTree = void 0;
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
41
|
+
const antd_1 = require("antd");
|
|
42
|
+
const utils_1 = require("../../utils");
|
|
43
|
+
const BaseTree_1 = require("./BaseTree");
|
|
44
|
+
const ActionTree_1 = require("./ActionTree");
|
|
45
|
+
const hooks_1 = require("../../hooks");
|
|
46
|
+
/**
|
|
47
|
+
* 动态树
|
|
48
|
+
* CRUD : 支持
|
|
49
|
+
* 动态加载 : 支持
|
|
50
|
+
* 搜索 : 仅支持已加载的节点
|
|
51
|
+
* 数据 :
|
|
52
|
+
* 1. 必传 childApi
|
|
53
|
+
* 2. 可选 rootCode,默认为 0
|
|
54
|
+
* 3. 可选 rootApi 传 rootApi 根节点数据将调用 rootApi获取,不传 rootApi时,将由 childApi + rootCode 获取
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
exports.DTree = (0, react_1.memo)((0, react_1.forwardRef)((props, ref) => {
|
|
58
|
+
const clearCache = (parentId) => {
|
|
59
|
+
if (parentId == props.rootCode) {
|
|
60
|
+
if (props.rootApi)
|
|
61
|
+
utils_1.Ajax.CLEAR(props.rootApi);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (lodash_1.default.isString(props.childApi))
|
|
65
|
+
utils_1.Ajax.CLEAR(props.childApi + parentId);
|
|
66
|
+
};
|
|
67
|
+
const getChildren = (parentCode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
+
if (lodash_1.default.isFunction(props.childApi))
|
|
69
|
+
return yield props.childApi(parentCode);
|
|
70
|
+
const API = props.childApi + parentCode;
|
|
71
|
+
if (!props.notCache)
|
|
72
|
+
utils_1.Ajax.SESSION(API);
|
|
73
|
+
const resp = yield utils_1.Ajax.GET(API);
|
|
74
|
+
return (0, ActionTree_1.getResponseList)(resp, props.sortField);
|
|
75
|
+
});
|
|
76
|
+
return react_1.default.createElement(ActionTree_1.ActionTree, Object.assign({}, props, { clearCache: clearCache, getChildren: getChildren, ref: ref }),
|
|
77
|
+
react_1.default.createElement(_Dtree, Object.assign({}, props, { clearCache: clearCache, getChildren: getChildren })));
|
|
78
|
+
}), (p, n) => p.searchValue == n.searchValue);
|
|
79
|
+
const _Dtree = (props) => {
|
|
80
|
+
const { treeState, setTreeData, onSelect } = (0, BaseTree_1.useBaseTree)();
|
|
81
|
+
const actionContext = (0, ActionTree_1.useActionTree)();
|
|
82
|
+
const [init, setInit] = (0, react_1.useState)(false);
|
|
83
|
+
const { rootApi, notCache } = props;
|
|
84
|
+
(0, hooks_1.useEffectFunction)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
|
+
// 获取根节点
|
|
86
|
+
let tree = [];
|
|
87
|
+
if (rootApi) {
|
|
88
|
+
if (!notCache)
|
|
89
|
+
utils_1.Ajax.SESSION(rootApi);
|
|
90
|
+
let rootResp = yield utils_1.Ajax.GET(rootApi);
|
|
91
|
+
if (rootResp.code != '0') {
|
|
92
|
+
antd_1.message.error(rootResp.message);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
tree = (0, ActionTree_1.getResponseList)(rootResp, treeState.sortField);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
tree = yield props.getChildren(treeState.rootCode);
|
|
99
|
+
}
|
|
100
|
+
if (tree.length == 1) {
|
|
101
|
+
tree[0].children = yield props.getChildren(tree[0][treeState.keyField]);
|
|
102
|
+
}
|
|
103
|
+
setTreeData(tree);
|
|
104
|
+
if (props.mustSelect && tree.length > 0) {
|
|
105
|
+
onSelect([
|
|
106
|
+
tree[0][treeState.keyField]
|
|
107
|
+
], {
|
|
108
|
+
selectedNodes: [
|
|
109
|
+
// @ts-ignore
|
|
110
|
+
{ props: { data: { node: tree[0], position: [0] } } }
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
setInit(true);
|
|
115
|
+
}));
|
|
116
|
+
if (!init)
|
|
117
|
+
return utils_1.Const.NONE;
|
|
118
|
+
const treeProps = {};
|
|
119
|
+
if (props.defaultExpandAll || props.searchValue) {
|
|
120
|
+
treeProps.defaultExpandAll = true;
|
|
121
|
+
treeProps.expandedKeys = lodash_1.default.flatMapDeep(treeState.treeData, item => item[treeState.keyField]);
|
|
122
|
+
}
|
|
123
|
+
else if (treeState.treeData.length == 1) {
|
|
124
|
+
// 如果根节点只有一个,则自动展开这个根结点
|
|
125
|
+
treeProps.defaultExpandedKeys = [treeState.treeData[0][treeState.keyField]];
|
|
126
|
+
}
|
|
127
|
+
// loadData?: (node: AntTreeNode) => PromiseLike<void>;
|
|
128
|
+
const loadData = (evt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
129
|
+
const { node, position } = evt.props.data;
|
|
130
|
+
const children = yield props.getChildren(node[treeState.keyField]);
|
|
131
|
+
let nodePath = position.map(i => `[${i}]`).join('.children');
|
|
132
|
+
let tree = treeState.treeData;
|
|
133
|
+
let data = lodash_1.default.get(treeState.treeData, nodePath);
|
|
134
|
+
data.children = children;
|
|
135
|
+
setTreeData(tree);
|
|
136
|
+
});
|
|
137
|
+
return react_1.default.createElement(antd_1.Tree, Object.assign({}, treeState.baseProps, treeProps, { className: treeState.className, loadData: loadData,
|
|
138
|
+
// disabled={props.disabled}
|
|
139
|
+
// onSelect={onSelect}
|
|
140
|
+
// selectedKeys={treeState.selectedKeys}
|
|
141
|
+
selectedKeys: treeState.selectedKeys }), (0, ActionTree_1.renderRoot)(props, treeState, actionContext));
|
|
142
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TreeUtil } from '../../utils';
|
|
3
|
+
import type { BaseTreeProps, ActionProps, ActionRef } from './index';
|
|
4
|
+
import type { PlainObject } from '../../basetype';
|
|
5
|
+
type FTreeFetch = {
|
|
6
|
+
/**
|
|
7
|
+
* 获取全部节点的API,如果不传,刚用 API 的GET模式代替
|
|
8
|
+
*/
|
|
9
|
+
fetchApi?: string;
|
|
10
|
+
};
|
|
11
|
+
export type FTreeProps = BaseTreeProps & ActionProps & FTreeFetch;
|
|
12
|
+
/**
|
|
13
|
+
* 动态树
|
|
14
|
+
* CRUD : 支持
|
|
15
|
+
* 动态加载 : 支持
|
|
16
|
+
* 搜索 : 支持
|
|
17
|
+
*/
|
|
18
|
+
export declare const FTree: React.MemoExoticComponent<React.ForwardRefExoticComponent<TreeUtil.BaseTreeOpts & {
|
|
19
|
+
className?: string;
|
|
20
|
+
iconField?: string | ((item: any) => React.ReactNode);
|
|
21
|
+
titleField: string | {
|
|
22
|
+
zhCN?: string;
|
|
23
|
+
enUS?: string;
|
|
24
|
+
zhHK?: string;
|
|
25
|
+
};
|
|
26
|
+
defaultExpandAll?: boolean;
|
|
27
|
+
mustSelect?: boolean;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
disabledNode?: (node: PlainObject) => boolean;
|
|
30
|
+
onSelect?: (key: import("../../basetype").Key, node: PlainObject, parentNode: PlainObject, crumb: PlainObject[], pos: number[]) => void;
|
|
31
|
+
searchValue?: string;
|
|
32
|
+
} & ActionProps & FTreeFetch & React.RefAttributes<ActionRef>>>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.FTree = void 0;
|
|
36
|
+
const react_1 = __importStar(require("react"));
|
|
37
|
+
const antd_1 = require("antd");
|
|
38
|
+
const utils_1 = require("../../utils");
|
|
39
|
+
const BaseTree_1 = require("./BaseTree");
|
|
40
|
+
const ActionTree_1 = require("./ActionTree");
|
|
41
|
+
const hooks_1 = require("../../hooks");
|
|
42
|
+
/**
|
|
43
|
+
* 动态树
|
|
44
|
+
* CRUD : 支持
|
|
45
|
+
* 动态加载 : 支持
|
|
46
|
+
* 搜索 : 支持
|
|
47
|
+
*/
|
|
48
|
+
exports.FTree = (0, react_1.memo)((0, react_1.forwardRef)((props, ref) => react_1.default.createElement(ActionTree_1.ActionTree, Object.assign({}, props, { clearCache: () => utils_1.Ajax.CLEAR(props.fetchApi || props.api), ref: ref }),
|
|
49
|
+
react_1.default.createElement(_Ftree, Object.assign({}, props)))), (p, n) => p.searchValue == n.searchValue);
|
|
50
|
+
const _Ftree = (props) => {
|
|
51
|
+
const { treeState, setTreeData, onSelect } = (0, BaseTree_1.useBaseTree)();
|
|
52
|
+
const actionContext = (0, ActionTree_1.useActionTree)();
|
|
53
|
+
const [init, setInit] = (0, react_1.useState)(false);
|
|
54
|
+
(0, hooks_1.useEffectFunction)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
+
const API = props.fetchApi || props.api;
|
|
56
|
+
if (!props.notCache)
|
|
57
|
+
utils_1.Ajax.SESSION(API);
|
|
58
|
+
const rootResp = yield utils_1.Ajax.GET(API);
|
|
59
|
+
const tree = utils_1.TreeUtil.buildFlatTree(treeState, (0, ActionTree_1.getResponseList)(rootResp));
|
|
60
|
+
setTreeData(tree);
|
|
61
|
+
if (props.mustSelect && tree.length > 0) {
|
|
62
|
+
//@ts-ignore
|
|
63
|
+
onSelect([tree[0][treeState.keyField]], { selectedNodes: [{ data: { node: tree[0], position: [0] } }] }, tree);
|
|
64
|
+
}
|
|
65
|
+
setInit(true);
|
|
66
|
+
}));
|
|
67
|
+
if (!init)
|
|
68
|
+
return utils_1.Const.NONE;
|
|
69
|
+
const treeProps = {};
|
|
70
|
+
if (props.defaultExpandAll || props.searchValue) {
|
|
71
|
+
treeProps.defaultExpandAll = true;
|
|
72
|
+
}
|
|
73
|
+
else if (treeState.treeData.length == 1) {
|
|
74
|
+
// 如果根节点只有一个,则自动展开这个根结点
|
|
75
|
+
treeProps.defaultExpandedKeys = [treeState.treeData[0][treeState.keyField]];
|
|
76
|
+
}
|
|
77
|
+
// if (treeState.treeData === null) return Const.NONE;
|
|
78
|
+
return react_1.default.createElement(antd_1.Tree, Object.assign({}, treeState.baseProps, treeProps, { className: treeState.className, disabled: props.disabled, onSelect: onSelect, selectedKeys: treeState.selectedKeys }), (0, ActionTree_1.renderRoot)(props, treeState, actionContext));
|
|
79
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BaseTreeProps } from './index';
|
|
3
|
+
import type { TreeNodeData } from '../../utils/TreeUtil';
|
|
4
|
+
export type STreeProps = BaseTreeProps & {
|
|
5
|
+
/**
|
|
6
|
+
* 树数据
|
|
7
|
+
* */
|
|
8
|
+
treeData: TreeNodeData[];
|
|
9
|
+
/**
|
|
10
|
+
* 是否扁平数据,默认非扁平数据
|
|
11
|
+
*/
|
|
12
|
+
isFlat?: boolean;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* 静态树
|
|
16
|
+
* CRUD : 不支持
|
|
17
|
+
* 动态加载 : 不支持
|
|
18
|
+
* 搜索 : 支持
|
|
19
|
+
* 数据 : 需要组装好后传入
|
|
20
|
+
*/
|
|
21
|
+
export declare const STree: React.FC<STreeProps>;
|
|
@@ -0,0 +1,92 @@
|
|
|
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.STree = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
32
|
+
const antd_1 = require("antd");
|
|
33
|
+
const BaseTree_1 = require("./BaseTree");
|
|
34
|
+
const TreeUtil_1 = require("../../utils/TreeUtil");
|
|
35
|
+
const utils_1 = require("../../utils");
|
|
36
|
+
const Const_1 = require("../_setup/Const");
|
|
37
|
+
/**
|
|
38
|
+
* 静态树
|
|
39
|
+
* CRUD : 不支持
|
|
40
|
+
* 动态加载 : 不支持
|
|
41
|
+
* 搜索 : 支持
|
|
42
|
+
* 数据 : 需要组装好后传入
|
|
43
|
+
*/
|
|
44
|
+
exports.STree = (0, react_1.memo)((props) => react_1.default.createElement(BaseTree_1.BaseTree, Object.assign({}, props),
|
|
45
|
+
react_1.default.createElement(_Stree, Object.assign({}, props))), (p, n) => p.searchValue == n.searchValue);
|
|
46
|
+
const _Stree = (props) => {
|
|
47
|
+
const { treeState, onSelect, setTreeData } = (0, BaseTree_1.useBaseTree)();
|
|
48
|
+
const [init, setInit] = (0, react_1.useState)(false);
|
|
49
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
50
|
+
let tree = [];
|
|
51
|
+
if (props.isFlat) {
|
|
52
|
+
tree = (0, TreeUtil_1.buildFlatTree)(treeState, props.treeData);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
tree = props.treeData;
|
|
56
|
+
}
|
|
57
|
+
setTreeData(tree);
|
|
58
|
+
if (props.mustSelect && tree.length > 0) {
|
|
59
|
+
// @ts-ignore
|
|
60
|
+
onSelect([tree[0][treeState.keyField]], { selectedNodes: [{ data: { node: tree[0], position: [0] } }] }, tree);
|
|
61
|
+
}
|
|
62
|
+
setInit(true);
|
|
63
|
+
}, []);
|
|
64
|
+
if (!init)
|
|
65
|
+
return utils_1.Const.NONE;
|
|
66
|
+
const treeProps = {};
|
|
67
|
+
if (props.defaultExpandAll || props.searchValue) {
|
|
68
|
+
treeProps.defaultExpandAll = true;
|
|
69
|
+
}
|
|
70
|
+
else if (treeState.treeData.length == 1) {
|
|
71
|
+
// 如果根节点只有一个,则自动展开这个根结点
|
|
72
|
+
treeProps.defaultExpandedKeys = [treeState.treeData[0][treeState.keyField]];
|
|
73
|
+
}
|
|
74
|
+
return react_1.default.createElement(antd_1.Tree, Object.assign({}, treeState.baseProps, treeProps, { className: treeState.className, disabled: props.disabled, selectedKeys: treeState.selectedKeys, onSelect: onSelect }), renderRoot(props, treeState));
|
|
75
|
+
};
|
|
76
|
+
const renderNode = (node, position, state, search, disabledNode) => {
|
|
77
|
+
if (search.keyword && !search.match.has(position.join('-')))
|
|
78
|
+
return utils_1.Const.NONE;
|
|
79
|
+
const param = (0, BaseTree_1.getNodeParam)(node, position, state, search, disabledNode);
|
|
80
|
+
if (lodash_1.default.isArray(node.children) && node.children.length) {
|
|
81
|
+
return react_1.default.createElement(antd_1.Tree.TreeNode, Object.assign({}, param, { isLeaf: false }), renderNodes(node.children, position, state, search, disabledNode));
|
|
82
|
+
}
|
|
83
|
+
return react_1.default.createElement(antd_1.Tree.TreeNode, Object.assign({}, param, { isLeaf: true }));
|
|
84
|
+
};
|
|
85
|
+
const renderNodes = (data, position, state, search, disabledNode) => data.map((item, idx) => renderNode(item, [...position, idx], state, search, disabledNode));
|
|
86
|
+
const renderRoot = (props, state) => {
|
|
87
|
+
const { search } = state;
|
|
88
|
+
if (search.keyword && search.match.size == 0) {
|
|
89
|
+
return react_1.default.createElement(antd_1.Tree.TreeNode, { isLeaf: true, title: react_1.default.createElement(antd_1.Empty, { description: utils_1.i18n.txt(Const_1.V.TXT_FIND_NULL, search.word) }), selectable: false, className: "c-tree-empty" });
|
|
90
|
+
}
|
|
91
|
+
return state.treeData.map((node, idx) => renderNode(node, [idx], state, search, props.disabledNode));
|
|
92
|
+
};
|