【v7.3】路由支持动态参数、优化编译方式

This commit is contained in:
神仙都没用 2024-10-18 16:48:08 +08:00
parent 254b444f22
commit 32c5e4bc39
348 changed files with 11537 additions and 10363 deletions

View File

@ -1,8 +1,4 @@
# 🎨 editorconfig.org
root = true
[*]
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}]
charset = utf-8
end_of_line = lf
indent_style = tab

View File

@ -1,3 +0,0 @@
packages/
dist/
node_modules/

View File

@ -1,47 +0,0 @@
/* eslint-env node */
require("@rushstack/eslint-patch/modern-module-resolution");
module.exports = {
root: true,
extends: [
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/eslint-config-typescript",
"@vue/eslint-config-prettier/skip-formatting"
],
parserOptions: {
ecmaVersion: "latest"
},
rules: {
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-empty-function": "off",
"vue/no-mutating-props": "off",
"vue/component-name-in-template-casing": ["error", "kebab-case"],
"vue/component-definition-name-casing": ["error", "kebab-case"],
"no-use-before-define": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-unused-vars": "off",
"space-before-function-paren": "off",
"vue/attributes-order": "off",
"vue/one-component-per-file": "off",
"vue/html-closing-bracket-newline": "off",
"vue/max-attributes-per-line": "off",
"vue/multiline-html-element-content-newline": "off",
"vue/multi-word-component-names": "off",
"vue/singleline-html-element-content-newline": "off",
"vue/attribute-hyphenation": "off",
"vue/html-self-closing": "off",
"vue/require-default-prop": "off",
"vue/v-on-event-hyphenation": "off",
"no-self-assign": "off"
}
};

View File

@ -1,8 +0,0 @@
{
"tabWidth": 4,
"useTabs": true,
"semi": true,
"singleQuote": false,
"printWidth": 100,
"trailingComma": "none"
}

10
.prettierrc.json Normal file
View File

@ -0,0 +1,10 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": true,
"useTabs": true,
"tabWidth": 4,
"printWidth": 100,
"singleQuote": true,
"arrowParens": "avoid",
"trailingComma": "none"
}

8
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,8 @@
{
"recommendations": [
"Vue.volar",
"vitest.explorer",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}

10
.vscode/settings.json vendored
View File

@ -1,4 +1,14 @@
{
"editor.cursorSmoothCaretAnimation": "on",
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"tsconfig.json": "tsconfig.*.json, env.d.ts",
"vite.config.*": "jsconfig*, vitest.config.*, cypress.config.*, playwright.config.*",
"package.json": "package-lock.json, pnpm*, .yarnrc*, yarn*, .eslint*, eslint*, .prettier*, prettier*, .editorconfig"
},
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}

View File

73
eslint.config.js Normal file
View File

