mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-26 00:26:20 +08:00
Compare commits
4 Commits
v2.10.0
...
v3.0.0-alp
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6ec0a01de7 | ||
![]() |
4cddaee88a | ||
![]() |
70e44af191 | ||
![]() |
82eaf1a74b |
@@ -2,6 +2,7 @@ dist
|
||||
.local
|
||||
.output.js
|
||||
node_modules
|
||||
.nvmrc
|
||||
|
||||
**/*.svg
|
||||
**/*.sh
|
||||
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -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
|
||||
|
@@ -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',
|
||||
{
|
||||
|
@@ -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'] },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@@ -46,7 +46,7 @@
|
||||
"picocolors": "^1.0.0",
|
||||
"pkg-types": "^1.0.2",
|
||||
"rollup-plugin-visualizer": "^5.9.0",
|
||||
"sass": "^1.60.0",
|
||||
"sass": "^1.61.0",
|
||||
"unocss": "^0.50.6",
|
||||
"unplugin-vue-define-options": "^1.3.3",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
|
@@ -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,6 +1,6 @@
|
||||
{
|
||||
"name": "vben-admin",
|
||||
"version": "2.10.0",
|
||||
"version": "3.0.0-alpha.1",
|
||||
"homepage": "https://github.com/vbenjs/vue-vben-admin",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vbenjs/vue-vben-admin/issues"
|
||||
@@ -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",
|
||||
|
@@ -1,9 +1,21 @@
|
||||
import { type Recordable } from '@vben/types';
|
||||
import { getCurrentInstance, reactive, shallowRef, watchEffect } from 'vue';
|
||||
import { getCurrentInstance, reactive, type ShallowRef, shallowRef, watchEffect } from 'vue';
|
||||
|
||||
interface UseAttrsOptions {
|
||||
/**
|
||||
* 排除监听事件
|
||||
* @default false
|
||||
*/
|
||||
excludeListeners?: boolean;
|
||||
/**
|
||||
* 排除部分对象 key值
|
||||
* @default []
|
||||
*/
|
||||
excludeKeys?: string[];
|
||||
/**
|
||||
* 排除默认值 key 值 ['class', 'style']
|
||||
* @default true
|
||||
*/
|
||||
excludeDefaultKeys?: boolean;
|
||||
}
|
||||
|
||||
@@ -14,12 +26,19 @@ function entries<T>(obj: Recordable<T>): [string, T][] {
|
||||
return Object.keys(obj).map((key: string) => [key, obj[key]]);
|
||||
}
|
||||
|
||||
function useAttrs(options: UseAttrsOptions = {}): Recordable<any> {
|
||||
/**
|
||||
* 获取当前组件的 Attrs 属性
|
||||
* @param UseAttrsOptions
|
||||
*/
|
||||
function useAttrs<T = any>(options: UseAttrsOptions = {}): ShallowRef<Recordable<T>> {
|
||||
const instance = getCurrentInstance();
|
||||
if (!instance) return {};
|
||||
const attrs = shallowRef({});
|
||||
|
||||
if (!instance) {
|
||||
return attrs;
|
||||
}
|
||||
|
||||
const { excludeListeners = false, excludeKeys = [], excludeDefaultKeys = true } = options;
|
||||
const attrs = shallowRef({});
|
||||
const allExcludeKeys = excludeKeys.concat(excludeDefaultKeys ? DEFAULT_EXCLUDE_KEYS : []);
|
||||
|
||||
// Since attrs are not reactive, make it reactive instead of doing in `onUpdated` hook for better performance
|
||||
|
@@ -1,9 +1,19 @@
|
||||
import type { Ref } from 'vue';
|
||||
import { onBeforeUpdate, shallowRef } from 'vue';
|
||||
import { type ComponentPublicInstance, onBeforeUpdate, type Ref, shallowRef } from 'vue';
|
||||
|
||||
type SetRefsFunctionRef = Element | ComponentPublicInstance | null;
|
||||
|
||||
interface SetRefsFunction {
|
||||
(ref: SetRefsFunctionRef, refs: Record<string, any>): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于模版循环获取 refs
|
||||
* <div :ref="setRefs(index)"></div>
|
||||
* @returns
|
||||
*/
|
||||
function useRefs(): {
|
||||
refs: Ref<HTMLElement[]>;
|
||||
setRefs: (index: number) => (el: HTMLElement) => void;
|
||||
setRefs: (index: number) => SetRefsFunction;
|
||||
} {
|
||||
const refs = shallowRef([]) as Ref<HTMLElement[]>;
|
||||
|
||||
@@ -11,8 +21,8 @@ function useRefs(): {
|
||||
refs.value = [];
|
||||
});
|
||||
|
||||
const setRefs = (index: number) => (el: HTMLElement) => {
|
||||
refs.value[index] = el;
|
||||
const setRefs = (index: number) => (ref: SetRefsFunctionRef, refs: Record<string, any>) => {
|
||||
refs.value[index] = ref;
|
||||
};
|
||||
|
||||
return {
|
||||
|
@@ -1,10 +1,23 @@
|
||||
import { shallowRef, unref } from 'vue';
|
||||
|
||||
interface UseScrollToOptions {
|
||||
el: any;
|
||||
/**
|
||||
* 需要滚动的 el dom节点
|
||||
*/
|
||||
el: HTMLElement;
|
||||
/**
|
||||
* 滚动的目标值
|
||||
*/
|
||||
to: number;
|
||||
/**
|
||||
* 滚动时间
|
||||
*/
|
||||
duration?: number;
|
||||
callback?: () => any;
|
||||
/**
|
||||
* 执行完成之后的回调函数
|
||||
* @returns
|
||||
*/
|
||||
callback?: () => void;
|
||||
}
|
||||
|
||||
function easeInOutQuad(t: number, b: number, c: number, d: number) {
|
||||
@@ -20,12 +33,14 @@ function move(el: HTMLElement, amount: number) {
|
||||
el.scrollTop = amount;
|
||||
}
|
||||
|
||||
const position = (el: HTMLElement) => {
|
||||
return el.scrollTop;
|
||||
};
|
||||
/**
|
||||
* dom节点滚动到指定位置
|
||||
* @param UseScrollToOptions
|
||||
* @returns
|
||||
*/
|
||||
function useScrollTo({ el, to, duration = 500, callback }: UseScrollToOptions) {
|
||||
const isActiveRef = shallowRef(false);
|
||||
const start = position(el);
|
||||
const start = el.scrollTop;
|
||||
const change = to - start;
|
||||
const increment = 20;
|
||||
let currentTime = 0;
|
||||
@@ -40,11 +55,10 @@ function useScrollTo({ el, to, duration = 500, callback }: UseScrollToOptions) {
|
||||
if (currentTime < duration && unref(isActiveRef)) {
|
||||
requestAnimationFrame(animateScroll);
|
||||
} else {
|
||||
if (callback && typeof callback === 'function') {
|
||||
callback();
|
||||
}
|
||||
callback?.();
|
||||
}
|
||||
};
|
||||
|
||||
const run = () => {
|
||||
isActiveRef.value = true;
|
||||
animateScroll();
|
||||
|
@@ -2,19 +2,31 @@ import { type AnyFunction } from '@vben/types';
|
||||
import { tryOnMounted, tryOnUnmounted, useDebounceFn } from '@vueuse/core';
|
||||
|
||||
interface UseWindowSizeOptions {
|
||||
/**
|
||||
* 节流时间
|
||||
* @default 150
|
||||
*/
|
||||
wait?: number;
|
||||
once?: boolean;
|
||||
/**
|
||||
* 立即执行
|
||||
* @default false
|
||||
*/
|
||||
immediate?: boolean;
|
||||
listenerOptions?: AddEventListenerOptions | boolean;
|
||||
/**
|
||||
* 只执行一次
|
||||
* @default false
|
||||
*/
|
||||
once?: boolean;
|
||||
}
|
||||
|
||||
function useWindowSizeFn(fn: AnyFunction, options: UseWindowSizeOptions = {}) {
|
||||
const { wait = 150, immediate } = options;
|
||||
|
||||
let handler = () => {
|
||||
fn();
|
||||
};
|
||||
const handleSize = useDebounceFn(handler, wait);
|
||||
handler = handleSize;
|
||||
|
||||
handler = useDebounceFn(handler, wait);
|
||||
|
||||
const start = () => {
|
||||
if (immediate) {
|
||||
|
4
packages/shared/.eslintrc.js
Normal file
4
packages/shared/.eslintrc.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['@vben/eslint-config/strict'],
|
||||
};
|
10
packages/shared/build.config.ts
Normal file
10
packages/shared/build.config.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { defineBuildConfig } from 'unbuild';
|
||||
|
||||
export default defineBuildConfig({
|
||||
clean: true,
|
||||
entries: ['src/index'],
|
||||
declaration: true,
|
||||
rollup: {
|
||||
emitCJS: true,
|
||||
},
|
||||
});
|
37
packages/shared/package.json
Normal file
37
packages/shared/package.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "@vben/shared",
|
||||
"version": "1.0.0",
|
||||
"homepage": "https://github.com/vbenjs/vue-vben-admin",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vbenjs/vue-vben-admin/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
|
||||
"directory": "packages/hooks"
|
||||
},
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"default": "./src/index.ts"
|
||||
}
|
||||
},
|
||||
"main": "./src/index.ts",
|
||||
"module": "./src/index.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"//build": "pnpm unbuild",
|
||||
"//stub": "pnpm unbuild --stub",
|
||||
"clean": "pnpm rimraf .turbo node_modules dist",
|
||||
"lint": "pnpm eslint ."
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.2.47"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/shared": "^3.2.47"
|
||||
}
|
||||
}
|
1
packages/shared/src/index.ts
Normal file
1
packages/shared/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './types';
|
75
packages/shared/src/types.ts
Normal file
75
packages/shared/src/types.ts
Normal file
@@ -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,
|
||||
};
|
5
packages/shared/tsconfig.json
Normal file
5
packages/shared/tsconfig.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"extends": "@vben/ts-config/vue-app.json",
|
||||
"include": ["src"]
|
||||
}
|
@@ -27,5 +27,8 @@
|
||||
"//stub": "pnpm unbuild --stub",
|
||||
"clean": "pnpm rimraf .turbo node_modules dist",
|
||||
"lint": "pnpm eslint ."
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.2.47"
|
||||
}
|
||||
}
|
||||
|
@@ -1 +1 @@
|
||||
export * from './utils';
|
||||
export * from './tools';
|
||||
|
@@ -1,17 +1,22 @@
|
||||
import { type ComputedRef, type Ref } from 'vue';
|
||||
|
||||
/**
|
||||
* 任意类型的异步函数
|
||||
*/
|
||||
type AnyPromiseFunction = (...arg: any[]) => PromiseLike<any>;
|
||||
|
||||
type AnyPromiseFunction<T extends any[] = any[], R = void> = (...arg: T) => PromiseLike<R>;
|
||||
|
||||
/**
|
||||
* 任意类型的普通函数
|
||||
*/
|
||||
type AnyNormalFunction = (...arg: any[]) => any;
|
||||
type AnyNormalFunction<T extends any[] = any[], R = void> = (...arg: T) => R;
|
||||
|
||||
/**
|
||||
* 任意类型的函数
|
||||
*/
|
||||
type AnyFunction = AnyNormalFunction | AnyPromiseFunction;
|
||||
type AnyFunction<T extends any[] = any[], R = void> =
|
||||
| AnyNormalFunction<T, R>
|
||||
| AnyPromiseFunction<T, R>;
|
||||
|
||||
/**
|
||||
* T | null 包装
|
||||
@@ -45,11 +50,32 @@ type TimeoutHandle = ReturnType<typeof setTimeout>;
|
||||
*/
|
||||
type IntervalHandle = ReturnType<typeof setInterval>;
|
||||
|
||||
/**
|
||||
* 也许它是一个Ref,或者一个普通的值
|
||||
*
|
||||
*/
|
||||
type MaybeRef<T> = T | Ref<T>;
|
||||
|
||||
/**
|
||||
* 也许它是一个 ref,或者一个普通值,或者一个 getter 函数
|
||||
*
|
||||
*/
|
||||
type MaybeComputedRef<T> = MaybeReadonlyRef<T> | MaybeRef<T>;
|
||||
|
||||
/**
|
||||
* 也许它是一个计算的 ref,或者一个 getter 函数
|
||||
*
|
||||
*/
|
||||
type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T>;
|
||||
|
||||
export {
|
||||
type AnyFunction,
|
||||
type AnyNormalFunction,
|
||||
type AnyPromiseFunction,
|
||||
type IntervalHandle,
|
||||
type MaybeComputedRef,
|
||||
type MaybeReadonlyRef,
|
||||
type MaybeRef,
|
||||
type NonNullable,
|
||||
type Nullable,
|
||||
type ReadonlyRecordable,
|
57
pnpm-lock.yaml
generated
57
pnpm-lock.yaml
generated
@@ -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
|
||||
@@ -229,7 +232,7 @@ importers:
|
||||
version: 1.3.3(rollup@2.79.1)(vue@3.2.47)
|
||||
vite:
|
||||
specifier: ^4.3.0-beta.2
|
||||
version: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.60.0)
|
||||
version: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.61.0)
|
||||
vite-plugin-mock:
|
||||
specifier: ^2.9.6
|
||||
version: 2.9.6(mockjs@1.1.0)(rollup@2.79.1)(vite@4.3.0-beta.2)
|
||||
@@ -386,7 +389,7 @@ importers:
|
||||
version: 1.3.3(rollup@2.79.1)(vue@3.2.47)
|
||||
vite:
|
||||
specifier: ^4.3.0-beta.2
|
||||
version: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.60.0)
|
||||
version: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.61.0)
|
||||
|
||||
internal/vite-config:
|
||||
dependencies:
|
||||
@@ -395,7 +398,7 @@ importers:
|
||||
version: 7.0.0
|
||||
vite:
|
||||
specifier: ^4.3.0-beta.2
|
||||
version: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.60.0)
|
||||
version: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.61.0)
|
||||
devDependencies:
|
||||
'@types/fs-extra':
|
||||
specifier: ^11.0.1
|
||||
@@ -431,8 +434,8 @@ importers:
|
||||
specifier: ^5.9.0
|
||||
version: 5.9.0(rollup@2.79.1)
|
||||
sass:
|
||||
specifier: ^1.60.0
|
||||
version: 1.60.0
|
||||
specifier: ^1.61.0
|
||||
version: 1.61.0
|
||||
unocss:
|
||||
specifier: ^0.50.6
|
||||
version: 0.50.6(postcss@8.4.21)(rollup@2.79.1)(vite@4.3.0-beta.2)
|
||||
@@ -471,7 +474,21 @@ importers:
|
||||
specifier: workspace:*
|
||||
version: link:../types
|
||||
|
||||
packages/types: {}
|
||||
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:
|
||||
vue:
|
||||
specifier: ^3.2.47
|
||||
version: 3.2.47
|
||||
|
||||
packages:
|
||||
|
||||
@@ -2378,7 +2395,7 @@ packages:
|
||||
chokidar: 3.5.3
|
||||
fast-glob: 3.2.12
|
||||
magic-string: 0.30.0
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.60.0)
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.61.0)
|
||||
transitivePeerDependencies:
|
||||
- rollup
|
||||
dev: true
|
||||
@@ -2393,7 +2410,7 @@ packages:
|
||||
'@babel/core': 7.21.4
|
||||
'@babel/plugin-transform-typescript': 7.21.3(@babel/core@7.21.4)
|
||||
'@vue/babel-plugin-jsx': 1.1.1(@babel/core@7.21.4)
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.60.0)
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.61.0)
|
||||
vue: 3.2.47
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@@ -2406,7 +2423,7 @@ packages:
|
||||
vite: ^4.0.0
|
||||
vue: ^3.2.25
|
||||
dependencies:
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.60.0)
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.61.0)
|
||||
vue: 3.2.47
|
||||
dev: true
|
||||
|
||||
@@ -8089,9 +8106,9 @@ packages:
|
||||
/safer-buffer@2.1.2:
|
||||
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
|
||||
|
||||
/sass@1.60.0:
|
||||
resolution: {integrity: sha512-updbwW6fNb5gGm8qMXzVO7V4sWf7LMXnMly/JEyfbfERbVH46Fn6q02BX7/eHTdKpE7d+oTkMMQpFWNUMfFbgQ==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
/sass@1.61.0:
|
||||
resolution: {integrity: sha512-PDsN7BrVkNZK2+dj/dpKQAWZavbAQ87IXqVvw2+oEYI+GwlTWkvbQtL7F2cCNbMqJEYKPh1EcjSxsnqIb/kyaQ==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
chokidar: 3.5.3
|
||||
@@ -9558,7 +9575,7 @@ packages:
|
||||
chalk: 4.1.2
|
||||
debug: 4.3.4
|
||||
fs-extra: 10.1.0
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.60.0)
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.61.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
@@ -9579,7 +9596,7 @@ packages:
|
||||
kolorist: 1.7.0
|
||||
magic-string: 0.29.0
|
||||
ts-morph: 17.0.1
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.60.0)
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.61.0)
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- rollup
|
||||
@@ -9603,7 +9620,7 @@ packages:
|
||||
html-minifier-terser: 6.1.0
|
||||
node-html-parser: 5.4.2
|
||||
pathe: 0.2.0
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.60.0)
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.61.0)
|
||||
dev: true
|
||||
|
||||
/vite-plugin-mock@2.9.6(mockjs@1.1.0)(rollup@2.79.1)(vite@4.3.0-beta.2):
|
||||
@@ -9623,7 +9640,7 @@ packages:
|
||||
fast-glob: 3.2.12
|
||||
mockjs: 1.1.0
|
||||
path-to-regexp: 6.2.1
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.60.0)
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.61.0)
|
||||
transitivePeerDependencies:
|
||||
- rollup
|
||||
- supports-color
|
||||
@@ -9638,7 +9655,7 @@ packages:
|
||||
'@purge-icons/core': 0.9.1
|
||||
'@purge-icons/generated': 0.9.0
|
||||
rollup-plugin-purge-icons: 0.9.1
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.60.0)
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.61.0)
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- supports-color
|
||||
@@ -9657,12 +9674,12 @@ packages:
|
||||
pathe: 0.2.0
|
||||
svg-baker: 1.7.0
|
||||
svgo: 2.8.0
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.60.0)
|
||||
vite: 4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.61.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/vite@4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.60.0):
|
||||
/vite@4.3.0-beta.2(@types/node@18.15.11)(less@4.1.3)(sass@1.61.0):
|
||||
resolution: {integrity: sha512-RRghM7RiRnwknCG3hS+NE8C+N3CNX4yKfVhFxO3NqrtYErN6htac//De9IwIHWqgV8DdKoNPeK8Yb/FOlZvjoQ==}
|
||||
engines: {node: ^14.18.0 || >=16.0.0}
|
||||
hasBin: true
|
||||
@@ -9693,7 +9710,7 @@ packages:
|
||||
postcss: 8.4.21
|
||||
resolve: 1.22.1
|
||||
rollup: 3.20.2
|
||||
sass: 1.60.0
|
||||
sass: 1.61.0
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.2
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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';
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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({
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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 = {
|
||||
|
@@ -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 },
|
||||
|
@@ -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 };
|
||||
|
@@ -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';
|
||||
|
||||
|
@@ -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';
|
||||
|
@@ -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';
|
||||
|
@@ -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;
|
||||
|
@@ -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[] = [];
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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';
|
||||
|
@@ -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';
|
||||
|
@@ -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 (
|
||||
|
@@ -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';
|
||||
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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';
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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,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(() => {
|
||||
|
@@ -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';
|
||||
|
@@ -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;
|
||||
|
@@ -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';
|
||||
|
@@ -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),
|
||||
|
@@ -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';
|
||||
|
@@ -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;
|
||||
|
@@ -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,4 +1,4 @@
|
||||
import { isString } from '/@/utils/is';
|
||||
import { isString } from '@vben/shared';
|
||||
import { RenderQrCodeParams, LogoType } from './typing';
|
||||
|
||||
export const drawLogo = ({ canvas, logo }: RenderQrCodeParams) => {
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
},
|
||||
|
@@ -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({
|
||||
|
@@ -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';
|
||||
|
||||
|
@@ -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}`;
|
||||
});
|
||||
|
@@ -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',
|
||||
|
@@ -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';
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -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';
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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,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';
|
||||
|
@@ -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>,
|
||||
|
@@ -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,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,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) {
|
||||
|
@@ -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;
|
||||
|
@@ -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,
|
||||
|
@@ -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,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 }) => {
|
||||
|
@@ -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,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({
|
||||
|
@@ -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';
|
||||
|
@@ -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 },
|
||||
|
@@ -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,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(
|
||||
|
@@ -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 高度作为判断补偿高度的条件
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -1,46 +0,0 @@
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
|
||||
interface ScriptOptions {
|
||||
src: string;
|
||||
}
|
||||
|
||||
export function useScript(opts: ScriptOptions) {
|
||||
const isLoading = ref(false);
|
||||
const error = ref(false);
|
||||
const success = ref(false);
|
||||
let script: HTMLScriptElement;
|
||||
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
onMounted(() => {
|
||||
script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.onload = function () {
|
||||
isLoading.value = false;
|
||||
success.value = true;
|
||||
error.value = false;
|
||||
resolve('');
|
||||
};
|
||||
|
||||
script.onerror = function (err) {
|
||||
isLoading.value = false;
|
||||
success.value = false;
|
||||
error.value = true;
|
||||
reject(err);
|
||||
};
|
||||
|
||||
script.src = opts.src;
|
||||
document.head.appendChild(script);
|
||||
});
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
script && script.remove();
|
||||
});
|
||||
|
||||
return {
|
||||
isLoading,
|
||||
error,
|
||||
success,
|
||||
toPromise: () => promise,
|
||||
};
|
||||
}
|
@@ -26,7 +26,7 @@ export function useTitle() {
|
||||
return;
|
||||
}
|
||||
|
||||
const tTitle = t(route?.meta?.title as string);
|
||||
const tTitle = t(route?.meta?.title ?? '');
|
||||
pageTitle.value = tTitle ? ` ${tTitle} - ${title} ` : `${title}`;
|
||||
},
|
||||
{ immediate: true },
|
||||
|
@@ -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`;
|
||||
}
|
||||
}
|
||||
|
@@ -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';
|
||||
|
||||
|
@@ -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,
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,5 @@
|
||||
export default {
|
||||
charts: {
|
||||
baiduMap: 'Baidu map',
|
||||
aMap: 'A map',
|
||||
googleMap: 'Google map',
|
||||
charts: 'Chart',
|
||||
map: 'Map',
|
||||
line: 'Line',
|
||||
|
@@ -1,8 +1,5 @@
|
||||
export default {
|
||||
charts: {
|
||||
baiduMap: '百度地图',
|
||||
aMap: '高德地图',
|
||||
googleMap: '谷歌地图',
|
||||
charts: '图表',
|
||||
map: '地图',
|
||||
line: '折线图',
|
||||
|
@@ -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}`;
|
||||
|
@@ -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);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user