zxt-table 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/zxt-table.css +1 -1
- package/dist/zxt-table.es.js +92 -90
- package/dist/zxt-table.umd.js +1 -1
- package/package.json +1 -1
package/dist/zxt-table.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.my-button[data-v-4480e77d]{display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#fff;border:1px solid #dcdfe6;color:#606266;text-align:center;box-sizing:border-box;outline:none;margin:0;transition:.1s;font-weight:500;padding:12px 20px;font-size:14px;border-radius:4px}.my-button--primary[data-v-4480e77d]{color:#fff;background-color:#409eff;border-color:#409eff}.my-button--success[data-v-4480e77d]{color:#fff;background-color:#67c23a;border-color:#67c23a}.my-button--warning[data-v-4480e77d]{color:#fff;background-color:#e6a23c;border-color:#e6a23c}.my-button--danger[data-v-4480e77d]{color:#fff;background-color:#f56c6c;border-color:#f56c6c}.my-button.is-disabled[data-v-4480e77d]{cursor:not-allowed;opacity:.7}.jsx-button{display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#fff;border:1px solid #dcdfe6;color:#606266;text-align:center;box-sizing:border-box;outline:none;margin:0;transition:.1s;font-weight:500;padding:12px 20px;font-size:14px;border-radius:4px}.jsx-button--primary{color:#fff;background-color:#409eff;border-color:#409eff}.jsx-button--success{color:#fff;background-color:#67c23a;border-color:#67c23a}.jsx-button--warning{color:#fff;background-color:#e6a23c;border-color:#e6a23c}.jsx-button--danger{color:#fff;background-color:#f56c6c;border-color:#f56c6c}.jsx-button.is-disabled{cursor:not-allowed;opacity:.7}.zxt-form-container[data-v-2148c373]{padding:20px}.form-actions[data-v-2148c373]{display:flex;justify-content:center;margin-top:30px;gap:10px}.zxt-pagination[data-v-e6813cef]{display:flex;justify-content:flex-end;margin-top:20px}.zxt-table-container[data-v-
|
|
1
|
+
.my-button[data-v-4480e77d]{display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#fff;border:1px solid #dcdfe6;color:#606266;text-align:center;box-sizing:border-box;outline:none;margin:0;transition:.1s;font-weight:500;padding:12px 20px;font-size:14px;border-radius:4px}.my-button--primary[data-v-4480e77d]{color:#fff;background-color:#409eff;border-color:#409eff}.my-button--success[data-v-4480e77d]{color:#fff;background-color:#67c23a;border-color:#67c23a}.my-button--warning[data-v-4480e77d]{color:#fff;background-color:#e6a23c;border-color:#e6a23c}.my-button--danger[data-v-4480e77d]{color:#fff;background-color:#f56c6c;border-color:#f56c6c}.my-button.is-disabled[data-v-4480e77d]{cursor:not-allowed;opacity:.7}.jsx-button{display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#fff;border:1px solid #dcdfe6;color:#606266;text-align:center;box-sizing:border-box;outline:none;margin:0;transition:.1s;font-weight:500;padding:12px 20px;font-size:14px;border-radius:4px}.jsx-button--primary{color:#fff;background-color:#409eff;border-color:#409eff}.jsx-button--success{color:#fff;background-color:#67c23a;border-color:#67c23a}.jsx-button--warning{color:#fff;background-color:#e6a23c;border-color:#e6a23c}.jsx-button--danger{color:#fff;background-color:#f56c6c;border-color:#f56c6c}.jsx-button.is-disabled{cursor:not-allowed;opacity:.7}.zxt-form-container[data-v-2148c373]{padding:20px}.form-actions[data-v-2148c373]{display:flex;justify-content:center;margin-top:30px;gap:10px}.zxt-pagination[data-v-e6813cef]{display:flex;justify-content:flex-end;margin-top:20px}.zxt-table-container[data-v-3bee3ce2]{width:100%}
|
package/dist/zxt-table.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createElementBlock as
|
|
2
|
-
const
|
|
1
|
+
import { createElementBlock as y, openBlock as r, normalizeClass as T, renderSlot as $, defineComponent as w, createVNode as k, ref as v, reactive as q, watch as B, computed as _, resolveComponent as f, withCtx as c, Fragment as C, renderList as R, createBlock as m, createCommentVNode as N, normalizeStyle as L, createSlots as E, normalizeProps as I, guardReactiveProps as M, mergeProps as j, resolveDynamicComponent as J, createTextVNode as Z, toDisplayString as U } from "vue";
|
|
2
|
+
const D = (e, a) => {
|
|
3
3
|
const n = e.__vccOpts || e;
|
|
4
|
-
for (const [l,
|
|
5
|
-
n[l] =
|
|
4
|
+
for (const [l, d] of a)
|
|
5
|
+
n[l] = d;
|
|
6
6
|
return n;
|
|
7
7
|
}, G = {
|
|
8
8
|
name: "MyButton",
|
|
@@ -26,20 +26,20 @@ const w = (e, a) => {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
}, H = ["disabled"];
|
|
29
|
-
function K(e, a, n, l,
|
|
30
|
-
return r(),
|
|
31
|
-
class:
|
|
29
|
+
function K(e, a, n, l, d, b) {
|
|
30
|
+
return r(), y("button", {
|
|
31
|
+
class: T(["my-button", [`my-button--${n.type}`, { "is-disabled": n.disabled }]]),
|
|
32
32
|
disabled: n.disabled,
|
|
33
33
|
onClick: a[0] || (a[0] = (...o) => l.handleClick && l.handleClick(...o))
|
|
34
34
|
}, [
|
|
35
|
-
|
|
35
|
+
$(e.$slots, "default", {}, void 0, !0)
|
|
36
36
|
], 10, H);
|
|
37
37
|
}
|
|
38
|
-
const F = /* @__PURE__ */
|
|
38
|
+
const F = /* @__PURE__ */ D(G, [["render", K], ["__scopeId", "data-v-4480e77d"]]);
|
|
39
39
|
F.install = function(e) {
|
|
40
40
|
e.component(F.name, F);
|
|
41
41
|
};
|
|
42
|
-
const V = /* @__PURE__ */
|
|
42
|
+
const V = /* @__PURE__ */ w({
|
|
43
43
|
name: "JsxButton",
|
|
44
44
|
props: {
|
|
45
45
|
type: {
|
|
@@ -57,10 +57,10 @@ const V = /* @__PURE__ */ D({
|
|
|
57
57
|
emit: a,
|
|
58
58
|
slots: n
|
|
59
59
|
}) {
|
|
60
|
-
const l = (
|
|
61
|
-
e.disabled || a("click",
|
|
60
|
+
const l = (d) => {
|
|
61
|
+
e.disabled || a("click", d);
|
|
62
62
|
};
|
|
63
|
-
return () =>
|
|
63
|
+
return () => k("button", {
|
|
64
64
|
class: ["jsx-button", `jsx-button--${e.type}`, {
|
|
65
65
|
"is-disabled": e.disabled
|
|
66
66
|
}],
|
|
@@ -72,7 +72,7 @@ const V = /* @__PURE__ */ D({
|
|
|
72
72
|
V.install = function(e) {
|
|
73
73
|
e.component(V.name, V);
|
|
74
74
|
};
|
|
75
|
-
const Q =
|
|
75
|
+
const Q = w({
|
|
76
76
|
name: "ZxtForm",
|
|
77
77
|
props: {
|
|
78
78
|
formColumns: { type: Array, default: () => [] },
|
|
@@ -81,45 +81,45 @@ const Q = D({
|
|
|
81
81
|
},
|
|
82
82
|
emits: ["submit", "reset"],
|
|
83
83
|
setup(e, { emit: a, expose: n }) {
|
|
84
|
-
const l =
|
|
84
|
+
const l = v(null), d = q({});
|
|
85
85
|
B(
|
|
86
86
|
() => e.initialFormData,
|
|
87
87
|
(u) => {
|
|
88
|
-
Object.keys(
|
|
89
|
-
delete
|
|
90
|
-
}), Object.assign(
|
|
88
|
+
Object.keys(d).forEach((i) => {
|
|
89
|
+
delete d[i];
|
|
90
|
+
}), Object.assign(d, u);
|
|
91
91
|
},
|
|
92
92
|
{ immediate: !0, deep: !0 }
|
|
93
93
|
);
|
|
94
|
-
const
|
|
94
|
+
const b = _(() => {
|
|
95
95
|
const u = { ...e.rules };
|
|
96
|
-
return Object.keys(u).length === 0 && e.formColumns.length > 0 && e.formColumns.forEach((
|
|
97
|
-
|
|
96
|
+
return Object.keys(u).length === 0 && e.formColumns.length > 0 && e.formColumns.forEach((i) => {
|
|
97
|
+
i.required && (u[i.prop] = [
|
|
98
98
|
{
|
|
99
99
|
required: !0,
|
|
100
|
-
message: `请${
|
|
101
|
-
trigger:
|
|
100
|
+
message: `请${i.type === "select" || i.type === "date" ? "选择" : "输入"}${i.label}`,
|
|
101
|
+
trigger: i.type === "select" || i.type === "date" ? "change" : "blur"
|
|
102
102
|
}
|
|
103
103
|
]);
|
|
104
104
|
}), u;
|
|
105
105
|
}), o = () => {
|
|
106
106
|
l.value && l.value.validate((u) => {
|
|
107
|
-
u && a("submit", { ...
|
|
107
|
+
u && a("submit", { ...d });
|
|
108
108
|
});
|
|
109
|
-
},
|
|
109
|
+
}, g = () => {
|
|
110
110
|
l.value && l.value.resetFields(), a("reset");
|
|
111
111
|
};
|
|
112
112
|
return n({
|
|
113
113
|
validate: () => l.value ? l.value.validate() : Promise.resolve(!1),
|
|
114
114
|
resetFields: () => l.value && l.value.resetFields(),
|
|
115
|
-
getFormData: () => ({ ...
|
|
116
|
-
}), { formRef: l, formData:
|
|
115
|
+
getFormData: () => ({ ...d })
|
|
116
|
+
}), { formRef: l, formData: d, formRules: b, submitForm: o, resetForm: g };
|
|
117
117
|
}
|
|
118
118
|
}), W = { class: "zxt-form-container" };
|
|
119
|
-
function X(e, a, n, l,
|
|
120
|
-
const o =
|
|
121
|
-
return r(),
|
|
122
|
-
|
|
119
|
+
function X(e, a, n, l, d, b) {
|
|
120
|
+
const o = f("el-input"), g = f("el-option"), u = f("el-select"), i = f("el-date-picker"), s = f("el-form-item"), z = f("el-col"), p = f("el-row"), S = f("el-form");
|
|
121
|
+
return r(), y("div", W, [
|
|
122
|
+
k(S, {
|
|
123
123
|
ref: "formRef",
|
|
124
124
|
model: e.formData,
|
|
125
125
|
rules: e.formRules,
|
|
@@ -127,10 +127,10 @@ function X(e, a, n, l, s, y) {
|
|
|
127
127
|
class: "zxt-form"
|
|
128
128
|
}, {
|
|
129
129
|
default: c(() => [
|
|
130
|
-
|
|
130
|
+
k(p, { gutter: 20 }, {
|
|
131
131
|
default: c(() => [
|
|
132
|
-
(r(!0),
|
|
133
|
-
key:
|
|
132
|
+
(r(!0), y(C, null, R(e.formColumns, (t, O) => (r(), m(z, {
|
|
133
|
+
key: O,
|
|
134
134
|
xs: t.xs || 24,
|
|
135
135
|
sm: t.sm || 12,
|
|
136
136
|
md: t.md || 12,
|
|
@@ -138,43 +138,43 @@ function X(e, a, n, l, s, y) {
|
|
|
138
138
|
xl: t.xl || t.span || 12
|
|
139
139
|
}, {
|
|
140
140
|
default: c(() => [
|
|
141
|
-
|
|
141
|
+
k(s, {
|
|
142
142
|
label: t.label,
|
|
143
143
|
prop: t.prop,
|
|
144
144
|
required: t.required
|
|
145
145
|
}, {
|
|
146
146
|
default: c(() => [
|
|
147
|
-
t.type === "input" || !t.type ? (r(),
|
|
147
|
+
t.type === "input" || !t.type ? (r(), m(o, {
|
|
148
148
|
key: 0,
|
|
149
149
|
modelValue: e.formData[t.prop],
|
|
150
|
-
"onUpdate:modelValue": (
|
|
150
|
+
"onUpdate:modelValue": (h) => e.formData[t.prop] = h,
|
|
151
151
|
placeholder: t.placeholder || `请输入${t.label}`,
|
|
152
152
|
disabled: t.disabled
|
|
153
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "select" ? (r(),
|
|
153
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "select" ? (r(), m(u, {
|
|
154
154
|
key: 1,
|
|
155
155
|
modelValue: e.formData[t.prop],
|
|
156
|
-
"onUpdate:modelValue": (
|
|
156
|
+
"onUpdate:modelValue": (h) => e.formData[t.prop] = h,
|
|
157
157
|
placeholder: t.placeholder || `请选择${t.label}`,
|
|
158
158
|
disabled: t.disabled,
|
|
159
159
|
style: { width: "100%" }
|
|
160
160
|
}, {
|
|
161
161
|
default: c(() => [
|
|
162
|
-
(r(!0),
|
|
163
|
-
key:
|
|
164
|
-
label:
|
|
165
|
-
value:
|
|
162
|
+
(r(!0), y(C, null, R(t.options, (h, A) => (r(), m(g, {
|
|
163
|
+
key: A,
|
|
164
|
+
label: h.label,
|
|
165
|
+
value: h.value
|
|
166
166
|
}, null, 8, ["label", "value"]))), 128))
|
|
167
167
|
]),
|
|
168
168
|
_: 2
|
|
169
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "date" ? (r(),
|
|
169
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "date" ? (r(), m(i, {
|
|
170
170
|
key: 2,
|
|
171
171
|
modelValue: e.formData[t.prop],
|
|
172
|
-
"onUpdate:modelValue": (
|
|
172
|
+
"onUpdate:modelValue": (h) => e.formData[t.prop] = h,
|
|
173
173
|
type: t.dateType || "date",
|
|
174
174
|
placeholder: t.placeholder || `请选择${t.label}`,
|
|
175
175
|
disabled: t.disabled,
|
|
176
176
|
style: { width: "100%" }
|
|
177
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "type", "placeholder", "disabled"])) : t.type === "slot" ?
|
|
177
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "type", "placeholder", "disabled"])) : t.type === "slot" ? $(e.$slots, t.slotName || t.prop, {
|
|
178
178
|
key: 3,
|
|
179
179
|
formData: e.formData,
|
|
180
180
|
column: t
|
|
@@ -193,7 +193,7 @@ function X(e, a, n, l, s, y) {
|
|
|
193
193
|
}, 8, ["model", "rules"])
|
|
194
194
|
]);
|
|
195
195
|
}
|
|
196
|
-
const Y = /* @__PURE__ */
|
|
196
|
+
const Y = /* @__PURE__ */ D(Q, [["render", X], ["__scopeId", "data-v-2148c373"]]), x = w({
|
|
197
197
|
name: "ZxtPagination",
|
|
198
198
|
props: {
|
|
199
199
|
// 当前页码
|
|
@@ -212,7 +212,7 @@ const Y = /* @__PURE__ */ w(Q, [["render", X], ["__scopeId", "data-v-2148c373"]]
|
|
|
212
212
|
},
|
|
213
213
|
emits: ["update:modelValue", "update:pageSize", "page-change", "size-change"],
|
|
214
214
|
setup(e, { emit: a }) {
|
|
215
|
-
const n =
|
|
215
|
+
const n = v(e.modelValue), l = v(e.pageSize);
|
|
216
216
|
return B(
|
|
217
217
|
() => e.modelValue,
|
|
218
218
|
(o) => {
|
|
@@ -235,13 +235,13 @@ const Y = /* @__PURE__ */ w(Q, [["render", X], ["__scopeId", "data-v-2148c373"]]
|
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
|
-
function ee(e, a, n, l,
|
|
239
|
-
const o =
|
|
240
|
-
return r(),
|
|
238
|
+
function ee(e, a, n, l, d, b) {
|
|
239
|
+
const o = f("el-pagination");
|
|
240
|
+
return r(), m(o, {
|
|
241
241
|
"current-page": e.currentPage,
|
|
242
|
-
"onUpdate:currentPage": a[0] || (a[0] = (
|
|
242
|
+
"onUpdate:currentPage": a[0] || (a[0] = (g) => e.currentPage = g),
|
|
243
243
|
"page-size": e.pageSize,
|
|
244
|
-
"onUpdate:pageSize": a[1] || (a[1] = (
|
|
244
|
+
"onUpdate:pageSize": a[1] || (a[1] = (g) => e.pageSize = g),
|
|
245
245
|
"page-sizes": e.pageSizes,
|
|
246
246
|
total: e.total,
|
|
247
247
|
layout: e.layout,
|
|
@@ -250,7 +250,7 @@ function ee(e, a, n, l, s, y) {
|
|
|
250
250
|
onCurrentChange: e.handleCurrentChange
|
|
251
251
|
}, null, 8, ["current-page", "page-size", "page-sizes", "total", "layout", "onSizeChange", "onCurrentChange"]);
|
|
252
252
|
}
|
|
253
|
-
const te = /* @__PURE__ */
|
|
253
|
+
const te = /* @__PURE__ */ D(x, [["render", ee], ["__scopeId", "data-v-e6813cef"]]), ae = w({
|
|
254
254
|
name: "ZxtTable",
|
|
255
255
|
components: { ZxtForm: Y, ZxtPagination: te },
|
|
256
256
|
props: {
|
|
@@ -288,7 +288,7 @@ const te = /* @__PURE__ */ w(x, [["render", ee], ["__scopeId", "data-v-e6813cef"
|
|
|
288
288
|
},
|
|
289
289
|
emits: ["submit", "reset", "page-change", "size-change"],
|
|
290
290
|
setup(e, { emit: a }) {
|
|
291
|
-
const n =
|
|
291
|
+
const n = v(null), l = v(null), d = v(e.pageSize), b = _(() => e.height === "full" ? { height: "100%" } : {}), o = _(() => e.total > 0 ? e.total : e.data.length), g = (S) => {
|
|
292
292
|
a("size-change", S);
|
|
293
293
|
}, u = (S) => {
|
|
294
294
|
a("page-change", S);
|
|
@@ -296,7 +296,7 @@ const te = /* @__PURE__ */ w(x, [["render", ee], ["__scopeId", "data-v-e6813cef"
|
|
|
296
296
|
return {
|
|
297
297
|
tableRef: n,
|
|
298
298
|
formRef: l,
|
|
299
|
-
containerStyle:
|
|
299
|
+
containerStyle: b,
|
|
300
300
|
onFormSubmit: (S) => {
|
|
301
301
|
a("submit", S);
|
|
302
302
|
},
|
|
@@ -305,22 +305,22 @@ const te = /* @__PURE__ */ w(x, [["render", ee], ["__scopeId", "data-v-e6813cef"
|
|
|
305
305
|
},
|
|
306
306
|
getTableRef: () => n.value,
|
|
307
307
|
getFormRef: () => l.value,
|
|
308
|
-
pageSize:
|
|
308
|
+
pageSize: d,
|
|
309
309
|
total: o,
|
|
310
|
-
pageSizes:
|
|
311
|
-
paginationLayout:
|
|
312
|
-
handleSizeChange:
|
|
310
|
+
pageSizes: _(() => e.pageSizes),
|
|
311
|
+
paginationLayout: _(() => e.paginationLayout),
|
|
312
|
+
handleSizeChange: g,
|
|
313
313
|
handlePageChange: u
|
|
314
314
|
};
|
|
315
315
|
}
|
|
316
316
|
});
|
|
317
|
-
function le(e, a, n, l,
|
|
318
|
-
const o =
|
|
319
|
-
return r(),
|
|
317
|
+
function le(e, a, n, l, d, b) {
|
|
318
|
+
const o = f("ZxtForm"), g = f("el-table-column"), u = f("el-table"), i = f("ZxtPagination");
|
|
319
|
+
return r(), y("div", {
|
|
320
320
|
class: "zxt-table-container",
|
|
321
|
-
style:
|
|
321
|
+
style: L(e.containerStyle)
|
|
322
322
|
}, [
|
|
323
|
-
e.formMode ? (r(),
|
|
323
|
+
e.formMode ? (r(), m(o, {
|
|
324
324
|
key: 0,
|
|
325
325
|
ref: "formRef",
|
|
326
326
|
"form-columns": e.formColumns,
|
|
@@ -328,49 +328,51 @@ function le(e, a, n, l, s, y) {
|
|
|
328
328
|
rules: e.rules,
|
|
329
329
|
onSubmit: e.onFormSubmit,
|
|
330
330
|
onReset: e.onFormReset
|
|
331
|
-
},
|
|
331
|
+
}, E({
|
|
332
332
|
"form-actions": c(() => [
|
|
333
|
-
|
|
333
|
+
$(e.$slots, "form-actions", {}, void 0, !0)
|
|
334
334
|
]),
|
|
335
335
|
_: 2
|
|
336
336
|
}, [
|
|
337
|
-
R(e.$slots, (
|
|
337
|
+
R(e.$slots, (s, z) => ({
|
|
338
338
|
name: z,
|
|
339
|
-
fn: c((
|
|
340
|
-
|
|
339
|
+
fn: c((p) => [
|
|
340
|
+
$(e.$slots, z, I(M(p)), void 0, !0)
|
|
341
341
|
])
|
|
342
342
|
}))
|
|
343
343
|
]), 1032, ["form-columns", "initial-form-data", "rules", "onSubmit", "onReset"])) : N("", !0),
|
|
344
|
-
|
|
344
|
+
k(u, j({
|
|
345
345
|
ref: "tableRef",
|
|
346
346
|
data: e.data,
|
|
347
347
|
height: e.height
|
|
348
348
|
}, e.$attrs, { id: e.id }), {
|
|
349
349
|
default: c(() => [
|
|
350
|
-
(r(!0),
|
|
351
|
-
|
|
350
|
+
(r(!0), y(C, null, R(e.columns, (s, z) => (r(), y(C, { key: z }, [
|
|
351
|
+
s.slot ? (r(), m(g, j({
|
|
352
352
|
key: 1,
|
|
353
353
|
ref_for: !0
|
|
354
|
-
},
|
|
355
|
-
default: c((
|
|
356
|
-
|
|
357
|
-
row:
|
|
358
|
-
index:
|
|
354
|
+
}, s), {
|
|
355
|
+
default: c((p) => [
|
|
356
|
+
$(e.$slots, s.slot, {
|
|
357
|
+
row: p.row,
|
|
358
|
+
index: p.$index
|
|
359
359
|
}, void 0, !0)
|
|
360
360
|
]),
|
|
361
361
|
_: 2
|
|
362
|
-
}, 1040)) : (r(), g
|
|
362
|
+
}, 1040)) : (r(), m(g, j({
|
|
363
363
|
key: 0,
|
|
364
364
|
ref_for: !0
|
|
365
|
-
},
|
|
366
|
-
default: c((
|
|
367
|
-
|
|
365
|
+
}, s), {
|
|
366
|
+
default: c((p) => [
|
|
367
|
+
s.render ? (r(), m(J(s.render), {
|
|
368
368
|
key: 0,
|
|
369
|
-
row:
|
|
370
|
-
column:
|
|
371
|
-
index:
|
|
372
|
-
}, null, 8, ["row", "column", "index"])) : (r(),
|
|
373
|
-
|
|
369
|
+
row: p.row,
|
|
370
|
+
column: s,
|
|
371
|
+
index: p.$index
|
|
372
|
+
}, null, 8, ["row", "column", "index"])) : s.formatter ? (r(), y(C, { key: 1 }, [
|
|
373
|
+
Z(U(s.formatter(p.row, s, p.row[s.prop])), 1)
|
|
374
|
+
], 64)) : (r(), y(C, { key: 2 }, [
|
|
375
|
+
Z(U(p.row[s.prop]), 1)
|
|
374
376
|
], 64))
|
|
375
377
|
]),
|
|
376
378
|
_: 2
|
|
@@ -379,11 +381,11 @@ function le(e, a, n, l, s, y) {
|
|
|
379
381
|
]),
|
|
380
382
|
_: 3
|
|
381
383
|
}, 16, ["data", "height", "id"]),
|
|
382
|
-
e.pageable ? (r(),
|
|
384
|
+
e.pageable ? (r(), m(i, {
|
|
383
385
|
key: 1,
|
|
384
386
|
"model-value": e.currentPage,
|
|
385
387
|
"page-size": e.pageSize,
|
|
386
|
-
"onUpdate:pageSize": a[0] || (a[0] = (
|
|
388
|
+
"onUpdate:pageSize": a[0] || (a[0] = (s) => e.pageSize = s),
|
|
387
389
|
"page-sizes": e.pageSizes,
|
|
388
390
|
total: e.total,
|
|
389
391
|
layout: e.paginationLayout,
|
|
@@ -392,7 +394,7 @@ function le(e, a, n, l, s, y) {
|
|
|
392
394
|
}, null, 8, ["model-value", "page-size", "page-sizes", "total", "layout", "onPageChange", "onSizeChange"])) : N("", !0)
|
|
393
395
|
], 4);
|
|
394
396
|
}
|
|
395
|
-
const P = /* @__PURE__ */
|
|
397
|
+
const P = /* @__PURE__ */ D(ae, [["render", le], ["__scopeId", "data-v-3bee3ce2"]]);
|
|
396
398
|
P.install = function(e) {
|
|
397
399
|
e.component(P.name, P);
|
|
398
400
|
};
|
package/dist/zxt-table.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(f,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(f=typeof globalThis<"u"?globalThis:f||self,e(f.ZxtTable={},f.Vue))})(this,(function(f,e){"use strict";const S=(t,o)=>{const l=t.__vccOpts||t;for(const[n,
|
|
1
|
+
(function(f,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(f=typeof globalThis<"u"?globalThis:f||self,e(f.ZxtTable={},f.Vue))})(this,(function(f,e){"use strict";const S=(t,o)=>{const l=t.__vccOpts||t;for(const[n,d]of o)l[n]=d;return l},z={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:o}){return{handleClick:n=>{o("click",n)}}}},B=["disabled"];function _(t,o,l,n,d,g){return e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["my-button",[`my-button--${l.type}`,{"is-disabled":l.disabled}]]),disabled:l.disabled,onClick:o[0]||(o[0]=(...r)=>n.handleClick&&n.handleClick(...r))},[e.renderSlot(t.$slots,"default",{},void 0,!0)],10,B)}const b=S(z,[["render",_],["__scopeId","data-v-4480e77d"]]);b.install=function(t){t.component(b.name,b)};const k=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:o,slots:l}){const n=d=>{t.disabled||o("click",d)};return()=>e.createVNode("button",{class:["jsx-button",`jsx-button--${t.type}`,{"is-disabled":t.disabled}],disabled:t.disabled,onClick:n},[l.default?.()])}});k.install=function(t){t.component(k.name,k)};const $=e.defineComponent({name:"ZxtForm",props:{formColumns:{type:Array,default:()=>[]},initialFormData:{type:Object,default:()=>({})},rules:{type:Object,default:()=>({})}},emits:["submit","reset"],setup(t,{emit:o,expose:l}){const n=e.ref(null),d=e.reactive({});e.watch(()=>t.initialFormData,p=>{Object.keys(d).forEach(i=>{delete d[i]}),Object.assign(d,p)},{immediate:!0,deep:!0});const g=e.computed(()=>{const p={...t.rules};return Object.keys(p).length===0&&t.formColumns.length>0&&t.formColumns.forEach(i=>{i.required&&(p[i.prop]=[{required:!0,message:`请${i.type==="select"||i.type==="date"?"选择":"输入"}${i.label}`,trigger:i.type==="select"||i.type==="date"?"change":"blur"}])}),p}),r=()=>{n.value&&n.value.validate(p=>{p&&o("submit",{...d})})},m=()=>{n.value&&n.value.resetFields(),o("reset")};return l({validate:()=>n.value?n.value.validate():Promise.resolve(!1),resetFields:()=>n.value&&n.value.resetFields(),getFormData:()=>({...d})}),{formRef:n,formData:d,formRules:g,submitForm:r,resetForm:m}}}),w={class:"zxt-form-container"};function F(t,o,l,n,d,g){const r=e.resolveComponent("el-input"),m=e.resolveComponent("el-option"),p=e.resolveComponent("el-select"),i=e.resolveComponent("el-date-picker"),s=e.resolveComponent("el-form-item"),y=e.resolveComponent("el-col"),c=e.resolveComponent("el-row"),h=e.resolveComponent("el-form");return e.openBlock(),e.createElementBlock("div",w,[e.createVNode(h,{ref:"formRef",model:t.formData,rules:t.formRules,"label-width":"100px",class:"zxt-form"},{default:e.withCtx(()=>[e.createVNode(c,{gutter:20},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.formColumns,(a,Z)=>(e.openBlock(),e.createBlock(y,{key:Z,xs:a.xs||24,sm:a.sm||12,md:a.md||12,lg:a.lg||a.span||12,xl:a.xl||a.span||12},{default:e.withCtx(()=>[e.createVNode(s,{label:a.label,prop:a.prop,required:a.required},{default:e.withCtx(()=>[a.type==="input"||!a.type?(e.openBlock(),e.createBlock(r,{key:0,modelValue:t.formData[a.prop],"onUpdate:modelValue":u=>t.formData[a.prop]=u,placeholder:a.placeholder||`请输入${a.label}`,disabled:a.disabled},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):a.type==="select"?(e.openBlock(),e.createBlock(p,{key:1,modelValue:t.formData[a.prop],"onUpdate:modelValue":u=>t.formData[a.prop]=u,placeholder:a.placeholder||`请选择${a.label}`,disabled:a.disabled,style:{width:"100%"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.options,(u,O)=>(e.openBlock(),e.createBlock(m,{key:O,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):a.type==="date"?(e.openBlock(),e.createBlock(i,{key:2,modelValue:t.formData[a.prop],"onUpdate:modelValue":u=>t.formData[a.prop]=u,type:a.dateType||"date",placeholder:a.placeholder||`请选择${a.label}`,disabled:a.disabled,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","type","placeholder","disabled"])):a.type==="slot"?e.renderSlot(t.$slots,a.slotName||a.prop,{key:3,formData:t.formData,column:a},void 0,!0):e.createCommentVNode("",!0)]),_:2},1032,["label","prop","required"])]),_:2},1032,["xs","sm","md","lg","xl"]))),128))]),_:3})]),_:3},8,["model","rules"])])}const V=S($,[["render",F],["__scopeId","data-v-2148c373"]]),P=e.defineComponent({name:"ZxtPagination",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:o}){const l=e.ref(t.modelValue),n=e.ref(t.pageSize);return e.watch(()=>t.modelValue,r=>{l.value=r}),e.watch(()=>t.pageSize,r=>{n.value=r}),{currentPage:l,pageSize:n,handleSizeChange:r=>{n.value=r,l.value=1,o("update:pageSize",r),o("size-change",{page:l.value,size:r})},handleCurrentChange:r=>{l.value=r,o("update:modelValue",r),o("page-change",{page:r,size:n.value})}}}});function D(t,o,l,n,d,g){const r=e.resolveComponent("el-pagination");return e.openBlock(),e.createBlock(r,{"current-page":t.currentPage,"onUpdate:currentPage":o[0]||(o[0]=m=>t.currentPage=m),"page-size":t.pageSize,"onUpdate:pageSize":o[1]||(o[1]=m=>t.pageSize=m),"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 N=S(P,[["render",D],["__scopeId","data-v-e6813cef"]]),R=e.defineComponent({name:"ZxtTable",components:{ZxtForm:V,ZxtPagination:N},props:{id:{type:String,default:""},columns:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},height:{type:[String,Number],default:""},formMode:{type:Boolean,default:!1},formColumns:{type:Array,default:()=>[]},initialFormData:{type:Object,default:()=>({})},rules:{type:Object,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"}},emits:["submit","reset","page-change","size-change"],setup(t,{emit:o}){const l=e.ref(null),n=e.ref(null),d=e.ref(t.pageSize),g=e.computed(()=>t.height==="full"?{height:"100%"}:{}),r=e.computed(()=>t.total>0?t.total:t.data.length),m=h=>{o("size-change",h)},p=h=>{o("page-change",h)};return{tableRef:l,formRef:n,containerStyle:g,onFormSubmit:h=>{o("submit",h)},onFormReset:()=>{o("reset")},getTableRef:()=>l.value,getFormRef:()=>n.value,pageSize:d,total:r,pageSizes:e.computed(()=>t.pageSizes),paginationLayout:e.computed(()=>t.paginationLayout),handleSizeChange:m,handlePageChange:p}}});function j(t,o,l,n,d,g){const r=e.resolveComponent("ZxtForm"),m=e.resolveComponent("el-table-column"),p=e.resolveComponent("el-table"),i=e.resolveComponent("ZxtPagination");return e.openBlock(),e.createElementBlock("div",{class:"zxt-table-container",style:e.normalizeStyle(t.containerStyle)},[t.formMode?(e.openBlock(),e.createBlock(r,{key:0,ref:"formRef","form-columns":t.formColumns,"initial-form-data":t.initialFormData,rules:t.rules,onSubmit:t.onFormSubmit,onReset:t.onFormReset},e.createSlots({"form-actions":e.withCtx(()=>[e.renderSlot(t.$slots,"form-actions",{},void 0,!0)]),_:2},[e.renderList(t.$slots,(s,y)=>({name:y,fn:e.withCtx(c=>[e.renderSlot(t.$slots,y,e.normalizeProps(e.guardReactiveProps(c)),void 0,!0)])}))]),1032,["form-columns","initial-form-data","rules","onSubmit","onReset"])):e.createCommentVNode("",!0),e.createVNode(p,e.mergeProps({ref:"tableRef",data:t.data,height:t.height},t.$attrs,{id:t.id}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,(s,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:y},[s.slot?(e.openBlock(),e.createBlock(m,e.mergeProps({key:1,ref_for:!0},s),{default:e.withCtx(c=>[e.renderSlot(t.$slots,s.slot,{row:c.row,index:c.$index},void 0,!0)]),_:2},1040)):(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,ref_for:!0},s),{default:e.withCtx(c=>[s.render?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.render),{key:0,row:c.row,column:s,index:c.$index},null,8,["row","column","index"])):s.formatter?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(s.formatter(c.row,s,c.row[s.prop])),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(c.row[s.prop]),1)],64))]),_:2},1040))],64))),128))]),_:3},16,["data","height","id"]),t.pageable?(e.openBlock(),e.createBlock(i,{key:1,"model-value":t.currentPage,"page-size":t.pageSize,"onUpdate:pageSize":o[0]||(o[0]=s=>t.pageSize=s),"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)],4)}const C=S(R,[["render",j],["__scopeId","data-v-3bee3ce2"]]);C.install=function(t){t.component(C.name,C)};const E=[b,k,C],T={install:t=>{E.forEach(o=>{t.component(o.name,o)})},MyButton:b,JsxButton:k,ZxtTable:C};f.JsxButton=k,f.MyButton=b,f.ZxtTable=C,f.default=T,Object.defineProperties(f,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|