@ -0,0 +1,73 @@
import pluginVue from 'eslint-plugin-vue';
import vueTsEslintConfig from '@vue/eslint-config-typescript';
import prettier from 'eslint-plugin-prettier';
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';
export default [
{
name: 'app/files-to-lint',
files: ['**/*.{ts,mts,tsx,vue}'],
},
{
name: 'app/files-to-ignore',
ignores: [
'**/dist/**',
'**/dist-ssr/**',
'**/coverage/**',
'**/packages/**',
'**/build/**',
],
},
...pluginVue.configs['flat/recommended'],
...vueTsEslintConfig(),
skipFormatting,
{
languageOptions: {
parserOptions: {
ecmaVersion: 2020,
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'space-before-function-paren': 'off',
'no-unused-vars': 'off',
'no-use-before-define': 'off',
'no-self-assign': 'off',
'vue/no-mutating-props': 'off',
'vue/no-template-shadow': 'off',
'vue/no-v-html': 'off',
'vue/component-name-in-template-casing': ['error', 'kebab-case'],
'vue/component-definition-name-casing': ['error', 'kebab-case'],
'vue/attributes-order': 'off',
'vue/one-component-per-file': 'off',
'vue/html-closing-bracket-newline': 'off',
'vue/max-attributes-per-line': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/multi-word-component-names': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/attribute-hyphenation': 'off',
'vue/html-self-closing': 'off',
'vue/require-default-prop': 'off',
'vue/v-on-event-hyphenation': 'off',
'vue/block-lang': 'off',
},
},
];

View File

@ -1,64 +1,75 @@
{
"name": "cool-admin",
"version": "7.2.0",
"version": "7.3.0",
"type": "module",
"scripts": {
"dev": "vite --host",
"build": "vite build",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"format": "prettier --write src/",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .eslintignore"
"build-only": "vite build",
"type-check": "vue-tsc --build --force",
"lint": "eslint . --fix",
"format": "prettier --write src/"
},
"dependencies": {
"@cool-vue/crud": "^7.2.2",
"@element-plus/icons-vue": "^2.3.1",
"@vueuse/core": "^10.4.0",
"@vueuse/core": "^11.1.0",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12",
"axios": "^1.7.2",
"axios": "^1.7.7",
"chardet": "^2.0.0",
"core-js": "^3.32.1",
"dayjs": "^1.11.10",
"echarts": "^5.4.3",
"element-plus": "^2.8.3",
"core-js": "^3.38.1",
"dayjs": "^1.11.13",
"echarts": "^5.5.1",
"element-plus": "^2.8.4",
"file-saver": "^2.0.5",
"lodash-es": "^4.17.21",
"marked": "^11.1.1",
"marked": "^14.1.3",
"mitt": "^3.0.1",
"mockjs": "^1.1.0",
"monaco-editor": "0.49.0",
"monaco-editor": "0.52.0",
"nprogress": "^0.2.0",
"pinia": "^2.1.7",
"socket.io-client": "^4.7.2",
"pinia": "^2.2.4",
"socket.io-client": "^4.8.0",
"store": "^2.0.12",
"vue": "^3.5.6",
"vue-echarts": "^6.6.1",
"vue-router": "^4.4.0",
"vue": "^3.5.12",
"vue-echarts": "^7.0.3",
"vue-router": "^4.4.5",
"vuedraggable": "^4.1.0",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@cool-vue/vite-plugin": "^7.2.4",
"@rushstack/eslint-patch": "^1.8.0",
"@rushstack/eslint-patch": "^1.10.4",
"@tsconfig/node20": "^20.1.4",
"@types/file-saver": "^2.0.7",
"@types/lodash-es": "^4.17.8",
"@types/mockjs": "^1.0.7",
"@types/node": "^20.14.5",
"@types/nprogress": "^0.2.0",
"@types/store": "^2.0.2",
"@types/jsdom": "^21.1.7",
"@types/lodash-es": "^4.17.12",
"@types/mockjs": "^1.0.10",
"@types/node": "^20.16.11",
"@types/nprogress": "^0.2.3",
"@types/store": "^2.0.5",
"@vitejs/plugin-vue": "^5.1.4",
"@vitejs/plugin-vue-jsx": "^4.0.1",
"@vue/compiler-sfc": "^3.5.6",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.23.0",
"@vue/compiler-sfc": "^3.5.12",
"@vue/eslint-config-prettier": "^10.0.0",
"@vue/eslint-config-typescript": "^14.0.1",
"@vue/test-utils": "^2.4.6",
"@vue/tsconfig": "^0.5.1",
"eslint": "^9.12.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-vue": "^9.29.0",
"jsdom": "^25.0.1",
"npm-run-all2": "^6.2.3",
"prettier": "^3.3.3",
"rollup-plugin-visualizer": "^5.9.2",
"sass": "^1.53.0",
"terser": "^5.27.0",
"typescript": "^5.4.0",
"vite": "^5.3.4",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.77.0",
"terser": "^5.36.0",
"typescript": "~5.5.4",
"vite": "^5.4.8",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-vue-devtools": "^7.3.1"
"vite-plugin-vue-devtools": "^7.5.2",
"vue-tsc": "^2.1.6"
}
}

View File

@ -307,7 +307,7 @@ declare namespace ClTable {
search: {
isInput: boolean;
value: any;
refreshOnChange: Boolean;
refreshOnChange: boolean;
component: Render.Component;
};
dict: DictOptions | Vue.Ref<DictOptions>;

View File

@ -54,7 +54,7 @@ export function useForm() {
() => form,
(val) => {
if (config.on?.change) {
for (let i in val) {
for (const i in val) {
if (form[i] !== oldForm.value[i]) {
config.on?.change(val, i);
}

View File

@ -1,6 +1,17 @@
import { useConfig, useCore, useForm } from "../../hooks";
import { isEmpty, keys } from "lodash-es";
import { onMounted, PropType, defineComponent, ref, h, reactive, inject, mergeProps, watch, watchEffect } from "vue";
import {
onMounted,
PropType,
defineComponent,
ref,
h,
reactive,
inject,
mergeProps,
watch,
watchEffect
} from "vue";
import { useApi } from "../form/helper";
export default defineComponent({
@ -132,7 +143,7 @@ export default defineComponent({
config.onLoad?.(data);
},
change(data, prop) {
config.onChange?.(data, prop)
config.onChange?.(data, prop);
}
}
});

View File

@ -142,7 +142,7 @@ export function useRender() {
}
// 插槽 empty
function renderEmpty(emptyText: String) {
function renderEmpty(emptyText: string) {
return (
<div class="cl-table__empty">
{slots.empty ? (

View File

@ -100,7 +100,7 @@ function parse(method: "submit" | "bind", { value, hook: pipe, form, prop }: any
} else if (isArray(pipe)) {
pipes = pipe;
} else if (isObject(pipe)) {
// @ts-ignore
// @ts-expect-error
pipes = isArray(pipe[method]) ? pipe[method] : [pipe[method]];
} else if (isFunction(pipe)) {
pipes = [pipe];

View File

@ -10,7 +10,7 @@ class Mitt {
}
send(type: "emit" | "off" | "on", name: string, ...args: any[]) {
// @ts-ignore
// @ts-expect-error
mitt[type](`${this.id}__${name}`, ...args);
}

View File

@ -1,2 +1,17 @@
declare const _default: import("vue").DefineComponent<{}, () => false | JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
declare const _default: import("vue").DefineComponent<
{},
() => false | JSX.Element,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<import("vue").ExtractPropTypes<{}>>,
{}
>;
export default _default;

View File

@ -1,2 +1,23 @@
declare const _default: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
declare const _default: import("vue").DefineComponent<
{},
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").PublicProps,
Readonly<{}> & Readonly<{}>,
{},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,2 +1,17 @@
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
declare const _default: import("vue").DefineComponent<
{},
() => JSX.Element,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<import("vue").ExtractPropTypes<{}>>,
{}
>;
export default _default;

View File

@ -1,6 +1,7 @@
/// <reference types="../index" />
import { PropType } from "vue";
declare const _default: import("vue").DefineComponent<{
declare const _default: import("vue").DefineComponent<
{
items: {
type: PropType<ClForm.Item[]>;
default: () => never[];
@ -15,7 +16,8 @@ declare const _default: import("vue").DefineComponent<{
default: () => string[];
};
onSearch: FunctionConstructor;
}, {
},
{
open: () => void;
close: () => void;
reset: () => void;
@ -24,7 +26,19 @@ declare const _default: import("vue").DefineComponent<{
Drawer: import("vue").Ref<any>;
Form: import("vue").Ref<ClForm.Ref | undefined>;
visible: import("vue").Ref<boolean>;
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("clear" | "reset")[], "clear" | "reset", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
},
unknown,
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
("clear" | "reset")[],
"clear" | "reset",
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<
import("vue").ExtractPropTypes<{
items: {
type: PropType<ClForm.Item[]>;
default: () => never[];
@ -39,12 +53,15 @@ declare const _default: import("vue").DefineComponent<{
default: () => string[];
};
onSearch: FunctionConstructor;
}>> & {
}>
> & {
onReset?: ((...args: any[]) => any) | undefined;
onClear?: ((...args: any[]) => any) | undefined;
}, {
},
{
items: ClForm.Item[];
op: unknown[];
size: string | number;
}>;
}
>;
export default _default;

View File

@ -1,4 +1,48 @@
declare const _default: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {
Search: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
declare const _default: import("vue").DefineComponent<
{},
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").PublicProps,
Readonly<{}> & Readonly<{}>,
{},
{},
{
Search: import("vue").DefineComponent<
{},
{},
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<import("vue").ExtractPropTypes<{}>>,
{},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,6 +1,7 @@
/// <reference types="../index" />
import { PropType } from "vue";
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
declare const _default: import("vue").DefineComponent<
import("vue").ExtractPropTypes<{
items: {
type: PropType<ClForm.Item<any>[]>;
default: () => never[];
@ -15,7 +16,18 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
default: () => string[];
};
onSearch: FunctionConstructor;
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("clear" | "reset")[], "clear" | "reset", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
}>,
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
("clear" | "reset")[],
"clear" | "reset",
import("vue").PublicProps,
Readonly<
import("vue").ExtractPropTypes<{
items: {
type: PropType<ClForm.Item<any>[]>;
default: () => never[];
@ -30,14 +42,49 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
default: () => string[];
};
onSearch: FunctionConstructor;
}>> & Readonly<{
}>
> &
Readonly<{
onReset?: ((...args: any[]) => any) | undefined;
onClear?: ((...args: any[]) => any) | undefined;
}>, {
}>,
{
size: string | number;
items: ClForm.Item<any>[];
op: unknown[];
}, {}, {
Close: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
},
{},
{
Close: import("vue").DefineComponent<
{},
{},
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<import("vue").ExtractPropTypes<{}>>,
{},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,6 +1,7 @@
/// <reference types="../index" />
import { type PropType } from "vue";
declare const ClContextMenu: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
declare const ClContextMenu: import("vue").DefineComponent<
import("vue").ExtractPropTypes<{
show: BooleanConstructor;
options: {
type: PropType<ClContextMenu.Options>;
@ -10,7 +11,18 @@ declare const ClContextMenu: import("vue").DefineComponent<import("vue").Extract
type: ObjectConstructor;
default: () => {};
};
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
}>,
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").PublicProps,
Readonly<
import("vue").ExtractPropTypes<{
show: BooleanConstructor;
options: {
type: PropType<ClContextMenu.Options>;
@ -20,11 +32,23 @@ declare const ClContextMenu: import("vue").DefineComponent<import("vue").Extract
type: ObjectConstructor;
default: () => {};
};
}>> & Readonly<{}>, {
}>
> &
Readonly<{}>,
{
options: ClContextMenu.Options;
show: boolean;
event: Record<string, any>;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export declare const ContextMenu: {
open(event: any, options: ClContextMenu.Options): ClContextMenu.Exposed;
};

View File

@ -1,19 +1,43 @@
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
declare const _default: import("vue").DefineComponent<
import("vue").ExtractPropTypes<{
name: StringConstructor;
border: BooleanConstructor;
padding: {
type: StringConstructor;
default: string;
};
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
}>,
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").PublicProps,
Readonly<
import("vue").ExtractPropTypes<{
name: StringConstructor;
border: BooleanConstructor;
padding: {
type: StringConstructor;
default: string;
};
}>> & Readonly<{}>, {
}>
> &
Readonly<{}>,
{
border: boolean;
padding: string;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,4 +1,5 @@
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
declare const _default: import("vue").DefineComponent<
import("vue").ExtractPropTypes<{
modelValue: {
type: BooleanConstructor;
default: boolean;
@ -29,9 +30,24 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
type: BooleanConstructor;
default: boolean;
};
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
}>,
() => import("vue").VNode<
import("vue").RendererNode,
import("vue").RendererElement,
{
[key: string]: any;
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "fullscreen-change")[], "update:modelValue" | "fullscreen-change", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
}
>,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
("update:modelValue" | "fullscreen-change")[],
"update:modelValue" | "fullscreen-change",
import("vue").PublicProps,
Readonly<
import("vue").ExtractPropTypes<{
modelValue: {
type: BooleanConstructor;
default: boolean;
@ -62,10 +78,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
type: BooleanConstructor;
default: boolean;
};
}>> & Readonly<{
}>
> &
Readonly<{
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
"onFullscreen-change"?: ((...args: any[]) => any) | undefined;
}>, {
}>,
{
title: string;
padding: string;
width: string;
@ -75,9 +94,87 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
fullscreen: boolean;
modelValue: boolean;
scrollbar: boolean;
}, {}, {
Close: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
FullScreen: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
Minus: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
},
{},
{
Close: import("vue").DefineComponent<
{},
{},
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<import("vue").ExtractPropTypes<{}>>,
{},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
FullScreen: import("vue").DefineComponent<
{},
{},
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<import("vue").ExtractPropTypes<{}>>,
{},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
Minus: import("vue").DefineComponent<
{},
{},
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<import("vue").ExtractPropTypes<{}>>,
{},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,6 +1,23 @@
declare const _default: import("vue").DefineComponent<{
declare const _default: import("vue").DefineComponent<
{
title: StringConstructor;
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
},
() => JSX.Element,
unknown,
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<
import("vue").ExtractPropTypes<{
title: StringConstructor;
}>>, {}>;
}>
>,
{}
>;
export default _default;

View File

@ -1,6 +1,30 @@
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
declare const _default: import("vue").DefineComponent<
import("vue").ExtractPropTypes<{
title: StringConstructor;
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
}>,
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").PublicProps,
Readonly<
import("vue").ExtractPropTypes<{
title: StringConstructor;
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
}>
> &
Readonly<{}>,
{},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,6 +1,7 @@
/// <reference types="../index" />
import { PropType } from "vue";
declare const _default: import("vue").DefineComponent<{
declare const _default: import("vue").DefineComponent<
{
data: {
type: ObjectConstructor;
default: () => {};
@ -14,12 +15,25 @@ declare const _default: import("vue").DefineComponent<{
default: boolean;
};
onSearch: FunctionConstructor;
}, {
},
{
Form: import("vue").Ref<ClForm.Ref | undefined>;
loading: import("vue").Ref<boolean>;
search: () => void;
reset: () => void;
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
},
unknown,
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<
import("vue").ExtractPropTypes<{
data: {
type: ObjectConstructor;
default: () => {};
@ -33,9 +47,12 @@ declare const _default: import("vue").DefineComponent<{
default: boolean;
};
onSearch: FunctionConstructor;
}>>, {
}>
>,
{
items: ClForm.Item[];
data: Record<string, any>;
resetBtn: boolean;
}>;
}
>;
export default _default;

View File

@ -1,6 +1,23 @@
declare const _default: import("vue").DefineComponent<{
declare const _default: import("vue").DefineComponent<
{
label: StringConstructor;
}, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
},
unknown,
unknown,
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<
import("vue").ExtractPropTypes<{
label: StringConstructor;
}>>, {}>;
}>
>,
{}
>;
export default _default;

View File

@ -1,6 +1,7 @@
/// <reference types="../index" />
import { PropType } from "vue";
declare const _default: import("vue").DefineComponent<{
declare const _default: import("vue").DefineComponent<
{
data: {
type: ObjectConstructor;
default: () => {};
@ -14,7 +15,20 @@ declare const _default: import("vue").DefineComponent<{
default: boolean;
};
onSearch: FunctionConstructor;
}, () => true | JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
},
() => true | JSX.Element,
unknown,
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<
import("vue").ExtractPropTypes<{
data: {
type: ObjectConstructor;
default: () => {};
@ -28,9 +42,12 @@ declare const _default: import("vue").DefineComponent<{
default: boolean;
};
onSearch: FunctionConstructor;
}>>, {
}>
>,
{
items: ClForm.Item[];
data: Record<string, any>;
resetBtn: boolean;
}>;
}
>;
export default _default;

View File

@ -1,6 +1,30 @@
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
declare const _default: import("vue").DefineComponent<
import("vue").ExtractPropTypes<{
label: StringConstructor;
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
}>,
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").PublicProps,
Readonly<
import("vue").ExtractPropTypes<{
label: StringConstructor;
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
}>
> &
Readonly<{}>,
{},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,2 +1,17 @@
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
declare const _default: import("vue").DefineComponent<
{},
() => JSX.Element,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<import("vue").ExtractPropTypes<{}>>,
{}
>;
export default _default;

View File

@ -1,2 +1,23 @@
declare const _default: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
declare const _default: import("vue").DefineComponent<
{},
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").PublicProps,
Readonly<{}> & Readonly<{}>,
{},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,4 +1,5 @@
declare const _default: import("vue").DefineComponent<{
declare const _default: import("vue").DefineComponent<
{
label: StringConstructor;
expand: {
type: BooleanConstructor;
@ -8,7 +9,20 @@ declare const _default: import("vue").DefineComponent<{
type: BooleanConstructor;
default: boolean;
};
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
},
() => JSX.Element,
unknown,
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<
import("vue").ExtractPropTypes<{
label: StringConstructor;
expand: {
type: BooleanConstructor;
@ -18,8 +32,11 @@ declare const _default: import("vue").DefineComponent<{
type: BooleanConstructor;
default: boolean;
};
}>>, {
}>
>,
{
expand: boolean;
isExpand: boolean;
}>;
}
>;
export default _default;

View File

@ -1,4 +1,5 @@
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
declare const _default: import("vue").DefineComponent<
import("vue").ExtractPropTypes<{
label: StringConstructor;
expand: {
type: BooleanConstructor;
@ -8,7 +9,18 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
type: BooleanConstructor;
default: boolean;
};
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
}>,
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").PublicProps,
Readonly<
import("vue").ExtractPropTypes<{
label: StringConstructor;
expand: {
type: BooleanConstructor;
@ -18,11 +30,69 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
type: BooleanConstructor;
default: boolean;
};
}>> & Readonly<{}>, {
}>
> &
Readonly<{}>,
{
expand: boolean;
isExpand: boolean;
}, {}, {
ArrowDown: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
ArrowUp: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
},
{},
{
ArrowDown: import("vue").DefineComponent<
{},
{},
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<import("vue").ExtractPropTypes<{}>>,
{},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
ArrowUp: import("vue").DefineComponent<
{},
{},
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<import("vue").ExtractPropTypes<{}>>,
{},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,5 +1,6 @@
import { PropType } from "vue";
declare const _default: import("vue").DefineComponent<{
declare const _default: import("vue").DefineComponent<
{
modelValue: (NumberConstructor | StringConstructor)[];
labels: {
type: ArrayConstructor;
@ -17,7 +18,8 @@ declare const _default: import("vue").DefineComponent<{
type: PropType<"default" | "card">;
default: string;
};
}, {
},
{
active: import("vue").Ref<string>;
list: import("vue").Ref<any[]>;
line: {
@ -29,7 +31,19 @@ declare const _default: import("vue").DefineComponent<{
refs: any;
setRefs: (index: number) => (el: HTMLElement) => void;
update: (val: any) => false | undefined;
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
},
unknown,
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
("update:modelValue" | "change")[],
"update:modelValue" | "change",
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<
import("vue").ExtractPropTypes<{
modelValue: (NumberConstructor | StringConstructor)[];
labels: {
type: ArrayConstructor;
@ -47,13 +61,16 @@ declare const _default: import("vue").DefineComponent<{
type: PropType<"default" | "card">;
default: string;
};
}>> & {
}>
> & {
onChange?: ((...args: any[]) => any) | undefined;
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
}, {
},
{
type: "default" | "card";
labels: unknown[];
justify: string;
color: string;
}>;
}
>;
export default _default;

View File

@ -1,38 +1,66 @@
import { PropType } from "vue";
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
declare const _default: import("vue").DefineComponent<
import("vue").ExtractPropTypes<{
modelValue: (NumberConstructor | StringConstructor)[];
labels: {
type: ArrayConstructor;
default: () => never[];
};
justify: {
type: PropType<"center" | "justify" | "left" | "right" | "start" | "end" | "match-parent">;
type: PropType<
"center" | "justify" | "left" | "right" | "start" | "end" | "match-parent"
>;
default: string;
};
type: {
type: PropType<"default" | "card">;
default: string;
};
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue")[], "change" | "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
}>,
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
("change" | "update:modelValue")[],
"change" | "update:modelValue",
import("vue").PublicProps,
Readonly<
import("vue").ExtractPropTypes<{
modelValue: (NumberConstructor | StringConstructor)[];
labels: {
type: ArrayConstructor;
default: () => never[];
};
justify: {
type: PropType<"center" | "justify" | "left" | "right" | "start" | "end" | "match-parent">;
type: PropType<
"center" | "justify" | "left" | "right" | "start" | "end" | "match-parent"
>;
default: string;
};
type: {
type: PropType<"default" | "card">;
default: string;
};
}>> & Readonly<{
}>
> &
Readonly<{
onChange?: ((...args: any[]) => any) | undefined;
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
}>, {
}>,
{
type: "default" | "card";
labels: unknown[];
justify: "center" | "justify" | "left" | "right" | "start" | "end" | "match-parent";
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -2,7 +2,11 @@
import { Ref } from "vue";
declare type Config = ClForm.Config;
declare type Form = Vue.Ref<any>;
export declare function useAction({ config, form, Form }: {
export declare function useAction({
config,
form,
Form
}: {
config: Config;
form: obj;
Form: Form;
@ -19,10 +23,7 @@ export declare function useAction({ config, form, Form }: {
setTitle: (value: string) => void;
collapseItem: (e: any) => void;
};
export declare function useTabs({ config, Form }: {
config: Config;
Form: Form;
}): {
export declare function useTabs({ config, Form }: { config: Config; Form: Form }): {
active: Ref<any>;
get: () => ClForm.Item | undefined;
set: (data: any) => void;
@ -30,14 +31,10 @@ export declare function useTabs({ config, Form }: {
clear: () => void;
mergeProp: (item: ClForm.Item) => void;
};
export declare function useApi({ Form }: {
Form: Form;
}): {
export declare function useApi({ Form }: { Form: Form }): {
[key: string]: any;
};
export declare function usePlugins({ visible }: {
visible: Ref<boolean>;
}): {
export declare function usePlugins({ visible }: { visible: Ref<boolean> }): {
create: (plugins?: ClForm.Plugin[]) => void;
submit: (data: any) => Promise<any>;
};

View File

@ -1,5 +1,9 @@
/// <reference types="../index" />
export declare function useAction({ config, form, Form }: {
export declare function useAction({
config,
form,
Form
}: {
config: ClForm.Config;
form: obj;
Form: Vue.Ref<any>;

View File

@ -1,4 +1,2 @@
/// <reference types="../index" />
export declare function useApi({ Form }: {
Form: Vue.Ref<any>;
}): obj;
export declare function useApi({ Form }: { Form: Vue.Ref<any> }): obj;

View File

@ -24,16 +24,19 @@ export declare function useForm(): {
[x: string]: any;
type?: "tabs" | undefined;
prop?: (string & {}) | undefined;
props?: {
props?:
| {
[x: string]: any;
labels?: {
labels?:
| {
[x: string]: any;
label: string;
value: string;
name?: string | undefined;
icon?: any;
lazy?: boolean | undefined;
}[] | undefined;
}[]
| undefined;
justify?: "center" | "left" | "right" | undefined;
color?: string | undefined;
mergeProp?: boolean | undefined;
@ -42,9 +45,11 @@ export declare function useForm(): {
showMessage?: boolean | undefined;
inlineMessage?: boolean | undefined;
size?: "default" | "small" | "medium" | undefined;
} | undefined;
}
| undefined;
span?: number | undefined;
col?: {
col?:
| {
span: number;
offset: number;
push: number;
@ -55,30 +60,35 @@ export declare function useForm(): {
lg: any;
xl: any;
tag: string;
} | undefined;
}
| undefined;
group?: string | undefined;
collapse?: boolean | undefined;
value?: any;
label?: string | undefined;
renderLabel?: any;
flex?: boolean | undefined;
hook?: ClForm.HookKey | {
hook?:
| ClForm.HookKey
| {
bind?: ClForm.HookPipe | ClForm.HookPipe[] | undefined;
submit?: ClForm.HookPipe | ClForm.HookPipe[] | undefined;
} | undefined;
hidden?: boolean | ((options: {
scope: obj;
}) => boolean) | undefined;
prepend?: {
}
| undefined;
hidden?: boolean | ((options: { scope: obj }) => boolean) | undefined;
prepend?:
| {
[x: string]: any;
name?: string | undefined;
options?: {
options?:
| {
[x: string]: any;
label?: string | undefined;
value?: any;
color?: string | undefined;
type?: string | undefined;
}[] | {
}[]
| {
value: {
[x: string]: any;
label?: string | undefined;
@ -86,32 +96,42 @@ export declare function useForm(): {
color?: string | undefined;
type?: string | undefined;
}[];
} | undefined;
props?: {
}
| undefined;
props?:
| {
[x: string]: any;
onChange?: ((value: any) => void) | undefined;
} | {
}
| {
value: {
[x: string]: any;
onChange?: ((value: any) => void) | undefined;
};
} | undefined;
}
| undefined;
style?: obj | undefined;
slots?: {
slots?:
| {
[key: string]: (data?: any) => any;
} | undefined;
}
| undefined;
vm?: any;
} | undefined;
component?: {
}
| undefined;
component?:
| {
[x: string]: any;
name?: string | undefined;
options?: {
options?:
| {
[x: string]: any;
label?: string | undefined;
value?: any;
color?: string | undefined;
type?: string | undefined;
}[] | {
}[]
| {
value: {
[x: string]: any;
label?: string | undefined;
@ -119,32 +139,42 @@ export declare function useForm(): {
color?: string | undefined;
type?: string | undefined;
}[];
} | undefined;
props?: {
}
| undefined;
props?:
| {
[x: string]: any;
onChange?: ((value: any) => void) | undefined;
} | {
}
| {
value: {
[x: string]: any;
onChange?: ((value: any) => void) | undefined;
};
} | undefined;
}
| undefined;
style?: obj | undefined;
slots?: {
slots?:
| {
[key: string]: (data?: any) => any;
} | undefined;
}
| undefined;
vm?: any;
} | undefined;
append?: {
}
| undefined;
append?:
| {
[x: string]: any;
name?: string | undefined;
options?: {
options?:
| {
[x: string]: any;
label?: string | undefined;
value?: any;
color?: string | undefined;
type?: string | undefined;
}[] | {
}[]
| {
value: {
[x: string]: any;
label?: string | undefined;
@ -152,69 +182,134 @@ export declare function useForm(): {
color?: string | undefined;
type?: string | undefined;
}[];
} | undefined;
props?: {
}
| undefined;
props?:
| {
[x: string]: any;
onChange?: ((value: any) => void) | undefined;
} | {
}
| {
value: {
[x: string]: any;
onChange?: ((value: any) => void) | undefined;
};
} | undefined;
}
| undefined;
style?: obj | undefined;
slots?: {
slots?:
| {
[key: string]: (data?: any) => any;
} | undefined;
}
| undefined;
vm?: any;
} | undefined;
rules?: {
}
| undefined;
rules?:
| {
[x: string]: any;
type?: "string" | "number" | "boolean" | "object" | "method" | "regexp" | "integer" | "float" | "array" | "enum" | "date" | "url" | "hex" | "email" | "any" | undefined;
type?:
| "string"
| "number"
| "boolean"
| "object"
| "method"
| "regexp"
| "integer"
| "float"
| "array"
| "enum"
| "date"
| "url"
| "hex"
| "email"
| "any"
| undefined;
required?: boolean | undefined;
message?: string | undefined;
min?: number | undefined;
max?: number | undefined;
trigger?: any;
validator?: ((rule: any, value: any, callback: (error?: Error | undefined) => void) => void) | undefined;
} | {
validator?:
| ((
rule: any,
value: any,
callback: (error?: Error | undefined) => void
) => void)
| undefined;
}
| {
[x: string]: any;
type?: "string" | "number" | "boolean" | "object" | "method" | "regexp" | "integer" | "float" | "array" | "enum" | "date" | "url" | "hex" | "email" | "any" | undefined;
type?:
| "string"
| "number"
| "boolean"
| "object"
| "method"
| "regexp"
| "integer"
| "float"
| "array"
| "enum"
| "date"
| "url"
| "hex"
| "email"
| "any"
| undefined;
required?: boolean | undefined;
message?: string | undefined;
min?: number | undefined;
max?: number | undefined;
trigger?: any;
validator?: ((rule: any, value: any, callback: (error?: Error | undefined) => void) => void) | undefined;
}[] | undefined;
validator?:
| ((
rule: any,
value: any,
callback: (error?: Error | undefined) => void
) => void)
| undefined;
}[]
| undefined;
required?: boolean | undefined;
children?: any[] | undefined;
}[];
form: obj;
isReset?: boolean | undefined;
on?: {
on?:
| {
open?: ((data: any) => void) | undefined;
close?: ((action: ClForm.CloseAction, done: fn) => void) | undefined;
submit?: ((data: any, event: {
submit?:
| ((
data: any,
event: {
close: fn;
done: fn;
}) => void) | undefined;
}
) => void)
| undefined;
change?: ((data: any, prop: string) => void) | undefined;
} | undefined;
}
| undefined;
op: {
hidden?: boolean | undefined;
saveButtonText?: string | undefined;
closeButtonText?: string | undefined;
justify?: "center" | "flex-start" | "flex-end" | undefined;
buttons?: (ClForm.CloseAction | `slot-${string}` | {
buttons?:
| (
| ClForm.CloseAction
| `slot-${string}`
| {
[x: string]: any;
label: string;
type?: string | undefined;
hidden?: boolean | undefined;
onClick: (options: {
scope: obj;
}) => void;
})[] | undefined;
onClick: (options: { scope: obj }) => void;
}
)[]
| undefined;
};
dialog: {
[x: string]: any;

View File

@ -1,8 +1,13 @@
/// <reference types="../index" />
import { Ref } from "vue";
export declare function usePlugins(enable: boolean, { visible }: {
export declare function usePlugins(
enable: boolean,
{
visible
}: {
visible: Ref<boolean>;
}): {
}
): {
create: (plugins?: ClForm.Plugin[]) => false | undefined;
submit: (data: any) => Promise<any>;
};

View File

@ -1,8 +1,5 @@
/// <reference types="../index" />
export declare function useTabs({ config, Form }: {
config: ClForm.Config;
Form: Vue.Ref<any>;
}): {
export declare function useTabs({ config, Form }: { config: ClForm.Config; Form: Vue.Ref<any> }): {
active: import("vue").Ref<string | undefined, string | undefined>;
list: import("vue").ComputedRef<ClFormTabs.labels>;
isLoaded: (value: any) => any;
@ -12,9 +9,5 @@ export declare function useTabs({ config, Form }: {
change: (value: any, isValid?: boolean) => Promise<unknown>;
clear: () => void;
mergeProp: (item: ClForm.Item) => void;
toGroup: (opts: {
config: ClForm.Config;
prop: string;
refs: any;
}) => void;
toGroup: (opts: { config: ClForm.Config; prop: string; refs: any }) => void;
};

View File

@ -1,20 +1,44 @@
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
declare const _default: import("vue").DefineComponent<
import("vue").ExtractPropTypes<{
inner: BooleanConstructor;
inline: BooleanConstructor;
enablePlugin: {
type: BooleanConstructor;
default: boolean;
};
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
}>,
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").PublicProps,
Readonly<
import("vue").ExtractPropTypes<{
inner: BooleanConstructor;
inline: BooleanConstructor;
enablePlugin: {
type: BooleanConstructor;
default: boolean;
};
}>> & Readonly<{}>, {
}>
> &
Readonly<{}>,
{
inline: boolean;
inner: boolean;
enablePlugin: boolean;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,2 +1,17 @@
declare const _default: import("vue").DefineComponent<{}, () => false | JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
declare const _default: import("vue").DefineComponent<
{},
() => false | JSX.Element,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<import("vue").ExtractPropTypes<{}>>,
{}
>;
export default _default;

View File

@ -1,2 +1,23 @@
declare const _default: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
declare const _default: import("vue").DefineComponent<
{},
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").PublicProps,
Readonly<{}> & Readonly<{}>,
{},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,9 +1,24 @@
declare const _default: import("vue").DefineComponent<{}, {
declare const _default: import("vue").DefineComponent<
{},
{
total: import("vue").Ref<number>;
currentPage: import("vue").Ref<number>;
pageSize: import("vue").Ref<number>;
onCurrentChange: (index: number) => void;
onSizeChange: (size: number) => void;
setPagination: (res: any) => void;
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
},
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<import("vue").ExtractPropTypes<{}>>,
{}
>;
export default _default;

View File

@ -1,4 +1,29 @@
declare const _default: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
declare const _default: import("vue").DefineComponent<
{},
() => import("vue").VNode<
import("vue").RendererNode,
import("vue").RendererElement,
{
[key: string]: any;
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
}
>,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").PublicProps,
Readonly<{}> & Readonly<{}>,
{},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,4 +1,5 @@
declare const _default: import("vue").DefineComponent<{
declare const _default: import("vue").DefineComponent<
{
modelValue: null;
list: {
type: ArrayConstructor;
@ -10,14 +11,29 @@ declare const _default: import("vue").DefineComponent<{
};
multiple: BooleanConstructor;
callback: FunctionConstructor;
}, {
list: import("vue").Ref<{
},
{
list: import("vue").Ref<
{
label: string;
value: any;
active: boolean;
}[]>;
}[]
>;
selectItem: (event: any, item: any) => void;
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
},
unknown,
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
("update:modelValue" | "change")[],
"update:modelValue" | "change",
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<
import("vue").ExtractPropTypes<{
modelValue: null;
list: {
type: ArrayConstructor;
@ -29,11 +45,14 @@ declare const _default: import("vue").DefineComponent<{
};
multiple: BooleanConstructor;
callback: FunctionConstructor;
}>> & {
}>
> & {
onChange?: ((...args: any[]) => any) | undefined;
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
}, {
},
{
field: string;
multiple: boolean;
}>;
}
>;
export default _default;

View File

@ -1,4 +1,5 @@
declare const _default: import("vue").DefineComponent<{
declare const _default: import("vue").DefineComponent<
{
modelValue: null;
list: {
type: ArrayConstructor;
@ -10,7 +11,20 @@ declare const _default: import("vue").DefineComponent<{
};
multiple: BooleanConstructor;
callback: FunctionConstructor;
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue")[], "change" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
},
() => JSX.Element,
unknown,
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
("change" | "update:modelValue")[],
"change" | "update:modelValue",
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<
import("vue").ExtractPropTypes<{
modelValue: null;
list: {
type: ArrayConstructor;
@ -22,11 +36,14 @@ declare const _default: import("vue").DefineComponent<{
};
multiple: BooleanConstructor;
callback: FunctionConstructor;
}>> & {
}>
> & {
onChange?: ((...args: any[]) => any) | undefined;
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
}, {
},
{
field: string;
multiple: boolean;
}>;
}
>;
export default _default;

View File

@ -1,2 +1,17 @@
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
declare const _default: import("vue").DefineComponent<
{},
() => JSX.Element,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<import("vue").ExtractPropTypes<{}>>,
{}
>;
export default _default;

View File

@ -1,2 +1,23 @@
declare const _default: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
declare const _default: import("vue").DefineComponent<
{},
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").PublicProps,
Readonly<{}> & Readonly<{}>,
{},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,2 +1,17 @@
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
declare const _default: import("vue").DefineComponent<
{},
() => JSX.Element,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<import("vue").ExtractPropTypes<{}>>,
{}
>;
export default _default;

View File

@ -1,2 +1,23 @@
declare const _default: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
declare const _default: import("vue").DefineComponent<
{},
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
{},
string,
import("vue").PublicProps,
Readonly<{}> & Readonly<{}>,
{},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,15 +1,18 @@
import { PropType } from "vue";
declare const _default: import("vue").DefineComponent<{
declare const _default: import("vue").DefineComponent<
{
modelValue: StringConstructor;
field: {
type: StringConstructor;
default: string;
};
fieldList: {
type: PropType<{
type: PropType<
{
label: string;
value: string;
}[]>;
}[]
>;
default: () => never[];
};
onSearch: FunctionConstructor;
@ -18,7 +21,8 @@ declare const _default: import("vue").DefineComponent<{
type: StringConstructor;
default: string;
};
}, {
},
{
value: import("vue").Ref<string>;
placeholder: import("vue").ComputedRef<string>;
selectField: import("vue").Ref<string>;
@ -27,17 +31,31 @@ declare const _default: import("vue").DefineComponent<{
onInput: (val: string) => void;
onChange: () => void;
onFieldChange: () => void;
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change" | "field-change")[], "update:modelValue" | "change" | "field-change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
},
unknown,
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
("update:modelValue" | "change" | "field-change")[],
"update:modelValue" | "change" | "field-change",
import("vue").VNodeProps &
import("vue").AllowedComponentProps &
import("vue").ComponentCustomProps,
Readonly<
import("vue").ExtractPropTypes<{
modelValue: StringConstructor;
field: {
type: StringConstructor;
default: string;
};
fieldList: {
type: PropType<{
type: PropType<
{
label: string;
value: string;
}[]>;
}[]
>;
default: () => never[];
};
onSearch: FunctionConstructor;
@ -46,16 +64,19 @@ declare const _default: import("vue").DefineComponent<{
type: StringConstructor;
default: string;
};
}>> & {
}>
> & {
onChange?: ((...args: any[]) => any) | undefined;
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
"onField-change"?: ((...args: any[]) => any) | undefined;
}, {
},
{
width: string;
field: string;
fieldList: {
label: string;
value: string;
}[];
}>;
}
>;
export default _default;

View File

@ -1,15 +1,18 @@
import { type PropType } from "vue";
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
declare const _default: import("vue").DefineComponent<
import("vue").ExtractPropTypes<{
modelValue: StringConstructor;
field: {
type: StringConstructor;
default: string;
};
fieldList: {
type: PropType<{
type: PropType<
{
label: string;
value: string;
}[]>;
}[]
>;
default: () => never[];
};
onSearch: FunctionConstructor;
@ -19,17 +22,30 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
default: number;
};
refreshOnInput: BooleanConstructor;
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue" | "field-change")[], "change" | "update:modelValue" | "field-change", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
}>,
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
("change" | "update:modelValue" | "field-change")[],
"change" | "update:modelValue" | "field-change",
import("vue").PublicProps,
Readonly<
import("vue").ExtractPropTypes<{
modelValue: StringConstructor;
field: {
type: StringConstructor;
default: string;
};
fieldList: {
type: PropType<{
type: PropType<
{
label: string;
value: string;
}[]>;
}[]
>;
default: () => never[];
};
onSearch: FunctionConstructor;
@ -39,11 +55,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
default: number;
};
refreshOnInput: BooleanConstructor;
}>> & Readonly<{
}>
> &
Readonly<{
onChange?: ((...args: any[]) => any) | undefined;
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
"onField-change"?: ((...args: any[]) => any) | undefined;
}>, {
}>,
{
width: string | number;
refreshOnInput: boolean;
field: string;
@ -51,5 +70,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
label: string;
value: string;
}[];
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,6 +1,7 @@
/// <reference types="../index" />
import { PropType } from "vue";
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
declare const _default: import("vue").DefineComponent<
import("vue").ExtractPropTypes<{
inline: {
type: BooleanConstructor;
default: boolean;
@ -23,7 +24,18 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
};
onLoad: FunctionConstructor;
onSearch: FunctionConstructor;
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "reset"[], "reset", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
}>,
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
"reset"[],
"reset",
import("vue").PublicProps,
Readonly<
import("vue").ExtractPropTypes<{
inline: {
type: BooleanConstructor;
default: boolean;
@ -46,13 +58,25 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
};
onLoad: FunctionConstructor;
onSearch: FunctionConstructor;
}>> & Readonly<{
}>
> &
Readonly<{
onReset?: ((...args: any[]) => any) | undefined;
}>, {
}>,
{
items: ClForm.Item<any>[];
props: Record<string, any>;
inline: boolean;
data: Record<string, any>;
resetBtn: boolean;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -9,55 +9,52 @@ declare interface Sort {
};
changeSort(prop: string, order: string): void;
}
export declare function useSort({ config, emit, Table }: {
export declare function useSort({
config,
emit,
Table
}: {
config: Config;
emit: Emit;
Table: Table;
}): {
defaultSort: {
defaultSort:
| {
prop: string;
order: "descending" | "ascending";
} | {
}
| {
prop?: undefined;
order?: undefined;
};
onSortChange: ({ prop, order }: {
prop: string | undefined;
order: string;
}) => void;
onSortChange: ({ prop, order }: { prop: string | undefined; order: string }) => void;
changeSort: (prop: string, order: string) => void;
};
export declare function useRow({ Table, config, Sort }: {
export declare function useRow({
Table,
config,
Sort
}: {
Table: Table;
config: Config;
Sort: Sort;
}): {
onRowContextMenu: (row: any, column: any, event: any) => void;
};
export declare function useHeight({ config, Table }: {
Table: Table;
config: Config;
}): {
export declare function useHeight({ config, Table }: { Table: Table; config: Config }): {
isAuto: import("vue").ComputedRef<boolean>;
maxHeight: import("vue").Ref<number>;
calcMaxHeight: (this: any, ...args: any[]) => any;
};
export declare function useSelection({ emit }: {
emit: Emit;
}): {
export declare function useSelection({ emit }: { emit: Emit }): {
selection: obj[];
onSelectionChange: (selection: any[]) => void;
};
export declare function useData({ config, Table }: {
config: Config;
Table: Table;
}): {
export declare function useData({ config, Table }: { config: Config; Table: Table }): {
data: import("vue").Ref<any[]>;
setData: (list: any[]) => void;
};
export declare function useOp({ config }: {
config: Config;
}): {
export declare function useOp({ config }: { config: Config }): {
visible: import("vue").Ref<boolean>;
reBuild: (cb?: fn) => Promise<void>;
showColumn: (prop: string | string[], status?: boolean) => void;
@ -65,10 +62,17 @@ export declare function useOp({ config }: {
setColumns: (list: ClTable.Column[]) => void;
};
export declare function useRender(): {
renderColumn: (columns: ClTable.Column[]) => (import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
renderColumn: (columns: ClTable.Column[]) => (
| import("vue").VNode<
import("vue").RendererNode,
import("vue").RendererElement,
{
[key: string]: any;
}> | null)[];
renderEmpty: (emptyText: String) => JSX.Element;
}
>
| null
)[];
renderEmpty: (emptyText: string) => JSX.Element;
renderAppend: () => JSX.Element;
};
export {};

View File

@ -1,5 +1,8 @@
/// <reference types="../index" />
export declare function useData({ config, Table }: {
export declare function useData({
config,
Table
}: {
config: ClTable.Config;
Table: Vue.Ref<any>;
}): {

View File

@ -1,5 +1,8 @@
/// <reference types="../index" />
export declare function useHeight({ config, Table }: {
export declare function useHeight({
config,
Table
}: {
Table: Vue.Ref<any>;
config: ClTable.Config;
}): {

View File

@ -5,19 +5,23 @@ export declare function useTable(props: any): {
columns: {
[x: string]: any;
type: ClTable.ColumnType;
hidden: boolean | {
hidden:
| boolean
| {
value: boolean;
};
component: {
[x: string]: any;
name?: string | undefined;
options?: {
options?:
| {
[x: string]: any;
label?: string | undefined;
value?: any;
color?: string | undefined;
type?: string | undefined;
}[] | {
}[]
| {
value: {
[x: string]: any;
label?: string | undefined;
@ -25,20 +29,26 @@ export declare function useTable(props: any): {
color?: string | undefined;
type?: string | undefined;
}[];
} | undefined;
props?: {
}
| undefined;
props?:
| {
[x: string]: any;
onChange?: ((value: any) => void) | undefined;
} | {
}
| {
value: {
[x: string]: any;
onChange?: ((value: any) => void) | undefined;
};
} | undefined;
}
| undefined;
style?: obj | undefined;
slots?: {
slots?:
| {
[key: string]: (data?: any) => any;
} | undefined;
}
| undefined;
vm?: any;
};
search: {
@ -50,13 +60,15 @@ export declare function useTable(props: any): {
component: {
[x: string]: any;
name?: string | undefined;
options?: {
options?:
| {
[x: string]: any;
label?: string | undefined;
value?: any;
color?: string | undefined;
type?: string | undefined;
}[] | {
}[]
| {
value: {
[x: string]: any;
label?: string | undefined;
@ -64,30 +76,38 @@ export declare function useTable(props: any): {
color?: string | undefined;
type?: string | undefined;
}[];
} | undefined;
props?: {
}
| undefined;
props?:
| {
[x: string]: any;
onChange?: ((value: any) => void) | undefined;
} | {
}
| {
value: {
[x: string]: any;
onChange?: ((value: any) => void) | undefined;
};
} | undefined;
}
| undefined;
style?: obj | undefined;
slots?: {
slots?:
| {
[key: string]: (data?: any) => any;
} | undefined;
}
| undefined;
vm?: any;
};
};
dict: {
dict:
| {
[x: string]: any;
label?: string | undefined;
value?: any;
color?: string | undefined;
type?: string | undefined;
}[] | {
}[]
| {
value: {
[x: string]: any;
label?: string | undefined;
@ -100,17 +120,22 @@ export declare function useTable(props: any): {
dictColor: boolean;
dictSeparator: string;
dictAllLevels: boolean;
buttons: ((options: {
scope: any;
}) => ClTable.OpButton) | ("info" | "delete" | "edit" | AnyString | `slot-${string}` | {
buttons:
| ((options: { scope: any }) => ClTable.OpButton)
| (
| "info"
| "delete"
| "edit"
| AnyString
| `slot-${string}`
| {
[x: string]: any;
label: string;
type?: string | undefined;
hidden?: boolean | undefined;
onClick: (options: {
scope: obj;
}) => void;
})[];
onClick: (options: { scope: obj }) => void;
}
)[];
align: ElementPlus.Align;
label: any;
className: string;
@ -118,10 +143,7 @@ export declare function useTable(props: any): {
orderNum: number;
width: number;
minWidth: string | number;
renderHeader: (options: {
column: any;
$index: number;
}) => any;
renderHeader: (options: { column: any; $index: number }) => any;
sortable: boolean | "asc" | "desc" | "custom" | "descending" | "ascending";
sortMethod: fn;
sortBy: string | any[] | ((row: any, index: number) => any);
@ -144,7 +166,13 @@ export declare function useTable(props: any): {
}[];
autoHeight: boolean;
height: any;
contextMenu: ("info" | "update" | "delete" | "edit" | "refresh" | {
contextMenu: (
| "info"
| "update"
| "delete"
| "edit"
| "refresh"
| {
[x: string]: any;
label: string;
prefixIcon?: any;
@ -155,7 +183,12 @@ export declare function useTable(props: any): {
children?: any[] | undefined;
showChildren?: boolean | undefined;
callback?: ((done: fn) => void) | undefined;
} | ((row: obj, column: obj, event: PointerEvent) => ClContextMenu.Item) | "check" | "order-desc" | "order-asc")[];
}
| ((row: obj, column: obj, event: PointerEvent) => ClContextMenu.Item)
| "check"
| "order-desc"
| "order-asc"
)[];
defaultSort: {
prop: string;
order: "descending" | "ascending";

View File

@ -1,7 +1,5 @@
/// <reference types="../index" />
export declare function useOp({ config }: {
config: ClTable.Config;
}): {
export declare function useOp({ config }: { config: ClTable.Config }): {
visible: import("vue").Ref<boolean, boolean>;
reBuild: (cb?: fn) => Promise<void>;
showColumn: (prop: string | string[], status?: boolean) => void;

View File

@ -1,8 +1,15 @@
/// <reference types="../index" />
export declare function useRender(): {
renderColumn: (columns: ClTable.Column[]) => (import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
renderColumn: (columns: ClTable.Column[]) => (
| import("vue").VNode<
import("vue").RendererNode,
import("vue").RendererElement,
{
[key: string]: any;
}> | null)[];
renderEmpty: (emptyText: String) => any;
}
>
| null
)[];
renderEmpty: (emptyText: string) => any;
renderAppend: () => any;
};

View File

@ -1,5 +1,9 @@
/// <reference types="../index" />
export declare function useRow({ Table, config, Sort }: {
export declare function useRow({
Table,
config,
Sort
}: {
Table: Vue.Ref<any>;
config: ClTable.Config;
Sort: {

View File

@ -1,7 +1,5 @@
/// <reference types="../index" />
export declare function useSelection({ emit }: {
emit: Vue.Emit;
}): {
export declare function useSelection({ emit }: { emit: Vue.Emit }): {
selection: obj[];
onSelectionChange: (selection: any[]) => void;
};

View File

@ -1,19 +1,22 @@
/// <reference types="../index" />
export declare function useSort({ config, Table, emit }: {
export declare function useSort({
config,
Table,
emit
}: {
config: ClTable.Config;
Table: Vue.Ref<any>;
emit: Vue.Emit;
}): {
defaultSort: {
defaultSort:
| {
prop: string;
order: "descending" | "ascending";
} | {
}
| {
prop?: undefined;
order?: undefined;
};
onSortChange: ({ prop, order }: {
prop: string | undefined;
order: string;
}) => void;
onSortChange: ({ prop, order }: { prop: string | undefined; order: string }) => void;
changeSort: (prop: string, order: string) => void;
};

View File

@ -1,4 +1,5 @@
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
declare const _default: import("vue").DefineComponent<
import("vue").ExtractPropTypes<{
columns: {
type: ArrayConstructor;
default: () => never[];
@ -22,9 +23,26 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
type: StringConstructor;
default: string;
};
}>, () => false | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
}>,
() =>
| false
| import("vue").VNode<
import("vue").RendererNode,
import("vue").RendererElement,
{
[key: string]: any;
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("selection-change" | "sort-change")[], "selection-change" | "sort-change", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
}
>,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
("selection-change" | "sort-change")[],
"selection-change" | "sort-change",
import("vue").PublicProps,
Readonly<
import("vue").ExtractPropTypes<{
columns: {
type: ArrayConstructor;
default: () => never[];
@ -48,14 +66,26 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
type: StringConstructor;
default: string;
};
}>> & Readonly<{
}>
> &
Readonly<{
"onSelection-change"?: ((...args: any[]) => any) | undefined;
"onSort-change"?: ((...args: any[]) => any) | undefined;
}>, {
}>,
{
columns: unknown[];
autoHeight: boolean;
contextMenu: boolean | unknown[];
sortRefresh: boolean;
rowKey: string;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -1,4 +1,5 @@
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
declare const _default: import("vue").DefineComponent<
import("vue").ExtractPropTypes<{
items: {
type: ArrayConstructor;
default: () => never[];
@ -13,7 +14,18 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
onClosed: FunctionConstructor;
onInfo: FunctionConstructor;
onSubmit: FunctionConstructor;
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("opened" | "closed")[], "opened" | "closed", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
}>,
() => any,
{},
{},
{},
import("vue").ComponentOptionsMixin,
import("vue").ComponentOptionsMixin,
("opened" | "closed")[],
"opened" | "closed",
import("vue").PublicProps,
Readonly<
import("vue").ExtractPropTypes<{
items: {
type: ArrayConstructor;
default: () => never[];
@ -28,11 +40,23 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
onClosed: FunctionConstructor;
onInfo: FunctionConstructor;
onSubmit: FunctionConstructor;
}>> & Readonly<{
}>
> &
Readonly<{
onOpened?: ((...args: any[]) => any) | undefined;
onClosed?: ((...args: any[]) => any) | undefined;
}>, {
}>,
{
sync: boolean;
items: unknown[];
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
},
{},
{},
{},
string,
import("vue").ComponentProvideOptions,
true,
{},
any
>;
export default _default;

View File

@ -33,7 +33,10 @@ export declare function useCore(): {
crud: ClCrud.Provide;
mitt: Emitter;
};
export declare function useElApi(keys: string[], el: any): {
export declare function useElApi(
keys: string[],
el: any
): {
[key: string]: any;
};
export declare function useConfig({ props }: any): any;

View File

@ -1,11 +1,24 @@
/// <reference types="../index" />
import { Ref } from "vue";
export declare function useCrud(options?: ClCrud.Options, cb?: (app: ClCrud.Ref) => void): Ref<ClCrud.Ref | undefined, ClCrud.Ref | undefined>;
export declare function useUpsert<T = any>(options?: ClUpsert.Options<T>): Ref<ClUpsert.Ref<any> | undefined, ClUpsert.Ref<any> | undefined>;
export declare function useTable<T = any>(options?: ClTable.Options<T>): Ref<ClTable.Ref<T> | undefined, ClTable.Ref<T> | undefined>;
export declare function useForm<T = any>(cb?: (app: ClForm.Ref<T>) => void): Ref<ClForm.Ref<T> | undefined, ClForm.Ref<T> | undefined>;
export declare function useAdvSearch<T = any>(options?: ClAdvSearch.Options<T>): Ref<ClAdvSearch.Ref<T> | undefined, ClAdvSearch.Ref<T> | undefined>;
export declare function useSearch<T = any>(options?: ClSearch.Options<T>): Ref<ClSearch.Ref<T> | undefined, ClSearch.Ref<T> | undefined>;
export declare function useCrud(
options?: ClCrud.Options,
cb?: (app: ClCrud.Ref) => void
): Ref<ClCrud.Ref | undefined, ClCrud.Ref | undefined>;
export declare function useUpsert<T = any>(
options?: ClUpsert.Options<T>
): Ref<ClUpsert.Ref<any> | undefined, ClUpsert.Ref<any> | undefined>;
export declare function useTable<T = any>(
options?: ClTable.Options<T>
): Ref<ClTable.Ref<T> | undefined, ClTable.Ref<T> | undefined>;
export declare function useForm<T = any>(
cb?: (app: ClForm.Ref<T>) => void
): Ref<ClForm.Ref<T> | undefined, ClForm.Ref<T> | undefined>;
export declare function useAdvSearch<T = any>(
options?: ClAdvSearch.Options<T>
): Ref<ClAdvSearch.Ref<T> | undefined, ClAdvSearch.Ref<T> | undefined>;
export declare function useSearch<T = any>(
options?: ClSearch.Options<T>
): Ref<ClSearch.Ref<T> | undefined, ClSearch.Ref<T> | undefined>;
export declare function useDialog(options?: {
onFullscreen(visible: boolean): void;
}): ClDialog.Provide;

View File

@ -2,7 +2,10 @@
import type { App } from "vue";
import "./static/index.scss";
declare const Crud: {
install(app: App, options?: Options): {
install(
app: App,
options?: Options
): {
name: string;
};
};

View File

@ -1,13 +1,9 @@
declare class TestService {
page(params: any): Promise<unknown>;
update(params: {
id: any;
[key: string]: any;
}): Promise<void>;
update(params: { id: any; [key: string]: any }): Promise<void>;
add(params: any): Promise<string>;
info(params: {
id: any;
}): Promise<{
info(params: { id: any }): Promise<
| {
id: number;
name: string;
createTime: string;
@ -16,11 +12,12 @@ declare class TestService {
account: string;
occupation: number;
phone: number;
} | undefined>;
delete(params: {
ids: any[];
}): Promise<void>;
list(): Promise<{
}
| undefined
>;
delete(params: { ids: any[] }): Promise<void>;
list(): Promise<
{
id: number;
name: string;
createTime: string;
@ -29,6 +26,7 @@ declare class TestService {
account: string;
occupation: number;
phone: number;
}[]>;
}[]
>;
}
export { TestService };

View File

@ -7,7 +7,11 @@ export declare function merge(d1: any, d2: any): any;
export declare function addClass(el: Element, name: string): void;
export declare function removeClass(el: Element, name: string): void;
export declare function getValue(data: any, params?: any): any;
export declare function deepFind(value: any, list: any[], options?: {
export declare function deepFind(
value: any,
list: any[],
options?: {
allLevels: boolean;
}): any;
}
): any;
export declare function uuid(separator?: string): string;

View File

@ -6,9 +6,18 @@ export declare function parseFormHidden(value: any, { scope }: any): any;
/**
* table.dict
*/
export declare function parseTableDict(value: any, item: ClTable.Column): string | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
export declare function parseTableDict(
value: any,
item: ClTable.Column
):
| string
| import("vue").VNode<
import("vue").RendererNode,
import("vue").RendererElement,
{
[key: string]: any;
}>[];
}
>[];
/**
* table.op.buttons
*/
@ -16,8 +25,10 @@ export declare function parseTableOpButtons(buttons: any[], { scope }: any): any
/**
*
*/
export declare function parseExtensionComponent(vnode: any): {
export declare function parseExtensionComponent(vnode: any):
| {
children: any;
} | {
}
| {
children?: undefined;
};

View File

@ -1,4 +1,5 @@
export declare const UserList: ({
export declare const UserList: (
| {
id: number;
name: string;
createTime: string;
@ -10,7 +11,8 @@ export declare const UserList: ({
};
t2: string;
tags: number[];
} | {
}
| {
id: number;
name: string;
createTime: string;
@ -20,7 +22,8 @@ export declare const UserList: ({
hook?: undefined;
user?: undefined;
t2?: undefined;
})[];
}
)[];
export declare const TestService: {
page: (p: any) => Promise<unknown>;
list: (p: any) => Promise<unknown>;

View File

@ -7,7 +7,7 @@ import prettier from "prettier";
import { config } from "../config";
import type { Eps } from "../../types";
let service = {};
const service = {};
let list: Eps.Entity[] = [];
let customList: Eps.Entity[] = [];

View File

@ -18,12 +18,12 @@ export function createTag(code: string, id: string) {
export default defineComponent({
name: "${name}"
})
<\/script>`
<\/script>`,
);
return {
map: str().generateMap(),
code: str().toString()
code: str().toString(),
};
}
}

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,6 @@
</template>
<script lang="ts" setup>
import { ElConfigProvider } from "element-plus";
import zhCn from "element-plus/dist/locale/zh-cn.mjs";
import { ElConfigProvider } from 'element-plus';
import zhCn from 'element-plus/dist/locale/zh-cn.mjs';
</script>

View File

@ -1,18 +1,18 @@
import { getUrlParam, storage } from "/@/cool/utils";
import { proxy } from "./proxy";
import { getUrlParam, storage } from '/@/cool/utils';
import { proxy } from './proxy';
export default {
// 根地址
host: proxy["/dev/"].target,
host: proxy['/dev/'].target,
// 请求地址
get baseUrl() {
let proxy = getUrlParam("proxy");
let proxy = getUrlParam('proxy');
if (proxy) {
storage.set("proxy", proxy);
storage.set('proxy', proxy);
} else {
proxy = storage.get("proxy") || "dev";
proxy = storage.get('proxy') || 'dev';
}
return `/${proxy}`;

View File

@ -1,5 +1,5 @@
import dev from "./dev";
import prod from "./prod";
import dev from './dev';
import prod from './prod';
// 是否开发模式
export const isDev = import.meta.env.DEV;
@ -21,9 +21,9 @@ export const config = {
// 路由
router: {
// 模式
mode: "history",
mode: 'history',
// 转场动画
transition: "slide"
transition: 'slide'
},
// 字体图标库
@ -34,22 +34,22 @@ export const config = {
ignore: {
// 不显示请求进度条
NProgress: [
"/__cool_eps",
"/base/open/eps",
"/base/comm/person",
"/base/comm/permmenu",
"/base/comm/upload",
"/base/comm/uploadMode",
"/dict/info/data",
"/space/info/add"
'/__cool_eps',
'/base/open/eps',
'/base/comm/person',
'/base/comm/permmenu',
'/base/comm/upload',
'/base/comm/uploadMode',
'/dict/info/data',
'/space/info/add'
],
// 页面不需要登录验证
token: ["/login", "/401", "/403", "/404", "/500", "/502"]
token: ['/login', '/401', '/403', '/404', '/500', '/502']
},
// 调试
test: {
token: "",
token: '',
eps: true
},
@ -57,4 +57,4 @@ export const config = {
...(isDev ? dev : prod)
};
export * from "./proxy";
export * from './proxy';

View File

@ -1,9 +1,9 @@
import { proxy } from "./proxy";
import { proxy } from './proxy';
export default {
// 根地址
host: proxy["/prod/"].target,
host: proxy['/prod/'].target,
// 请求地址
baseUrl: "/api"
baseUrl: '/api'
};

View File

@ -1,13 +1,13 @@
export const proxy = {
"/dev/": {
target: "http://127.0.0.1:8001",
'/dev/': {
target: 'http://127.0.0.1:8888',
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/dev/, "")
rewrite: (path: string) => path.replace(/^\/dev/, '')
},
"/prod/": {
target: "https://show.cool-admin.com",
'/prod/': {
target: 'https://show.cool-admin.com',
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/prod/, "/api")
rewrite: (path: string) => path.replace(/^\/prod/, '/api')
}
};

View File

@ -1,11 +1,11 @@
import { cloneDeep, merge } from "lodash-es";
import { BaseService, service } from "../service";
import { Module } from "../types";
import { path2Obj } from "../utils";
import { config, isDev } from "/@/config";
import { eps } from "virtual:eps";
import { hmr } from "../hooks";
import { module } from "../module";
import { cloneDeep, merge } from 'lodash-es';
import { BaseService, service } from '../service';
import type { Module } from '../types';
import { path2Obj } from '../utils';
import { config, isDev } from '/@/config';
import { eps } from 'virtual:eps';
import { hmr } from '../hooks';
import { module } from '../module';
// 更新事件
function onUpdate() {
@ -15,22 +15,24 @@ function onUpdate() {
const a = new BaseService(d.namespace);
for (const i in d) {
const { path, method = "get" } = d[i];
const { path, method = 'get' } = d[i];
if (path) {
a.request = a.request;
// @ts-ignore
a[i] = function (data?: any) {
return this.request({
url: path,
method,
[method.toLocaleLowerCase() == "post" ? "data" : "params"]: data
[method.toLocaleLowerCase() == 'post' ? 'data' : 'params']: data
});
};
}
}
for (const i in a) {
// @ts-ignore
d[i] = a[i];
}
} else {
@ -59,11 +61,11 @@ function onUpdate() {
);
// 热更新处理
hmr.setData("service", service);
hmr.setData('service', service);
// 提示
if (isDev) {
console.log("[cool-eps] updated");
console.log('[cool-eps] updated');
}
}
@ -76,21 +78,21 @@ export function createEps(modules: Module[]) {
const list: any[] = [];
// 模拟 eps 数据
modules.forEach((m) => {
m.services?.forEach((s) => {
modules.forEach(m => {
m.services?.forEach(s => {
const api = Array.from(
new Set([
...Object.getOwnPropertyNames(s.value.constructor.prototype),
"page",
"list",
"info",
"delete",
"update",
"add"
'page',
'list',
'info',
'delete',
'update',
'add'
])
)
.filter((e) => !["constructor", "namespace"].includes(e))
.map((e) => {
.filter(e => !['constructor', 'namespace'].includes(e))
.map(e => {
return {
path: `/${e}`
};
@ -99,7 +101,7 @@ export function createEps(modules: Module[]) {
list.push({
api,
module: m.name,
name: s.value.constructor.name + "Entity",
name: s.value.constructor.name + 'Entity',
prefix: `/admin/${s.path}`,
isLocal: true
});
@ -108,8 +110,8 @@ export function createEps(modules: Module[]) {
// 生成文件
service.request({
url: "/__cool_eps",
method: "POST",
url: '/__cool_eps',
method: 'POST',
proxy: false,
data: {
list
@ -120,7 +122,7 @@ export function createEps(modules: Module[]) {
// 监听 vite 触发事件
if (import.meta.hot) {
import.meta.hot.on("eps-update", ({ service }) => {
import.meta.hot.on('eps-update', ({ service }) => {
if (service) {
eps.service = service;
}

View File

@ -1,10 +1,10 @@
import { createPinia } from "pinia";
import { App } from "vue";
import { createModule } from "./module";
import { router } from "../router";
import { Loading } from "../utils";
import { createEps } from "./eps";
import "virtual:svg-register";
import { createPinia } from 'pinia';
import { type App } from 'vue';
import { createModule } from './module';
import { router } from '../router';
import { Loading } from '../utils';
import { createEps } from './eps';
import 'virtual:svg-register';
export async function bootstrap(app: App) {
// pinia

View File

@ -1,22 +1,22 @@
import { type App, type Directive } from "vue";
import { assign, isFunction, orderBy } from "lodash-es";
import { filename } from "../utils";
import { module } from "../module";
import { hmr } from "../hooks";
import { type App, type Directive } from 'vue';
import { assign, isFunction, orderBy } from 'lodash-es';
import { filename } from '../utils';
import { module } from '../module';
import { hmr } from '../hooks';
// 扫描文件
const files = import.meta.glob("/src/{modules,plugins}/*/{config.ts,service/**,directives/**}", {
const files = import.meta.glob('/src/{modules,plugins}/*/{config.ts,service/**,directives/**}', {
eager: true,
import: "default"
import: 'default'
});
// 模块列表
module.list = hmr.getData("modules", []);
module.list = hmr.getData('modules', []);
// 解析
for (const i in files) {
// 分割
const [, , type, name, action] = i.split("/");
const [, , type, name, action] = i.split('/');
// 文件名
const n = filename(i);
@ -37,11 +37,11 @@ for (const i in files) {
};
// 配置
if (action == "config.ts") {
if (action == 'config.ts') {
d.value = v;
}
// 服务
else if (action == "service") {
else if (action == 'service') {
const s = new (v as any)();
if (s) {
@ -52,7 +52,7 @@ for (const i in files) {
}
}
// 指令
else if (action == "directives") {
else if (action == 'directives') {
d.directives?.push({ name: n, value: v as Directive });
}
@ -64,7 +64,7 @@ for (const i in files) {
// 创建
export function createModule(app: App) {
// 排序
module.list.forEach((e) => {
module.list.forEach(e => {
const d = isFunction(e.value) ? e.value(app) : e.value;
if (d) {
@ -76,13 +76,12 @@ export function createModule(app: App) {
}
});
const list = orderBy(module.list, "order", "desc").map((e) => {
const list = orderBy(module.list, 'order', 'desc').map(e => {
// 初始化
e.install?.(app, e.options);
// 注册组件
e.components?.forEach(async (c) => {
// @ts-ignore
e.components?.forEach(async (c: any) => {
const v = await (isFunction(c) ? c() : c);
const n = v.default || v;
@ -92,10 +91,15 @@ export function createModule(app: App) {
});
// 注册指令
e.directives?.forEach((v) => {
e.directives?.forEach(v => {
app.directive(v.name, v.value);
});
// 附加值
e.pages?.forEach(v => {
v.isPage = true;
});
return e;
});

View File

@ -1,6 +1,6 @@
import { useEventListener } from "@vueuse/core";
import { reactive, watch } from "vue";
import { getBrowser } from "../utils";
import { useEventListener } from '@vueuse/core';
import { reactive, watch } from 'vue';
import { getBrowser } from '../utils';
const browser = reactive(getBrowser());
const events: (() => void)[] = [];
@ -8,11 +8,11 @@ const events: (() => void)[] = [];
watch(
() => browser.screen,
() => {
events.forEach((ev) => ev());
events.forEach(ev => ev());
}
);
useEventListener(window, "resize", () => {
useEventListener(window, 'resize', () => {
Object.assign(browser, getBrowser());
});

View File

@ -1,8 +1,8 @@
import { getCurrentInstance, Ref, reactive } from "vue";
import { useRoute, useRouter } from "vue-router";
import { service } from "../service";
import { useBrowser } from "./browser";
import { useMitt } from "./mitt";
import { getCurrentInstance, type Ref, reactive } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { service } from '../service';
import { useBrowser } from './browser';
import { useMitt } from './mitt';
export function useRefs() {
const refs = reactive<{ [key: string]: any }>({});
@ -50,5 +50,5 @@ export function useCool() {
};
}
export * from "./browser";
export * from "./hmr";
export * from './browser';
export * from './hmr';

View File

@ -1,7 +1,7 @@
import Mitt, { Emitter } from "mitt";
import { hmr } from "./hmr";
import Mitt, { type Emitter } from 'mitt';
import { hmr } from './hmr';
const mitt: Emitter<any> = hmr.getData("mitt", Mitt());
const mitt: Emitter<any> = hmr.getData('mitt', Mitt());
export function useMitt() {
return mitt;

View File

@ -1,7 +1,7 @@
export * from "./service";
export * from "./bootstrap";
export * from "./hooks";
export * from "./module";
export * from "./router";
export * from "./types";
export { storage } from "./utils";
export * from './service';
export * from './bootstrap';
export * from './hooks';
export * from './module';
export * from './router';
export * from './types';
export { storage } from './utils';

View File

@ -1,9 +1,9 @@
import { Module } from "../types";
import { hmr } from "../hooks";
import { ctx } from "virtual:ctx";
import type { Module } from '../types';
import { hmr } from '../hooks';
import { ctx } from 'virtual:ctx';
// 模块列表
const list: Module[] = hmr.getData("modules", []);
const list: Module[] = hmr.getData('modules', []);
// 模块对象
const module = {
@ -11,7 +11,7 @@ const module = {
dirs: ctx.modules,
req: Promise.resolve(),
get(name: string): Module {
return this.list.find((e) => e.name == name)!;
return this.list.find(e => e.name == name)!;
},
config(name: string) {
return this.get(name).options || {};

View File

@ -1,36 +1,42 @@
import { ElMessage } from "element-plus";
import { createRouter, createWebHashHistory, createWebHistory, RouteRecordRaw } from "vue-router";
import { Router, storage, module } from "/@/cool";
import { isArray } from "lodash-es";
import { useBase } from "/$/base";
import { Loading } from "../utils";
import { config } from "/@/config";
import { ElMessage } from 'element-plus';
import {
createRouter,
createRouterMatcher,
createWebHashHistory,
createWebHistory,
type RouteRecordRaw
} from 'vue-router';
import { type Router, storage, module } from '/@/cool';
import { isArray } from 'lodash-es';
import { useBase } from '/$/base';
import { Loading } from '../utils';
import { config } from '/@/config';
// 基本路径
const baseUrl = import.meta.env.BASE_URL;
// 扫描文件
const files = import.meta.glob(["/src/modules/*/{views,pages}/**/*", "!**/components"]);
const files = import.meta.glob(['/src/modules/*/{views,pages}/**/*', '!**/components']);
// 默认路由
const routes: RouteRecordRaw[] = [
{
path: "/",
name: "index",
component: () => import("/$/base/pages/main/index.vue"),
path: '/',
name: 'index',
component: () => import('/$/base/pages/main/index.vue'),
children: []
},
{
path: "/:catchAll(.*)",
name: "404",
component: () => import("/$/base/pages/error/404.vue")
path: '/:catchAll(.*)',
name: '404',
component: () => import('/$/base/pages/error/404.vue')
}
];
// 创建路由器
const router = createRouter({
history:
config.app.router.mode == "history"
config.app.router.mode == 'history'
? createWebHistory(baseUrl)
: createWebHashHistory(baseUrl),
routes
@ -52,7 +58,7 @@ router.onError((err: Error) => {
console.error(err);
// 动态加载组件错误,刷新页面
if (err.message?.includes("Failed to fetch dynamically imported module")) {
if (err.message?.includes('Failed to fetch dynamically imported module')) {
window.location.reload();
}
@ -64,9 +70,13 @@ router.onError((err: Error) => {
// 添加试图,页面路由
router.append = function (data) {
if (!data) {
return false;
}
const list = isArray(data) ? data : [data];
list.forEach((d) => {
list.forEach(d => {
if (!d.meta) {
d.meta = {};
}
@ -76,27 +86,44 @@ router.append = function (data) {
const url = d.viewPath;
if (url) {
if (url.indexOf("http") == 0) {
if (url.indexOf('http') == 0) {
if (d.meta) {
d.meta.iframeUrl = url;
}
d.component = () => import("/$/base/views/frame.vue");
d.component = () => import('/$/base/views/frame.vue');
} else {
d.component = files["/src/" + url.replace("cool/", "")];
d.component = files['/src/' + url.replace('cool/', '')];
}
} else {
d.redirect = "/404";
if (!d.redirect) {
d.redirect = '/404';
}
}
}
// 支持 props 接收参数
d.props = true;
// 是否动态添加
d.meta.dynamic = true;
if (d.isPage) {
router.addRoute(d as any);
// 判断是页面/视图
if (d.isPage || d.viewPath?.includes('/pages/')) {
router.addRoute(d);
} else {
router.addRoute("index", d as any);
router.addRoute('index', d);
}
});
};
// 删除路由
router.del = function (name) {
const rs = router.getRoutes();
rs.forEach(e => {
if (e.name == name) {
router.removeRoute(name);
}
});
};
@ -105,7 +132,7 @@ router.append = function (data) {
router.clear = function () {
const rs = router.getRoutes();
rs.forEach((e) => {
rs.forEach(e => {
if (e.name && e.meta?.dynamic) {
router.removeRoute(e.name);
}
@ -114,89 +141,94 @@ router.clear = function () {
// 找路由
router.find = function (path: string) {
return router.getRoutes().find((e) => {
if (path == "/") {
return e.path == path && e.name != "index";
} else {
return e.path == path;
}
});
};
// 注册
router.register = async function (path: string) {
// 当前路由是否注册
const isReg = Boolean(router.find(path));
if (!isReg) {
const { menu } = useBase();
// 等待应用配置加载完
await Loading.wait();
// 已注册路由
const routes = router.getRoutes();
// 待注册列表
const list: any[] = [];
// 动态菜单数据
menu.routes.find((e) => {
list.push({
...e,
isPage: e.viewPath?.includes("/pages")
});
});
// 本地模块数据
module.list.forEach((e) => {
if (e.views) {
list.push(...e.views);
}
if (e.pages) {
list.push(
...e.pages.map((d) => {
// 路由列表
const list: any[] = [
...routes.map(e => {
return {
...d,
isPage: true
...e,
isReg: true
};
})
);
}),
// 菜单配置
...menu.routes,
// 模块中自定义
...module.list.map(e => (e.views || [])?.concat(e.pages || [])).flat(1)
];
let isReg = false;
let route: (typeof list)[number] | undefined;
// 匹配器
const matcher = createRouterMatcher(list, {});
// 获取路由
matcher.getRoutes().find(e => {
const r = new RegExp(e.re);
if (r.test(path)) {
if (path == '/') {
route = list.find(e => e.meta?.isHome);
} else {
route = list.find(a => a.path == e.record.path && a.name != 'index');
}
if (route) {
isReg = !!route.isReg;
}
return true;
} else {
return false;
}
});
// 需要注册的路由
const r = list.find((e) => e.path == path);
if (r) {
router.append(r);
}
}
return { route: router.find(path), isReg };
return {
route,
isReg
};
};
// 路由守卫
router.beforeEach(async (to, from, next) => {
// 等待应用配置加载完
await Loading.wait();
// 数据缓存
const { user, process } = useBase();
// 预先注册路由
const { isReg, route } = await router.register(to.path);
// 查找路由信息
const { isReg, route } = router.find(to.path);
// 组件不存在、路由不存在
if (!route?.components) {
next(user.token ? "/404" : "/login");
} else {
// 路由不存在
if (!route) {
next(user.token ? '/404' : '/login');
return;
}
// 路由未注册
if (!isReg) {
// 注册路由
router.append(route);
// 重定向原路径
next(to.fullPath);
} else {
return;
}
// 登录成功
if (user.token) {
// 在登录页
if (to.path.includes("/login")) {
if (to.path.includes('/login')) {
// Token 未过期
if (!storage.isExpired("token")) {
if (!storage.isExpired('token')) {
// 回到首页
return next("/");
next('/');
return;
}
} else {
// 添加路由进程
@ -204,14 +236,13 @@ router.beforeEach(async (to, from, next) => {
}
} else {
// 忽略部分 Token 验证
if (!config.ignore.token.find((e) => to.path == e)) {
return next("/login");
if (!config.ignore.token.find(e => to.path == e)) {
next('/login');
return;
}
}
next();
}
}
});
export { router };

View File

@ -1,8 +1,8 @@
// @ts-nocheck
import { isDev, config, proxy } from "../../config";
import { isObject } from "lodash-es";
import { request } from "./request";
import { AxiosRequestConfig } from "axios";
import { isDev, config, proxy } from '../../config';
import { isObject } from 'lodash-es';
import { request } from './request';
import { AxiosRequestConfig } from 'axios';
export function Service(
value:
@ -15,7 +15,7 @@ export function Service(
) {
return function (target: any) {
// 命名
if (typeof value == "string") {
if (typeof value == 'string') {
target.prototype.namespace = value;
}
@ -44,8 +44,8 @@ export class BaseService {
async request(options: AxiosRequestConfig = {}) {
if (options.url) {
// 过滤 http 开头的地址
if (options.url.indexOf("http") < 0) {
let ns = "";
if (options.url.indexOf('http') < 0) {
let ns = '';
if (isDev) {
ns = this.proxy || config.baseUrl;
@ -55,7 +55,7 @@ export class BaseService {
// 拼接前缀
if (this.namespace) {
ns += "/" + this.namespace;
ns += '/' + this.namespace;
}
// 处理地址
@ -70,47 +70,47 @@ export class BaseService {
async list(data: any) {
return this.request({
url: "/list",
method: "POST",
url: '/list',
method: 'POST',
data
});
}
async page(data: any) {
return this.request({
url: "/page",
method: "POST",
url: '/page',
method: 'POST',
data
});
}
async info(params: any) {
return this.request({
url: "/info",
url: '/info',
params
});
}
async update(data: any) {
return this.request({
url: "/update",
method: "POST",
url: '/update',
method: 'POST',
data
});
}
async delete(data: any) {
return this.request({
url: "/delete",
method: "POST",
url: '/delete',
method: 'POST',
data
});
}
async add(data: any) {
return this.request({
url: "/add",
method: "POST",
url: '/add',
method: 'POST',
data
});
}

View File

@ -1,9 +1,9 @@
import { hmr } from "../hooks";
import { BaseService } from "./base";
import { hmr } from '../hooks';
import { BaseService } from './base';
// service 数据集合
export const service: Eps.Service = hmr.getData("service", {
export const service: Eps.Service = hmr.getData('service', {
request: new BaseService().request
});
export * from "./base";
export * from './base';

View File

@ -1,12 +1,12 @@
import axios from "axios";
import NProgress from "nprogress";
import "nprogress/nprogress.css";
import { ElMessage } from "element-plus";
import { endsWith } from "lodash-es";
import { storage } from "/@/cool/utils";
import { useBase } from "/$/base";
import { router } from "../router";
import { config, isDev } from "/@/config";
import axios from 'axios';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import { ElMessage } from 'element-plus';
import { endsWith } from 'lodash-es';
import { storage } from '/@/cool/utils';
import { useBase } from '/$/base';
import { router } from '../router';
import { config, isDev } from '/@/config';
const request = axios.create({
timeout: import.meta.env.VITE_TIMEOUT,
@ -31,7 +31,7 @@ request.interceptors.request.use(
if (req.url) {
// 请求进度条
if (
!config.ignore.NProgress.some((e) => req.url.match(new RegExp(`${e}.*`))) &&
!config.ignore.NProgress.some(e => req.url.match(new RegExp(`${e}.*`))) &&
(req.NProgress ?? true)
) {
NProgress.start();
@ -41,28 +41,28 @@ request.interceptors.request.use(
// 请求信息
if (isDev) {
console.group(req.url);
console.log("method:", req.method);
console.table("data:", req.method == "get" ? req.params : req.data);
console.log('method:', req.method);
console.table('data:', req.method == 'get' ? req.params : req.data);
console.groupEnd();
}
// 验证 token
if (user.token) {
// 请求标识
if (req.headers && req.headers["Authorization"] !== null) {
req.headers["Authorization"] = user.token;
if (req.headers && req.headers['Authorization'] !== null) {
req.headers['Authorization'] = user.token;
}
// 忽略
if (["eps", "refreshToken"].some((e) => endsWith(req.url, e))) {
if (['eps', 'refreshToken'].some(e => endsWith(req.url, e))) {
return req;
}
// 判断 token 是否过期
if (storage.isExpired("token")) {
if (storage.isExpired('token')) {
// 判断 refreshToken 是否过期
if (storage.isExpired("refreshToken")) {
ElMessage.error("登录状态已失效,请重新登录");
if (storage.isExpired('refreshToken')) {
ElMessage.error('登录状态已失效,请重新登录');
user.logout();
} else {
// 是否在刷新中
@ -70,8 +70,8 @@ request.interceptors.request.use(
isRefreshing = true;
user.refreshToken()
.then((token) => {
queue.forEach((cb) => cb(token));
.then(token => {
queue.forEach(cb => cb(token));
queue = [];
isRefreshing = false;
})
@ -80,12 +80,12 @@ request.interceptors.request.use(
});
}
return new Promise((resolve) => {
return new Promise(resolve => {
// 继续请求
queue.push((token) => {
queue.push(token => {
// 重新设置 token
if (req.headers) {
req.headers["Authorization"] = token;
req.headers['Authorization'] = token;
}
resolve(req);
});
@ -96,14 +96,14 @@ request.interceptors.request.use(
return req;
},
(error) => {
error => {
return Promise.reject(error);
}
);
// 响应
request.interceptors.response.use(
(res) => {
res => {
NProgress.done();
if (!res?.data) {
@ -123,7 +123,7 @@ request.interceptors.response.use(
return Promise.reject({ code, message });
}
},
async (error) => {
async error => {
NProgress.done();
if (error.response) {
@ -136,15 +136,15 @@ request.interceptors.response.use(
if (!isDev) {
switch (status) {
case 403:
router.push("/403");
router.push('/403');
break;
case 500:
router.push("/500");
router.push('/500');
break;
case 502:
router.push("/502");
router.push('/502');
break;
}
}

View File

@ -1,5 +1,5 @@
import { Component, Directive, App } from "vue";
import { Router as VueRouter, RouteRecordRaw } from "vue-router";
import type { Component, Directive, App } from 'vue';
import type { Router as VueRouter, RouteRecordRaw } from 'vue-router';
export declare type Merge<A, B> = Omit<A, keyof B> & B;
@ -24,7 +24,7 @@ export declare interface ModuleConfig {
};
components?: Component[];
views?: RouteRecordRaw[];
pages?: RouteRecordRaw[];
pages?: (RouteRecordRaw & { isPage?: boolean })[];
install?(app: App, options?: any): any;
onLoad?(events: {
hasToken: (cb: () => Promise<any> | void) => Promise<any> | void;
@ -44,17 +44,8 @@ export declare interface Module extends ModuleConfig {
}
export declare interface Router extends VueRouter {
find(path: string): RouteRecordRaw | undefined;
append(
data: {
name?: string;
path: string;
component?: any;
viewPath?: string;
isPage?: boolean;
[key: string]: any;
}[]
): void;
register(path: string): Promise<{ route: RouteRecordRaw | undefined; isReg: boolean }>;
[key: string]: any;
find(path: string): { route: RouteRecordRaw; isReg: boolean };
del(name: string): void;
clear(): void;
append(data: any | any[]): void;
}

View File

@ -1,6 +1,6 @@
import { isArray, isNumber, isString, orderBy } from "lodash-es";
import { resolveComponent } from "vue";
import storage from "./storage";
import { isArray, isNumber, isString, orderBy } from 'lodash-es';
import { resolveComponent } from 'vue';
import storage from './storage';
// 首字母大写
export function firstUpperCase(value: string): string {
@ -16,7 +16,7 @@ export function getNames(value: any) {
// 获取地址栏参数
export function getUrlParam(name: string): string | null {
const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
const r = window.location.search.substr(1).match(reg);
if (r != null) return decodeURIComponent(r[2]);
return null;
@ -24,13 +24,13 @@ export function getUrlParam(name: string): string | null {
// 文件名
export function filename(path: string): string {
return basename(path.substring(0, path.lastIndexOf(".")));
return basename(path.substring(0, path.lastIndexOf('.')));
}
// 路径名称
export function basename(path: string): string {
let index = path.lastIndexOf("/");
index = index > -1 ? index : path.lastIndexOf("\\");
let index = path.lastIndexOf('/');
index = index > -1 ? index : path.lastIndexOf('\\');
if (index < 0) {
return path;
}
@ -39,7 +39,7 @@ export function basename(path: string): string {
// 文件扩展名
export function extname(path: string): string {
return path.substring(path.lastIndexOf(".") + 1).split(/(\?|&)/)[0];
return path.substring(path.lastIndexOf('.') + 1).split(/(\?|&)/)[0];
}
// 横杠转驼峰
@ -50,17 +50,17 @@ export function toCamel(str: string): string {
}
// uuid
export function uuid(separator = "-"): string {
export function uuid(separator = '-'): string {
const s: any[] = [];
const hexDigits = "0123456789abcdef";
const hexDigits = '0123456789abcdef';
for (let i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
s[14] = "4";
s[14] = '4';
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
s[8] = s[13] = s[18] = s[23] = separator;
return s.join("");
return s.join('');
}
// 浏览器信息
@ -71,83 +71,83 @@ export function getBrowser() {
const ua = navigator.userAgent.toLowerCase();
// 浏览器类型
let type = (ua.match(/firefox|chrome|safari|opera/g) || "other")[0];
let type = (ua.match(/firefox|chrome|safari|opera/g) || 'other')[0];
if ((ua.match(/msie|trident/g) || [])[0]) {
type = "msie";
type = 'msie';
}
// 平台标签
let tag = "";
let tag = '';
const isTocuh =
"ontouchstart" in window || ua.indexOf("touch") !== -1 || ua.indexOf("mobile") !== -1;
'ontouchstart' in window || ua.indexOf('touch') !== -1 || ua.indexOf('mobile') !== -1;
if (isTocuh) {
if (ua.indexOf("ipad") !== -1) {
tag = "pad";
} else if (ua.indexOf("mobile") !== -1) {
tag = "mobile";
} else if (ua.indexOf("android") !== -1) {
tag = "androidPad";
if (ua.indexOf('ipad') !== -1) {
tag = 'pad';
} else if (ua.indexOf('mobile') !== -1) {
tag = 'mobile';
} else if (ua.indexOf('android') !== -1) {
tag = 'androidPad';
} else {
tag = "pc";
tag = 'pc';
}
} else {
tag = "pc";
tag = 'pc';
}
// 浏览器内核
let prefix = "";
let prefix = '';
switch (type) {
case "chrome":
case "safari":
case "mobile":
prefix = "webkit";
case 'chrome':
case 'safari':
case 'mobile':
prefix = 'webkit';
break;
case "msie":
prefix = "ms";
case 'msie':
prefix = 'ms';
break;
case "firefox":
prefix = "Moz";
case 'firefox':
prefix = 'Moz';
break;
case "opera":
prefix = "O";
case 'opera':
prefix = 'O';
break;
default:
prefix = "webkit";
prefix = 'webkit';
break;
}
// 操作平台
const plat = ua.indexOf("android") > 0 ? "android" : navigator.platform.toLowerCase();
const plat = ua.indexOf('android') > 0 ? 'android' : navigator.platform.toLowerCase();
// 屏幕信息
let screen = "full";
let screen = 'full';
if (clientWidth < 768) {
screen = "xs";
screen = 'xs';
} else if (clientWidth < 992) {
screen = "sm";
screen = 'sm';
} else if (clientWidth < 1200) {
screen = "md";
screen = 'md';
} else if (clientWidth < 1920) {
screen = "xl";
screen = 'xl';
} else {
screen = "full";
screen = 'full';
}
// 是否 ios
const isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
// 是否 PC 端
const isPC = tag === "pc";
const isPC = tag === 'pc';
// 是否移动端
const isMobile = isPC ? false : true;
// 是否移动端 + 屏幕宽过小
const isMini = screen === "xs" || isMobile;
const isMini = screen === 'xs' || isMobile;
return {
height: clientHeight,
@ -168,13 +168,13 @@ export function getBrowser() {
export function deepPaths(paths: string[], splitor?: string) {
const list: any[] = [];
paths.forEach((e) => {
const arr: string[] = e.split(splitor || "/").filter(Boolean);
paths.forEach(e => {
const arr: string[] = e.split(splitor || '/').filter(Boolean);
let c = list;
arr.forEach((a, i) => {
let d = c.find((e) => e.label == a);
let d = c.find(e => e.label == a);
if (!d) {
d = {
@ -196,16 +196,16 @@ export function deepPaths(paths: string[], splitor?: string) {
}
// 列表转树形
export function deepTree(list: any[], sort?: "desc" | "asc"): any[] {
export function deepTree(list: any[], sort?: 'desc' | 'asc'): any[] {
const newList: any[] = [];
const map: any = {};
orderBy(list, "orderNum", sort)
.map((e) => {
orderBy(list, 'orderNum', sort)
.map(e => {
map[e.id] = e;
return e;
})
.forEach((e) => {
.forEach(e => {
const parent = map[e.parentId];
if (parent) {
@ -224,7 +224,7 @@ export function revDeepTree(list: any[]) {
let id = 0;
function deep(list: any[], parentId: number) {
list.forEach((e) => {
list.forEach(e => {
if (!e.id) {
e.id = ++id;
}
@ -252,13 +252,13 @@ export function path2Obj(list: any[]) {
list.forEach(({ path, value }) => {
if (path) {
const arr: string[] = path.split("/");
const arr: string[] = path.split('/');
const parents = arr.slice(0, arr.length - 1);
const name = basename(path).replace(".ts", "");
const name = basename(path).replace('.ts', '');
let curr = data;
parents.forEach((k) => {
parents.forEach(k => {
if (!curr[k]) {
curr[k] = {};
}
@ -280,7 +280,7 @@ export function isComponent(name: string) {
// 是否Promise
export function isPromise(val: any) {
return val && Object.prototype.toString.call(val) === "[object Promise]";
return val && Object.prototype.toString.call(val) === '[object Promise]';
}
// 单位转换
@ -290,7 +290,7 @@ export function parsePx(val: string | number) {
// 延迟
export function sleep(duration: number) {
return new Promise((resolve) => {
return new Promise(resolve => {
setTimeout(() => {
resolve(true);
}, duration);
@ -298,4 +298,4 @@ export function sleep(duration: number) {
}
export { storage };
export * from "./loading";
export * from './loading';

View File

@ -6,7 +6,7 @@ export const Loading = {
try {
await Promise.all(list);
} catch (e) {
console.error("[Loading] Error: ", e);
console.error('[Loading] Error: ', e);
}
if (this.resolve) {
@ -22,16 +22,16 @@ export const Loading = {
},
close() {
const el = document.getElementById("Loading");
const el = document.getElementById('Loading');
if (el) {
setTimeout(() => {
el.classList.add("is-hide");
el.classList.add('is-hide');
}, 0);
}
}
};
Loading.next = new Promise<void>((resolve) => {
Loading.next = new Promise<void>(resolve => {
Loading.resolve = resolve;
});

View File

@ -1,8 +1,8 @@
import store from "store";
import store from 'store';
export default {
// 后缀标识
suffix: "_deadtime",
suffix: '_deadtime',
/**
*

View File

@ -1,14 +1,14 @@
import { createApp } from "vue";
import App from "./App.vue";
import { bootstrap } from "./cool";
import { createApp } from 'vue';
import App from './App.vue';
import { bootstrap } from './cool';
const app = createApp(App);
// 启动
bootstrap(app)
.then(() => {
app.mount("#app");
app.mount('#app');
})
.catch((err) => {
console.error("COOL-ADMIN 启动失败", err);
.catch(err => {
console.error('COOL-ADMIN 启动失败', err);
});

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