Browse Source

refactor: @vben/shared

vben 2 years ago
parent
commit
4cddaee88a
100 changed files with 275 additions and 268 deletions
  1. 1 0
      .nvmrc
  2. 1 0
      .prettierignore
  3. 1 1
      .vscode/settings.json
  4. 1 0
      internal/eslint-config/src/index.ts
  5. 11 2
      internal/eslint-config/src/strict.ts
  6. 2 1
      internal/vite-config/src/config/application.ts
  7. 1 0
      package.json
  8. 6 2
      packages/shared/package.json
  9. 1 0
      packages/shared/src/index.ts
  10. 75 0
      packages/shared/src/types.ts
  11. 12 1
      pnpm-lock.yaml
  12. 3 2
      src/components/Application/src/search/useMenuSearch.ts
  13. 1 1
      src/components/Basic/src/BasicHelp.vue
  14. 1 1
      src/components/CardList/src/CardList.vue
  15. 2 2
      src/components/CodeEditor/src/CodeEditor.vue
  16. 0 4
      src/components/ContextMenu/src/createContextMenu.ts
  17. 2 2
      src/components/CountDown/src/CountButton.vue
  18. 1 1
      src/components/CountTo/src/CountTo.vue
  19. 1 1
      src/components/Cropper/src/CopperModal.vue
  20. 1 1
      src/components/Description/src/Description.vue
  21. 1 1
      src/components/Drawer/src/BasicDrawer.vue
  22. 1 1
      src/components/Drawer/src/useDrawer.ts
  23. 1 1
      src/components/Dropdown/src/Dropdown.vue
  24. 2 2
      src/components/Form/src/BasicForm.vue
  25. 3 3
      src/components/Form/src/components/ApiCascader.vue
  26. 2 2
      src/components/Form/src/components/ApiRadioGroup.vue
  27. 2 2
      src/components/Form/src/components/ApiSelect.vue
  28. 5 5
      src/components/Form/src/components/ApiTransfer.vue
  29. 1 1
      src/components/Form/src/components/ApiTree.vue
  30. 1 1
      src/components/Form/src/components/ApiTreeSelect.vue
  31. 7 6
      src/components/Form/src/components/FormItem.vue
  32. 1 1
      src/components/Form/src/components/RadioButtonGroup.vue
  33. 1 1
      src/components/Form/src/helper.ts
  34. 1 1
      src/components/Form/src/hooks/useAdvanced.ts
  35. 9 9
      src/components/Form/src/hooks/useFormEvents.ts
  36. 3 3
      src/components/Form/src/hooks/useFormValues.ts
  37. 1 1
      src/components/Form/src/hooks/useLabelWidth.ts
  38. 1 1
      src/components/Icon/Icon.vue
  39. 2 1
      src/components/Icon/src/IconPicker.vue
  40. 1 1
      src/components/Menu/src/BasicMenu.vue
  41. 5 4
      src/components/Modal/src/BasicModal.vue
  42. 1 1
      src/components/Modal/src/hooks/useModal.ts
  43. 1 1
      src/components/Preview/src/Preview.vue
  44. 0 2
      src/components/Preview/src/functional.ts
  45. 1 1
      src/components/Qrcode/src/drawLogo.ts
  46. 2 1
      src/components/Scrollbar/src/Scrollbar.vue
  47. 2 3
      src/components/SimpleMenu/src/SimpleMenu.vue
  48. 2 2
      src/components/SimpleMenu/src/components/SubMenuItem.vue
  49. 1 1
      src/components/Table/src/BasicTable.vue
  50. 1 1
      src/components/Table/src/components/TableAction.vue
  51. 7 6
      src/components/Table/src/components/TableFooter.vue
  52. 1 1
      src/components/Table/src/components/TableTitle.vue
  53. 1 1
      src/components/Table/src/components/editable/EditableCell.vue
  54. 1 1
      src/components/Table/src/components/editable/index.ts
  55. 2 2
      src/components/Table/src/components/settings/ColumnSetting.vue
  56. 1 1
      src/components/Table/src/hooks/useColumns.ts
  57. 1 1
      src/components/Table/src/hooks/useCustomRow.ts
  58. 4 4
      src/components/Table/src/hooks/useDataSource.ts
  59. 1 1
      src/components/Table/src/hooks/usePagination.tsx
  60. 1 1
      src/components/Table/src/hooks/useRowSelection.ts
  61. 1 1
      src/components/Table/src/hooks/useTableForm.ts
  62. 1 1
      src/components/Table/src/hooks/useTableHeader.ts
  63. 1 1
      src/components/Table/src/hooks/useTableScroll.ts
  64. 1 1
      src/components/Table/src/hooks/useTableStyle.ts
  65. 1 1
      src/components/Time/src/Time.vue
  66. 2 2
      src/components/Tinymce/src/Editor.vue
  67. 5 4
      src/components/Tree/src/BasicTree.vue
  68. 1 1
      src/components/Tree/src/TreeIcon.ts
  69. 1 1
      src/components/Upload/src/BasicUpload.vue
  70. 1 1
      src/components/Upload/src/FileList.vue
  71. 1 1
      src/components/Upload/src/UploadModal.vue
  72. 1 1
      src/components/Upload/src/UploadPreviewModal.vue
  73. 8 10
      src/directives/clickOutside.ts
  74. 1 1
      src/hooks/event/useScroll.ts
  75. 1 1
      src/hooks/web/useContentHeight.ts
  76. 2 3
      src/hooks/web/useCopyToClipboard.ts
  77. 1 1
      src/hooks/web/useMessage.tsx
  78. 1 1
      src/hooks/web/usePermission.ts
  79. 4 4
      src/hooks/web/useWatermark.ts
  80. 1 1
      src/layouts/default/header/components/Breadcrumb.vue
  81. 2 1
      src/layouts/default/header/components/notify/NoticeList.vue
  82. 2 2
      src/layouts/default/menu/index.vue
  83. 1 2
      src/layouts/default/tabs/useMultipleTabs.ts
  84. 2 2
      src/router/helper/menuHelper.ts
  85. 3 3
      src/router/menus/index.ts
  86. 2 1
      src/router/routes/index.ts
  87. 1 1
      src/store/modules/user.ts
  88. 2 1
      src/utils/bem.ts
  89. 3 3
      src/utils/cache/storageCache.ts
  90. 0 3
      src/utils/event/index.ts
  91. 3 1
      src/utils/helper/treeHelper.ts
  92. 1 1
      src/utils/helper/tsxHelper.tsx
  93. 2 2
      src/utils/http/axios/Axios.ts
  94. 1 1
      src/utils/http/axios/helper.ts
  95. 2 2
      src/utils/http/axios/index.ts
  96. 1 1
      src/utils/index.ts
  97. 0 98
      src/utils/is.ts
  98. 2 1
      src/utils/props.ts
  99. 2 1
      src/views/demo/tree/index.vue
  100. 1 1
      src/views/form-design/components/VFormDesign/components/FormItemColumnProps.vue

+ 1 - 0
.nvmrc

@@ -0,0 +1 @@
+v18

+ 1 - 0
.prettierignore

@@ -2,6 +2,7 @@ dist
 .local
 .output.js
 node_modules
+.nvmrc
 
 **/*.svg
 **/*.sh

+ 1 - 1
.vscode/settings.json

@@ -165,7 +165,7 @@
     "*.tsx": "$(capture).test.ts, $(capture).test.tsx",
     "*.env": "$(capture).env.*",
     "CHANGELOG.md": "CHANGELOG*",
-    "package.json": "pnpm-lock.yaml,pnpm-workspace.yaml,LICENSE,.gitattributes,.gitignore,.gitpod.yml,CNAME,README*,.npmrc,.browserslistrc",
+    "package.json": "pnpm-lock.yaml,pnpm-workspace.yaml,LICENSE,.gitattributes,.gitignore,.gitpod.yml,CNAME,README*,.npmrc,.browserslistrc,.nvmrc",
     ".eslintrc.js": ".eslintignore,.prettierignore,.stylelintignore,.commitlintrc.js,.prettierrc.js,.stylelintrc.js"
   },
   "terminal.integrated.scrollback": 10000

+ 1 - 0
internal/eslint-config/src/index.ts

