zxt-table 0.3.9 → 0.4.1
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/dist/zxt-table.css +1 -1
- package/dist/zxt-table.es.js +242 -242
- package/dist/zxt-table.umd.js +1 -1
- package/package.json +7 -7
package/dist/zxt-table.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.my-button[data-v-4480e77d]{display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#fff;border:1px solid #dcdfe6;color:#606266;text-align:center;box-sizing:border-box;outline:none;margin:0;transition:.1s;font-weight:500;padding:12px 20px;font-size:14px;border-radius:4px}.my-button--primary[data-v-4480e77d]{color:#fff;background-color:#409eff;border-color:#409eff}.my-button--success[data-v-4480e77d]{color:#fff;background-color:#67c23a;border-color:#67c23a}.my-button--warning[data-v-4480e77d]{color:#fff;background-color:#e6a23c;border-color:#e6a23c}.my-button--danger[data-v-4480e77d]{color:#fff;background-color:#f56c6c;border-color:#f56c6c}.my-button.is-disabled[data-v-4480e77d]{cursor:not-allowed;opacity:.7}.jsx-button{display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#fff;border:1px solid #dcdfe6;color:#606266;text-align:center;box-sizing:border-box;outline:none;margin:0;transition:.1s;font-weight:500;padding:12px 20px;font-size:14px;border-radius:4px}.jsx-button--primary{color:#fff;background-color:#409eff;border-color:#409eff}.jsx-button--success{color:#fff;background-color:#67c23a;border-color:#67c23a}.jsx-button--warning{color:#fff;background-color:#e6a23c;border-color:#e6a23c}.jsx-button--danger{color:#fff;background-color:#f56c6c;border-color:#f56c6c}.jsx-button.is-disabled{cursor:not-allowed;opacity:.7}.zxt-pagination[data-v-497aa44d]{display:flex;justify-content:flex-end;margin-top:20px;--el-color-primary: #ff3a33;--el-pagination-hover-color: #ff3a33}[data-v-497aa44d] .el-pager li.is-active{color:#ff3a33!important}[data-v-497aa44d] .el-pagination.is-background .el-pager li:not(.is-disabled).is-active{background-color:#ff3a33!important;color:#fff}[data-v-497aa44d] .el-pager li:hover{color:#ff3a33!important}[data-v-497aa44d] .el-pagination__sizes .el-input.is-focus .el-input__wrapper,[data-v-497aa44d] .el-pagination__sizes .el-input__wrapper:hover{box-shadow:0 0 0 1px #ff3a33 inset!important}.el-select-dropdown__item.is-selected{color:#ff3a33!important}.zxt-table-container[data-v-421a4654]{width:100%}.zxt-table-container--full[data-v-421a4654]{display:flex;flex-direction:column;height:100%}.zxt-table-container--full[data-v-421a4654] .el-table{flex:1;min-height:0}.zxt-table-container--full[data-v-421a4654] .el-table__inner-wrapper{height:100%}[data-v-421a4654] .el-table{--el-table-header-bg-color: #f8f8f9;--el-table-header-text-color: #333333;--el-table-text-color: #606266;--el-table-border-color: #ebeef5;--el-table-row-hover-bg-color: #f5f7fa}[data-v-421a4654] .el-table th.el-table__cell{background-color:var(--el-table-header-bg-color)!important;color:var(--el-table-header-text-color);font-weight:600;height:48px;padding:6px 0}[data-v-421a4654] .el-table td.el-table__cell{padding:8px 0}[data-v-421a4654] .el-table .cell{line-height:24px;padding:0 12px}[data-v-421a4654] .el-link.el-link--default,[data-v-421a4654] .el-link.el-link--primary{--el-link-text-color: #409eff;color:#409eff;font-weight:400}[data-v-421a4654] .el-link:hover{color:#66b1ff;text-decoration:none}[data-v-421a4654] .el-button--primary.is-link,[data-v-421a4654] .el-button--primary.is-text{color:#409eff}[data-v-421a4654] .el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell{background-color:#fafafa}[data-v-421a4654] .el-table .el-tag{border-radius:4px;height:24px;line-height:22px;padding:0 8px}[data-v-421a4654] .el-table__expand-icon{outline:none;border:none}[data-v-421a4654] .el-table__expand-icon:focus,[data-v-421a4654] .el-table__expand-icon:focus-visible{outline:none;box-shadow:none;border:none}[data-v-421a4654] .el-table__expand-icon .el-icon{outline:none}[data-v-421a4654] .el-table__expand-icon .el-icon:focus,[data-v-421a4654] .el-table__expand-icon .el-icon:focus-visible{outline:none;box-shadow:none}.zxt-form-popper .el-select-dropdown__item.selected,.zxt-form-popper .el-select-dropdown__item.is-selected{color:#fa2314!important}.zxt-form-popper .el-select-dropdown__item.hover,.zxt-form-popper .el-select-dropdown__item:hover{background-color:#f5f7fa;color:#fa2314}.zxt-form-popper .el-date-table td.current:not(.disabled) .el-date-table-cell__text{background-color:#fa2314!important}.zxt-form-popper .el-date-table td.today .el-date-table-cell__text{color:#fa2314}.zxt-form-popper .el-date-table td.today.current .el-date-table-cell__text{color:#fff}.zxt-form-popper .el-year-table td.current .cell,.zxt-form-popper .el-month-table td.current .cell{color:#fa2314!important}.zxt-form-popper .el-date-table td.start-date .el-date-table-cell__text,.zxt-form-popper .el-date-table td.end-date .el-date-table-cell__text{background-color:#fa2314!important}.zxt-form-popper .el-date-table td.available:hover,.zxt-form-popper .el-year-table td .cell:hover,.zxt-form-popper .el-month-table td .cell:hover,.zxt-form-popper .el-date-picker__header-label:hover,.zxt-form-popper .el-picker-panel__icon-btn:hover{color:#fa2314}.form-actions[data-v-9c337267]{display:flex;justify-content:center;margin-top:30px;gap:10px}.form-item-wrapper[data-v-9c337267]{display:flex;align-items:center;border:1px solid #dcdfe6;border-radius:4px;padding:0 12px;width:100%;background-color:#fff;transition:border-color .2s cubic-bezier(.645,.045,.355,1)}.form-item-wrapper.is-action[data-v-9c337267]{border:none;background-color:transparent;padding:0}.form-item-wrapper[data-v-9c337267]:focus-within{border-color:#fa2314}.custom-form-item.is-error .form-item-wrapper[data-v-9c337267]{border-color:#f56c6c}.form-label[data-v-9c337267]{color:#606266;white-space:nowrap;margin-right:12px;font-size:14px;line-height:32px}.form-control[data-v-9c337267]{flex:1;min-width:0;display:flex;align-items:center}.custom-form-item[data-v-9c337267] .el-input__wrapper,.custom-form-item[data-v-9c337267] .el-select__wrapper,.custom-form-item[data-v-9c337267] .el-textarea__wrapper{box-shadow:none!important;background-color:transparent!important;padding-left:0;padding-right:0}.custom-form-item[data-v-9c337267] .el-date-editor.el-input__wrapper{width:100%}.custom-form-item[data-v-9c337267] .el-range-editor.el-input__wrapper{padding:0;box-shadow:none!important}.zxt-grid-container[data-v-
|
|
1
|
+
.my-button[data-v-4480e77d]{display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#fff;border:1px solid #dcdfe6;color:#606266;text-align:center;box-sizing:border-box;outline:none;margin:0;transition:.1s;font-weight:500;padding:12px 20px;font-size:14px;border-radius:4px}.my-button--primary[data-v-4480e77d]{color:#fff;background-color:#409eff;border-color:#409eff}.my-button--success[data-v-4480e77d]{color:#fff;background-color:#67c23a;border-color:#67c23a}.my-button--warning[data-v-4480e77d]{color:#fff;background-color:#e6a23c;border-color:#e6a23c}.my-button--danger[data-v-4480e77d]{color:#fff;background-color:#f56c6c;border-color:#f56c6c}.my-button.is-disabled[data-v-4480e77d]{cursor:not-allowed;opacity:.7}.jsx-button{display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#fff;border:1px solid #dcdfe6;color:#606266;text-align:center;box-sizing:border-box;outline:none;margin:0;transition:.1s;font-weight:500;padding:12px 20px;font-size:14px;border-radius:4px}.jsx-button--primary{color:#fff;background-color:#409eff;border-color:#409eff}.jsx-button--success{color:#fff;background-color:#67c23a;border-color:#67c23a}.jsx-button--warning{color:#fff;background-color:#e6a23c;border-color:#e6a23c}.jsx-button--danger{color:#fff;background-color:#f56c6c;border-color:#f56c6c}.jsx-button.is-disabled{cursor:not-allowed;opacity:.7}.zxt-pagination[data-v-497aa44d]{display:flex;justify-content:flex-end;margin-top:20px;--el-color-primary: #ff3a33;--el-pagination-hover-color: #ff3a33}[data-v-497aa44d] .el-pager li.is-active{color:#ff3a33!important}[data-v-497aa44d] .el-pagination.is-background .el-pager li:not(.is-disabled).is-active{background-color:#ff3a33!important;color:#fff}[data-v-497aa44d] .el-pager li:hover{color:#ff3a33!important}[data-v-497aa44d] .el-pagination__sizes .el-input.is-focus .el-input__wrapper,[data-v-497aa44d] .el-pagination__sizes .el-input__wrapper:hover{box-shadow:0 0 0 1px #ff3a33 inset!important}.el-select-dropdown__item.is-selected{color:#ff3a33!important}.zxt-table-container[data-v-421a4654]{width:100%}.zxt-table-container--full[data-v-421a4654]{display:flex;flex-direction:column;height:100%}.zxt-table-container--full[data-v-421a4654] .el-table{flex:1;min-height:0}.zxt-table-container--full[data-v-421a4654] .el-table__inner-wrapper{height:100%}[data-v-421a4654] .el-table{--el-table-header-bg-color: #f8f8f9;--el-table-header-text-color: #333333;--el-table-text-color: #606266;--el-table-border-color: #ebeef5;--el-table-row-hover-bg-color: #f5f7fa}[data-v-421a4654] .el-table th.el-table__cell{background-color:var(--el-table-header-bg-color)!important;color:var(--el-table-header-text-color);font-weight:600;height:48px;padding:6px 0}[data-v-421a4654] .el-table td.el-table__cell{padding:8px 0}[data-v-421a4654] .el-table .cell{line-height:24px;padding:0 12px}[data-v-421a4654] .el-link.el-link--default,[data-v-421a4654] .el-link.el-link--primary{--el-link-text-color: #409eff;color:#409eff;font-weight:400}[data-v-421a4654] .el-link:hover{color:#66b1ff;text-decoration:none}[data-v-421a4654] .el-button--primary.is-link,[data-v-421a4654] .el-button--primary.is-text{color:#409eff}[data-v-421a4654] .el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell{background-color:#fafafa}[data-v-421a4654] .el-table .el-tag{border-radius:4px;height:24px;line-height:22px;padding:0 8px}[data-v-421a4654] .el-table__expand-icon{outline:none;border:none}[data-v-421a4654] .el-table__expand-icon:focus,[data-v-421a4654] .el-table__expand-icon:focus-visible{outline:none;box-shadow:none;border:none}[data-v-421a4654] .el-table__expand-icon .el-icon{outline:none}[data-v-421a4654] .el-table__expand-icon .el-icon:focus,[data-v-421a4654] .el-table__expand-icon .el-icon:focus-visible{outline:none;box-shadow:none}.zxt-form-popper .el-select-dropdown__item.selected,.zxt-form-popper .el-select-dropdown__item.is-selected{color:#fa2314!important}.zxt-form-popper .el-select-dropdown__item.hover,.zxt-form-popper .el-select-dropdown__item:hover{background-color:#f5f7fa;color:#fa2314}.zxt-form-popper .el-date-table td.current:not(.disabled) .el-date-table-cell__text{background-color:#fa2314!important}.zxt-form-popper .el-date-table td.today .el-date-table-cell__text{color:#fa2314}.zxt-form-popper .el-date-table td.today.current .el-date-table-cell__text{color:#fff}.zxt-form-popper .el-year-table td.current .cell,.zxt-form-popper .el-month-table td.current .cell{color:#fa2314!important}.zxt-form-popper .el-date-table td.start-date .el-date-table-cell__text,.zxt-form-popper .el-date-table td.end-date .el-date-table-cell__text{background-color:#fa2314!important}.zxt-form-popper .el-date-table td.available:hover,.zxt-form-popper .el-year-table td .cell:hover,.zxt-form-popper .el-month-table td .cell:hover,.zxt-form-popper .el-date-picker__header-label:hover,.zxt-form-popper .el-picker-panel__icon-btn:hover{color:#fa2314}.form-actions[data-v-9c337267]{display:flex;justify-content:center;margin-top:30px;gap:10px}.form-item-wrapper[data-v-9c337267]{display:flex;align-items:center;border:1px solid #dcdfe6;border-radius:4px;padding:0 12px;width:100%;background-color:#fff;transition:border-color .2s cubic-bezier(.645,.045,.355,1)}.form-item-wrapper.is-action[data-v-9c337267]{border:none;background-color:transparent;padding:0}.form-item-wrapper[data-v-9c337267]:focus-within{border-color:#fa2314}.custom-form-item.is-error .form-item-wrapper[data-v-9c337267]{border-color:#f56c6c}.form-label[data-v-9c337267]{color:#606266;white-space:nowrap;margin-right:12px;font-size:14px;line-height:32px}.form-control[data-v-9c337267]{flex:1;min-width:0;display:flex;align-items:center}.custom-form-item[data-v-9c337267] .el-input__wrapper,.custom-form-item[data-v-9c337267] .el-select__wrapper,.custom-form-item[data-v-9c337267] .el-textarea__wrapper{box-shadow:none!important;background-color:transparent!important;padding-left:0;padding-right:0}.custom-form-item[data-v-9c337267] .el-date-editor.el-input__wrapper{width:100%}.custom-form-item[data-v-9c337267] .el-range-editor.el-input__wrapper{padding:0;box-shadow:none!important}.zxt-grid-container[data-v-5add7979]{width:100%}.zxt-grid-container--full[data-v-5add7979]{display:flex;flex-direction:column;height:100%}.zxt-grid-container--full .grid-table-wrapper[data-v-5add7979]{flex:1;display:flex;flex-direction:column;min-height:0}.zxt-grid-container--full .zxt-table-container[data-v-5add7979]{flex:1;min-height:0}.grid-search-form[data-v-5add7979]{padding:10px;border-radius:4px}.search-btn-group[data-v-5add7979]{display:flex;gap:10px}.grid-toolbar[data-v-5add7979]{margin-bottom:10px;padding:10px;border-radius:4px;display:flex;gap:10px;align-items:center}.btn-search[data-v-5add7979]{background-color:#fff;border-color:#fa2314;color:#fa2314}.btn-search[data-v-5add7979]:hover,.btn-search[data-v-5add7979]:focus,.btn-search[data-v-5add7979]:active{background-color:#fff}.btn-search[data-v-5add7979]:hover,.btn-search[data-v-5add7979]:focus{border-color:#fb4f43;color:#fb4f43;outline:none}.btn-search.el-button[data-v-5add7979]:focus,.btn-search.el-button[data-v-5add7979]:focus-visible{background-color:#fff;border-color:#fb4f43;color:#fb4f43;outline:none}.btn-search[data-v-5add7979]:active,.btn-search.el-button[data-v-5add7979]:active{background-color:#fff;border-color:#e12012;color:#e12012}.btn-reset[data-v-5add7979]{background-color:#fff;border-color:#ddd;color:#111}.btn-reset[data-v-5add7979]:hover,.btn-reset[data-v-5add7979]:focus,.btn-reset[data-v-5add7979]:active{background-color:#fff}.btn-reset[data-v-5add7979]:focus,.btn-reset.el-button[data-v-5add7979]:focus,.btn-reset.el-button[data-v-5add7979]:focus-visible{border-color:#ddd;color:#111;outline:none}.btn-reset[data-v-5add7979]:hover,.btn-reset.el-button[data-v-5add7979]:hover{border-color:#fb4f43;color:#fb4f43}.btn-reset[data-v-5add7979]:active,.btn-reset.el-button[data-v-5add7979]:active{background-color:#fff;border-color:#e12012;color:#e12012}
|
package/dist/zxt-table.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createElementBlock as m, openBlock as
|
|
2
|
-
import { ElPagination as Ie, ElLink as
|
|
3
|
-
const
|
|
1
|
+
import { createElementBlock as m, openBlock as u, normalizeClass as re, renderSlot as A, defineComponent as z, createVNode as M, ref as b, watch as ae, resolveComponent as _, createBlock as $, h as I, inject as De, computed as w, mergeProps as j, withCtx as C, Fragment as H, renderList as O, createSlots as K, resolveDynamicComponent as be, createTextVNode as U, toDisplayString as ne, provide as Ze, onMounted as Me, resolveDirective as Ae, normalizeStyle as je, withDirectives as Le, createCommentVNode as Q, createElementVNode as S, reactive as Be, toHandlers as Ee, useAttrs as He, normalizeProps as we, guardReactiveProps as _e } from "vue";
|
|
2
|
+
import { ElPagination as Ie, ElLink as xe, ElCheckbox as Ne, ElSelect as qe, ElOption as Ue, ElInput as Ge, ElTableColumn as Je, ElTable as We, ElMessage as te } from "element-plus";
|
|
3
|
+
const N = (e, t) => {
|
|
4
4
|
const a = e.__vccOpts || e;
|
|
5
5
|
for (const [n, l] of t)
|
|
6
6
|
a[n] = l;
|
|
@@ -28,15 +28,15 @@ const q = (e, t) => {
|
|
|
28
28
|
}
|
|
29
29
|
}, Qe = ["disabled"];
|
|
30
30
|
function Xe(e, t, a, n, l, s) {
|
|
31
|
-
return
|
|
31
|
+
return u(), m("button", {
|
|
32
32
|
class: re(["my-button", [`my-button--${a.type}`, { "is-disabled": a.disabled }]]),
|
|
33
33
|
disabled: a.disabled,
|
|
34
|
-
onClick: t[0] || (t[0] = (...
|
|
34
|
+
onClick: t[0] || (t[0] = (...o) => n.handleClick && n.handleClick(...o))
|
|
35
35
|
}, [
|
|
36
36
|
A(e.$slots, "default", {}, void 0, !0)
|
|
37
37
|
], 10, Qe);
|
|
38
38
|
}
|
|
39
|
-
const G = /* @__PURE__ */
|
|
39
|
+
const G = /* @__PURE__ */ N(Ke, [["render", Xe], ["__scopeId", "data-v-4480e77d"]]);
|
|
40
40
|
G.install = function(e) {
|
|
41
41
|
e.component(G.name, G);
|
|
42
42
|
};
|
|
@@ -93,32 +93,32 @@ const Ye = z({
|
|
|
93
93
|
},
|
|
94
94
|
emits: ["update:modelValue", "update:pageSize", "page-change", "size-change"],
|
|
95
95
|
setup(e, { emit: t }) {
|
|
96
|
-
const a =
|
|
96
|
+
const a = b(e.modelValue), n = b(e.pageSize);
|
|
97
97
|
return ae(
|
|
98
98
|
() => e.modelValue,
|
|
99
|
-
(
|
|
100
|
-
a.value =
|
|
99
|
+
(o) => {
|
|
100
|
+
a.value = o;
|
|
101
101
|
}
|
|
102
102
|
), ae(
|
|
103
103
|
() => e.pageSize,
|
|
104
|
-
(
|
|
105
|
-
n.value =
|
|
104
|
+
(o) => {
|
|
105
|
+
n.value = o;
|
|
106
106
|
}
|
|
107
107
|
), {
|
|
108
108
|
currentPage: a,
|
|
109
109
|
pageSize: n,
|
|
110
|
-
handleSizeChange: (
|
|
111
|
-
n.value =
|
|
110
|
+
handleSizeChange: (o) => {
|
|
111
|
+
n.value = o, a.value = 1, t("update:pageSize", o), t("size-change", { page: a.value, size: o });
|
|
112
112
|
},
|
|
113
|
-
handleCurrentChange: (
|
|
114
|
-
a.value =
|
|
113
|
+
handleCurrentChange: (o) => {
|
|
114
|
+
a.value = o, t("update:modelValue", o), t("page-change", { page: o, size: n.value });
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
118
|
});
|
|
119
119
|
function et(e, t, a, n, l, s) {
|
|
120
|
-
const
|
|
121
|
-
return
|
|
120
|
+
const o = _("el-pagination");
|
|
121
|
+
return u(), $(o, {
|
|
122
122
|
"current-page": e.currentPage,
|
|
123
123
|
"onUpdate:currentPage": t[0] || (t[0] = (c) => e.currentPage = c),
|
|
124
124
|
"page-size": e.pageSize,
|
|
@@ -131,7 +131,7 @@ function et(e, t, a, n, l, s) {
|
|
|
131
131
|
onCurrentChange: e.handleCurrentChange
|
|
132
132
|
}, null, 8, ["current-page", "page-size", "page-sizes", "total", "layout", "onSizeChange", "onCurrentChange"]);
|
|
133
133
|
}
|
|
134
|
-
const
|
|
134
|
+
const x = /* @__PURE__ */ N(Ye, [["render", et], ["__scopeId", "data-v-497aa44d"]]), W = {
|
|
135
135
|
default: ({ cellValue: e }) => e ?? "",
|
|
136
136
|
input: ({ cellValue: e, row: t, column: a, updateRow: n }) => I(Ge, {
|
|
137
137
|
modelValue: e,
|
|
@@ -139,21 +139,21 @@ const N = /* @__PURE__ */ q(Ye, [["render", et], ["__scopeId", "data-v-497aa44d"
|
|
|
139
139
|
onInput: (l) => n({ ...t, [a.property]: l })
|
|
140
140
|
}),
|
|
141
141
|
select: ({ cellValue: e, row: t, column: a, updateRow: n, options: l = [] }) => I(
|
|
142
|
-
|
|
142
|
+
qe,
|
|
143
143
|
{
|
|
144
144
|
modelValue: e,
|
|
145
145
|
size: "small",
|
|
146
146
|
onChange: (s) => n({ ...t, [a.property]: s })
|
|
147
147
|
},
|
|
148
148
|
() => l.map(
|
|
149
|
-
(s) => I(
|
|
149
|
+
(s) => I(Ue, { label: s.label, value: s.value, key: s.value })
|
|
150
150
|
)
|
|
151
151
|
),
|
|
152
|
-
checkbox: ({ cellValue: e, row: t, column: a, updateRow: n }) => I(
|
|
152
|
+
checkbox: ({ cellValue: e, row: t, column: a, updateRow: n }) => I(Ne, {
|
|
153
153
|
modelValue: !!e,
|
|
154
154
|
onChange: (l) => n({ ...t, [a.property]: l })
|
|
155
155
|
}),
|
|
156
|
-
link: ({ cellValue: e, href: t, target: a = "_blank" }) => I(
|
|
156
|
+
link: ({ cellValue: e, href: t, target: a = "_blank" }) => I(xe, { href: t, target: a }, () => e)
|
|
157
157
|
};
|
|
158
158
|
function tt(e, t) {
|
|
159
159
|
if (!e) return null;
|
|
@@ -164,13 +164,13 @@ function tt(e, t) {
|
|
|
164
164
|
if (typeof e == "function")
|
|
165
165
|
return e(t);
|
|
166
166
|
if (typeof e == "object" && !Array.isArray(e)) {
|
|
167
|
-
const { name: a, props: n = {}, attrs: l = {}, events: s = {}, content:
|
|
167
|
+
const { name: a, props: n = {}, attrs: l = {}, events: s = {}, content: o } = e;
|
|
168
168
|
return typeof a == "string" && W[a] ? W[a]({
|
|
169
169
|
...t,
|
|
170
170
|
...n,
|
|
171
171
|
...l,
|
|
172
172
|
...s
|
|
173
|
-
}) : typeof a == "object" || typeof a == "function" ? I(a, { ...n, ...l, ...s },
|
|
173
|
+
}) : typeof a == "object" || typeof a == "function" ? I(a, { ...n, ...l, ...s }, o) : (console.warn("[ZxtTable] cellRender 对象缺少有效的 name 字段"), t.cellValue ?? "");
|
|
174
174
|
}
|
|
175
175
|
return t.cellValue ?? "";
|
|
176
176
|
}
|
|
@@ -195,10 +195,10 @@ const nt = z({
|
|
|
195
195
|
}
|
|
196
196
|
},
|
|
197
197
|
setup(e) {
|
|
198
|
-
const t =
|
|
198
|
+
const t = De("updateRow", () => {
|
|
199
199
|
}), a = (s) => {
|
|
200
|
-
const { currentPage:
|
|
201
|
-
return (
|
|
200
|
+
const { currentPage: o, pageSize: c } = e;
|
|
201
|
+
return (o - 1) * c + s + 1;
|
|
202
202
|
}, n = w(() => {
|
|
203
203
|
const s = e.column;
|
|
204
204
|
return {
|
|
@@ -212,10 +212,10 @@ const nt = z({
|
|
|
212
212
|
return {
|
|
213
213
|
normalizedColumn: n,
|
|
214
214
|
renderCell: (s) => {
|
|
215
|
-
const
|
|
216
|
-
return tt(
|
|
215
|
+
const o = n.value, c = s.row[o.prop], p = c ?? o.defaultValue ?? "";
|
|
216
|
+
return tt(o.cellRender, {
|
|
217
217
|
row: s.row,
|
|
218
|
-
column:
|
|
218
|
+
column: o,
|
|
219
219
|
rowIndex: s.$index,
|
|
220
220
|
cellValue: p,
|
|
221
221
|
updateRow: (g) => t(g, s.$index)
|
|
@@ -226,27 +226,27 @@ const nt = z({
|
|
|
226
226
|
}
|
|
227
227
|
});
|
|
228
228
|
function rt(e, t, a, n, l, s) {
|
|
229
|
-
const
|
|
230
|
-
return e.normalizedColumn.children && e.normalizedColumn.children.length ? (
|
|
229
|
+
const o = _("ZxtTableColumn", !0), c = _("el-table-column");
|
|
230
|
+
return e.normalizedColumn.children && e.normalizedColumn.children.length ? (u(), $(c, j({ key: 0 }, e.normalizedColumn, {
|
|
231
231
|
key: e.normalizedColumn.prop + "-group"
|
|
232
232
|
}), {
|
|
233
233
|
default: C(() => [
|
|
234
|
-
(
|
|
234
|
+
(u(!0), m(H, null, O(e.normalizedColumn.children, (p, g) => (u(), $(o, {
|
|
235
235
|
key: g,
|
|
236
236
|
column: p,
|
|
237
237
|
"current-page": e.currentPage,
|
|
238
238
|
"page-size": e.pageSize
|
|
239
239
|
}, K({ _: 2 }, [
|
|
240
|
-
|
|
241
|
-
name:
|
|
242
|
-
fn: C((
|
|
243
|
-
A(e.$slots,
|
|
240
|
+
O(e.$slots, (f, d) => ({
|
|
241
|
+
name: d,
|
|
242
|
+
fn: C((y) => [
|
|
243
|
+
A(e.$slots, d, j({ ref_for: !0 }, y))
|
|
244
244
|
])
|
|
245
245
|
}))
|
|
246
246
|
]), 1032, ["column", "current-page", "page-size"]))), 128))
|
|
247
247
|
]),
|
|
248
248
|
_: 3
|
|
249
|
-
}, 16)) : (
|
|
249
|
+
}, 16)) : (u(), $(c, j({ key: 1 }, e.normalizedColumn, {
|
|
250
250
|
key: e.normalizedColumn.prop,
|
|
251
251
|
index: e.normalizedColumn.indexMethod || e.defaultIndexMethod
|
|
252
252
|
}), K({ _: 2 }, [
|
|
@@ -258,25 +258,25 @@ function rt(e, t, a, n, l, s) {
|
|
|
258
258
|
row: p.row,
|
|
259
259
|
index: p.$index,
|
|
260
260
|
column: e.normalizedColumn
|
|
261
|
-
}) : e.normalizedColumn.cellRender ? (
|
|
262
|
-
|
|
261
|
+
}) : e.normalizedColumn.cellRender ? (u(), $(be(e.renderCell(p)), { key: 1 })) : e.normalizedColumn.formatter ? (u(), m(H, { key: 2 }, [
|
|
262
|
+
U(ne(e.normalizedColumn.formatter(
|
|
263
263
|
p.row,
|
|
264
264
|
e.normalizedColumn,
|
|
265
265
|
p.row[e.normalizedColumn.prop],
|
|
266
266
|
p.$index
|
|
267
267
|
)), 1)
|
|
268
|
-
], 64)) : (
|
|
269
|
-
|
|
268
|
+
], 64)) : (u(), m(H, { key: 3 }, [
|
|
269
|
+
U(ne(p.row[e.normalizedColumn.prop]), 1)
|
|
270
270
|
], 64))
|
|
271
271
|
]),
|
|
272
272
|
key: "0"
|
|
273
273
|
}
|
|
274
274
|
]), 1040, ["index"]));
|
|
275
275
|
}
|
|
276
|
-
const ot = /* @__PURE__ */
|
|
276
|
+
const ot = /* @__PURE__ */ N(nt, [["render", rt]]), lt = z({
|
|
277
277
|
name: "ZxtTable",
|
|
278
278
|
inheritAttrs: !1,
|
|
279
|
-
components: { ZxtPagination:
|
|
279
|
+
components: { ZxtPagination: x, ZxtTableColumn: ot, ElTable: We },
|
|
280
280
|
props: {
|
|
281
281
|
// 表格唯一标识
|
|
282
282
|
id: { type: String, default: "" },
|
|
@@ -317,82 +317,82 @@ const ot = /* @__PURE__ */ q(nt, [["render", rt]]), lt = z({
|
|
|
317
317
|
"update:row"
|
|
318
318
|
],
|
|
319
319
|
setup(e, { emit: t }) {
|
|
320
|
-
const a =
|
|
320
|
+
const a = b(null), n = b(e.pageSize), l = b(e.currentPage), s = b(!1), o = b([]), c = b(0), p = b({ prop: "", order: "" }), g = b({}), f = w(() => e.height === "full" ? { height: "100%" } : {}), d = w(() => {
|
|
321
321
|
if (e.height !== "full")
|
|
322
322
|
return e.height;
|
|
323
|
-
}),
|
|
324
|
-
() =>
|
|
323
|
+
}), y = w(() => !!e.proxyConfig), r = w(() => y.value ? c.value : e.total > 0 ? e.total : e.data.length), v = w(
|
|
324
|
+
() => y.value ? o.value : e.data
|
|
325
325
|
), T = (h) => {
|
|
326
|
-
|
|
326
|
+
y.value && (l.value = h.page, n.value = h.size, V()), t("size-change", h);
|
|
327
327
|
}, D = (h) => {
|
|
328
|
-
|
|
329
|
-
}, oe = ({ prop: h, order:
|
|
330
|
-
p.value = { prop: h, order:
|
|
328
|
+
y.value && (l.value = h.page, n.value = h.size, V()), t("page-change", h);
|
|
329
|
+
}, oe = ({ prop: h, order: F }) => {
|
|
330
|
+
p.value = { prop: h, order: F }, y.value && V(), t("sort-change", { prop: h, order: F });
|
|
331
331
|
}, le = (h) => {
|
|
332
|
-
g.value = h || {},
|
|
333
|
-
},
|
|
334
|
-
if (!
|
|
335
|
-
const h = e.proxyConfig || {},
|
|
336
|
-
if (typeof
|
|
337
|
-
const L = h.props || {},
|
|
338
|
-
[
|
|
332
|
+
g.value = h || {}, y.value && V(), t("filter-change", g.value);
|
|
333
|
+
}, V = async () => {
|
|
334
|
+
if (!y.value) return;
|
|
335
|
+
const h = e.proxyConfig || {}, F = h.ajax?.query;
|
|
336
|
+
if (typeof F != "function") return;
|
|
337
|
+
const L = h.props || {}, ue = L.pageField || "page", ce = L.sizeField || "size", pe = L.sortField || "sort", ge = L.orderField || "order", fe = L.filtersField || "filters", me = h.params || {}, B = {
|
|
338
|
+
[ue]: l.value,
|
|
339
339
|
[ce]: n.value,
|
|
340
340
|
...me
|
|
341
341
|
};
|
|
342
342
|
p.value?.prop && (B[pe] = p.value.prop, B[ge] = p.value.order), g.value && Object.keys(g.value).length && (B[fe] = g.value), s.value = !0;
|
|
343
343
|
try {
|
|
344
|
-
const
|
|
344
|
+
const P = await F(B), q = h.response || {}, i = q.listField || "list", k = q.totalField || "total", Y = q.transform;
|
|
345
345
|
let Z = [], ee = 0;
|
|
346
346
|
if (typeof Y == "function") {
|
|
347
|
-
const he = Y(
|
|
347
|
+
const he = Y(P);
|
|
348
348
|
Z = he?.list ?? [], ee = he?.total ?? 0;
|
|
349
|
-
} else
|
|
350
|
-
|
|
351
|
-
data:
|
|
349
|
+
} else P && typeof P == "object" && (Z = P?.[i] ?? P?.data ?? [], ee = P?.[k] ?? P?.total ?? 0);
|
|
350
|
+
o.value = Array.isArray(Z) ? Z : [], c.value = Number(ee) || 0, t("loaded", {
|
|
351
|
+
data: o.value,
|
|
352
352
|
total: c.value,
|
|
353
353
|
payload: B
|
|
354
354
|
});
|
|
355
|
-
} catch (
|
|
356
|
-
t("load-error",
|
|
355
|
+
} catch (P) {
|
|
356
|
+
t("load-error", P);
|
|
357
357
|
} finally {
|
|
358
358
|
s.value = !1;
|
|
359
359
|
}
|
|
360
|
-
}, X = (h,
|
|
361
|
-
|
|
360
|
+
}, X = (h, F) => {
|
|
361
|
+
y.value ? o.value.splice(F, 1, h) : t("update:row", { index: F, row: h });
|
|
362
362
|
};
|
|
363
363
|
Ze("updateRow", X), Me(() => {
|
|
364
|
-
|
|
364
|
+
y.value && V();
|
|
365
365
|
});
|
|
366
|
-
const se = () => a.value, ie = () => a.value?.getSelectionRows?.() || [],
|
|
366
|
+
const se = () => a.value, ie = () => a.value?.getSelectionRows?.() || [], de = () => V();
|
|
367
367
|
return {
|
|
368
368
|
tableRef: a,
|
|
369
369
|
containerStyle: f,
|
|
370
|
-
tableHeight:
|
|
370
|
+
tableHeight: d,
|
|
371
371
|
getTableRef: se,
|
|
372
372
|
pageSize: n,
|
|
373
373
|
currentPage: l,
|
|
374
374
|
loading: s,
|
|
375
375
|
renderData: v,
|
|
376
|
-
total:
|
|
376
|
+
total: r,
|
|
377
377
|
pageSizes: w(() => e.pageSizes),
|
|
378
378
|
paginationLayout: w(() => e.paginationLayout),
|
|
379
379
|
handleSizeChange: T,
|
|
380
380
|
handlePageChange: D,
|
|
381
381
|
handleSortChange: oe,
|
|
382
382
|
handleFilterChange: le,
|
|
383
|
-
reload:
|
|
383
|
+
reload: de,
|
|
384
384
|
getSelectedRows: ie,
|
|
385
385
|
updateRow: X
|
|
386
386
|
};
|
|
387
387
|
}
|
|
388
388
|
});
|
|
389
389
|
function st(e, t, a, n, l, s) {
|
|
390
|
-
const
|
|
391
|
-
return
|
|
390
|
+
const o = _("ZxtTableColumn"), c = _("el-table"), p = _("ZxtPagination"), g = Ae("loading");
|
|
391
|
+
return u(), m("div", {
|
|
392
392
|
class: re(["zxt-table-container", { "zxt-table-container--full": e.height === "full" }]),
|
|
393
393
|
style: je(e.containerStyle)
|
|
394
394
|
}, [
|
|
395
|
-
Le((
|
|
395
|
+
Le((u(), $(c, j({
|
|
396
396
|
ref: "tableRef",
|
|
397
397
|
data: e.renderData,
|
|
398
398
|
height: e.tableHeight
|
|
@@ -402,16 +402,16 @@ function st(e, t, a, n, l, s) {
|
|
|
402
402
|
onFilterChange: e.handleFilterChange
|
|
403
403
|
}), {
|
|
404
404
|
default: C(() => [
|
|
405
|
-
(
|
|
406
|
-
key:
|
|
405
|
+
(u(!0), m(H, null, O(e.columns, (f, d) => (u(), $(o, {
|
|
406
|
+
key: d,
|
|
407
407
|
column: f,
|
|
408
408
|
"current-page": e.currentPage,
|
|
409
409
|
"page-size": e.pageSize
|
|
410
410
|
}, K({ _: 2 }, [
|
|
411
|
-
|
|
412
|
-
name:
|
|
411
|
+
O(e.$slots, (y, r) => ({
|
|
412
|
+
name: r,
|
|
413
413
|
fn: C((v) => [
|
|
414
|
-
A(e.$slots,
|
|
414
|
+
A(e.$slots, r, j({ ref_for: !0 }, v), void 0, !0)
|
|
415
415
|
])
|
|
416
416
|
}))
|
|
417
417
|
]), 1032, ["column", "current-page", "page-size"]))), 128))
|
|
@@ -420,7 +420,7 @@ function st(e, t, a, n, l, s) {
|
|
|
420
420
|
}, 16, ["data", "height", "id", "onSortChange", "onFilterChange"])), [
|
|
421
421
|
[g, e.loading]
|
|
422
422
|
]),
|
|
423
|
-
e.pageable ? (
|
|
423
|
+
e.pageable ? (u(), $(p, {
|
|
424
424
|
key: 0,
|
|
425
425
|
"model-value": e.currentPage,
|
|
426
426
|
"page-size": e.pageSize,
|
|
@@ -433,7 +433,7 @@ function st(e, t, a, n, l, s) {
|
|
|
433
433
|
}, null, 8, ["model-value", "page-size", "page-sizes", "total", "layout", "onPageChange", "onSizeChange"])) : Q("", !0)
|
|
434
434
|
], 6);
|
|
435
435
|
}
|
|
436
|
-
const R = /* @__PURE__ */
|
|
436
|
+
const R = /* @__PURE__ */ N(lt, [["render", st], ["__scopeId", "data-v-421a4654"]]), E = /* @__PURE__ */ new Map();
|
|
437
437
|
class it {
|
|
438
438
|
/**
|
|
439
439
|
* 注册自定义渲染器
|
|
@@ -488,7 +488,7 @@ class it {
|
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
490
|
const Ce = new it();
|
|
491
|
-
function
|
|
491
|
+
function dt(e, t, a = {}) {
|
|
492
492
|
if (!e || !e.itemRender)
|
|
493
493
|
return null;
|
|
494
494
|
const { name: n } = e.itemRender;
|
|
@@ -503,8 +503,8 @@ function ut(e, t, a = {}) {
|
|
|
503
503
|
};
|
|
504
504
|
try {
|
|
505
505
|
return l.renderItemContent(a, s);
|
|
506
|
-
} catch (
|
|
507
|
-
return console.error(`[ZxtTable] 渲染器 "${n}" 执行出错:`,
|
|
506
|
+
} catch (o) {
|
|
507
|
+
return console.error(`[ZxtTable] 渲染器 "${n}" 执行出错:`, o), null;
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
510
|
}
|
|
@@ -515,11 +515,11 @@ R.install = function(e) {
|
|
|
515
515
|
};
|
|
516
516
|
R.registerRenderer = at;
|
|
517
517
|
R.renderer = Ce;
|
|
518
|
-
var
|
|
518
|
+
var ut = /* @__PURE__ */ z({
|
|
519
519
|
name: "Delete",
|
|
520
520
|
__name: "delete",
|
|
521
521
|
setup(e) {
|
|
522
|
-
return (t, a) => (
|
|
522
|
+
return (t, a) => (u(), m("svg", {
|
|
523
523
|
xmlns: "http://www.w3.org/2000/svg",
|
|
524
524
|
viewBox: "0 0 1024 1024"
|
|
525
525
|
}, [
|
|
@@ -529,11 +529,11 @@ var dt = /* @__PURE__ */ z({
|
|
|
529
529
|
})
|
|
530
530
|
]));
|
|
531
531
|
}
|
|
532
|
-
}), Se =
|
|
532
|
+
}), Se = ut, ct = /* @__PURE__ */ z({
|
|
533
533
|
name: "Download",
|
|
534
534
|
__name: "download",
|
|
535
535
|
setup(e) {
|
|
536
|
-
return (t, a) => (
|
|
536
|
+
return (t, a) => (u(), m("svg", {
|
|
537
537
|
xmlns: "http://www.w3.org/2000/svg",
|
|
538
538
|
viewBox: "0 0 1024 1024"
|
|
539
539
|
}, [
|
|
@@ -547,7 +547,7 @@ var dt = /* @__PURE__ */ z({
|
|
|
547
547
|
name: "Edit",
|
|
548
548
|
__name: "edit",
|
|
549
549
|
setup(e) {
|
|
550
|
-
return (t, a) => (
|
|
550
|
+
return (t, a) => (u(), m("svg", {
|
|
551
551
|
xmlns: "http://www.w3.org/2000/svg",
|
|
552
552
|
viewBox: "0 0 1024 1024"
|
|
553
553
|
}, [
|
|
@@ -565,7 +565,7 @@ var dt = /* @__PURE__ */ z({
|
|
|
565
565
|
name: "Plus",
|
|
566
566
|
__name: "plus",
|
|
567
567
|
setup(e) {
|
|
568
|
-
return (t, a) => (
|
|
568
|
+
return (t, a) => (u(), m("svg", {
|
|
569
569
|
xmlns: "http://www.w3.org/2000/svg",
|
|
570
570
|
viewBox: "0 0 1024 1024"
|
|
571
571
|
}, [
|
|
@@ -579,7 +579,7 @@ var dt = /* @__PURE__ */ z({
|
|
|
579
579
|
name: "Refresh",
|
|
580
580
|
__name: "refresh",
|
|
581
581
|
setup(e) {
|
|
582
|
-
return (t, a) => (
|
|
582
|
+
return (t, a) => (u(), m("svg", {
|
|
583
583
|
xmlns: "http://www.w3.org/2000/svg",
|
|
584
584
|
viewBox: "0 0 1024 1024"
|
|
585
585
|
}, [
|
|
@@ -593,7 +593,7 @@ var dt = /* @__PURE__ */ z({
|
|
|
593
593
|
name: "Search",
|
|
594
594
|
__name: "search",
|
|
595
595
|
setup(e) {
|
|
596
|
-
return (t, a) => (
|
|
596
|
+
return (t, a) => (u(), m("svg", {
|
|
597
597
|
xmlns: "http://www.w3.org/2000/svg",
|
|
598
598
|
viewBox: "0 0 1024 1024"
|
|
599
599
|
}, [
|
|
@@ -603,11 +603,11 @@ var dt = /* @__PURE__ */ z({
|
|
|
603
603
|
})
|
|
604
604
|
]));
|
|
605
605
|
}
|
|
606
|
-
}),
|
|
606
|
+
}), ye = mt, ht = /* @__PURE__ */ z({
|
|
607
607
|
name: "Setting",
|
|
608
608
|
__name: "setting",
|
|
609
609
|
setup(e) {
|
|
610
|
-
return (t, a) => (
|
|
610
|
+
return (t, a) => (u(), m("svg", {
|
|
611
611
|
xmlns: "http://www.w3.org/2000/svg",
|
|
612
612
|
viewBox: "0 0 1024 1024"
|
|
613
613
|
}, [
|
|
@@ -617,11 +617,11 @@ var dt = /* @__PURE__ */ z({
|
|
|
617
617
|
})
|
|
618
618
|
]));
|
|
619
619
|
}
|
|
620
|
-
}),
|
|
620
|
+
}), Fe = ht, vt = /* @__PURE__ */ z({
|
|
621
621
|
name: "Upload",
|
|
622
622
|
__name: "upload",
|
|
623
623
|
setup(e) {
|
|
624
|
-
return (t, a) => (
|
|
624
|
+
return (t, a) => (u(), m("svg", {
|
|
625
625
|
xmlns: "http://www.w3.org/2000/svg",
|
|
626
626
|
viewBox: "0 0 1024 1024"
|
|
627
627
|
}, [
|
|
@@ -631,11 +631,11 @@ var dt = /* @__PURE__ */ z({
|
|
|
631
631
|
})
|
|
632
632
|
]));
|
|
633
633
|
}
|
|
634
|
-
}),
|
|
634
|
+
}), Re = vt, yt = /* @__PURE__ */ z({
|
|
635
635
|
name: "View",
|
|
636
636
|
__name: "view",
|
|
637
637
|
setup(e) {
|
|
638
|
-
return (t, a) => (
|
|
638
|
+
return (t, a) => (u(), m("svg", {
|
|
639
639
|
xmlns: "http://www.w3.org/2000/svg",
|
|
640
640
|
viewBox: "0 0 1024 1024"
|
|
641
641
|
}, [
|
|
@@ -645,8 +645,8 @@ var dt = /* @__PURE__ */ z({
|
|
|
645
645
|
})
|
|
646
646
|
]));
|
|
647
647
|
}
|
|
648
|
-
}), Ve =
|
|
649
|
-
const
|
|
648
|
+
}), Ve = yt;
|
|
649
|
+
const bt = z({
|
|
650
650
|
name: "ZxtForm",
|
|
651
651
|
props: {
|
|
652
652
|
formColumns: { type: Array, default: () => [] },
|
|
@@ -655,7 +655,7 @@ const yt = z({
|
|
|
655
655
|
},
|
|
656
656
|
emits: ["submit", "reset"],
|
|
657
657
|
setup(e, { emit: t, expose: a }) {
|
|
658
|
-
const n =
|
|
658
|
+
const n = b(null), l = Be({}), s = {
|
|
659
659
|
input: "el-input",
|
|
660
660
|
select: "el-select",
|
|
661
661
|
date: "el-date-picker",
|
|
@@ -663,8 +663,8 @@ const yt = z({
|
|
|
663
663
|
datetime: "el-date-picker",
|
|
664
664
|
datetimerange: "el-date-picker",
|
|
665
665
|
cascader: "el-cascader"
|
|
666
|
-
},
|
|
667
|
-
const v =
|
|
666
|
+
}, o = (r) => s[r] || "el-input", c = (r) => {
|
|
667
|
+
const v = r.type || "input", T = [
|
|
668
668
|
"select",
|
|
669
669
|
"date",
|
|
670
670
|
"daterange",
|
|
@@ -672,8 +672,8 @@ const yt = z({
|
|
|
672
672
|
"datetimerange",
|
|
673
673
|
"cascader"
|
|
674
674
|
].includes(v), D = {
|
|
675
|
-
placeholder:
|
|
676
|
-
disabled:
|
|
675
|
+
placeholder: r.placeholder || `请${T ? "选择" : "输入"}${r.label}`,
|
|
676
|
+
disabled: r.disabled,
|
|
677
677
|
style: "width: 100%",
|
|
678
678
|
"popper-class": "zxt-form-popper"
|
|
679
679
|
};
|
|
@@ -684,18 +684,18 @@ const yt = z({
|
|
|
684
684
|
case "datetimerange":
|
|
685
685
|
return {
|
|
686
686
|
...D,
|
|
687
|
-
type:
|
|
688
|
-
startPlaceholder:
|
|
689
|
-
endPlaceholder:
|
|
690
|
-
format:
|
|
691
|
-
valueFormat:
|
|
687
|
+
type: r.dateType || v,
|
|
688
|
+
startPlaceholder: r.startPlaceholder || "开始日期",
|
|
689
|
+
endPlaceholder: r.endPlaceholder || "结束日期",
|
|
690
|
+
format: r.format,
|
|
691
|
+
valueFormat: r.valueFormat
|
|
692
692
|
};
|
|
693
693
|
case "cascader":
|
|
694
694
|
return {
|
|
695
695
|
...D,
|
|
696
|
-
options:
|
|
697
|
-
props:
|
|
698
|
-
clearable:
|
|
696
|
+
options: r.options,
|
|
697
|
+
props: r.cascaderProps,
|
|
698
|
+
clearable: r.clearable !== !1
|
|
699
699
|
};
|
|
700
700
|
case "select":
|
|
701
701
|
return D;
|
|
@@ -703,28 +703,28 @@ const yt = z({
|
|
|
703
703
|
default:
|
|
704
704
|
return D;
|
|
705
705
|
}
|
|
706
|
-
}, p = w(() => e.formColumns.map((
|
|
707
|
-
...
|
|
706
|
+
}, p = w(() => e.formColumns.map((r) => ({
|
|
707
|
+
...r,
|
|
708
708
|
colSpan: {
|
|
709
|
-
xs:
|
|
710
|
-
sm:
|
|
711
|
-
md:
|
|
712
|
-
lg:
|
|
713
|
-
xl:
|
|
709
|
+
xs: r.xs ?? r.span ?? 24,
|
|
710
|
+
sm: r.sm ?? r.span ?? 12,
|
|
711
|
+
md: r.md ?? r.span ?? 12,
|
|
712
|
+
lg: r.lg ?? r.span ?? 12,
|
|
713
|
+
xl: r.xl ?? r.span ?? 12
|
|
714
714
|
}
|
|
715
715
|
})));
|
|
716
716
|
ae(
|
|
717
717
|
() => e.initialFormData,
|
|
718
|
-
(
|
|
718
|
+
(r) => {
|
|
719
719
|
Object.keys(l).forEach((v) => {
|
|
720
720
|
delete l[v];
|
|
721
|
-
}), Object.assign(l,
|
|
721
|
+
}), Object.assign(l, r);
|
|
722
722
|
},
|
|
723
723
|
{ immediate: !0, deep: !0 }
|
|
724
724
|
);
|
|
725
725
|
const g = w(() => {
|
|
726
|
-
const
|
|
727
|
-
return Object.keys(
|
|
726
|
+
const r = { ...e.rules };
|
|
727
|
+
return Object.keys(r).length === 0 && e.formColumns.length > 0 && e.formColumns.forEach((v) => {
|
|
728
728
|
if (v.required) {
|
|
729
729
|
const T = [
|
|
730
730
|
"select",
|
|
@@ -734,7 +734,7 @@ const yt = z({
|
|
|
734
734
|
"datetimerange",
|
|
735
735
|
"cascader"
|
|
736
736
|
].includes(v.type);
|
|
737
|
-
|
|
737
|
+
r[v.prop] = [
|
|
738
738
|
{
|
|
739
739
|
required: !0,
|
|
740
740
|
message: `请${T ? "选择" : "输入"}${v.label}`,
|
|
@@ -742,30 +742,30 @@ const yt = z({
|
|
|
742
742
|
}
|
|
743
743
|
];
|
|
744
744
|
}
|
|
745
|
-
}),
|
|
745
|
+
}), r;
|
|
746
746
|
}), f = () => {
|
|
747
|
-
n.value && n.value.validate((
|
|
748
|
-
|
|
747
|
+
n.value && n.value.validate((r) => {
|
|
748
|
+
r && t("submit", { ...l });
|
|
749
749
|
});
|
|
750
|
-
},
|
|
750
|
+
}, d = () => {
|
|
751
751
|
n.value && n.value.resetFields(), t("reset");
|
|
752
|
-
},
|
|
752
|
+
}, y = (r) => () => dt(r, l, {}) || null;
|
|
753
753
|
return a({
|
|
754
754
|
validate: () => n.value ? n.value.validate() : Promise.resolve(!1),
|
|
755
755
|
resetFields: () => n.value && n.value.resetFields(),
|
|
756
756
|
getFormData: () => ({ ...l }),
|
|
757
757
|
submitForm: f,
|
|
758
|
-
resetForm:
|
|
758
|
+
resetForm: d
|
|
759
759
|
}), {
|
|
760
760
|
formRef: n,
|
|
761
761
|
formData: l,
|
|
762
762
|
formRules: g,
|
|
763
763
|
submitForm: f,
|
|
764
|
-
resetForm:
|
|
764
|
+
resetForm: d,
|
|
765
765
|
processedColumns: p,
|
|
766
|
-
getComponentType:
|
|
766
|
+
getComponentType: o,
|
|
767
767
|
getComponentProps: c,
|
|
768
|
-
renderCustomItem:
|
|
768
|
+
renderCustomItem: y
|
|
769
769
|
};
|
|
770
770
|
}
|
|
771
771
|
}), Ct = { class: "zxt-form-container" }, zt = {
|
|
@@ -773,8 +773,8 @@ const yt = z({
|
|
|
773
773
|
class: "form-label"
|
|
774
774
|
}, wt = { class: "form-control" };
|
|
775
775
|
function _t(e, t, a, n, l, s) {
|
|
776
|
-
const
|
|
777
|
-
return
|
|
776
|
+
const o = _("el-option"), c = _("el-form-item"), p = _("el-col"), g = _("el-row"), f = _("el-form");
|
|
777
|
+
return u(), m("div", Ct, [
|
|
778
778
|
M(f, {
|
|
779
779
|
ref: "formRef",
|
|
780
780
|
model: e.formData,
|
|
@@ -785,34 +785,34 @@ function _t(e, t, a, n, l, s) {
|
|
|
785
785
|
default: C(() => [
|
|
786
786
|
M(g, { gutter: 20 }, {
|
|
787
787
|
default: C(() => [
|
|
788
|
-
(
|
|
788
|
+
(u(!0), m(H, null, O(e.processedColumns, (d, y) => (u(), $(p, j({ key: y }, { ref_for: !0 }, d.colSpan), {
|
|
789
789
|
default: C(() => [
|
|
790
790
|
M(c, {
|
|
791
|
-
prop:
|
|
792
|
-
required:
|
|
791
|
+
prop: d.prop,
|
|
792
|
+
required: d.required,
|
|
793
793
|
"label-width": "0",
|
|
794
794
|
class: "custom-form-item"
|
|
795
795
|
}, {
|
|
796
796
|
default: C(() => [
|
|
797
797
|
S("div", {
|
|
798
|
-
class: re(["form-item-wrapper", { "is-action":
|
|
798
|
+
class: re(["form-item-wrapper", { "is-action": d.isAction }])
|
|
799
799
|
}, [
|
|
800
|
-
|
|
800
|
+
d.label ? (u(), m("span", zt, ne(d.label), 1)) : Q("", !0),
|
|
801
801
|
S("div", wt, [
|
|
802
|
-
|
|
802
|
+
d.type === "slot" ? A(e.$slots, d.slotName || d.prop, {
|
|
803
803
|
key: 0,
|
|
804
804
|
formData: e.formData,
|
|
805
|
-
column:
|
|
806
|
-
}, void 0, !0) :
|
|
805
|
+
column: d
|
|
806
|
+
}, void 0, !0) : d.itemRender ? (u(), $(be(e.renderCustomItem(d)), { key: 1 })) : (u(), $(be(e.getComponentType(d.type)), j({
|
|
807
807
|
key: 2,
|
|
808
|
-
modelValue: e.formData[
|
|
809
|
-
"onUpdate:modelValue": (
|
|
810
|
-
}, { ref_for: !0 }, e.getComponentProps(
|
|
808
|
+
modelValue: e.formData[d.prop],
|
|
809
|
+
"onUpdate:modelValue": (r) => e.formData[d.prop] = r
|
|
810
|
+
}, { ref_for: !0 }, e.getComponentProps(d), Ee(d.events || {})), {
|
|
811
811
|
default: C(() => [
|
|
812
|
-
|
|
812
|
+
d.type === "select" ? (u(!0), m(H, { key: 0 }, O(d.options, (r, v) => (u(), $(o, {
|
|
813
813
|
key: v,
|
|
814
|
-
label:
|
|
815
|
-
value:
|
|
814
|
+
label: r.label,
|
|
815
|
+
value: r.value
|
|
816
816
|
}, null, 8, ["label", "value"]))), 128)) : Q("", !0)
|
|
817
817
|
]),
|
|
818
818
|
_: 2
|
|
@@ -833,7 +833,7 @@ function _t(e, t, a, n, l, s) {
|
|
|
833
833
|
}, 8, ["model", "rules"])
|
|
834
834
|
]);
|
|
835
835
|
}
|
|
836
|
-
const ze = /* @__PURE__ */
|
|
836
|
+
const ze = /* @__PURE__ */ N(bt, [["render", _t], ["__scopeId", "data-v-9c337267"]]), St = z({
|
|
837
837
|
name: "ZxtGrid",
|
|
838
838
|
inheritAttrs: !1,
|
|
839
839
|
components: {
|
|
@@ -843,11 +843,11 @@ const ze = /* @__PURE__ */ q(yt, [["render", _t], ["__scopeId", "data-v-9c337267
|
|
|
843
843
|
Delete: Se,
|
|
844
844
|
Refresh: ve,
|
|
845
845
|
Download: ke,
|
|
846
|
-
Search:
|
|
846
|
+
Search: ye,
|
|
847
847
|
Edit: $e,
|
|
848
848
|
View: Ve,
|
|
849
|
-
Upload:
|
|
850
|
-
Setting:
|
|
849
|
+
Upload: Re,
|
|
850
|
+
Setting: Fe
|
|
851
851
|
},
|
|
852
852
|
props: {
|
|
853
853
|
// 网格配置选项
|
|
@@ -875,148 +875,148 @@ const ze = /* @__PURE__ */ q(yt, [["render", _t], ["__scopeId", "data-v-9c337267
|
|
|
875
875
|
},
|
|
876
876
|
emits: ["toolbar-click", "submit", "reset", "page-change", "size-change"],
|
|
877
877
|
setup(e, { emit: t, expose: a }) {
|
|
878
|
-
const n = He(), l =
|
|
878
|
+
const n = He(), l = b(null), s = b(null), o = b(null), c = b(1), p = b(10), g = b([]), f = b(e.gridOptions.formMode || !0), d = {
|
|
879
879
|
Plus: Pe,
|
|
880
880
|
Delete: Se,
|
|
881
881
|
Refresh: ve,
|
|
882
882
|
Download: ke,
|
|
883
|
-
Search:
|
|
883
|
+
Search: ye,
|
|
884
884
|
Edit: $e,
|
|
885
885
|
View: Ve,
|
|
886
|
-
Upload:
|
|
887
|
-
Setting:
|
|
888
|
-
},
|
|
889
|
-
const
|
|
890
|
-
if (!
|
|
891
|
-
const
|
|
892
|
-
return
|
|
886
|
+
Upload: Re,
|
|
887
|
+
Setting: Fe
|
|
888
|
+
}, y = w(() => {
|
|
889
|
+
const i = e.gridOptions.formConfig;
|
|
890
|
+
if (!i || !i.items) return [];
|
|
891
|
+
const k = [...i.items];
|
|
892
|
+
return k.some(
|
|
893
893
|
(Z) => Z.type === "slot" && Z.slotName === "search-actions"
|
|
894
|
-
) ||
|
|
894
|
+
) || k.push({
|
|
895
895
|
type: "slot",
|
|
896
896
|
slotName: "search-actions",
|
|
897
897
|
span: 6,
|
|
898
898
|
labelWidth: "0px",
|
|
899
899
|
isAction: !0,
|
|
900
|
-
...
|
|
901
|
-
}),
|
|
902
|
-
}),
|
|
903
|
-
|
|
904
|
-
}, v = (
|
|
905
|
-
t("
|
|
900
|
+
...i.actionConfig
|
|
901
|
+
}), k;
|
|
902
|
+
}), r = () => {
|
|
903
|
+
o.value?.submitForm();
|
|
904
|
+
}, v = (i) => {
|
|
905
|
+
t("submit", i), e.gridOptions.proxyConfig && (e.gridOptions.proxyConfig.params || (e.gridOptions.proxyConfig.params = {}), Object.assign(e.gridOptions.proxyConfig.params, i), c.value = 1, l.value?.reload?.());
|
|
906
906
|
}, T = () => {
|
|
907
|
-
|
|
907
|
+
o.value?.resetForm();
|
|
908
908
|
}, D = () => {
|
|
909
|
-
t("
|
|
910
|
-
|
|
911
|
-
},
|
|
912
|
-
}, oe = (
|
|
913
|
-
if (
|
|
914
|
-
return typeof
|
|
909
|
+
t("reset"), e.gridOptions.proxyConfig && (e.gridOptions.proxyConfig.params && (e.gridOptions.formConfig?.items?.map((k) => k.prop) || []).forEach((k) => {
|
|
910
|
+
e.gridOptions.proxyConfig.params[k] !== void 0 && delete e.gridOptions.proxyConfig.params[k];
|
|
911
|
+
}), c.value = 1, l.value?.reload?.());
|
|
912
|
+
}, oe = (i) => {
|
|
913
|
+
if (i)
|
|
914
|
+
return typeof i == "object" || typeof i == "function" ? i : d[i];
|
|
915
915
|
}, le = w(() => {
|
|
916
916
|
const {
|
|
917
|
-
formConfig:
|
|
918
|
-
toolbar:
|
|
917
|
+
formConfig: i,
|
|
918
|
+
toolbar: k,
|
|
919
919
|
formMode: Y,
|
|
920
920
|
formColumns: Z,
|
|
921
921
|
rules: ee,
|
|
922
922
|
data: he,
|
|
923
|
-
...
|
|
923
|
+
...Te
|
|
924
924
|
} = e.gridOptions;
|
|
925
|
-
return
|
|
926
|
-
}),
|
|
927
|
-
switch (t("toolbar-click", { code:
|
|
925
|
+
return Te;
|
|
926
|
+
}), V = w(() => e.externalData.length > 0 ? e.externalData : e.gridOptions.data || []), X = w(() => V.value.length), se = (i, k) => {
|
|
927
|
+
switch (t("toolbar-click", { code: i, button: k, grid: l.value }), i) {
|
|
928
928
|
case "add":
|
|
929
929
|
ie();
|
|
930
930
|
break;
|
|
931
931
|
case "delete":
|
|
932
|
-
|
|
932
|
+
de();
|
|
933
933
|
break;
|
|
934
934
|
case "refresh":
|
|
935
935
|
h();
|
|
936
936
|
break;
|
|
937
937
|
case "export":
|
|
938
|
-
|
|
938
|
+
F();
|
|
939
939
|
break;
|
|
940
940
|
}
|
|
941
941
|
}, ie = () => {
|
|
942
942
|
f.value = !0;
|
|
943
|
-
},
|
|
944
|
-
const
|
|
945
|
-
if (
|
|
943
|
+
}, de = () => {
|
|
944
|
+
const i = l.value?.getTableRef()?.getSelectionRows?.() || [];
|
|
945
|
+
if (i.length === 0) {
|
|
946
946
|
te.warning("请先选择要删除的数据");
|
|
947
947
|
return;
|
|
948
948
|
}
|
|
949
|
-
te.success(`删除 ${
|
|
949
|
+
te.success(`删除 ${i.length} 条数据`);
|
|
950
950
|
}, h = () => {
|
|
951
951
|
te.success("刷新数据"), l.value?.reload?.();
|
|
952
|
-
},
|
|
952
|
+
}, F = () => {
|
|
953
953
|
te.success("导出数据");
|
|
954
|
-
}, L = (
|
|
955
|
-
t("submit",
|
|
956
|
-
},
|
|
954
|
+
}, L = (i) => {
|
|
955
|
+
t("submit", i);
|
|
956
|
+
}, ue = () => {
|
|
957
957
|
t("reset");
|
|
958
958
|
}, ce = () => {
|
|
959
959
|
f.value = !1;
|
|
960
|
-
}, pe = (
|
|
961
|
-
c.value =
|
|
962
|
-
}, ge = (
|
|
963
|
-
p.value =
|
|
964
|
-
}, fe = () => l.value, me = () => s.value, B = () => l.value?.getTableRef()?.getSelectionRows?.() || [],
|
|
965
|
-
g.value =
|
|
966
|
-
},
|
|
967
|
-
f.value =
|
|
960
|
+
}, pe = (i) => {
|
|
961
|
+
c.value = i.page, t("page-change", i);
|
|
962
|
+
}, ge = (i) => {
|
|
963
|
+
p.value = i.size, t("size-change", i);
|
|
964
|
+
}, fe = () => l.value, me = () => s.value, B = () => l.value?.getTableRef()?.getSelectionRows?.() || [], P = (i) => {
|
|
965
|
+
g.value = i;
|
|
966
|
+
}, q = (i) => {
|
|
967
|
+
f.value = i;
|
|
968
968
|
};
|
|
969
969
|
return ae(
|
|
970
970
|
() => e.gridOptions.formMode,
|
|
971
|
-
(
|
|
972
|
-
|
|
971
|
+
(i) => {
|
|
972
|
+
i !== void 0 && (f.value = i);
|
|
973
973
|
}
|
|
974
974
|
), a({
|
|
975
975
|
getGridRef: fe,
|
|
976
976
|
getFormRef: me,
|
|
977
977
|
getSelectedRows: B,
|
|
978
|
-
reloadData:
|
|
979
|
-
setFormVisible:
|
|
978
|
+
reloadData: P,
|
|
979
|
+
setFormVisible: q
|
|
980
980
|
}), {
|
|
981
981
|
attrs: n,
|
|
982
982
|
gridRef: l,
|
|
983
983
|
formRef: s,
|
|
984
|
-
searchFormRef:
|
|
984
|
+
searchFormRef: o,
|
|
985
985
|
currentPage: c,
|
|
986
986
|
pageSize: p,
|
|
987
|
-
tableData:
|
|
987
|
+
tableData: V,
|
|
988
988
|
tableProps: le,
|
|
989
989
|
total: X,
|
|
990
990
|
isFormVisible: f,
|
|
991
|
-
searchFormColumns:
|
|
991
|
+
searchFormColumns: y,
|
|
992
992
|
getIconComponent: oe,
|
|
993
993
|
handleToolbarClick: se,
|
|
994
994
|
handleSubmit: L,
|
|
995
|
-
handleFormReset:
|
|
995
|
+
handleFormReset: ue,
|
|
996
996
|
handleFormCancel: ce,
|
|
997
997
|
handlePageChange: pe,
|
|
998
998
|
handleSizeChange: ge,
|
|
999
|
-
handleSearch:
|
|
999
|
+
handleSearch: r,
|
|
1000
1000
|
handleSearchSubmit: v,
|
|
1001
1001
|
handleReset: T,
|
|
1002
1002
|
handleSearchReset: D,
|
|
1003
|
-
Search:
|
|
1003
|
+
Search: ye,
|
|
1004
1004
|
Refresh: ve
|
|
1005
1005
|
};
|
|
1006
1006
|
}
|
|
1007
1007
|
}), kt = {
|
|
1008
1008
|
key: 0,
|
|
1009
1009
|
class: "grid-search-form"
|
|
1010
|
-
}, $t = { class: "search-btn-group" }, Pt = { class: "grid-table-wrapper" },
|
|
1010
|
+
}, $t = { class: "search-btn-group" }, Pt = { class: "grid-table-wrapper" }, Ft = {
|
|
1011
1011
|
key: 0,
|
|
1012
1012
|
class: "grid-toolbar"
|
|
1013
1013
|
};
|
|
1014
|
-
function
|
|
1015
|
-
const
|
|
1016
|
-
return
|
|
1014
|
+
function Rt(e, t, a, n, l, s) {
|
|
1015
|
+
const o = _("el-button"), c = _("ZxtForm"), p = _("ZxtTable");
|
|
1016
|
+
return u(), m("div", {
|
|
1017
1017
|
class: re(["zxt-grid-container", { "zxt-grid-container--full": e.gridOptions.height === "full" }])
|
|
1018
1018
|
}, [
|
|
1019
|
-
e.gridOptions.formConfig ? (
|
|
1019
|
+
e.gridOptions.formConfig ? (u(), m("div", kt, [
|
|
1020
1020
|
M(c, {
|
|
1021
1021
|
ref: "searchFormRef",
|
|
1022
1022
|
"form-columns": e.searchFormColumns,
|
|
@@ -1027,23 +1027,23 @@ function Ft(e, t, a, n, l, s) {
|
|
|
1027
1027
|
}, K({
|
|
1028
1028
|
"search-actions": C(() => [
|
|
1029
1029
|
S("div", $t, [
|
|
1030
|
-
M(
|
|
1030
|
+
M(o, {
|
|
1031
1031
|
class: "btn-search",
|
|
1032
1032
|
icon: e.Search,
|
|
1033
1033
|
onClick: e.handleSearch
|
|
1034
1034
|
}, {
|
|
1035
1035
|
default: C(() => [...t[0] || (t[0] = [
|
|
1036
|
-
|
|
1036
|
+
U(" 查询 ", -1)
|
|
1037
1037
|
])]),
|
|
1038
1038
|
_: 1
|
|
1039
1039
|
}, 8, ["icon", "onClick"]),
|
|
1040
|
-
M(
|
|
1040
|
+
M(o, {
|
|
1041
1041
|
class: "btn-reset",
|
|
1042
1042
|
icon: e.Refresh,
|
|
1043
1043
|
onClick: e.handleReset
|
|
1044
1044
|
}, {
|
|
1045
1045
|
default: C(() => [...t[1] || (t[1] = [
|
|
1046
|
-
|
|
1046
|
+
U(" 重置 ", -1)
|
|
1047
1047
|
])]),
|
|
1048
1048
|
_: 1
|
|
1049
1049
|
}, 8, ["icon", "onClick"])
|
|
@@ -1051,26 +1051,26 @@ function Ft(e, t, a, n, l, s) {
|
|
|
1051
1051
|
]),
|
|
1052
1052
|
_: 2
|
|
1053
1053
|
}, [
|
|
1054
|
-
|
|
1054
|
+
O(e.$slots, (g, f) => ({
|
|
1055
1055
|
name: f,
|
|
1056
|
-
fn: C((
|
|
1057
|
-
A(e.$slots, f, we(_e(
|
|
1056
|
+
fn: C((d) => [
|
|
1057
|
+
A(e.$slots, f, we(_e(d)), void 0, !0)
|
|
1058
1058
|
])
|
|
1059
1059
|
}))
|
|
1060
1060
|
]), 1032, ["form-columns", "initial-form-data", "rules", "onSubmit", "onReset"])
|
|
1061
1061
|
])) : Q("", !0),
|
|
1062
1062
|
S("div", Pt, [
|
|
1063
|
-
e.gridOptions.toolbar ? (
|
|
1064
|
-
(
|
|
1063
|
+
e.gridOptions.toolbar ? (u(), m("div", Ft, [
|
|
1064
|
+
(u(!0), m(H, null, O(e.gridOptions.toolbar.buttons, (g, f) => (u(), $(o, {
|
|
1065
1065
|
key: f,
|
|
1066
1066
|
type: g.type || "default",
|
|
1067
1067
|
size: g.size || "small",
|
|
1068
1068
|
icon: e.getIconComponent(g.icon),
|
|
1069
1069
|
disabled: g.disabled,
|
|
1070
|
-
onClick: (
|
|
1070
|
+
onClick: (d) => e.handleToolbarClick(g.code, g)
|
|
1071
1071
|
}, {
|
|
1072
1072
|
default: C(() => [
|
|
1073
|
-
|
|
1073
|
+
U(ne(g.name), 1)
|
|
1074
1074
|
]),
|
|
1075
1075
|
_: 2
|
|
1076
1076
|
}, 1032, ["type", "size", "icon", "disabled", "onClick"]))), 128)),
|
|
@@ -1092,39 +1092,39 @@ function Ft(e, t, a, n, l, s) {
|
|
|
1092
1092
|
onPageChange: e.handlePageChange,
|
|
1093
1093
|
onSizeChange: e.handleSizeChange
|
|
1094
1094
|
}), K({ _: 2 }, [
|
|
1095
|
-
|
|
1095
|
+
O(e.$slots, (g, f) => ({
|
|
1096
1096
|
name: f,
|
|
1097
|
-
fn: C((
|
|
1098
|
-
A(e.$slots, f, we(_e(
|
|
1097
|
+
fn: C((d) => [
|
|
1098
|
+
A(e.$slots, f, we(_e(d)), void 0, !0)
|
|
1099
1099
|
])
|
|
1100
1100
|
}))
|
|
1101
1101
|
]), 1040, ["id", "columns", "data", "height", "pageable", "current-page", "page-size", "page-sizes", "total", "pagination-layout", "onPageChange", "onSizeChange"])
|
|
1102
1102
|
])
|
|
1103
1103
|
], 2);
|
|
1104
1104
|
}
|
|
1105
|
-
const
|
|
1106
|
-
|
|
1107
|
-
e.component(
|
|
1105
|
+
const Oe = /* @__PURE__ */ N(St, [["render", Rt], ["__scopeId", "data-v-5add7979"]]);
|
|
1106
|
+
x.install = function(e) {
|
|
1107
|
+
e.component(x.name, x);
|
|
1108
1108
|
};
|
|
1109
1109
|
const Vt = [
|
|
1110
1110
|
G,
|
|
1111
1111
|
J,
|
|
1112
1112
|
R,
|
|
1113
|
-
|
|
1113
|
+
Oe,
|
|
1114
1114
|
ze,
|
|
1115
|
-
|
|
1116
|
-
],
|
|
1115
|
+
x
|
|
1116
|
+
], Ot = (e) => {
|
|
1117
1117
|
Vt.forEach((t) => {
|
|
1118
1118
|
e.component(t.name, t);
|
|
1119
1119
|
});
|
|
1120
1120
|
}, Zt = {
|
|
1121
|
-
install:
|
|
1121
|
+
install: Ot,
|
|
1122
1122
|
MyButton: G,
|
|
1123
1123
|
JsxButton: J,
|
|
1124
1124
|
ZxtTable: R,
|
|
1125
|
-
ZxtGrid:
|
|
1125
|
+
ZxtGrid: Oe,
|
|
1126
1126
|
ZxtForm: ze,
|
|
1127
|
-
ZxtPagination:
|
|
1127
|
+
ZxtPagination: x,
|
|
1128
1128
|
// 暴露渲染器 API
|
|
1129
1129
|
renderer: R.renderer,
|
|
1130
1130
|
registerRenderer: R.registerRenderer
|
|
@@ -1133,8 +1133,8 @@ export {
|
|
|
1133
1133
|
J as JsxButton,
|
|
1134
1134
|
G as MyButton,
|
|
1135
1135
|
ze as ZxtForm,
|
|
1136
|
-
|
|
1137
|
-
|
|
1136
|
+
Oe as ZxtGrid,
|
|
1137
|
+
x as ZxtPagination,
|
|
1138
1138
|
R as ZxtTable,
|
|
1139
1139
|
Zt as default
|
|
1140
1140
|
};
|
package/dist/zxt-table.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(b,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(b=typeof globalThis<"u"?globalThis:b||self,e(b.ZxtTable={},b.Vue,b.ElementPlus))})(this,(function(b,e,y){"use strict";const T=(t,a)=>{const n=t.__vccOpts||t;for(const[o,s]of a)n[o]=s;return n},ce={name:"MyButton",props:{type:{type:String,default:"default",validator:t=>["default","primary","success","warning","danger"].includes(t)},disabled:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:a}){return{handleClick:o=>{a("click",o)}}}},pe=["disabled"];function me(t,a,n,o,s,i){return e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["my-button",[`my-button--${n.type}`,{"is-disabled":n.disabled}]]),disabled:n.disabled,onClick:a[0]||(a[0]=(...r)=>o.handleClick&&o.handleClick(...r))},[e.renderSlot(t.$slots,"default",{},void 0,!0)],10,pe)}const N=T(ce,[["render",me],["__scopeId","data-v-4480e77d"]]);N.install=function(t){t.component(N.name,N)};const D=e.defineComponent({name:"JsxButton",props:{type:{type:String,default:"default",validator:t=>["default","primary","success","warning","danger"].includes(t)},disabled:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:a,slots:n}){const o=s=>{t.disabled||a("click",s)};return()=>e.createVNode("button",{class:["jsx-button",`jsx-button--${t.type}`,{"is-disabled":t.disabled}],disabled:t.disabled,onClick:o},[n.default?.()])}});D.install=function(t){t.component(D.name,D)};const fe=e.defineComponent({name:"ZxtPagination",components:{ElPagination:y.ElPagination},props:{modelValue:{type:Number,default:1},pageSize:{type:Number,default:10},pageSizes:{type:Array,default:()=>[10,20,50,100]},total:{type:Number,default:0},layout:{type:String,default:"total, sizes, prev, pager, next, jumper"}},emits:["update:modelValue","update:pageSize","page-change","size-change"],setup(t,{emit:a}){const n=e.ref(t.modelValue),o=e.ref(t.pageSize);return e.watch(()=>t.modelValue,r=>{n.value=r}),e.watch(()=>t.pageSize,r=>{o.value=r}),{currentPage:n,pageSize:o,handleSizeChange:r=>{o.value=r,n.value=1,a("update:pageSize",r),a("size-change",{page:n.value,size:r})},handleCurrentChange:r=>{n.value=r,a("update:modelValue",r),a("page-change",{page:r,size:o.value})}}}});function ge(t,a,n,o,s,i){const r=e.resolveComponent("el-pagination");return e.openBlock(),e.createBlock(r,{"current-page":t.currentPage,"onUpdate:currentPage":a[0]||(a[0]=p=>t.currentPage=p),"page-size":t.pageSize,"onUpdate:pageSize":a[1]||(a[1]=p=>t.pageSize=p),"page-sizes":t.pageSizes,total:t.total,layout:t.layout,class:"zxt-pagination",onSizeChange:t.handleSizeChange,onCurrentChange:t.handleCurrentChange},null,8,["current-page","page-size","page-sizes","total","layout","onSizeChange","onCurrentChange"])}const E=T(fe,[["render",ge],["__scopeId","data-v-497aa44d"]]),M={default:({cellValue:t})=>t??"",input:({cellValue:t,row:a,column:n,updateRow:o})=>e.h(y.ElInput,{modelValue:t,size:"small",onInput:s=>o({...a,[n.property]:s})}),select:({cellValue:t,row:a,column:n,updateRow:o,options:s=[]})=>e.h(y.ElSelect,{modelValue:t,size:"small",onChange:i=>o({...a,[n.property]:i})},()=>s.map(i=>e.h(y.ElOption,{label:i.label,value:i.value,key:i.value}))),checkbox:({cellValue:t,row:a,column:n,updateRow:o})=>e.h(y.ElCheckbox,{modelValue:!!t,onChange:s=>o({...a,[n.property]:s})}),link:({cellValue:t,href:a,target:n="_blank"})=>e.h(y.ElLink,{href:a,target:n},()=>t)};function ue(t,a){if(!t)return null;if(typeof t=="string"){const n=M[t];return n?n(a):(console.warn(`[ZxtTable] 未找到内置渲染器: ${t}`),a.cellValue??"")}if(typeof t=="function")return t(a);if(typeof t=="object"&&!Array.isArray(t)){const{name:n,props:o={},attrs:s={},events:i={},content:r}=t;return typeof n=="string"&&M[n]?M[n]({...a,...o,...s,...i}):typeof n=="object"||typeof n=="function"?e.h(n,{...o,...s,...i},r):(console.warn("[ZxtTable] cellRender 对象缺少有效的 name 字段"),a.cellValue??"")}return a.cellValue??""}function he(t,a){M[t]&&console.warn(`[ZxtTable] 内置渲染器 ${t} 已被覆盖`),M[t]=a}const Ce=e.defineComponent({name:"ZxtTableColumn",components:{ElTableColumn:y.ElTableColumn},props:{column:{type:Object,required:!0},currentPage:{type:Number,default:1},pageSize:{type:Number,default:10}},setup(t){const a=e.inject("updateRow",()=>{}),n=i=>{const{currentPage:r,pageSize:p}=t;return(r-1)*p+i+1},o=e.computed(()=>{const i=t.column;return{...i,prop:i.prop??i.field,label:i.label??i.title}});return{normalizedColumn:o,renderCell:i=>{const r=o.value,p=i.row[r.prop],m=p??r.defaultValue??"";return ue(r.cellRender,{row:i.row,column:r,rowIndex:i.$index,cellValue:m,updateRow:f=>a(f,i.$index)})},defaultIndexMethod:n}}});function be(t,a,n,o,s,i){const r=e.resolveComponent("ZxtTableColumn",!0),p=e.resolveComponent("el-table-column");return t.normalizedColumn.children&&t.normalizedColumn.children.length?(e.openBlock(),e.createBlock(p,e.mergeProps({key:0},t.normalizedColumn,{key:t.normalizedColumn.prop+"-group"}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.normalizedColumn.children,(m,f)=>(e.openBlock(),e.createBlock(r,{key:f,column:m,"current-page":t.currentPage,"page-size":t.pageSize},e.createSlots({_:2},[e.renderList(t.$slots,(g,d)=>({name:d,fn:e.withCtx(C=>[e.renderSlot(t.$slots,d,e.mergeProps({ref_for:!0},C))])}))]),1032,["column","current-page","page-size"]))),128))]),_:3},16)):(e.openBlock(),e.createBlock(p,e.mergeProps({key:1},t.normalizedColumn,{key:t.normalizedColumn.prop,index:t.normalizedColumn.indexMethod||t.defaultIndexMethod}),e.createSlots({_:2},[["selection","index"].includes(t.normalizedColumn.type)?void 0:{name:"default",fn:e.withCtx(m=>[t.normalizedColumn.slot?e.renderSlot(t.$slots,t.normalizedColumn.slot,{key:0,row:m.row,index:m.$index,column:t.normalizedColumn}):t.normalizedColumn.cellRender?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.renderCell(m)),{key:1})):t.normalizedColumn.formatter?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(t.normalizedColumn.formatter(m.row,t.normalizedColumn,m.row[t.normalizedColumn.prop],m.$index)),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createTextVNode(e.toDisplayString(m.row[t.normalizedColumn.prop]),1)],64))]),key:"0"}]),1040,["index"]))}const ye=T(Ce,[["render",be]]),ke=e.defineComponent({name:"ZxtTable",inheritAttrs:!1,components:{ZxtPagination:E,ZxtTableColumn:ye,ElTable:y.ElTable},props:{id:{type:String,default:""},columns:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},height:{type:[String,Number],default:""},pageable:{type:Boolean,default:!0},currentPage:{type:Number,default:1},pageSize:{type:Number,default:10},pageSizes:{type:Array,default:()=>[10,20,50,100]},total:{type:Number,default:0},paginationLayout:{type:String,default:"total, sizes, prev, pager, next, jumper"},proxyConfig:{type:Object,default:null}},emits:["page-change","size-change","sort-change","filter-change","loaded","load-error","update:row"],setup(t,{emit:a}){const n=e.ref(null),o=e.ref(t.pageSize),s=e.ref(t.currentPage),i=e.ref(!1),r=e.ref([]),p=e.ref(0),m=e.ref({prop:"",order:""}),f=e.ref({}),g=e.computed(()=>t.height==="full"?{height:"100%"}:{}),d=e.computed(()=>{if(t.height!=="full")return t.height}),C=e.computed(()=>!!t.proxyConfig),l=e.computed(()=>C.value?p.value:t.total>0?t.total:t.data.length),h=e.computed(()=>C.value?r.value:t.data),_=u=>{C.value&&(s.value=u.page,o.value=u.size,S()),a("size-change",u)},B=u=>{C.value&&(s.value=u.page,o.value=u.size,S()),a("page-change",u)},U=({prop:u,order:w})=>{m.value={prop:u,order:w},C.value&&S(),a("sort-change",{prop:u,order:w})},G=u=>{f.value=u||{},C.value&&S(),a("filter-change",f.value)},S=async()=>{if(!C.value)return;const u=t.proxyConfig||{},w=u.ajax?.query;if(typeof w!="function")return;const P=u.props||{},Q=P.pageField||"page",X=P.sizeField||"size",Y=P.sortField||"sort",v=P.orderField||"order",ee=P.filtersField||"filters",te=u.params||{},R={[Q]:s.value,[X]:o.value,...te};m.value?.prop&&(R[Y]=m.value.prop,R[v]=m.value.order),f.value&&Object.keys(f.value).length&&(R[ee]=f.value),i.value=!0;try{const z=await w(R),Z=u.response||{},c=Z.listField||"list",V=Z.totalField||"total",x=Z.transform;let $=[],A=0;if(typeof x=="function"){const ae=x(z);$=ae?.list??[],A=ae?.total??0}else z&&typeof z=="object"&&($=z?.[c]??z?.data??[],A=z?.[V]??z?.total??0);r.value=Array.isArray($)?$:[],p.value=Number(A)||0,a("loaded",{data:r.value,total:p.value,payload:R})}catch(z){a("load-error",z)}finally{i.value=!1}},O=(u,w)=>{C.value?r.value.splice(w,1,u):a("update:row",{index:w,row:u})};e.provide("updateRow",O),e.onMounted(()=>{C.value&&S()});const J=()=>n.value,W=()=>n.value?.getSelectionRows?.()||[],K=()=>S();return{tableRef:n,containerStyle:g,tableHeight:d,getTableRef:J,pageSize:o,currentPage:s,loading:i,renderData:h,total:l,pageSizes:e.computed(()=>t.pageSizes),paginationLayout:e.computed(()=>t.paginationLayout),handleSizeChange:_,handlePageChange:B,handleSortChange:U,handleFilterChange:G,reload:K,getSelectedRows:W,updateRow:O}}});function ze(t,a,n,o,s,i){const r=e.resolveComponent("ZxtTableColumn"),p=e.resolveComponent("el-table"),m=e.resolveComponent("ZxtPagination"),f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["zxt-table-container",{"zxt-table-container--full":t.height==="full"}]),style:e.normalizeStyle(t.containerStyle)},[e.withDirectives((e.openBlock(),e.createBlock(p,e.mergeProps({ref:"tableRef",data:t.renderData,height:t.tableHeight},t.$attrs,{id:t.id,onSortChange:t.handleSortChange,onFilterChange:t.handleFilterChange}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,(g,d)=>(e.openBlock(),e.createBlock(r,{key:d,column:g,"current-page":t.currentPage,"page-size":t.pageSize},e.createSlots({_:2},[e.renderList(t.$slots,(C,l)=>({name:l,fn:e.withCtx(h=>[e.renderSlot(t.$slots,l,e.mergeProps({ref_for:!0},h),void 0,!0)])}))]),1032,["column","current-page","page-size"]))),128))]),_:3},16,["data","height","id","onSortChange","onFilterChange"])),[[f,t.loading]]),t.pageable?(e.openBlock(),e.createBlock(m,{key:0,"model-value":t.currentPage,"page-size":t.pageSize,"onUpdate:pageSize":a[0]||(a[0]=g=>t.pageSize=g),"page-sizes":t.pageSizes,total:t.total,layout:t.paginationLayout,onPageChange:t.handlePageChange,onSizeChange:t.handleSizeChange},null,8,["model-value","page-size","page-sizes","total","layout","onPageChange","onSizeChange"])):e.createCommentVNode("",!0)],6)}const k=T(ke,[["render",ze],["__scopeId","data-v-421a4654"]]),F=new Map;class we{add(a,n){return!a||typeof a!="string"?(console.warn("[ZxtTable] 渲染器名称必须是字符串"),this):!n||typeof n!="object"?(console.warn("[ZxtTable] 渲染器配置必须是对象"),this):(F.has(a)&&console.warn(`[ZxtTable] 渲染器 "${a}" 已存在,将被覆盖`),F.set(a,n),this)}get(a){return F.get(a)}delete(a){return F.delete(a)}has(a){return F.has(a)}getAll(){return Array.from(F.keys())}clear(){F.clear()}}const j=new we;function Se(t,a,n={}){if(!t||!t.itemRender)return null;const{name:o}=t.itemRender;if(o&&j.has(o)){const s=j.get(o);if(typeof s.renderItemContent=="function"){const i={data:a,field:t.field||t.prop,item:t,formData:a};try{return s.renderItemContent(n,i)}catch(r){return console.error(`[ZxtTable] 渲染器 "${o}" 执行出错:`,r),null}}}return null}k.install=function(t){t.component(k.name,k)},k.registerRenderer=he,k.renderer=j;var _e=e.defineComponent({name:"Delete",__name:"delete",setup(t){return(a,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}}),ne=_e,Be=e.defineComponent({name:"Download",__name:"download",setup(t){return(a,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z"})]))}}),oe=Be,Ve=e.defineComponent({name:"Edit",__name:"edit",setup(t){return(a,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640z"}),e.createElementVNode("path",{fill:"currentColor",d:"m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"})]))}}),re=Ve,$e=e.defineComponent({name:"Plus",__name:"plus",setup(t){return(a,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"})]))}}),le=$e,Ee=e.defineComponent({name:"Refresh",__name:"refresh",setup(t){return(a,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"})]))}}),H=Ee,Fe=e.defineComponent({name:"Search",__name:"search",setup(t){return(a,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"})]))}}),I=Fe,Pe=e.defineComponent({name:"Setting",__name:"setting",setup(t){return(a,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M600.704 64a32 32 0 0 1 30.464 22.208l35.2 109.376c14.784 7.232 28.928 15.36 42.432 24.512l112.384-24.192a32 32 0 0 1 34.432 15.36L944.32 364.8a32 32 0 0 1-4.032 37.504l-77.12 85.12a357 357 0 0 1 0 49.024l77.12 85.248a32 32 0 0 1 4.032 37.504l-88.704 153.6a32 32 0 0 1-34.432 15.296L708.8 803.904c-13.44 9.088-27.648 17.28-42.368 24.512l-35.264 109.376A32 32 0 0 1 600.704 960H423.296a32 32 0 0 1-30.464-22.208L357.696 828.48a352 352 0 0 1-42.56-24.64l-112.32 24.256a32 32 0 0 1-34.432-15.36L79.68 659.2a32 32 0 0 1 4.032-37.504l77.12-85.248a357 357 0 0 1 0-48.896l-77.12-85.248A32 32 0 0 1 79.68 364.8l88.704-153.6a32 32 0 0 1 34.432-15.296l112.32 24.256c13.568-9.152 27.776-17.408 42.56-24.64l35.2-109.312A32 32 0 0 1 423.232 64H600.64zm-23.424 64H446.72l-36.352 113.088-24.512 11.968a294 294 0 0 0-34.816 20.096l-22.656 15.36-116.224-25.088-65.28 113.152 79.68 88.192-1.92 27.136a293 293 0 0 0 0 40.192l1.92 27.136-79.808 88.192 65.344 113.152 116.224-25.024 22.656 15.296a294 294 0 0 0 34.816 20.096l24.512 11.968L446.72 896h130.688l36.48-113.152 24.448-11.904a288 288 0 0 0 34.752-20.096l22.592-15.296 116.288 25.024 65.28-113.152-79.744-88.192 1.92-27.136a293 293 0 0 0 0-40.256l-1.92-27.136 79.808-88.128-65.344-113.152-116.288 24.96-22.592-15.232a288 288 0 0 0-34.752-20.096l-24.448-11.904L577.344 128zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384m0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256"})]))}}),se=Pe,Re=e.defineComponent({name:"Upload",__name:"upload",setup(t){return(a,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248z"})]))}}),ie=Re,Te=e.defineComponent({name:"View",__name:"view",setup(t){return(a,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288m0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.19 160.19 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"})]))}}),de=Te;const Ne=e.defineComponent({name:"ZxtForm",props:{formColumns:{type:Array,default:()=>[]},initialFormData:{type:Object,default:()=>({})},rules:{type:Object,default:()=>({})}},emits:["submit","reset"],setup(t,{emit:a,expose:n}){const o=e.ref(null),s=e.reactive({}),i={input:"el-input",select:"el-select",date:"el-date-picker",daterange:"el-date-picker",datetime:"el-date-picker",datetimerange:"el-date-picker",cascader:"el-cascader"},r=l=>i[l]||"el-input",p=l=>{const h=l.type||"input",_=["select","date","daterange","datetime","datetimerange","cascader"].includes(h),B={placeholder:l.placeholder||`请${_?"选择":"输入"}${l.label}`,disabled:l.disabled,style:"width: 100%","popper-class":"zxt-form-popper"};switch(h){case"date":case"daterange":case"datetime":case"datetimerange":return{...B,type:l.dateType||h,startPlaceholder:l.startPlaceholder||"开始日期",endPlaceholder:l.endPlaceholder||"结束日期",format:l.format,valueFormat:l.valueFormat};case"cascader":return{...B,options:l.options,props:l.cascaderProps,clearable:l.clearable!==!1};case"select":return B;case"input":default:return B}},m=e.computed(()=>t.formColumns.map(l=>({...l,colSpan:{xs:l.xs??l.span??24,sm:l.sm??l.span??12,md:l.md??l.span??12,lg:l.lg??l.span??12,xl:l.xl??l.span??12}})));e.watch(()=>t.initialFormData,l=>{Object.keys(s).forEach(h=>{delete s[h]}),Object.assign(s,l)},{immediate:!0,deep:!0});const f=e.computed(()=>{const l={...t.rules};return Object.keys(l).length===0&&t.formColumns.length>0&&t.formColumns.forEach(h=>{if(h.required){const _=["select","date","daterange","datetime","datetimerange","cascader"].includes(h.type);l[h.prop]=[{required:!0,message:`请${_?"选择":"输入"}${h.label}`,trigger:_?"change":"blur"}]}}),l}),g=()=>{o.value&&o.value.validate(l=>{l&&a("submit",{...s})})},d=()=>{o.value&&o.value.resetFields(),a("reset")},C=l=>()=>Se(l,s,{})||null;return n({validate:()=>o.value?o.value.validate():Promise.resolve(!1),resetFields:()=>o.value&&o.value.resetFields(),getFormData:()=>({...s}),submitForm:g,resetForm:d}),{formRef:o,formData:s,formRules:f,submitForm:g,resetForm:d,processedColumns:m,getComponentType:r,getComponentProps:p,renderCustomItem:C}}}),De={class:"zxt-form-container"},Me={key:0,class:"form-label"},Ze={class:"form-control"};function Le(t,a,n,o,s,i){const r=e.resolveComponent("el-option"),p=e.resolveComponent("el-form-item"),m=e.resolveComponent("el-col"),f=e.resolveComponent("el-row"),g=e.resolveComponent("el-form");return e.openBlock(),e.createElementBlock("div",De,[e.createVNode(g,{ref:"formRef",model:t.formData,rules:t.formRules,"label-width":"100px",class:"zxt-form"},{default:e.withCtx(()=>[e.createVNode(f,{gutter:20},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.processedColumns,(d,C)=>(e.openBlock(),e.createBlock(m,e.mergeProps({key:C},{ref_for:!0},d.colSpan),{default:e.withCtx(()=>[e.createVNode(p,{prop:d.prop,required:d.required,"label-width":"0",class:"custom-form-item"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["form-item-wrapper",{"is-action":d.isAction}])},[d.label?(e.openBlock(),e.createElementBlock("span",Me,e.toDisplayString(d.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Ze,[d.type==="slot"?e.renderSlot(t.$slots,d.slotName||d.prop,{key:0,formData:t.formData,column:d},void 0,!0):d.itemRender?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.renderCustomItem(d)),{key:1})):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.getComponentType(d.type)),e.mergeProps({key:2,modelValue:t.formData[d.prop],"onUpdate:modelValue":l=>t.formData[d.prop]=l},{ref_for:!0},t.getComponentProps(d),e.toHandlers(d.events||{})),{default:e.withCtx(()=>[d.type==="select"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(d.options,(l,h)=>(e.openBlock(),e.createBlock(r,{key:h,label:l.label,value:l.value},null,8,["label","value"]))),128)):e.createCommentVNode("",!0)]),_:2},1040,["modelValue","onUpdate:modelValue"]))])],2)]),_:2},1032,["prop","required"])]),_:2},1040))),128))]),_:3})]),_:3},8,["model","rules"])])}const L=T(Ne,[["render",Le],["__scopeId","data-v-9c337267"]]),Oe=e.defineComponent({name:"ZxtGrid",inheritAttrs:!1,components:{ZxtTable:k,ZxtForm:L,Plus:le,Delete:ne,Refresh:H,Download:oe,Search:I,Edit:re,View:de,Upload:ie,Setting:se},props:{gridOptions:{type:Object,default:()=>({id:"grid",columns:[],data:[],height:400,pageable:!0,pageSizes:[10,20,50,100],paginationLayout:"total, sizes, prev, pager, next, jumper",toolbar:null,formMode:!1,formColumns:[],rules:{}})},externalData:{type:Array,default:()=>[]}},emits:["toolbar-click","submit","reset","page-change","size-change"],setup(t,{emit:a,expose:n}){const o=e.useAttrs(),s=e.ref(null),i=e.ref(null),r=e.ref(null),p=e.ref(1),m=e.ref(10),f=e.ref([]),g=e.ref(t.gridOptions.formMode||!0),d={Plus:le,Delete:ne,Refresh:H,Download:oe,Search:I,Edit:re,View:de,Upload:ie,Setting:se},C=e.computed(()=>{const c=t.gridOptions.formConfig;if(!c||!c.items)return[];const V=[...c.items];return V.some($=>$.type==="slot"&&$.slotName==="search-actions")||V.push({type:"slot",slotName:"search-actions",span:6,labelWidth:"0px",isAction:!0,...c.actionConfig}),V}),l=()=>{r.value?.submitForm()},h=c=>{a("search-submit",c)},_=()=>{r.value?.resetForm()},B=()=>{a("search-reset"),setTimeout(()=>{r.value?.submitForm()},0)},U=c=>{if(c)return typeof c=="object"||typeof c=="function"?c:d[c]},G=e.computed(()=>{const{formConfig:c,toolbar:V,formMode:x,formColumns:$,rules:A,data:ae,...Ge}=t.gridOptions;return Ge}),S=e.computed(()=>t.externalData.length>0?t.externalData:t.gridOptions.data||[]),O=e.computed(()=>S.value.length),J=(c,V)=>{switch(a("toolbar-click",{code:c,button:V,grid:s.value}),c){case"add":W();break;case"delete":K();break;case"refresh":u();break;case"export":w();break}},W=()=>{g.value=!0},K=()=>{const c=s.value?.getTableRef()?.getSelectionRows?.()||[];if(c.length===0){y.ElMessage.warning("请先选择要删除的数据");return}y.ElMessage.success(`删除 ${c.length} 条数据`)},u=()=>{y.ElMessage.success("刷新数据"),s.value?.reload?.()},w=()=>{y.ElMessage.success("导出数据")},P=c=>{a("submit",c)},Q=()=>{a("reset")},X=()=>{g.value=!1},Y=c=>{p.value=c.page,a("page-change",c)},v=c=>{m.value=c.size,a("size-change",c)},ee=()=>s.value,te=()=>i.value,R=()=>s.value?.getTableRef()?.getSelectionRows?.()||[],z=c=>{f.value=c},Z=c=>{g.value=c};return e.watch(()=>t.gridOptions.formMode,c=>{c!==void 0&&(g.value=c)}),n({getGridRef:ee,getFormRef:te,getSelectedRows:R,reloadData:z,setFormVisible:Z}),{attrs:o,gridRef:s,formRef:i,searchFormRef:r,currentPage:p,pageSize:m,tableData:S,tableProps:G,total:O,isFormVisible:g,searchFormColumns:C,getIconComponent:U,handleToolbarClick:J,handleSubmit:P,handleFormReset:Q,handleFormCancel:X,handlePageChange:Y,handleSizeChange:v,handleSearch:l,handleSearchSubmit:h,handleReset:_,handleSearchReset:B,Search:I,Refresh:H}}}),xe={key:0,class:"grid-search-form"},Ae={class:"search-btn-group"},je={class:"grid-table-wrapper"},He={key:0,class:"grid-toolbar"};function Ie(t,a,n,o,s,i){const r=e.resolveComponent("el-button"),p=e.resolveComponent("ZxtForm"),m=e.resolveComponent("ZxtTable");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["zxt-grid-container",{"zxt-grid-container--full":t.gridOptions.height==="full"}])},[t.gridOptions.formConfig?(e.openBlock(),e.createElementBlock("div",xe,[e.createVNode(p,{ref:"searchFormRef","form-columns":t.searchFormColumns,"initial-form-data":t.gridOptions.formConfig.data,rules:t.gridOptions.formConfig.rules,onSubmit:t.handleSearchSubmit,onReset:t.handleSearchReset},e.createSlots({"search-actions":e.withCtx(()=>[e.createElementVNode("div",Ae,[e.createVNode(r,{class:"btn-search",icon:t.Search,onClick:t.handleSearch},{default:e.withCtx(()=>[...a[0]||(a[0]=[e.createTextVNode(" 查询 ",-1)])]),_:1},8,["icon","onClick"]),e.createVNode(r,{class:"btn-reset",icon:t.Refresh,onClick:t.handleReset},{default:e.withCtx(()=>[...a[1]||(a[1]=[e.createTextVNode(" 重置 ",-1)])]),_:1},8,["icon","onClick"])])]),_:2},[e.renderList(t.$slots,(f,g)=>({name:g,fn:e.withCtx(d=>[e.renderSlot(t.$slots,g,e.normalizeProps(e.guardReactiveProps(d)),void 0,!0)])}))]),1032,["form-columns","initial-form-data","rules","onSubmit","onReset"])])):e.createCommentVNode("",!0),e.createElementVNode("div",je,[t.gridOptions.toolbar?(e.openBlock(),e.createElementBlock("div",He,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.gridOptions.toolbar.buttons,(f,g)=>(e.openBlock(),e.createBlock(r,{key:g,type:f.type||"default",size:f.size||"small",icon:t.getIconComponent(f.icon),disabled:f.disabled,onClick:d=>t.handleToolbarClick(f.code,f)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.name),1)]),_:2},1032,["type","size","icon","disabled","onClick"]))),128)),e.renderSlot(t.$slots,"toolbar",{grid:t.$refs.gridRef},void 0,!0)])):e.createCommentVNode("",!0),e.createVNode(m,e.mergeProps({ref:"gridRef"},{...t.tableProps,...t.attrs},{id:t.gridOptions.id,columns:t.gridOptions.columns,data:t.tableData,height:t.gridOptions.height,pageable:t.gridOptions.pageable!==!1,"current-page":t.currentPage,"page-size":t.pageSize,"page-sizes":t.gridOptions.pageSizes,total:t.total,"pagination-layout":t.gridOptions.paginationLayout,onPageChange:t.handlePageChange,onSizeChange:t.handleSizeChange}),e.createSlots({_:2},[e.renderList(t.$slots,(f,g)=>({name:g,fn:e.withCtx(d=>[e.renderSlot(t.$slots,g,e.normalizeProps(e.guardReactiveProps(d)),void 0,!0)])}))]),1040,["id","columns","data","height","pageable","current-page","page-size","page-sizes","total","pagination-layout","onPageChange","onSizeChange"])])],2)}const q=T(Oe,[["render",Ie],["__scopeId","data-v-a7b1f516"]]);E.install=function(t){t.component(E.name,E)};const qe=[N,D,k,q,L,E],Ue={install:t=>{qe.forEach(a=>{t.component(a.name,a)})},MyButton:N,JsxButton:D,ZxtTable:k,ZxtGrid:q,ZxtForm:L,ZxtPagination:E,renderer:k.renderer,registerRenderer:k.registerRenderer};b.JsxButton=D,b.MyButton=N,b.ZxtForm=L,b.ZxtGrid=q,b.ZxtPagination=E,b.ZxtTable=k,b.default=Ue,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(y,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(y=typeof globalThis<"u"?globalThis:y||self,e(y.ZxtTable={},y.Vue,y.ElementPlus))})(this,(function(y,e,k){"use strict";const T=(t,n)=>{const a=t.__vccOpts||t;for(const[o,s]of n)a[o]=s;return a},ce={name:"MyButton",props:{type:{type:String,default:"default",validator:t=>["default","primary","success","warning","danger"].includes(t)},disabled:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:n}){return{handleClick:o=>{n("click",o)}}}},pe=["disabled"];function me(t,n,a,o,s,i){return e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["my-button",[`my-button--${a.type}`,{"is-disabled":a.disabled}]]),disabled:a.disabled,onClick:n[0]||(n[0]=(...l)=>o.handleClick&&o.handleClick(...l))},[e.renderSlot(t.$slots,"default",{},void 0,!0)],10,pe)}const N=T(ce,[["render",me],["__scopeId","data-v-4480e77d"]]);N.install=function(t){t.component(N.name,N)};const O=e.defineComponent({name:"JsxButton",props:{type:{type:String,default:"default",validator:t=>["default","primary","success","warning","danger"].includes(t)},disabled:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:n,slots:a}){const o=s=>{t.disabled||n("click",s)};return()=>e.createVNode("button",{class:["jsx-button",`jsx-button--${t.type}`,{"is-disabled":t.disabled}],disabled:t.disabled,onClick:o},[a.default?.()])}});O.install=function(t){t.component(O.name,O)};const fe=e.defineComponent({name:"ZxtPagination",components:{ElPagination:k.ElPagination},props:{modelValue:{type:Number,default:1},pageSize:{type:Number,default:10},pageSizes:{type:Array,default:()=>[10,20,50,100]},total:{type:Number,default:0},layout:{type:String,default:"total, sizes, prev, pager, next, jumper"}},emits:["update:modelValue","update:pageSize","page-change","size-change"],setup(t,{emit:n}){const a=e.ref(t.modelValue),o=e.ref(t.pageSize);return e.watch(()=>t.modelValue,l=>{a.value=l}),e.watch(()=>t.pageSize,l=>{o.value=l}),{currentPage:a,pageSize:o,handleSizeChange:l=>{o.value=l,a.value=1,n("update:pageSize",l),n("size-change",{page:a.value,size:l})},handleCurrentChange:l=>{a.value=l,n("update:modelValue",l),n("page-change",{page:l,size:o.value})}}}});function ge(t,n,a,o,s,i){const l=e.resolveComponent("el-pagination");return e.openBlock(),e.createBlock(l,{"current-page":t.currentPage,"onUpdate:currentPage":n[0]||(n[0]=p=>t.currentPage=p),"page-size":t.pageSize,"onUpdate:pageSize":n[1]||(n[1]=p=>t.pageSize=p),"page-sizes":t.pageSizes,total:t.total,layout:t.layout,class:"zxt-pagination",onSizeChange:t.handleSizeChange,onCurrentChange:t.handleCurrentChange},null,8,["current-page","page-size","page-sizes","total","layout","onSizeChange","onCurrentChange"])}const E=T(fe,[["render",ge],["__scopeId","data-v-497aa44d"]]),x={default:({cellValue:t})=>t??"",input:({cellValue:t,row:n,column:a,updateRow:o})=>e.h(k.ElInput,{modelValue:t,size:"small",onInput:s=>o({...n,[a.property]:s})}),select:({cellValue:t,row:n,column:a,updateRow:o,options:s=[]})=>e.h(k.ElSelect,{modelValue:t,size:"small",onChange:i=>o({...n,[a.property]:i})},()=>s.map(i=>e.h(k.ElOption,{label:i.label,value:i.value,key:i.value}))),checkbox:({cellValue:t,row:n,column:a,updateRow:o})=>e.h(k.ElCheckbox,{modelValue:!!t,onChange:s=>o({...n,[a.property]:s})}),link:({cellValue:t,href:n,target:a="_blank"})=>e.h(k.ElLink,{href:n,target:a},()=>t)};function ue(t,n){if(!t)return null;if(typeof t=="string"){const a=x[t];return a?a(n):(console.warn(`[ZxtTable] 未找到内置渲染器: ${t}`),n.cellValue??"")}if(typeof t=="function")return t(n);if(typeof t=="object"&&!Array.isArray(t)){const{name:a,props:o={},attrs:s={},events:i={},content:l}=t;return typeof a=="string"&&x[a]?x[a]({...n,...o,...s,...i}):typeof a=="object"||typeof a=="function"?e.h(a,{...o,...s,...i},l):(console.warn("[ZxtTable] cellRender 对象缺少有效的 name 字段"),n.cellValue??"")}return n.cellValue??""}function he(t,n){x[t]&&console.warn(`[ZxtTable] 内置渲染器 ${t} 已被覆盖`),x[t]=n}const Ce=e.defineComponent({name:"ZxtTableColumn",components:{ElTableColumn:k.ElTableColumn},props:{column:{type:Object,required:!0},currentPage:{type:Number,default:1},pageSize:{type:Number,default:10}},setup(t){const n=e.inject("updateRow",()=>{}),a=i=>{const{currentPage:l,pageSize:p}=t;return(l-1)*p+i+1},o=e.computed(()=>{const i=t.column;return{...i,prop:i.prop??i.field,label:i.label??i.title}});return{normalizedColumn:o,renderCell:i=>{const l=o.value,p=i.row[l.prop],m=p??l.defaultValue??"";return ue(l.cellRender,{row:i.row,column:l,rowIndex:i.$index,cellValue:m,updateRow:f=>n(f,i.$index)})},defaultIndexMethod:a}}});function ye(t,n,a,o,s,i){const l=e.resolveComponent("ZxtTableColumn",!0),p=e.resolveComponent("el-table-column");return t.normalizedColumn.children&&t.normalizedColumn.children.length?(e.openBlock(),e.createBlock(p,e.mergeProps({key:0},t.normalizedColumn,{key:t.normalizedColumn.prop+"-group"}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.normalizedColumn.children,(m,f)=>(e.openBlock(),e.createBlock(l,{key:f,column:m,"current-page":t.currentPage,"page-size":t.pageSize},e.createSlots({_:2},[e.renderList(t.$slots,(g,c)=>({name:c,fn:e.withCtx(C=>[e.renderSlot(t.$slots,c,e.mergeProps({ref_for:!0},C))])}))]),1032,["column","current-page","page-size"]))),128))]),_:3},16)):(e.openBlock(),e.createBlock(p,e.mergeProps({key:1},t.normalizedColumn,{key:t.normalizedColumn.prop,index:t.normalizedColumn.indexMethod||t.defaultIndexMethod}),e.createSlots({_:2},[["selection","index"].includes(t.normalizedColumn.type)?void 0:{name:"default",fn:e.withCtx(m=>[t.normalizedColumn.slot?e.renderSlot(t.$slots,t.normalizedColumn.slot,{key:0,row:m.row,index:m.$index,column:t.normalizedColumn}):t.normalizedColumn.cellRender?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.renderCell(m)),{key:1})):t.normalizedColumn.formatter?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(t.normalizedColumn.formatter(m.row,t.normalizedColumn,m.row[t.normalizedColumn.prop],m.$index)),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createTextVNode(e.toDisplayString(m.row[t.normalizedColumn.prop]),1)],64))]),key:"0"}]),1040,["index"]))}const be=T(Ce,[["render",ye]]),ke=e.defineComponent({name:"ZxtTable",inheritAttrs:!1,components:{ZxtPagination:E,ZxtTableColumn:be,ElTable:k.ElTable},props:{id:{type:String,default:""},columns:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},height:{type:[String,Number],default:""},pageable:{type:Boolean,default:!0},currentPage:{type:Number,default:1},pageSize:{type:Number,default:10},pageSizes:{type:Array,default:()=>[10,20,50,100]},total:{type:Number,default:0},paginationLayout:{type:String,default:"total, sizes, prev, pager, next, jumper"},proxyConfig:{type:Object,default:null}},emits:["page-change","size-change","sort-change","filter-change","loaded","load-error","update:row"],setup(t,{emit:n}){const a=e.ref(null),o=e.ref(t.pageSize),s=e.ref(t.currentPage),i=e.ref(!1),l=e.ref([]),p=e.ref(0),m=e.ref({prop:"",order:""}),f=e.ref({}),g=e.computed(()=>t.height==="full"?{height:"100%"}:{}),c=e.computed(()=>{if(t.height!=="full")return t.height}),C=e.computed(()=>!!t.proxyConfig),r=e.computed(()=>C.value?p.value:t.total>0?t.total:t.data.length),h=e.computed(()=>C.value?l.value:t.data),B=u=>{C.value&&(s.value=u.page,o.value=u.size,_()),n("size-change",u)},V=u=>{C.value&&(s.value=u.page,o.value=u.size,_()),n("page-change",u)},U=({prop:u,order:S})=>{m.value={prop:u,order:S},C.value&&_(),n("sort-change",{prop:u,order:S})},G=u=>{f.value=u||{},C.value&&_(),n("filter-change",f.value)},_=async()=>{if(!C.value)return;const u=t.proxyConfig||{},S=u.ajax?.query;if(typeof S!="function")return;const P=u.props||{},Q=P.pageField||"page",X=P.sizeField||"size",Y=P.sortField||"sort",v=P.orderField||"order",ee=P.filtersField||"filters",te=u.params||{},R={[Q]:s.value,[X]:o.value,...te};m.value?.prop&&(R[Y]=m.value.prop,R[v]=m.value.order),f.value&&Object.keys(f.value).length&&(R[ee]=f.value),i.value=!0;try{const w=await S(R),D=u.response||{},d=D.listField||"list",b=D.totalField||"total",L=D.transform;let $=[],j=0;if(typeof L=="function"){const ne=L(w);$=ne?.list??[],j=ne?.total??0}else w&&typeof w=="object"&&($=w?.[d]??w?.data??[],j=w?.[b]??w?.total??0);l.value=Array.isArray($)?$:[],p.value=Number(j)||0,n("loaded",{data:l.value,total:p.value,payload:R})}catch(w){n("load-error",w)}finally{i.value=!1}},Z=(u,S)=>{C.value?l.value.splice(S,1,u):n("update:row",{index:S,row:u})};e.provide("updateRow",Z),e.onMounted(()=>{C.value&&_()});const J=()=>a.value,W=()=>a.value?.getSelectionRows?.()||[],K=()=>_();return{tableRef:a,containerStyle:g,tableHeight:c,getTableRef:J,pageSize:o,currentPage:s,loading:i,renderData:h,total:r,pageSizes:e.computed(()=>t.pageSizes),paginationLayout:e.computed(()=>t.paginationLayout),handleSizeChange:B,handlePageChange:V,handleSortChange:U,handleFilterChange:G,reload:K,getSelectedRows:W,updateRow:Z}}});function ze(t,n,a,o,s,i){const l=e.resolveComponent("ZxtTableColumn"),p=e.resolveComponent("el-table"),m=e.resolveComponent("ZxtPagination"),f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["zxt-table-container",{"zxt-table-container--full":t.height==="full"}]),style:e.normalizeStyle(t.containerStyle)},[e.withDirectives((e.openBlock(),e.createBlock(p,e.mergeProps({ref:"tableRef",data:t.renderData,height:t.tableHeight},t.$attrs,{id:t.id,onSortChange:t.handleSortChange,onFilterChange:t.handleFilterChange}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,(g,c)=>(e.openBlock(),e.createBlock(l,{key:c,column:g,"current-page":t.currentPage,"page-size":t.pageSize},e.createSlots({_:2},[e.renderList(t.$slots,(C,r)=>({name:r,fn:e.withCtx(h=>[e.renderSlot(t.$slots,r,e.mergeProps({ref_for:!0},h),void 0,!0)])}))]),1032,["column","current-page","page-size"]))),128))]),_:3},16,["data","height","id","onSortChange","onFilterChange"])),[[f,t.loading]]),t.pageable?(e.openBlock(),e.createBlock(m,{key:0,"model-value":t.currentPage,"page-size":t.pageSize,"onUpdate:pageSize":n[0]||(n[0]=g=>t.pageSize=g),"page-sizes":t.pageSizes,total:t.total,layout:t.paginationLayout,onPageChange:t.handlePageChange,onSizeChange:t.handleSizeChange},null,8,["model-value","page-size","page-sizes","total","layout","onPageChange","onSizeChange"])):e.createCommentVNode("",!0)],6)}const z=T(ke,[["render",ze],["__scopeId","data-v-421a4654"]]),F=new Map;class we{add(n,a){return!n||typeof n!="string"?(console.warn("[ZxtTable] 渲染器名称必须是字符串"),this):!a||typeof a!="object"?(console.warn("[ZxtTable] 渲染器配置必须是对象"),this):(F.has(n)&&console.warn(`[ZxtTable] 渲染器 "${n}" 已存在,将被覆盖`),F.set(n,a),this)}get(n){return F.get(n)}delete(n){return F.delete(n)}has(n){return F.has(n)}getAll(){return Array.from(F.keys())}clear(){F.clear()}}const A=new we;function Se(t,n,a={}){if(!t||!t.itemRender)return null;const{name:o}=t.itemRender;if(o&&A.has(o)){const s=A.get(o);if(typeof s.renderItemContent=="function"){const i={data:n,field:t.field||t.prop,item:t,formData:n};try{return s.renderItemContent(a,i)}catch(l){return console.error(`[ZxtTable] 渲染器 "${o}" 执行出错:`,l),null}}}return null}z.install=function(t){t.component(z.name,z)},z.registerRenderer=he,z.renderer=A;var _e=e.defineComponent({name:"Delete",__name:"delete",setup(t){return(n,a)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}}),ae=_e,Be=e.defineComponent({name:"Download",__name:"download",setup(t){return(n,a)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z"})]))}}),oe=Be,Ve=e.defineComponent({name:"Edit",__name:"edit",setup(t){return(n,a)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640z"}),e.createElementVNode("path",{fill:"currentColor",d:"m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"})]))}}),re=Ve,$e=e.defineComponent({name:"Plus",__name:"plus",setup(t){return(n,a)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"})]))}}),le=$e,Ee=e.defineComponent({name:"Refresh",__name:"refresh",setup(t){return(n,a)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"})]))}}),H=Ee,Fe=e.defineComponent({name:"Search",__name:"search",setup(t){return(n,a)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"})]))}}),I=Fe,Pe=e.defineComponent({name:"Setting",__name:"setting",setup(t){return(n,a)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M600.704 64a32 32 0 0 1 30.464 22.208l35.2 109.376c14.784 7.232 28.928 15.36 42.432 24.512l112.384-24.192a32 32 0 0 1 34.432 15.36L944.32 364.8a32 32 0 0 1-4.032 37.504l-77.12 85.12a357 357 0 0 1 0 49.024l77.12 85.248a32 32 0 0 1 4.032 37.504l-88.704 153.6a32 32 0 0 1-34.432 15.296L708.8 803.904c-13.44 9.088-27.648 17.28-42.368 24.512l-35.264 109.376A32 32 0 0 1 600.704 960H423.296a32 32 0 0 1-30.464-22.208L357.696 828.48a352 352 0 0 1-42.56-24.64l-112.32 24.256a32 32 0 0 1-34.432-15.36L79.68 659.2a32 32 0 0 1 4.032-37.504l77.12-85.248a357 357 0 0 1 0-48.896l-77.12-85.248A32 32 0 0 1 79.68 364.8l88.704-153.6a32 32 0 0 1 34.432-15.296l112.32 24.256c13.568-9.152 27.776-17.408 42.56-24.64l35.2-109.312A32 32 0 0 1 423.232 64H600.64zm-23.424 64H446.72l-36.352 113.088-24.512 11.968a294 294 0 0 0-34.816 20.096l-22.656 15.36-116.224-25.088-65.28 113.152 79.68 88.192-1.92 27.136a293 293 0 0 0 0 40.192l1.92 27.136-79.808 88.192 65.344 113.152 116.224-25.024 22.656 15.296a294 294 0 0 0 34.816 20.096l24.512 11.968L446.72 896h130.688l36.48-113.152 24.448-11.904a288 288 0 0 0 34.752-20.096l22.592-15.296 116.288 25.024 65.28-113.152-79.744-88.192 1.92-27.136a293 293 0 0 0 0-40.256l-1.92-27.136 79.808-88.128-65.344-113.152-116.288 24.96-22.592-15.232a288 288 0 0 0-34.752-20.096l-24.448-11.904L577.344 128zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384m0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256"})]))}}),se=Pe,Re=e.defineComponent({name:"Upload",__name:"upload",setup(t){return(n,a)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248z"})]))}}),ie=Re,Te=e.defineComponent({name:"View",__name:"view",setup(t){return(n,a)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288m0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.19 160.19 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"})]))}}),de=Te;const Ne=e.defineComponent({name:"ZxtForm",props:{formColumns:{type:Array,default:()=>[]},initialFormData:{type:Object,default:()=>({})},rules:{type:Object,default:()=>({})}},emits:["submit","reset"],setup(t,{emit:n,expose:a}){const o=e.ref(null),s=e.reactive({}),i={input:"el-input",select:"el-select",date:"el-date-picker",daterange:"el-date-picker",datetime:"el-date-picker",datetimerange:"el-date-picker",cascader:"el-cascader"},l=r=>i[r]||"el-input",p=r=>{const h=r.type||"input",B=["select","date","daterange","datetime","datetimerange","cascader"].includes(h),V={placeholder:r.placeholder||`请${B?"选择":"输入"}${r.label}`,disabled:r.disabled,style:"width: 100%","popper-class":"zxt-form-popper"};switch(h){case"date":case"daterange":case"datetime":case"datetimerange":return{...V,type:r.dateType||h,startPlaceholder:r.startPlaceholder||"开始日期",endPlaceholder:r.endPlaceholder||"结束日期",format:r.format,valueFormat:r.valueFormat};case"cascader":return{...V,options:r.options,props:r.cascaderProps,clearable:r.clearable!==!1};case"select":return V;case"input":default:return V}},m=e.computed(()=>t.formColumns.map(r=>({...r,colSpan:{xs:r.xs??r.span??24,sm:r.sm??r.span??12,md:r.md??r.span??12,lg:r.lg??r.span??12,xl:r.xl??r.span??12}})));e.watch(()=>t.initialFormData,r=>{Object.keys(s).forEach(h=>{delete s[h]}),Object.assign(s,r)},{immediate:!0,deep:!0});const f=e.computed(()=>{const r={...t.rules};return Object.keys(r).length===0&&t.formColumns.length>0&&t.formColumns.forEach(h=>{if(h.required){const B=["select","date","daterange","datetime","datetimerange","cascader"].includes(h.type);r[h.prop]=[{required:!0,message:`请${B?"选择":"输入"}${h.label}`,trigger:B?"change":"blur"}]}}),r}),g=()=>{o.value&&o.value.validate(r=>{r&&n("submit",{...s})})},c=()=>{o.value&&o.value.resetFields(),n("reset")},C=r=>()=>Se(r,s,{})||null;return a({validate:()=>o.value?o.value.validate():Promise.resolve(!1),resetFields:()=>o.value&&o.value.resetFields(),getFormData:()=>({...s}),submitForm:g,resetForm:c}),{formRef:o,formData:s,formRules:f,submitForm:g,resetForm:c,processedColumns:m,getComponentType:l,getComponentProps:p,renderCustomItem:C}}}),Oe={class:"zxt-form-container"},xe={key:0,class:"form-label"},De={class:"form-control"};function Me(t,n,a,o,s,i){const l=e.resolveComponent("el-option"),p=e.resolveComponent("el-form-item"),m=e.resolveComponent("el-col"),f=e.resolveComponent("el-row"),g=e.resolveComponent("el-form");return e.openBlock(),e.createElementBlock("div",Oe,[e.createVNode(g,{ref:"formRef",model:t.formData,rules:t.formRules,"label-width":"100px",class:"zxt-form"},{default:e.withCtx(()=>[e.createVNode(f,{gutter:20},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.processedColumns,(c,C)=>(e.openBlock(),e.createBlock(m,e.mergeProps({key:C},{ref_for:!0},c.colSpan),{default:e.withCtx(()=>[e.createVNode(p,{prop:c.prop,required:c.required,"label-width":"0",class:"custom-form-item"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["form-item-wrapper",{"is-action":c.isAction}])},[c.label?(e.openBlock(),e.createElementBlock("span",xe,e.toDisplayString(c.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",De,[c.type==="slot"?e.renderSlot(t.$slots,c.slotName||c.prop,{key:0,formData:t.formData,column:c},void 0,!0):c.itemRender?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.renderCustomItem(c)),{key:1})):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.getComponentType(c.type)),e.mergeProps({key:2,modelValue:t.formData[c.prop],"onUpdate:modelValue":r=>t.formData[c.prop]=r},{ref_for:!0},t.getComponentProps(c),e.toHandlers(c.events||{})),{default:e.withCtx(()=>[c.type==="select"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.options,(r,h)=>(e.openBlock(),e.createBlock(l,{key:h,label:r.label,value:r.value},null,8,["label","value"]))),128)):e.createCommentVNode("",!0)]),_:2},1040,["modelValue","onUpdate:modelValue"]))])],2)]),_:2},1032,["prop","required"])]),_:2},1040))),128))]),_:3})]),_:3},8,["model","rules"])])}const M=T(Ne,[["render",Me],["__scopeId","data-v-9c337267"]]),Ze=e.defineComponent({name:"ZxtGrid",inheritAttrs:!1,components:{ZxtTable:z,ZxtForm:M,Plus:le,Delete:ae,Refresh:H,Download:oe,Search:I,Edit:re,View:de,Upload:ie,Setting:se},props:{gridOptions:{type:Object,default:()=>({id:"grid",columns:[],data:[],height:400,pageable:!0,pageSizes:[10,20,50,100],paginationLayout:"total, sizes, prev, pager, next, jumper",toolbar:null,formMode:!1,formColumns:[],rules:{}})},externalData:{type:Array,default:()=>[]}},emits:["toolbar-click","submit","reset","page-change","size-change"],setup(t,{emit:n,expose:a}){const o=e.useAttrs(),s=e.ref(null),i=e.ref(null),l=e.ref(null),p=e.ref(1),m=e.ref(10),f=e.ref([]),g=e.ref(t.gridOptions.formMode||!0),c={Plus:le,Delete:ae,Refresh:H,Download:oe,Search:I,Edit:re,View:de,Upload:ie,Setting:se},C=e.computed(()=>{const d=t.gridOptions.formConfig;if(!d||!d.items)return[];const b=[...d.items];return b.some($=>$.type==="slot"&&$.slotName==="search-actions")||b.push({type:"slot",slotName:"search-actions",span:6,labelWidth:"0px",isAction:!0,...d.actionConfig}),b}),r=()=>{l.value?.submitForm()},h=d=>{n("submit",d),t.gridOptions.proxyConfig&&(t.gridOptions.proxyConfig.params||(t.gridOptions.proxyConfig.params={}),Object.assign(t.gridOptions.proxyConfig.params,d),p.value=1,s.value?.reload?.())},B=()=>{l.value?.resetForm()},V=()=>{n("reset"),t.gridOptions.proxyConfig&&(t.gridOptions.proxyConfig.params&&(t.gridOptions.formConfig?.items?.map(b=>b.prop)||[]).forEach(b=>{t.gridOptions.proxyConfig.params[b]!==void 0&&delete t.gridOptions.proxyConfig.params[b]}),p.value=1,s.value?.reload?.())},U=d=>{if(d)return typeof d=="object"||typeof d=="function"?d:c[d]},G=e.computed(()=>{const{formConfig:d,toolbar:b,formMode:L,formColumns:$,rules:j,data:ne,...Ge}=t.gridOptions;return Ge}),_=e.computed(()=>t.externalData.length>0?t.externalData:t.gridOptions.data||[]),Z=e.computed(()=>_.value.length),J=(d,b)=>{switch(n("toolbar-click",{code:d,button:b,grid:s.value}),d){case"add":W();break;case"delete":K();break;case"refresh":u();break;case"export":S();break}},W=()=>{g.value=!0},K=()=>{const d=s.value?.getTableRef()?.getSelectionRows?.()||[];if(d.length===0){k.ElMessage.warning("请先选择要删除的数据");return}k.ElMessage.success(`删除 ${d.length} 条数据`)},u=()=>{k.ElMessage.success("刷新数据"),s.value?.reload?.()},S=()=>{k.ElMessage.success("导出数据")},P=d=>{n("submit",d)},Q=()=>{n("reset")},X=()=>{g.value=!1},Y=d=>{p.value=d.page,n("page-change",d)},v=d=>{m.value=d.size,n("size-change",d)},ee=()=>s.value,te=()=>i.value,R=()=>s.value?.getTableRef()?.getSelectionRows?.()||[],w=d=>{f.value=d},D=d=>{g.value=d};return e.watch(()=>t.gridOptions.formMode,d=>{d!==void 0&&(g.value=d)}),a({getGridRef:ee,getFormRef:te,getSelectedRows:R,reloadData:w,setFormVisible:D}),{attrs:o,gridRef:s,formRef:i,searchFormRef:l,currentPage:p,pageSize:m,tableData:_,tableProps:G,total:Z,isFormVisible:g,searchFormColumns:C,getIconComponent:U,handleToolbarClick:J,handleSubmit:P,handleFormReset:Q,handleFormCancel:X,handlePageChange:Y,handleSizeChange:v,handleSearch:r,handleSearchSubmit:h,handleReset:B,handleSearchReset:V,Search:I,Refresh:H}}}),Le={key:0,class:"grid-search-form"},je={class:"search-btn-group"},Ae={class:"grid-table-wrapper"},He={key:0,class:"grid-toolbar"};function Ie(t,n,a,o,s,i){const l=e.resolveComponent("el-button"),p=e.resolveComponent("ZxtForm"),m=e.resolveComponent("ZxtTable");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["zxt-grid-container",{"zxt-grid-container--full":t.gridOptions.height==="full"}])},[t.gridOptions.formConfig?(e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(p,{ref:"searchFormRef","form-columns":t.searchFormColumns,"initial-form-data":t.gridOptions.formConfig.data,rules:t.gridOptions.formConfig.rules,onSubmit:t.handleSearchSubmit,onReset:t.handleSearchReset},e.createSlots({"search-actions":e.withCtx(()=>[e.createElementVNode("div",je,[e.createVNode(l,{class:"btn-search",icon:t.Search,onClick:t.handleSearch},{default:e.withCtx(()=>[...n[0]||(n[0]=[e.createTextVNode(" 查询 ",-1)])]),_:1},8,["icon","onClick"]),e.createVNode(l,{class:"btn-reset",icon:t.Refresh,onClick:t.handleReset},{default:e.withCtx(()=>[...n[1]||(n[1]=[e.createTextVNode(" 重置 ",-1)])]),_:1},8,["icon","onClick"])])]),_:2},[e.renderList(t.$slots,(f,g)=>({name:g,fn:e.withCtx(c=>[e.renderSlot(t.$slots,g,e.normalizeProps(e.guardReactiveProps(c)),void 0,!0)])}))]),1032,["form-columns","initial-form-data","rules","onSubmit","onReset"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Ae,[t.gridOptions.toolbar?(e.openBlock(),e.createElementBlock("div",He,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.gridOptions.toolbar.buttons,(f,g)=>(e.openBlock(),e.createBlock(l,{key:g,type:f.type||"default",size:f.size||"small",icon:t.getIconComponent(f.icon),disabled:f.disabled,onClick:c=>t.handleToolbarClick(f.code,f)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.name),1)]),_:2},1032,["type","size","icon","disabled","onClick"]))),128)),e.renderSlot(t.$slots,"toolbar",{grid:t.$refs.gridRef},void 0,!0)])):e.createCommentVNode("",!0),e.createVNode(m,e.mergeProps({ref:"gridRef"},{...t.tableProps,...t.attrs},{id:t.gridOptions.id,columns:t.gridOptions.columns,data:t.tableData,height:t.gridOptions.height,pageable:t.gridOptions.pageable!==!1,"current-page":t.currentPage,"page-size":t.pageSize,"page-sizes":t.gridOptions.pageSizes,total:t.total,"pagination-layout":t.gridOptions.paginationLayout,onPageChange:t.handlePageChange,onSizeChange:t.handleSizeChange}),e.createSlots({_:2},[e.renderList(t.$slots,(f,g)=>({name:g,fn:e.withCtx(c=>[e.renderSlot(t.$slots,g,e.normalizeProps(e.guardReactiveProps(c)),void 0,!0)])}))]),1040,["id","columns","data","height","pageable","current-page","page-size","page-sizes","total","pagination-layout","onPageChange","onSizeChange"])])],2)}const q=T(Ze,[["render",Ie],["__scopeId","data-v-5add7979"]]);E.install=function(t){t.component(E.name,E)};const qe=[N,O,z,q,M,E],Ue={install:t=>{qe.forEach(n=>{t.component(n.name,n)})},MyButton:N,JsxButton:O,ZxtTable:z,ZxtGrid:q,ZxtForm:M,ZxtPagination:E,renderer:z.renderer,registerRenderer:z.registerRenderer};y.JsxButton=O,y.MyButton=N,y.ZxtForm=M,y.ZxtGrid=q,y.ZxtPagination=E,y.ZxtTable=z,y.default=Ue,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zxt-table",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "一个基于 Vue 3 和 Element Plus 的高级表格、表单组件库",
|
|
7
7
|
"keywords": [
|
|
@@ -34,11 +34,6 @@
|
|
|
34
34
|
"README.md",
|
|
35
35
|
"resolver.js"
|
|
36
36
|
],
|
|
37
|
-
"scripts": {
|
|
38
|
-
"dev": "vite",
|
|
39
|
-
"build": "vite build",
|
|
40
|
-
"preview": "vite preview"
|
|
41
|
-
},
|
|
42
37
|
"peerDependencies": {
|
|
43
38
|
"element-plus": "^2.0.0",
|
|
44
39
|
"vue": "^3.2.0"
|
|
@@ -57,5 +52,10 @@
|
|
|
57
52
|
},
|
|
58
53
|
"dependencies": {
|
|
59
54
|
"@element-plus/icons-vue": "^2.3.2"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"dev": "vite",
|
|
58
|
+
"build": "vite build",
|
|
59
|
+
"preview": "vite preview"
|
|
60
60
|
}
|
|
61
|
-
}
|
|
61
|
+
}
|