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,352 @@
|
|
|
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.getFileType = exports.getFloat = exports.getInteger = exports.getBoolean = exports.getString = exports.copy = exports.px = exports.className = exports.searchText = exports.trimLower = exports.isBoolean = exports.isBTCAddress = exports.uuid = exports.genKey = exports.isId = exports.isId15 = exports.isId18 = exports.REG_ID_15 = exports.REG_ID_18 = exports.isIP = exports.isIP6 = exports.isIP4 = exports.isPhone = exports.isMAC = exports.isURL = exports.isEmail = exports.isTelePhone = exports.isMobilePhone = exports.REG_PORT = exports.REG_URL = exports.REG_IPV6 = exports.REG_IPV4 = exports.REG_TELEPHONE = exports.REG_PHONE = exports.REG_EMAIL = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const _Support_1 = require("./_Support");
|
|
9
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
10
|
+
exports.REG_EMAIL = /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i;
|
|
11
|
+
exports.REG_PHONE = /^((\+|00)86)?(1[3-9]|9[28])\d{9}$/; // https://github.com/validatorjs/validator.js/blob/master/src/lib/isMobilePhone.js
|
|
12
|
+
exports.REG_TELEPHONE = /^0\d{2,3}-[1-9]\d{6,7}$/;
|
|
13
|
+
const IPv4SegmentFormat = '(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
|
|
14
|
+
const IPv4AddressFormat = `(${IPv4SegmentFormat}[.]){3}${IPv4SegmentFormat}`;
|
|
15
|
+
exports.REG_IPV4 = new RegExp(`^${IPv4AddressFormat}$`);
|
|
16
|
+
const IPv6SegmentFormat = '(?:[0-9a-fA-F]{1,4})';
|
|
17
|
+
exports.REG_IPV6 = new RegExp('^(' +
|
|
18
|
+
`(?:${IPv6SegmentFormat}:){7}(?:${IPv6SegmentFormat}|:)|` +
|
|
19
|
+
`(?:${IPv6SegmentFormat}:){6}(?:${IPv4AddressFormat}|:${IPv6SegmentFormat}|:)|` +
|
|
20
|
+
`(?:${IPv6SegmentFormat}:){5}(?::${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,2}|:)|` +
|
|
21
|
+
`(?:${IPv6SegmentFormat}:){4}(?:(:${IPv6SegmentFormat}){0,1}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,3}|:)|` +
|
|
22
|
+
`(?:${IPv6SegmentFormat}:){3}(?:(:${IPv6SegmentFormat}){0,2}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,4}|:)|` +
|
|
23
|
+
`(?:${IPv6SegmentFormat}:){2}(?:(:${IPv6SegmentFormat}){0,3}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,5}|:)|` +
|
|
24
|
+
`(?:${IPv6SegmentFormat}:){1}(?:(:${IPv6SegmentFormat}){0,4}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,6}|:)|` +
|
|
25
|
+
`(?::((?::${IPv6SegmentFormat}){0,5}:${IPv4AddressFormat}|(?::${IPv6SegmentFormat}){1,7}|:))` +
|
|
26
|
+
')(%[0-9a-zA-Z-.:]{1,})?$');
|
|
27
|
+
exports.REG_URL = /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/;
|
|
28
|
+
exports.REG_PORT = /TODO/;
|
|
29
|
+
const macAddress48 = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){4}([0-9a-fA-F]{2})$/;
|
|
30
|
+
const macAddress48NoSeparators = /^([0-9a-fA-F]){12}$/;
|
|
31
|
+
const macAddress48WithDots = /^([0-9a-fA-F]{4}\.){2}([0-9a-fA-F]{4})$/;
|
|
32
|
+
const macAddress64 = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){6}([0-9a-fA-F]{2})$/;
|
|
33
|
+
const macAddress64NoSeparators = /^([0-9a-fA-F]){16}$/;
|
|
34
|
+
const macAddress64WithDots = /^([0-9a-fA-F]{4}\.){3}([0-9a-fA-F]{4})$/;
|
|
35
|
+
const s4 = () => (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
36
|
+
/**
|
|
37
|
+
* 是否为一个手机号码
|
|
38
|
+
*/
|
|
39
|
+
const isMobilePhone = (txt) => exports.REG_PHONE.test(txt);
|
|
40
|
+
exports.isMobilePhone = isMobilePhone;
|
|
41
|
+
/**
|
|
42
|
+
* 是否为一个固话号码
|
|
43
|
+
*/
|
|
44
|
+
const isTelePhone = (txt) => exports.REG_TELEPHONE.test(txt);
|
|
45
|
+
exports.isTelePhone = isTelePhone;
|
|
46
|
+
/**
|
|
47
|
+
* 是否为一个Email地址
|
|
48
|
+
*/
|
|
49
|
+
const isEmail = (txt) => exports.REG_EMAIL.test(txt);
|
|
50
|
+
exports.isEmail = isEmail;
|
|
51
|
+
/**
|
|
52
|
+
* 是否为一个URL地址
|
|
53
|
+
*/
|
|
54
|
+
const isURL = (txt) => exports.REG_URL.test(txt);
|
|
55
|
+
exports.isURL = isURL;
|
|
56
|
+
/**
|
|
57
|
+
* 是否为一个Mac地址
|
|
58
|
+
*/
|
|
59
|
+
const isMAC = (txt) => macAddress48.test(txt) || macAddress48WithDots.test(txt)
|
|
60
|
+
|| macAddress64.test(txt) || macAddress64WithDots.test(txt)
|
|
61
|
+
|| macAddress48NoSeparators.test(txt) || macAddress64NoSeparators.test(txt);
|
|
62
|
+
exports.isMAC = isMAC;
|
|
63
|
+
/**
|
|
64
|
+
* 是否为一个电话号码,支持固定电话和手机
|
|
65
|
+
*/
|
|
66
|
+
const isPhone = (txt) => (0, exports.isMobilePhone)(txt) || (0, exports.isTelePhone)(txt);
|
|
67
|
+
exports.isPhone = isPhone;
|
|
68
|
+
const isIP4 = (str) => exports.REG_IPV4.test(str);
|
|
69
|
+
exports.isIP4 = isIP4;
|
|
70
|
+
const isIP6 = (str) => exports.REG_IPV4.test(str);
|
|
71
|
+
exports.isIP6 = isIP6;
|
|
72
|
+
/**
|
|
73
|
+
* 判断是否是一个 IP 地址,默认
|
|
74
|
+
* @param str : 要判断的字符串
|
|
75
|
+
* @param version : IP版本,默认为 IP4, 如果要同时 4,6, 传 空字串 :''
|
|
76
|
+
*/
|
|
77
|
+
const isIP = (str, version = '') => {
|
|
78
|
+
switch (version) {
|
|
79
|
+
case '4':
|
|
80
|
+
return (0, exports.isIP4)(str);
|
|
81
|
+
case '6':
|
|
82
|
+
return (0, exports.isIP6)(str);
|
|
83
|
+
default:
|
|
84
|
+
return (0, exports.isIP4)(str) || (0, exports.isIP6)(str);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
exports.isIP = isIP;
|
|
88
|
+
exports.REG_ID_18 = /^[1-9]\d\d{4}(18|19|20)\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
|
|
89
|
+
exports.REG_ID_15 = /^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}[0-9Xx]$/;
|
|
90
|
+
// 省份代码
|
|
91
|
+
const ID_PROVICES = new Set([
|
|
92
|
+
"11", "12", "13", "14", "15", "21", "22", "23", "31", "32",
|
|
93
|
+
"33", "34", "35", "36", "37", "41", "42", "43", "44",
|
|
94
|
+
"45", "46", "50", "51", "52", "53", "54", "61", "62", "63",
|
|
95
|
+
"64", "65"
|
|
96
|
+
]);
|
|
97
|
+
// 加权因子
|
|
98
|
+
const ID_FACTORS = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
|
|
99
|
+
// 校验码对应值
|
|
100
|
+
const ID_CODES = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", '2'];
|
|
101
|
+
/**
|
|
102
|
+
* 判断是否是一个18位身份证号
|
|
103
|
+
* @param txt : 要判断的字符串
|
|
104
|
+
* @param strict : 是否开启严格校验,默认开启
|
|
105
|
+
*/
|
|
106
|
+
const isId18 = (txt, strict = true) => {
|
|
107
|
+
let isFormat = exports.REG_ID_18.test(txt);
|
|
108
|
+
if (!isFormat)
|
|
109
|
+
return false; // 格式有误
|
|
110
|
+
if (!strict)
|
|
111
|
+
return true; // 非严格模式,直接成功
|
|
112
|
+
if (!ID_PROVICES.has(txt.substring(0, 2)))
|
|
113
|
+
return false; // 省份有问题
|
|
114
|
+
let date = txt.substring(6, 14);
|
|
115
|
+
let validate = (0, dayjs_1.default)(txt.substring(6, 14), 'YYYYMMDD');
|
|
116
|
+
if (!validate.isValid() || validate.format('YYYYMMDD') != date)
|
|
117
|
+
return false; // 日期有问题
|
|
118
|
+
var sum = 0;
|
|
119
|
+
for (var i = 0; i < 17; i++) {
|
|
120
|
+
sum += parseInt(txt[i]) * ID_FACTORS[i];
|
|
121
|
+
}
|
|
122
|
+
if (ID_CODES[sum % 11] != txt[17].toUpperCase())
|
|
123
|
+
return false; // 身份证校验失败
|
|
124
|
+
return true;
|
|
125
|
+
};
|
|
126
|
+
exports.isId18 = isId18;
|
|
127
|
+
/**
|
|
128
|
+
* 判断是否是一个15位身份证号
|
|
129
|
+
* @param txt : 要判断的字符串
|
|
130
|
+
* @param strict : 是否开启严格校验,默认开启,
|
|
131
|
+
* 15位身份证号,只会判定省份与年份,不检验哈希,性别
|
|
132
|
+
*
|
|
133
|
+
*/
|
|
134
|
+
const isId15 = (txt, strict = true) => {
|
|
135
|
+
let isFormat = exports.REG_ID_15.test(txt);
|
|
136
|
+
if (!isFormat)
|
|
137
|
+
return false; // 格式有误
|
|
138
|
+
if (!strict)
|
|
139
|
+
return true; // 非严格模式,直接成功
|
|
140
|
+
if (!ID_PROVICES.has(txt.substring(0, 2)))
|
|
141
|
+
return false; // 省份有问题
|
|
142
|
+
let date = '19' + txt.substring(6, 12);
|
|
143
|
+
let validate = (0, dayjs_1.default)(date, 'YYYYMMDD');
|
|
144
|
+
if (!validate.isValid() || validate.format('YYYYMMDD') != date)
|
|
145
|
+
return false; // 日期有问题
|
|
146
|
+
return true;
|
|
147
|
+
};
|
|
148
|
+
exports.isId15 = isId15;
|
|
149
|
+
/**
|
|
150
|
+
* 判断是否是一个身份证号,支持18位和15位
|
|
151
|
+
* @param txt : 要判断的字符串
|
|
152
|
+
* @param strict : 是否开启严格校验,默认开启
|
|
153
|
+
*/
|
|
154
|
+
const isId = (txt, strict = true) => (0, exports.isId18)(txt, strict) || (0, exports.isId15)(txt, strict);
|
|
155
|
+
exports.isId = isId;
|
|
156
|
+
var MULTIPLIER = Math.pow(2, 20);
|
|
157
|
+
var seenKeys = {};
|
|
158
|
+
/**
|
|
159
|
+
* 生成一个唯一 ID 标识
|
|
160
|
+
*/
|
|
161
|
+
const genKey = () => {
|
|
162
|
+
var key = void 0;
|
|
163
|
+
while (key === undefined || seenKeys.hasOwnProperty(key) || !isNaN(+key)) {
|
|
164
|
+
key = Math.floor(Math.random() * MULTIPLIER).toString(32);
|
|
165
|
+
}
|
|
166
|
+
seenKeys[key] = true;
|
|
167
|
+
return key;
|
|
168
|
+
};
|
|
169
|
+
exports.genKey = genKey;
|
|
170
|
+
/**
|
|
171
|
+
* 生成uuid
|
|
172
|
+
*/
|
|
173
|
+
const uuid = () => s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
|
|
174
|
+
exports.uuid = uuid;
|
|
175
|
+
const REG_BTC32 = /^(bc1)[a-z0-9]{25,39}$/;
|
|
176
|
+
const REG_BTC58 = /^(1|3)[A-HJ-NP-Za-km-z1-9]{25,39}$/;
|
|
177
|
+
/**
|
|
178
|
+
* 是否是一个 BTC 地址
|
|
179
|
+
*/
|
|
180
|
+
const isBTCAddress = (str) => REG_BTC32.test(str) || REG_BTC58.test(str);
|
|
181
|
+
exports.isBTCAddress = isBTCAddress;
|
|
182
|
+
/**
|
|
183
|
+
* 说明:不能判断 变量类型,为 vap 内置识别方法
|
|
184
|
+
* 可为 Boolean 的有字符串有 0 / 1 / true / false / yes / no
|
|
185
|
+
* 通过 getBoolean 可获取到对应的 bool 值
|
|
186
|
+
*/
|
|
187
|
+
const isBoolean = (str) => _Support_1.TRUE_SET.has(str) || _Support_1.FALSE_SET.has(str);
|
|
188
|
+
exports.isBoolean = isBoolean;
|
|
189
|
+
/**
|
|
190
|
+
* 清空首尾空格,并小写
|
|
191
|
+
*/
|
|
192
|
+
const trimLower = (str) => lodash_1.default.toLower(lodash_1.default.trim(str));
|
|
193
|
+
exports.trimLower = trimLower;
|
|
194
|
+
/**
|
|
195
|
+
* 搜索,用于高亮,通常与 HighLight 结合使用,或只使用 HighLight 组件
|
|
196
|
+
*/
|
|
197
|
+
const searchText = (sentence, keyword) => (0, _Support_1.matchText)(keyword)(sentence);
|
|
198
|
+
exports.searchText = searchText;
|
|
199
|
+
/**
|
|
200
|
+
* 拼 className
|
|
201
|
+
*/
|
|
202
|
+
const className = (base, classNameProps) => {
|
|
203
|
+
if (classNameProps)
|
|
204
|
+
return [...base, classNameProps].join(' ');
|
|
205
|
+
return base.join(' ');
|
|
206
|
+
};
|
|
207
|
+
exports.className = className;
|
|
208
|
+
/**
|
|
209
|
+
* 试图转px的值
|
|
210
|
+
* 300px -> 300
|
|
211
|
+
*/
|
|
212
|
+
const px = (str) => {
|
|
213
|
+
if (lodash_1.default.isNumber(str)) {
|
|
214
|
+
return str;
|
|
215
|
+
}
|
|
216
|
+
if (lodash_1.default.endsWith(str, 'px')) {
|
|
217
|
+
return parseInt(str.substring(0, str.length - 2));
|
|
218
|
+
}
|
|
219
|
+
try {
|
|
220
|
+
return parseInt(str);
|
|
221
|
+
}
|
|
222
|
+
catch (_a) {
|
|
223
|
+
return 0;
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
exports.px = px;
|
|
227
|
+
/**
|
|
228
|
+
* 复制字符串
|
|
229
|
+
*/
|
|
230
|
+
const copy = (text, onCopied) => {
|
|
231
|
+
var input = document.createElement('input');
|
|
232
|
+
input.setAttribute('readonly', 'readonly'); // 防止手机上弹出软键盘
|
|
233
|
+
input.setAttribute('value', text);
|
|
234
|
+
document.body.appendChild(input);
|
|
235
|
+
input.setSelectionRange(0, 9999);
|
|
236
|
+
input.select();
|
|
237
|
+
document.execCommand('copy');
|
|
238
|
+
document.body.removeChild(input);
|
|
239
|
+
if (lodash_1.default.isFunction(onCopied)) {
|
|
240
|
+
onCopied(text);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
exports.copy = copy;
|
|
244
|
+
/**
|
|
245
|
+
* 获取字符串
|
|
246
|
+
*/
|
|
247
|
+
const getString = (txt, def) => {
|
|
248
|
+
let result = lodash_1.default.trim(txt);
|
|
249
|
+
if (result.length)
|
|
250
|
+
return result;
|
|
251
|
+
return def || '';
|
|
252
|
+
};
|
|
253
|
+
exports.getString = getString;
|
|
254
|
+
/**
|
|
255
|
+
* 获取布尔值
|
|
256
|
+
*/
|
|
257
|
+
const getBoolean = (key, def) => {
|
|
258
|
+
if (key === null || key === undefined)
|
|
259
|
+
return def || false;
|
|
260
|
+
let txt = lodash_1.default.trim(lodash_1.default.toLower(key));
|
|
261
|
+
if (_Support_1.TRUE_SET.has(txt))
|
|
262
|
+
return true;
|
|
263
|
+
if (_Support_1.FALSE_SET.has(txt))
|
|
264
|
+
return false;
|
|
265
|
+
if (!lodash_1.default.isBoolean(def))
|
|
266
|
+
return false; // 默认返回 false
|
|
267
|
+
return def || false;
|
|
268
|
+
};
|
|
269
|
+
exports.getBoolean = getBoolean;
|
|
270
|
+
/**
|
|
271
|
+
* 获取数字
|
|
272
|
+
*/
|
|
273
|
+
const getInteger = (txt, def) => {
|
|
274
|
+
if (txt === null || txt === undefined)
|
|
275
|
+
return def || 0;
|
|
276
|
+
try {
|
|
277
|
+
return parseInt(txt);
|
|
278
|
+
}
|
|
279
|
+
catch (_a) {
|
|
280
|
+
return lodash_1.default.isNumber(def) ? def : 0;
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
exports.getInteger = getInteger;
|
|
284
|
+
/**
|
|
285
|
+
* 获取浮点数
|
|
286
|
+
*/
|
|
287
|
+
const getFloat = (txt, def) => {
|
|
288
|
+
if (txt === null || txt === undefined)
|
|
289
|
+
return def || 0;
|
|
290
|
+
try {
|
|
291
|
+
return parseFloat(txt);
|
|
292
|
+
}
|
|
293
|
+
catch (_a) {
|
|
294
|
+
return lodash_1.default.isNumber(def) ? def : 0;
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
exports.getFloat = getFloat;
|
|
298
|
+
/**
|
|
299
|
+
* 获取文件类及 icon
|
|
300
|
+
*/
|
|
301
|
+
const getFileType = (fileName) => {
|
|
302
|
+
if (fileName == '' || fileName == null)
|
|
303
|
+
return ['unknown', 'file'];
|
|
304
|
+
let idx = lodash_1.default.lastIndexOf(fileName, '.');
|
|
305
|
+
let type = lodash_1.default.toLower(lodash_1.default.trim(idx >= 0 ? fileName.substring(idx + 1) : fileName));
|
|
306
|
+
switch (type) {
|
|
307
|
+
case 'jpg':
|
|
308
|
+
case 'jpeg':
|
|
309
|
+
case 'gif':
|
|
310
|
+
case 'png':
|
|
311
|
+
case 'bmp':
|
|
312
|
+
return ['image', 'file-image'];
|
|
313
|
+
case 'doc':
|
|
314
|
+
case 'txt':
|
|
315
|
+
case 'docx':
|
|
316
|
+
case 'rtf':
|
|
317
|
+
case 'md':
|
|
318
|
+
return ['doc', 'file-word'];
|
|
319
|
+
case 'xls':
|
|
320
|
+
case 'xlsx':
|
|
321
|
+
return ['excel', 'file-excel'];
|
|
322
|
+
case 'pdf':
|
|
323
|
+
return ['pdf', 'file-pdf'];
|
|
324
|
+
case 'ppt':
|
|
325
|
+
case 'pptx':
|
|
326
|
+
return ['ppt', 'file-ppt'];
|
|
327
|
+
case 'zip':
|
|
328
|
+
case 'rar':
|
|
329
|
+
case '7z':
|
|
330
|
+
case 'tar':
|
|
331
|
+
case 'gz':
|
|
332
|
+
return ['zip', 'file-zip'];
|
|
333
|
+
case 'mp3':
|
|
334
|
+
case 'm4a':
|
|
335
|
+
case 'wma':
|
|
336
|
+
case 'wav':
|
|
337
|
+
case 'flac':
|
|
338
|
+
return ['audio', 'audio'];
|
|
339
|
+
case 'mp4':
|
|
340
|
+
case 'm4v':
|
|
341
|
+
case 'wmv':
|
|
342
|
+
case 'mkv':
|
|
343
|
+
case 'flv':
|
|
344
|
+
case 'mov':
|
|
345
|
+
case 'mpeg':
|
|
346
|
+
case 'avi':
|
|
347
|
+
return ['video', 'youtube'];
|
|
348
|
+
default:
|
|
349
|
+
return ['unknown', 'file'];
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
exports.getFileType = getFileType;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Key } from '../basetype';
|
|
2
|
+
/**
|
|
3
|
+
* 基础参数
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 一个抽象的树结构,使用 children 字段分级别层次
|
|
7
|
+
*/
|
|
8
|
+
export type TreeNodeData = {
|
|
9
|
+
[props: string]: any;
|
|
10
|
+
/**
|
|
11
|
+
* 子节点固定字段 : children
|
|
12
|
+
*/
|
|
13
|
+
children?: TreeNodeData[];
|
|
14
|
+
};
|
|
15
|
+
export type BaseTreeOpts = {
|
|
16
|
+
/**
|
|
17
|
+
* 树取值的字段,默认为 `id`
|
|
18
|
+
*/
|
|
19
|
+
keyField?: string;
|
|
20
|
+
/**
|
|
21
|
+
* 排序字段,默认为空,传入后,以此字段做为排序依据
|
|
22
|
+
*/
|
|
23
|
+
sortField?: string;
|
|
24
|
+
/**
|
|
25
|
+
* 父节点
|
|
26
|
+
*/
|
|
27
|
+
parentField?: string;
|
|
28
|
+
/**
|
|
29
|
+
* 根节点 Code 标识
|
|
30
|
+
*/
|
|
31
|
+
rootCode?: Key;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* 用扁平化方式构造一棵树
|
|
35
|
+
*/
|
|
36
|
+
export declare const buildFlatTree: (props: BaseTreeOpts, data: any[]) => any[];
|
|
37
|
+
export type SearchResult = {
|
|
38
|
+
word: string;
|
|
39
|
+
keyword: string;
|
|
40
|
+
match: Set<string>;
|
|
41
|
+
};
|
|
42
|
+
export declare const search: (tree: TreeNodeData[], word: string, titleField: string) => SearchResult;
|
|
@@ -0,0 +1,69 @@
|
|
|
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.search = exports.buildFlatTree = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const StringUtil_1 = require("../utils/StringUtil");
|
|
9
|
+
const buildTree = (list, root, keyField, parentField, sortField = null) => {
|
|
10
|
+
for (let sub of root) {
|
|
11
|
+
let children = lodash_1.default.filter(list, child => child[parentField] == sub[keyField]);
|
|
12
|
+
if (children.length > 0) {
|
|
13
|
+
if (sortField) {
|
|
14
|
+
sub.children = lodash_1.default.orderBy(children, sortField, 'asc');
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
sub.children = children;
|
|
18
|
+
}
|
|
19
|
+
buildTree(list, sub.children, keyField, parentField, sortField);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* 用扁平化方式构造一棵树
|
|
25
|
+
*/
|
|
26
|
+
const buildFlatTree = (props, data) => {
|
|
27
|
+
if (!lodash_1.default.has(props, 'parentField')) {
|
|
28
|
+
return data;
|
|
29
|
+
}
|
|
30
|
+
const { parentField, sortField, keyField, } = props;
|
|
31
|
+
let root = data.filter(item => item[parentField] == (props.rootCode || '0'));
|
|
32
|
+
if (sortField) {
|
|
33
|
+
root = lodash_1.default.orderBy(root, sortField, 'asc');
|
|
34
|
+
}
|
|
35
|
+
buildTree(data, root, keyField, parentField, sortField);
|
|
36
|
+
return root;
|
|
37
|
+
};
|
|
38
|
+
exports.buildFlatTree = buildFlatTree;
|
|
39
|
+
// 高性能树递归搜索
|
|
40
|
+
const search = (tree, word, titleField) => {
|
|
41
|
+
let keyword = (0, StringUtil_1.trimLower)(word);
|
|
42
|
+
if (keyword == '' || keyword.length == 0)
|
|
43
|
+
return { word: null, keyword: null, match: null };
|
|
44
|
+
let searchPos = [];
|
|
45
|
+
tree.map((node, idx) => searchNode(node, [idx], keyword, searchPos, titleField));
|
|
46
|
+
const match = new Set();
|
|
47
|
+
searchPos.map(pos => {
|
|
48
|
+
let key = pos;
|
|
49
|
+
match.add(key);
|
|
50
|
+
let idx = key.lastIndexOf('-');
|
|
51
|
+
while (idx > 0) {
|
|
52
|
+
key = key.substring(0, idx);
|
|
53
|
+
idx = key.lastIndexOf('-');
|
|
54
|
+
match.add(key);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return { word, keyword, match };
|
|
58
|
+
};
|
|
59
|
+
exports.search = search;
|
|
60
|
+
const searchNode = (node, pos, word, result, titleField) => {
|
|
61
|
+
let name = lodash_1.default.toLower(node[titleField]);
|
|
62
|
+
if (name.indexOf(word) >= 0) {
|
|
63
|
+
result.push(pos.join('-'));
|
|
64
|
+
}
|
|
65
|
+
if (node.children && node.children.length) {
|
|
66
|
+
searchNodes(node.children, pos, word, result, titleField);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const searchNodes = (data, pos, word, result, titleField) => data.map((item, idx) => searchNode(item, [...pos, idx], word, result, titleField));
|
package/utils/VAP.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type VAP = {
|
|
2
|
+
KEYMAP: Map<string, string>;
|
|
3
|
+
system_version: string;
|
|
4
|
+
has: (key: string) => boolean;
|
|
5
|
+
getConfig: (key: string) => string;
|
|
6
|
+
getString: (key: string, def?: string) => string;
|
|
7
|
+
getBoolean: (key: string, def?: boolean) => boolean;
|
|
8
|
+
getInteger: (key: string, def?: number) => number;
|
|
9
|
+
getFloat: (key: string, def?: number) => number;
|
|
10
|
+
};
|
|
11
|
+
declare const _VAP: VAP;
|
|
12
|
+
/**
|
|
13
|
+
* 初始化,仅在入口脚本里面使用
|
|
14
|
+
*/
|
|
15
|
+
export declare const _INIT: (confs: Record<string, string>[]) => void[];
|
|
16
|
+
export default _VAP;
|
package/utils/VAP.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
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._INIT = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const _Support_1 = require("./_Support");
|
|
9
|
+
const StringUtil_1 = require("./StringUtil");
|
|
10
|
+
const defaultVAP = () => {
|
|
11
|
+
return {
|
|
12
|
+
KEYMAP: new Map(),
|
|
13
|
+
system_version: '',
|
|
14
|
+
has: (key) => _VAP.KEYMAP.has(key),
|
|
15
|
+
getConfig: (key) => {
|
|
16
|
+
return _VAP.KEYMAP.get(key);
|
|
17
|
+
},
|
|
18
|
+
getString: (key, def) => {
|
|
19
|
+
return (0, StringUtil_1.getString)(_VAP.KEYMAP.get(key), def);
|
|
20
|
+
},
|
|
21
|
+
getBoolean: (key, def) => {
|
|
22
|
+
return (0, StringUtil_1.getBoolean)(_VAP.KEYMAP.get(key), def);
|
|
23
|
+
// if (!_VAP.KEYMAP.has(key)) return def || false;
|
|
24
|
+
// let txt = _.toLower(_.trim(_VAP.KEYMAP.get(key)));
|
|
25
|
+
// if (TRUE_SET.has(txt)) return true;
|
|
26
|
+
// if (FALSE_SET.has(txt)) return false;
|
|
27
|
+
// if (!_.isBoolean(def)) return false; // 默认返回 false
|
|
28
|
+
// return def;
|
|
29
|
+
},
|
|
30
|
+
getInteger: (key, def) => {
|
|
31
|
+
return (0, StringUtil_1.getInteger)(_VAP.KEYMAP.get(key), def);
|
|
32
|
+
// let defReturn = def != undefined ? def : 0;
|
|
33
|
+
// if (!_VAP.KEYMAP.has(key)) {
|
|
34
|
+
// return defReturn;
|
|
35
|
+
// }
|
|
36
|
+
// let txt = _VAP.KEYMAP.get(key);
|
|
37
|
+
// try {
|
|
38
|
+
// let val = parseInt(txt);
|
|
39
|
+
// if (val) {
|
|
40
|
+
// return val
|
|
41
|
+
// }
|
|
42
|
+
// } catch {
|
|
43
|
+
// return defReturn;
|
|
44
|
+
// }
|
|
45
|
+
},
|
|
46
|
+
getFloat: (key, def) => {
|
|
47
|
+
return (0, StringUtil_1.getFloat)(_VAP.KEYMAP.get(key), def);
|
|
48
|
+
// let defReturn = def != undefined ? def : 0;
|
|
49
|
+
// if (!_VAP.KEYMAP.has(key)) {
|
|
50
|
+
// return defReturn;
|
|
51
|
+
// }
|
|
52
|
+
// let txt = _VAP.KEYMAP.get(key);
|
|
53
|
+
// try {
|
|
54
|
+
// let val = parseFloat(txt);
|
|
55
|
+
// if (val) {
|
|
56
|
+
// return val
|
|
57
|
+
// }
|
|
58
|
+
// } catch {
|
|
59
|
+
// return defReturn;
|
|
60
|
+
// }
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
// const _V_SYSTEM = globalDefault<Map<string, string>>('_V_SYSTEM', new Map<string, string>());
|
|
65
|
+
const _VAP = (0, _Support_1.globalDefault)('_VAP', defaultVAP());
|
|
66
|
+
/**
|
|
67
|
+
* 初始化,仅在入口脚本里面使用
|
|
68
|
+
*/
|
|
69
|
+
const _INIT = (confs) => (confs || []).map(item => {
|
|
70
|
+
let value = lodash_1.default.trim(item.confValue);
|
|
71
|
+
if (value)
|
|
72
|
+
_VAP.KEYMAP.set(item.confId, value);
|
|
73
|
+
if (item.confId == 'system_version') {
|
|
74
|
+
_VAP.system_version = value;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
exports._INIT = _INIT;
|
|
78
|
+
exports.default = _VAP;
|
package/utils/XHR.d.ts
ADDED
package/utils/XHR.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
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.POSTSYNC = exports.GETSYNC = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const _AjaxUtil_1 = require("./_AjaxUtil");
|
|
9
|
+
const FETCH = (method, url, param) => {
|
|
10
|
+
const xhr = new XMLHttpRequest();
|
|
11
|
+
let result = {};
|
|
12
|
+
xhr.onreadystatechange = () => {
|
|
13
|
+
if (xhr.readyState == 4) {
|
|
14
|
+
if (xhr.status == 200) {
|
|
15
|
+
result = JSON.parse(xhr.responseText);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
xhr.open(method, url, false);
|
|
20
|
+
xhr.setRequestHeader('Content-Type', 'application/json');
|
|
21
|
+
if (method == 'GET') {
|
|
22
|
+
xhr.send();
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
xhr.send(JSON.stringify(param));
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
const _FETCH = (method, url, param) => {
|
|
30
|
+
let [_url, _method, _headers, _data] = (0, _AjaxUtil_1.AOP_BEFORE)(url, method, {}, param);
|
|
31
|
+
return FETCH(_method == 'GET' ? 'GET' : 'POST', _url, _data);
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* 不推荐使用同步方法,
|
|
35
|
+
*/
|
|
36
|
+
const GETSYNC = (url) => {
|
|
37
|
+
if (_AjaxUtil_1.CACHE_URL.has(url) && sessionStorage.getItem(url)) {
|
|
38
|
+
return JSON.parse(sessionStorage.getItem(url));
|
|
39
|
+
}
|
|
40
|
+
const resp = _FETCH('GET', url, null);
|
|
41
|
+
if (_AjaxUtil_1.CACHE_URL.has(url)) {
|
|
42
|
+
if (lodash_1.default.has(resp, 'code') && resp.code == '0') {
|
|
43
|
+
sessionStorage.setItem(url, JSON.stringify(resp));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return resp;
|
|
47
|
+
};
|
|
48
|
+
exports.GETSYNC = GETSYNC;
|
|
49
|
+
/**
|
|
50
|
+
* 不推荐使用同步方法
|
|
51
|
+
*/
|
|
52
|
+
const POSTSYNC = (url, param) => _FETCH('POST', url, param);
|
|
53
|
+
exports.POSTSYNC = POSTSYNC;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CONFIG } from './Global';
|
|
2
|
+
export declare const CACHE_URL: Set<string>;
|
|
3
|
+
export declare const SESSION: (...urls: string[]) => Set<string>[];
|
|
4
|
+
export declare const CLEAR: (...urls: string[]) => void[];
|
|
5
|
+
export interface Result {
|
|
6
|
+
code: string;
|
|
7
|
+
message: string;
|
|
8
|
+
[props: string]: any;
|
|
9
|
+
}
|
|
10
|
+
export declare const filterNull: (param: any) => any;
|
|
11
|
+
export declare const AOP_BEFORE: typeof CONFIG.AJAX.beforeSend;
|
|
@@ -0,0 +1,45 @@
|
|
|
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.AOP_BEFORE = exports.filterNull = exports.CLEAR = exports.SESSION = exports.CACHE_URL = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const _Support_1 = require("./_Support");
|
|
9
|
+
const Global_1 = require("./Global");
|
|
10
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language
|
|
11
|
+
// const {
|
|
12
|
+
// APP:{LANG},
|
|
13
|
+
// AJAX:{
|
|
14
|
+
// timeout, beforeSend, beforeReceive
|
|
15
|
+
// }
|
|
16
|
+
// } = CONFIG;
|
|
17
|
+
exports.CACHE_URL = (0, _Support_1.globalDefault)('_INNER_CACHE', new Set());
|
|
18
|
+
const SESSION = (...urls) => urls.map(url => exports.CACHE_URL.add(url));
|
|
19
|
+
exports.SESSION = SESSION;
|
|
20
|
+
const CLEAR = (...urls) => urls.map(url => sessionStorage.removeItem(url));
|
|
21
|
+
exports.CLEAR = CLEAR;
|
|
22
|
+
const sessionStorage = window.sessionStorage;
|
|
23
|
+
//过滤空参数
|
|
24
|
+
const filterNull = (param) => {
|
|
25
|
+
if (!lodash_1.default.isObject(param))
|
|
26
|
+
return param;
|
|
27
|
+
let result = {};
|
|
28
|
+
lodash_1.default.keys(param).map(key => {
|
|
29
|
+
if (param[key] === null || param[key] === undefined || param[key] === '')
|
|
30
|
+
return;
|
|
31
|
+
if (lodash_1.default.isString(param[key]) && lodash_1.default.trim(param[key]) == '')
|
|
32
|
+
return;
|
|
33
|
+
result[key] = param[key];
|
|
34
|
+
});
|
|
35
|
+
return param;
|
|
36
|
+
};
|
|
37
|
+
exports.filterNull = filterNull;
|
|
38
|
+
const AOP_BEFORE = (url, method, headers, query) => {
|
|
39
|
+
let data = method == 'POST' ? (0, exports.filterNull)(query) : query;
|
|
40
|
+
if (lodash_1.default.isFunction(Global_1.CONFIG.AJAX.beforeSend)) {
|
|
41
|
+
return Global_1.CONFIG.AJAX.beforeSend(url, method, headers || {}, data);
|
|
42
|
+
}
|
|
43
|
+
return [url, method, headers, data];
|
|
44
|
+
};
|
|
45
|
+
exports.AOP_BEFORE = AOP_BEFORE;
|