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,134 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Key, PlainObject } from '../../basetype';
|
|
3
|
+
import type { BaseTreeOpts } from '../../utils/TreeUtil';
|
|
4
|
+
import type { UFormField, UFormFieldGroup } from '../UForm';
|
|
5
|
+
export { STree } from './STree';
|
|
6
|
+
export { DTree } from './DTree';
|
|
7
|
+
export { FTree } from './FTree';
|
|
8
|
+
/**
|
|
9
|
+
* 基础参数
|
|
10
|
+
*/
|
|
11
|
+
export type BaseTreeProps = BaseTreeOpts & {
|
|
12
|
+
/**
|
|
13
|
+
* 自定义 className
|
|
14
|
+
*/
|
|
15
|
+
className?: string;
|
|
16
|
+
/**
|
|
17
|
+
* 树显示Icon字段 ,默认为空,传入后,以此字段显示图标
|
|
18
|
+
*/
|
|
19
|
+
iconField?: string | ((item: any) => ReactNode);
|
|
20
|
+
/**
|
|
21
|
+
* title 字段,传字段名称。
|
|
22
|
+
* 如果需要支持 i18n ,则传一个对象,支持3个字段
|
|
23
|
+
*/
|
|
24
|
+
titleField: string | {
|
|
25
|
+
/**
|
|
26
|
+
* 简体中文使用名称字段
|
|
27
|
+
*/
|
|
28
|
+
zhCN?: string;
|
|
29
|
+
/**
|
|
30
|
+
* 英语名称字段
|
|
31
|
+
*/
|
|
32
|
+
enUS?: string;
|
|
33
|
+
/**
|
|
34
|
+
* 繁体中文使用名称字段
|
|
35
|
+
*/
|
|
36
|
+
zhHK?: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* 是否默认展开所有结点
|
|
40
|
+
*/
|
|
41
|
+
defaultExpandAll?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* 是否必选,
|
|
44
|
+
*/
|
|
45
|
+
mustSelect?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* 是否禁用树
|
|
48
|
+
* 禁用后无法进行 select 操作
|
|
49
|
+
* */
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* 是否禁用结点,返回true为禁用
|
|
53
|
+
*/
|
|
54
|
+
disabledNode?: (node: PlainObject) => boolean;
|
|
55
|
+
/**
|
|
56
|
+
* 选中后的回调函数
|
|
57
|
+
* 参数1 : key
|
|
58
|
+
* 参数2 : 选中的对象,可能会返回空
|
|
59
|
+
* 参数3 : 选中对象的父节点
|
|
60
|
+
* 参数4 : 选中对象的位置
|
|
61
|
+
*/
|
|
62
|
+
onSelect?: (key: Key, node: PlainObject, parentNode: PlainObject, crumb: PlainObject[], pos: number[]) => void;
|
|
63
|
+
/**
|
|
64
|
+
* 搜索关键字
|
|
65
|
+
*/
|
|
66
|
+
searchValue?: string;
|
|
67
|
+
};
|
|
68
|
+
export type ActionProps = {
|
|
69
|
+
/**
|
|
70
|
+
* 对象的 Label
|
|
71
|
+
*/
|
|
72
|
+
objectName?: string;
|
|
73
|
+
/**
|
|
74
|
+
* 对象Label 的 i18nKey
|
|
75
|
+
*/
|
|
76
|
+
ik?: string;
|
|
77
|
+
/**
|
|
78
|
+
* 添加、修改、删除的接口
|
|
79
|
+
* 需要符合VAP规范
|
|
80
|
+
* 必须传些参数才有 CRUD功能
|
|
81
|
+
*/
|
|
82
|
+
api?: string;
|
|
83
|
+
/**
|
|
84
|
+
* 是否可以插入节点
|
|
85
|
+
*/
|
|
86
|
+
canAdd?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* 是否允许插入根节点
|
|
89
|
+
*/
|
|
90
|
+
canAddRoot?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* 是否允许修改节点
|
|
93
|
+
*/
|
|
94
|
+
canUpdate?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* 是否允许修改根节点
|
|
97
|
+
*/
|
|
98
|
+
canUpdateRoot?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* 是否可以删除节点
|
|
101
|
+
*/
|
|
102
|
+
canDelete?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* 是否支持排序
|
|
105
|
+
*/
|
|
106
|
+
canSort?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* 添加编辑,使用UForm,如果不传,则自动使用 key,title,parent,icon,
|
|
109
|
+
*/
|
|
110
|
+
formFields?: (UFormField[]) | (UFormFieldGroup[]);
|
|
111
|
+
/**
|
|
112
|
+
* 添加编辑一个节点时,给默认值
|
|
113
|
+
*/
|
|
114
|
+
formDefault?: PlainObject | ((selectNode: PlainObject) => PlainObject);
|
|
115
|
+
/**
|
|
116
|
+
* 是否去缓存,默认缓存,如果强制不缓存,则传 notCache = true
|
|
117
|
+
*/
|
|
118
|
+
notCache?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* 说明,当api 的key 与 id 不同时,可指定 idForApiField,
|
|
121
|
+
* 可用于编辑,排序,删除
|
|
122
|
+
*/
|
|
123
|
+
idForApiField?: string;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* 说明 针对节点进行操作
|
|
127
|
+
* 说明,节点信息,位置信息,可通过 onSelect 方法的第五个参数可以拿到
|
|
128
|
+
*/
|
|
129
|
+
export type ActionRef = {
|
|
130
|
+
updateData: (node: PlainObject, pos: number[]) => void;
|
|
131
|
+
update: (node: PlainObject, pos: number[]) => Promise<void>;
|
|
132
|
+
del: (node: PlainObject, pos: number[]) => Promise<void>;
|
|
133
|
+
add: (node: PlainObject, pos: number[]) => void;
|
|
134
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FTree = exports.DTree = exports.STree = void 0;
|
|
4
|
+
var STree_1 = require("./STree");
|
|
5
|
+
Object.defineProperty(exports, "STree", { enumerable: true, get: function () { return STree_1.STree; } });
|
|
6
|
+
var DTree_1 = require("./DTree");
|
|
7
|
+
Object.defineProperty(exports, "DTree", { enumerable: true, get: function () { return DTree_1.DTree; } });
|
|
8
|
+
var FTree_1 = require("./FTree");
|
|
9
|
+
Object.defineProperty(exports, "FTree", { enumerable: true, get: function () { return FTree_1.FTree; } });
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { UFromProps } from './index';
|
|
3
|
+
import type { MutableRefObject, PropsWithChildren } from 'react';
|
|
4
|
+
export type FormState = {
|
|
5
|
+
width: number;
|
|
6
|
+
cols: 1 | 2 | 3;
|
|
7
|
+
isGroup: boolean;
|
|
8
|
+
colSpan: number;
|
|
9
|
+
labelSpan: number;
|
|
10
|
+
inputSpan: number;
|
|
11
|
+
maxLabel: number;
|
|
12
|
+
hiddenFields: MutableRefObject<Set<string>>;
|
|
13
|
+
disableFields: MutableRefObject<Set<string>>;
|
|
14
|
+
multipleFields: MutableRefObject<Set<string>>;
|
|
15
|
+
requireFields: MutableRefObject<Map<string, boolean>>;
|
|
16
|
+
optionFields: MutableRefObject<Map<string, any[]>>;
|
|
17
|
+
};
|
|
18
|
+
export declare const useFormLayout: () => FormState;
|
|
19
|
+
export declare const getDefault: (props: UFromProps) => [boolean, number, 1 | 2 | 3, number];
|
|
20
|
+
export declare const FormWrapper: React.FC<PropsWithChildren<UFromProps & {
|
|
21
|
+
isInfo: boolean;
|
|
22
|
+
}>>;
|
|
@@ -0,0 +1,270 @@
|
|
|
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.FormWrapper = exports.getDefault = exports.useFormLayout = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const utils_1 = require("../../utils");
|
|
32
|
+
const _register_1 = require("./_register");
|
|
33
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
34
|
+
const LABEL_NOT_CHINESE = 0.66;
|
|
35
|
+
const useFormLayout = () => (0, react_1.useContext)(FormContext);
|
|
36
|
+
exports.useFormLayout = useFormLayout;
|
|
37
|
+
const FormContext = (0, react_1.createContext)(null);
|
|
38
|
+
/**
|
|
39
|
+
* 默认排版
|
|
40
|
+
* [默认宽度, 一行显示列数, Label最高可占据span数]
|
|
41
|
+
* */
|
|
42
|
+
const LAYOUTS = {
|
|
43
|
+
common: [880, 2, 12],
|
|
44
|
+
simple: [640, 1, 8],
|
|
45
|
+
compress: [1080, 3, 9],
|
|
46
|
+
};
|
|
47
|
+
const COLS_SPLIT = 8;
|
|
48
|
+
const FONT_SIZE = 12;
|
|
49
|
+
const getDefault = (props) => {
|
|
50
|
+
const isGroup = lodash_1.default.has(props.fields[0], 'fields');
|
|
51
|
+
let width, cols, colMax;
|
|
52
|
+
if (lodash_1.default.has(LAYOUTS, props.layout)) {
|
|
53
|
+
[width, cols, colMax] = LAYOUTS[props.layout];
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
let col = 0;
|
|
57
|
+
if (!isGroup) {
|
|
58
|
+
col = props.fields.length;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
col = lodash_1.default.sum(props.fields.map((item) => lodash_1.default.filter(item.fields, v => v).length));
|
|
62
|
+
}
|
|
63
|
+
[width, cols, colMax] = (col > COLS_SPLIT) ? LAYOUTS.common : LAYOUTS.simple;
|
|
64
|
+
}
|
|
65
|
+
return [isGroup, width, cols, colMax];
|
|
66
|
+
};
|
|
67
|
+
exports.getDefault = getDefault;
|
|
68
|
+
/**
|
|
69
|
+
* 判断表单默认展示形式
|
|
70
|
+
*/
|
|
71
|
+
const getFormLayout = (props, root) => {
|
|
72
|
+
let [isGroup, width, cols, colMax] = (0, exports.getDefault)(props);
|
|
73
|
+
if (lodash_1.default.has(props, 'width')) {
|
|
74
|
+
width = props.width;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
let totalWidth = root.getBoundingClientRect().width;
|
|
78
|
+
if (width > totalWidth) {
|
|
79
|
+
width = totalWidth;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
let isInfo = false, isEdit = false, isCreate = false;
|
|
83
|
+
switch (props.mode) {
|
|
84
|
+
case 'ADD':
|
|
85
|
+
isCreate = true;
|
|
86
|
+
break;
|
|
87
|
+
case 'EDIT':
|
|
88
|
+
isEdit = true;
|
|
89
|
+
break;
|
|
90
|
+
case 'INFO':
|
|
91
|
+
isInfo = true;
|
|
92
|
+
break;
|
|
93
|
+
default:
|
|
94
|
+
if (props.isInfo) {
|
|
95
|
+
isInfo = true;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
if (props.isEdit) {
|
|
99
|
+
isEdit = true;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
isCreate = true;
|
|
103
|
+
// if (props.data != null || _.keys(props.data).length == 0) {
|
|
104
|
+
// isInfo = true;
|
|
105
|
+
// break;
|
|
106
|
+
// }
|
|
107
|
+
// isInfo = true;
|
|
108
|
+
}
|
|
109
|
+
return [isGroup, cols, width, colMax, isInfo, isEdit, isCreate];
|
|
110
|
+
};
|
|
111
|
+
const getMaxTitleWidth = (field) => {
|
|
112
|
+
if (field.type && (0, _register_1.getUFormInput)(field.type).breakTitle)
|
|
113
|
+
return 0;
|
|
114
|
+
let title = null;
|
|
115
|
+
if (field.ik)
|
|
116
|
+
title = utils_1.i18n.txt(field.ik);
|
|
117
|
+
if (title == null)
|
|
118
|
+
title = lodash_1.default.isString(field.title) ? field.title : '';
|
|
119
|
+
let sum = 0;
|
|
120
|
+
for (let i = 0, _i = title.length; i < _i; i++) {
|
|
121
|
+
if (title.charCodeAt(i) < 12800) {
|
|
122
|
+
sum += LABEL_NOT_CHINESE;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
sum += 1;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return Math.ceil(sum);
|
|
129
|
+
};
|
|
130
|
+
// 遍历字段,计算表单属性
|
|
131
|
+
const _LOOP = (fs, maxLabel, isInfo, isEdit, isCreate, hiddFields, disableFields) => {
|
|
132
|
+
fs.map(field => {
|
|
133
|
+
// @ts-ignore // 兼容 && 写法
|
|
134
|
+
if (field == null || field === false)
|
|
135
|
+
return;
|
|
136
|
+
let show = true;
|
|
137
|
+
if (field.roleCode && !utils_1.PageUtil.hasRole(field.roleCode)) {
|
|
138
|
+
show = false;
|
|
139
|
+
}
|
|
140
|
+
else if (lodash_1.default.has(field, 'show')) {
|
|
141
|
+
if (field.show === false || field.show === true) {
|
|
142
|
+
show = field.show;
|
|
143
|
+
}
|
|
144
|
+
else if (field.show) {
|
|
145
|
+
switch (field.show) {
|
|
146
|
+
case 'A':
|
|
147
|
+
show = !isInfo && !isEdit;
|
|
148
|
+
break;
|
|
149
|
+
case 'AE':
|
|
150
|
+
show = !isInfo;
|
|
151
|
+
break;
|
|
152
|
+
case 'I':
|
|
153
|
+
show = isInfo;
|
|
154
|
+
break;
|
|
155
|
+
case 'IE':
|
|
156
|
+
show = !isEdit;
|
|
157
|
+
break;
|
|
158
|
+
case 'IE':
|
|
159
|
+
show = isInfo || isEdit;
|
|
160
|
+
break;
|
|
161
|
+
case 'E':
|
|
162
|
+
show = isEdit && !isInfo;
|
|
163
|
+
break;
|
|
164
|
+
case 'IAE':
|
|
165
|
+
show = true;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (!show) {
|
|
171
|
+
hiddFields.add(field.field);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
let maxCount = getMaxTitleWidth(field);
|
|
175
|
+
if (maxLabel.current < maxCount)
|
|
176
|
+
maxLabel.current = maxCount;
|
|
177
|
+
let disabled = false;
|
|
178
|
+
if (!isInfo && lodash_1.default.has(field, 'disabled')) {
|
|
179
|
+
if (field.disabled === false || field.disabled === true) {
|
|
180
|
+
disabled = field.disabled;
|
|
181
|
+
}
|
|
182
|
+
else if (field.disabled) {
|
|
183
|
+
switch (field.disabled) {
|
|
184
|
+
case 'A':
|
|
185
|
+
case 'IE':
|
|
186
|
+
disabled = !isEdit;
|
|
187
|
+
break;
|
|
188
|
+
case 'IE':
|
|
189
|
+
case 'E':
|
|
190
|
+
disabled = isEdit;
|
|
191
|
+
break;
|
|
192
|
+
case 'AE':
|
|
193
|
+
case 'IAE':
|
|
194
|
+
disabled = true;
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (disabled) {
|
|
200
|
+
disableFields.add(field.field);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
const FormWrapper = (props) => {
|
|
205
|
+
const DisableFieldRef = (0, react_1.useRef)(null);
|
|
206
|
+
const HiddenFieldRef = (0, react_1.useRef)(null);
|
|
207
|
+
const OptionsMapRef = (0, react_1.useRef)(null);
|
|
208
|
+
const RequiredMapRef = (0, react_1.useRef)(null);
|
|
209
|
+
const multipleFieldsRef = (0, react_1.useRef)(null);
|
|
210
|
+
const formContainer = (0, react_1.useRef)(null);
|
|
211
|
+
const maxLabelRef = (0, react_1.useRef)(0);
|
|
212
|
+
// maxLabel
|
|
213
|
+
const [state, setState] = (0, react_1.useState)(null);
|
|
214
|
+
(0, react_1.useEffect)(() => {
|
|
215
|
+
if (DisableFieldRef.current == null) {
|
|
216
|
+
DisableFieldRef.current = new Set();
|
|
217
|
+
HiddenFieldRef.current = new Set();
|
|
218
|
+
OptionsMapRef.current = new Map();
|
|
219
|
+
RequiredMapRef.current = new Map();
|
|
220
|
+
multipleFieldsRef.current = new Set();
|
|
221
|
+
}
|
|
222
|
+
const { fields } = props;
|
|
223
|
+
if (fields == null || fields.length == 0)
|
|
224
|
+
throw new Error('Must Have Fields');
|
|
225
|
+
const [isGroup, cols, width, colMax, isInfo, isEdit, isCreate] = getFormLayout(props, formContainer.current);
|
|
226
|
+
let colSpan = 24 / cols;
|
|
227
|
+
// const MAX_LABEL_SPAN = COLMAX[cols];
|
|
228
|
+
if (isGroup) {
|
|
229
|
+
fields.map(group => _LOOP(group.fields, maxLabelRef, isInfo, isEdit, isCreate, HiddenFieldRef.current, DisableFieldRef.current));
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
_LOOP(fields, maxLabelRef, isInfo, isEdit, isCreate, HiddenFieldRef.current, DisableFieldRef.current);
|
|
233
|
+
}
|
|
234
|
+
let fieldWidth = width / cols;
|
|
235
|
+
var percent = (maxLabelRef.current * FONT_SIZE + 20) / fieldWidth;
|
|
236
|
+
let labelSpan = Math.ceil(percent * 24);
|
|
237
|
+
if (labelSpan > colMax) {
|
|
238
|
+
labelSpan = colMax;
|
|
239
|
+
}
|
|
240
|
+
var fix = labelSpan % cols;
|
|
241
|
+
if (fix != 0) {
|
|
242
|
+
labelSpan += fix;
|
|
243
|
+
}
|
|
244
|
+
if (cols == 1) {
|
|
245
|
+
if (labelSpan < 6) {
|
|
246
|
+
labelSpan = 6;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
let inputSpan = 24 - labelSpan;
|
|
250
|
+
if (cols == 1 && inputSpan > 14) {
|
|
251
|
+
inputSpan = inputSpan - 1;
|
|
252
|
+
}
|
|
253
|
+
setState({
|
|
254
|
+
maxLabel: maxLabelRef.current,
|
|
255
|
+
width,
|
|
256
|
+
cols,
|
|
257
|
+
isGroup,
|
|
258
|
+
colSpan,
|
|
259
|
+
labelSpan,
|
|
260
|
+
inputSpan,
|
|
261
|
+
hiddenFields: HiddenFieldRef,
|
|
262
|
+
disableFields: DisableFieldRef,
|
|
263
|
+
multipleFields: multipleFieldsRef,
|
|
264
|
+
requireFields: RequiredMapRef,
|
|
265
|
+
optionFields: OptionsMapRef,
|
|
266
|
+
});
|
|
267
|
+
}, []);
|
|
268
|
+
return react_1.default.createElement("div", { ref: formContainer, className: props.className, style: props.style }, state == null ? [] : react_1.default.createElement(FormContext.Provider, { value: state }, props.children));
|
|
269
|
+
};
|
|
270
|
+
exports.FormWrapper = FormWrapper;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UDescriptions = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const isReactFragment = (variableToInspect) => {
|
|
11
|
+
if (variableToInspect.type)
|
|
12
|
+
return variableToInspect.type === react_1.default.Fragment;
|
|
13
|
+
return false;
|
|
14
|
+
};
|
|
15
|
+
const toArray = (children) => {
|
|
16
|
+
let ret = [];
|
|
17
|
+
react_1.default.Children.forEach(children, child => {
|
|
18
|
+
if (child === undefined || child === null) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (isReactFragment(child)) {
|
|
22
|
+
//@ts-ignore
|
|
23
|
+
ret = ret.concat(toArray(child.props.children));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (Array.isArray(child)) {
|
|
27
|
+
ret = ret.concat(toArray(child));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
ret.push(child);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return ret;
|
|
34
|
+
};
|
|
35
|
+
const _UDescriptions = props => {
|
|
36
|
+
const { className, style, title, labelWidth, column, theme, hideBorder, ik } = props;
|
|
37
|
+
let cols = column || 2;
|
|
38
|
+
let mode = theme ? theme : 'label';
|
|
39
|
+
const items = toArray(props.children);
|
|
40
|
+
if (items.length == 0)
|
|
41
|
+
return utils_1.Const.NONE;
|
|
42
|
+
let clazz = ['c-des', 'c-des-t' + mode,];
|
|
43
|
+
if (hideBorder) {
|
|
44
|
+
if (lodash_1.default.isString(hideBorder)) {
|
|
45
|
+
clazz.push('c-des-h' + hideBorder);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
hideBorder.map(item => clazz.push('c-des-h' + item));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (className) {
|
|
52
|
+
clazz.push(className);
|
|
53
|
+
}
|
|
54
|
+
const rows = generateChildrenRows(items, cols);
|
|
55
|
+
let groupTitle = utils_1.i18n.getText(ik, title);
|
|
56
|
+
return react_1.default.createElement("div", { className: clazz.join(' '), style: style },
|
|
57
|
+
groupTitle && react_1.default.createElement("div", { className: "c-des-title" }, groupTitle),
|
|
58
|
+
react_1.default.createElement("div", { className: `c-des-view c-des-c${cols}l${labelWidth}` },
|
|
59
|
+
react_1.default.createElement("table", null,
|
|
60
|
+
react_1.default.createElement("colgroup", null, lodash_1.default.range(cols * 2).map(i => react_1.default.createElement("col", { className: (i % 2 == 0) ? 'c-des-glabel' : 'c-des-gvalue' }))),
|
|
61
|
+
react_1.default.createElement("tbody", null,
|
|
62
|
+
react_1.default.createElement("tr", { className: "c-des-align" }, lodash_1.default.range(cols * 2).map(i => (i % 2 == 0) ? react_1.default.createElement("th", null) : react_1.default.createElement("td", null))),
|
|
63
|
+
rows.map((row) => react_1.default.createElement("tr", { className: "c-des-row" }, renderRow(row, column)))))));
|
|
64
|
+
};
|
|
65
|
+
const generateChildrenRows = (items, column) => {
|
|
66
|
+
const rows = [];
|
|
67
|
+
let columns = null;
|
|
68
|
+
let leftSpans;
|
|
69
|
+
items.forEach((node, index) => {
|
|
70
|
+
// let itemNode = node;
|
|
71
|
+
if (!columns) {
|
|
72
|
+
leftSpans = column;
|
|
73
|
+
columns = [];
|
|
74
|
+
rows.push(columns);
|
|
75
|
+
}
|
|
76
|
+
var { span = 1 } = node.props;
|
|
77
|
+
if (span >= column) {
|
|
78
|
+
span = column;
|
|
79
|
+
}
|
|
80
|
+
if (index === items.length - 1) {
|
|
81
|
+
span = leftSpans;
|
|
82
|
+
}
|
|
83
|
+
if (span <= leftSpans) {
|
|
84
|
+
leftSpans -= span;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
// 超出结界,换行重构
|
|
88
|
+
let cells = columns.map(item => item.props.span);
|
|
89
|
+
let diffSpan = column - lodash_1.default.sum(cells);
|
|
90
|
+
const lastNode = columns.pop();
|
|
91
|
+
columns.push(react_1.default.cloneElement(lastNode, { span: lastNode.props.span + diffSpan }));
|
|
92
|
+
leftSpans = column - span;
|
|
93
|
+
columns = [];
|
|
94
|
+
rows.push(columns);
|
|
95
|
+
}
|
|
96
|
+
columns.push(react_1.default.cloneElement(node, { span }));
|
|
97
|
+
if (leftSpans <= 0) {
|
|
98
|
+
columns = null;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
return rows;
|
|
102
|
+
};
|
|
103
|
+
const Col = (props) => {
|
|
104
|
+
if (props.isLabel)
|
|
105
|
+
return react_1.default.createElement("th", { className: "c-des-label" }, props.children);
|
|
106
|
+
let colSpan = 1;
|
|
107
|
+
if (props.breakLabel)
|
|
108
|
+
colSpan += 1;
|
|
109
|
+
if (props.span && props.span > 1)
|
|
110
|
+
colSpan += ((props.span - 1) * 2);
|
|
111
|
+
return react_1.default.createElement("td", { className: "c-des-value " + (props.className ? props.className : ''), colSpan: colSpan }, props.children);
|
|
112
|
+
};
|
|
113
|
+
const renderRow = (row, cols) => {
|
|
114
|
+
let columns = [];
|
|
115
|
+
row.map(col => {
|
|
116
|
+
if (col.props.roleCode && !utils_1.PageUtil.hasRole(col.props.roleCode))
|
|
117
|
+
return;
|
|
118
|
+
let label = null;
|
|
119
|
+
if (col.props.ik) {
|
|
120
|
+
label = utils_1.i18n.txt(col.props.ik);
|
|
121
|
+
}
|
|
122
|
+
else if (col.props.label) {
|
|
123
|
+
label = col.props.label;
|
|
124
|
+
}
|
|
125
|
+
let breakLabel = label == null || col.props.breakLabel;
|
|
126
|
+
if (!breakLabel) {
|
|
127
|
+
columns.push(react_1.default.createElement(Col, { isLabel: true, breakLabel: breakLabel, className: col.props.className, span: col.props.span, cols: cols }, label));
|
|
128
|
+
}
|
|
129
|
+
columns.push(react_1.default.createElement(Col, { isLabel: false, breakLabel: breakLabel, className: col.props.className, span: col.props.span, cols: cols }, col.props.children));
|
|
130
|
+
});
|
|
131
|
+
return columns;
|
|
132
|
+
};
|
|
133
|
+
exports.UDescriptions = _UDescriptions;
|
|
134
|
+
exports.UDescriptions.Item = (props) => utils_1.Const.NONE;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { UFromProps } from './index';
|
|
3
|
+
import type { FormState } from './FormWrapper';
|
|
4
|
+
import type { PlainObject } from '../../basetype';
|
|
5
|
+
export type UFomFunctions = {
|
|
6
|
+
/**
|
|
7
|
+
* 获取当前表单数据
|
|
8
|
+
*/
|
|
9
|
+
data: () => PlainObject;
|
|
10
|
+
/**
|
|
11
|
+
* 获取当前表单数据
|
|
12
|
+
* 会先进行验证表单有效性,验证不通过则不返回
|
|
13
|
+
*/
|
|
14
|
+
validate: () => Promise<PlainObject>;
|
|
15
|
+
/**
|
|
16
|
+
* 重置表单
|
|
17
|
+
*/
|
|
18
|
+
reset: () => void;
|
|
19
|
+
};
|
|
20
|
+
export declare const initValue: (props: UFromProps & {
|
|
21
|
+
state: FormState;
|
|
22
|
+
}) => {
|
|
23
|
+
[x: string]: any;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* 说明:
|
|
27
|
+
* 相比旧版UForm ,新版本 UForm 功能更强
|
|
28
|
+
* 1. 降低大部分没必要的渲染,性能提升
|
|
29
|
+
* 2. 现已支持 Link 联动 返回 Promise
|
|
30
|
+
* 3. 支持 ref 控制方法
|
|
31
|
+
* 4. filed 支持更多提示,验证方法
|
|
32
|
+
*/
|
|
33
|
+
export declare const UForm: React.ForwardRefExoticComponent<UFromProps & React.RefAttributes<UFomFunctions>>;
|