@dinert/element-plus 1.0.1 → 1.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.
- package/README.md +335 -36
- package/dist/element-plus.umd.js +1 -1
- package/dist/element-plus.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/es/node_modules/@element-plus/icons-vue/dist/index.mjs +63 -92
- package/es/node_modules/@element-plus/icons-vue/dist/index.mjs.map +1 -1
- package/es/packages/components/form/index.mjs.map +1 -1
- package/es/packages/components/form/src/cascader.mjs.map +1 -1
- package/es/packages/components/form/src/checkbox.mjs.map +1 -1
- package/es/packages/components/form/src/date.mjs +7 -6
- package/es/packages/components/form/src/date.mjs.map +1 -1
- package/es/packages/components/form/src/index.mjs +18 -18
- package/es/packages/components/form/src/index.mjs.map +1 -1
- package/es/packages/components/form/src/input-autocomplete.mjs.map +1 -1
- package/es/packages/components/form/src/input-number.mjs.map +1 -1
- package/es/packages/components/form/src/input.mjs.map +1 -1
- package/es/packages/components/form/src/radio.mjs +12 -7
- package/es/packages/components/form/src/radio.mjs.map +1 -1
- package/es/packages/components/form/src/rate.mjs.map +1 -1
- package/es/packages/components/form/src/select.mjs.map +1 -1
- package/es/packages/components/form/src/switch.mjs.map +1 -1
- package/es/packages/components/form/src/tree-select.mjs.map +1 -1
- package/es/packages/components/form/utils/index.mjs +30 -25
- package/es/packages/components/form/utils/index.mjs.map +1 -1
- package/es/packages/components/table/hooks/index.mjs.map +1 -1
- package/es/packages/components/table/index.mjs.map +1 -1
- package/es/packages/components/table/src/index.mjs.map +1 -1
- package/es/packages/components/table/src/recuve-table-column.mjs.map +1 -1
- package/es/packages/components/table-page/index.mjs.map +1 -1
- package/es/packages/components/table-page/src/index.mjs +18 -17
- package/es/packages/components/table-page/src/index.mjs.map +1 -1
- package/es/packages/components/tooltip/index.mjs.map +1 -1
- package/es/packages/components/tooltip/src/index.mjs.map +1 -1
- package/es/packages/hooks/useTablePage/index.mjs +49 -24
- package/es/packages/hooks/useTablePage/index.mjs.map +1 -1
- package/es/packages/hooks/useWindowResize.mjs.map +1 -1
- package/es/packages/index.mjs.map +1 -1
- package/es/packages/utils/tools.mjs.map +1 -1
- package/es/src/components/form/index.d.ts +3 -3
- package/es/src/components/form/src/checkbox.d.ts +3 -3
- package/es/src/components/form/src/date.d.ts +3 -3
- package/es/src/components/form/src/index.d.ts +4 -4
- package/es/src/components/form/src/input-autocomplete.d.ts +3 -3
- package/es/src/components/form/src/input-number.d.ts +3 -3
- package/es/src/components/form/src/input.d.ts +3 -3
- package/es/src/components/form/src/radio.d.ts +3 -3
- package/es/src/components/form/src/rate.d.ts +3 -3
- package/es/src/components/form/src/switch.d.ts +3 -3
- package/es/src/components/form/src/tree-select.d.ts +3 -3
- package/es/src/components/form/types/index.d.ts +2 -2
- package/es/src/components/table/index.d.ts +359 -460
- package/es/src/components/table/src/index.d.ts +360 -462
- package/es/src/components/table/src/recuve-table-column.d.ts +4 -4
- package/es/src/components/table/types/index.d.ts +10 -9
- package/es/src/components/table-page/index.d.ts +1039 -1314
- package/es/src/components/table-page/src/index.d.ts +1041 -1316
- package/es/src/components/tooltip/index.d.ts +1 -1
- package/es/src/components/tooltip/src/index.d.ts +1 -1
- package/es/src/hooks/useTablePage/index.d.ts +5 -3
- package/es/src/index.d.ts +1 -0
- package/es/style.css +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/src/components/form/index.d.ts +3 -3
- package/lib/src/components/form/src/checkbox.d.ts +3 -3
- package/lib/src/components/form/src/date.d.ts +3 -3
- package/lib/src/components/form/src/index.d.ts +4 -4
- package/lib/src/components/form/src/input-autocomplete.d.ts +3 -3
- package/lib/src/components/form/src/input-number.d.ts +3 -3
- package/lib/src/components/form/src/input.d.ts +3 -3
- package/lib/src/components/form/src/radio.d.ts +3 -3
- package/lib/src/components/form/src/rate.d.ts +3 -3
- package/lib/src/components/form/src/switch.d.ts +3 -3
- package/lib/src/components/form/src/tree-select.d.ts +3 -3
- package/lib/src/components/form/types/index.d.ts +2 -2
- package/lib/src/components/table/index.d.ts +359 -460
- package/lib/src/components/table/src/index.d.ts +360 -462
- package/lib/src/components/table/src/recuve-table-column.d.ts +4 -4
- package/lib/src/components/table/types/index.d.ts +10 -9
- package/lib/src/components/table-page/index.d.ts +1039 -1314
- package/lib/src/components/table-page/src/index.d.ts +1041 -1316
- package/lib/src/components/tooltip/index.d.ts +1 -1
- package/lib/src/components/tooltip/src/index.d.ts +1 -1
- package/lib/src/hooks/useTablePage/index.d.ts +5 -3
- package/lib/src/index.d.ts +1 -0
- package/lib/style.css +1 -1
- package/package.json +92 -86
- package/es/src/views/test-table-page/tableColumns.d.ts +0 -27
- package/lib/src/views/test-table-page/tableColumns.d.ts +0 -27
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { getUuid as
|
|
3
|
-
import
|
|
4
|
-
class
|
|
1
|
+
import { ref as r } from "vue";
|
|
2
|
+
import { getUuid as u } from "../../utils/tools.mjs";
|
|
3
|
+
import l from "lodash";
|
|
4
|
+
class c {
|
|
5
5
|
constructor(a) {
|
|
6
|
-
this.selecTableDatas =
|
|
6
|
+
this.selecTableDatas = r([]), this.lastSelectDatas = r([]), this.ids = r([]), this.tablePageRef = r(null), this.defaultOptions = {
|
|
7
7
|
table: {
|
|
8
8
|
rowKey: "id",
|
|
9
|
-
className: "table_page" +
|
|
9
|
+
className: "table_page" + u(),
|
|
10
10
|
tableColumns: [],
|
|
11
11
|
data: [],
|
|
12
12
|
key: !0,
|
|
@@ -34,14 +34,14 @@ class f {
|
|
|
34
34
|
pagination: {}
|
|
35
35
|
},
|
|
36
36
|
form: { model: {}, formItem: {} }
|
|
37
|
-
}, this.getTableParams = () => ({}), this.ajaxTableDataAfter = () => ({}), this.lookOperations = () => ({}), this.editOperations = () => ({}), this.addOperations = () => ({}), this.deleteOperations = () => ({}), this.importOperations = () => ({}), this.options =
|
|
37
|
+
}, this.getTableParams = () => ({}), this.ajaxTableDataAfter = () => ({}), this.lookOperations = () => ({}), this.editOperations = () => ({}), this.addOperations = () => ({}), this.deleteOperations = () => ({}), this.importOperations = () => ({}), this.options = l.defaultsDeep(l.cloneDeep(a), this.defaultOptions), this.firstOptions = l.cloneDeep(this.options), this.table = r(this.options.table), this.form = r(this.options.form), this.footer = r(this.options.footer), this.showSearch = r(this.options.search), this.params = {}, this.oldParams = {}, this.tableSelectEvent();
|
|
38
38
|
}
|
|
39
39
|
// 导入
|
|
40
40
|
sizeChange(a) {
|
|
41
41
|
const e = this.table.value.pagination.pageSize;
|
|
42
42
|
this.table.value.pagination.pageSize = a;
|
|
43
|
-
const
|
|
44
|
-
(e > a ||
|
|
43
|
+
const t = this.table.value.pagination;
|
|
44
|
+
(e > a || t.currentPage <= Math.ceil(t.total / t.pageSize)) && this.search({ name: "size", pageSize: a });
|
|
45
45
|
}
|
|
46
46
|
currentChange(a) {
|
|
47
47
|
this.table.value.pagination.currentPage = a, this.search({ name: "current", currentPage: a });
|
|
@@ -56,11 +56,13 @@ class f {
|
|
|
56
56
|
a.data[e].index = e + 1 + a.pageNum * a.pageSize;
|
|
57
57
|
this.table.value.data = a.data, this.table.value.pagination.total = a.total;
|
|
58
58
|
}
|
|
59
|
+
// 获取请求的所有参数
|
|
59
60
|
getAjaxTableDataParams(a) {
|
|
60
61
|
this.params = this.getTableParams(a);
|
|
61
|
-
const e =
|
|
62
|
-
return a.name === "search" ? (e || (this.table.value.pagination.currentPage = 1, this.params = this.getTableParams(a)), this.oldParams =
|
|
62
|
+
const e = l.isEqual(this.params, this.oldParams);
|
|
63
|
+
return a.name === "search" ? (e || (this.table.value.pagination.currentPage = 1, this.params = this.getTableParams(a)), this.oldParams = l.cloneDeep(this.params)) : a.name === "reset" ? (this.resetPagination(), this.params = this.getTableParams(a), this.oldParams = l.cloneDeep(this.params)) : a.name === "delete" ? this.table.value.data && this.table.value.data.length && this.table.value.data.length === 1 && this.table.value.pagination.currentPage > 1 && (this.table.value.pagination.currentPage = 2, this.params = this.getTableParams(a)) : a.name === "current" ? (this.oldParams.data && this.oldParams.data.pageNum ? this.oldParams.data.pageNum = a.currentPage : this.oldParams.data && this.oldParams.data.page ? this.oldParams.data.page = a.currentPage : this.oldParams.params && this.oldParams.params.page ? this.oldParams.params.page = a.currentPage : this.oldParams.params && this.oldParams.params.pageNum && (this.oldParams.params.pageNum = a.currentPage), this.oldParams.data && this.oldParams.data.pageSize ? this.oldParams.data.pageSize = this.table.value.pagination.pageSize : this.oldParams.params && this.oldParams.params.pageSize && (this.oldParams.params.pageSize = this.table.value.pagination.pageSize), this.params = l.cloneDeep(this.oldParams)) : a.name === "size" && (this.oldParams.data && this.oldParams.data.pageSize ? this.oldParams.data.pageSize = a.pageSize : this.oldParams.params && this.oldParams.params.pageSize && (this.oldParams.params.pageSize = a.pageSize), this.params = l.cloneDeep(this.oldParams)), (!["size", "current"].includes(a.name || "") || !this.table.value.rowKey) && (this.selecTableDatas.value = []), this.params;
|
|
63
64
|
}
|
|
65
|
+
// 请求
|
|
64
66
|
ajaxTableData(a) {
|
|
65
67
|
return new Promise((e) => {
|
|
66
68
|
e(this.getAjaxTableDataParams(a));
|
|
@@ -68,9 +70,9 @@ class f {
|
|
|
68
70
|
}
|
|
69
71
|
// 查询
|
|
70
72
|
search(a = { name: "search" }) {
|
|
71
|
-
var e,
|
|
72
|
-
for (const
|
|
73
|
-
[null, void 0, ""].includes(this.form.value.model[
|
|
73
|
+
var e, t;
|
|
74
|
+
for (const s in (e = this.form.value) == null ? void 0 : e.model)
|
|
75
|
+
[null, void 0, ""].includes(this.form.value.model[s]) && ((t = this.form.value) == null || delete t.model[s]);
|
|
74
76
|
return this.getTableData(a);
|
|
75
77
|
}
|
|
76
78
|
// 重置查询
|
|
@@ -83,15 +85,15 @@ class f {
|
|
|
83
85
|
}
|
|
84
86
|
// 重置表格请求参数
|
|
85
87
|
resetParams() {
|
|
86
|
-
var a, e,
|
|
87
|
-
if (
|
|
88
|
-
for (const
|
|
89
|
-
(
|
|
88
|
+
var a, e, t, s, h, o, n;
|
|
89
|
+
if (l.isEmpty((a = this.firstOptions.form) == null ? void 0 : a.model))
|
|
90
|
+
for (const i in (e = this.form.value) == null ? void 0 : e.model)
|
|
91
|
+
(t = this.form.value) == null || delete t.model[i];
|
|
90
92
|
else {
|
|
91
|
-
for (const
|
|
92
|
-
(h = this.form.value) == null || delete h.model[
|
|
93
|
-
for (const
|
|
94
|
-
this.form.value.model[
|
|
93
|
+
for (const i in (s = this.form.value) == null ? void 0 : s.model)
|
|
94
|
+
(h = this.form.value) == null || delete h.model[i];
|
|
95
|
+
for (const i in (o = this.firstOptions.form) == null ? void 0 : o.model)
|
|
96
|
+
this.form.value.model[i] = (n = this.firstOptions.form) == null ? void 0 : n.model[i];
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
// 清空参数
|
|
@@ -102,10 +104,33 @@ class f {
|
|
|
102
104
|
}
|
|
103
105
|
// 根据key获取表格中的数据
|
|
104
106
|
getTableDataKeys(a = "id") {
|
|
105
|
-
this.ids.value =
|
|
107
|
+
return this.ids.value = l.map(this.table.value.data || [], a), this.ids.value;
|
|
108
|
+
}
|
|
109
|
+
// 回显选中
|
|
110
|
+
echoOperations() {
|
|
111
|
+
const a = this.table.value.rowKey, e = (this.selecTableDatas.value || []).map((t) => t[a]);
|
|
112
|
+
this.tablePageRef.value && (this.table.value.data || []).forEach((t) => {
|
|
113
|
+
var s, h, o, n, i, m;
|
|
114
|
+
e.includes(t[a]) ? (o = (h = (s = this.tablePageRef.value) == null ? void 0 : s.tableRef) == null ? void 0 : h.tableRef) == null || o.toggleRowSelection(t, !0) : (m = (i = (n = this.tablePageRef.value) == null ? void 0 : n.tableRef) == null ? void 0 : i.tableRef) == null || m.toggleRowSelection(t, !1);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
// 监听表格选择事件,包括全选和单选
|
|
118
|
+
tableSelectEvent() {
|
|
119
|
+
const a = this.table.value.rowKey;
|
|
120
|
+
this.table.value.on && (this.table.value.on.onSelect || (this.table.value.on.onSelect = (e) => {
|
|
121
|
+
a ? (this.table.value.data.forEach((t) => {
|
|
122
|
+
for (let s = 0; s < this.selecTableDatas.value.length; s++)
|
|
123
|
+
t[a] === this.selecTableDatas.value[s][a] && this.selecTableDatas.value.splice(s, 1);
|
|
124
|
+
}), this.selecTableDatas.value = l.uniqBy(e.concat(this.selecTableDatas.value), a)) : this.selecTableDatas.value = e;
|
|
125
|
+
}), this.table.value.on["onSelect-all"] || (this.table.value.on["onSelect-all"] = (e) => {
|
|
126
|
+
a ? e.length === 0 ? this.table.value.data.forEach((t) => {
|
|
127
|
+
for (let s = 0; s < this.selecTableDatas.value.length; s++)
|
|
128
|
+
t[a] === this.selecTableDatas.value[s][a] && this.selecTableDatas.value.splice(s, 1);
|
|
129
|
+
}) : this.selecTableDatas.value = l.uniqBy(e.concat(this.selecTableDatas.value), a) : this.selecTableDatas.value = e;
|
|
130
|
+
}));
|
|
106
131
|
}
|
|
107
132
|
}
|
|
108
133
|
export {
|
|
109
|
-
|
|
134
|
+
c as default
|
|
110
135
|
};
|
|
111
136
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../packages/hooks/useTablePage/index.ts"],"sourcesContent":["\r\nimport {Ref, ref} from 'vue'\r\n\r\nimport type {RewriteFormProps} from '@/components/form/types'\r\nimport type {RewriteTableProps} from '@/components/table/types'\r\n\r\nimport type {DinertTablePageProps, AjaxTableProps, ScopeFn} from '@/hooks/useTablePage/types'\r\n\r\nimport TablePageCom from '@/components/table-page/index'\r\nimport {getUuid} from '@/utils/tools'\r\nimport lodash from 'lodash'\r\n\r\n/**\r\n * T 表格data数据格式\r\n * D 表单model的数据格式\r\n * P 发起请求的数据格式\r\n * R 请求回来的数据格式\r\n */\r\n\r\nclass TablePage<T = any, D = any, P = any, R = any> {\r\n showSearch: Ref<DinertTablePageProps['search']>\r\n table: Ref<RewriteTableProps<T>>\r\n form: Ref<RewriteFormProps<D>>\r\n footer: Ref<DinertTablePageProps['footer']>\r\n\r\n selecTableDatas: Ref<T[]> = ref([])\r\n lastSelectDatas: Ref<T[]> = ref([])\r\n\r\n options: DinertTablePageProps<T, D>\r\n\r\n ids: Ref<string[]> = ref([])\r\n\r\n params: P | any\r\n oldParams: P | any\r\n\r\n tablePageRef: Ref<InstanceType<typeof TablePageCom> | null> = ref(null)\r\n\r\n private readonly defaultOptions: DinertTablePageProps<T, D> = {\r\n table: {\r\n rowKey: 'id',\r\n className: 'table_page' + getUuid(),\r\n tableColumns: [],\r\n data: [],\r\n key: true,\r\n border: true,\r\n tableSlot: true,\r\n pagination: {\r\n total: 0,\r\n currentPage: 1,\r\n pageSize: 10,\r\n pageSizes: [10, 20, 30, 50, 100],\r\n },\r\n on: {\r\n }\r\n },\r\n form: {\r\n model: {},\r\n formItem: {}\r\n },\r\n footer: false,\r\n search: false\r\n }\r\n\r\n\r\n private readonly firstOptions: DinertTablePageProps<T, D> = {\r\n table: {\r\n tableColumns: [],\r\n data: [],\r\n key: true,\r\n pagination: {}\r\n },\r\n form: {model: {}, formItem: {}}\r\n }\r\n\r\n\r\n constructor(options: DinertTablePageProps<T, D>) {\r\n\r\n this.options = lodash.defaultsDeep(lodash.cloneDeep(options), this.defaultOptions)\r\n\r\n this.firstOptions = lodash.cloneDeep(this.options)\r\n\r\n this.table = ref<DinertTablePageProps['table'] | any>(this.options.table)\r\n\r\n this.form = ref<RewriteFormProps<D | any>>(this.options.form)\r\n\r\n this.footer = ref<DinertTablePageProps['footer']>(this.options.footer)\r\n\r\n this.showSearch = ref<DinertTablePageProps['search']>(this.options.search)\r\n\r\n this.params = {}\r\n this.oldParams = {}\r\n }\r\n\r\n getTableParams: (params: P) => (Partial<P>) = () => ({} as any)\r\n ajaxTableDataAfter: (res: R) => void = () => ({})\r\n\r\n lookOperations: ScopeFn<T> = () => ({}) // 查看\r\n editOperations: ScopeFn<T> = () => ({}) // 编辑\r\n addOperations: ScopeFn<T> = () => ({}) // 添加\r\n deleteOperations: ScopeFn<T> = () => ({}) // 删除\r\n importOperations: ScopeFn<T> = () => ({}) // 导入\r\n\r\n sizeChange(size: number) {\r\n\r\n const pageSize = this.table.value.pagination.pageSize\r\n this.table.value.pagination.pageSize = size\r\n const pagination = this.table.value.pagination\r\n if ((pageSize as any) > size\r\n || (pagination.currentPage as any) <= Math.ceil((pagination.total as any) / (pagination.pageSize as any))) {\r\n this.search({name: 'size', pageSize: size})\r\n }\r\n\r\n }\r\n\r\n currentChange(currentPage: number) {\r\n this.table.value.pagination.currentPage = currentPage\r\n this.search({name: 'current', currentPage})\r\n }\r\n\r\n async getTableData(options: (P & AjaxTableProps) | any) {\r\n const res = await this.ajaxTableData(options)\r\n this.changeTableData(res.data)\r\n\r\n typeof this.ajaxTableDataAfter === 'function' && this.ajaxTableDataAfter(res)\r\n\r\n this.table.value.key = !this.table.value.key\r\n return res\r\n }\r\n\r\n changeTableData(res: R | any) {\r\n if (res && res.data && res.data.length) {\r\n for (let i = 0; i < res.data.length; i++) {\r\n res.data[i].index = i + 1 + (res.pageNum as number) * (res.pageSize as number)\r\n }\r\n }\r\n this.table.value.data = res.data\r\n this.table.value.pagination.total = res.total\r\n }\r\n\r\n getAjaxTableDataParams(options: (P & AjaxTableProps) | any) {\r\n this.params = this.getTableParams(options)\r\n\r\n const isSame = lodash.isEqual(this.params, this.oldParams) // 判断当前提交的参数和上一次提交的参数是否相同\r\n\r\n if (options.name === 'search') {\r\n if (!isSame) {\r\n this.table.value.pagination.currentPage = 1\r\n this.params = this.getTableParams(options)\r\n }\r\n\r\n this.oldParams = lodash.cloneDeep(this.params)\r\n } else if (options.name === 'reset') {\r\n this.resetPagination()\r\n this.params = this.getTableParams(options)\r\n\r\n this.oldParams = lodash.cloneDeep(this.params)\r\n } else if (options.name === 'delete') {\r\n if (this.table.value.data && this.table.value.data.length) {\r\n if (this.table.value.data.length === 1 && (this.table.value as any).pagination.currentPage > 1) {\r\n this.table.value.pagination.currentPage = 2\r\n\r\n this.params = this.getTableParams(options)\r\n }\r\n }\r\n } else if (options.name === 'current') {\r\n if (this.oldParams.data && this.oldParams.data.pageNum) {\r\n this.oldParams.data.pageNum = options.currentPage\r\n } else if (this.oldParams.data && this.oldParams.data.page) {\r\n this.oldParams.data.page = options.currentPage\r\n } else if (this.oldParams.params && this.oldParams.params.page) {\r\n this.oldParams.params.page = options.currentPage\r\n } else if (this.oldParams.params && this.oldParams.params.pageNum) {\r\n this.oldParams.params.pageNum = options.currentPage\r\n }\r\n\r\n if (this.oldParams.data && this.oldParams.data.pageSize) {\r\n this.oldParams.data.pageSize = this.table.value.pagination.pageSize\r\n } else if (this.oldParams.params && this.oldParams.params.pageSize) {\r\n this.oldParams.params.pageSize = this.table.value.pagination.pageSize\r\n }\r\n\r\n this.params = lodash.cloneDeep(this.oldParams)\r\n } else if (options.name === 'size') {\r\n if (this.oldParams.data && this.oldParams.data.pageSize) {\r\n this.oldParams.data.pageSize = options.pageSize\r\n } else if (this.oldParams.params && this.oldParams.params.pageSize) {\r\n this.oldParams.params.pageSize = options.pageSize\r\n }\r\n\r\n this.params = lodash.cloneDeep(this.oldParams)\r\n }\r\n if (!['size', 'current'].includes(options.name || '') || !this.table.value.rowKey) {\r\n this.selecTableDatas.value = []\r\n }\r\n\r\n return this.params\r\n }\r\n\r\n ajaxTableData(options: (P & AjaxTableProps)): Promise<R | any> {\r\n return new Promise(resolve => {\r\n resolve(this.getAjaxTableDataParams(options))\r\n })\r\n }\r\n\r\n\r\n // 查询\r\n search(options: (P & AjaxTableProps) | any = {name: 'search'}) {\r\n\r\n for (const prop in this.form.value?.model) {\r\n if ([null, undefined, ''].includes((this.form.value.model as any)[prop])) {\r\n delete this.form.value?.model[prop]\r\n }\r\n }\r\n return this.getTableData(options)\r\n }\r\n\r\n // 重置查询\r\n resetSearch(options: (P & AjaxTableProps) | any = {name: 'reset'}) {\r\n this.resetParams()\r\n this.search(options)\r\n }\r\n\r\n\r\n // 重置分页参数\r\n resetPagination() {\r\n this.table.value.pagination = this.defaultOptions.table.pagination\r\n }\r\n\r\n // 重置表格请求参数\r\n resetParams() {\r\n if (lodash.isEmpty(this.firstOptions.form?.model)) { // 判断查询的默认参数是否为空\r\n for (const prop in this.form.value?.model) {\r\n delete this.form.value?.model[prop]\r\n }\r\n } else {\r\n for (const prop in this.form.value?.model) {\r\n delete this.form.value?.model[prop]\r\n }\r\n for (const prop in this.firstOptions.form?.model) {\r\n this.form.value.model[prop] = this.firstOptions.form?.model[prop]\r\n }\r\n }\r\n }\r\n\r\n // 清空参数\r\n clearParams() {\r\n for (const prop in this.form.value?.model) {\r\n delete this.form.value.model[prop]\r\n }\r\n }\r\n\r\n // 根据key获取表格中的数据\r\n getTableDataKeys(key: string = 'id') {\r\n this.ids.value = lodash.map(this.table.value.data || [], key)\r\n }\r\n\r\n}\r\n\r\n\r\nexport default TablePage\r\n"],"names":["TablePage","options","ref","getUuid","lodash","size","pageSize","pagination","currentPage","res","i","isSame","resolve","prop","_a","_b","_c","_d","_e","_f","_g","key"],"mappings":";;;AAmBA,MAAMA,EAA8C;AAAA,EAwDhD,YAAYC,GAAqC;AAlDrB,SAAA,kBAAAC,EAAI,CAAA,CAAE,GACN,KAAA,kBAAAA,EAAI,CAAA,CAAE,GAIb,KAAA,MAAAA,EAAI,CAAA,CAAE,GAK3B,KAAA,eAA8DA,EAAI,IAAI,GAEtE,KAAiB,iBAA6C;AAAA,MAC1D,OAAO;AAAA,QACH,QAAQ;AAAA,QACR,WAAW,eAAeC,EAAQ;AAAA,QAClC,cAAc,CAAC;AAAA,QACf,MAAM,CAAC;AAAA,QACP,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,WAAW;AAAA,QACX,YAAY;AAAA,UACR,OAAO;AAAA,UACP,aAAa;AAAA,UACb,UAAU;AAAA,UACV,WAAW,CAAC,IAAI,IAAI,IAAI,IAAI,GAAG;AAAA,QACnC;AAAA,QACA,IAAI,CACJ;AAAA,MACJ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+
{"version":3,"file":"index.mjs","sources":["../../../../packages/hooks/useTablePage/index.ts"],"sourcesContent":["\nimport {Ref, ref} from 'vue'\n\nimport type {RewriteFormProps} from '@packages/components/form/types'\nimport type {RewriteTableProps} from '@packages/components/table/types'\n\nimport type {DinertTablePageProps, AjaxTableProps, ScopeFn} from '@packages/hooks/useTablePage/types'\n\nimport TablePageCom from '@packages/components/table-page/index'\nimport {getUuid} from '@packages/utils/tools'\nimport lodash from 'lodash'\n\n/**\n * T 表格data数据格式\n * D 表单model的数据格式\n * P 发起请求的数据格式\n * R 请求回来的数据格式\n */\n\n\nclass TablePage<T, D = any, P = any, R = any> {\n showSearch: Ref<DinertTablePageProps['search']>\n table: Ref<RewriteTableProps<T>>\n form: Ref<RewriteFormProps<D>>\n footer: Ref<DinertTablePageProps['footer']>\n\n selecTableDatas: Ref<T[]> = ref([])\n lastSelectDatas: Ref<T[]> = ref([])\n\n options: DinertTablePageProps<T, D>\n\n ids: Ref<string[]> = ref([])\n\n params: P | any\n oldParams: P | any\n\n tablePageRef: Ref<InstanceType<typeof TablePageCom> | null> = ref(null)\n\n private readonly defaultOptions: DinertTablePageProps<T, D> = {\n table: {\n rowKey: 'id',\n className: 'table_page' + getUuid(),\n tableColumns: [],\n data: [],\n key: true,\n border: true,\n tableSlot: true,\n pagination: {\n total: 0,\n currentPage: 1,\n pageSize: 10,\n pageSizes: [10, 20, 30, 50, 100],\n },\n on: {\n }\n },\n form: {\n model: {},\n formItem: {}\n },\n footer: false,\n search: false\n }\n\n\n private readonly firstOptions: DinertTablePageProps<T, D> = {\n table: {\n tableColumns: [],\n data: [],\n key: true,\n pagination: {}\n },\n form: {model: {}, formItem: {}}\n }\n\n\n constructor(options: DinertTablePageProps<T, D>) {\n\n this.options = lodash.defaultsDeep(lodash.cloneDeep(options), this.defaultOptions)\n\n this.firstOptions = lodash.cloneDeep(this.options)\n\n this.table = ref<DinertTablePageProps['table'] | any>(this.options.table)\n\n this.form = ref<RewriteFormProps<D | any>>(this.options.form)\n\n this.footer = ref<DinertTablePageProps['footer']>(this.options.footer)\n\n this.showSearch = ref<DinertTablePageProps['search']>(this.options.search)\n\n this.params = {}\n this.oldParams = {}\n\n // 监听表格选择的方法,方便表格数据回显\n this.tableSelectEvent()\n }\n\n // 获取请求参数\n getTableParams: (params: P) => (Partial<P>) = () => ({} as any)\n ajaxTableDataAfter: (res: R) => void = () => ({})\n\n lookOperations: ScopeFn<T> = () => ({}) // 查看\n editOperations: ScopeFn<T> = () => ({}) // 编辑\n addOperations: ScopeFn<T> = () => ({}) // 添加\n deleteOperations: ScopeFn<T> = () => ({}) // 删除\n importOperations: ScopeFn<T> = () => ({}) // 导入\n\n sizeChange(size: number) {\n\n const pageSize = this.table.value.pagination.pageSize\n this.table.value.pagination.pageSize = size\n const pagination = this.table.value.pagination\n if ((pageSize as any) > size\n || (pagination.currentPage as any) <= Math.ceil((pagination.total as any) / (pagination.pageSize as any))) {\n this.search({name: 'size', pageSize: size})\n }\n\n }\n\n currentChange(currentPage: number) {\n this.table.value.pagination.currentPage = currentPage\n this.search({name: 'current', currentPage})\n }\n\n async getTableData(options: (P & AjaxTableProps) | any) {\n const res = await this.ajaxTableData(options)\n this.changeTableData(res.data as R)\n\n typeof this.ajaxTableDataAfter === 'function' && this.ajaxTableDataAfter(res)\n\n this.table.value.key = !this.table.value.key\n return res\n }\n\n changeTableData(res: R | any) {\n if (res && res.data && res.data.length) {\n for (let i = 0; i < res.data.length; i++) {\n res.data[i].index = i + 1 + (res.pageNum as number) * (res.pageSize as number)\n }\n }\n this.table.value.data = res.data\n this.table.value.pagination.total = res.total\n }\n\n // 获取请求的所有参数\n getAjaxTableDataParams(options: (P & AjaxTableProps) | any) {\n this.params = this.getTableParams(options)\n\n const isSame = lodash.isEqual(this.params, this.oldParams) // 判断当前提交的参数和上一次提交的参数是否相同\n\n if (options.name === 'search') {\n if (!isSame) {\n this.table.value.pagination.currentPage = 1\n this.params = this.getTableParams(options)\n }\n\n this.oldParams = lodash.cloneDeep(this.params)\n } else if (options.name === 'reset') {\n this.resetPagination()\n this.params = this.getTableParams(options)\n\n this.oldParams = lodash.cloneDeep(this.params)\n } else if (options.name === 'delete') {\n if (this.table.value.data && this.table.value.data.length) {\n if (this.table.value.data.length === 1 && (this.table.value as any).pagination.currentPage > 1) {\n this.table.value.pagination.currentPage = 2\n\n this.params = this.getTableParams(options)\n }\n }\n } else if (options.name === 'current') {\n if (this.oldParams.data && this.oldParams.data.pageNum) {\n this.oldParams.data.pageNum = options.currentPage\n } else if (this.oldParams.data && this.oldParams.data.page) {\n this.oldParams.data.page = options.currentPage\n } else if (this.oldParams.params && this.oldParams.params.page) {\n this.oldParams.params.page = options.currentPage\n } else if (this.oldParams.params && this.oldParams.params.pageNum) {\n this.oldParams.params.pageNum = options.currentPage\n }\n\n if (this.oldParams.data && this.oldParams.data.pageSize) {\n this.oldParams.data.pageSize = this.table.value.pagination.pageSize\n } else if (this.oldParams.params && this.oldParams.params.pageSize) {\n this.oldParams.params.pageSize = this.table.value.pagination.pageSize\n }\n\n this.params = lodash.cloneDeep(this.oldParams)\n } else if (options.name === 'size') {\n if (this.oldParams.data && this.oldParams.data.pageSize) {\n this.oldParams.data.pageSize = options.pageSize\n } else if (this.oldParams.params && this.oldParams.params.pageSize) {\n this.oldParams.params.pageSize = options.pageSize\n }\n\n this.params = lodash.cloneDeep(this.oldParams)\n }\n if (!['size', 'current'].includes(options.name || '') || !this.table.value.rowKey) {\n this.selecTableDatas.value = []\n }\n\n return this.params\n }\n\n // 请求\n ajaxTableData(options: (P & AjaxTableProps)): Promise<R | any> {\n return new Promise(resolve => {\n resolve(this.getAjaxTableDataParams(options))\n })\n }\n\n\n // 查询\n search(options: (P & AjaxTableProps) | any = {name: 'search'}) {\n\n for (const prop in this.form.value?.model) {\n if ([null, undefined, ''].includes((this.form.value.model as any)[prop])) {\n delete this.form.value?.model[prop]\n }\n }\n return this.getTableData(options)\n }\n\n // 重置查询\n resetSearch(options: (P & AjaxTableProps) | any = {name: 'reset'}) {\n this.resetParams()\n this.search(options)\n }\n\n\n // 重置分页参数\n resetPagination() {\n this.table.value.pagination = this.defaultOptions.table.pagination\n }\n\n // 重置表格请求参数\n resetParams() {\n if (lodash.isEmpty(this.firstOptions.form?.model)) { // 判断查询的默认参数是否为空\n for (const prop in this.form.value?.model) {\n delete this.form.value?.model[prop]\n }\n } else {\n for (const prop in this.form.value?.model) {\n delete this.form.value?.model[prop]\n }\n for (const prop in this.firstOptions.form?.model) {\n this.form.value.model[prop] = this.firstOptions.form?.model[prop]\n }\n }\n }\n\n // 清空参数\n clearParams() {\n for (const prop in this.form.value?.model) {\n delete this.form.value.model[prop]\n }\n }\n\n // 根据key获取表格中的数据\n getTableDataKeys(key: string = 'id') {\n this.ids.value = lodash.map(this.table.value.data || [], key)\n return this.ids.value\n }\n\n // 回显选中\n echoOperations() {\n const rowKey = this.table.value.rowKey as any\n const keys = (this.selecTableDatas.value || []).map((item: any) => item[rowKey])\n if (this.tablePageRef.value) {\n (this.table.value.data || []).forEach((item: any) => {\n if (keys.includes(item[rowKey])) {\n this.tablePageRef.value?.tableRef?.tableRef?.toggleRowSelection(item, true)\n } else {\n this.tablePageRef.value?.tableRef?.tableRef?.toggleRowSelection(item, false)\n }\n })\n }\n\n }\n\n // 监听表格选择事件,包括全选和单选\n tableSelectEvent() {\n const rowKey: any = this.table.value.rowKey\n if (this.table.value.on) {\n if (!this.table.value.on.onSelect) {\n this.table.value.on.onSelect = (selection: T[]) => {\n if (rowKey) {\n this.table.value.data.forEach((item: any) => {\n for (let i = 0; i < this.selecTableDatas.value.length; i++) {\n if (item[rowKey] === (this.selecTableDatas.value[i]as any)[rowKey]) {\n this.selecTableDatas.value.splice(i, 1)\n }\n }\n })\n this.selecTableDatas.value = lodash.uniqBy(selection.concat(this.selecTableDatas.value), rowKey)\n } else {\n this.selecTableDatas.value = selection\n }\n }\n }\n if (!this.table.value.on['onSelect-all']) {\n this.table.value.on['onSelect-all'] = (selection: T[]) => {\n if (rowKey) {\n if (selection.length === 0) {\n this.table.value.data.forEach((item: any) => {\n for (let i = 0; i < this.selecTableDatas.value.length; i++) {\n if (item[rowKey] === (this.selecTableDatas.value[i] as any)[rowKey]) {\n this.selecTableDatas.value.splice(i, 1)\n }\n }\n })\n } else {\n this.selecTableDatas.value = lodash.uniqBy(selection.concat(this.selecTableDatas.value), rowKey)\n }\n\n } else {\n this.selecTableDatas.value = selection\n }\n }\n }\n }\n }\n}\n\n\nexport default TablePage\n"],"names":["TablePage","options","ref","getUuid","lodash","size","pageSize","pagination","currentPage","res","i","isSame","resolve","prop","_a","_b","_c","_d","_e","_f","_g","key","rowKey","keys","item","selection"],"mappings":";;;AAoBA,MAAMA,EAAwC;AAAA,EAwD1C,YAAYC,GAAqC;AAlDrB,SAAA,kBAAAC,EAAI,CAAA,CAAE,GACN,KAAA,kBAAAA,EAAI,CAAA,CAAE,GAIb,KAAA,MAAAA,EAAI,CAAA,CAAE,GAK3B,KAAA,eAA8DA,EAAI,IAAI,GAEtE,KAAiB,iBAA6C;AAAA,MAC1D,OAAO;AAAA,QACH,QAAQ;AAAA,QACR,WAAW,eAAeC,EAAQ;AAAA,QAClC,cAAc,CAAC;AAAA,QACf,MAAM,CAAC;AAAA,QACP,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,WAAW;AAAA,QACX,YAAY;AAAA,UACR,OAAO;AAAA,UACP,aAAa;AAAA,UACb,UAAU;AAAA,UACV,WAAW,CAAC,IAAI,IAAI,IAAI,IAAI,GAAG;AAAA,QACnC;AAAA,QACA,IAAI,CACJ;AAAA,MACJ;AAAA,MACA,MAAM;AAAA,QACF,OAAO,CAAC;AAAA,QACR,UAAU,CAAC;AAAA,MACf;AAAA,MACA,QAAQ;AAAA,MACR,QAAQ;AAAA,IAAA,GAIZ,KAAiB,eAA2C;AAAA,MACxD,OAAO;AAAA,QACH,cAAc,CAAC;AAAA,QACf,MAAM,CAAC;AAAA,QACP,KAAK;AAAA,QACL,YAAY,CAAC;AAAA,MACj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M,OAAOZ,GAAG,CAAC;AAAA,MAE9C,CACH,IAEI,KAAA,gBAAgB,QAAQN,EAAO,OAAOqB,EAAU,OAAO,KAAK,gBAAgB,KAAK,GAAGH,CAAM,IAInG,KAAK,gBAAgB,QAAQG;AAAA,IACjC;AAAA,EAIhB;AACJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWindowResize.mjs","sources":["../../../packages/hooks/useWindowResize.ts"],"sourcesContent":["/**\
|
|
1
|
+
{"version":3,"file":"useWindowResize.mjs","sources":["../../../packages/hooks/useWindowResize.ts"],"sourcesContent":["/**\n * 监听浏览器缩放,使用防抖函数做触发次数太多的处理\n */\nimport lodash from 'lodash'\nimport {onMounted, onUnmounted} from 'vue'\n\nconst useWindowResize = (resize: () => void, delay: number = 0, immediate: boolean = false) => {\n const onResize = lodash.debounce(() => {\n resize()\n }, delay)\n onMounted(() => {\n if (immediate) {\n resize() // 手动触发一次\n }\n window.addEventListener('resize', onResize, false)\n })\n\n onUnmounted(() => {\n window.removeEventListener('resize', onResize, false)\n })\n}\n\nexport default useWindowResize\n"],"names":["useWindowResize","resize","delay","immediate","onResize","lodash","onMounted","onUnmounted"],"mappings":";;AAMA,MAAMA,IAAkB,CAACC,GAAoBC,IAAgB,GAAGC,IAAqB,OAAU;AACrF,QAAAC,IAAWC,EAAO,SAAS,MAAM;AAC5B,IAAAJ;KACRC,CAAK;AACR,EAAAI,EAAU,MAAM;AACZ,IAAIH,KACOF,KAEJ,OAAA,iBAAiB,UAAUG,GAAU,EAAK;AAAA,EAAA,CACpD,GAEDG,EAAY,MAAM;AACP,WAAA,oBAAoB,UAAUH,GAAU,EAAK;AAAA,EAAA,CACvD;AACL;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../packages/index.ts"],"sourcesContent":["import {Plugin, App} from 'vue'\
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../packages/index.ts"],"sourcesContent":["import {Plugin, App} from 'vue'\nimport * as components from './components/index'\nimport TablePage from './hooks/useTablePage/index'\n\nexport * from './components/index'\nexport const UseTablePage: typeof TablePage = TablePage\nexport * from './hooks/useTablePage/types/index'\n\nconst myPlugin: Plugin = {\n install: (app: App) => {\n for (const name in components) {\n app.use((components as any)[name])\n }\n }\n}\n\nexport default myPlugin\n"],"names":["UseTablePage","TablePage","myPlugin","app","name","components"],"mappings":";;;;;;AAKO,MAAMA,IAAiCC,GAGxCC,IAAmB;AAAA,EACrB,SAAS,CAACC,MAAa;AACnB,eAAWC,KAAQC;AACX,MAAAF,EAAA,IAAKE,EAAmBD,CAAI,CAAC;AAAA,EAEzC;AACJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.mjs","sources":["../../../packages/utils/tools.ts"],"sourcesContent":["\
|
|
1
|
+
{"version":3,"file":"tools.mjs","sources":["../../../packages/utils/tools.ts"],"sourcesContent":["\n// 浏览器的各种存储\nexport const storage = (name: 'localStorage' | 'sessionStorage', key: string, value?: any) => {\n if (key === 'remove') {\n return (window as any)[name].removeItem(`dinert-zhdd-${value}`)\n } else if (key === 'clear') {\n return (window as any)[name].clear()\n } else if (value) {\n return (window as any)[name].setItem(`dinert-zhdd-${key}`, JSON.stringify(value))\n } else {\n return JSON.parse((window as any)[name].getItem(`dinert-zhdd-${key}`))\n }\n}\n\n// 首字母大写\nexport const firstUpperCase = (str: string) => {\n str = String(str)\n return str.replace(/^\\S/, s => s.toUpperCase())\n}\n\n// 重写判断类型\nexport const type = (type: any) => {\n return Object.prototype.toString\n .call(type)\n .split(' ')[1]\n .split(']')[0]\n .toLocaleLowerCase()\n}\n\n// 生成唯一ID\nexport const getUuid = (): string => {\n const s = []\n const hexDigits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n for (let i = 0; i < 36; i++) {\n s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1)\n }\n s[14] = '4'\n s[19] = hexDigits.substr((+s[19] & 0x3) | 0x8, 1)\n s[8] = s[13] = s[18] = s[23] = '-'\n const uuid = s.join('')\n return uuid\n}\n\n\n/**\n *\n * @param {Object} obj\n * @param {String} path\n * @returns\n */\nexport const getPropByPath = (obj: any, path: string) => {\n let tempObj = obj\n path = path.replace(/\\[(\\w+)\\]/g, '.$1')\n path = path.replace(/^\\./, '')\n\n const keyArr = path.split('.')\n let i = 0\n for (let len = keyArr.length; i < len - 1; ++i) {\n // eslint-disable-next-line max-statements-per-line\n if (!tempObj) {break}\n const key = keyArr[i]\n if (key in tempObj) {\n tempObj = tempObj[key]\n } else {\n return null\n // break;\n }\n }\n return tempObj ? tempObj[keyArr[i]] : null\n}\n\nexport const dataTransformRod = (data: any, errData: any = '-') => {\n return [null, undefined, ''].includes(data) ? errData : data\n}\n\n// 获取树指定的所有节点\nexport const getTreeNode = <T = any>(treeData: any, name: string, value: any, key: string): T[] => {\n const result: T[] = []\n // eslint-disable-next-line consistent-return\n const treeNode = (treeData2: any) => {\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < treeData2.length; i++) {\n if (value.includes(treeData2[i][name])) {\n result.push(treeData2[i][key])\n }\n if (treeData2[i].children && treeData2[i].children.length) {\n treeNode(treeData2[i].children)\n }\n }\n\n }\n treeNode(treeData)\n return result\n}\n\n// 树转扁平\nexport function convertToFlat<T = any>(data: T[], children: string = 'children', parentId: any = null): T[] {\n return data.reduce((acc: any, curr: any) => {\n acc.push({...curr, parentId})\n if (curr[children] && curr[children].length) {\n acc = acc.concat(convertToFlat(curr[children], children, curr.id))\n }\n return acc\n }, [])\n}\n\n// 格式化手机号\nexport function formatPhone(value: string): string {\n if (!/^1[3|4|5|7|8|9][0-9]\\d{4,8}$/.test(value)\n || value.length !== 11) {\n return value\n } else {\n const mobile = value.replace(/^(.{3})(.*)(.{4})/, '$1-$2-$3')\n return mobile\n }\n}\n\n// 下载文件\nexport const downFile = (response: any): any => {\n const content = response.data\n // blob内容是json,不下载\n if (response.headers['content-type'] === 'application/json;charset=UTF-8') {\n return response\n }\n const data = new Blob([content], {\n type: response.headers['content-type']\n })\n const downloadUrl = window.URL.createObjectURL(data)\n\n if (response.config.headers.prohibitDownload) {\n return downloadUrl\n }\n const anchor = document.createElement('a')\n anchor.href = downloadUrl\n let filename = response.headers['content-disposition'].split('=')[1]\n filename = filename.split(';')[0]\n anchor.download = decodeURIComponent(filename)\n anchor.target = '_blank'\n anchor.click()\n window.URL.revokeObjectURL((data as any))\n return true\n}\n\n// 转化数组为字符串\nexport const formatterArray = (cellValue: any) => {\n if (cellValue instanceof Array) {\n const joinValue = cellValue.join(',')\n return joinValue || '-'\n } else if (cellValue) {\n return cellValue\n } else {\n return '-'\n }\n}\n\n\n// 预防xss攻击\nexport const escapeHTML = (str: any) => {\n // eslint-disable-next-line consistent-return\n return String(str).replace(/[<>& \"]/g, (match: any) => {\n switch (match) {\n case '<':\n return '<'\n case '>':\n return '>'\n case '&':\n return '&'\n case ' ':\n return ' '\n case '\"':\n return '"'\n default:\n return ''\n }\n })\n}\n\nexport const columnProp = (prop: string) => {\n return 'column_' + prop.split('.').join('_')\n}\n"],"names":["getUuid","s","hexDigits","i","getPropByPath","obj","path","tempObj","keyArr","len","key","dataTransformRod","data","errData","getTreeNode","treeData","name","value","result","treeNode","treeData2","convertToFlat","children","parentId","acc","curr","escapeHTML","str","match","columnProp","prop"],"mappings":"AA8BO,MAAMA,IAAU,MAAc;AACjC,QAAMC,IAAI,CAAA,GACJC,IAAY;AAClB,WAASC,IAAI,GAAGA,IAAI,IAAIA;AAClB,IAAAF,EAAAE,CAAC,IAAID,EAAU,OAAO,KAAK,MAAM,KAAK,OAAO,IAAI,EAAI,GAAG,CAAC;AAE/D,SAAAD,EAAE,EAAE,IAAI,KACNA,EAAA,EAAE,IAAIC,EAAU,OAAQ,CAACD,EAAE,EAAE,IAAI,IAAO,GAAK,CAAC,GAC9CA,EAAA,CAAC,IAAIA,EAAE,EAAE,IAAIA,EAAE,EAAE,IAAIA,EAAE,EAAE,IA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AI,OAAOH,EAAcI,EAAKH,CAAQ,GAAGA,GAAUG,EAAK,EAAE,CAAC,IAE9DD,IACR,CAAE,CAAA;AACT;AAqDa,MAAAE,IAAa,CAACC,MAEhB,OAAOA,CAAG,EAAE,QAAQ,YAAY,CAACC,MAAe;AACnD,UAAQA,GAAO;AAAA,IACX,KAAK;AACM,aAAA;AAAA,IACX,KAAK;AACM,aAAA;AAAA,IACX,KAAK;AACM,aAAA;AAAA,IACX,KAAK;AACM,aAAA;AAAA,IACX,KAAK;AACM,aAAA;AAAA,IACX;AACW,aAAA;AAAA,EACf;AAAA,CACH,GAGQC,IAAa,CAACC,MAChB,YAAYA,EAAK,MAAM,GAAG,EAAE,KAAK,GAAG;"}
|
|
@@ -12,7 +12,7 @@ export declare const Form: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
12
12
|
}, {
|
|
13
13
|
formItemMap: import("vue").ComputedRef<any>;
|
|
14
14
|
unfold: () => void;
|
|
15
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("UnFold" | "
|
|
15
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("UnFold" | "SearchFn" | "ResetFn")[], "UnFold" | "SearchFn" | "ResetFn", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
16
|
form: {
|
|
17
17
|
type: import("vue").PropType<import("./types").RewriteFormProps<any>>;
|
|
18
18
|
default: () => {};
|
|
@@ -22,9 +22,9 @@ export declare const Form: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
22
22
|
default: boolean;
|
|
23
23
|
};
|
|
24
24
|
}>> & {
|
|
25
|
-
onReset?: ((...args: any[]) => any) | undefined;
|
|
26
25
|
onUnFold?: ((...args: any[]) => any) | undefined;
|
|
27
|
-
|
|
26
|
+
onSearchFn?: ((...args: any[]) => any) | undefined;
|
|
27
|
+
onResetFn?: ((...args: any[]) => any) | undefined;
|
|
28
28
|
}, {
|
|
29
29
|
form: import("./types").RewriteFormProps<any>;
|
|
30
30
|
search: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RewriteFormProps, CustomFormItemProps } from '
|
|
1
|
+
import type { RewriteFormProps, CustomFormItemProps } from '../types';
|
|
2
2
|
import type { PropType } from 'vue';
|
|
3
3
|
import type { CheckboxGroupProps } from 'element-plus';
|
|
4
4
|
declare const _default: import("vue").DefineComponent<{
|
|
@@ -11,8 +11,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
11
11
|
default: () => {};
|
|
12
12
|
};
|
|
13
13
|
}, {
|
|
14
|
-
options: import("vue").ComputedRef<import('
|
|
15
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").
|
|
14
|
+
options: import("vue").ComputedRef<import('../types').RewriteFormItemProps<any[]>>;
|
|
15
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
16
|
form: {
|
|
17
17
|
type: PropType<RewriteFormProps<any>>;
|
|
18
18
|
default: () => {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DatePickerProps } from 'element-plus';
|
|
2
|
-
import type { RewriteFormProps, CustomFormItemProps } from '
|
|
2
|
+
import type { RewriteFormProps, CustomFormItemProps } from '../types';
|
|
3
3
|
import type { PropType } from 'vue';
|
|
4
4
|
declare const _default: import("vue").DefineComponent<{
|
|
5
5
|
form: {
|
|
@@ -11,8 +11,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
11
11
|
default: () => {};
|
|
12
12
|
};
|
|
13
13
|
}, {
|
|
14
|
-
options: import("vue").ComputedRef<import('
|
|
15
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").
|
|
14
|
+
options: import("vue").ComputedRef<import('../types').RewriteFormItemProps<any[]>>;
|
|
15
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
16
|
form: {
|
|
17
17
|
type: PropType<RewriteFormProps<any>>;
|
|
18
18
|
default: () => {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
-
import type { RewriteFormProps } from '
|
|
2
|
+
import type { RewriteFormProps } from '../types';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
4
|
form: {
|
|
5
5
|
type: PropType<RewriteFormProps<any>>;
|
|
@@ -12,7 +12,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
12
12
|
}, {
|
|
13
13
|
formItemMap: import("vue").ComputedRef<any>;
|
|
14
14
|
unfold: () => void;
|
|
15
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("UnFold" | "
|
|
15
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("UnFold" | "SearchFn" | "ResetFn")[], "UnFold" | "SearchFn" | "ResetFn", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
16
|
form: {
|
|
17
17
|
type: PropType<RewriteFormProps<any>>;
|
|
18
18
|
default: () => {};
|
|
@@ -22,9 +22,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
22
22
|
default: boolean;
|
|
23
23
|
};
|
|
24
24
|
}>> & {
|
|
25
|
-
onReset?: ((...args: any[]) => any) | undefined;
|
|
26
25
|
onUnFold?: ((...args: any[]) => any) | undefined;
|
|
27
|
-
|
|
26
|
+
onSearchFn?: ((...args: any[]) => any) | undefined;
|
|
27
|
+
onResetFn?: ((...args: any[]) => any) | undefined;
|
|
28
28
|
}, {
|
|
29
29
|
form: RewriteFormProps<any>;
|
|
30
30
|
search: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RewriteFormProps, CustomFormItemProps } from '
|
|
1
|
+
import type { RewriteFormProps, CustomFormItemProps } from '../types';
|
|
2
2
|
import type { PropType } from 'vue';
|
|
3
3
|
import type { AutocompleteProps } from 'element-plus';
|
|
4
4
|
declare const _default: import("vue").DefineComponent<{
|
|
@@ -11,8 +11,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
11
11
|
default: () => {};
|
|
12
12
|
};
|
|
13
13
|
}, {
|
|
14
|
-
options: import("vue").ComputedRef<import('
|
|
15
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").
|
|
14
|
+
options: import("vue").ComputedRef<import('../types').RewriteFormItemProps<any[]>>;
|
|
15
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
16
|
form: {
|
|
17
17
|
type: PropType<RewriteFormProps<any>>;
|
|
18
18
|
default: () => {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RewriteFormProps, CustomFormItemProps } from '
|
|
1
|
+
import type { RewriteFormProps, CustomFormItemProps } from '../types';
|
|
2
2
|
import type { InputNumberProps } from 'element-plus';
|
|
3
3
|
import type { PropType } from 'vue';
|
|
4
4
|
declare const _default: import("vue").DefineComponent<{
|
|
@@ -11,8 +11,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
11
11
|
default: () => {};
|
|
12
12
|
};
|
|
13
13
|
}, {
|
|
14
|
-
options: import("vue").ComputedRef<import('
|
|
15
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").
|
|
14
|
+
options: import("vue").ComputedRef<import('../types').RewriteFormItemProps<any[]>>;
|
|
15
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
16
|
form: {
|
|
17
17
|
type: PropType<RewriteFormProps<any>>;
|
|
18
18
|
default: () => {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RewriteFormProps, CustomFormItemProps } from '
|
|
1
|
+
import type { RewriteFormProps, CustomFormItemProps } from '../types';
|
|
2
2
|
import type { PropType } from 'vue';
|
|
3
3
|
import type { InputProps } from 'element-plus';
|
|
4
4
|
declare const _default: import("vue").DefineComponent<{
|
|
@@ -11,8 +11,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
11
11
|
default: () => {};
|
|
12
12
|
};
|
|
13
13
|
}, {
|
|
14
|
-
options: import("vue").ComputedRef<import('
|
|
15
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").
|
|
14
|
+
options: import("vue").ComputedRef<import('../types').RewriteFormItemProps<any>>;
|
|
15
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
16
|
form: {
|
|
17
17
|
type: PropType<RewriteFormProps<any>>;
|
|
18
18
|
default: () => {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RewriteFormProps, CustomFormItemProps } from '
|
|
1
|
+
import type { RewriteFormProps, CustomFormItemProps } from '../types';
|
|
2
2
|
import type { PropType } from 'vue';
|
|
3
3
|
import type { RadioProps } from 'element-plus';
|
|
4
4
|
declare const _default: import("vue").DefineComponent<{
|
|
@@ -11,8 +11,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
11
11
|
default: () => {};
|
|
12
12
|
};
|
|
13
13
|
}, {
|
|
14
|
-
options: import("vue").ComputedRef<import('
|
|
15
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").
|
|
14
|
+
options: import("vue").ComputedRef<import('../types').RewriteFormItemProps<any[]>>;
|
|
15
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
16
|
form: {
|
|
17
17
|
type: PropType<RewriteFormProps<any>>;
|
|
18
18
|
default: () => {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
-
import type { RewriteFormProps, CustomFormItemProps } from '
|
|
2
|
+
import type { RewriteFormProps, CustomFormItemProps } from '../types';
|
|
3
3
|
import type { RateProps } from 'element-plus';
|
|
4
4
|
declare const _default: import("vue").DefineComponent<{
|
|
5
5
|
form: {
|
|
@@ -11,8 +11,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
11
11
|
default: () => {};
|
|
12
12
|
};
|
|
13
13
|
}, {
|
|
14
|
-
options: import("vue").ComputedRef<import('
|
|
15
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").
|
|
14
|
+
options: import("vue").ComputedRef<import('../types').RewriteFormItemProps<any>>;
|
|
15
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
16
|
form: {
|
|
17
17
|
type: PropType<RewriteFormProps<any>>;
|
|
18
18
|
default: () => {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RewriteFormProps, CustomFormItemProps } from '
|
|
1
|
+
import type { RewriteFormProps, CustomFormItemProps } from '../types';
|
|
2
2
|
import type { PropType } from 'vue';
|
|
3
3
|
import type { SwitchProps } from 'element-plus';
|
|
4
4
|
declare const _default: import("vue").DefineComponent<{
|
|
@@ -11,8 +11,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
11
11
|
default: () => {};
|
|
12
12
|
};
|
|
13
13
|
}, {
|
|
14
|
-
options: import("vue").ComputedRef<import('
|
|
15
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").
|
|
14
|
+
options: import("vue").ComputedRef<import('../types').RewriteFormItemProps<any[]>>;
|
|
15
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
16
|
form: {
|
|
17
17
|
type: PropType<RewriteFormProps<any>>;
|
|
18
18
|
default: () => {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RewriteFormProps, CustomFormItemProps } from '
|
|
1
|
+
import type { RewriteFormProps, CustomFormItemProps } from '../types';
|
|
2
2
|
import type { PropType } from 'vue';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
4
|
form: {
|
|
@@ -14,8 +14,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
14
14
|
default: () => {};
|
|
15
15
|
};
|
|
16
16
|
}, {
|
|
17
|
-
options: import("vue").ComputedRef<import('
|
|
18
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").
|
|
17
|
+
options: import("vue").ComputedRef<import('../types').RewriteFormItemProps<any[]>>;
|
|
18
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
19
19
|
form: {
|
|
20
20
|
type: PropType<RewriteFormProps<any>>;
|
|
21
21
|
default: () => {};
|
|
@@ -2,7 +2,7 @@ import { type FormProps, type FormItemProps, type ColProps, type RowProps, type
|
|
|
2
2
|
import { SelectProps } from 'element-plus/es/components/select-v2/src/defaults';
|
|
3
3
|
type RewriteColProps = Partial<ColProps>;
|
|
4
4
|
type RewriteRowProps = Partial<RowProps>;
|
|
5
|
-
type TypeName = 'input' | 'select' | 'textarea' | 'input-autocomplete' | 'input-number' | 'switch' | 'datetime' | 'date' | 'week' | 'month' | 'year' | 'datetimerange' | 'daterange' | 'monthrange' | 'custom' | 'radio' | 'tree-select' | 'rate' | 'checkbox' | 'cascader';
|
|
5
|
+
type TypeName = 'input' | 'select' | 'textarea' | 'input-autocomplete' | 'input-number' | 'switch' | 'datetime' | 'date' | 'week' | 'month' | 'year' | 'datetimerange' | 'daterange' | 'monthrange' | 'custom' | 'radio' | 'tree-select' | 'radio-button' | 'rate' | 'checkbox' | 'cascader';
|
|
6
6
|
export interface RewriteFormItemProps<T = any[]> extends Partial<InputProps & InputNumberProps & Omit<typeof SelectProps, 'options' | 'props'> & Omit<typeof ElTreeSelect, 'options' | 'data'> & AutocompleteProps & SwitchProps & DatePickerProps & RateProps & CheckboxGroupProps> {
|
|
7
7
|
data?: T | Partial<CheckboxProps[] & SelectOptionProxy[]>;
|
|
8
8
|
options?: T | Partial<CheckboxProps[] & SelectOptionProxy[]>;
|
|
@@ -28,7 +28,7 @@ export interface CustomFormItemProps<D = any, O = any[]> extends Partial<FormIte
|
|
|
28
28
|
export interface RewriteFormProps<D = any> extends Omit<Partial<FormProps>, 'model'> {
|
|
29
29
|
model: Partial<D>;
|
|
30
30
|
formItem: {
|
|
31
|
-
[key: string]: CustomFormItemProps
|
|
31
|
+
[key: string]: CustomFormItemProps<D>;
|
|
32
32
|
};
|
|
33
33
|
colLayout?: RewriteColProps;
|
|
34
34
|
row?: RewriteRowProps;
|