@gct-paas/core 0.1.4-dev.9 → 0.1.5-dev.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/dist/index.esm.min.js +1 -0
- package/dist/redirect-index-Ck5Ddtcb.js +1 -0
- package/es/constants/core.mjs +5 -4
- package/es/constants/default-date-type/default-date-type.d.ts +70 -0
- package/es/constants/default-date-type/default-date-type.mjs +74 -0
- package/es/constants/editor-register/editor-register.mjs +17 -5
- package/es/constants/expression-type/BuiltOperators.mjs +152 -144
- package/es/constants/expression-type/FunctionKeys.mjs +75 -79
- package/es/constants/expression-type/editor.mjs +10 -3
- package/es/constants/expression-type/function.mjs +602 -613
- package/es/constants/expression-type/index.mjs +111 -113
- package/es/constants/expression-type/modeCfg.mjs +256 -263
- package/es/constants/expression-type/variable.mjs +43 -39
- package/es/constants/form-container-type/form-container-type.mjs +17 -5
- package/es/constants/index.d.ts +7 -1
- package/es/constants/index.mjs +32 -10
- package/es/constants/page-designer/model.d.ts +4 -0
- package/es/constants/page-designer/model.mjs +17 -0
- package/es/constants/page-designer/regex.d.ts +2 -0
- package/es/constants/page-designer/regex.mjs +5 -0
- package/es/create-app-vue.mjs +15 -9
- package/es/enums/app-designer/index.d.ts +19 -0
- package/es/enums/app-designer/index.mjs +131 -63
- package/es/enums/appEnum.mjs +681 -360
- package/es/enums/appStateEnum.mjs +17 -10
- package/es/enums/authActionEnum.mjs +63 -51
- package/es/enums/breakpointEnum.mjs +27 -26
- package/es/enums/cacheEnum.d.ts +0 -1
- package/es/enums/cacheEnum.mjs +22 -22
- package/es/enums/designEnum.d.ts +7 -1
- package/es/enums/designEnum.mjs +110 -68
- package/es/enums/developer-center/integration.mjs +7 -6
- package/es/enums/exceptionEnum.mjs +21 -17
- package/es/enums/expressionEnum.d.ts +2 -2
- package/es/enums/expressionEnum.mjs +81 -74
- package/es/enums/globalEnum.d.ts +15 -0
- package/es/enums/globalEnum.mjs +60 -25
- package/es/enums/httpEnum.mjs +71 -61
- package/es/enums/index.mjs +44 -14
- package/es/enums/menuEnum.mjs +42 -38
- package/es/enums/page-designer/designer.d.ts +1 -8
- package/es/enums/page-designer/designer.mjs +403 -407
- package/es/enums/page-designer/index.d.ts +1 -0
- package/es/enums/page-designer/index.mjs +5 -0
- package/es/enums/page-designer/layout.d.ts +12 -0
- package/es/enums/page-designer/layout.mjs +17 -0
- package/es/enums/page-designer/panel.mjs +341 -213
- package/es/enums/page-designer/toolkit.mjs +13 -12
- package/es/enums/page-designer/widget.d.ts +5 -0
- package/es/enums/page-designer/widget.mjs +426 -334
- package/es/enums/pageEnum.mjs +14 -13
- package/es/enums/plugin-enum.d.ts +8 -4
- package/es/enums/plugin-enum.mjs +27 -7
- package/es/enums/processEnum.mjs +95 -60
- package/es/enums/roleEnum.mjs +7 -6
- package/es/enums/sizeEnum.d.ts +18 -0
- package/es/enums/sizeEnum.mjs +28 -8
- package/es/global/gct/gct.d.ts +240 -4
- package/es/global/gct/gct.mjs +98 -90
- package/es/global/index.mjs +1 -0
- package/es/hooks/index.d.ts +0 -2
- package/es/hooks/index.mjs +4 -0
- package/es/hooks/use-app-inst/use-app-inst.mjs +11 -5
- package/es/hooks/use-modal/use-modal.mjs +16 -10
- package/es/hooks/use-sub-app-utils/use-sub-app-utils.d.ts +8 -12
- package/es/hooks/use-sub-app-utils/use-sub-app-utils.mjs +45 -25
- package/es/hooks/useCopyToClipboard.mjs +50 -50
- package/es/index.d.ts +2 -3
- package/es/index.mjs +129 -132
- package/es/interface/i-dictionary/i-dictionary-item.d.ts +6 -0
- package/es/interface/i-global-register/i-global-register.d.ts +8 -0
- package/es/interface/i-kit-info/i-kit-info.d.ts +20 -0
- package/es/interface/i-pinia-action/i-global-actions.d.ts +4 -6
- package/es/interface/i-pinia-getter/i-global-getters.d.ts +2 -0
- package/es/interface/i-pinia-state/i-global-state.d.ts +12 -12
- package/es/interface/index.d.ts +4 -6
- package/es/interface/model-designer/entity.d.ts +110 -0
- package/es/interface/provider/index.d.ts +0 -2
- package/es/locale/index.d.ts +11 -3
- package/es/locale/index.mjs +75 -57
- package/es/modules/env-manager/env-manager.const.mjs +16 -8
- package/es/modules/env-manager/env-manager.d.ts +2 -0
- package/es/modules/env-manager/env-manager.interface.d.ts +2 -0
- package/es/modules/env-manager/env-manager.interface.mjs +14 -7
- package/es/modules/env-manager/env-manager.mjs +108 -107
- package/es/modules/error-handler/error-handler.const.mjs +11 -16
- package/es/modules/error-handler/error-strategy.mjs +199 -175
- package/es/modules/error-handler/index.mjs +120 -106
- package/es/modules/mqtt/constants/mqtt.const.d.ts +33 -0
- package/es/modules/mqtt/constants/mqtt.const.mjs +24 -0
- package/es/modules/mqtt/enums/mqtt-status.enum.d.ts +20 -0
- package/es/modules/mqtt/enums/mqtt-status.enum.mjs +24 -0
- package/es/modules/mqtt/index.d.ts +5 -0
- package/es/modules/mqtt/index.mjs +4 -0
- package/es/modules/mqtt/interfaces/i-mqtt.d.ts +139 -0
- package/es/modules/mqtt/mqtt-client.d.ts +117 -0
- package/es/modules/mqtt/mqtt-client.mjs +229 -0
- package/es/modules/mqtt/mqtt-manager.d.ts +87 -0
- package/es/modules/mqtt/mqtt-manager.mjs +118 -0
- package/es/modules/platform-config/constants/index.mjs +4 -0
- package/es/modules/platform-config/constants/login.const.mjs +48 -45
- package/es/modules/platform-config/constants/org.const.mjs +57 -52
- package/es/modules/platform-config/constants/theme.const.mjs +11 -4
- package/es/modules/platform-config/constants/watermark.const.mjs +17 -12
- package/es/modules/platform-config/enums/deploy.enum.mjs +13 -6
- package/es/modules/platform-config/enums/login.enum.mjs +29 -15
- package/es/modules/platform-config/enums/platform.enum.d.ts +0 -15
- package/es/modules/platform-config/enums/platform.enum.mjs +17 -26
- package/es/modules/platform-config/index.d.ts +1 -1
- package/es/modules/platform-config/index.mjs +9 -0
- package/es/modules/platform-config/interfaces/index.d.ts +0 -1
- package/es/modules/platform-config/store.d.ts +5 -1
- package/es/modules/platform-config/store.mjs +68 -76
- package/es/modules/platform-config/useBasicSetting.mjs +47 -35
- package/es/modules/platform-config/useDeploySetting.mjs +29 -21
- package/es/modules/platform-config/useLoginSetting.mjs +151 -173
- package/es/modules/platform-config/useOrgSetting.mjs +63 -62
- package/es/modules/platform-config/useProjectSetting.mjs +14 -6
- package/es/modules/platform-config/useSecuritySetting.d.ts +1 -0
- package/es/modules/platform-config/useSecuritySetting.mjs +81 -56
- package/es/modules/platform-config/useThemeSetting.mjs +78 -59
- package/es/modules/platform-config/useWatermarkSetting.mjs +37 -23
- package/es/modules/user-stores/index.mjs +3 -0
- package/es/modules/user-stores/store/permission.store.mjs +27 -36
- package/es/modules/user-stores/store/tenant.store.mjs +20 -22
- package/es/modules/user-stores/store/user.store.d.ts +149 -1
- package/es/modules/user-stores/store/user.store.mjs +97 -101
- package/es/modules/user-stores/types/user.d.ts +1 -0
- package/es/router/index.d.ts +3 -0
- package/es/router/index.mjs +59 -29
- package/es/router/redirect/redirect-index.vue.d.ts +2 -0
- package/es/router/redirect/redirect-index.vue.mjs +5 -0
- package/es/router/redirect/redirect-index.vue_vue_type_script_setup_true_lang.mjs +28 -0
- package/es/setup-app.d.ts +1 -1
- package/es/setup-app.mjs +22 -28
- package/es/state/global-pinia-state/global-pinia-state.d.ts +15 -7
- package/es/state/global-pinia-state/global-pinia-state.mjs +43 -57
- package/es/state/index.d.ts +0 -9
- package/es/state/index.mjs +1 -0
- package/es/store/global-store.mjs +44 -57
- package/es/store/index.d.ts +8 -0
- package/es/store/index.mjs +35 -19
- package/es/store/storage-store.d.ts +9 -0
- package/es/store/storage-store.mjs +10 -0
- package/es/types/index.d.ts +18 -0
- package/es/utils/axios/interceptors.mjs +22 -17
- package/es/utils/cache-adapter/cache-adapter.mjs +61 -56
- package/es/utils/css-loader/css-loader.d.ts +36 -0
- package/es/utils/css-loader/css-loader.mjs +82 -0
- package/es/utils/design/design.d.ts +11 -0
- package/es/utils/design/design.mjs +21 -0
- package/es/utils/deviceFingerprint.mjs +77 -63
- package/es/utils/dictionary/dictionary.mjs +142 -145
- package/es/utils/file/base64Conver.d.ts +9 -0
- package/es/utils/file/base64Conver.mjs +40 -0
- package/es/utils/file/download.d.ts +44 -0
- package/es/utils/file/download.mjs +101 -0
- package/es/utils/file/parser.d.ts +3 -0
- package/es/utils/file/parser.mjs +29 -0
- package/es/utils/i18n/index.mjs +14 -3
- package/es/utils/index.d.ts +14 -4
- package/es/utils/index.mjs +34 -0
- package/es/utils/is-sort-filed/is-sort-filed.d.ts +10 -0
- package/es/utils/is-sort-filed/is-sort-filed.mjs +45 -0
- package/es/utils/kit-pkg-util/kit-pkg-util.d.ts +32 -0
- package/es/utils/kit-pkg-util/kit-pkg-util.mjs +73 -0
- package/es/utils/linked-list/linked-list.mjs +115 -118
- package/es/utils/linked-node/linked-node.mjs +41 -31
- package/es/utils/lowcode/utils.mjs +13 -18
- package/es/utils/lowcode/validate.mjs +20 -26
- package/es/utils/mitt/mitt.mjs +4 -4
- package/es/utils/model-loader/model-loader.mjs +288 -325
- package/es/utils/namespace/namespace.mjs +178 -164
- package/es/utils/openUtil/index.mjs +2 -0
- package/es/utils/openUtil/modal/modal.mjs +72 -79
- package/es/utils/openUtil/overlay-container/overlay-container.mjs +144 -138
- package/es/utils/permission.d.ts +19 -0
- package/es/utils/permission.mjs +34 -0
- package/es/utils/plugin-pkg-util/plugin-pkg-util.d.ts +63 -0
- package/es/utils/plugin-pkg-util/plugin-pkg-util.mjs +119 -0
- package/es/utils/plugin-static-resource/plugin-static-resource.d.ts +2 -27
- package/es/utils/plugin-static-resource/plugin-static-resource.mjs +19 -42
- package/es/utils/style/index.mjs +94 -138
- package/es/utils/tools/tools.d.ts +12 -10
- package/es/utils/tools/tools.mjs +128 -57
- package/es/utils/treeHelper/treeHelper.d.ts +3 -9
- package/es/utils/treeHelper/treeHelper.mjs +205 -233
- package/es/utils/uploader/uploader.d.ts +20 -0
- package/es/utils/uploader/uploader.mjs +86 -0
- package/es/utils/useUUid.d.ts +41 -0
- package/es/utils/useUUid.mjs +85 -0
- package/es/utils/util.mjs +55 -35
- package/es/utils/uuid/uuid.d.ts +2 -0
- package/es/utils/uuid/uuid.mjs +33 -43
- package/es/utils/validate.d.ts +5 -0
- package/es/utils/validate.mjs +21 -0
- package/es/utils/value-helper/value-helper.mjs +113 -98
- package/package.json +18 -27
- package/dist/index.esm.min.mjs +0 -7973
- package/dist/index.min.cjs +0 -386
- package/dist/index.system.min.js +0 -386
- package/es/constants/editor-type/editor-type.d.ts +0 -244
- package/es/constants/editor-type/editor-type.mjs +0 -63
- package/es/controller/edit-form/edit-form.controller.d.ts +0 -28
- package/es/controller/edit-form/edit-form.controller.mjs +0 -47
- package/es/controller/editor/color-editor.controller.d.ts +0 -13
- package/es/controller/editor/color-editor.controller.mjs +0 -6
- package/es/controller/editor/length-unit-editor.controller.d.ts +0 -13
- package/es/controller/editor/length-unit-editor.controller.mjs +0 -6
- package/es/controller/editor-item/editor-item.controller.d.ts +0 -14
- package/es/controller/editor-item/editor-item.controller.mjs +0 -8
- package/es/controller/form/form.controller.d.ts +0 -76
- package/es/controller/form/form.controller.mjs +0 -147
- package/es/controller/form-collapse/form-collapse.controller.d.ts +0 -18
- package/es/controller/form-collapse/form-collapse.controller.mjs +0 -14
- package/es/controller/form-collapse-pane/form-collapse-pane.controller.d.ts +0 -18
- package/es/controller/form-collapse-pane/form-collapse-pane.controller.mjs +0 -14
- package/es/controller/form-edit-item/form-edit-item.controller.d.ts +0 -27
- package/es/controller/form-edit-item/form-edit-item.controller.mjs +0 -74
- package/es/controller/form-group/form-group.controller.d.ts +0 -18
- package/es/controller/form-group/form-group.controller.mjs +0 -14
- package/es/controller/form-item/form-item.controller.d.ts +0 -21
- package/es/controller/form-item/form-item.controller.mjs +0 -43
- package/es/controller/form-item-basic/form-item-basic.controller.d.ts +0 -57
- package/es/controller/form-item-basic/form-item-basic.controller.mjs +0 -49
- package/es/controller/form-item-hidden/form-item-hidden.controller.d.ts +0 -17
- package/es/controller/form-item-hidden/form-item-hidden.controller.mjs +0 -7
- package/es/controller/form-tab/form-tab.controller.d.ts +0 -18
- package/es/controller/form-tab/form-tab.controller.mjs +0 -14
- package/es/controller/form-tab-pane/form-tab-pane.controller.d.ts +0 -18
- package/es/controller/form-tab-pane/form-tab-pane.controller.mjs +0 -14
- package/es/controller/gct-form/gct-form.controller.d.ts +0 -101
- package/es/controller/gct-form/gct-form.controller.mjs +0 -214
- package/es/controller/index.d.ts +0 -15
- package/es/hooks/use-form/use-form.d.ts +0 -10
- package/es/hooks/use-form/use-form.mjs +0 -8
- package/es/hooks/use-gct-form-value/use-gct-form-value.d.ts +0 -22
- package/es/hooks/use-gct-form-value/use-gct-form-value.mjs +0 -89
- package/es/hooks/use-overlay-scrollbars/use-overlay-scrollbars.d.ts +0 -11
- package/es/interface/controller/edit-form/edit-form.controller.d.ts +0 -26
- package/es/interface/controller/editor/i-color-editor.controller.d.ts +0 -11
- package/es/interface/controller/editor/i-length-unit-editor.controller.d.ts +0 -11
- package/es/interface/controller/editor-item/editor-item.controller.d.ts +0 -19
- package/es/interface/controller/form/form.controller.d.ts +0 -121
- package/es/interface/controller/form-collapse/form-collapse.controller.d.ts +0 -23
- package/es/interface/controller/form-collapse-pane/form-collapse-pane.controller.d.ts +0 -23
- package/es/interface/controller/form-edit-item/form-edit-item.controller.d.ts +0 -59
- package/es/interface/controller/form-group/form-group.controller.d.ts +0 -24
- package/es/interface/controller/form-hidden-item/form-hidden-item.controller.d.ts +0 -24
- package/es/interface/controller/form-item/form-item.controller.d.ts +0 -40
- package/es/interface/controller/form-item-basic/form-item-basic.controller.d.ts +0 -51
- package/es/interface/controller/form-tab/form-tab.controller.d.ts +0 -23
- package/es/interface/controller/form-tab-pane/form-tab-pane.controller.d.ts +0 -23
- package/es/interface/controller/index.d.ts +0 -14
- package/es/interface/events/form/i-form.event.d.ts +0 -11
- package/es/interface/events/index.d.ts +0 -1
- package/es/interface/form/i-editor/i-check-switch.d.ts +0 -29
- package/es/interface/form/i-editor/i-checkbox-editor.d.ts +0 -9
- package/es/interface/form/i-editor/i-color-editor.d.ts +0 -13
- package/es/interface/form/i-editor/i-editor-basic.d.ts +0 -87
- package/es/interface/form/i-editor/i-icon-select-editor.d.ts +0 -21
- package/es/interface/form/i-editor/i-info-editor.d.ts +0 -21
- package/es/interface/form/i-editor/i-length-unit-editor.d.ts +0 -13
- package/es/interface/form/i-editor/i-model-field-select-editor.d.ts +0 -18
- package/es/interface/form/i-editor/i-number-editor.d.ts +0 -21
- package/es/interface/form/i-editor/i-picker-editor.d.ts +0 -30
- package/es/interface/form/i-editor/i-radio-editor.d.ts +0 -21
- package/es/interface/form/i-editor/i-select-editor.d.ts +0 -14
- package/es/interface/form/i-editor/i-span-editor.d.ts +0 -30
- package/es/interface/form/i-editor/i-switch-editor.d.ts +0 -14
- package/es/interface/form/i-editor/i-text-editor.d.ts +0 -46
- package/es/interface/form/i-editor/i-textarea-editor.d.ts +0 -25
- package/es/interface/form/i-form/i-edit-form.d.ts +0 -48
- package/es/interface/form/i-form/i-form-collapse-pane.d.ts +0 -30
- package/es/interface/form/i-form/i-form-collapse.d.ts +0 -35
- package/es/interface/form/i-form/i-form-container.d.ts +0 -53
- package/es/interface/form/i-form/i-form-edit-item.d.ts +0 -140
- package/es/interface/form/i-form/i-form-group-container.d.ts +0 -24
- package/es/interface/form/i-form/i-form-group.d.ts +0 -35
- package/es/interface/form/i-form/i-form-hidden-item.d.ts +0 -11
- package/es/interface/form/i-form/i-form-item-basic.d.ts +0 -126
- package/es/interface/form/i-form/i-form-item.d.ts +0 -11
- package/es/interface/form/i-form/i-form-tab-pane.d.ts +0 -23
- package/es/interface/form/i-form/i-form-tab.d.ts +0 -21
- package/es/interface/form/i-form/i-form.d.ts +0 -79
- package/es/interface/form/index.d.ts +0 -29
- package/es/interface/layout/i-flex-layout/i-flex-container.d.ts +0 -75
- package/es/interface/layout/i-flex-layout/i-flex-item.d.ts +0 -51
- package/es/interface/layout/i-grid-layout/i-grid-container.d.ts +0 -29
- package/es/interface/layout/i-grid-layout/i-grid-item-span.d.ts +0 -54
- package/es/interface/layout/i-grid-layout/i-grid-item.d.ts +0 -37
- package/es/interface/layout/i-layout-basis/i-layout-container-basis.d.ts +0 -11
- package/es/interface/layout/index.d.ts +0 -6
- package/es/interface/provider/i-editor-provider/i-editor-provider.d.ts +0 -24
- package/es/interface/provider/i-form-item-provider/i-form-item-provider.d.ts +0 -44
- package/es/interface/state/form/form.state.d.ts +0 -53
- package/es/interface/state/form-collapse/form-collapse.state.d.ts +0 -11
- package/es/interface/state/form-collapse-pane/form-collapse-pane.state.d.ts +0 -11
- package/es/interface/state/form-edit-item/form-edit-item.state.d.ts +0 -38
- package/es/interface/state/form-group/form-group.state.d.ts +0 -21
- package/es/interface/state/form-hidden-item/form-hidden-item.state.d.ts +0 -5
- package/es/interface/state/form-item/form-item.state.d.ts +0 -20
- package/es/interface/state/form-item-basic/form-item-basic.state.d.ts +0 -63
- package/es/interface/state/form-tab/form-tab.state.d.ts +0 -19
- package/es/interface/state/form-tab-pane/form-tab-pane.state.d.ts +0 -11
- package/es/interface/state/index.d.ts +0 -10
- package/es/modules/platform-config/interfaces/global-setting.interface.d.ts +0 -7
- package/es/register/editor-register/editor-register.d.ts +0 -49
- package/es/register/editor-register/editor-register.mjs +0 -57
- package/es/register/form-item-register/form-item-register.d.ts +0 -36
- package/es/register/form-item-register/form-item-register.mjs +0 -42
- package/es/register/index.d.ts +0 -14
- package/es/state/form/form.state.d.ts +0 -24
- package/es/state/form/form.state.mjs +0 -16
- package/es/state/form-collapse/form-collapse.state.d.ts +0 -14
- package/es/state/form-collapse/form-collapse.state.mjs +0 -6
- package/es/state/form-collapse-pane/form-collapse-pane.state.d.ts +0 -14
- package/es/state/form-collapse-pane/form-collapse-pane.state.mjs +0 -6
- package/es/state/form-edit-item/form-edit-item.state.d.ts +0 -17
- package/es/state/form-edit-item/form-edit-item.state.mjs +0 -10
- package/es/state/form-group/form-group.state.d.ts +0 -21
- package/es/state/form-group/form-group.state.mjs +0 -14
- package/es/state/form-item/form-item.state.d.ts +0 -14
- package/es/state/form-item/form-item.state.mjs +0 -6
- package/es/state/form-item-basic/form-item-basic.state.d.ts +0 -17
- package/es/state/form-item-basic/form-item-basic.state.mjs +0 -9
- package/es/state/form-tab/form-tab.state.d.ts +0 -15
- package/es/state/form-tab/form-tab.state.mjs +0 -7
- package/es/state/form-tab-pane/form-tab-pane.state.d.ts +0 -14
- package/es/state/form-tab-pane/form-tab-pane.state.mjs +0 -6
- package/es/utils/props/gct-form-item/gct-form-item.props.d.ts +0 -63
- package/es/utils/props/gct-form-item/gct-form-item.props.mjs +0 -66
- package/es/utils/props/index.d.ts +0 -1
- package/es/utils/width-install/width-install.d.ts +0 -17
- package/es/utils/width-install/width-install.mjs +0 -23
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { notSingleArr } from "../../enums/designEnum.mjs";
|
|
2
|
+
import "../../enums/index.mjs";
|
|
3
|
+
import { intersection } from "lodash-es";
|
|
4
|
+
//#region src/utils/design/design.ts
|
|
5
|
+
/**
|
|
6
|
+
* 是否完全为多选算子
|
|
7
|
+
*
|
|
8
|
+
* @description 只有全部是多选算子时,下拉才可以算是多选
|
|
9
|
+
* @author zhanghanrui
|
|
10
|
+
* @date 2024-09-20 11:09:47
|
|
11
|
+
* @export
|
|
12
|
+
* @param {string[]} arr
|
|
13
|
+
* @return {*} {boolean}
|
|
14
|
+
*/
|
|
15
|
+
function isMultipleOperator(arr) {
|
|
16
|
+
const items = intersection(arr, notSingleArr);
|
|
17
|
+
if (items.length > 0 && items.length === arr.length) return true;
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { isMultipleOperator };
|
|
@@ -1,73 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/utils/deviceFingerprint.ts
|
|
2
|
+
/** 指纹缓存 key */
|
|
3
|
+
var FINGERPRINT_KEY = "FINGERPRINT";
|
|
4
|
+
/** 判断是否浏览器环境 */
|
|
4
5
|
function isBrowserEnv() {
|
|
5
|
-
|
|
6
|
+
return typeof window !== "undefined" && typeof navigator !== "undefined";
|
|
6
7
|
}
|
|
8
|
+
/** 获取客户端平台(浏览器 / 移动系统) */
|
|
7
9
|
function getClientPlatform() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
10
|
+
if (!isBrowserEnv()) return {
|
|
11
|
+
type: "unknown",
|
|
12
|
+
name: "unknown"
|
|
13
|
+
};
|
|
14
|
+
const ua = navigator.userAgent;
|
|
15
|
+
if (/iPad|iPhone|iPod/i.test(ua)) return {
|
|
16
|
+
type: "mobile",
|
|
17
|
+
name: "iOS"
|
|
18
|
+
};
|
|
19
|
+
if (/Android/i.test(ua)) return {
|
|
20
|
+
type: "mobile",
|
|
21
|
+
name: "Android"
|
|
22
|
+
};
|
|
23
|
+
if (/Windows Phone/i.test(ua)) return {
|
|
24
|
+
type: "mobile",
|
|
25
|
+
name: "Windows Phone"
|
|
26
|
+
};
|
|
27
|
+
if (/BlackBerry/i.test(ua)) return {
|
|
28
|
+
type: "mobile",
|
|
29
|
+
name: "BlackBerry"
|
|
30
|
+
};
|
|
31
|
+
if (/Edg/i.test(ua)) return {
|
|
32
|
+
type: "web",
|
|
33
|
+
name: "Edge"
|
|
34
|
+
};
|
|
35
|
+
if (/OPR|Opera/i.test(ua)) return {
|
|
36
|
+
type: "web",
|
|
37
|
+
name: "Opera"
|
|
38
|
+
};
|
|
39
|
+
if (/Firefox/i.test(ua)) return {
|
|
40
|
+
type: "web",
|
|
41
|
+
name: "Firefox"
|
|
42
|
+
};
|
|
43
|
+
if (/Chrome/i.test(ua)) return {
|
|
44
|
+
type: "web",
|
|
45
|
+
name: "Chrome"
|
|
46
|
+
};
|
|
47
|
+
if (/Safari/i.test(ua)) return {
|
|
48
|
+
type: "web",
|
|
49
|
+
name: "Safari"
|
|
50
|
+
};
|
|
51
|
+
return {
|
|
52
|
+
type: "unknown",
|
|
53
|
+
name: "unknown"
|
|
54
|
+
};
|
|
40
55
|
}
|
|
56
|
+
/** 获取浏览器指纹对象 */
|
|
41
57
|
async function getFingerprint() {
|
|
42
|
-
|
|
43
|
-
return agent.get();
|
|
58
|
+
return (await (await import("@fingerprintjs/fingerprintjs")).load()).get();
|
|
44
59
|
}
|
|
60
|
+
/** 获取设备指纹标识(统一入口) */
|
|
45
61
|
async function getDeviceFingerprint() {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
const fingerprint = await getFingerprint();
|
|
58
|
-
const visitorId = fingerprint.visitorId;
|
|
59
|
-
if (isWeb) {
|
|
60
|
-
localStorage.setItem(FINGERPRINT_KEY, visitorId);
|
|
61
|
-
}
|
|
62
|
-
return `${name}/${visitorId}`;
|
|
62
|
+
if (!isBrowserEnv()) return "unknown/unknown";
|
|
63
|
+
const { type, name } = getClientPlatform();
|
|
64
|
+
const isWeb = type === "web";
|
|
65
|
+
if (isWeb) {
|
|
66
|
+
const cached = localStorage.getItem(FINGERPRINT_KEY);
|
|
67
|
+
if (cached) return `${name}/${cached}`;
|
|
68
|
+
}
|
|
69
|
+
const visitorId = (await getFingerprint()).visitorId;
|
|
70
|
+
if (isWeb) localStorage.setItem(FINGERPRINT_KEY, visitorId);
|
|
71
|
+
return `${name}/${visitorId}`;
|
|
63
72
|
}
|
|
73
|
+
/** mobile 端指纹(语义兼容) */
|
|
74
|
+
function getMobileBrowserFingerprint() {
|
|
75
|
+
return getDeviceFingerprint();
|
|
76
|
+
}
|
|
77
|
+
/** 页签唯一标识 */
|
|
64
78
|
function getPageIdentification() {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
79
|
+
let pageTag = sessionStorage.getItem("currentPageTag");
|
|
80
|
+
if (!pageTag) {
|
|
81
|
+
pageTag = Date.now().toString();
|
|
82
|
+
sessionStorage.setItem("currentPageTag", pageTag);
|
|
83
|
+
}
|
|
84
|
+
return pageTag;
|
|
71
85
|
}
|
|
72
|
-
|
|
73
|
-
export {
|
|
86
|
+
//#endregion
|
|
87
|
+
export { getDeviceFingerprint, getMobileBrowserFingerprint, getPageIdentification };
|
|
@@ -1,146 +1,143 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
1
|
+
//#region src/utils/dictionary/dictionary.ts
|
|
2
|
+
/**
|
|
3
|
+
* 数据字典工具类
|
|
4
|
+
*
|
|
5
|
+
* @export
|
|
6
|
+
* @class DictionaryService
|
|
7
|
+
*/
|
|
8
|
+
var DictionaryUtil = class {
|
|
9
|
+
/**
|
|
10
|
+
* 代码表配置
|
|
11
|
+
*
|
|
12
|
+
* @author zhanghanrui
|
|
13
|
+
* @date 2024-03-27 13:03:59
|
|
14
|
+
* @private
|
|
15
|
+
* @type {Map<string, IDictionary>}
|
|
16
|
+
*/
|
|
17
|
+
configs = /* @__PURE__ */ new Map();
|
|
18
|
+
/**
|
|
19
|
+
* 已经加载的代码表缓存
|
|
20
|
+
*
|
|
21
|
+
* @author zhanghanrui
|
|
22
|
+
* @date 2024-03-27 13:03:14
|
|
23
|
+
* @private
|
|
24
|
+
* @type {Map<string, IDictionaryItem[]>}
|
|
25
|
+
*/
|
|
26
|
+
cache = /* @__PURE__ */ new Map();
|
|
27
|
+
/**
|
|
28
|
+
* 获取代码表配置
|
|
29
|
+
*
|
|
30
|
+
* @author zhanghanrui
|
|
31
|
+
* @date 2024-04-02 13:04:32
|
|
32
|
+
* @param {string} tag
|
|
33
|
+
* @return {*} {(IDictionary | undefined)}
|
|
34
|
+
*/
|
|
35
|
+
getConfig(tag) {
|
|
36
|
+
return this.configs.get(tag);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 注册写的代码表配置
|
|
40
|
+
*
|
|
41
|
+
* @author zhanghanrui
|
|
42
|
+
* @date 2024-03-27 13:03:17
|
|
43
|
+
* @param {IDictionary} config
|
|
44
|
+
*/
|
|
45
|
+
register(config) {
|
|
46
|
+
this.configs.set(config.tag, config);
|
|
47
|
+
if (config.items) this.cache.set(config.tag, config.items);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 取消注册代码表
|
|
51
|
+
*
|
|
52
|
+
* @author zhanghanrui
|
|
53
|
+
* @date 2024-03-27 13:03:58
|
|
54
|
+
* @param {string} tag
|
|
55
|
+
*/
|
|
56
|
+
unregister(tag) {
|
|
57
|
+
this.configs.delete(tag);
|
|
58
|
+
this.cache.delete(tag);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* 获取代码表配置
|
|
62
|
+
*
|
|
63
|
+
* @author zhanghanrui
|
|
64
|
+
* @date 2024-03-27 13:03:06
|
|
65
|
+
* @param {string} codeTag
|
|
66
|
+
* @return {*} {IDictionaryItem[]}
|
|
67
|
+
*/
|
|
68
|
+
get(codeTag) {
|
|
69
|
+
return this.cache.get(codeTag) || [];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 动态请求代码表
|
|
73
|
+
*
|
|
74
|
+
* @author zhanghanrui
|
|
75
|
+
* @date 2024-03-27 13:03:14
|
|
76
|
+
* @param {string} codeTag
|
|
77
|
+
* @param {IParams} [params]
|
|
78
|
+
* @return {*} {Promise<IDictionaryItem[]>}
|
|
79
|
+
*/
|
|
80
|
+
async asyncGet(codeTag, params) {
|
|
81
|
+
const config = this.configs.get(codeTag);
|
|
82
|
+
if (!config) return [];
|
|
83
|
+
if (config.mode === "static") return this.getByConfig(config);
|
|
84
|
+
if (config.mode === "async") {
|
|
85
|
+
if (this.cache.has(codeTag)) return this.cache.get(codeTag) || [];
|
|
86
|
+
return this.asyncGetByConfig(config, params);
|
|
87
|
+
}
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 根据配置获取代码表
|
|
92
|
+
*
|
|
93
|
+
* @author zhanghanrui
|
|
94
|
+
* @date 2024-04-02 21:04:25
|
|
95
|
+
* @param {IDictionary} config
|
|
96
|
+
* @return {*} {IDictionaryItem[]}
|
|
97
|
+
*/
|
|
98
|
+
getByConfig(config) {
|
|
99
|
+
return config.items || [];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* 根据配置获取异步代码表
|
|
103
|
+
*
|
|
104
|
+
* @author zhanghanrui
|
|
105
|
+
* @date 2024-04-02 21:04:00
|
|
106
|
+
* @param {IDictionary} config
|
|
107
|
+
* @param {IParams} [params={}]
|
|
108
|
+
* @return {*} {Promise<IDictionaryItem[]>}
|
|
109
|
+
*/
|
|
110
|
+
async asyncGetByConfig(config, params = {}) {
|
|
111
|
+
if (config.fetch) {
|
|
112
|
+
const items = await config.fetch(params || {});
|
|
113
|
+
if (items) {
|
|
114
|
+
const [key, value] = config.keys || ["name", "id"];
|
|
115
|
+
return this.deepFormat(items, key, value);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* 递归格式化代码表
|
|
122
|
+
*
|
|
123
|
+
* @author zhanghanrui
|
|
124
|
+
* @date 2024-04-02 22:04:03
|
|
125
|
+
* @protected
|
|
126
|
+
* @param {IData[]} items
|
|
127
|
+
* @param {string} key
|
|
128
|
+
* @param {string} value
|
|
129
|
+
* @return {*} {IDictionaryItem[]}
|
|
130
|
+
*/
|
|
131
|
+
deepFormat(items, key, value) {
|
|
132
|
+
return items.map((item) => {
|
|
133
|
+
const config = {
|
|
134
|
+
label: item[key],
|
|
135
|
+
value: item[value]
|
|
136
|
+
};
|
|
137
|
+
if (item.children && item.children.length > 0) config.options = this.deepFormat(item.children, key, value);
|
|
138
|
+
return config;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
//#endregion
|
|
146
143
|
export { DictionaryUtil };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/utils/file/base64Conver.ts
|
|
2
|
+
/**
|
|
3
|
+
* @description: base64 to blob
|
|
4
|
+
*/
|
|
5
|
+
function dataURLtoBlob(base64Buf) {
|
|
6
|
+
const arr = base64Buf.split(",");
|
|
7
|
+
const mime = arr[0].match(/:(.*?);/)[1];
|
|
8
|
+
const bstr = window.atob(arr[1]);
|
|
9
|
+
let n = bstr.length;
|
|
10
|
+
const u8arr = new Uint8Array(n);
|
|
11
|
+
while (n > 0) {
|
|
12
|
+
n -= 1;
|
|
13
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
14
|
+
}
|
|
15
|
+
return new Blob([u8arr], { type: mime });
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* img url to base64
|
|
19
|
+
* @param url
|
|
20
|
+
*/
|
|
21
|
+
function urlToBase64(url, mineType) {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
let canvas = document.createElement("CANVAS");
|
|
24
|
+
const ctx = canvas.getContext("2d");
|
|
25
|
+
const img = new Image();
|
|
26
|
+
img.crossOrigin = "";
|
|
27
|
+
img.onload = function() {
|
|
28
|
+
if (!canvas || !ctx) return reject();
|
|
29
|
+
canvas.height = img.height;
|
|
30
|
+
canvas.width = img.width;
|
|
31
|
+
ctx.drawImage(img, 0, 0);
|
|
32
|
+
const dataURL = canvas.toDataURL(mineType || "image/png");
|
|
33
|
+
canvas = null;
|
|
34
|
+
resolve(dataURL);
|
|
35
|
+
};
|
|
36
|
+
img.src = url;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { dataURLtoBlob, urlToBase64 };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Download online pictures
|
|
3
|
+
* @param url
|
|
4
|
+
* @param filename
|
|
5
|
+
* @param mime
|
|
6
|
+
* @param bom
|
|
7
|
+
*/
|
|
8
|
+
export declare function downloadByOnlineUrl(url: string, filename: string, mime?: string, bom?: BlobPart): void;
|
|
9
|
+
/**
|
|
10
|
+
* Download pictures based on base64
|
|
11
|
+
* @param buf
|
|
12
|
+
* @param filename
|
|
13
|
+
* @param mime
|
|
14
|
+
* @param bom
|
|
15
|
+
*/
|
|
16
|
+
export declare function downloadByBase64(buf: string, filename: string, mime?: string, bom?: BlobPart): void;
|
|
17
|
+
export declare function uploaderFiles({ multiple, accept }?: {
|
|
18
|
+
multiple?: boolean | undefined;
|
|
19
|
+
accept?: string | undefined;
|
|
20
|
+
}): Promise<File[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Download according to the background interface file stream
|
|
23
|
+
* @param {*} data
|
|
24
|
+
* @param {*} opts
|
|
25
|
+
* @param {*} opts.filename 文件名
|
|
26
|
+
* @param {*} opts.timestamp 是否需要在文件名后面自动加上时间戳
|
|
27
|
+
* @param {*} opts.mime
|
|
28
|
+
* @param {*} opts.bom
|
|
29
|
+
*/
|
|
30
|
+
export declare function downloadByData(data: BlobPart, { filename, timestamp, mime, bom, }: {
|
|
31
|
+
filename?: string;
|
|
32
|
+
timestamp?: boolean;
|
|
33
|
+
mime?: string;
|
|
34
|
+
bom?: BlobPart;
|
|
35
|
+
}): void;
|
|
36
|
+
/**
|
|
37
|
+
* Download file according to file address
|
|
38
|
+
* @param {*} sUrl
|
|
39
|
+
*/
|
|
40
|
+
export declare function downloadByUrl({ url, target, fileName, }: {
|
|
41
|
+
url: string;
|
|
42
|
+
target?: string;
|
|
43
|
+
fileName?: string;
|
|
44
|
+
}): boolean;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { openWindow } from "../util.mjs";
|
|
2
|
+
import { dataURLtoBlob, urlToBase64 } from "./base64Conver.mjs";
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
//#region src/utils/file/download.ts
|
|
5
|
+
/**
|
|
6
|
+
* Download online pictures
|
|
7
|
+
* @param url
|
|
8
|
+
* @param filename
|
|
9
|
+
* @param mime
|
|
10
|
+
* @param bom
|
|
11
|
+
*/
|
|
12
|
+
function downloadByOnlineUrl(url, filename, mime, bom) {
|
|
13
|
+
urlToBase64(url).then((base64) => {
|
|
14
|
+
downloadByBase64(base64, filename, mime, bom);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Download pictures based on base64
|
|
19
|
+
* @param buf
|
|
20
|
+
* @param filename
|
|
21
|
+
* @param mime
|
|
22
|
+
* @param bom
|
|
23
|
+
*/
|
|
24
|
+
function downloadByBase64(buf, filename, mime, bom) {
|
|
25
|
+
downloadByData(dataURLtoBlob(buf), {
|
|
26
|
+
filename,
|
|
27
|
+
mime,
|
|
28
|
+
bom
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function uploaderFiles({ multiple = false, accept = "*" } = {}) {
|
|
32
|
+
const input = document.createElement("input");
|
|
33
|
+
input.type = "file";
|
|
34
|
+
input.multiple = !!multiple;
|
|
35
|
+
input.accept = accept;
|
|
36
|
+
input.click();
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
input.onchange = async () => {
|
|
39
|
+
const filelist = input.files || [];
|
|
40
|
+
resolve(Object.values(filelist));
|
|
41
|
+
};
|
|
42
|
+
input.onerror = async () => {
|
|
43
|
+
reject();
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Download according to the background interface file stream
|
|
49
|
+
* @param {*} data
|
|
50
|
+
* @param {*} opts
|
|
51
|
+
* @param {*} opts.filename 文件名
|
|
52
|
+
* @param {*} opts.timestamp 是否需要在文件名后面自动加上时间戳
|
|
53
|
+
* @param {*} opts.mime
|
|
54
|
+
* @param {*} opts.bom
|
|
55
|
+
*/
|
|
56
|
+
function downloadByData(data, { filename = "file", timestamp = false, mime, bom }) {
|
|
57
|
+
if (timestamp) {
|
|
58
|
+
const ext = filename.split(".").pop();
|
|
59
|
+
filename = `${filename.replace(/\.[^/.]+$/, "")}${dayjs(/* @__PURE__ */ new Date()).format("YYYYMMDDHHmmss")}.${ext}`;
|
|
60
|
+
}
|
|
61
|
+
const blob = new Blob(typeof bom !== "undefined" ? [bom, data] : [data], { type: mime || "application/octet-stream" });
|
|
62
|
+
const blobURL = window.URL.createObjectURL(blob);
|
|
63
|
+
const tempLink = document.createElement("a");
|
|
64
|
+
tempLink.style.display = "none";
|
|
65
|
+
tempLink.href = blobURL;
|
|
66
|
+
tempLink.setAttribute("download", filename);
|
|
67
|
+
if (typeof tempLink.download === "undefined") tempLink.setAttribute("target", "_blank");
|
|
68
|
+
document.body.appendChild(tempLink);
|
|
69
|
+
tempLink.click();
|
|
70
|
+
document.body.removeChild(tempLink);
|
|
71
|
+
window.URL.revokeObjectURL(blobURL);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Download file according to file address
|
|
75
|
+
* @param {*} sUrl
|
|
76
|
+
*/
|
|
77
|
+
function downloadByUrl({ url, target = "_blank", fileName }) {
|
|
78
|
+
const isChrome = window.navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
|
|
79
|
+
const isSafari = window.navigator.userAgent.toLowerCase().indexOf("safari") > -1;
|
|
80
|
+
if (/(iP)/g.test(window.navigator.userAgent)) {
|
|
81
|
+
console.error("Your browser does not support download!");
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (isChrome || isSafari) {
|
|
85
|
+
const link = document.createElement("a");
|
|
86
|
+
link.href = url;
|
|
87
|
+
link.target = target;
|
|
88
|
+
if (link.download !== void 0) link.download = fileName || url.substring(url.lastIndexOf("/") + 1, url.length);
|
|
89
|
+
if (document.createEvent) {
|
|
90
|
+
const e = document.createEvent("MouseEvents");
|
|
91
|
+
e.initEvent("click", true, true);
|
|
92
|
+
link.dispatchEvent(e);
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (url.indexOf("?") === -1) url += "?download";
|
|
97
|
+
openWindow(url, { target });
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { downloadByBase64, downloadByData, downloadByOnlineUrl, downloadByUrl, uploaderFiles };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { UploadTypeEnum } from '../../enums';
|
|
2
|
+
export declare const sizeParser: (size: number) => string;
|
|
3
|
+
export declare const typeParser: (fileName: string) => "attachment" | "img" | UploadTypeEnum.JPG | UploadTypeEnum.JPEG | UploadTypeEnum.PNG | UploadTypeEnum.BMP | UploadTypeEnum.DOCX | UploadTypeEnum.XLSX | UploadTypeEnum.DOC | UploadTypeEnum.MP4 | UploadTypeEnum.AVI | UploadTypeEnum.PPT | UploadTypeEnum.GIF | "MP4" | "PDF" | "ssl";
|