@@ -63,6 +63,7 @@ export default {
     'vue/attribute-hyphenation': 'off',
     'vue/require-default-prop': 'off',
     'vue/require-explicit-emits': 'off',
+    'vue/prefer-import-from-vue': 'off',
     'vue/html-self-closing': [
       'error',
       {

+ 11 - 2
internal/eslint-config/src/strict.ts

@@ -1,10 +1,13 @@
 export default {
-  extends: ['@vben'],
+  extends: ['@vben', 'plugin:import/recommended'],
   plugins: ['simple-import-sort'],
   rules: {
+    'object-shorthand': ['error', 'always', { ignoreConstructors: false, avoidQuotes: true }],
+
+    'import/no-unresolved': 'off',
+
     'simple-import-sort/imports': 'error',
     'simple-import-sort/exports': 'error',
-
     '@typescript-eslint/ban-ts-comment': [
       'error',
       {
@@ -54,4 +57,10 @@ export default {
     'vue/attributes-order': 'error',
     'vue/require-default-prop': 'error',
   },
+
+  settings: {
+    'import/resolver': {
+      node: { extensions: ['.ts', '.d.ts', '.tsx'] },
+    },
+  },
 };

+ 2 - 1
internal/vite-config/src/config/application.ts

@@ -71,7 +71,8 @@ function defineApplicationConfig(defineOptions: DefineOptions = {}) {
           output: {
             manualChunks: {
               vue: ['vue', 'pinia', 'vue-router'],
-              antd: ['ant-design-vue', '@ant-design/icons-vue'],
+              // antd: ['ant-design-vue', '@ant-design/icons-vue'],
+              // vxe: ['vxe-table', 'vxe-table-plugin-export-xlsx', 'xe-utils'],
             },
           },
         },

+ 1 - 0
package.json

@@ -71,6 +71,7 @@
     "@logicflow/core": "^1.2.1",
     "@logicflow/extension": "^1.2.1",
     "@vben/hooks": "workspace:*",
+    "@vben/shared": "workspace:*",
     "@vue/shared": "^3.2.47",
     "@vueuse/core": "^9.13.0",
     "@vueuse/shared": "^9.13.0",

+ 6 - 2
packages/shared/package.json

@@ -28,6 +28,10 @@
     "clean": "pnpm rimraf .turbo node_modules dist",
     "lint": "pnpm eslint ."
   },
-  "dependencies": {},
-  "devDependencies": {}
+  "dependencies": {
+    "vue": "^3.2.47"
+  },
+  "devDependencies": {
+    "@vue/shared": "^3.2.47"
+  }
 }

+ 1 - 0
packages/shared/src/index.ts

@@ -0,0 +1 @@
+export * from './types';

+ 75 - 0
packages/shared/src/types.ts

@@ -0,0 +1,75 @@
+import { isArray, isFunction, isObject, isString } from '@vue/shared';
+import { isBoolean, isNumber } from '@vueuse/core';
+
+const toString = Object.prototype.toString;
+
+function is(val: unknown, type: string) {
+  return toString.call(val) === `[object ${type}]`;
+}
+
+function isUndefined(val: unknown): val is undefined {
+  return val === undefined;
+}
+
+function isNull(val: unknown): val is null {
+  return val === null;
+}
+
+function isNullOrUndefined(val: unknown): val is undefined | null {
+  return isUndefined(val) || isNull(val);
+}
+
+function isEmpty<T = unknown>(val: T): val is T {
+  if (!val && val !== 0) {
+    return true;
+  }
+
+  if (isArray(val) || isString(val)) {
+    return val.length === 0;
+  }
+
+  if (val instanceof Map || val instanceof Set) {
+    return val.size === 0;
+  }
+
+  if (isObject(val)) {
+    return Object.keys(val).length === 0;
+  }
+
+  return false;
+}
+
+/**
+ * 判断所给字符串是否为url类型,这里只判断是否 http/http,其他格式不支持
+ * @param pathname
+ * @returns
+ */
+function isHttpUrl(pathname: string): boolean {
+  const reg = /^http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?/;
+  return reg.test(pathname);
+}
+
+function isMap(val: unknown): val is Map<any, any> {
+  return is(val, 'Map');
+}
+
+function isWindow(val: any): val is Window {
+  return typeof window !== 'undefined' && is(val, 'Window');
+}
+
+export {
+  is,
+  isArray,
+  isBoolean,
+  isEmpty,
+  isFunction,
+  isHttpUrl,
+  isMap,
+  isNull,
+  isNullOrUndefined,
+  isNumber,
+  isObject,
+  isString,
+  isUndefined,
+  isWindow,
+};

+ 12 - 1
pnpm-lock.yaml

@@ -19,6 +19,9 @@ importers:
       '@vben/hooks':
         specifier: workspace:*
         version: link:packages/hooks
+      '@vben/shared':
+        specifier: workspace:*
+        version: link:packages/shared
       '@vue/shared':
         specifier: ^3.2.47
         version: 3.2.47
@@ -471,7 +474,15 @@ importers:
         specifier: workspace:*
         version: link:../types
 
-  packages/shared: {}
+  packages/shared:
+    dependencies:
+      vue:
+        specifier: ^3.2.47
+        version: 3.2.47
+    devDependencies:
+      '@vue/shared':
+        specifier: ^3.2.47
+        version: 3.2.47
 
   packages/types:
     dependencies:

+ 3 - 2
src/components/Application/src/search/useMenuSearch.ts

@@ -6,6 +6,7 @@ import { cloneDeep } from 'lodash-es';
 import { filter, forEach } from '/@/utils/helper/treeHelper';
 import { useGo } from '/@/hooks/web/usePage';
 import { useScrollTo } from '@vben/hooks';
+import { isArray } from '@vben/shared';
 import { onKeyStroke, useDebounceFn } from '@vueuse/core';
 import { useI18n } from '/@/hooks/web/useI18n';
 
@@ -73,7 +74,7 @@ export function useMenuSearch(refs: Ref<HTMLElement[]>, scrollWrap: Ref, emit: A
           icon,
         });
       }
-      if (!meta?.hideChildrenInMenu && Array.isArray(children) && children.length) {
+      if (!meta?.hideChildrenInMenu && isArray(children) && children.length) {
         ret.push(...handlerSearchResult(children, reg, item));
       }
     });
@@ -110,7 +111,7 @@ export function useMenuSearch(refs: Ref<HTMLElement[]>, scrollWrap: Ref, emit: A
   // the scroll bar needs to scroll automatically
   function handleScroll() {
     const refList = unref(refs);
-    if (!refList || !Array.isArray(refList) || refList.length === 0 || !unref(scrollWrap)) {
+    if (!refList || !isArray(refList) || refList.length === 0 || !unref(scrollWrap)) {
       return;
     }
 

+ 1 - 1
src/components/Basic/src/BasicHelp.vue

@@ -4,7 +4,7 @@
   import { Tooltip } from 'ant-design-vue';
   import { InfoCircleOutlined } from '@ant-design/icons-vue';
   import { getPopupContainer } from '/@/utils';
-  import { isString, isArray } from '/@/utils/is';
+  import { isArray, isString } from '@vben/shared';
   import { getSlot } from '/@/utils/helper/tsxHelper';
   import { useDesign } from '/@/hooks/web/useDesign';
 

+ 1 - 1
src/components/CardList/src/CardList.vue

@@ -88,7 +88,7 @@
   import { BasicForm, useForm } from '/@/components/Form';
   import { propTypes } from '/@/utils/propTypes';
   import { Button } from '/@/components/Button';
-  import { isFunction } from '/@/utils/is';
+  import { isFunction } from '@vben/shared';
   import { useSlider, grid } from './data';
 
   const ListItem = List.Item;

+ 2 - 2
src/components/CodeEditor/src/CodeEditor.vue

@@ -9,9 +9,9 @@
   </div>
 </template>
 <script lang="ts" setup>
-  import { computed } from 'vue';
+  import { type PropType, computed } from 'vue';
   import CodeMirrorEditor from './codemirror/CodeMirror.vue';
-  import { isString } from '/@/utils/is';
+  import { isString } from '@vben/shared';
   import { MODE } from './typing';
 
   const props = defineProps({

+ 0 - 4
src/components/ContextMenu/src/createContextMenu.ts

@@ -1,5 +1,4 @@
 import contextMenuVue from './ContextMenu.vue';
-import { isClient } from '/@/utils/is';
 import { CreateContextOptions, ContextMenuProps } from './typing';
 import { createVNode, render } from 'vue';
 
@@ -16,9 +15,6 @@ export const createContextMenu = function (options: CreateContextOptions) {
 
   event && event?.preventDefault();
 
-  if (!isClient) {
-    return;
-  }
   return new Promise((resolve) => {
     const body = document.body;
 

+ 2 - 2
src/components/CountDown/src/CountButton.vue

@@ -4,10 +4,10 @@
   </Button>
 </template>
 <script lang="ts">
-  import { defineComponent, ref, watchEffect, computed, unref } from 'vue';
+  import { type PropType, defineComponent, ref, watchEffect, computed, unref } from 'vue';
   import { Button } from 'ant-design-vue';
   import { useCountdown } from './useCountdown';
-  import { isFunction } from '/@/utils/is';
+  import { isFunction } from '@vben/shared';
   import { useI18n } from '/@/hooks/web/useI18n';
 
   const props = {

+ 1 - 1
src/components/CountTo/src/CountTo.vue

@@ -6,7 +6,7 @@
 <script lang="ts">
   import { defineComponent, ref, computed, watchEffect, unref, onMounted, watch } from 'vue';
   import { useTransition, TransitionPresets } from '@vueuse/core';
-  import { isNumber } from '/@/utils/is';
+  import { isNumber } from '@vben/shared';
 
   const props = {
     startVal: { type: Number, default: 0 },

+ 1 - 1
src/components/Cropper/src/CopperModal.vue

@@ -119,7 +119,7 @@
   import { useDesign } from '/@/hooks/web/useDesign';
   import { BasicModal, useModalInner } from '/@/components/Modal';
   import { dataURLtoBlob } from '/@/utils/file/base64Conver';
-  import { isFunction } from '/@/utils/is';
+  import { isFunction } from '@vben/shared';
   import { useI18n } from '/@/hooks/web/useI18n';
 
   type apiFunParams = { file: Blob; name: string; filename: string };

+ 1 - 1
src/components/Description/src/Description.vue

@@ -15,7 +15,7 @@
   import { Descriptions } from 'ant-design-vue';
   import { CollapseContainer } from '/@/components/Container/index';
   import { useDesign } from '/@/hooks/web/useDesign';
-  import { isFunction } from '/@/utils/is';
+  import { isFunction } from '@vben/shared';
   import { getSlot } from '/@/utils/helper/tsxHelper';
   import { useAttrs } from '@vben/hooks';
 

+ 1 - 1
src/components/Drawer/src/BasicDrawer.vue

@@ -45,7 +45,7 @@
   } from 'vue';
   import { Drawer } from 'ant-design-vue';
   import { useI18n } from '/@/hooks/web/useI18n';
-  import { isFunction, isNumber } from '/@/utils/is';
+  import { isFunction, isNumber } from '@vben/shared';
   import { deepMerge } from '/@/utils';
   import DrawerFooter from './components/DrawerFooter.vue';
   import DrawerHeader from './components/DrawerHeader.vue';

+ 1 - 1
src/components/Drawer/src/useDrawer.ts

@@ -16,7 +16,7 @@ import {
   computed,
 } from 'vue';
 import { isProdMode } from '/@/utils/env';
-import { isFunction } from '/@/utils/is';
+import { isFunction } from '@vben/shared';
 import { tryOnUnmounted } from '@vueuse/core';
 import { isEqual } from 'lodash-es';
 import { error } from '/@/utils/log';

+ 1 - 1
src/components/Dropdown/src/Dropdown.vue

@@ -42,7 +42,7 @@
   import { Dropdown, Menu, Popconfirm } from 'ant-design-vue';
   import Icon from '@/components/Icon/Icon.vue';
   import { omit } from 'lodash-es';
-  import { isFunction } from '/@/utils/is';
+  import { isFunction } from '@vben/shared';
 
   const ADropdown = Dropdown;
   const AMenu = Menu;

+ 2 - 2
src/components/Form/src/BasicForm.vue

@@ -41,7 +41,7 @@
   import type { FormActionType, FormProps, FormSchema } from './types/form';
   import type { AdvanceState } from './types/hooks';
   import type { Ref } from 'vue';
-
+  import { isArray } from '@vben/shared';
   import { defineComponent, reactive, ref, computed, unref, onMounted, watch, nextTick } from 'vue';
   import { Form, Row } from 'ant-design-vue';
   import FormItem from './components/FormItem.vue';
@@ -120,7 +120,7 @@
           const { defaultValue, component, isHandleDateDefaultValue = true } = schema;
           // handle date type
           if (isHandleDateDefaultValue && defaultValue && dateItemType.includes(component)) {
-            if (!Array.isArray(defaultValue)) {
+            if (!isArray(defaultValue)) {
               schema.defaultValue = dateUtil(defaultValue);
             } else {
               const def: any[] = [];

+ 3 - 3
src/components/Form/src/components/ApiCascader.vue

@@ -23,7 +23,7 @@
   import { defineComponent, PropType, ref, unref, watch, watchEffect } from 'vue';
   import { Cascader } from 'ant-design-vue';
   import { propTypes } from '/@/utils/propTypes';
-  import { isFunction } from '/@/utils/is';
+  import { isFunction, isArray } from '@vben/shared';
   import { get, omit } from 'lodash-es';
   import { useRuleFormItem } from '/@/hooks/component/useFormItem';
   import { LoadingOutlined } from '@ant-design/icons-vue';
@@ -119,7 +119,7 @@
         loading.value = true;
         try {
           const res = await api(props.initFetchParams);
-          if (Array.isArray(res)) {
+          if (isArray(res)) {
             apiData.value = res;
             return;
           }
@@ -143,7 +143,7 @@
           const res = await api({
             [props.asyncFetchParamKey]: Reflect.get(targetOption, 'value'),
           });
-          if (Array.isArray(res)) {
+          if (isArray(res)) {
             const children = generatorOptions(res);
             targetOption.children = children;
             return;

+ 2 - 2
src/components/Form/src/components/ApiRadioGroup.vue

@@ -21,7 +21,7 @@
 <script lang="ts">
   import { defineComponent, type PropType, ref, watchEffect, computed, unref, watch } from 'vue';
   import { Radio } from 'ant-design-vue';
-  import { isFunction } from '/@/utils/is';
+  import { isFunction, isArray } from '@vben/shared';
   import { useRuleFormItem } from '/@/hooks/component/useFormItem';
   import { useAttrs } from '@vben/hooks';
   import { propTypes } from '/@/utils/propTypes';
@@ -106,7 +106,7 @@
         try {
           loading.value = true;
           const res = await api(props.params);
-          if (Array.isArray(res)) {
+          if (isArray(res)) {
             options.value = res;
             emitChange();
             return;

+ 2 - 2
src/components/Form/src/components/ApiSelect.vue

@@ -23,7 +23,7 @@
 <script lang="ts">
   import { defineComponent, PropType, ref, watchEffect, computed, unref, watch } from 'vue';
   import { Select } from 'ant-design-vue';
-  import { isFunction } from '/@/utils/is';
+  import { isFunction, isArray } from '@vben/shared';
   import { useRuleFormItem } from '/@/hooks/component/useFormItem';
   import { useAttrs } from '@vben/hooks';
   import { get, omit } from 'lodash-es';
@@ -110,7 +110,7 @@
         try {
           loading.value = true;
           const res = await api(props.params);
-          if (Array.isArray(res)) {
+          if (isArray(res)) {
             options.value = res;
             emitChange();
             return;

+ 5 - 5
src/components/Form/src/components/ApiTransfer.vue

@@ -14,7 +14,7 @@
 <script lang="ts">
   import { computed, defineComponent, watch, ref, unref, watchEffect, PropType } from 'vue';
   import { Transfer } from 'ant-design-vue';
-  import { isFunction } from '/@/utils/is';
+  import { isArray, isFunction } from '@vben/shared';
   import { get, omit } from 'lodash-es';
   import { propTypes } from '/@/utils/propTypes';
   import { useI18n } from '/@/hooks/web/useI18n';
@@ -76,10 +76,10 @@
         if (unref(_targetKeys).length > 0) {
           return unref(_targetKeys);
         }
-        if (Array.isArray(props.value)) {
+        if (isArray(props.value)) {
           return props.value;
         }
-        if (Array.isArray(props.targetKeys)) {
+        if (isArray(props.targetKeys)) {
           return props.targetKeys;
         }
         return [];
@@ -107,7 +107,7 @@
       async function fetch() {
         const api = props.api;
         if (!api || !isFunction(api)) {
-          if (Array.isArray(props.dataSource)) {
+          if (isArray(props.dataSource)) {
             _dataSource.value = props.dataSource;
           }
           return;
@@ -115,7 +115,7 @@
         _dataSource.value = [];
         try {
           const res = await api(props.params);
-          if (Array.isArray(res)) {
+          if (isArray(res)) {
             _dataSource.value = res;
             emitChange();
             return;

+ 1 - 1
src/components/Form/src/components/ApiTree.vue

@@ -13,7 +13,7 @@
   import { type Recordable, type AnyFunction } from '@vben/types';
   import { type PropType, computed, defineComponent, watch, ref, onMounted, unref } from 'vue';
   import { Tree } from 'ant-design-vue';
-  import { isArray, isFunction } from '/@/utils/is';
+  import { isArray, isFunction } from '@vben/shared';
   import { get } from 'lodash-es';
   import { propTypes } from '/@/utils/propTypes';
   import { LoadingOutlined } from '@ant-design/icons-vue';

+ 1 - 1
src/components/Form/src/components/ApiTreeSelect.vue

@@ -13,7 +13,7 @@
   import { type Recordable } from '@vben/types';
   import { type PropType, computed, defineComponent, watch, ref, onMounted, unref } from 'vue';
   import { TreeSelect } from 'ant-design-vue';
-  import { isArray, isFunction } from '/@/utils/is';
+  import { isArray, isFunction } from '@vben/shared';
   import { get } from 'lodash-es';
   import { propTypes } from '/@/utils/propTypes';
   import { LoadingOutlined } from '@ant-design/icons-vue';

+ 7 - 6
src/components/Form/src/components/FormItem.vue

@@ -8,7 +8,8 @@
   import { Col, Divider, Form } from 'ant-design-vue';
   import { componentMap } from '../componentMap';
   import { BasicHelp } from '/@/components/Basic';
-  import { isBoolean, isFunction, isNull } from '/@/utils/is';
+  import { isBoolean, isFunction, isArray } from '@vben/shared';
+
   import { getSlot } from '/@/utils/helper/tsxHelper';
   import {
     createPlaceholderMessage,
@@ -163,10 +164,10 @@
 
         function validator(rule: any, value: any) {
           const msg = rule.message || defaultMsg;
-          if (value === undefined || isNull(value)) {
+          if (value === undefined || value === null) {
             // 空值
             return Promise.reject(msg);
-          } else if (Array.isArray(value) && value.length === 0) {
+          } else if (isArray(value) && value.length === 0) {
             // 数组类型
             return Promise.reject(msg);
           } else if (typeof value === 'string' && value.trim() === '') {
@@ -176,8 +177,8 @@
             typeof value === 'object' &&
             Reflect.has(value, 'checked') &&
             Reflect.has(value, 'halfChecked') &&
-            Array.isArray(value.checked) &&
-            Array.isArray(value.halfChecked) &&
+            isArray(value.checked) &&
+            isArray(value.halfChecked) &&
             value.checked.length === 0 &&
             value.halfChecked.length === 0
           ) {
@@ -318,7 +319,7 @@
         const getHelpMessage = isFunction(helpMessage)
           ? helpMessage(unref(getValues))
           : helpMessage;
-        if (!getHelpMessage || (Array.isArray(getHelpMessage) && getHelpMessage.length === 0)) {
+        if (!getHelpMessage || (isArray(getHelpMessage) && getHelpMessage.length === 0)) {
           return renderLabel;
         }
         return (

+ 1 - 1
src/components/Form/src/components/RadioButtonGroup.vue

@@ -13,7 +13,7 @@
 <script lang="ts">
   import { defineComponent, PropType, computed, ref } from 'vue';
   import { Radio } from 'ant-design-vue';
-  import { isString } from '/@/utils/is';
+  import { isString } from '@vben/shared';
   import { useRuleFormItem } from '/@/hooks/component/useFormItem';
   import { useAttrs } from '@vben/hooks';
 

+ 1 - 1
src/components/Form/src/helper.ts

@@ -2,7 +2,7 @@ import type { ValidationRule } from 'ant-design-vue/lib/form/Form';
 import type { ComponentType } from './types/index';
 import { useI18n } from '/@/hooks/web/useI18n';
 import { dateUtil } from '/@/utils/dateUtil';
-import { isNumber, isObject } from '/@/utils/is';
+import { isNumber, isObject } from '@vben/shared';
 
 const { t } = useI18n();
 

+ 1 - 1
src/components/Form/src/hooks/useAdvanced.ts

@@ -2,7 +2,7 @@ import type { ColEx } from '../types';
 import type { AdvanceState } from '../types/hooks';
 import { ComputedRef, getCurrentInstance, Ref, shallowReactive, computed, unref, watch } from 'vue';
 import type { FormProps, FormSchema } from '../types/form';
-import { isBoolean, isFunction, isNumber, isObject } from '/@/utils/is';
+import { isBoolean, isFunction, isNumber, isObject } from '@vben/shared';
 import { useBreakpoint } from '/@/hooks/event/useBreakpoint';
 import { useDebounceFn } from '@vueuse/core';
 

+ 9 - 9
src/components/Form/src/hooks/useFormEvents.ts

@@ -3,14 +3,14 @@ import type { FormProps, FormSchema, FormActionType } from '../types/form';
 import type { NamePath } from 'ant-design-vue/lib/form/interface';
 import { unref, toRaw, nextTick } from 'vue';
 import {
-  isArray,
+  isNullOrUndefined,
   isFunction,
-  isObject,
+  isArray,
   isString,
-  isDef,
-  isNullOrUnDef,
+  isUndefined,
   isEmpty,
-} from '/@/utils/is';
+  isObject,
+} from '@vben/shared';
 import { deepMerge } from '/@/utils';
 import { dateItemType, handleInputNumberValue, defaultValueComponents } from '../helper';
 import { dateUtil } from '/@/utils/dateUtil';
@@ -153,13 +153,13 @@ export function useFormEvents({
         nestKeyArray.forEach((nestKey: string) => {
           try {
             const value = nestKey.split('.').reduce((out, item) => out[item], values);
-            if (isDef(value)) {
+            if (!isUndefined(value)) {
               unref(formModel)[nestKey] = unref(value);
               validKeys.push(nestKey);
             }
           } catch (e) {
             // key not exist
-            if (isDef(defaultValueRef.value[nestKey])) {
+            if (!isUndefined(defaultValueRef.value[nestKey])) {
               unref(formModel)[nestKey] = cloneDeep(unref(defaultValueRef.value[nestKey]));
             }
           }
@@ -304,9 +304,9 @@ export function useFormEvents({
         item.component != 'Divider' &&
         Reflect.has(item, 'field') &&
         item.field &&
-        !isNullOrUnDef(item.defaultValue) &&
+        !isNullOrUndefined(item.defaultValue) &&
         (!(item.field in currentFieldsValue) ||
-          isNullOrUnDef(currentFieldsValue[item.field]) ||
+          isNullOrUndefined(currentFieldsValue[item.field]) ||
           isEmpty(currentFieldsValue[item.field]))
       ) {
         obj[item.field] = item.defaultValue;

+ 3 - 3
src/components/Form/src/hooks/useFormValues.ts

@@ -1,4 +1,4 @@
-import { isArray, isFunction, isObject, isString, isNullOrUnDef } from '/@/utils/is';
+import { isFunction, isArray, isString, isNullOrUndefined, isObject } from '@vben/shared';
 import { dateUtil } from '/@/utils/dateUtil';
 import { unref } from 'vue';
 import type { Ref, ComputedRef } from 'vue';
@@ -97,7 +97,7 @@ export function useFormValues({
   function handleRangeTimeValue(values: Recordable) {
     const fieldMapToTime = unref(getProps).fieldMapToTime;
 
-    if (!fieldMapToTime || !Array.isArray(fieldMapToTime)) {
+    if (!fieldMapToTime || !isArray(fieldMapToTime)) {
       return values;
     }
 
@@ -128,7 +128,7 @@ export function useFormValues({
     const obj: Recordable = {};
     schemas.forEach((item) => {
       const { defaultValue } = item;
-      if (!isNullOrUnDef(defaultValue)) {
+      if (!isNullOrUndefined(defaultValue)) {
         obj[item.field] = defaultValue;
 
         if (formModel[item.field] === undefined) {

+ 1 - 1
src/components/Form/src/hooks/useLabelWidth.ts

@@ -1,7 +1,7 @@
 import type { Ref } from 'vue';
 import { computed, unref } from 'vue';
 import type { FormProps, FormSchema } from '../types/form';
-import { isNumber } from '/@/utils/is';
+import { isNumber } from '@vben/shared';
 
 export function useItemLabelWidth(schemaItemRef: Ref<FormSchema>, propsRef: Ref<FormProps>) {
   return computed(() => {

+ 1 - 1
src/components/Icon/Icon.vue

@@ -27,7 +27,7 @@
   } from 'vue';
   import SvgIcon from './src/SvgIcon.vue';
   import Iconify from '@purge-icons/generated';
-  import { isString } from '/@/utils/is';
+  import { isString } from '@vben/shared';
   import { propTypes } from '/@/utils/propTypes';
 
   const SVG_END_WITH_FLAG = '|svg';

+ 2 - 1
src/components/Icon/src/IconPicker.vue

@@ -71,6 +71,7 @@
   import { Input, Popover, Pagination, Empty } from 'ant-design-vue';
   import Icon from '../Icon.vue';
   import SvgIcon from './SvgIcon.vue';
+  import { isArray } from '@vben/shared';
 
   import iconsData from '../data/icons.data';
   import { propTypes } from '/@/utils/propTypes';
@@ -93,7 +94,7 @@
     let result: string[] = [];
     if (prefix) {
       result = (data?.icons ?? []).map((item) => `${prefix}:${item}`);
-    } else if (Array.isArray(iconsData)) {
+    } else if (isArray(iconsData)) {
       result = iconsData as string[];
     }
     return result;

+ 1 - 1
src/components/Menu/src/BasicMenu.vue

@@ -25,7 +25,7 @@
   import { MenuModeEnum, MenuTypeEnum } from '/@/enums/menuEnum';
   import { useOpenKeys } from './useOpenKeys';
   import { RouteLocationNormalizedLoaded, useRouter } from 'vue-router';
-  import { isFunction } from '/@/utils/is';
+  import { isFunction } from '@vben/shared';
   import { basicProps } from './props';
   import { useMenuSetting } from '/@/hooks/setting/useMenuSetting';
   import { REDIRECT_NAME } from '/@/router/constant';

+ 5 - 4
src/components/Modal/src/BasicModal.vue

@@ -67,7 +67,8 @@
   import ModalClose from './components/ModalClose.vue';
   import ModalFooter from './components/ModalFooter.vue';
   import ModalHeader from './components/ModalHeader.vue';
-  import { isFunction } from '/@/utils/is';
+  import { isFunction } from '@vben/shared';
+  import { type Recordable } from '@vben/types';
   import { deepMerge } from '/@/utils';
   import { basicProps } from './props';
   import { useFullScreen } from './hooks/useModalFullScreen';
@@ -106,7 +107,7 @@
       }
 
       // Custom title component: get title
-      const getMergeProps = computed((): Recordable => {
+      const getMergeProps = computed((): Recordable<any> => {
         return {
           ...props,
           ...(unref(propsRef) as any),
@@ -120,7 +121,7 @@
       });
 
       // modal component does not need title and origin buttons
-      const getProps = computed((): Recordable => {
+      const getProps = computed((): Recordable<any> => {
         const opt = {
           ...unref(getMergeProps),
           visible: unref(visibleRef),
@@ -134,7 +135,7 @@
         };
       });
 
-      const getBindValue = computed((): Recordable => {
+      const getBindValue = computed((): Recordable<any> => {
         const attr = {
           ...attrs,
           ...unref(getMergeProps),

+ 1 - 1
src/components/Modal/src/hooks/useModal.ts

@@ -17,7 +17,7 @@ import {
   computed,
 } from 'vue';
 import { isProdMode } from '/@/utils/env';
-import { isFunction } from '/@/utils/is';
+import { isFunction } from '@vben/shared';
 import { isEqual } from 'lodash-es';
 import { tryOnUnmounted } from '@vueuse/core';
 import { error } from '/@/utils/log';

+ 1 - 1
src/components/Preview/src/Preview.vue

@@ -21,7 +21,7 @@
   import { Image } from 'ant-design-vue';
   import { useDesign } from '/@/hooks/web/useDesign';
   import { propTypes } from '/@/utils/propTypes';
-  import { isString } from '/@/utils/is';
+  import { isString } from '@vben/shared';
 
   interface ImageProps {
     alt?: string;

+ 0 - 2
src/components/Preview/src/functional.ts

@@ -1,11 +1,9 @@
 import type { Options, Props } from './typing';
 import ImgPreview from './Functional.vue';
-import { isClient } from '/@/utils/is';
 import { createVNode, render } from 'vue';
 
 let instance: ReturnType<typeof createVNode> | null = null;
 export function createImgPreview(options: Options) {
-  if (!isClient) return;
   const propsData: Partial<Props> = {};
   const container = document.createElement('div');
   Object.assign(propsData, { show: true, index: 0, scaleStep: 100 }, options);

+ 1 - 1
src/components/Qrcode/src/drawLogo.ts

@@ -1,4 +1,4 @@
-import { isString } from '/@/utils/is';
+import { isString } from '@vben/shared';
 import { RenderQrCodeParams, LogoType } from './typing';
 
 export const drawLogo = ({ canvas, logo }: RenderQrCodeParams) => {

+ 2 - 1
src/components/Scrollbar/src/Scrollbar.vue

@@ -20,6 +20,7 @@
   import { addResizeListener, removeResizeListener } from '/@/utils/event';
   import componentSetting from '/@/settings/componentSetting';
   import { toObject } from './util';
+  import { isArray } from '@vben/shared';
   import {
     defineComponent,
     ref,
@@ -76,7 +77,7 @@
       provide('scroll-bar-wrap', wrap);
 
       const style = computed(() => {
-        if (Array.isArray(props.wrapStyle)) {
+        if (isArray(props.wrapStyle)) {
           return toObject(props.wrapStyle);
         }
         return props.wrapStyle;

+ 2 - 3
src/components/SimpleMenu/src/SimpleMenu.vue

@@ -29,9 +29,8 @@
   import { propTypes } from '/@/utils/propTypes';
   import { REDIRECT_NAME } from '/@/router/constant';
   import { useRouter } from 'vue-router';
-  import { isFunction, isUrl } from '/@/utils/is';
+  import { isFunction, isHttpUrl } from '@vben/shared';
   import { openWindow } from '/@/utils';
-
   import { useOpenKeys } from './useOpenKeys';
 
   export default defineComponent({
@@ -129,7 +128,7 @@
       }
 
       async function handleSelect(key: string) {
-        if (isUrl(key)) {
+        if (isHttpUrl(key)) {
           openWindow(key);
           return;
         }

+ 2 - 2
src/components/SimpleMenu/src/components/SubMenuItem.vue

@@ -77,7 +77,7 @@
   import { CollapseTransition } from '/@/components/Transition';
   import Icon from '@/components/Icon/Icon.vue';
   import { Popover } from 'ant-design-vue';
-  import { isBoolean, isObject } from '/@/utils/is';
+  import { isObject, isBoolean, isArray } from '@vben/shared';
   import { mitt } from '/@/utils/mitt';
 
   const DELAY = 200;
@@ -284,7 +284,7 @@
               return;
             }
 
-            if (props.name && Array.isArray(data)) {
+            if (props.name && isArray(data)) {
               state.opened = (data as (string | number)[]).includes(props.name);
             }
           },

+ 1 - 1
src/components/Table/src/BasicTable.vue

@@ -71,7 +71,7 @@
 
   import { omit } from 'lodash-es';
   import { basicProps } from './props';
-  import { isFunction } from '/@/utils/is';
+  import { isFunction } from '@vben/shared';
   import { warn } from '/@/utils/log';
 
   export default defineComponent({

+ 1 - 1
src/components/Table/src/components/TableAction.vue

@@ -41,7 +41,7 @@
   import { useDesign } from '/@/hooks/web/useDesign';
   import { useTableContext } from '../hooks/useTableContext';
   import { usePermission } from '/@/hooks/web/usePermission';
-  import { isBoolean, isFunction, isString } from '/@/utils/is';
+  import { isBoolean, isFunction, isString } from '@vben/shared';
   import { propTypes } from '/@/utils/propTypes';
   import { ACTION_COLUMN_FLAG } from '../const';
 

+ 7 - 6
src/components/Table/src/components/TableFooter.vue

@@ -16,7 +16,8 @@
   import { defineComponent, unref, computed, toRaw } from 'vue';
   import { Table } from 'ant-design-vue';
   import { cloneDeep } from 'lodash-es';
-  import { isFunction } from '/@/utils/is';
+  import { isFunction } from '@vben/shared';
+  import { type AnyFunction, Recordable } from '@vben/types';
   import type { BasicColumn } from '../types/table';
   import { INDEX_COLUMN_FLAG } from '../const';
   import { propTypes } from '/@/utils/propTypes';
@@ -29,20 +30,20 @@
     components: { Table },
     props: {
       summaryFunc: {
-        type: Function as PropType<Fn>,
+        type: Function as PropType<AnyFunction>,
       },
       summaryData: {
-        type: Array as PropType<Recordable[]>,
+        type: Array as PropType<Recordable<any>[]>,
       },
       scroll: {
-        type: Object as PropType<Recordable>,
+        type: Object as PropType<Recordable<any>>,
       },
       rowKey: propTypes.string.def('key'),
     },
     setup(props) {
       const table = useTableContext();
 
-      const getDataSource = computed((): Recordable[] => {
+      const getDataSource = computed((): Recordable<any>[] => {
         const { summaryFunc, summaryData } = props;
         if (summaryData?.length) {
           summaryData.forEach((item, i) => (item[props.rowKey] = `${i}`));
@@ -52,7 +53,7 @@
           return [];
         }
         let dataSource = toRaw(unref(table.getDataSource()));
-        dataSource = summaryFunc(dataSource);
+        dataSource = summaryFunc(dataSource) as any;
         dataSource.forEach((item, i) => {
           item[props.rowKey] = `${i}`;
         });

+ 1 - 1
src/components/Table/src/components/TableTitle.vue

@@ -7,7 +7,7 @@
   import { computed, defineComponent, PropType } from 'vue';
   import { BasicTitle } from '/@/components/Basic/index';
   import { useDesign } from '/@/hooks/web/useDesign';
-  import { isFunction } from '/@/utils/is';
+  import { isFunction } from '@vben/shared';
 
   export default defineComponent({
     name: 'BasicTableTitle',

+ 1 - 1
src/components/Table/src/components/editable/EditableCell.vue

@@ -11,7 +11,7 @@
   import clickOutside from '/@/directives/clickOutside';
 
   import { propTypes } from '/@/utils/propTypes';
-  import { isArray, isBoolean, isFunction, isNumber, isString } from '/@/utils/is';
+  import { isArray, isBoolean, isFunction, isNumber, isString } from '@vben/shared';
   import { createPlaceholderMessage } from './helper';
   import { pick, set } from 'lodash-es';
   import { treeToList } from '/@/utils/helper/treeHelper';

+ 1 - 1
src/components/Table/src/components/editable/index.ts

@@ -3,7 +3,7 @@ import type { BasicColumn } from '/@/components/Table/src/types/table';
 import { h, Ref } from 'vue';
 
 import EditableCell from './EditableCell.vue';
-import { isArray } from '/@/utils/is';
+import { isArray } from '@vben/shared';
 
 interface Params {
   text: string;

+ 2 - 2
src/components/Table/src/components/settings/ColumnSetting.vue

@@ -119,7 +119,7 @@
   import { useTableContext } from '../../hooks/useTableContext';
   import { useDesign } from '/@/hooks/web/useDesign';
   // import { useSortable } from '/@/hooks/web/useSortable';
-  import { isFunction, isNullAndUnDef } from '/@/utils/is';
+  import { isFunction } from '@vben/shared';
   import { getPopupContainer as getParentContainer } from '/@/utils';
   import { cloneDeep, omit } from 'lodash-es';
   import Sortablejs from 'sortablejs';
@@ -301,7 +301,7 @@
             handle: '.table-column-drag-icon ',
             onEnd: (evt) => {
               const { oldIndex, newIndex } = evt;
-              if (isNullAndUnDef(oldIndex) || isNullAndUnDef(newIndex) || oldIndex === newIndex) {
+              if (oldIndex === newIndex) {
                 return;
               }
               // Sort column

+ 1 - 1
src/components/Table/src/hooks/useColumns.ts

@@ -5,7 +5,7 @@ import { computed, Ref, ref, reactive, toRaw, unref, watch } from 'vue';
 import { renderEditCell } from '../components/editable';
 import { usePermission } from '/@/hooks/web/usePermission';
 import { useI18n } from '/@/hooks/web/useI18n';
-import { isArray, isBoolean, isFunction, isMap, isString } from '/@/utils/is';
+import { isMap, isArray, isBoolean, isFunction, isString } from '@vben/shared';
 import { cloneDeep, isEqual } from 'lodash-es';
 import { formatToDate } from '/@/utils/dateUtil';
 import { ACTION_COLUMN_FLAG, DEFAULT_ALIGN, INDEX_COLUMN_FLAG, PAGE_SIZE } from '../const';

+ 1 - 1
src/components/Table/src/hooks/useCustomRow.ts

@@ -2,7 +2,7 @@ import type { ComputedRef } from 'vue';
 import type { BasicTableProps } from '../types/table';
 import { unref } from 'vue';
 import { ROW_KEY } from '../const';
-import { isString, isFunction } from '/@/utils/is';
+import { isString, isFunction } from '@vben/shared';
 
 interface Options {
   setSelectedRowKeys: (keys: string[]) => void;

+ 4 - 4
src/components/Table/src/hooks/useDataSource.ts

@@ -13,9 +13,9 @@ import {
 } from 'vue';
 import { useTimeoutFn } from '@vben/hooks';
 import { buildUUID } from '/@/utils/uuid';
-import { isFunction, isBoolean, isObject } from '/@/utils/is';
 import { get, cloneDeep, merge } from 'lodash-es';
 import { FETCH_SETTING, ROW_KEY, PAGE_SIZE } from '../const';
+import { isArray, isFunction, isBoolean, isObject } from '@vben/shared';
 
 interface ActionType {
   getPaginationInfo: ComputedRef<boolean | PaginationProps>;
@@ -91,7 +91,7 @@ export function useDataSource(
   }
 
   function setTableKey(items: any[]) {
-    if (!items || !Array.isArray(items)) return;
+    if (!items || !isArray(items)) return;
     items.forEach((item) => {
       if (!item[ROW_KEY]) {
         item[ROW_KEY] = buildUUID();
@@ -164,7 +164,7 @@ export function useDataSource(
     if (!dataSourceRef.value || dataSourceRef.value.length == 0) return;
     const rowKeyName = unref(getRowKey);
     if (!rowKeyName) return;
-    const rowKeys = !Array.isArray(rowKey) ? [rowKey] : rowKey;
+    const rowKeys = !isArray(rowKey) ? [rowKey] : rowKey;
 
     function deleteRow(data, key) {
       const row: { index: number; data: [] } = findRow(data, key);
@@ -304,7 +304,7 @@ export function useDataSource(
       const res = await api(params);
       rawDataSourceRef.value = res;
 
-      const isArrayResult = Array.isArray(res);
+      const isArrayResult = isArray(res);
 
       let resultItems: Recordable[] = isArrayResult ? res : get(res, listField);
       const resultTotal: number = isArrayResult ? res.length : get(res, totalField);

+ 1 - 1
src/components/Table/src/hooks/usePagination.tsx

@@ -2,7 +2,7 @@ import type { PaginationProps } from '../types/pagination';
 import type { BasicTableProps } from '../types/table';
 import { computed, unref, ref, ComputedRef, watch } from 'vue';
 import { LeftOutlined, RightOutlined } from '@ant-design/icons-vue';
-import { isBoolean } from '/@/utils/is';
+import { isBoolean } from '@vben/shared';
 import { PAGE_SIZE, PAGE_SIZE_OPTIONS } from '../const';
 import { useI18n } from '/@/hooks/web/useI18n';
 

+ 1 - 1
src/components/Table/src/hooks/useRowSelection.ts

@@ -1,4 +1,4 @@
-import { isFunction } from '/@/utils/is';
+import { isFunction } from '@vben/shared';
 import type { BasicTableProps, TableRowSelection } from '../types/table';
 import { computed, ComputedRef, nextTick, Ref, ref, toRaw, unref, watch } from 'vue';
 import { ROW_KEY } from '../const';

+ 1 - 1
src/components/Table/src/hooks/useTableForm.ts

@@ -2,7 +2,7 @@ import type { ComputedRef, Slots } from 'vue';
 import type { BasicTableProps, FetchParams } from '../types/table';
 import { unref, computed } from 'vue';
 import type { FormProps } from '/@/components/Form';
-import { isFunction } from '/@/utils/is';
+import { isFunction } from '@vben/shared';
 
 export function useTableForm(
   propsRef: ComputedRef<BasicTableProps>,

+ 1 - 1
src/components/Table/src/hooks/useTableHeader.ts

@@ -2,7 +2,7 @@ import type { ComputedRef, Slots } from 'vue';
 import type { BasicTableProps, InnerHandlers } from '../types/table';
 import { unref, computed, h } from 'vue';
 import TableHeader from '../components/TableHeader.vue';
-import { isString } from '/@/utils/is';
+import { isString } from '@vben/shared';
 import { getSlot } from '/@/utils/helper/tsxHelper';
 
 export function useTableHeader(

+ 1 - 1
src/components/Table/src/hooks/useTableScroll.ts

@@ -1,7 +1,7 @@
 import type { BasicTableProps, TableRowSelection, BasicColumn } from '../types/table';
 import { Ref, ComputedRef, ref, computed, unref, nextTick, watch } from 'vue';
 import { getViewportOffset } from '/@/utils/domUtils';
-import { isBoolean } from '/@/utils/is';
+import { isBoolean } from '@vben/shared';
 import { useWindowSizeFn, onMountedOrActivated } from '@vben/hooks';
 import { useModalContext } from '/@/components/Modal';
 import { useDebounceFn } from '@vueuse/core';

+ 1 - 1
src/components/Table/src/hooks/useTableStyle.ts

@@ -1,7 +1,7 @@
 import type { ComputedRef } from 'vue';
 import type { BasicTableProps, TableCustomRecord } from '../types/table';
 import { unref } from 'vue';
-import { isFunction } from '/@/utils/is';
+import { isFunction } from '@vben/shared';
 
 export function useTableStyle(propsRef: ComputedRef<BasicTableProps>, prefixCls: string) {
   function getRowClassName(record: TableCustomRecord, index: number) {

+ 1 - 1
src/components/Time/src/Time.vue

@@ -6,7 +6,7 @@
   import { useI18n } from '/@/hooks/web/useI18n';
   import { useIntervalFn } from '@vueuse/core';
   import { formatToDateTime, formatToDate, dateUtil } from '/@/utils/dateUtil';
-  import { isNumber, isObject, isString } from '/@/utils/is';
+  import { isNumber, isObject, isString } from '@vben/shared';
   import { propTypes } from '/@/utils/propTypes';
 
   const ONE_SECONDS = 1000;

+ 2 - 2
src/components/Tinymce/src/Editor.vue

@@ -52,6 +52,7 @@
   import 'tinymce/plugins/visualblocks';
   import 'tinymce/plugins/visualchars';
   import 'tinymce/plugins/wordcount';
+  import { isArray, isNumber } from '@vben/shared';
 
   import {
     defineComponent,
@@ -70,7 +71,6 @@
   import { bindHandlers } from './helper';
   import { onMountedOrActivated } from '@vben/hooks';
   import { useDesign } from '/@/hooks/web/useDesign';
-  import { isNumber } from '/@/utils/is';
   import { useLocale } from '/@/locales/useLocale';
   import { useAppStore } from '/@/store/modules/app';
 
@@ -259,7 +259,7 @@
 
       function bindModelHandlers(editor: any) {
         const modelEvents = attrs.modelEvents ? attrs.modelEvents : null;
-        const normalizedEvents = Array.isArray(modelEvents) ? modelEvents.join(' ') : modelEvents;
+        const normalizedEvents = isArray(modelEvents) ? modelEvents.join(' ') : modelEvents;
 
         watch(
           () => props.modelValue,

+ 5 - 4
src/components/Tree/src/BasicTree.vue

@@ -25,7 +25,8 @@
   import { TreeIcon } from './TreeIcon';
   import { ScrollContainer } from '/@/components/Container';
   import { omit, get, difference, cloneDeep } from 'lodash-es';
-  import { isArray, isBoolean, isEmpty, isFunction } from '/@/utils/is';
+  import { isArray, isBoolean, isEmpty, isFunction } from '@vben/shared';
+  import { type Recordable } from '@vben/types';
   import { extendSlots, getSlot } from '/@/utils/helper/tsxHelper';
   import { filter, treeToList, eachTree } from '/@/utils/helper/treeHelper';
   import { useTree } from './hooks/useTree';
@@ -129,7 +130,7 @@
         getSelectedNode,
       } = useTree(treeDataRef, getFieldNames);
 
-      function getIcon(params: Recordable, icon?: string) {
+      function getIcon(params: Recordable<any>, icon?: string) {
         if (!icon) {
           if (props.renderIcon && isFunction(props.renderIcon)) {
             return props.renderIcon(params);
@@ -138,13 +139,13 @@
         return icon;
       }
 
-      async function handleRightClick({ event, node }: Recordable) {
+      async function handleRightClick({ event, node }: Recordable<any>) {
         const { rightMenuList: menuList = [], beforeRightClick } = props;
         let contextMenuOptions: CreateContextOptions = { event, items: [] };
 
         if (beforeRightClick && isFunction(beforeRightClick)) {
           let result = await beforeRightClick(node, event);
-          if (Array.isArray(result)) {
+          if (isArray(result)) {
             contextMenuOptions.items = result;
           } else {
             Object.assign(contextMenuOptions, result);

+ 1 - 1
src/components/Tree/src/TreeIcon.ts

@@ -1,6 +1,6 @@
 import type { VNode, FunctionalComponent } from 'vue';
 import { h } from 'vue';
-import { isString } from 'lodash-es';
+import { isString } from '@vben/shared';
 import Icon from '@/components/Icon/Icon.vue';
 
 export const TreeIcon: FunctionalComponent = ({ icon }: { icon: VNode | string }) => {

+ 1 - 1
src/components/Upload/src/BasicUpload.vue

@@ -44,7 +44,7 @@
   import { uploadContainerProps } from './props';
   import { omit } from 'lodash-es';
   import { useI18n } from '/@/hooks/web/useI18n';
-  import { isArray } from '/@/utils/is';
+  import { isArray } from '@vben/shared';
   import UploadModal from './UploadModal.vue';
   import UploadPreviewModal from './UploadPreviewModal.vue';
 

+ 1 - 1
src/components/Upload/src/FileList.vue

@@ -1,7 +1,7 @@
 <script lang="tsx">
   import { defineComponent, CSSProperties, watch, nextTick } from 'vue';
   import { fileListProps } from './props';
-  import { isFunction } from '/@/utils/is';
+  import { isFunction } from '@vben/shared';
   import { useModalContext } from '/@/components/Modal/src/hooks/useModalContext';
 
   export default defineComponent({

+ 1 - 1
src/components/Upload/src/UploadModal.vue

@@ -57,7 +57,7 @@
   // utils
   import { checkImgType, getBase64WithFile } from './helper';
   import { buildUUID } from '/@/utils/uuid';
-  import { isFunction } from '/@/utils/is';
+  import { isFunction } from '@vben/shared';
   import { warn } from '/@/utils/log';
   import FileList from './FileList.vue';
   import { useI18n } from '/@/hooks/web/useI18n';

+ 1 - 1
src/components/Upload/src/UploadPreviewModal.vue

@@ -20,7 +20,7 @@
   import { downloadByUrl } from '/@/utils/file/download';
   import { createPreviewColumns, createPreviewActionColumn } from './data';
   import { useI18n } from '/@/hooks/web/useI18n';
-  import { isArray } from '/@/utils/is';
+  import { isArray } from '@vben/shared';
 
   export default defineComponent({
     components: { BasicModal, FileList },

+ 8 - 10
src/directives/clickOutside.ts

@@ -1,6 +1,6 @@
 import { on } from '/@/utils/domUtils';
-import { isServer } from '/@/utils/is';
 import type { ComponentPublicInstance, DirectiveBinding, ObjectDirective } from 'vue';
+import { isArray } from '@vben/shared';
 
 type DocumentHandler = <T extends MouseEvent>(mouseup: T, mousedown: T) => void;
 
@@ -16,18 +16,16 @@ const nodeList: FlushList = new Map();
 
 let startClick: MouseEvent;
 
-if (!isServer) {
-  on(document, 'mousedown', (e: MouseEvent) => (startClick = e));
-  on(document, 'mouseup', (e: MouseEvent) => {
-    for (const { documentHandler } of nodeList.values()) {
-      documentHandler(e, startClick);
-    }
-  });
-}
+on(document, 'mousedown', (e: MouseEvent) => (startClick = e));
+on(document, 'mouseup', (e: MouseEvent) => {
+  for (const { documentHandler } of nodeList.values()) {
+    documentHandler(e, startClick);
+  }
+});
 
 function createDocumentHandler(el: HTMLElement, binding: DirectiveBinding): DocumentHandler {
   let excludes: HTMLElement[] = [];
-  if (Array.isArray(binding.arg)) {
+  if (isArray(binding.arg)) {
     excludes = binding.arg;
   } else {
     // due to current implementation on binding type is wrong the type casting is necessary here

+ 1 - 1
src/hooks/event/useScroll.ts

@@ -1,7 +1,7 @@
 import type { Ref } from 'vue';
 
 import { ref, onMounted, watch, onUnmounted } from 'vue';
-import { isWindow, isObject } from '/@/utils/is';
+import { isWindow, isObject } from '@vben/shared';
 import { useThrottleFn } from '@vueuse/core';
 
 export function useScroll(

+ 1 - 1
src/hooks/web/useContentHeight.ts

@@ -2,7 +2,7 @@ import { ComputedRef, isRef, nextTick, Ref, ref, unref, watch } from 'vue';
 import { onMountedOrActivated, useWindowSizeFn } from '@vben/hooks';
 import { useLayoutHeight } from '/@/layouts/default/content/useContentViewHeight';
 import { getViewportOffset } from '/@/utils/domUtils';
-import { isNumber, isString } from '/@/utils/is';
+import { isNumber, isString } from '@vben/shared';
 
 export interface CompensationHeight {
   // 使用 layout Footer 高度作为判断补偿高度的条件

+ 2 - 3
src/hooks/web/useCopyToClipboard.ts

@@ -1,6 +1,5 @@
 import { ref, watch } from 'vue';
-
-import { isDef } from '/@/utils/is';
+import { isUndefined } from '@vben/shared';
 
 interface Options {
   target?: HTMLElement;
@@ -13,7 +12,7 @@ export function useCopyToClipboard(initial?: string) {
   watch(
     clipboardRef,
     (str?: string) => {
-      if (isDef(str)) {
+      if (!isUndefined(str)) {
         copiedRef.value = true;
         isSuccessRef.value = copyTextToClipboard(str);
       }

+ 1 - 1
src/hooks/web/useMessage.tsx

@@ -3,7 +3,7 @@ import { Modal, message as Message, notification } from 'ant-design-vue';
 import { InfoCircleFilled, CheckCircleFilled, CloseCircleFilled } from '@ant-design/icons-vue';
 import { NotificationArgsProps, ConfigProps } from 'ant-design-vue/lib/notification';
 import { useI18n } from './useI18n';
-import { isString } from '/@/utils/is';
+import { isString } from '@vben/shared';
 
 export interface NotifyApi {
   info(config: NotificationArgsProps): void;

+ 1 - 1
src/hooks/web/usePermission.ts

@@ -14,7 +14,7 @@ import { PermissionModeEnum } from '/@/enums/appEnum';
 import { RoleEnum } from '/@/enums/roleEnum';
 
 import { intersection } from 'lodash-es';
-import { isArray } from '/@/utils/is';
+import { isArray } from '@vben/shared';
 import { useMultipleTabStore } from '/@/store/modules/multipleTab';
 
 // User permissions related operations

+ 4 - 4
src/hooks/web/useWatermark.ts

@@ -1,7 +1,7 @@
 import { getCurrentInstance, onBeforeUnmount, ref, Ref, shallowRef, unref } from 'vue';
 import { useRafThrottle } from '/@/utils/domUtils';
 import { addResizeListener, removeResizeListener } from '/@/utils/event';
-import { isDef } from '/@/utils/is';
+import { isUndefined } from '@vben/shared';
 
 const domSymbol = Symbol('watermark-dom');
 const sourceMap = new WeakMap<HTMLElement, {}>();
@@ -58,13 +58,13 @@ export function useWatermark(
   ) {
     const el = unref(watermarkEl);
     if (!el) return;
-    if (isDef(options.width)) {
+    if (!isUndefined(options.width)) {
       el.style.width = `${options.width}px`;
     }
-    if (isDef(options.height)) {
+    if (!isUndefined(options.height)) {
       el.style.height = `${options.height}px`;
     }
-    if (isDef(options.str)) {
+    if (!isUndefined(options.str)) {
       el.style.background = `url(${createBase64(options.str)}) left top repeat`;
     }
   }

+ 1 - 1
src/layouts/default/header/components/Breadcrumb.vue

@@ -29,7 +29,7 @@
   import { useI18n } from '/@/hooks/web/useI18n';
 
   import { propTypes } from '/@/utils/propTypes';
-  import { isString } from '/@/utils/is';
+  import { isString } from '@vben/shared';
   import { filter } from '/@/utils/helper/treeHelper';
   import { getMenus } from '/@/router/menus';
 

+ 2 - 1
src/layouts/default/header/components/notify/NoticeList.vue

@@ -58,7 +58,8 @@
   import { ListItem } from './data';
   import { useDesign } from '/@/hooks/web/useDesign';
   import { List, Avatar, Tag, Typography } from 'ant-design-vue';
-  import { isNumber } from '/@/utils/is';
+  import { isNumber } from '@vben/shared';
+
   export default defineComponent({
     components: {
       [Avatar.name]: Avatar,

+ 2 - 2
src/layouts/default/menu/index.vue

@@ -15,7 +15,7 @@
   import { useSplitMenu } from './useLayoutMenu';
   import { openWindow } from '/@/utils';
   import { propTypes } from '/@/utils/propTypes';
-  import { isUrl } from '/@/utils/is';
+  import { isHttpUrl } from '@vben/shared';
   import { useRootSetting } from '/@/hooks/setting/useRootSetting';
   import { useAppInject } from '/@/hooks/web/useAppInject';
   import { useDesign } from '/@/hooks/web/useDesign';
@@ -119,7 +119,7 @@
        * @param menu
        */
       async function beforeMenuClickFn(path: string) {
-        if (!isUrl(path)) {
+        if (!isHttpUrl(path)) {
           return true;
         }
         openWindow(path);

+ 1 - 2
src/layouts/default/tabs/useMultipleTabs.ts

@@ -3,7 +3,6 @@ import type { RouteLocationNormalized } from 'vue-router';
 import { useDesign } from '/@/hooks/web/useDesign';
 import { useSortable } from '/@/hooks/web/useSortable';
 import { useMultipleTabStore } from '/@/store/modules/multipleTab';
-import { isNullAndUnDef } from '/@/utils/is';
 import projectSetting from '/@/settings/projectSetting';
 import { useRouter } from 'vue-router';
 
@@ -68,7 +67,7 @@ export function useTabsDrag(affixTextList: string[]) {
       onEnd: (evt) => {
         const { oldIndex, newIndex } = evt;
 
-        if (isNullAndUnDef(oldIndex) || isNullAndUnDef(newIndex) || oldIndex === newIndex) {
+        if (oldIndex === newIndex) {
           return;
         }
 

+ 2 - 2
src/router/helper/menuHelper.ts

@@ -2,7 +2,7 @@ import { AppRouteModule } from '/@/router/types';
 import type { MenuModule, Menu, AppRouteRecordRaw } from '/@/router/types';
 import { findPath, treeMap } from '/@/utils/helper/treeHelper';
 import { cloneDeep } from 'lodash-es';
-import { isUrl } from '/@/utils/is';
+import { isHttpUrl } from '@vben/shared';
 import { RouteParams } from 'vue-router';
 import { toRaw } from 'vue';
 
@@ -20,7 +20,7 @@ function joinParentPath(menus: Menu[], parentPath = '') {
     // 请注意,以 / 开头的嵌套路径将被视为根路径。
     // This allows you to leverage the component nesting without having to use a nested URL.
     // 这允许你利用组件嵌套,而无需使用嵌套 URL。
-    if (!(menu.path.startsWith('/') || isUrl(menu.path))) {
+    if (!(menu.path.startsWith('/') || isHttpUrl(menu.path))) {
       // path doesn't start with /, nor is it a url, join parent path
       // 路径不以 / 开头,也不是 url,加入父路径
       menu.path = `${parentPath}/${menu.path}`;

+ 3 - 3
src/router/menus/index.ts

@@ -5,7 +5,7 @@ import { useAppStoreWithOut } from '/@/store/modules/app';
 import { usePermissionStore } from '/@/store/modules/permission';
 import { transformMenuModule, getAllParentPath } from '/@/router/helper/menuHelper';
 import { filter } from '/@/utils/helper/treeHelper';
-import { isUrl } from '/@/utils/is';
+import { isHttpUrl, isArray } from '@vben/shared';
 import { router } from '/@/router';
 import { PermissionModeEnum } from '/@/enums/appEnum';
 import { pathToRegexp } from 'path-to-regexp';
@@ -16,7 +16,7 @@ const menuModules: MenuModule[] = [];
 
 Object.keys(modules).forEach((key) => {
   const mod = modules[key].default || {};
-  const modList = Array.isArray(mod) ? [...mod] : [mod];
+  const modList = isArray(mod) ? [...mod] : [mod];
   menuModules.push(...modList);
 });
 
@@ -115,7 +115,7 @@ export async function getChildrenMenus(parentPath: string) {
 function basicFilter(routes: RouteRecordNormalized[]) {
   return (menu: Menu) => {
     const matchRoute = routes.find((route) => {
-      if (isUrl(menu.path)) return true;
+      if (isHttpUrl(menu.path)) return true;
 
       if (route.meta?.carryParam) {
         return pathToRegexp(route.path).test(menu.path);

+ 2 - 1
src/router/routes/index.ts

@@ -5,6 +5,7 @@ import { PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '/@/router/routes/basic';
 import { mainOutRoutes } from './mainOut';
 import { PageEnum } from '/@/enums/pageEnum';
 import { t } from '/@/hooks/web/useI18n';
+import { isArray } from '@vben/shared';
 
 // import.meta.globEager() 直接引入所有的模块 Vite 独有的功能
 const modules = import.meta.globEager('./modules/**/*.ts');
@@ -13,7 +14,7 @@ const routeModuleList: AppRouteModule[] = [];
 // 加入到路由集合中
 Object.keys(modules).forEach((key) => {
   const mod = modules[key].default || {};
-  const modList = Array.isArray(mod) ? [...mod] : [mod];
+  const modList = isArray(mod) ? [...mod] : [mod];
   routeModuleList.push(...modList);
 });
 

+ 1 - 1
src/store/modules/user.ts

@@ -14,7 +14,7 @@ import { router } from '/@/router';
 import { usePermissionStore } from '/@/store/modules/permission';
 import { RouteRecordRaw } from 'vue-router';
 import { PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic';
-import { isArray } from '/@/utils/is';
+import { isArray } from '@vben/shared';
 import { h } from 'vue';
 
 interface UserState {

+ 2 - 1
src/utils/bem.ts

@@ -1,4 +1,5 @@
 import { prefixCls } from '/@/settings/designSetting';
+import { isArray } from '@vben/shared';
 
 type Mod = string | { [key: string]: any };
 type Mods = Mod | Mod[];
@@ -14,7 +15,7 @@ function genBem(name: string, mods?: Mods): string {
     return ` ${name}--${mods}`;
   }
 
-  if (Array.isArray(mods)) {
+  if (isArray(mods)) {
     return mods.reduce<string>((ret, item) => ret + genBem(name, item), '');
   }
 

+ 3 - 3
src/utils/cache/storageCache.ts

@@ -1,7 +1,7 @@
 import { cacheCipher } from '/@/settings/encryptionSetting';
 import type { EncryptionParams } from '/@/utils/cipher';
 import { AesEncryption } from '/@/utils/cipher';
-import { isNullOrUnDef } from '/@/utils/is';
+import { isNullOrUndefined } from '@vben/shared';
 
 export interface CreateStorageParams extends EncryptionParams {
   prefixKey: string;
@@ -60,7 +60,7 @@ export const createStorage = ({
       const stringData = JSON.stringify({
         value,
         time: Date.now(),
-        expire: !isNullOrUnDef(expire) ? new Date().getTime() + expire * 1000 : null,
+        expire: !isNullOrUndefined(expire) ? new Date().getTime() + expire * 1000 : null,
       });
       const stringifyValue = this.hasEncrypt
         ? this.encryption.encryptByAES(stringData)
@@ -82,7 +82,7 @@ export const createStorage = ({
         const decVal = this.hasEncrypt ? this.encryption.decryptByAES(val) : val;
         const data = JSON.parse(decVal);
         const { value, expire } = data;
-        if (isNullOrUnDef(expire) || expire >= new Date().getTime()) {
+        if (isNullOrUndefined(expire) || expire >= new Date().getTime()) {
           return value;
         }
         this.remove(key);

+ 0 - 3
src/utils/event/index.ts

@@ -1,7 +1,5 @@
 import ResizeObserver from 'resize-observer-polyfill';
 
-const isServer = typeof window === 'undefined';
-
 /* istanbul ignore next */
 function resizeHandler(entries: any[]) {
   for (const entry of entries) {
@@ -16,7 +14,6 @@ function resizeHandler(entries: any[]) {
 
 /* istanbul ignore next */
 export function addResizeListener(element: any, fn: () => any) {
-  if (isServer) return;
   if (!element.__resizeListeners__) {
     element.__resizeListeners__ = [];
     element.__ro__ = new ResizeObserver(resizeHandler);

+ 3 - 1
src/utils/helper/treeHelper.ts

@@ -1,3 +1,5 @@
+import { isArray } from '@vben/shared';
+
 interface TreeHelperConfig {
   id: string;
   children: string;
@@ -181,7 +183,7 @@ export function treeMapEach(
   data: any,
   { children = 'children', conversion }: { children?: string; conversion: Fn },
 ) {
-  const haveChildren = Array.isArray(data[children]) && data[children].length > 0;
+  const haveChildren = isArray(data[children]) && data[children].length > 0;
   const conversionData = conversion(data) || {};
   if (haveChildren) {
     return {

+ 1 - 1
src/utils/helper/tsxHelper.tsx

@@ -1,5 +1,5 @@
 import { Slots } from 'vue';
-import { isFunction } from '/@/utils/is';
+import { isFunction } from '@vben/shared';
 
 /**
  * @description:  Get slot to prevent empty error

+ 2 - 2
src/utils/http/axios/Axios.ts

@@ -10,7 +10,7 @@ import type { CreateAxiosOptions } from './axiosTransform';
 import axios from 'axios';
 import qs from 'qs';
 import { AxiosCanceler } from './axiosCancel';
-import { isFunction } from '/@/utils/is';
+import { isFunction, isArray } from '@vben/shared';
 import { cloneDeep } from 'lodash-es';
 import { ContentTypeEnum, RequestEnum } from '/@/enums/httpEnum';
 
@@ -138,7 +138,7 @@ export class VAxios {
     if (params.data) {
       Object.keys(params.data).forEach((key) => {
         const value = params.data![key];
-        if (Array.isArray(value)) {
+        if (isArray(value)) {
           value.forEach((item) => {
             formData.append(`${key}[]`, item);
           });

+ 1 - 1
src/utils/http/axios/helper.ts

@@ -1,4 +1,4 @@
-import { isObject, isString } from '/@/utils/is';
+import { isString, isObject } from '@vben/shared';
 
 const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
 

+ 2 - 2
src/utils/http/axios/index.ts

@@ -10,7 +10,7 @@ import { checkStatus } from './checkStatus';
 import { useGlobSetting } from '/@/hooks/setting';
 import { useMessage } from '/@/hooks/web/useMessage';
 import { RequestEnum, ResultEnum, ContentTypeEnum } from '/@/enums/httpEnum';
-import { isString, isUnDef, isNull, isEmpty } from '/@/utils/is';
+import { isString, isUndefined, isEmpty } from '@vben/shared';
 import { getToken } from '/@/utils/auth';
 import { setObjToUrlParams, deepMerge } from '/@/utils';
 import { useErrorLogStoreWithOut } from '/@/store/modules/errorLog';
@@ -58,7 +58,7 @@ const transform: AxiosTransform = {
     if (hasSuccess) {
       let successMsg = message;
 
-      if (isNull(successMsg) || isUnDef(successMsg) || isEmpty(successMsg)) {
+      if (successMsg === null || isUndefined(successMsg) || isEmpty(successMsg)) {
         successMsg = t(`sys.api.operationSuccess`);
       }
 

+ 1 - 1
src/utils/index.ts

@@ -2,7 +2,7 @@ import type { RouteLocationNormalized, RouteRecordNormalized } from 'vue-router'
 import type { App, Component } from 'vue';
 
 import { unref } from 'vue';
-import { isArray, isObject } from '/@/utils/is';
+import { isArray, isObject } from '@vben/shared';
 import { cloneDeep, isEqual, mergeWith, unionWith } from 'lodash-es';
 
 export const noop = () => {};

+ 0 - 98
src/utils/is.ts

@@ -1,98 +0,0 @@
-const toString = Object.prototype.toString;
-
-export function is(val: unknown, type: string) {
-  return toString.call(val) === `[object ${type}]`;
-}
-
-export function isDef<T = unknown>(val?: T): val is T {
-  return typeof val !== 'undefined';
-}
-
-export function isUnDef<T = unknown>(val?: T): val is T {
-  return !isDef(val);
-}
-
-export function isObject(val: any): val is Record<any, any> {
-  return val !== null && is(val, 'Object');
-}
-
-export function isEmpty<T = unknown>(val: T): val is T {
-  if (isArray(val) || isString(val)) {
-    return val.length === 0;
-  }
-
-  if (val instanceof Map || val instanceof Set) {
-    return val.size === 0;
-  }
-
-  if (isObject(val)) {
-    return Object.keys(val).length === 0;
-  }
-
-  return false;
-}
-
-export function isDate(val: unknown): val is Date {
-  return is(val, 'Date');
-}
-
-export function isNull(val: unknown): val is null {
-  return val === null;
-}
-
-export function isNullAndUnDef(val: unknown): val is null | undefined {
-  return isUnDef(val) && isNull(val);
-}
-
-export function isNullOrUnDef(val: unknown): val is null | undefined {
-  return isUnDef(val) || isNull(val);
-}
-
-export function isNumber(val: unknown): val is number {
-  return is(val, 'Number');
-}
-
-export function isPromise<T = any>(val: unknown): val is Promise<T> {
-  return is(val, 'Promise') && isObject(val) && isFunction(val.then) && isFunction(val.catch);
-}
-
-export function isString(val: unknown): val is string {
-  return is(val, 'String');
-}
-
-export function isFunction(val: unknown): val is Function {
-  return typeof val === 'function';
-}
-
-export function isBoolean(val: unknown): val is boolean {
-  return is(val, 'Boolean');
-}
-
-export function isRegExp(val: unknown): val is RegExp {
-  return is(val, 'RegExp');
-}
-
-export function isArray(val: any): val is Array<any> {
-  return val && Array.isArray(val);
-}
-
-export function isWindow(val: any): val is Window {
-  return typeof window !== 'undefined' && is(val, 'Window');
-}
-
-export function isElement(val: unknown): val is Element {
-  return isObject(val) && !!val.tagName;
-}
-
-export function isMap(val: unknown): val is Map<any, any> {
-  return is(val, 'Map');
-}
-
-export const isServer = typeof window === 'undefined';
-
-export const isClient = !isServer;
-
-export function isUrl(path: string): boolean {
-  const reg = /^http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?/;
-  return reg.test(path);
-}

+ 2 - 1
src/utils/props.ts

@@ -1,7 +1,8 @@
 // copy from element-plus
 
 import { warn } from 'vue';
-import { fromPairs, isObject } from 'lodash-es';
+import { fromPairs } from 'lodash-es';
+import { isObject } from '@vben/shared';
 import type { ExtractPropTypes, PropType } from 'vue';
 import type { Mutable } from './types';
 

+ 2 - 1
src/views/demo/tree/index.vue

@@ -60,7 +60,8 @@
   import { PageWrapper } from '/@/components/Page';
   import { Card, Row, Col, Spin } from 'ant-design-vue';
   import { cloneDeep, uniq } from 'lodash-es';
-  import { isArray } from '/@/utils/is';
+  import { isArray } from '@vben/shared';
+  import { type Nullable } from '@vben/types';
 
   export default defineComponent({
     components: { BasicTree, PageWrapper, Card, Row, Col, Spin },

+ 1 - 1
src/views/form-design/components/VFormDesign/components/FormItemColumnProps.vue

@@ -28,7 +28,7 @@
   import { Empty, Input, Form, FormItem, Switch, Checkbox, Select, Slider } from 'ant-design-vue';
   import RuleProps from './RuleProps.vue';
   import { useFormDesignState } from '../../../hooks/useFormDesignState';
-  import { isArray } from 'lodash-es';
+  import { isArray } from '@vben/shared';
 
   export default defineComponent({
     name: 'FormItemProps',

Some files were not shown because too many files changed in this diff