zxt-table 0.4.0 → 0.4.1

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