zxt-table 0.4.2 → 0.4.3
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 +203 -191
- package/dist/zxt-table.umd.js +1 -1
- package/package.json +1 -1
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-1c00db7c]{width:100%}.zxt-table-container--full[data-v-1c00db7c]{display:flex;flex-direction:column;height:100%}.zxt-table-container--full[data-v-1c00db7c] .el-table{flex:1;min-height:0}.zxt-table-container--full[data-v-1c00db7c] .el-table__inner-wrapper{height:100%}[data-v-1c00db7c] .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-1c00db7c] .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-1c00db7c] .el-table td.el-table__cell{padding:8px 0}[data-v-1c00db7c] .el-table .cell{line-height:24px;padding:0 12px}[data-v-1c00db7c] .el-link.el-link--default,[data-v-1c00db7c] .el-link.el-link--primary{--el-link-text-color: #409eff;color:#409eff;font-weight:400}[data-v-1c00db7c] .el-link:hover{color:#66b1ff;text-decoration:none}[data-v-1c00db7c] .el-button--primary.is-link,[data-v-1c00db7c] .el-button--primary.is-text{color:#409eff}[data-v-1c00db7c] .el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell{background-color:#fafafa}[data-v-1c00db7c] .el-table .el-tag{border-radius:4px;height:24px;line-height:22px;padding:0 8px}[data-v-1c00db7c] .el-table__expand-icon{outline:none;border:none}[data-v-1c00db7c] .el-table__expand-icon:focus,[data-v-1c00db7c] .el-table__expand-icon:focus-visible{outline:none;box-shadow:none;border:none}[data-v-1c00db7c] .el-table__expand-icon .el-icon{outline:none}[data-v-1c00db7c] .el-table__expand-icon .el-icon:focus,[data-v-1c00db7c] .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-1c00db7c]{width:100%}.zxt-table-container--full[data-v-1c00db7c]{display:flex;flex-direction:column;height:100%}.zxt-table-container--full[data-v-1c00db7c] .el-table{flex:1;min-height:0}.zxt-table-container--full[data-v-1c00db7c] .el-table__inner-wrapper{height:100%}[data-v-1c00db7c] .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-1c00db7c] .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-1c00db7c] .el-table td.el-table__cell{padding:8px 0}[data-v-1c00db7c] .el-table .cell{line-height:24px;padding:0 12px}[data-v-1c00db7c] .el-link.el-link--default,[data-v-1c00db7c] .el-link.el-link--primary{--el-link-text-color: #409eff;color:#409eff;font-weight:400}[data-v-1c00db7c] .el-link:hover{color:#66b1ff;text-decoration:none}[data-v-1c00db7c] .el-button--primary.is-link,[data-v-1c00db7c] .el-button--primary.is-text{color:#409eff}[data-v-1c00db7c] .el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell{background-color:#fafafa}[data-v-1c00db7c] .el-table .el-tag{border-radius:4px;height:24px;line-height:22px;padding:0 8px}[data-v-1c00db7c] .el-table__expand-icon{outline:none;border:none}[data-v-1c00db7c] .el-table__expand-icon:focus,[data-v-1c00db7c] .el-table__expand-icon:focus-visible{outline:none;box-shadow:none;border:none}[data-v-1c00db7c] .el-table__expand-icon .el-icon{outline:none}[data-v-1c00db7c] .el-table__expand-icon .el-icon:focus,[data-v-1c00db7c] .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-ca0e4fa5]{width:100%}.zxt-grid-container--full[data-v-ca0e4fa5]{display:flex;flex-direction:column;height:100%}.zxt-grid-container--full .grid-table-wrapper[data-v-ca0e4fa5]{flex:1;display:flex;flex-direction:column;min-height:0}.zxt-grid-container--full .zxt-table-container[data-v-ca0e4fa5]{flex:1;min-height:0}.grid-search-form[data-v-ca0e4fa5]{padding:10px;border-radius:4px}.search-btn-group[data-v-ca0e4fa5]{display:flex;gap:10px}.grid-toolbar[data-v-ca0e4fa5]{margin-bottom:10px;padding:10px;border-radius:4px;display:flex;gap:10px;align-items:center}.btn-search[data-v-ca0e4fa5]{background-color:#fff;border-color:#fa2314;color:#fa2314}.btn-search[data-v-ca0e4fa5]:hover,.btn-search[data-v-ca0e4fa5]:focus,.btn-search[data-v-ca0e4fa5]:active{background-color:#fff}.btn-search[data-v-ca0e4fa5]:hover,.btn-search[data-v-ca0e4fa5]:focus{border-color:#fb4f43;color:#fb4f43;outline:none}.btn-search.el-button[data-v-ca0e4fa5]:focus,.btn-search.el-button[data-v-ca0e4fa5]:focus-visible{background-color:#fff;border-color:#fb4f43;color:#fb4f43;outline:none}.btn-search[data-v-ca0e4fa5]:active,.btn-search.el-button[data-v-ca0e4fa5]:active{background-color:#fff;border-color:#e12012;color:#e12012}.btn-reset[data-v-ca0e4fa5]{background-color:#fff;border-color:#ddd;color:#111}.btn-reset[data-v-ca0e4fa5]:hover,.btn-reset[data-v-ca0e4fa5]:focus,.btn-reset[data-v-ca0e4fa5]:active{background-color:#fff}.btn-reset[data-v-ca0e4fa5]:focus,.btn-reset.el-button[data-v-ca0e4fa5]:focus,.btn-reset.el-button[data-v-ca0e4fa5]:focus-visible{border-color:#ddd;color:#111;outline:none}.btn-reset[data-v-ca0e4fa5]:hover,.btn-reset.el-button[data-v-ca0e4fa5]:hover{border-color:#fb4f43;color:#fb4f43}.btn-reset[data-v-ca0e4fa5]:active,.btn-reset.el-button[data-v-ca0e4fa5]:active{background-color:#fff;border-color:#e12012;color:#e12012}
|
package/dist/zxt-table.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createElementBlock as h, openBlock as u, normalizeClass as ne, renderSlot as M, defineComponent as
|
|
2
|
-
import { ElPagination as He, ElLink as
|
|
3
|
-
const
|
|
1
|
+
import { createElementBlock as h, openBlock as u, normalizeClass as ne, renderSlot as M, defineComponent as w, createVNode as Z, ref as b, watch as te, resolveComponent as _, createBlock as k, h as x, inject as De, computed as z, mergeProps as A, withCtx as C, Fragment as E, renderList as O, createSlots as Q, resolveDynamicComponent as ye, createTextVNode as G, toDisplayString as ae, provide as Te, onMounted as Ze, resolveDirective as Me, normalizeStyle as Ae, withDirectives as je, createCommentVNode as X, createElementVNode as S, reactive as Le, toHandlers as Be, useAttrs as Ee, normalizeProps as ze, guardReactiveProps as we } from "vue";
|
|
2
|
+
import { ElPagination as He, ElLink as xe, ElCheckbox as Ie, ElSelect as Ne, ElOption as qe, ElInput as Ue, ElTableColumn as Ge, ElTable as Je, ElMessage as ee } from "element-plus";
|
|
3
|
+
const N = (e, t) => {
|
|
4
4
|
const a = e.__vccOpts || e;
|
|
5
|
-
for (const [r,
|
|
6
|
-
a[r] =
|
|
5
|
+
for (const [r, o] of t)
|
|
6
|
+
a[r] = o;
|
|
7
7
|
return a;
|
|
8
8
|
}, We = {
|
|
9
9
|
name: "MyButton",
|
|
@@ -27,7 +27,7 @@ const q = (e, t) => {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
}, Ke = ["disabled"];
|
|
30
|
-
function Qe(e, t, a, r,
|
|
30
|
+
function Qe(e, t, a, r, o, p) {
|
|
31
31
|
return u(), h("button", {
|
|
32
32
|
class: ne(["my-button", [`my-button--${a.type}`, { "is-disabled": a.disabled }]]),
|
|
33
33
|
disabled: a.disabled,
|
|
@@ -36,11 +36,11 @@ function Qe(e, t, a, r, l, p) {
|
|
|
36
36
|
M(e.$slots, "default", {}, void 0, !0)
|
|
37
37
|
], 10, Ke);
|
|
38
38
|
}
|
|
39
|
-
const J = /* @__PURE__ */
|
|
39
|
+
const J = /* @__PURE__ */ N(We, [["render", Qe], ["__scopeId", "data-v-4480e77d"]]);
|
|
40
40
|
J.install = function(e) {
|
|
41
41
|
e.component(J.name, J);
|
|
42
42
|
};
|
|
43
|
-
const W = /* @__PURE__ */
|
|
43
|
+
const W = /* @__PURE__ */ w({
|
|
44
44
|
name: "JsxButton",
|
|
45
45
|
props: {
|
|
46
46
|
type: {
|
|
@@ -58,8 +58,8 @@ const W = /* @__PURE__ */ _({
|
|
|
58
58
|
emit: t,
|
|
59
59
|
slots: a
|
|
60
60
|
}) {
|
|
61
|
-
const r = (
|
|
62
|
-
e.disabled || t("click",
|
|
61
|
+
const r = (o) => {
|
|
62
|
+
e.disabled || t("click", o);
|
|
63
63
|
};
|
|
64
64
|
return () => Z("button", {
|
|
65
65
|
class: ["jsx-button", `jsx-button--${e.type}`, {
|
|
@@ -73,7 +73,7 @@ const W = /* @__PURE__ */ _({
|
|
|
73
73
|
W.install = function(e) {
|
|
74
74
|
e.component(W.name, W);
|
|
75
75
|
};
|
|
76
|
-
const Xe =
|
|
76
|
+
const Xe = w({
|
|
77
77
|
name: "ZxtPagination",
|
|
78
78
|
components: { ElPagination: He },
|
|
79
79
|
props: {
|
|
@@ -93,7 +93,7 @@ const Xe = _({
|
|
|
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), r = b(e.pageSize);
|
|
97
97
|
return te(
|
|
98
98
|
() => e.modelValue,
|
|
99
99
|
(n) => {
|
|
@@ -116,8 +116,8 @@ const Xe = _({
|
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
118
|
});
|
|
119
|
-
function Ye(e, t, a, r,
|
|
120
|
-
const n =
|
|
119
|
+
function Ye(e, t, a, r, o, p) {
|
|
120
|
+
const n = _("el-pagination");
|
|
121
121
|
return u(), k(n, {
|
|
122
122
|
"current-page": e.currentPage,
|
|
123
123
|
"onUpdate:currentPage": t[0] || (t[0] = (d) => e.currentPage = d),
|
|
@@ -131,29 +131,29 @@ function Ye(e, t, a, r, l, p) {
|
|
|
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 I = /* @__PURE__ */ N(Xe, [["render", Ye], ["__scopeId", "data-v-497aa44d"]]), K = {
|
|
135
135
|
default: ({ cellValue: e }) => e ?? "",
|
|
136
136
|
input: ({ cellValue: e, row: t, column: a, updateRow: r }) => x(Ue, {
|
|
137
137
|
modelValue: e,
|
|
138
138
|
size: "small",
|
|
139
|
-
onInput: (
|
|
139
|
+
onInput: (o) => r({ ...t, [a.property]: o })
|
|
140
140
|
}),
|
|
141
|
-
select: ({ cellValue: e, row: t, column: a, updateRow: r, options:
|
|
141
|
+
select: ({ cellValue: e, row: t, column: a, updateRow: r, options: o = [] }) => x(
|
|
142
142
|
Ne,
|
|
143
143
|
{
|
|
144
144
|
modelValue: e,
|
|
145
145
|
size: "small",
|
|
146
146
|
onChange: (p) => r({ ...t, [a.property]: p })
|
|
147
147
|
},
|
|
148
|
-
() =>
|
|
148
|
+
() => o.map(
|
|
149
149
|
(p) => x(qe, { label: p.label, value: p.value, key: p.value })
|
|
150
150
|
)
|
|
151
151
|
),
|
|
152
|
-
checkbox: ({ cellValue: e, row: t, column: a, updateRow: r }) => x(
|
|
152
|
+
checkbox: ({ cellValue: e, row: t, column: a, updateRow: r }) => x(Ie, {
|
|
153
153
|
modelValue: !!e,
|
|
154
|
-
onChange: (
|
|
154
|
+
onChange: (o) => r({ ...t, [a.property]: o })
|
|
155
155
|
}),
|
|
156
|
-
link: ({ cellValue: e, href: t, target: a = "_blank" }) => x(
|
|
156
|
+
link: ({ cellValue: e, href: t, target: a = "_blank" }) => x(xe, { href: t, target: a }, () => e)
|
|
157
157
|
};
|
|
158
158
|
function et(e, t) {
|
|
159
159
|
if (!e) return null;
|
|
@@ -164,20 +164,20 @@ function et(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: r = {}, attrs:
|
|
167
|
+
const { name: a, props: r = {}, attrs: o = {}, events: p = {}, content: n } = e;
|
|
168
168
|
return typeof a == "string" && K[a] ? K[a]({
|
|
169
169
|
...t,
|
|
170
170
|
...r,
|
|
171
|
-
...
|
|
171
|
+
...o,
|
|
172
172
|
...p
|
|
173
|
-
}) : typeof a == "object" || typeof a == "function" ? x(a, { ...r, ...
|
|
173
|
+
}) : typeof a == "object" || typeof a == "function" ? x(a, { ...r, ...o, ...p }, n) : (console.warn("[ZxtTable] cellRender 对象缺少有效的 name 字段"), t.cellValue ?? "");
|
|
174
174
|
}
|
|
175
175
|
return t.cellValue ?? "";
|
|
176
176
|
}
|
|
177
177
|
function tt(e, t) {
|
|
178
178
|
K[e] && console.warn(`[ZxtTable] 内置渲染器 ${e} 已被覆盖`), K[e] = t;
|
|
179
179
|
}
|
|
180
|
-
const at =
|
|
180
|
+
const at = w({
|
|
181
181
|
name: "ZxtTableColumn",
|
|
182
182
|
components: { ElTableColumn: Ge },
|
|
183
183
|
props: {
|
|
@@ -208,13 +208,13 @@ const at = _({
|
|
|
208
208
|
label: n.label ?? n.title
|
|
209
209
|
// 优先使用 label,兼容 title
|
|
210
210
|
};
|
|
211
|
-
}),
|
|
211
|
+
}), o = z(() => {
|
|
212
212
|
const { children: n, ...d } = r.value;
|
|
213
213
|
return d;
|
|
214
214
|
});
|
|
215
215
|
return {
|
|
216
216
|
normalizedColumn: r,
|
|
217
|
-
columnProps:
|
|
217
|
+
columnProps: o,
|
|
218
218
|
renderCell: (n) => {
|
|
219
219
|
const d = r.value, c = n.row[d.prop], g = c ?? d.defaultValue ?? "";
|
|
220
220
|
return et(d.cellRender, {
|
|
@@ -229,13 +229,13 @@ const at = _({
|
|
|
229
229
|
};
|
|
230
230
|
}
|
|
231
231
|
});
|
|
232
|
-
function nt(e, t, a, r,
|
|
233
|
-
const n =
|
|
232
|
+
function nt(e, t, a, r, o, p) {
|
|
233
|
+
const n = _("ZxtTableColumn", !0), d = _("el-table-column");
|
|
234
234
|
return e.normalizedColumn.children && e.normalizedColumn.children.length ? (u(), k(d, A({ key: 0 }, e.columnProps, {
|
|
235
235
|
key: e.normalizedColumn.prop + "-group"
|
|
236
236
|
}), {
|
|
237
237
|
default: C(() => [
|
|
238
|
-
(u(!0), h(
|
|
238
|
+
(u(!0), h(E, null, O(e.normalizedColumn.children, (c, g) => (u(), k(n, {
|
|
239
239
|
key: g,
|
|
240
240
|
column: c,
|
|
241
241
|
"current-page": e.currentPage,
|
|
@@ -243,8 +243,8 @@ function nt(e, t, a, r, l, p) {
|
|
|
243
243
|
}, Q({ _: 2 }, [
|
|
244
244
|
O(e.$slots, (f, i) => ({
|
|
245
245
|
name: i,
|
|
246
|
-
fn: C((
|
|
247
|
-
M(e.$slots, i, A({ ref_for: !0 },
|
|
246
|
+
fn: C((y) => [
|
|
247
|
+
M(e.$slots, i, A({ ref_for: !0 }, y))
|
|
248
248
|
])
|
|
249
249
|
}))
|
|
250
250
|
]), 1032, ["column", "current-page", "page-size"]))), 128))
|
|
@@ -262,14 +262,14 @@ function nt(e, t, a, r, l, p) {
|
|
|
262
262
|
row: c.row,
|
|
263
263
|
index: c.$index,
|
|
264
264
|
column: e.normalizedColumn
|
|
265
|
-
}) : e.normalizedColumn.cellRender ? (u(), k(
|
|
265
|
+
}) : e.normalizedColumn.cellRender ? (u(), k(ye(e.renderCell(c)), { key: 1 })) : e.normalizedColumn.formatter ? (u(), h(E, { key: 2 }, [
|
|
266
266
|
G(ae(e.normalizedColumn.formatter(
|
|
267
267
|
c.row,
|
|
268
268
|
e.normalizedColumn,
|
|
269
269
|
c.row[e.normalizedColumn.prop],
|
|
270
270
|
c.$index
|
|
271
271
|
)), 1)
|
|
272
|
-
], 64)) : (u(), h(
|
|
272
|
+
], 64)) : (u(), h(E, { key: 3 }, [
|
|
273
273
|
G(ae(c.row[e.normalizedColumn.prop]), 1)
|
|
274
274
|
], 64))
|
|
275
275
|
]),
|
|
@@ -277,10 +277,10 @@ function nt(e, t, a, r, l, p) {
|
|
|
277
277
|
}
|
|
278
278
|
]), 1040, ["index"]));
|
|
279
279
|
}
|
|
280
|
-
const rt = /* @__PURE__ */
|
|
280
|
+
const rt = /* @__PURE__ */ N(at, [["render", nt]]), ot = w({
|
|
281
281
|
name: "ZxtTable",
|
|
282
282
|
inheritAttrs: !1,
|
|
283
|
-
components: { ZxtPagination:
|
|
283
|
+
components: { ZxtPagination: I, ZxtTableColumn: rt, ElTable: Je },
|
|
284
284
|
props: {
|
|
285
285
|
// 表格唯一标识
|
|
286
286
|
id: { type: String, default: "" },
|
|
@@ -321,29 +321,29 @@ const rt = /* @__PURE__ */ q(at, [["render", nt]]), ot = _({
|
|
|
321
321
|
"update:row"
|
|
322
322
|
],
|
|
323
323
|
setup(e, { emit: t }) {
|
|
324
|
-
const a =
|
|
324
|
+
const a = b(null), r = b(e.pageSize), o = b(e.currentPage), p = b(!1), n = b([]), d = b(0), c = b({ prop: "", order: "" }), g = b({}), f = z(() => e.height === "full" ? { height: "100%" } : {}), i = z(() => {
|
|
325
325
|
if (e.height !== "full")
|
|
326
326
|
return e.height;
|
|
327
|
-
}),
|
|
328
|
-
() =>
|
|
327
|
+
}), y = z(() => !!e.proxyConfig), l = z(() => y.value ? d.value : e.total > 0 ? e.total : e.data.length), v = z(
|
|
328
|
+
() => y.value ? n.value : e.data
|
|
329
329
|
), D = (m) => {
|
|
330
|
-
|
|
330
|
+
y.value && (o.value = m.page, r.value = m.size, V()), t("size-change", m);
|
|
331
331
|
}, T = (m) => {
|
|
332
|
-
|
|
333
|
-
}, re = ({ prop: m, order:
|
|
334
|
-
c.value = { prop: m, order:
|
|
332
|
+
y.value && (o.value = m.page, r.value = m.size, V()), t("page-change", m);
|
|
333
|
+
}, re = ({ prop: m, order: R }) => {
|
|
334
|
+
c.value = { prop: m, order: R }, y.value && V(), t("sort-change", { prop: m, order: R });
|
|
335
335
|
}, oe = (m) => {
|
|
336
|
-
g.value = m || {},
|
|
337
|
-
},
|
|
338
|
-
if (!
|
|
339
|
-
const m = e.proxyConfig || {},
|
|
340
|
-
if (typeof
|
|
336
|
+
g.value = m || {}, y.value && V(), t("filter-change", g.value);
|
|
337
|
+
}, V = async () => {
|
|
338
|
+
if (!y.value) return;
|
|
339
|
+
const m = e.proxyConfig || {}, R = m.ajax?.query;
|
|
340
|
+
if (typeof R != "function") return;
|
|
341
341
|
const j = m.props || {}, ue = j.pageField || "page";
|
|
342
342
|
j.sizeField;
|
|
343
343
|
const de = j.sortField || "sort", ce = j.orderField || "order", pe = j.filtersField || "filters", ge = m.params || {}, L = {
|
|
344
344
|
// page 作为对象(类似 vxe-grid)
|
|
345
345
|
[ue]: {
|
|
346
|
-
currentPage:
|
|
346
|
+
currentPage: o.value,
|
|
347
347
|
pageSize: r.value
|
|
348
348
|
},
|
|
349
349
|
// form 数据(从 _formData 中获取)
|
|
@@ -353,39 +353,39 @@ const rt = /* @__PURE__ */ q(at, [["render", nt]]), ot = _({
|
|
|
353
353
|
};
|
|
354
354
|
c.value?.prop && (L[de] = c.value.prop, L[ce] = c.value.order), g.value && Object.keys(g.value).length && (L[pe] = g.value), p.value = !0;
|
|
355
355
|
try {
|
|
356
|
-
const
|
|
357
|
-
let
|
|
358
|
-
if (typeof
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
} else
|
|
362
|
-
n.value = Array.isArray(
|
|
356
|
+
const P = await R(L), q = m.response || {}, fe = q.listField || "list", me = q.totalField || "total", s = q.transform;
|
|
357
|
+
let $ = [], U = 0;
|
|
358
|
+
if (typeof s == "function") {
|
|
359
|
+
const H = s(P);
|
|
360
|
+
$ = H?.list ?? [], U = H?.total ?? 0;
|
|
361
|
+
} else P && typeof P == "object" && ($ = P?.[fe] ?? P?.data ?? [], U = P?.[me] ?? P?.total ?? 0);
|
|
362
|
+
n.value = Array.isArray($) ? $ : [], d.value = Number(U) || 0, t("loaded", {
|
|
363
363
|
data: n.value,
|
|
364
364
|
total: d.value,
|
|
365
365
|
payload: L
|
|
366
366
|
});
|
|
367
|
-
} catch (
|
|
368
|
-
t("load-error",
|
|
367
|
+
} catch (P) {
|
|
368
|
+
t("load-error", P);
|
|
369
369
|
} finally {
|
|
370
370
|
p.value = !1;
|
|
371
371
|
}
|
|
372
|
-
}, Y = (m,
|
|
373
|
-
|
|
372
|
+
}, Y = (m, R) => {
|
|
373
|
+
y.value ? n.value.splice(R, 1, m) : t("update:row", { index: R, row: m });
|
|
374
374
|
};
|
|
375
375
|
Te("updateRow", Y), Ze(() => {
|
|
376
|
-
|
|
376
|
+
y.value && V();
|
|
377
377
|
});
|
|
378
|
-
const le = () => a.value, se = () => a.value?.getSelectionRows?.() || [], ie = () =>
|
|
378
|
+
const le = () => a.value, se = () => a.value?.getSelectionRows?.() || [], ie = () => V();
|
|
379
379
|
return {
|
|
380
380
|
tableRef: a,
|
|
381
381
|
containerStyle: f,
|
|
382
382
|
tableHeight: i,
|
|
383
383
|
getTableRef: le,
|
|
384
384
|
pageSize: r,
|
|
385
|
-
currentPage:
|
|
385
|
+
currentPage: o,
|
|
386
386
|
loading: p,
|
|
387
387
|
renderData: v,
|
|
388
|
-
total:
|
|
388
|
+
total: l,
|
|
389
389
|
pageSizes: z(() => e.pageSizes),
|
|
390
390
|
paginationLayout: z(() => e.paginationLayout),
|
|
391
391
|
handleSizeChange: D,
|
|
@@ -398,8 +398,8 @@ const rt = /* @__PURE__ */ q(at, [["render", nt]]), ot = _({
|
|
|
398
398
|
};
|
|
399
399
|
}
|
|
400
400
|
});
|
|
401
|
-
function lt(e, t, a, r,
|
|
402
|
-
const n =
|
|
401
|
+
function lt(e, t, a, r, o, p) {
|
|
402
|
+
const n = _("ZxtTableColumn"), d = _("el-table"), c = _("ZxtPagination"), g = Me("loading");
|
|
403
403
|
return u(), h("div", {
|
|
404
404
|
class: ne(["zxt-table-container", { "zxt-table-container--full": e.height === "full" }]),
|
|
405
405
|
style: Ae(e.containerStyle)
|
|
@@ -414,16 +414,16 @@ function lt(e, t, a, r, l, p) {
|
|
|
414
414
|
onFilterChange: e.handleFilterChange
|
|
415
415
|
}), {
|
|
416
416
|
default: C(() => [
|
|
417
|
-
(u(!0), h(
|
|
417
|
+
(u(!0), h(E, null, O(e.columns, (f, i) => (u(), k(n, {
|
|
418
418
|
key: i,
|
|
419
419
|
column: f,
|
|
420
420
|
"current-page": e.currentPage,
|
|
421
421
|
"page-size": e.pageSize
|
|
422
422
|
}, Q({ _: 2 }, [
|
|
423
|
-
O(e.$slots, (
|
|
424
|
-
name:
|
|
423
|
+
O(e.$slots, (y, l) => ({
|
|
424
|
+
name: l,
|
|
425
425
|
fn: C((v) => [
|
|
426
|
-
M(e.$slots,
|
|
426
|
+
M(e.$slots, l, A({ ref_for: !0 }, v), void 0, !0)
|
|
427
427
|
])
|
|
428
428
|
}))
|
|
429
429
|
]), 1032, ["column", "current-page", "page-size"]))), 128))
|
|
@@ -445,7 +445,7 @@ function lt(e, t, a, r, l, p) {
|
|
|
445
445
|
}, null, 8, ["model-value", "page-size", "page-sizes", "total", "layout", "onPageChange", "onSizeChange"])) : X("", !0)
|
|
446
446
|
], 6);
|
|
447
447
|
}
|
|
448
|
-
const
|
|
448
|
+
const F = /* @__PURE__ */ N(ot, [["render", lt], ["__scopeId", "data-v-1c00db7c"]]), B = /* @__PURE__ */ new Map();
|
|
449
449
|
class st {
|
|
450
450
|
/**
|
|
451
451
|
* 注册自定义渲染器
|
|
@@ -460,7 +460,7 @@ class st {
|
|
|
460
460
|
* })
|
|
461
461
|
*/
|
|
462
462
|
add(t, a) {
|
|
463
|
-
return !t || typeof t != "string" ? (console.warn("[ZxtTable] 渲染器名称必须是字符串"), this) : !a || typeof a != "object" ? (console.warn("[ZxtTable] 渲染器配置必须是对象"), this) : (
|
|
463
|
+
return !t || typeof t != "string" ? (console.warn("[ZxtTable] 渲染器名称必须是字符串"), this) : !a || typeof a != "object" ? (console.warn("[ZxtTable] 渲染器配置必须是对象"), this) : (B.has(t) && console.warn(`[ZxtTable] 渲染器 "${t}" 已存在,将被覆盖`), B.set(t, a), this);
|
|
464
464
|
}
|
|
465
465
|
/**
|
|
466
466
|
* 获取渲染器
|
|
@@ -468,14 +468,14 @@ class st {
|
|
|
468
468
|
* @returns {Object|undefined}
|
|
469
469
|
*/
|
|
470
470
|
get(t) {
|
|
471
|
-
return
|
|
471
|
+
return B.get(t);
|
|
472
472
|
}
|
|
473
473
|
/**
|
|
474
474
|
* 删除渲染器
|
|
475
475
|
* @param {String} name - 渲染器名称
|
|
476
476
|
*/
|
|
477
477
|
delete(t) {
|
|
478
|
-
return
|
|
478
|
+
return B.delete(t);
|
|
479
479
|
}
|
|
480
480
|
/**
|
|
481
481
|
* 检查渲染器是否存在
|
|
@@ -483,30 +483,30 @@ class st {
|
|
|
483
483
|
* @returns {Boolean}
|
|
484
484
|
*/
|
|
485
485
|
has(t) {
|
|
486
|
-
return
|
|
486
|
+
return B.has(t);
|
|
487
487
|
}
|
|
488
488
|
/**
|
|
489
489
|
* 获取所有渲染器名称
|
|
490
490
|
* @returns {Array<String>}
|
|
491
491
|
*/
|
|
492
492
|
getAll() {
|
|
493
|
-
return Array.from(
|
|
493
|
+
return Array.from(B.keys());
|
|
494
494
|
}
|
|
495
495
|
/**
|
|
496
496
|
* 清空所有自定义渲染器
|
|
497
497
|
*/
|
|
498
498
|
clear() {
|
|
499
|
-
|
|
499
|
+
B.clear();
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
const
|
|
502
|
+
const be = new st();
|
|
503
503
|
function it(e, t, a = {}) {
|
|
504
504
|
if (!e || !e.itemRender)
|
|
505
505
|
return null;
|
|
506
506
|
const { name: r } = e.itemRender;
|
|
507
|
-
if (r &&
|
|
508
|
-
const
|
|
509
|
-
if (typeof
|
|
507
|
+
if (r && be.has(r)) {
|
|
508
|
+
const o = be.get(r);
|
|
509
|
+
if (typeof o.renderItemContent == "function") {
|
|
510
510
|
const p = {
|
|
511
511
|
data: t,
|
|
512
512
|
field: e.field || e.prop,
|
|
@@ -514,7 +514,7 @@ function it(e, t, a = {}) {
|
|
|
514
514
|
formData: t
|
|
515
515
|
};
|
|
516
516
|
try {
|
|
517
|
-
return
|
|
517
|
+
return o.renderItemContent(a, p);
|
|
518
518
|
} catch (n) {
|
|
519
519
|
return console.error(`[ZxtTable] 渲染器 "${r}" 执行出错:`, n), null;
|
|
520
520
|
}
|
|
@@ -522,12 +522,12 @@ function it(e, t, a = {}) {
|
|
|
522
522
|
}
|
|
523
523
|
return null;
|
|
524
524
|
}
|
|
525
|
-
|
|
526
|
-
e.component(
|
|
525
|
+
F.install = function(e) {
|
|
526
|
+
e.component(F.name, F);
|
|
527
527
|
};
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
var ut = /* @__PURE__ */
|
|
528
|
+
F.registerRenderer = tt;
|
|
529
|
+
F.renderer = be;
|
|
530
|
+
var ut = /* @__PURE__ */ w({
|
|
531
531
|
name: "Delete",
|
|
532
532
|
__name: "delete",
|
|
533
533
|
setup(e) {
|
|
@@ -541,7 +541,7 @@ var ut = /* @__PURE__ */ _({
|
|
|
541
541
|
})
|
|
542
542
|
]));
|
|
543
543
|
}
|
|
544
|
-
}),
|
|
544
|
+
}), _e = ut, dt = /* @__PURE__ */ w({
|
|
545
545
|
name: "Download",
|
|
546
546
|
__name: "download",
|
|
547
547
|
setup(e) {
|
|
@@ -555,7 +555,7 @@ var ut = /* @__PURE__ */ _({
|
|
|
555
555
|
})
|
|
556
556
|
]));
|
|
557
557
|
}
|
|
558
|
-
}), Se = dt, ct = /* @__PURE__ */
|
|
558
|
+
}), Se = dt, ct = /* @__PURE__ */ w({
|
|
559
559
|
name: "Edit",
|
|
560
560
|
__name: "edit",
|
|
561
561
|
setup(e) {
|
|
@@ -573,7 +573,7 @@ var ut = /* @__PURE__ */ _({
|
|
|
573
573
|
})
|
|
574
574
|
]));
|
|
575
575
|
}
|
|
576
|
-
}), ke = ct, pt = /* @__PURE__ */
|
|
576
|
+
}), ke = ct, pt = /* @__PURE__ */ w({
|
|
577
577
|
name: "Plus",
|
|
578
578
|
__name: "plus",
|
|
579
579
|
setup(e) {
|
|
@@ -587,7 +587,7 @@ var ut = /* @__PURE__ */ _({
|
|
|
587
587
|
})
|
|
588
588
|
]));
|
|
589
589
|
}
|
|
590
|
-
}), $e = pt, gt = /* @__PURE__ */
|
|
590
|
+
}), $e = pt, gt = /* @__PURE__ */ w({
|
|
591
591
|
name: "Refresh",
|
|
592
592
|
__name: "refresh",
|
|
593
593
|
setup(e) {
|
|
@@ -601,7 +601,7 @@ var ut = /* @__PURE__ */ _({
|
|
|
601
601
|
})
|
|
602
602
|
]));
|
|
603
603
|
}
|
|
604
|
-
}), he = gt, ft = /* @__PURE__ */
|
|
604
|
+
}), he = gt, ft = /* @__PURE__ */ w({
|
|
605
605
|
name: "Search",
|
|
606
606
|
__name: "search",
|
|
607
607
|
setup(e) {
|
|
@@ -615,7 +615,7 @@ var ut = /* @__PURE__ */ _({
|
|
|
615
615
|
})
|
|
616
616
|
]));
|
|
617
617
|
}
|
|
618
|
-
}), ve = ft, mt = /* @__PURE__ */
|
|
618
|
+
}), ve = ft, mt = /* @__PURE__ */ w({
|
|
619
619
|
name: "Setting",
|
|
620
620
|
__name: "setting",
|
|
621
621
|
setup(e) {
|
|
@@ -629,7 +629,7 @@ var ut = /* @__PURE__ */ _({
|
|
|
629
629
|
})
|
|
630
630
|
]));
|
|
631
631
|
}
|
|
632
|
-
}), Pe = mt, ht = /* @__PURE__ */
|
|
632
|
+
}), Pe = mt, ht = /* @__PURE__ */ w({
|
|
633
633
|
name: "Upload",
|
|
634
634
|
__name: "upload",
|
|
635
635
|
setup(e) {
|
|
@@ -643,7 +643,7 @@ var ut = /* @__PURE__ */ _({
|
|
|
643
643
|
})
|
|
644
644
|
]));
|
|
645
645
|
}
|
|
646
|
-
}), Re = ht, vt = /* @__PURE__ */
|
|
646
|
+
}), Re = ht, vt = /* @__PURE__ */ w({
|
|
647
647
|
name: "View",
|
|
648
648
|
__name: "view",
|
|
649
649
|
setup(e) {
|
|
@@ -658,7 +658,7 @@ var ut = /* @__PURE__ */ _({
|
|
|
658
658
|
]));
|
|
659
659
|
}
|
|
660
660
|
}), Fe = vt;
|
|
661
|
-
const
|
|
661
|
+
const yt = w({
|
|
662
662
|
name: "ZxtForm",
|
|
663
663
|
props: {
|
|
664
664
|
formColumns: { type: Array, default: () => [] },
|
|
@@ -667,7 +667,7 @@ const bt = _({
|
|
|
667
667
|
},
|
|
668
668
|
emits: ["submit", "reset"],
|
|
669
669
|
setup(e, { emit: t, expose: a }) {
|
|
670
|
-
const r =
|
|
670
|
+
const r = b(null), o = Le({}), p = {
|
|
671
671
|
input: "el-input",
|
|
672
672
|
select: "el-select",
|
|
673
673
|
date: "el-date-picker",
|
|
@@ -675,8 +675,8 @@ const bt = _({
|
|
|
675
675
|
datetime: "el-date-picker",
|
|
676
676
|
datetimerange: "el-date-picker",
|
|
677
677
|
cascader: "el-cascader"
|
|
678
|
-
}, n = (
|
|
679
|
-
const v =
|
|
678
|
+
}, n = (l) => p[l] || "el-input", d = (l) => {
|
|
679
|
+
const v = l.type || "input", D = [
|
|
680
680
|
"select",
|
|
681
681
|
"date",
|
|
682
682
|
"daterange",
|
|
@@ -684,8 +684,8 @@ const bt = _({
|
|
|
684
684
|
"datetimerange",
|
|
685
685
|
"cascader"
|
|
686
686
|
].includes(v), T = {
|
|
687
|
-
placeholder:
|
|
688
|
-
disabled:
|
|
687
|
+
placeholder: l.placeholder || `请${D ? "选择" : "输入"}${l.label}`,
|
|
688
|
+
disabled: l.disabled,
|
|
689
689
|
style: "width: 100%",
|
|
690
690
|
"popper-class": "zxt-form-popper"
|
|
691
691
|
};
|
|
@@ -696,18 +696,18 @@ const bt = _({
|
|
|
696
696
|
case "datetimerange":
|
|
697
697
|
return {
|
|
698
698
|
...T,
|
|
699
|
-
type:
|
|
700
|
-
startPlaceholder:
|
|
701
|
-
endPlaceholder:
|
|
702
|
-
format:
|
|
703
|
-
valueFormat:
|
|
699
|
+
type: l.dateType || v,
|
|
700
|
+
startPlaceholder: l.startPlaceholder || "开始日期",
|
|
701
|
+
endPlaceholder: l.endPlaceholder || "结束日期",
|
|
702
|
+
format: l.format,
|
|
703
|
+
valueFormat: l.valueFormat
|
|
704
704
|
};
|
|
705
705
|
case "cascader":
|
|
706
706
|
return {
|
|
707
707
|
...T,
|
|
708
|
-
options:
|
|
709
|
-
props:
|
|
710
|
-
clearable:
|
|
708
|
+
options: l.options,
|
|
709
|
+
props: l.cascaderProps,
|
|
710
|
+
clearable: l.clearable !== !1
|
|
711
711
|
};
|
|
712
712
|
case "select":
|
|
713
713
|
return T;
|
|
@@ -715,28 +715,28 @@ const bt = _({
|
|
|
715
715
|
default:
|
|
716
716
|
return T;
|
|
717
717
|
}
|
|
718
|
-
}, c = z(() => e.formColumns.map((
|
|
719
|
-
...
|
|
718
|
+
}, c = z(() => e.formColumns.map((l) => ({
|
|
719
|
+
...l,
|
|
720
720
|
colSpan: {
|
|
721
|
-
xs:
|
|
722
|
-
sm:
|
|
723
|
-
md:
|
|
724
|
-
lg:
|
|
725
|
-
xl:
|
|
721
|
+
xs: l.xs ?? l.span ?? 24,
|
|
722
|
+
sm: l.sm ?? l.span ?? 12,
|
|
723
|
+
md: l.md ?? l.span ?? 12,
|
|
724
|
+
lg: l.lg ?? l.span ?? 12,
|
|
725
|
+
xl: l.xl ?? l.span ?? 12
|
|
726
726
|
}
|
|
727
727
|
})));
|
|
728
728
|
te(
|
|
729
729
|
() => e.initialFormData,
|
|
730
|
-
(
|
|
731
|
-
Object.keys(
|
|
732
|
-
delete
|
|
733
|
-
}), Object.assign(
|
|
730
|
+
(l) => {
|
|
731
|
+
Object.keys(o).forEach((v) => {
|
|
732
|
+
delete o[v];
|
|
733
|
+
}), Object.assign(o, l);
|
|
734
734
|
},
|
|
735
735
|
{ immediate: !0, deep: !0 }
|
|
736
736
|
);
|
|
737
737
|
const g = z(() => {
|
|
738
|
-
const
|
|
739
|
-
return Object.keys(
|
|
738
|
+
const l = { ...e.rules };
|
|
739
|
+
return Object.keys(l).length === 0 && e.formColumns.length > 0 && e.formColumns.forEach((v) => {
|
|
740
740
|
if (v.required) {
|
|
741
741
|
const D = [
|
|
742
742
|
"select",
|
|
@@ -746,7 +746,7 @@ const bt = _({
|
|
|
746
746
|
"datetimerange",
|
|
747
747
|
"cascader"
|
|
748
748
|
].includes(v.type);
|
|
749
|
-
|
|
749
|
+
l[v.prop] = [
|
|
750
750
|
{
|
|
751
751
|
required: !0,
|
|
752
752
|
message: `请${D ? "选择" : "输入"}${v.label}`,
|
|
@@ -754,39 +754,39 @@ const bt = _({
|
|
|
754
754
|
}
|
|
755
755
|
];
|
|
756
756
|
}
|
|
757
|
-
}),
|
|
757
|
+
}), l;
|
|
758
758
|
}), f = () => {
|
|
759
|
-
r.value && r.value.validate((
|
|
760
|
-
|
|
759
|
+
r.value && r.value.validate((l) => {
|
|
760
|
+
l && t("submit", { ...o });
|
|
761
761
|
});
|
|
762
762
|
}, i = () => {
|
|
763
763
|
r.value && r.value.resetFields(), t("reset");
|
|
764
|
-
},
|
|
764
|
+
}, y = (l) => () => it(l, o, {}) || null;
|
|
765
765
|
return a({
|
|
766
766
|
validate: () => r.value ? r.value.validate() : Promise.resolve(!1),
|
|
767
767
|
resetFields: () => r.value && r.value.resetFields(),
|
|
768
|
-
getFormData: () => ({ ...
|
|
768
|
+
getFormData: () => ({ ...o }),
|
|
769
769
|
submitForm: f,
|
|
770
770
|
resetForm: i
|
|
771
771
|
}), {
|
|
772
772
|
formRef: r,
|
|
773
|
-
formData:
|
|
773
|
+
formData: o,
|
|
774
774
|
formRules: g,
|
|
775
775
|
submitForm: f,
|
|
776
776
|
resetForm: i,
|
|
777
777
|
processedColumns: c,
|
|
778
778
|
getComponentType: n,
|
|
779
779
|
getComponentProps: d,
|
|
780
|
-
renderCustomItem:
|
|
780
|
+
renderCustomItem: y
|
|
781
781
|
};
|
|
782
782
|
}
|
|
783
|
-
}),
|
|
783
|
+
}), bt = { class: "zxt-form-container" }, Ct = {
|
|
784
784
|
key: 0,
|
|
785
785
|
class: "form-label"
|
|
786
786
|
}, zt = { class: "form-control" };
|
|
787
|
-
function
|
|
788
|
-
const n =
|
|
789
|
-
return u(), h("div",
|
|
787
|
+
function wt(e, t, a, r, o, p) {
|
|
788
|
+
const n = _("el-option"), d = _("el-form-item"), c = _("el-col"), g = _("el-row"), f = _("el-form");
|
|
789
|
+
return u(), h("div", bt, [
|
|
790
790
|
Z(f, {
|
|
791
791
|
ref: "formRef",
|
|
792
792
|
model: e.formData,
|
|
@@ -797,7 +797,7 @@ function _t(e, t, a, r, l, p) {
|
|
|
797
797
|
default: C(() => [
|
|
798
798
|
Z(g, { gutter: 20 }, {
|
|
799
799
|
default: C(() => [
|
|
800
|
-
(u(!0), h(
|
|
800
|
+
(u(!0), h(E, null, O(e.processedColumns, (i, y) => (u(), k(c, A({ key: y }, { ref_for: !0 }, i.colSpan), {
|
|
801
801
|
default: C(() => [
|
|
802
802
|
Z(d, {
|
|
803
803
|
prop: i.prop,
|
|
@@ -815,16 +815,16 @@ function _t(e, t, a, r, l, p) {
|
|
|
815
815
|
key: 0,
|
|
816
816
|
formData: e.formData,
|
|
817
817
|
column: i
|
|
818
|
-
}, void 0, !0) : i.itemRender ? (u(), k(
|
|
818
|
+
}, void 0, !0) : i.itemRender ? (u(), k(ye(e.renderCustomItem(i)), { key: 1 })) : (u(), k(ye(e.getComponentType(i.type)), A({
|
|
819
819
|
key: 2,
|
|
820
820
|
modelValue: e.formData[i.prop],
|
|
821
|
-
"onUpdate:modelValue": (
|
|
821
|
+
"onUpdate:modelValue": (l) => e.formData[i.prop] = l
|
|
822
822
|
}, { ref_for: !0 }, e.getComponentProps(i), Be(i.events || {})), {
|
|
823
823
|
default: C(() => [
|
|
824
|
-
i.type === "select" ? (u(!0), h(
|
|
824
|
+
i.type === "select" ? (u(!0), h(E, { key: 0 }, O(i.options, (l, v) => (u(), k(n, {
|
|
825
825
|
key: v,
|
|
826
|
-
label:
|
|
827
|
-
value:
|
|
826
|
+
label: l.label,
|
|
827
|
+
value: l.value
|
|
828
828
|
}, null, 8, ["label", "value"]))), 128)) : X("", !0)
|
|
829
829
|
]),
|
|
830
830
|
_: 2
|
|
@@ -845,14 +845,14 @@ function _t(e, t, a, r, l, p) {
|
|
|
845
845
|
}, 8, ["model", "rules"])
|
|
846
846
|
]);
|
|
847
847
|
}
|
|
848
|
-
const Ce = /* @__PURE__ */
|
|
848
|
+
const Ce = /* @__PURE__ */ N(yt, [["render", wt], ["__scopeId", "data-v-9c337267"]]), _t = w({
|
|
849
849
|
name: "ZxtGrid",
|
|
850
850
|
inheritAttrs: !1,
|
|
851
851
|
components: {
|
|
852
|
-
ZxtTable:
|
|
852
|
+
ZxtTable: F,
|
|
853
853
|
ZxtForm: Ce,
|
|
854
854
|
Plus: $e,
|
|
855
|
-
Delete:
|
|
855
|
+
Delete: _e,
|
|
856
856
|
Refresh: he,
|
|
857
857
|
Download: Se,
|
|
858
858
|
Search: ve,
|
|
@@ -887,9 +887,9 @@ const Ce = /* @__PURE__ */ q(bt, [["render", _t], ["__scopeId", "data-v-9c337267
|
|
|
887
887
|
},
|
|
888
888
|
emits: ["toolbar-click", "submit", "reset", "page-change", "size-change"],
|
|
889
889
|
setup(e, { emit: t, expose: a }) {
|
|
890
|
-
const r = Ee(),
|
|
890
|
+
const r = Ee(), o = b(null), p = b(null), n = b(null), d = b(1), c = b(10), g = b([]), f = b(e.gridOptions.formMode || !0), i = {
|
|
891
891
|
Plus: $e,
|
|
892
|
-
Delete:
|
|
892
|
+
Delete: _e,
|
|
893
893
|
Refresh: he,
|
|
894
894
|
Download: Se,
|
|
895
895
|
Search: ve,
|
|
@@ -897,44 +897,44 @@ const Ce = /* @__PURE__ */ q(bt, [["render", _t], ["__scopeId", "data-v-9c337267
|
|
|
897
897
|
View: Fe,
|
|
898
898
|
Upload: Re,
|
|
899
899
|
Setting: Pe
|
|
900
|
-
},
|
|
900
|
+
}, y = z(() => {
|
|
901
901
|
const s = e.gridOptions.formConfig;
|
|
902
902
|
if (!s || !s.items) return [];
|
|
903
|
-
const
|
|
904
|
-
return
|
|
905
|
-
(
|
|
906
|
-
) ||
|
|
903
|
+
const $ = [...s.items];
|
|
904
|
+
return $.some(
|
|
905
|
+
(H) => H.type === "slot" && H.slotName === "search-actions"
|
|
906
|
+
) || $.push({
|
|
907
907
|
type: "slot",
|
|
908
908
|
slotName: "search-actions",
|
|
909
909
|
span: 6,
|
|
910
910
|
labelWidth: "0px",
|
|
911
911
|
isAction: !0,
|
|
912
912
|
...s.actionConfig
|
|
913
|
-
}),
|
|
914
|
-
}),
|
|
913
|
+
}), $;
|
|
914
|
+
}), l = () => {
|
|
915
915
|
n.value?.submitForm();
|
|
916
916
|
}, v = (s) => {
|
|
917
|
-
t("submit", s), e.gridOptions.proxyConfig && (e.gridOptions.proxyConfig._formData || (e.gridOptions.proxyConfig._formData = {}), Object.assign(e.gridOptions.proxyConfig._formData, s), d.value = 1,
|
|
917
|
+
t("submit", s), e.gridOptions.proxyConfig && (e.gridOptions.proxyConfig._formData || (e.gridOptions.proxyConfig._formData = {}), Object.assign(e.gridOptions.proxyConfig._formData, s), d.value = 1, o.value?.reload?.());
|
|
918
918
|
}, D = () => {
|
|
919
919
|
n.value?.resetForm();
|
|
920
920
|
}, T = () => {
|
|
921
|
-
t("reset"), e.gridOptions.proxyConfig && (e.gridOptions.proxyConfig._formData && (e.gridOptions.proxyConfig._formData = {}), d.value = 1,
|
|
921
|
+
t("reset"), e.gridOptions.proxyConfig && (e.gridOptions.proxyConfig._formData && (e.gridOptions.proxyConfig._formData = {}), d.value = 1, o.value?.reload?.());
|
|
922
922
|
}, re = (s) => {
|
|
923
923
|
if (s)
|
|
924
924
|
return typeof s == "object" || typeof s == "function" ? s : i[s];
|
|
925
925
|
}, oe = z(() => {
|
|
926
926
|
const {
|
|
927
927
|
formConfig: s,
|
|
928
|
-
toolbar:
|
|
929
|
-
formMode:
|
|
930
|
-
formColumns:
|
|
931
|
-
rules:
|
|
932
|
-
data:
|
|
928
|
+
toolbar: $,
|
|
929
|
+
formMode: U,
|
|
930
|
+
formColumns: H,
|
|
931
|
+
rules: Ot,
|
|
932
|
+
data: Dt,
|
|
933
933
|
...Oe
|
|
934
934
|
} = e.gridOptions;
|
|
935
935
|
return Oe;
|
|
936
|
-
}),
|
|
937
|
-
switch (t("toolbar-click", { code: s, button:
|
|
936
|
+
}), V = z(() => e.externalData.length > 0 ? e.externalData : e.gridOptions.data || []), Y = z(() => V.value.length), le = (s, $) => {
|
|
937
|
+
switch (t("toolbar-click", { code: s, button: $, grid: o.value }), s) {
|
|
938
938
|
case "add":
|
|
939
939
|
se();
|
|
940
940
|
break;
|
|
@@ -945,21 +945,21 @@ const Ce = /* @__PURE__ */ q(bt, [["render", _t], ["__scopeId", "data-v-9c337267
|
|
|
945
945
|
m();
|
|
946
946
|
break;
|
|
947
947
|
case "export":
|
|
948
|
-
|
|
948
|
+
R();
|
|
949
949
|
break;
|
|
950
950
|
}
|
|
951
951
|
}, se = () => {
|
|
952
952
|
f.value = !0;
|
|
953
953
|
}, ie = () => {
|
|
954
|
-
const s =
|
|
954
|
+
const s = o.value?.getTableRef()?.getSelectionRows?.() || [];
|
|
955
955
|
if (s.length === 0) {
|
|
956
956
|
ee.warning("请先选择要删除的数据");
|
|
957
957
|
return;
|
|
958
958
|
}
|
|
959
959
|
ee.success(`删除 ${s.length} 条数据`);
|
|
960
960
|
}, m = () => {
|
|
961
|
-
ee.success("刷新数据"),
|
|
962
|
-
},
|
|
961
|
+
ee.success("刷新数据"), o.value?.reload?.();
|
|
962
|
+
}, R = () => {
|
|
963
963
|
ee.success("导出数据");
|
|
964
964
|
}, j = (s) => {
|
|
965
965
|
t("submit", s);
|
|
@@ -971,10 +971,21 @@ const Ce = /* @__PURE__ */ q(bt, [["render", _t], ["__scopeId", "data-v-9c337267
|
|
|
971
971
|
d.value = s.page, t("page-change", s);
|
|
972
972
|
}, pe = (s) => {
|
|
973
973
|
c.value = s.size, t("size-change", s);
|
|
974
|
-
}, ge = () =>
|
|
974
|
+
}, ge = () => o.value, L = () => p.value, P = () => o.value?.getTableRef()?.getSelectionRows?.() || [], q = (s) => {
|
|
975
975
|
g.value = s;
|
|
976
976
|
}, fe = (s) => {
|
|
977
977
|
f.value = s;
|
|
978
|
+
}, me = (s, ...$) => {
|
|
979
|
+
switch (s) {
|
|
980
|
+
case "query":
|
|
981
|
+
d.value = 1, o.value?.reload?.();
|
|
982
|
+
break;
|
|
983
|
+
case "reload":
|
|
984
|
+
o.value?.reload?.();
|
|
985
|
+
break;
|
|
986
|
+
default:
|
|
987
|
+
console.warn(`[ZxtGrid] commitProxy: unknown type "${s}"`);
|
|
988
|
+
}
|
|
978
989
|
};
|
|
979
990
|
return te(
|
|
980
991
|
() => e.gridOptions.formMode,
|
|
@@ -984,21 +995,22 @@ const Ce = /* @__PURE__ */ q(bt, [["render", _t], ["__scopeId", "data-v-9c337267
|
|
|
984
995
|
), a({
|
|
985
996
|
getGridRef: ge,
|
|
986
997
|
getFormRef: L,
|
|
987
|
-
getSelectedRows:
|
|
988
|
-
reloadData:
|
|
989
|
-
setFormVisible: fe
|
|
998
|
+
getSelectedRows: P,
|
|
999
|
+
reloadData: q,
|
|
1000
|
+
setFormVisible: fe,
|
|
1001
|
+
commitProxy: me
|
|
990
1002
|
}), {
|
|
991
1003
|
attrs: r,
|
|
992
|
-
gridRef:
|
|
1004
|
+
gridRef: o,
|
|
993
1005
|
formRef: p,
|
|
994
1006
|
searchFormRef: n,
|
|
995
1007
|
currentPage: d,
|
|
996
1008
|
pageSize: c,
|
|
997
|
-
tableData:
|
|
1009
|
+
tableData: V,
|
|
998
1010
|
tableProps: oe,
|
|
999
1011
|
total: Y,
|
|
1000
1012
|
isFormVisible: f,
|
|
1001
|
-
searchFormColumns:
|
|
1013
|
+
searchFormColumns: y,
|
|
1002
1014
|
getIconComponent: re,
|
|
1003
1015
|
handleToolbarClick: le,
|
|
1004
1016
|
handleSubmit: j,
|
|
@@ -1006,7 +1018,7 @@ const Ce = /* @__PURE__ */ q(bt, [["render", _t], ["__scopeId", "data-v-9c337267
|
|
|
1006
1018
|
handleFormCancel: de,
|
|
1007
1019
|
handlePageChange: ce,
|
|
1008
1020
|
handleSizeChange: pe,
|
|
1009
|
-
handleSearch:
|
|
1021
|
+
handleSearch: l,
|
|
1010
1022
|
handleSearchSubmit: v,
|
|
1011
1023
|
handleReset: D,
|
|
1012
1024
|
handleSearchReset: T,
|
|
@@ -1021,8 +1033,8 @@ const Ce = /* @__PURE__ */ q(bt, [["render", _t], ["__scopeId", "data-v-9c337267
|
|
|
1021
1033
|
key: 0,
|
|
1022
1034
|
class: "grid-toolbar"
|
|
1023
1035
|
};
|
|
1024
|
-
function Rt(e, t, a, r,
|
|
1025
|
-
const n =
|
|
1036
|
+
function Rt(e, t, a, r, o, p) {
|
|
1037
|
+
const n = _("el-button"), d = _("ZxtForm"), c = _("ZxtTable");
|
|
1026
1038
|
return u(), h("div", {
|
|
1027
1039
|
class: ne(["zxt-grid-container", { "zxt-grid-container--full": e.gridOptions.height === "full" }])
|
|
1028
1040
|
}, [
|
|
@@ -1064,14 +1076,14 @@ function Rt(e, t, a, r, l, p) {
|
|
|
1064
1076
|
O(e.$slots, (g, f) => ({
|
|
1065
1077
|
name: f,
|
|
1066
1078
|
fn: C((i) => [
|
|
1067
|
-
M(e.$slots, f, ze(
|
|
1079
|
+
M(e.$slots, f, ze(we(i)), void 0, !0)
|
|
1068
1080
|
])
|
|
1069
1081
|
}))
|
|
1070
1082
|
]), 1032, ["form-columns", "initial-form-data", "rules", "onSubmit", "onReset"])
|
|
1071
1083
|
])) : X("", !0),
|
|
1072
1084
|
S("div", $t, [
|
|
1073
1085
|
e.gridOptions.toolbar ? (u(), h("div", Pt, [
|
|
1074
|
-
(u(!0), h(
|
|
1086
|
+
(u(!0), h(E, null, O(e.gridOptions.toolbar.buttons, (g, f) => (u(), k(n, {
|
|
1075
1087
|
key: f,
|
|
1076
1088
|
type: g.type || "default",
|
|
1077
1089
|
size: g.size || "small",
|
|
@@ -1105,46 +1117,46 @@ function Rt(e, t, a, r, l, p) {
|
|
|
1105
1117
|
O(e.$slots, (g, f) => ({
|
|
1106
1118
|
name: f,
|
|
1107
1119
|
fn: C((i) => [
|
|
1108
|
-
M(e.$slots, f, ze(
|
|
1120
|
+
M(e.$slots, f, ze(we(i)), void 0, !0)
|
|
1109
1121
|
])
|
|
1110
1122
|
}))
|
|
1111
1123
|
]), 1040, ["id", "columns", "data", "height", "pageable", "current-page", "page-size", "page-sizes", "total", "pagination-layout", "onPageChange", "onSizeChange"])
|
|
1112
1124
|
])
|
|
1113
1125
|
], 2);
|
|
1114
1126
|
}
|
|
1115
|
-
const Ve = /* @__PURE__ */
|
|
1116
|
-
|
|
1117
|
-
e.component(
|
|
1127
|
+
const Ve = /* @__PURE__ */ N(_t, [["render", Rt], ["__scopeId", "data-v-ca0e4fa5"]]);
|
|
1128
|
+
I.install = function(e) {
|
|
1129
|
+
e.component(I.name, I);
|
|
1118
1130
|
};
|
|
1119
1131
|
const Ft = [
|
|
1120
1132
|
J,
|
|
1121
1133
|
W,
|
|
1122
|
-
|
|
1134
|
+
F,
|
|
1123
1135
|
Ve,
|
|
1124
1136
|
Ce,
|
|
1125
|
-
|
|
1137
|
+
I
|
|
1126
1138
|
], Vt = (e) => {
|
|
1127
1139
|
Ft.forEach((t) => {
|
|
1128
1140
|
e.component(t.name, t);
|
|
1129
1141
|
});
|
|
1130
|
-
},
|
|
1142
|
+
}, Mt = {
|
|
1131
1143
|
install: Vt,
|
|
1132
1144
|
MyButton: J,
|
|
1133
1145
|
JsxButton: W,
|
|
1134
|
-
ZxtTable:
|
|
1146
|
+
ZxtTable: F,
|
|
1135
1147
|
ZxtGrid: Ve,
|
|
1136
1148
|
ZxtForm: Ce,
|
|
1137
|
-
ZxtPagination:
|
|
1149
|
+
ZxtPagination: I,
|
|
1138
1150
|
// 暴露渲染器 API
|
|
1139
|
-
renderer:
|
|
1140
|
-
registerRenderer:
|
|
1151
|
+
renderer: F.renderer,
|
|
1152
|
+
registerRenderer: F.registerRenderer
|
|
1141
1153
|
};
|
|
1142
1154
|
export {
|
|
1143
1155
|
W as JsxButton,
|
|
1144
1156
|
J as MyButton,
|
|
1145
1157
|
Ce as ZxtForm,
|
|
1146
1158
|
Ve as ZxtGrid,
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1159
|
+
I as ZxtPagination,
|
|
1160
|
+
F as ZxtTable,
|
|
1161
|
+
Mt as default
|
|
1150
1162
|
};
|
package/dist/zxt-table.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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,b){"use strict";const T=(t,n)=>{const a=t.__vccOpts||t;for(const[r,s]of n)a[r]=s;return a},de={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:r=>{n("click",r)}}}},ce=["disabled"];function pe(t,n,a,r,s,m){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]=(...o)=>r.handleClick&&r.handleClick(...o))},[e.renderSlot(t.$slots,"default",{},void 0,!0)],10,ce)}const D=T(de,[["render",pe],["__scopeId","data-v-4480e77d"]]);D.install=function(t){t.component(D.name,D)};const N=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 r=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:r},[a.default?.()])}});N.install=function(t){t.component(N.name,N)};const me=e.defineComponent({name:"ZxtPagination",components:{ElPagination:b.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),r=e.ref(t.pageSize);return e.watch(()=>t.modelValue,o=>{a.value=o}),e.watch(()=>t.pageSize,o=>{r.value=o}),{currentPage:a,pageSize:r,handleSizeChange:o=>{r.value=o,a.value=1,n("update:pageSize",o),n("size-change",{page:a.value,size:o})},handleCurrentChange:o=>{a.value=o,n("update:modelValue",o),n("page-change",{page:o,size:r.value})}}}});function fe(t,n,a,r,s,m){const o=e.resolveComponent("el-pagination");return e.openBlock(),e.createBlock(o,{"current-page":t.currentPage,"onUpdate:currentPage":n[0]||(n[0]=c=>t.currentPage=c),"page-size":t.pageSize,"onUpdate:pageSize":n[1]||(n[1]=c=>t.pageSize=c),"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 $=T(me,[["render",fe],["__scopeId","data-v-497aa44d"]]),x={default:({cellValue:t})=>t??"",input:({cellValue:t,row:n,column:a,updateRow:r})=>e.h(b.ElInput,{modelValue:t,size:"small",onInput:s=>r({...n,[a.property]:s})}),select:({cellValue:t,row:n,column:a,updateRow:r,options:s=[]})=>e.h(b.ElSelect,{modelValue:t,size:"small",onChange:m=>r({...n,[a.property]:m})},()=>s.map(m=>e.h(b.ElOption,{label:m.label,value:m.value,key:m.value}))),checkbox:({cellValue:t,row:n,column:a,updateRow:r})=>e.h(b.ElCheckbox,{modelValue:!!t,onChange:s=>r({...n,[a.property]:s})}),link:({cellValue:t,href:n,target:a="_blank"})=>e.h(b.ElLink,{href:n,target:a},()=>t)};function ge(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:r={},attrs:s={},events:m={},content:o}=t;return typeof a=="string"&&x[a]?x[a]({...n,...r,...s,...m}):typeof a=="object"||typeof a=="function"?e.h(a,{...r,...s,...m},o):(console.warn("[ZxtTable] cellRender 对象缺少有效的 name 字段"),n.cellValue??"")}return n.cellValue??""}function ue(t,n){x[t]&&console.warn(`[ZxtTable] 内置渲染器 ${t} 已被覆盖`),x[t]=n}const he=e.defineComponent({name:"ZxtTableColumn",components:{ElTableColumn:b.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=o=>{const{currentPage:c,pageSize:p}=t;return(c-1)*p+o+1},r=e.computed(()=>{const o=t.column;return{...o,prop:o.prop??o.field,label:o.label??o.title}}),s=e.computed(()=>{const{children:o,...c}=r.value;return c});return{normalizedColumn:r,columnProps:s,renderCell:o=>{const c=r.value,p=o.row[c.prop],f=p??c.defaultValue??"";return ge(c.cellRender,{row:o.row,column:c,rowIndex:o.$index,cellValue:f,updateRow:g=>n(g,o.$index)})},defaultIndexMethod:a}}});function Ce(t,n,a,r,s,m){const o=e.resolveComponent("ZxtTableColumn",!0),c=e.resolveComponent("el-table-column");return t.normalizedColumn.children&&t.normalizedColumn.children.length?(e.openBlock(),e.createBlock(c,e.mergeProps({key:0},t.columnProps,{key:t.normalizedColumn.prop+"-group"}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.normalizedColumn.children,(p,f)=>(e.openBlock(),e.createBlock(o,{key:f,column:p,"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(c,e.mergeProps({key:1},t.columnProps,{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(p=>[t.normalizedColumn.slot?e.renderSlot(t.$slots,t.normalizedColumn.slot,{key:0,row:p.row,index:p.$index,column:t.normalizedColumn}):t.normalizedColumn.cellRender?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.renderCell(p)),{key:1})):t.normalizedColumn.formatter?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(t.normalizedColumn.formatter(p.row,t.normalizedColumn,p.row[t.normalizedColumn.prop],p.$index)),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createTextVNode(e.toDisplayString(p.row[t.normalizedColumn.prop]),1)],64))]),key:"0"}]),1040,["index"]))}const ye=T(he,[["render",Ce]]),be=e.defineComponent({name:"ZxtTable",inheritAttrs:!1,components:{ZxtPagination:$,ZxtTableColumn:ye,ElTable:b.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),r=e.ref(t.pageSize),s=e.ref(t.currentPage),m=e.ref(!1),o=e.ref([]),c=e.ref(0),p=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?c.value:t.total>0?t.total:t.data.length),h=e.computed(()=>C.value?o.value:t.data),B=u=>{C.value&&(s.value=u.page,r.value=u.size,S()),n("size-change",u)},V=u=>{C.value&&(s.value=u.page,r.value=u.size,S()),n("page-change",u)},q=({prop:u,order:w})=>{p.value={prop:u,order:w},C.value&&S(),n("sort-change",{prop:u,order:w})},U=u=>{f.value=u||{},C.value&&S(),n("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||{},K=P.pageField||"page";P.sizeField;const Q=P.sortField||"sort",X=P.orderField||"order",Y=P.filtersField||"filters",v=u.params||{},F={[K]:{currentPage:s.value,pageSize:r.value},form:u._formData||{},...v};p.value?.prop&&(F[Q]=p.value.prop,F[X]=p.value.order),f.value&&Object.keys(f.value).length&&(F[Y]=f.value),m.value=!0;try{const z=await w(F),M=u.response||{},ee=M.listField||"list",i=M.totalField||"total",_=M.transform;let O=[],R=0;if(typeof _=="function"){const te=_(z);O=te?.list??[],R=te?.total??0}else z&&typeof z=="object"&&(O=z?.[ee]??z?.data??[],R=z?.[i]??z?.total??0);o.value=Array.isArray(O)?O:[],c.value=Number(R)||0,n("loaded",{data:o.value,total:c.value,payload:F})}catch(z){n("load-error",z)}finally{m.value=!1}},L=(u,w)=>{C.value?o.value.splice(w,1,u):n("update:row",{index:w,row:u})};e.provide("updateRow",L),e.onMounted(()=>{C.value&&S()});const G=()=>a.value,J=()=>a.value?.getSelectionRows?.()||[],W=()=>S();return{tableRef:a,containerStyle:g,tableHeight:d,getTableRef:G,pageSize:r,currentPage:s,loading:m,renderData:h,total:l,pageSizes:e.computed(()=>t.pageSizes),paginationLayout:e.computed(()=>t.paginationLayout),handleSizeChange:B,handlePageChange:V,handleSortChange:q,handleFilterChange:U,reload:W,getSelectedRows:J,updateRow:L}}});function ke(t,n,a,r,s,m){const o=e.resolveComponent("ZxtTableColumn"),c=e.resolveComponent("el-table"),p=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(c,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(o,{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(p,{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 k=T(be,[["render",ke],["__scopeId","data-v-1c00db7c"]]),E=new Map;class ze{add(n,a){return!n||typeof n!="string"?(console.warn("[ZxtTable] 渲染器名称必须是字符串"),this):!a||typeof a!="object"?(console.warn("[ZxtTable] 渲染器配置必须是对象"),this):(E.has(n)&&console.warn(`[ZxtTable] 渲染器 "${n}" 已存在,将被覆盖`),E.set(n,a),this)}get(n){return E.get(n)}delete(n){return E.delete(n)}has(n){return E.has(n)}getAll(){return Array.from(E.keys())}clear(){E.clear()}}const j=new ze;function we(t,n,a={}){if(!t||!t.itemRender)return null;const{name:r}=t.itemRender;if(r&&j.has(r)){const s=j.get(r);if(typeof s.renderItemContent=="function"){const m={data:n,field:t.field||t.prop,item:t,formData:n};try{return s.renderItemContent(a,m)}catch(o){return console.error(`[ZxtTable] 渲染器 "${r}" 执行出错:`,o),null}}}return null}k.install=function(t){t.component(k.name,k)},k.registerRenderer=ue,k.renderer=j;var Se=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"})]))}}),ne=Se,_e=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"})]))}}),ae=_e,Be=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"})]))}}),oe=Be,Ve=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"})]))}}),re=Ve,$e=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"})]))}}),A=$e,Ee=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"})]))}}),H=Ee,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"})]))}}),le=Pe,Fe=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"})]))}}),se=Fe,Re=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"})]))}}),ie=Re;const Te=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 r=e.ref(null),s=e.reactive({}),m={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"},o=l=>m[l]||"el-input",c=l=>{const h=l.type||"input",B=["select","date","daterange","datetime","datetimerange","cascader"].includes(h),V={placeholder:l.placeholder||`请${B?"选择":"输入"}${l.label}`,disabled:l.disabled,style:"width: 100%","popper-class":"zxt-form-popper"};switch(h){case"date":case"daterange":case"datetime":case"datetimerange":return{...V,type:l.dateType||h,startPlaceholder:l.startPlaceholder||"开始日期",endPlaceholder:l.endPlaceholder||"结束日期",format:l.format,valueFormat:l.valueFormat};case"cascader":return{...V,options:l.options,props:l.cascaderProps,clearable:l.clearable!==!1};case"select":return V;case"input":default:return V}},p=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 B=["select","date","daterange","datetime","datetimerange","cascader"].includes(h.type);l[h.prop]=[{required:!0,message:`请${B?"选择":"输入"}${h.label}`,trigger:B?"change":"blur"}]}}),l}),g=()=>{r.value&&r.value.validate(l=>{l&&n("submit",{...s})})},d=()=>{r.value&&r.value.resetFields(),n("reset")},C=l=>()=>we(l,s,{})||null;return a({validate:()=>r.value?r.value.validate():Promise.resolve(!1),resetFields:()=>r.value&&r.value.resetFields(),getFormData:()=>({...s}),submitForm:g,resetForm:d}),{formRef:r,formData:s,formRules:f,submitForm:g,resetForm:d,processedColumns:p,getComponentType:o,getComponentProps:c,renderCustomItem:C}}}),De={class:"zxt-form-container"},Ne={key:0,class:"form-label"},Oe={class:"form-control"};function xe(t,n,a,r,s,m){const o=e.resolveComponent("el-option"),c=e.resolveComponent("el-form-item"),p=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(p,e.mergeProps({key:C},{ref_for:!0},d.colSpan),{default:e.withCtx(()=>[e.createVNode(c,{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",Ne,e.toDisplayString(d.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Oe,[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(o,{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 Z=T(Te,[["render",xe],["__scopeId","data-v-9c337267"]]),Me=e.defineComponent({name:"ZxtGrid",inheritAttrs:!1,components:{ZxtTable:k,ZxtForm:Z,Plus:re,Delete:ne,Refresh:A,Download:ae,Search:H,Edit:oe,View:ie,Upload:se,Setting:le},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 r=e.useAttrs(),s=e.ref(null),m=e.ref(null),o=e.ref(null),c=e.ref(1),p=e.ref(10),f=e.ref([]),g=e.ref(t.gridOptions.formMode||!0),d={Plus:re,Delete:ne,Refresh:A,Download:ae,Search:H,Edit:oe,View:ie,Upload:se,Setting:le},C=e.computed(()=>{const i=t.gridOptions.formConfig;if(!i||!i.items)return[];const _=[...i.items];return _.some(R=>R.type==="slot"&&R.slotName==="search-actions")||_.push({type:"slot",slotName:"search-actions",span:6,labelWidth:"0px",isAction:!0,...i.actionConfig}),_}),l=()=>{o.value?.submitForm()},h=i=>{n("submit",i),t.gridOptions.proxyConfig&&(t.gridOptions.proxyConfig._formData||(t.gridOptions.proxyConfig._formData={}),Object.assign(t.gridOptions.proxyConfig._formData,i),c.value=1,s.value?.reload?.())},B=()=>{o.value?.resetForm()},V=()=>{n("reset"),t.gridOptions.proxyConfig&&(t.gridOptions.proxyConfig._formData&&(t.gridOptions.proxyConfig._formData={}),c.value=1,s.value?.reload?.())},q=i=>{if(i)return typeof i=="object"||typeof i=="function"?i:d[i]},U=e.computed(()=>{const{formConfig:i,toolbar:_,formMode:O,formColumns:R,rules:te,data:Je,...Ue}=t.gridOptions;return Ue}),S=e.computed(()=>t.externalData.length>0?t.externalData:t.gridOptions.data||[]),L=e.computed(()=>S.value.length),G=(i,_)=>{switch(n("toolbar-click",{code:i,button:_,grid:s.value}),i){case"add":J();break;case"delete":W();break;case"refresh":u();break;case"export":w();break}},J=()=>{g.value=!0},W=()=>{const i=s.value?.getTableRef()?.getSelectionRows?.()||[];if(i.length===0){b.ElMessage.warning("请先选择要删除的数据");return}b.ElMessage.success(`删除 ${i.length} 条数据`)},u=()=>{b.ElMessage.success("刷新数据"),s.value?.reload?.()},w=()=>{b.ElMessage.success("导出数据")},P=i=>{n("submit",i)},K=()=>{n("reset")},Q=()=>{g.value=!1},X=i=>{c.value=i.page,n("page-change",i)},Y=i=>{p.value=i.size,n("size-change",i)},v=()=>s.value,F=()=>m.value,z=()=>s.value?.getTableRef()?.getSelectionRows?.()||[],M=i=>{f.value=i},ee=i=>{g.value=i};return e.watch(()=>t.gridOptions.formMode,i=>{i!==void 0&&(g.value=i)}),a({getGridRef:v,getFormRef:F,getSelectedRows:z,reloadData:M,setFormVisible:ee}),{attrs:r,gridRef:s,formRef:m,searchFormRef:o,currentPage:c,pageSize:p,tableData:S,tableProps:U,total:L,isFormVisible:g,searchFormColumns:C,getIconComponent:q,handleToolbarClick:G,handleSubmit:P,handleFormReset:K,handleFormCancel:Q,handlePageChange:X,handleSizeChange:Y,handleSearch:l,handleSearchSubmit:h,handleReset:B,handleSearchReset:V,Search:H,Refresh:A}}}),Ze={key:0,class:"grid-search-form"},Le={class:"search-btn-group"},je={class:"grid-table-wrapper"},Ae={key:0,class:"grid-toolbar"};function He(t,n,a,r,s,m){const o=e.resolveComponent("el-button"),c=e.resolveComponent("ZxtForm"),p=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",Ze,[e.createVNode(c,{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",Le,[e.createVNode(o,{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(o,{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(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",Ae,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.gridOptions.toolbar.buttons,(f,g)=>(e.openBlock(),e.createBlock(o,{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(p,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 I=T(Me,[["render",He],["__scopeId","data-v-51570bb9"]]);$.install=function(t){t.component($.name,$)};const Ie=[D,N,k,I,Z,$],qe={install:t=>{Ie.forEach(n=>{t.component(n.name,n)})},MyButton:D,JsxButton:N,ZxtTable:k,ZxtGrid:I,ZxtForm:Z,ZxtPagination:$,renderer:k.renderer,registerRenderer:k.registerRenderer};y.JsxButton=N,y.MyButton=D,y.ZxtForm=Z,y.ZxtGrid=I,y.ZxtPagination=$,y.ZxtTable=k,y.default=qe,Object.defineProperties(y,{__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,b){"use strict";const R=(t,a)=>{const n=t.__vccOpts||t;for(const[r,l]of a)n[r]=l;return n},de={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:r=>{a("click",r)}}}},ce=["disabled"];function pe(t,a,n,r,l,m){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]=(...o)=>r.handleClick&&r.handleClick(...o))},[e.renderSlot(t.$slots,"default",{},void 0,!0)],10,ce)}const T=R(de,[["render",pe],["__scopeId","data-v-4480e77d"]]);T.install=function(t){t.component(T.name,T)};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 r=l=>{t.disabled||a("click",l)};return()=>e.createVNode("button",{class:["jsx-button",`jsx-button--${t.type}`,{"is-disabled":t.disabled}],disabled:t.disabled,onClick:r},[n.default?.()])}});D.install=function(t){t.component(D.name,D)};const me=e.defineComponent({name:"ZxtPagination",components:{ElPagination:b.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),r=e.ref(t.pageSize);return e.watch(()=>t.modelValue,o=>{n.value=o}),e.watch(()=>t.pageSize,o=>{r.value=o}),{currentPage:n,pageSize:r,handleSizeChange:o=>{r.value=o,n.value=1,a("update:pageSize",o),a("size-change",{page:n.value,size:o})},handleCurrentChange:o=>{n.value=o,a("update:modelValue",o),a("page-change",{page:o,size:r.value})}}}});function fe(t,a,n,r,l,m){const o=e.resolveComponent("el-pagination");return e.openBlock(),e.createBlock(o,{"current-page":t.currentPage,"onUpdate:currentPage":a[0]||(a[0]=c=>t.currentPage=c),"page-size":t.pageSize,"onUpdate:pageSize":a[1]||(a[1]=c=>t.pageSize=c),"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 $=R(me,[["render",fe],["__scopeId","data-v-497aa44d"]]),O={default:({cellValue:t})=>t??"",input:({cellValue:t,row:a,column:n,updateRow:r})=>e.h(b.ElInput,{modelValue:t,size:"small",onInput:l=>r({...a,[n.property]:l})}),select:({cellValue:t,row:a,column:n,updateRow:r,options:l=[]})=>e.h(b.ElSelect,{modelValue:t,size:"small",onChange:m=>r({...a,[n.property]:m})},()=>l.map(m=>e.h(b.ElOption,{label:m.label,value:m.value,key:m.value}))),checkbox:({cellValue:t,row:a,column:n,updateRow:r})=>e.h(b.ElCheckbox,{modelValue:!!t,onChange:l=>r({...a,[n.property]:l})}),link:({cellValue:t,href:a,target:n="_blank"})=>e.h(b.ElLink,{href:a,target:n},()=>t)};function ge(t,a){if(!t)return null;if(typeof t=="string"){const n=O[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:r={},attrs:l={},events:m={},content:o}=t;return typeof n=="string"&&O[n]?O[n]({...a,...r,...l,...m}):typeof n=="object"||typeof n=="function"?e.h(n,{...r,...l,...m},o):(console.warn("[ZxtTable] cellRender 对象缺少有效的 name 字段"),a.cellValue??"")}return a.cellValue??""}function ue(t,a){O[t]&&console.warn(`[ZxtTable] 内置渲染器 ${t} 已被覆盖`),O[t]=a}const he=e.defineComponent({name:"ZxtTableColumn",components:{ElTableColumn:b.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=o=>{const{currentPage:c,pageSize:p}=t;return(c-1)*p+o+1},r=e.computed(()=>{const o=t.column;return{...o,prop:o.prop??o.field,label:o.label??o.title}}),l=e.computed(()=>{const{children:o,...c}=r.value;return c});return{normalizedColumn:r,columnProps:l,renderCell:o=>{const c=r.value,p=o.row[c.prop],f=p??c.defaultValue??"";return ge(c.cellRender,{row:o.row,column:c,rowIndex:o.$index,cellValue:f,updateRow:g=>a(g,o.$index)})},defaultIndexMethod:n}}});function Ce(t,a,n,r,l,m){const o=e.resolveComponent("ZxtTableColumn",!0),c=e.resolveComponent("el-table-column");return t.normalizedColumn.children&&t.normalizedColumn.children.length?(e.openBlock(),e.createBlock(c,e.mergeProps({key:0},t.columnProps,{key:t.normalizedColumn.prop+"-group"}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.normalizedColumn.children,(p,f)=>(e.openBlock(),e.createBlock(o,{key:f,column:p,"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(c,e.mergeProps({key:1},t.columnProps,{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(p=>[t.normalizedColumn.slot?e.renderSlot(t.$slots,t.normalizedColumn.slot,{key:0,row:p.row,index:p.$index,column:t.normalizedColumn}):t.normalizedColumn.cellRender?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.renderCell(p)),{key:1})):t.normalizedColumn.formatter?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(t.normalizedColumn.formatter(p.row,t.normalizedColumn,p.row[t.normalizedColumn.prop],p.$index)),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createTextVNode(e.toDisplayString(p.row[t.normalizedColumn.prop]),1)],64))]),key:"0"}]),1040,["index"]))}const ye=R(he,[["render",Ce]]),be=e.defineComponent({name:"ZxtTable",inheritAttrs:!1,components:{ZxtPagination:$,ZxtTableColumn:ye,ElTable:b.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),r=e.ref(t.pageSize),l=e.ref(t.currentPage),m=e.ref(!1),o=e.ref([]),c=e.ref(0),p=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),s=e.computed(()=>C.value?c.value:t.total>0?t.total:t.data.length),h=e.computed(()=>C.value?o.value:t.data),B=u=>{C.value&&(l.value=u.page,r.value=u.size,_()),a("size-change",u)},V=u=>{C.value&&(l.value=u.page,r.value=u.size,_()),a("page-change",u)},q=({prop:u,order:S})=>{p.value={prop:u,order:S},C.value&&_(),a("sort-change",{prop:u,order:S})},U=u=>{f.value=u||{},C.value&&_(),a("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||{},K=P.pageField||"page";P.sizeField;const Q=P.sortField||"sort",X=P.orderField||"order",Y=P.filtersField||"filters",v=u.params||{},F={[K]:{currentPage:l.value,pageSize:r.value},form:u._formData||{},...v};p.value?.prop&&(F[Q]=p.value.prop,F[X]=p.value.order),f.value&&Object.keys(f.value).length&&(F[Y]=f.value),m.value=!0;try{const w=await S(F),x=u.response||{},ee=x.listField||"list",te=x.totalField||"total",i=x.transform;let k=[],Z=0;if(typeof i=="function"){const N=i(w);k=N?.list??[],Z=N?.total??0}else w&&typeof w=="object"&&(k=w?.[ee]??w?.data??[],Z=w?.[te]??w?.total??0);o.value=Array.isArray(k)?k:[],c.value=Number(Z)||0,a("loaded",{data:o.value,total:c.value,payload:F})}catch(w){a("load-error",w)}finally{m.value=!1}},L=(u,S)=>{C.value?o.value.splice(S,1,u):a("update:row",{index:S,row:u})};e.provide("updateRow",L),e.onMounted(()=>{C.value&&_()});const G=()=>n.value,J=()=>n.value?.getSelectionRows?.()||[],W=()=>_();return{tableRef:n,containerStyle:g,tableHeight:d,getTableRef:G,pageSize:r,currentPage:l,loading:m,renderData:h,total:s,pageSizes:e.computed(()=>t.pageSizes),paginationLayout:e.computed(()=>t.paginationLayout),handleSizeChange:B,handlePageChange:V,handleSortChange:q,handleFilterChange:U,reload:W,getSelectedRows:J,updateRow:L}}});function ke(t,a,n,r,l,m){const o=e.resolveComponent("ZxtTableColumn"),c=e.resolveComponent("el-table"),p=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(c,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(o,{key:d,column:g,"current-page":t.currentPage,"page-size":t.pageSize},e.createSlots({_:2},[e.renderList(t.$slots,(C,s)=>({name:s,fn:e.withCtx(h=>[e.renderSlot(t.$slots,s,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(p,{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 z=R(be,[["render",ke],["__scopeId","data-v-1c00db7c"]]),E=new Map;class ze{add(a,n){return!a||typeof a!="string"?(console.warn("[ZxtTable] 渲染器名称必须是字符串"),this):!n||typeof n!="object"?(console.warn("[ZxtTable] 渲染器配置必须是对象"),this):(E.has(a)&&console.warn(`[ZxtTable] 渲染器 "${a}" 已存在,将被覆盖`),E.set(a,n),this)}get(a){return E.get(a)}delete(a){return E.delete(a)}has(a){return E.has(a)}getAll(){return Array.from(E.keys())}clear(){E.clear()}}const j=new ze;function we(t,a,n={}){if(!t||!t.itemRender)return null;const{name:r}=t.itemRender;if(r&&j.has(r)){const l=j.get(r);if(typeof l.renderItemContent=="function"){const m={data:a,field:t.field||t.prop,item:t,formData:a};try{return l.renderItemContent(n,m)}catch(o){return console.error(`[ZxtTable] 渲染器 "${r}" 执行出错:`,o),null}}}return null}z.install=function(t){t.component(z.name,z)},z.registerRenderer=ue,z.renderer=j;var Se=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"})]))}}),ae=Se,_e=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"})]))}}),ne=_e,Be=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"})]))}}),oe=Be,Ve=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"})]))}}),re=Ve,$e=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"})]))}}),A=$e,Ee=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"})]))}}),H=Ee,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"})]))}}),le=Pe,Fe=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"})]))}}),se=Fe,Re=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"})]))}}),ie=Re;const Te=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 r=e.ref(null),l=e.reactive({}),m={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"},o=s=>m[s]||"el-input",c=s=>{const h=s.type||"input",B=["select","date","daterange","datetime","datetimerange","cascader"].includes(h),V={placeholder:s.placeholder||`请${B?"选择":"输入"}${s.label}`,disabled:s.disabled,style:"width: 100%","popper-class":"zxt-form-popper"};switch(h){case"date":case"daterange":case"datetime":case"datetimerange":return{...V,type:s.dateType||h,startPlaceholder:s.startPlaceholder||"开始日期",endPlaceholder:s.endPlaceholder||"结束日期",format:s.format,valueFormat:s.valueFormat};case"cascader":return{...V,options:s.options,props:s.cascaderProps,clearable:s.clearable!==!1};case"select":return V;case"input":default:return V}},p=e.computed(()=>t.formColumns.map(s=>({...s,colSpan:{xs:s.xs??s.span??24,sm:s.sm??s.span??12,md:s.md??s.span??12,lg:s.lg??s.span??12,xl:s.xl??s.span??12}})));e.watch(()=>t.initialFormData,s=>{Object.keys(l).forEach(h=>{delete l[h]}),Object.assign(l,s)},{immediate:!0,deep:!0});const f=e.computed(()=>{const s={...t.rules};return Object.keys(s).length===0&&t.formColumns.length>0&&t.formColumns.forEach(h=>{if(h.required){const B=["select","date","daterange","datetime","datetimerange","cascader"].includes(h.type);s[h.prop]=[{required:!0,message:`请${B?"选择":"输入"}${h.label}`,trigger:B?"change":"blur"}]}}),s}),g=()=>{r.value&&r.value.validate(s=>{s&&a("submit",{...l})})},d=()=>{r.value&&r.value.resetFields(),a("reset")},C=s=>()=>we(s,l,{})||null;return n({validate:()=>r.value?r.value.validate():Promise.resolve(!1),resetFields:()=>r.value&&r.value.resetFields(),getFormData:()=>({...l}),submitForm:g,resetForm:d}),{formRef:r,formData:l,formRules:f,submitForm:g,resetForm:d,processedColumns:p,getComponentType:o,getComponentProps:c,renderCustomItem:C}}}),De={class:"zxt-form-container"},Ne={key:0,class:"form-label"},Oe={class:"form-control"};function xe(t,a,n,r,l,m){const o=e.resolveComponent("el-option"),c=e.resolveComponent("el-form-item"),p=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(p,e.mergeProps({key:C},{ref_for:!0},d.colSpan),{default:e.withCtx(()=>[e.createVNode(c,{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",Ne,e.toDisplayString(d.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Oe,[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":s=>t.formData[d.prop]=s},{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,(s,h)=>(e.openBlock(),e.createBlock(o,{key:h,label:s.label,value:s.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=R(Te,[["render",xe],["__scopeId","data-v-9c337267"]]),Ze=e.defineComponent({name:"ZxtGrid",inheritAttrs:!1,components:{ZxtTable:z,ZxtForm:M,Plus:re,Delete:ae,Refresh:A,Download:ne,Search:H,Edit:oe,View:ie,Upload:se,Setting:le},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 r=e.useAttrs(),l=e.ref(null),m=e.ref(null),o=e.ref(null),c=e.ref(1),p=e.ref(10),f=e.ref([]),g=e.ref(t.gridOptions.formMode||!0),d={Plus:re,Delete:ae,Refresh:A,Download:ne,Search:H,Edit:oe,View:ie,Upload:se,Setting:le},C=e.computed(()=>{const i=t.gridOptions.formConfig;if(!i||!i.items)return[];const k=[...i.items];return k.some(N=>N.type==="slot"&&N.slotName==="search-actions")||k.push({type:"slot",slotName:"search-actions",span:6,labelWidth:"0px",isAction:!0,...i.actionConfig}),k}),s=()=>{o.value?.submitForm()},h=i=>{a("submit",i),t.gridOptions.proxyConfig&&(t.gridOptions.proxyConfig._formData||(t.gridOptions.proxyConfig._formData={}),Object.assign(t.gridOptions.proxyConfig._formData,i),c.value=1,l.value?.reload?.())},B=()=>{o.value?.resetForm()},V=()=>{a("reset"),t.gridOptions.proxyConfig&&(t.gridOptions.proxyConfig._formData&&(t.gridOptions.proxyConfig._formData={}),c.value=1,l.value?.reload?.())},q=i=>{if(i)return typeof i=="object"||typeof i=="function"?i:d[i]},U=e.computed(()=>{const{formConfig:i,toolbar:k,formMode:Z,formColumns:N,rules:Je,data:We,...Ue}=t.gridOptions;return Ue}),_=e.computed(()=>t.externalData.length>0?t.externalData:t.gridOptions.data||[]),L=e.computed(()=>_.value.length),G=(i,k)=>{switch(a("toolbar-click",{code:i,button:k,grid:l.value}),i){case"add":J();break;case"delete":W();break;case"refresh":u();break;case"export":S();break}},J=()=>{g.value=!0},W=()=>{const i=l.value?.getTableRef()?.getSelectionRows?.()||[];if(i.length===0){b.ElMessage.warning("请先选择要删除的数据");return}b.ElMessage.success(`删除 ${i.length} 条数据`)},u=()=>{b.ElMessage.success("刷新数据"),l.value?.reload?.()},S=()=>{b.ElMessage.success("导出数据")},P=i=>{a("submit",i)},K=()=>{a("reset")},Q=()=>{g.value=!1},X=i=>{c.value=i.page,a("page-change",i)},Y=i=>{p.value=i.size,a("size-change",i)},v=()=>l.value,F=()=>m.value,w=()=>l.value?.getTableRef()?.getSelectionRows?.()||[],x=i=>{f.value=i},ee=i=>{g.value=i},te=(i,...k)=>{switch(i){case"query":c.value=1,l.value?.reload?.();break;case"reload":l.value?.reload?.();break;default:console.warn(`[ZxtGrid] commitProxy: unknown type "${i}"`)}};return e.watch(()=>t.gridOptions.formMode,i=>{i!==void 0&&(g.value=i)}),n({getGridRef:v,getFormRef:F,getSelectedRows:w,reloadData:x,setFormVisible:ee,commitProxy:te}),{attrs:r,gridRef:l,formRef:m,searchFormRef:o,currentPage:c,pageSize:p,tableData:_,tableProps:U,total:L,isFormVisible:g,searchFormColumns:C,getIconComponent:q,handleToolbarClick:G,handleSubmit:P,handleFormReset:K,handleFormCancel:Q,handlePageChange:X,handleSizeChange:Y,handleSearch:s,handleSearchSubmit:h,handleReset:B,handleSearchReset:V,Search:H,Refresh:A}}}),Me={key:0,class:"grid-search-form"},Le={class:"search-btn-group"},je={class:"grid-table-wrapper"},Ae={key:0,class:"grid-toolbar"};function He(t,a,n,r,l,m){const o=e.resolveComponent("el-button"),c=e.resolveComponent("ZxtForm"),p=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",Me,[e.createVNode(c,{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",Le,[e.createVNode(o,{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(o,{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",Ae,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.gridOptions.toolbar.buttons,(f,g)=>(e.openBlock(),e.createBlock(o,{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(p,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 I=R(Ze,[["render",He],["__scopeId","data-v-ca0e4fa5"]]);$.install=function(t){t.component($.name,$)};const Ie=[T,D,z,I,M,$],qe={install:t=>{Ie.forEach(a=>{t.component(a.name,a)})},MyButton:T,JsxButton:D,ZxtTable:z,ZxtGrid:I,ZxtForm:M,ZxtPagination:$,renderer:z.renderer,registerRenderer:z.registerRenderer};y.JsxButton=D,y.MyButton=T,y.ZxtForm=M,y.ZxtGrid=I,y.ZxtPagination=$,y.ZxtTable=z,y.default=qe,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|