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,87 @@
|
|
|
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.getOptions = exports.currentApp = exports.hasRole = exports.IpToInt = exports.stopEvent = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const StringUtil_1 = require("./StringUtil");
|
|
9
|
+
const _Support_1 = require("./_Support");
|
|
10
|
+
const i18n_1 = require("./i18n");
|
|
11
|
+
const Global_1 = require("./Global");
|
|
12
|
+
/**
|
|
13
|
+
* 阻止事件简单封装
|
|
14
|
+
*/
|
|
15
|
+
const stopEvent = (evt, callback) => {
|
|
16
|
+
if (lodash_1.default.isFunction(evt === null || evt === void 0 ? void 0 : evt.preventDefault)) {
|
|
17
|
+
evt.preventDefault();
|
|
18
|
+
evt.stopPropagation();
|
|
19
|
+
}
|
|
20
|
+
if (lodash_1.default.isFunction(callback)) {
|
|
21
|
+
callback.call(null);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.stopEvent = stopEvent;
|
|
25
|
+
/**
|
|
26
|
+
* 将一个ip4地址转换成数字
|
|
27
|
+
*/
|
|
28
|
+
const IpToInt = (ip) => {
|
|
29
|
+
let ipNum = 0;
|
|
30
|
+
if (!(0, StringUtil_1.isIP)(ip, '4'))
|
|
31
|
+
return ipNum;
|
|
32
|
+
return ip.split('.').reduce((ipInt, octet) => (ipInt << 8) + parseInt(octet, 10), 0) >>> 0;
|
|
33
|
+
};
|
|
34
|
+
exports.IpToInt = IpToInt;
|
|
35
|
+
/**
|
|
36
|
+
* 判断是否有权限
|
|
37
|
+
*/
|
|
38
|
+
const hasRole = (roleCode) => Global_1.CONFIG.PROMISSION.ROLE.has(lodash_1.default.trim(roleCode).toLowerCase());
|
|
39
|
+
exports.hasRole = hasRole;
|
|
40
|
+
// export const hasRole = (roleCode: string): boolean => true; // 测试中,总返回有权限
|
|
41
|
+
const GLOBAL_APPS = new Map();
|
|
42
|
+
/**
|
|
43
|
+
* 获取当前 APP 名称
|
|
44
|
+
*/
|
|
45
|
+
const currentApp = (root) => {
|
|
46
|
+
let pathname = root ? root : location.pathname;
|
|
47
|
+
if (GLOBAL_APPS.has(pathname))
|
|
48
|
+
return GLOBAL_APPS.get(pathname);
|
|
49
|
+
let path = pathname;
|
|
50
|
+
if (lodash_1.default.startsWith(path, _Support_1.APP_ROOT))
|
|
51
|
+
path = path.substring(_Support_1.APP_ROOT.length);
|
|
52
|
+
if (lodash_1.default.endsWith(path, '/'))
|
|
53
|
+
path = path.substring(0, path.length - 1);
|
|
54
|
+
if (lodash_1.default.startsWith(path, '/'))
|
|
55
|
+
path = path.substring(1);
|
|
56
|
+
let appName = 'app-' + path.split('/').join('-');
|
|
57
|
+
GLOBAL_APPS.set(pathname, appName);
|
|
58
|
+
return appName;
|
|
59
|
+
};
|
|
60
|
+
exports.currentApp = currentApp;
|
|
61
|
+
/**
|
|
62
|
+
* 通过一组 option 获取到一组 option 用于 select/checkbox/radio/treeselect 等选项
|
|
63
|
+
* 通过 getOptions 方法可以:
|
|
64
|
+
* 1. 过滤掉 没有roleCode的项目
|
|
65
|
+
* 2. 将label 转换为 国际化后的 label
|
|
66
|
+
*/
|
|
67
|
+
const getOptions = (items) => {
|
|
68
|
+
let options = [];
|
|
69
|
+
items.map(item => {
|
|
70
|
+
if (item.roleCode) {
|
|
71
|
+
if (!(0, exports.hasRole)(item.roleCode)) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
let label = item.label;
|
|
76
|
+
if (item.ik && (0, i18n_1.hasKey)(item.ik)) {
|
|
77
|
+
label = (0, i18n_1.txt)(item.ik);
|
|
78
|
+
}
|
|
79
|
+
let node = Object.assign(Object.assign({}, item), { label });
|
|
80
|
+
if (lodash_1.default.isArray(item.children) && item.children.length) {
|
|
81
|
+
node.children = (0, exports.getOptions)(item.children);
|
|
82
|
+
}
|
|
83
|
+
options.push(node);
|
|
84
|
+
});
|
|
85
|
+
return items;
|
|
86
|
+
};
|
|
87
|
+
exports.getOptions = getOptions;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ApiRenderOptions, Render, OptionConvertConfig } from './_define';
|
|
2
|
+
export interface ApiGetRender extends Render {
|
|
3
|
+
/**
|
|
4
|
+
* 将数据转出为 option 用于 select / checkbox / vap组件中的 options 等。
|
|
5
|
+
*/
|
|
6
|
+
useOption: (config?: OptionConvertConfig) => {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string | number;
|
|
9
|
+
}[];
|
|
10
|
+
/**
|
|
11
|
+
* 刷新缓存并更新页面展示
|
|
12
|
+
*/
|
|
13
|
+
reflush: () => void;
|
|
14
|
+
}
|
|
15
|
+
type ApiGetRenderOptions = ApiRenderOptions & {
|
|
16
|
+
cache?: false;
|
|
17
|
+
};
|
|
18
|
+
export declare const loadApi: (option: ApiGetRenderOptions) => Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* 从一个 GET API 中取出对应的值,并渲染到页面上
|
|
21
|
+
*/
|
|
22
|
+
export declare const ApiGetRender: (options: ApiGetRenderOptions) => ApiGetRender;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,192 @@
|
|
|
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.ApiGetRender = exports.loadApi = void 0;
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
41
|
+
const index_1 = require("../index");
|
|
42
|
+
const XHR_1 = require("../XHR");
|
|
43
|
+
const hooks_1 = require("../../hooks");
|
|
44
|
+
const Const_1 = require("../../components/_setup/Const");
|
|
45
|
+
const _define_1 = require("./_define");
|
|
46
|
+
const Const_2 = require("../Const");
|
|
47
|
+
const API_CACHES = new Map();
|
|
48
|
+
const loadApi = (option) => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
if (option.cache !== false)
|
|
50
|
+
index_1.Ajax.SESSION(option.api);
|
|
51
|
+
const KEY = option.api;
|
|
52
|
+
if (!API_CACHES.has(KEY)) {
|
|
53
|
+
API_CACHES.set(KEY, {
|
|
54
|
+
fetcher: index_1.Ajax.GET(option.api),
|
|
55
|
+
loaded: false,
|
|
56
|
+
map: new Map()
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const cache = API_CACHES.get(KEY);
|
|
60
|
+
if (cache.loaded)
|
|
61
|
+
return false;
|
|
62
|
+
const result = yield cache.fetcher;
|
|
63
|
+
if (!cache.loaded) {
|
|
64
|
+
let arr = (0, _define_1.getList)(result);
|
|
65
|
+
arr.map(item => cache.map.set(item[option.valueFiled] + '', item[option.nameField]));
|
|
66
|
+
cache.loaded = true;
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
});
|
|
70
|
+
exports.loadApi = loadApi;
|
|
71
|
+
const _ApiGetRender = (props) => {
|
|
72
|
+
const update = (0, hooks_1.useUpdate)();
|
|
73
|
+
(0, react_1.useEffect)(() => {
|
|
74
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
+
const needUpdate = yield (0, exports.loadApi)(props);
|
|
76
|
+
if (needUpdate)
|
|
77
|
+
update();
|
|
78
|
+
}))();
|
|
79
|
+
const KEY = `_API_GET_EVENT_` + props.api.split('/').join('_');
|
|
80
|
+
index_1.EventUtil.on(KEY, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
|
+
yield (0, exports.loadApi)(props);
|
|
82
|
+
update();
|
|
83
|
+
}));
|
|
84
|
+
return () => index_1.EventUtil.off(KEY);
|
|
85
|
+
}, []);
|
|
86
|
+
const cache = API_CACHES.get(props.api);
|
|
87
|
+
if (props.value === null || props.value === '' || cache == null || cache.map == null || cache.map.size == 0) {
|
|
88
|
+
return props.default || Const_2.NONE;
|
|
89
|
+
}
|
|
90
|
+
let key = props.value + '';
|
|
91
|
+
if (!cache.map.has(key))
|
|
92
|
+
return props.default || Const_2.NONE;
|
|
93
|
+
const label = cache.map.get(key);
|
|
94
|
+
if (props.render)
|
|
95
|
+
return props.render({ label, value: props.value });
|
|
96
|
+
return (0, _define_1.getValue)(label, props);
|
|
97
|
+
// if (props.render) return props.render({ label: result, value: cacheKey });
|
|
98
|
+
// if (_.isNumber(props.value)) {
|
|
99
|
+
// return cache.map.has(props.value + '') ? getValue(cache.map.get(props.value + ''), props) : (props.default || NONE)
|
|
100
|
+
// }
|
|
101
|
+
// const names = [];
|
|
102
|
+
// props.value.split(',').map(_.trim).map(key => {
|
|
103
|
+
// let val = cache.map.get(key);
|
|
104
|
+
// if (val) names.push(val);
|
|
105
|
+
// });
|
|
106
|
+
// if (names.length == 0) return (props.default as any || NONE);
|
|
107
|
+
// return getValue(names.join(', '), props)
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* 从一个 GET API 中取出对应的值,并渲染到页面上
|
|
111
|
+
*/
|
|
112
|
+
const ApiGetRender = (options) => {
|
|
113
|
+
const fn = (txt) => react_1.default.createElement(_ApiGetRender, Object.assign({ key: options.api + txt }, options, { value: txt }));
|
|
114
|
+
fn.useOption = (config) => {
|
|
115
|
+
const [state, setState] = (0, react_1.useState)([]);
|
|
116
|
+
(0, react_1.useEffect)(() => {
|
|
117
|
+
const fetchOptions = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
118
|
+
yield (0, exports.loadApi)(options);
|
|
119
|
+
const cache = API_CACHES.get(options.api);
|
|
120
|
+
const result = yield cache.fetcher;
|
|
121
|
+
const apiOptions = [];
|
|
122
|
+
let format = val => val;
|
|
123
|
+
if (config) {
|
|
124
|
+
if (config.shift) {
|
|
125
|
+
if (config.shift === true) {
|
|
126
|
+
apiOptions.push({ label: index_1.i18n.txt(Const_1.V.TXT_ALL), value: '' });
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
apiOptions.push(Object.assign({}, config.shift));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (config.valueFormat) {
|
|
133
|
+
switch (config.valueFormat) {
|
|
134
|
+
case 'string':
|
|
135
|
+
format = val => val + '';
|
|
136
|
+
break;
|
|
137
|
+
case 'number':
|
|
138
|
+
format = val => {
|
|
139
|
+
if (lodash_1.default.isNumber(val))
|
|
140
|
+
return val;
|
|
141
|
+
try {
|
|
142
|
+
return parseInt(val);
|
|
143
|
+
}
|
|
144
|
+
catch (_a) {
|
|
145
|
+
return val;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const arr = (0, _define_1.getList)(result);
|
|
152
|
+
arr.map(item => {
|
|
153
|
+
apiOptions.push({ label: item[options.nameField], value: format(item[options.valueFiled]) });
|
|
154
|
+
});
|
|
155
|
+
setState(apiOptions);
|
|
156
|
+
});
|
|
157
|
+
const KEY = `_API_GET_EVENT_` + options.api.split('/').join('_');
|
|
158
|
+
index_1.EventUtil.on(KEY, fetchOptions);
|
|
159
|
+
fetchOptions();
|
|
160
|
+
return () => index_1.EventUtil.off(KEY);
|
|
161
|
+
}, []);
|
|
162
|
+
return state;
|
|
163
|
+
};
|
|
164
|
+
fn.getText = (val, def) => {
|
|
165
|
+
if (API_CACHES.has(options.api) && API_CACHES.get(options.api).loaded) {
|
|
166
|
+
return API_CACHES.get(options.api).map.get(val) || (def || val);
|
|
167
|
+
}
|
|
168
|
+
const resp = (0, XHR_1.GETSYNC)(options.api);
|
|
169
|
+
const map = new Map();
|
|
170
|
+
const arr = (0, _define_1.getList)(resp);
|
|
171
|
+
arr.map(item => map.set(item[options.valueFiled] + '', item[options.nameField]));
|
|
172
|
+
API_CACHES.set(options.api, {
|
|
173
|
+
fetcher: index_1.Ajax.GET(options.api),
|
|
174
|
+
loaded: true,
|
|
175
|
+
map,
|
|
176
|
+
});
|
|
177
|
+
return map.get(val) || (def || val);
|
|
178
|
+
};
|
|
179
|
+
fn.reflush = () => {
|
|
180
|
+
index_1.Ajax.CLEAR(options.api);
|
|
181
|
+
API_CACHES.set(options.api, {
|
|
182
|
+
fetcher: index_1.Ajax.GET(options.api),
|
|
183
|
+
loaded: false,
|
|
184
|
+
map: new Map()
|
|
185
|
+
});
|
|
186
|
+
const KEY = `_API_GET_EVENT_` + options.api.split('/').join('_');
|
|
187
|
+
index_1.EventUtil.call(KEY);
|
|
188
|
+
};
|
|
189
|
+
return fn;
|
|
190
|
+
};
|
|
191
|
+
exports.ApiGetRender = ApiGetRender;
|
|
192
|
+
// export const roleRender = ApiGetRender({ api: GLOBAL.CONFIG.ADMIN.ROLE, nameField: 'name', valueFiled: 'id', });
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ApiRenderOptions, Render } from './_define';
|
|
2
|
+
import type { PlainObject, BaseOption } from '../../basetype';
|
|
3
|
+
export interface ApiPostRender extends Render {
|
|
4
|
+
/**
|
|
5
|
+
* ApiPostRender 可以用于自动联想
|
|
6
|
+
*/
|
|
7
|
+
autocomplate: (txt: string) => Promise<BaseOption[]>;
|
|
8
|
+
/**
|
|
9
|
+
* clear 删除全部 or 指定key 缓存
|
|
10
|
+
*/
|
|
11
|
+
clear: (key?: string | number) => void;
|
|
12
|
+
}
|
|
13
|
+
type ApiPostRenderOptions = ApiRenderOptions & {
|
|
14
|
+
param?: PlainObject;
|
|
15
|
+
};
|
|
16
|
+
export declare const ApiPostRender: (options: ApiPostRenderOptions) => ApiPostRender;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ApiPostRender = void 0;
|
|
16
|
+
const react_1 = __importDefault(require("react"));
|
|
17
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
18
|
+
const index_1 = require("../index");
|
|
19
|
+
const XHR_1 = require("../XHR");
|
|
20
|
+
const hooks_1 = require("../../hooks");
|
|
21
|
+
const _define_1 = require("./_define");
|
|
22
|
+
const Const_1 = require("../Const");
|
|
23
|
+
const SESSION_KEY = '__API_KV_';
|
|
24
|
+
const getInCache = (SESSION, key) => {
|
|
25
|
+
var cache = index_1.CacheUtil.getData(SESSION);
|
|
26
|
+
const cacheKey = key + '';
|
|
27
|
+
if (!lodash_1.default.has(cache, cacheKey)) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
let val = lodash_1.default.get(cache, cacheKey);
|
|
31
|
+
if (val === true) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return val;
|
|
35
|
+
};
|
|
36
|
+
const getLabel = (props, resp, key) => {
|
|
37
|
+
const SESSION = SESSION_KEY + props.api;
|
|
38
|
+
var cache = index_1.CacheUtil.getData(SESSION);
|
|
39
|
+
const cacheKey = key + '';
|
|
40
|
+
if (SESSION == null) {
|
|
41
|
+
index_1.CacheUtil.set(SESSION, {});
|
|
42
|
+
cache = index_1.CacheUtil.getData(SESSION);
|
|
43
|
+
}
|
|
44
|
+
if (resp.code != '0') {
|
|
45
|
+
cache[cacheKey] = false;
|
|
46
|
+
index_1.CacheUtil.set(SESSION, cache);
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
;
|
|
50
|
+
var result = false;
|
|
51
|
+
const arr = (0, _define_1.getList)(resp);
|
|
52
|
+
if (arr.length > 0)
|
|
53
|
+
result = resp.list[0][props.nameField] + '';
|
|
54
|
+
cache[cacheKey] = result;
|
|
55
|
+
index_1.CacheUtil.set(SESSION, cache);
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* post 说明
|
|
60
|
+
* 无 API 缓存,API缓存无KEY 请求
|
|
61
|
+
* API 缓存有 KEY 但 KEY = TRUE 正在请求中
|
|
62
|
+
* API 缓存有 KEY 但 KEY = FALSE 确定无值
|
|
63
|
+
* API 缓存有值 = 值
|
|
64
|
+
*/
|
|
65
|
+
const _ApiPostRender = (props) => {
|
|
66
|
+
const update = (0, hooks_1.useUpdate)();
|
|
67
|
+
const KEY = SESSION_KEY + props.api;
|
|
68
|
+
const cacheKey = props.value + '';
|
|
69
|
+
(0, hooks_1.useEffectFunction)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
70
|
+
if (cacheKey == '')
|
|
71
|
+
return;
|
|
72
|
+
var cache = index_1.CacheUtil.getData(KEY);
|
|
73
|
+
// 存在
|
|
74
|
+
if (lodash_1.default.has(cache, cacheKey)) {
|
|
75
|
+
let txt = lodash_1.default.get(cache, cacheKey);
|
|
76
|
+
if (txt !== true)
|
|
77
|
+
return;
|
|
78
|
+
// 正在请求时,等待一下 最长20秒
|
|
79
|
+
let i = 0;
|
|
80
|
+
while (txt === true && i < 200) {
|
|
81
|
+
i++;
|
|
82
|
+
yield index_1.Ajax.WAIT(lodash_1.default.random(50, 150));
|
|
83
|
+
cache = index_1.CacheUtil.getData(KEY);
|
|
84
|
+
txt = lodash_1.default.get(cache, cacheKey);
|
|
85
|
+
}
|
|
86
|
+
if (txt !== true) {
|
|
87
|
+
update();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
;
|
|
93
|
+
cache = index_1.CacheUtil.getData(KEY);
|
|
94
|
+
// 不存在
|
|
95
|
+
cache[cacheKey] = true;
|
|
96
|
+
index_1.CacheUtil.set(KEY, cache);
|
|
97
|
+
update();
|
|
98
|
+
const resp = yield index_1.Ajax.POST(props.api, Object.assign(Object.assign({}, props.param), { [props.valueFiled]: props.value }), { process: false });
|
|
99
|
+
const result = getLabel(props, resp, cacheKey);
|
|
100
|
+
cache = index_1.CacheUtil.getData(KEY);
|
|
101
|
+
cache[cacheKey] = result;
|
|
102
|
+
index_1.CacheUtil.set(KEY, cache);
|
|
103
|
+
update();
|
|
104
|
+
}));
|
|
105
|
+
const CACHE = index_1.CacheUtil.getData(KEY);
|
|
106
|
+
if (props.value == null || CACHE == null || !lodash_1.default.has(CACHE, cacheKey) || CACHE[cacheKey] === true)
|
|
107
|
+
return Const_1.NONE;
|
|
108
|
+
const result = CACHE[cacheKey];
|
|
109
|
+
if (lodash_1.default.isFunction(props.render)) {
|
|
110
|
+
if (result === false) {
|
|
111
|
+
return props.render({ label: null, value: cacheKey });
|
|
112
|
+
}
|
|
113
|
+
return props.render({ label: result, value: cacheKey });
|
|
114
|
+
}
|
|
115
|
+
if (result === false)
|
|
116
|
+
return props.default || props.value;
|
|
117
|
+
return (0, _define_1.getValue)(result, props);
|
|
118
|
+
};
|
|
119
|
+
const ApiPostRender = (options) => {
|
|
120
|
+
const KEY = SESSION_KEY + options.api;
|
|
121
|
+
if (index_1.CacheUtil.getData(KEY) === null) {
|
|
122
|
+
index_1.CacheUtil.set(KEY, {});
|
|
123
|
+
}
|
|
124
|
+
let cache = index_1.CacheUtil.getData(KEY);
|
|
125
|
+
lodash_1.default.keys(cache).map(key => {
|
|
126
|
+
if (cache[key] === true) {
|
|
127
|
+
lodash_1.default.unset(cache, key);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
index_1.CacheUtil.set(KEY, cache);
|
|
131
|
+
const fn = (txt) => react_1.default.createElement(_ApiPostRender, Object.assign({ key: KEY + txt }, options, { value: txt }));
|
|
132
|
+
fn.autocomplate = (txt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
133
|
+
return [];
|
|
134
|
+
});
|
|
135
|
+
fn.clear = (key) => {
|
|
136
|
+
if (key === undefined) {
|
|
137
|
+
index_1.CacheUtil.set(KEY, null);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
var cache = index_1.CacheUtil.getData(KEY);
|
|
141
|
+
if (cache == null)
|
|
142
|
+
return;
|
|
143
|
+
const cacheKey = key + '';
|
|
144
|
+
if (!lodash_1.default.has(cache, cacheKey))
|
|
145
|
+
return;
|
|
146
|
+
lodash_1.default.unset(cache, cacheKey);
|
|
147
|
+
index_1.CacheUtil.set(KEY, cache);
|
|
148
|
+
};
|
|
149
|
+
fn.getText = (key, def) => {
|
|
150
|
+
let result = getInCache(KEY, key);
|
|
151
|
+
if (result === null) {
|
|
152
|
+
const resp = (0, XHR_1.POSTSYNC)(options.api, Object.assign(Object.assign({}, options.param), { [options.valueFiled]: key }));
|
|
153
|
+
result = getLabel(options, resp, key);
|
|
154
|
+
}
|
|
155
|
+
if (result == false)
|
|
156
|
+
return def || '';
|
|
157
|
+
return result;
|
|
158
|
+
};
|
|
159
|
+
return fn;
|
|
160
|
+
};
|
|
161
|
+
exports.ApiPostRender = ApiPostRender;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Render, BaseRenderOptions } from './_define';
|
|
2
|
+
type DateRenderOptions = Omit<BaseRenderOptions, 'len' | 'format'> & {
|
|
3
|
+
sourceFormat?: string;
|
|
4
|
+
targetFormat?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const DateRender: (options?: DateRenderOptions) => Render;
|
|
7
|
+
export declare const dateRender: Render;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
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.dateRender = exports.DateRender = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
9
|
+
const Const_1 = require("../Const");
|
|
10
|
+
const DateRender = (options) => {
|
|
11
|
+
const config = options == undefined ? {} : options;
|
|
12
|
+
const fn = (txt) => {
|
|
13
|
+
if (txt == null)
|
|
14
|
+
return Const_1.NONE || config.default;
|
|
15
|
+
;
|
|
16
|
+
const date = (0, dayjs_1.default)(txt, config.sourceFormat || undefined);
|
|
17
|
+
if (!date.isValid())
|
|
18
|
+
return Const_1.NONE || config.default;
|
|
19
|
+
if (config.className) {
|
|
20
|
+
return react_1.default.createElement("span", { className: config.className }, date.format(config.targetFormat || 'YYYY-MM-DD HH:mm:ss'));
|
|
21
|
+
}
|
|
22
|
+
return date.format(config.targetFormat || 'YYYY-MM-DD HH:mm:ss');
|
|
23
|
+
};
|
|
24
|
+
fn.getText = (txt, def) => {
|
|
25
|
+
if (txt == null)
|
|
26
|
+
return (def || '');
|
|
27
|
+
const date = (0, dayjs_1.default)(txt, config.sourceFormat || undefined);
|
|
28
|
+
if (!date.isValid())
|
|
29
|
+
return txt + '';
|
|
30
|
+
return date.format(config.targetFormat || 'YYYY-MM-DD HH:mm:ss');
|
|
31
|
+
};
|
|
32
|
+
return fn;
|
|
33
|
+
};
|
|
34
|
+
exports.DateRender = DateRender;
|
|
35
|
+
exports.dateRender = (0, exports.DateRender)();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Render, BaseRenderOptions, OptionConvertConfig } from './_define';
|
|
2
|
+
import type { BaseOption, PlainObject } from '../../basetype';
|
|
3
|
+
type DictRenderOptions = Omit<BaseRenderOptions, 'len' | 'format'> & {
|
|
4
|
+
dictType: string;
|
|
5
|
+
};
|
|
6
|
+
type DictInfo = {
|
|
7
|
+
code: string;
|
|
8
|
+
format?: 'tag' | 'color' | 'status' | 'sup' | 'sub' | 'icon' | 'progress' | 'clazz';
|
|
9
|
+
nodes: BaseOption[];
|
|
10
|
+
};
|
|
11
|
+
declare const _V_DICT: {
|
|
12
|
+
DICTS: any[];
|
|
13
|
+
DICT_MAP: Map<string, DictInfo>;
|
|
14
|
+
};
|
|
15
|
+
interface DictRender extends Render {
|
|
16
|
+
/**
|
|
17
|
+
* 将数据转出为 option 用于 select / checkbox / vap组件中的 options 等。
|
|
18
|
+
*/
|
|
19
|
+
options: (config?: OptionConvertConfig) => BaseOption[];
|
|
20
|
+
}
|
|
21
|
+
export declare const DictRender: (options: string | DictRenderOptions) => DictRender;
|
|
22
|
+
export declare const initDict: (dict: PlainObject[]) => void;
|
|
23
|
+
export { _V_DICT as DICT };
|