zyf-model-engine 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/build/getEnv.d.ts +13 -0
  2. package/build/plugins.d.ts +7 -0
  3. package/build/proxy.d.ts +11 -0
  4. package/index.html +2 -100
  5. package/manifest.webmanifest +1 -0
  6. package/package.json +3 -94
  7. package/registerSW.js +1 -0
  8. package/src/api/config/servicePort.d.ts +2 -0
  9. package/src/api/enums/httpEnum.d.ts +29 -0
  10. package/src/api/helper/axiosCancel.d.ts +21 -0
  11. package/src/api/helper/axiosFileCancel.d.ts +27 -0
  12. package/src/api/helper/checkStatus.d.ts +6 -0
  13. package/src/api/index.d.ts +26 -0
  14. package/src/api/interface/index.d.ts +18 -0
  15. package/src/components/CTree/interface/index.d.ts +6 -0
  16. package/src/components/Grid/interface/index.d.ts +5 -0
  17. package/src/components/ProTable/interface/index.d.ts +66 -0
  18. package/src/config/index.d.ts +5 -0
  19. package/src/config/nprogress.d.ts +3 -0
  20. package/src/config/piniaPersist.d.ts +10 -0
  21. package/src/config/serviceLoading.d.ts +5 -0
  22. package/src/enums/httpEnum.d.ts +19 -0
  23. package/src/hooks/interface/index.d.ts +30 -0
  24. package/src/hooks/useOnline.d.ts +6 -0
  25. package/src/hooks/useTable.d.ts +47 -0
  26. package/src/main.d.ts +1 -0
  27. package/src/stores/commonStore.d.ts +2 -0
  28. package/src/stores/index.d.ts +2 -0
  29. package/src/stores/interface/index.d.ts +1 -0
  30. package/src/utils/color.d.ts +28 -0
  31. package/src/utils/commonUtils.d.ts +63 -0
  32. package/src/utils/errorHandler.d.ts +5 -0
  33. package/src/utils/is.d.ts +82 -0
  34. package/src/utils/layoutUtils.d.ts +44 -0
  35. package/src/utils/localUtils.d.ts +24 -0
  36. package/src/utils/serviceDict.d.ts +7 -0
  37. package/style.css +1 -0
  38. package/sw.js +1 -0
  39. package/vite.config.d.ts +2 -0
  40. package/workbox-3e911b1d.js +1 -0
  41. package/zyf-model-engine.mjs +45118 -0
  42. package/zyf-model-engine.umd.js +81 -0
  43. package/.editorconfig +0 -15
  44. package/.env +0 -13
  45. package/.env.development +0 -20
  46. package/.env.production +0 -25
  47. package/.env.test +0 -25
  48. package/.eslintignore +0 -15
  49. package/.eslintrc-auto-import.json +0 -65
  50. package/.eslintrc.cjs +0 -66
  51. package/.husky/commit-msg +0 -4
  52. package/.husky/pre-commit +0 -5
  53. package/.prettierignore +0 -9
  54. package/.prettierrc.cjs +0 -41
  55. package/.stylelintignore +0 -4
  56. package/.stylelintrc.cjs +0 -40
  57. package/.vscode/extensions.json +0 -14
  58. package/.vscode/settings.json +0 -92
  59. package/CHANGELOG.md +0 -246
  60. package/LICENSE +0 -21
  61. package/README.md +0 -205
  62. package/auto-imports.d.ts +0 -132
  63. package/build/getEnv.ts +0 -46
  64. package/build/plugins.ts +0 -138
  65. package/build/proxy.ts +0 -28
  66. package/commitlint.config.cjs +0 -84
  67. package/components.d.ts +0 -28
  68. package/lint-staged.config.cjs +0 -8
  69. package/postcss.config.cjs +0 -5
  70. package/src/App.vue +0 -16
  71. package/src/api/config/servicePort.ts +0 -3
  72. package/src/api/enums/httpEnum.ts +0 -35
  73. package/src/api/helper/axiosCancel.ts +0 -50
  74. package/src/api/helper/axiosFileCancel.ts +0 -62
  75. package/src/api/helper/checkStatus.ts +0 -97
  76. package/src/api/index.ts +0 -142
  77. package/src/api/interface/index.ts +0 -27
  78. package/src/assets/global-icons/icon-demo.svg +0 -1
  79. package/src/assets/iconfont/iconfont.scss +0 -44
  80. package/src/assets/iconfont/iconfont.ttf +0 -0
  81. package/src/assets/images/empty-img.png +0 -0
  82. package/src/assets/option-icons/add.svg +0 -1
  83. package/src/assets/option-icons/check.svg +0 -1
  84. package/src/assets/option-icons/config.svg +0 -1
  85. package/src/assets/option-icons/del.svg +0 -1
  86. package/src/assets/option-icons/detail.svg +0 -1
  87. package/src/assets/option-icons/edit.svg +0 -2
  88. package/src/assets/option-icons/export.svg +0 -1
  89. package/src/assets/option-icons/folder.svg +0 -1
  90. package/src/assets/option-icons/full-screen.svg +0 -1
  91. package/src/assets/option-icons/more.svg +0 -1
  92. package/src/assets/option-icons/return.svg +0 -1
  93. package/src/assets/option-icons/search.svg +0 -1
  94. package/src/components/CSvgIcon/index.scss +0 -23
  95. package/src/components/CSvgIcon/index.vue +0 -74
  96. package/src/components/CTree/index.scss +0 -48
  97. package/src/components/CTree/index.vue +0 -176
  98. package/src/components/CTree/interface/index.ts +0 -6
  99. package/src/components/Dialog/index.scss +0 -74
  100. package/src/components/Dialog/index.vue +0 -87
  101. package/src/components/Empty/index.scss +0 -16
  102. package/src/components/Empty/index.vue +0 -43
  103. package/src/components/Grid/components/GridItem.vue +0 -68
  104. package/src/components/Grid/index.vue +0 -167
  105. package/src/components/Grid/interface/index.ts +0 -6
  106. package/src/components/Loading/index.scss +0 -67
  107. package/src/components/Loading/index.vue +0 -13
  108. package/src/components/Overflow/index.vue +0 -76
  109. package/src/components/ProTable/components/ColSetting.vue +0 -45
  110. package/src/components/ProTable/components/Pagination.vue +0 -29
  111. package/src/components/ProTable/components/SearchForm/components/SearchFormItem.vue +0 -93
  112. package/src/components/ProTable/components/SearchForm/index.scss +0 -12
  113. package/src/components/ProTable/components/SearchForm/index.vue +0 -91
  114. package/src/components/ProTable/components/TableColumn.vue +0 -56
  115. package/src/components/ProTable/index.scss +0 -14
  116. package/src/components/ProTable/index.vue +0 -274
  117. package/src/components/ProTable/interface/index.ts +0 -86
  118. package/src/components/ScrollBox/index.vue +0 -44
  119. package/src/components/SvgIcon/index.vue +0 -20
  120. package/src/components/Tabs/index.vue +0 -142
  121. package/src/config/index.ts +0 -12
  122. package/src/config/nprogress.ts +0 -12
  123. package/src/config/piniaPersist.ts +0 -19
  124. package/src/config/serviceLoading.ts +0 -45
  125. package/src/enums/httpEnum.ts +0 -24
  126. package/src/hooks/interface/index.ts +0 -32
  127. package/src/hooks/useOnline.ts +0 -27
  128. package/src/hooks/useTable.ts +0 -167
  129. package/src/main.ts +0 -35
  130. package/src/plugins/button/button.vue +0 -56
  131. package/src/plugins/index.js +0 -26
  132. package/src/plugins/index.vue +0 -24
  133. package/src/plugins/msg/msg.vue +0 -56
  134. package/src/stores/commonStore.ts +0 -9
  135. package/src/stores/index.ts +0 -8
  136. package/src/stores/interface/index.ts +0 -1
  137. package/src/styles/common.scss +0 -87
  138. package/src/styles/element.scss +0 -233
  139. package/src/styles/reset.scss +0 -20
  140. package/src/styles/var.scss +0 -2
  141. package/src/typings/global.d.ts +0 -37
  142. package/src/typings/window.d.ts +0 -8
  143. package/src/utils/color.ts +0 -59
  144. package/src/utils/commonUtils.ts +0 -175
  145. package/src/utils/errorHandler.ts +0 -28
  146. package/src/utils/is.ts +0 -147
  147. package/src/utils/layoutUtils.ts +0 -83
  148. package/src/utils/localUtils.ts +0 -42
  149. package/src/utils/serviceDict.ts +0 -9
  150. package/src/vite-env.d.ts +0 -6
  151. package/tsconfig.json +0 -50
  152. package/vite.config.ts +0 -76
  153. /package/{public/logo.png → logo.png} +0 -0
@@ -1,28 +0,0 @@
1
- import { ElNotification } from "element-plus";
2
-
3
- /**
4
- * @description 全局代码错误捕捉
5
- * */
6
- const errorHandler = (error: any) => {
7
- console.log(error);
8
- // 过滤 HTTP 请求错误
9
- if (error.status || error.status == 0) return false;
10
- let errorMap: { [key: string]: string } = {
11
- InternalError: "Javascript引擎内部错误",
12
- ReferenceError: "未找到对象",
13
- TypeError: "使用了错误的类型或对象",
14
- RangeError: "使用内置对象时,参数超范围",
15
- SyntaxError: "语法错误",
16
- EvalError: "错误的使用了Eval",
17
- URIError: "URI错误"
18
- };
19
- let errorName = errorMap[error.name] || "未知错误";
20
- ElNotification({
21
- title: errorName,
22
- message: error,
23
- type: "error",
24
- duration: 3000
25
- });
26
- };
27
-
28
- export default errorHandler;
package/src/utils/is.ts DELETED
@@ -1,147 +0,0 @@
1
- /**
2
- * @description: 判断值是某个类型
3
- */
4
- export function is(val: unknown, type: string) {
5
- return Object.prototype.toString.call(val) === `[object ${type}]`;
6
- }
7
-
8
- /**
9
- * @description 判断数据类型
10
- * @param {*} val 需要判断类型的数据
11
- * @returns {String}
12
- */
13
- export function isType(val: any) {
14
- if (val === null) return "null";
15
- if (typeof val !== "object") return typeof val;
16
- else return Object.prototype.toString.call(val).slice(8, -1).toLocaleLowerCase();
17
- }
18
-
19
- /**
20
- * @description: 是否为空
21
- */
22
- export const isEmpty = (val: any) => {
23
- if (val !== null && val !== undefined && val !== "") {
24
- return false;
25
- } else {
26
- return true;
27
- }
28
- };
29
-
30
- /**
31
- * @description: 是否为函数
32
- */
33
- export function isFunction<T = Function>(val: unknown): val is T {
34
- return is(val, "Function");
35
- }
36
-
37
- /**
38
- * @description: 是否已定义
39
- */
40
- export const isDef = <T = unknown>(val?: T): val is T => {
41
- return typeof val !== "undefined";
42
- };
43
-
44
- /**
45
- * @description: 是否未定义
46
- */
47
- export const isUnDef = <T = unknown>(val?: T): val is T => {
48
- return !isDef(val);
49
- };
50
-
51
- /**
52
- * @description: 是否为对象
53
- */
54
- export const isObject = (val: any): val is Record<any, any> => {
55
- return val !== null && is(val, "Object");
56
- };
57
-
58
- /**
59
- * @description: 是否为时间
60
- */
61
- export function isDate(val: unknown): val is Date {
62
- return is(val, "Date");
63
- }
64
-
65
- /**
66
- * @description: 是否为数值
67
- */
68
- export function isNumber(val: unknown): val is number {
69
- return is(val, "Number");
70
- }
71
-
72
- /**
73
- * @description: 是否为AsyncFunction
74
- */
75
- export function isAsyncFunction<T = any>(val: unknown): val is Promise<T> {
76
- return is(val, "AsyncFunction");
77
- }
78
-
79
- /**
80
- * @description: 是否为promise
81
- */
82
- export function isPromise<T = any>(val: unknown): val is Promise<T> {
83
- return is(val, "Promise") && isObject(val) && isFunction(val.then) && isFunction(val.catch);
84
- }
85
-
86
- /**
87
- * @description: 是否为字符串
88
- */
89
- export function isString(val: unknown): val is string {
90
- return is(val, "String");
91
- }
92
-
93
- /**
94
- * @description: 是否为boolean类型
95
- */
96
- export function isBoolean(val: unknown): val is boolean {
97
- return is(val, "Boolean");
98
- }
99
-
100
- /**
101
- * @description: 是否为数组
102
- */
103
- export function isArray(val: any): val is Array<any> {
104
- return val && Array.isArray(val);
105
- }
106
-
107
- /**
108
- * @description: 是否客户端
109
- */
110
- export const isClient = () => {
111
- return typeof window !== "undefined";
112
- };
113
-
114
- /**
115
- * @description: 是否为浏览器
116
- */
117
- export const isWindow = (val: any): val is Window => {
118
- return typeof window !== "undefined" && is(val, "Window");
119
- };
120
-
121
- /**
122
- * @description: 是否为 element 元素
123
- */
124
- export const isElement = (val: unknown): val is Element => {
125
- return isObject(val) && !!val.tagName;
126
- };
127
-
128
- /**
129
- * @description: 是否为 null
130
- */
131
- export function isNull(val: unknown): val is null {
132
- return val === null;
133
- }
134
-
135
- /**
136
- * @description: 是否为 null || undefined
137
- */
138
- export function isNullOrUnDef(val: unknown): val is null | undefined {
139
- return isUnDef(val) || isNull(val);
140
- }
141
-
142
- /**
143
- * @description: 是否为 16 进制颜色
144
- */
145
- export const isHexColor = (str: string) => {
146
- return /^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(str);
147
- };
@@ -1,83 +0,0 @@
1
- import { isArray } from "@/utils/is";
2
- import { FieldNamesProps } from "@/components/ProTable/interface";
3
-
4
- /**
5
- * @description 格式化表格单元格默认值 (el-table-column)
6
- * @param {Number} row 行
7
- * @param {Number} col 列
8
- * @param {*} callValue 当前单元格值
9
- * @returns {String}
10
- * */
11
- export function formatTableColumn(row: number, col: number, callValue: any) {
12
- // 如果当前值为数组,使用 / 拼接(根据需求自定义)
13
- if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--";
14
- return callValue ?? "--";
15
- }
16
-
17
- /**
18
- * @description 处理值无数据情况
19
- * @param {*} callValue 需要处理的值
20
- * @returns {String}
21
- * */
22
- export function formatValue(callValue: any) {
23
- // 如果当前值为数组,使用 / 拼接(根据需求自定义)
24
- if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--";
25
- return callValue ?? "--";
26
- }
27
-
28
- /**
29
- * @description 处理 prop 为多级嵌套的情况,返回的数据 (列如: prop: user.name)
30
- * @param {Object} row 当前行数据
31
- * @param {String} prop 当前 prop
32
- * @returns {*}
33
- * */
34
- export function handleRowAccordingToProp(row: { [key: string]: any }, prop: string) {
35
- if (!prop.includes(".")) return row[prop] ?? "--";
36
- prop.split(".").forEach(item => (row = row[item] ?? "--"));
37
- return row;
38
- }
39
-
40
- /**
41
- * @description 处理 prop,当 prop 为多级嵌套时 ==> 返回最后一级 prop
42
- * @param {String} prop 当前 prop
43
- * @returns {String}
44
- * */
45
- export function handleProp(prop: string) {
46
- const propArr = prop.split(".");
47
- if (propArr.length == 1) return prop;
48
- return propArr[propArr.length - 1];
49
- }
50
-
51
- /**
52
- * @description 根据枚举列表查询当需要的数据(如果指定了 label 和 value 的 key值,会自动识别格式化)
53
- * @param {String} callValue 当前单元格值
54
- * @param {Array} enumData 字典列表
55
- * @param {Array} fieldNames label && value && children 的 key 值
56
- * @param {String} type 过滤类型(目前只有 tag)
57
- * @returns {String}
58
- * */
59
- export function filterEnum(callValue: any, enumData?: any, fieldNames?: FieldNamesProps, type?: "tag") {
60
- const value = fieldNames?.value ?? "value";
61
- const label = fieldNames?.label ?? "label";
62
- const children = fieldNames?.children ?? "children";
63
- let filterData: { [key: string]: any } = {};
64
- // 判断 enumData 是否为数组
65
- if (Array.isArray(enumData)) filterData = findItemNested(enumData, callValue, value, children);
66
- // 判断是否输出的结果为 tag 类型
67
- if (type == "tag") {
68
- return filterData?.tagType ? filterData.tagType : "";
69
- } else {
70
- return filterData ? filterData[label] : "--";
71
- }
72
- }
73
-
74
- /**
75
- * @description 递归查找 callValue 对应的 enum 值
76
- * */
77
- export function findItemNested(enumData: any, callValue: any, value: string, children: string) {
78
- return enumData.reduce((accumulator: any, current: any) => {
79
- if (accumulator) return accumulator;
80
- if (current[value] === callValue) return current;
81
- if (current[children]) return findItemNested(current[children], callValue, value, children);
82
- }, null);
83
- }
@@ -1,42 +0,0 @@
1
- /**
2
- * @description 获取localStorage
3
- * @param {String} key Storage名称
4
- * @returns {String}
5
- */
6
-
7
- import { DEMO_KEY } from "@/config";
8
- export function localGet(key: string) {
9
- const value = window.localStorage.getItem(DEMO_KEY + key);
10
- try {
11
- return JSON.parse(window.localStorage.getItem(DEMO_KEY + key) as string);
12
- } catch (error) {
13
- return value;
14
- }
15
- }
16
-
17
- /**
18
- * @description 存储localStorage
19
- * @param {String} key Storage名称
20
- * @param {*} value Storage值
21
- * @returns {void}
22
- */
23
- export function localSet(key: string, value: any) {
24
- window.localStorage.setItem(DEMO_KEY + key, JSON.stringify(value));
25
- }
26
-
27
- /**
28
- * @description 清除localStorage
29
- * @param {String} key Storage名称
30
- * @returns {void}
31
- */
32
- export function localRemove(key: string) {
33
- window.localStorage.removeItem(DEMO_KEY + key);
34
- }
35
-
36
- /**
37
- * @description 清除所有localStorage
38
- * @returns {void}
39
- */
40
- export function localClear() {
41
- window.localStorage.clear();
42
- }
@@ -1,9 +0,0 @@
1
- // ? 系统全局字典
2
-
3
- /**
4
- * @description:用户状态
5
- */
6
- export const userStatus = [
7
- { label: "启用", value: 1 },
8
- { label: "禁用", value: 0 }
9
- ];
package/src/vite-env.d.ts DELETED
@@ -1,6 +0,0 @@
1
- /// <reference types="vite/client" />
2
- declare module "*.vue" {
3
- import { ComponentOptions } from "vue";
4
- const componentOptions: ComponentOptions;
5
- export default componentOptions;
6
- }
package/tsconfig.json DELETED
@@ -1,50 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "declaration": true,
4
- "target": "ESNext",
5
- "useDefineForClassFields": true,
6
- "module": "ESNext",
7
- "moduleResolution": "Node",
8
- "types": ["vite/client", "element-plus/global"],
9
- "sourceMap": true,
10
- /* Strict Type-Checking Options */
11
- "strict": false /* 不使用严格的类型检查. */,
12
- "noImplicitAny": false /* 是否在表达式和声明上有隐含的any类型时报错. */,
13
- "declarationDir": "./lib/types",
14
- "emitDeclarationOnly": true,
15
- // "strictNullChecks": true, /* Enable strict null checks. */
16
- // "strictFunctionTypes": true, /* Enable strict checking of function types. */
17
- // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
18
- // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
19
- // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
20
- // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
21
- "allowSyntheticDefaultImports": true,
22
- "jsx": "preserve",
23
- "resolveJsonModule": true,
24
- "isolatedModules": true,
25
- "esModuleInterop": true,
26
- "lib": ["ESNext", "DOM"],
27
- "skipLibCheck": true,
28
- // "noEmit": true,
29
- "baseUrl": "./",
30
- "paths": {
31
- "@": ["src"],
32
- "@/*": ["src/*"]
33
- }
34
- },
35
- "include": [
36
- "src/**/*.ts",
37
- "src/*.ts",
38
- "src/**/*.js",
39
- "src/**/*.d.ts",
40
- "src/**/*.tsx",
41
- "build/**/*.ts",
42
- "build/**/*.d.ts",
43
- "lib/**/*.ts",
44
- "lib/**/*.d.ts",
45
- "vite.config.ts",
46
- "./components.d.ts",
47
- "./auto-imports.d.ts"
48
- ],
49
- "exclude": ["node_modules", "dist", "src/views/**/*.ts"]
50
- }
package/vite.config.ts DELETED
@@ -1,76 +0,0 @@
1
- import { defineConfig, loadEnv, ConfigEnv, UserConfig } from "vite";
2
- import { resolve } from "path";
3
- import { wrapperEnv } from "./build/getEnv";
4
- import { createProxy } from "./build/proxy";
5
- import { createVitePlugins } from "./build/plugins";
6
- import pkg from "./package.json";
7
- import dayjs from "dayjs";
8
-
9
- const { dependencies, devDependencies, name, version } = pkg;
10
- const __APP_INFO__ = {
11
- pkg: { dependencies, devDependencies, name, version },
12
- lastBuildTime: dayjs().format("YYYY-MM-DD HH:mm:ss")
13
- };
14
-
15
- const fs: any = {
16
- maxFileSize: 5 * 1024 * 1024
17
- };
18
-
19
- // @see: https://vitejs.dev/config/
20
- export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
21
- const root = process.cwd();
22
- const env = loadEnv(mode, root);
23
- const viteEnv = wrapperEnv(env);
24
- return {
25
- base: viteEnv.VITE_PUBLIC_PATH,
26
- root,
27
- resolve: {
28
- alias: {
29
- "@": resolve(__dirname, "./src"),
30
- packages: resolve("packages")
31
- }
32
- },
33
- define: {
34
- __APP_INFO__: JSON.stringify(__APP_INFO__)
35
- },
36
- css: {
37
- preprocessorOptions: {
38
- scss: {
39
- api: "modern-compiler",
40
- additionalData: `@import "@/styles/var.scss";`
41
- }
42
- }
43
- },
44
- server: {
45
- host: "0.0.0.0",
46
- port: viteEnv.VITE_PORT,
47
- open: viteEnv.VITE_OPEN,
48
- cors: true,
49
- // Load proxy configuration from .env.development
50
- proxy: createProxy(viteEnv.VITE_PROXY),
51
- fs: fs
52
- },
53
- plugins: createVitePlugins(viteEnv),
54
- esbuild: {
55
- pure: viteEnv.VITE_DROP_CONSOLE ? ["console.log", "debugger"] : []
56
- },
57
- build: {
58
- outDir: "lib", //输出文件名称
59
- lib: {
60
- entry: resolve(__dirname, "src/plugins/index.js"), //指定组件编译入口文件
61
- name: "zyf-model-engine",
62
- fileName: "zyf-model-engine"
63
- }, //库编译模式配置
64
- rollupOptions: {
65
- // 确保外部化处理那些你不想打包进库的依赖
66
- external: ["vue"],
67
- output: {
68
- // 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
69
- globals: {
70
- vue: "Vue"
71
- }
72
- }
73
- } // rollup打包配置
74
- }
75
- };
76
- });
File without changes