@aplus-frontend/ui 0.0.23 → 0.0.25
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/es/src/ap-field/date/index.vue.mjs +26 -26
- package/es/src/ap-field/number/helper.d.ts +9 -0
- package/es/src/ap-field/number/helper.mjs +20 -11
- package/es/src/ap-table/ap-table.vue.d.ts +2137 -112
- package/es/src/ap-table/ap-table.vue.mjs +31 -30
- package/es/src/check-card/style/index.css +1 -0
- package/es/src/editable-table/form-item.vue.mjs +61 -63
- package/es/src/editable-table/hooks/use-get-columns.mjs +27 -27
- package/es/src/editable-table/index.vue.mjs +63 -65
- package/es/src/editable-table/utils.d.ts +13 -0
- package/es/src/editable-table/utils.mjs +26 -6
- package/es/src/theme/check-card/index.css +1 -0
- package/es/src/work-order-modal/createWorkOrder.mjs +2 -1
- package/es/src/work-order-modal/work-order-modal.vue.d.ts +2 -0
- package/es/src/work-order-modal/work-order-modal.vue.mjs +51 -46
- package/lib/src/ap-field/date/index.vue.js +1 -1
- package/lib/src/ap-field/number/helper.d.ts +9 -0
- package/lib/src/ap-field/number/helper.js +1 -1
- package/lib/src/ap-table/ap-table.vue.d.ts +2137 -112
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/check-card/style/index.css +1 -0
- package/lib/src/editable-table/form-item.vue.js +1 -1
- package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
- package/lib/src/editable-table/index.vue.js +1 -1
- package/lib/src/editable-table/utils.d.ts +13 -0
- package/lib/src/editable-table/utils.js +1 -1
- package/lib/src/theme/check-card/index.css +1 -0
- package/lib/src/work-order-modal/createWorkOrder.js +1 -1
- package/lib/src/work-order-modal/work-order-modal.vue.d.ts +2 -0
- package/lib/src/work-order-modal/work-order-modal.vue.js +1 -1
- package/package.json +3 -3
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { defineComponent as ae, useSlots as te, computed as s, createVNode as d, mergeProps as f, unref as l, watch as oe, openBlock as i, createElementBlock as m, normalizeClass as F, normalizeStyle as R, createSlots as k, withCtx as p, Fragment as re, renderList as L, createBlock as le, resolveDynamicComponent as ne, renderSlot as
|
|
1
|
+
import { defineComponent as ae, useSlots as te, computed as s, createVNode as d, mergeProps as f, unref as l, watch as oe, openBlock as i, createElementBlock as m, normalizeClass as F, normalizeStyle as R, createSlots as k, withCtx as p, Fragment as re, renderList as L, createBlock as le, resolveDynamicComponent as ne, renderSlot as w, createCommentVNode as E, createElementVNode as O, toDisplayString as se, normalizeProps as de, guardReactiveProps as ue } from "vue";
|
|
2
2
|
import { Typography as ie, Table as pe, Tooltip as ce } from "ant-design-vue";
|
|
3
3
|
import { useToken as fe } from "ant-design-vue/es/theme/internal";
|
|
4
4
|
import { ApForm as me } from "../ap-form/index.mjs";
|
|
5
|
-
import { apTableRenderItemMap as ge, noRenderAsFormItemValueList as
|
|
5
|
+
import { apTableRenderItemMap as ge, noRenderAsFormItemValueList as V, apTableFormItemMap as ye } from "./constants.mjs";
|
|
6
6
|
import "../config-provider/index.mjs";
|
|
7
7
|
import { useTablePaging as be } from "./hooks/use-table-paging.mjs";
|
|
8
|
-
import { omit as
|
|
8
|
+
import { omit as z, isUndefined as x, isBoolean as he } from "lodash-unified";
|
|
9
9
|
import "./style/ap-table.css";
|
|
10
10
|
import { QuestionCircleOutlined as Ce } from "@ant-design/icons-vue";
|
|
11
|
-
import { apColumnToColumn as Se, getTableRenderType as Fe, getTableRenderProps as Re, getColumnOrder as
|
|
11
|
+
import { apColumnToColumn as Se, getTableRenderType as Fe, getTableRenderProps as Re, getColumnOrder as N, updateFormProps as we, getFieldProps as xe, getPlaceholder as Te } from "./utils.mjs";
|
|
12
12
|
import Be from "./hooks/use-table-content-height.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
13
|
+
import { getRawDisplayValue as Pe } from "../editable-table/utils.mjs";
|
|
14
|
+
import { useLocale as ve } from "../config-provider/hooks/use-locale.mjs";
|
|
15
|
+
import { useNamespace as Ie } from "../config-provider/hooks/use-namespace.mjs";
|
|
16
|
+
import { useGlobalConfig as ke } from "../config-provider/hooks/use-global-config.mjs";
|
|
17
|
+
const Le = {
|
|
17
18
|
key: 0
|
|
18
|
-
},
|
|
19
|
+
}, Qe = /* @__PURE__ */ ae({
|
|
19
20
|
name: "ApTable",
|
|
20
21
|
__name: "ap-table",
|
|
21
22
|
props: {
|
|
@@ -132,19 +133,19 @@ const ke = {
|
|
|
132
133
|
setup(D, {
|
|
133
134
|
expose: W
|
|
134
135
|
}) {
|
|
135
|
-
const o = D,
|
|
136
|
+
const o = D, T = te(), [, j] = fe(), {
|
|
136
137
|
t: _
|
|
137
|
-
} =
|
|
138
|
+
} = ve(), {
|
|
138
139
|
e: g,
|
|
139
140
|
b: u
|
|
140
|
-
} =
|
|
141
|
+
} = Ie("ap-table"), A = ke("uiMode", "aplus"), {
|
|
141
142
|
height: M,
|
|
142
143
|
contentRef: q
|
|
143
144
|
} = Be(), y = s(() => {
|
|
144
145
|
var t;
|
|
145
146
|
let e = ((t = o.columns) == null ? void 0 : t.filter((a) => !a.hideInTable)) || [];
|
|
146
147
|
return e = e.map((a) => ({
|
|
147
|
-
...
|
|
148
|
+
...z(Se(a), ["ellipsis"]),
|
|
148
149
|
customRender({
|
|
149
150
|
value: r,
|
|
150
151
|
...n
|
|
@@ -166,11 +167,11 @@ const ke = {
|
|
|
166
167
|
})), e;
|
|
167
168
|
}), B = s(() => {
|
|
168
169
|
var e, t, a;
|
|
169
|
-
return ((a = (t = (e = o.columns) == null ? void 0 : e.filter((r) => !r.hideInSearch && r.dataIndex && (r.valueType || r.customRenderFormItem) && !
|
|
170
|
-
let C =
|
|
171
|
-
return
|
|
170
|
+
return ((a = (t = (e = o.columns) == null ? void 0 : e.filter((r) => !r.hideInSearch && r.dataIndex && (r.valueType || r.customRenderFormItem) && !V.includes(r.valueType))) == null ? void 0 : t.sort((r, n) => {
|
|
171
|
+
let C = N(r.order);
|
|
172
|
+
return N(n.order) - C;
|
|
172
173
|
})) == null ? void 0 : a.map((r) => {
|
|
173
|
-
const n =
|
|
174
|
+
const n = we(r, xe(r.fieldProps, {}));
|
|
174
175
|
return {
|
|
175
176
|
...r,
|
|
176
177
|
fieldProps: {
|
|
@@ -178,7 +179,7 @@ const ke = {
|
|
|
178
179
|
name: r.dataIndex,
|
|
179
180
|
...n || {},
|
|
180
181
|
// 格式化placeholder
|
|
181
|
-
placeholder:
|
|
182
|
+
placeholder: Te(_, r.valueType, n == null ? void 0 : n.placeholder)
|
|
182
183
|
}
|
|
183
184
|
};
|
|
184
185
|
})) || [];
|
|
@@ -221,7 +222,7 @@ const ke = {
|
|
|
221
222
|
if ((e = o.columns) != null && e.some((t) => t.ellipsis))
|
|
222
223
|
return "fixed";
|
|
223
224
|
}), U = s(() => {
|
|
224
|
-
const e = l(c), t =
|
|
225
|
+
const e = l(c), t = x(o.dataSource) ? e : {
|
|
225
226
|
...e,
|
|
226
227
|
dataSource: o.dataSource,
|
|
227
228
|
onChange: o.onChange
|
|
@@ -229,13 +230,13 @@ const ke = {
|
|
|
229
230
|
return {
|
|
230
231
|
...o,
|
|
231
232
|
...t,
|
|
232
|
-
loading:
|
|
233
|
+
loading: x(o.loading) ? l(c).loading : o.loading,
|
|
233
234
|
pagination: o.pagination === !1 ? !1 : l(c).pagination,
|
|
234
235
|
scroll: l(G)
|
|
235
236
|
};
|
|
236
237
|
}), J = s(() => [u(), o.card ? null : u("wrapper"), o.adaptive ? u("adaptive") : null].filter(Boolean));
|
|
237
238
|
function X(e, t, a) {
|
|
238
|
-
return
|
|
239
|
+
return V.includes(e.valueType) ? a : e.copyable || e.ellipsis ? d(ie.Paragraph, {
|
|
239
240
|
copyable: e.copyable ? {
|
|
240
241
|
text: t,
|
|
241
242
|
tooltip: !1
|
|
@@ -246,7 +247,7 @@ const ke = {
|
|
|
246
247
|
...e.ellipsis,
|
|
247
248
|
tooltip: t
|
|
248
249
|
} : !1,
|
|
249
|
-
content: e.ellipsis ? t : a
|
|
250
|
+
content: e.ellipsis ? Pe(e, t) : a
|
|
250
251
|
}, null) : a;
|
|
251
252
|
}
|
|
252
253
|
oe(() => l(h).loading, (e) => {
|
|
@@ -269,7 +270,7 @@ const ke = {
|
|
|
269
270
|
dataSource: s(() => l(h).records)
|
|
270
271
|
}), (e, t) => (i(), m("div", {
|
|
271
272
|
class: F(J.value)
|
|
272
|
-
}, [l(
|
|
273
|
+
}, [l(x)(e.dataSource) && e.searchForm !== !1 && B.value.length > 0 ? (i(), m("div", {
|
|
273
274
|
key: 0,
|
|
274
275
|
class: F(e.card ? l(g)("search-wrapper") : null),
|
|
275
276
|
style: R(e.searchFormWrapperStyle)
|
|
@@ -288,16 +289,16 @@ const ke = {
|
|
|
288
289
|
span: a.span
|
|
289
290
|
}), null, 16, ["span"]))), 128))]),
|
|
290
291
|
_: 2
|
|
291
|
-
}, [
|
|
292
|
+
}, [T.searchFormExtra ? {
|
|
292
293
|
name: "extra",
|
|
293
|
-
fn: p(() => [
|
|
294
|
+
fn: p(() => [w(e.$slots, "searchFormExtra")]),
|
|
294
295
|
key: "0"
|
|
295
296
|
} : void 0]), 1040, ["onSubmit", "onReset", "submit-loading"])], 6)) : E("", !0), O("div", {
|
|
296
297
|
ref_key: "contentRef",
|
|
297
298
|
ref: q,
|
|
298
299
|
class: F([l(g)("table-wrapper"), e.card ? l(g)("table-wrapper-card") : null]),
|
|
299
300
|
style: R(e.tableWrapperStyle)
|
|
300
|
-
}, [
|
|
301
|
+
}, [w(e.$slots, "title"), d(l(pe), f({
|
|
301
302
|
class: l(A) === "admin" ? l(u)("table-admin") : l(u)("table")
|
|
302
303
|
}, U.value, {
|
|
303
304
|
"table-layout": Q.value,
|
|
@@ -307,7 +308,7 @@ const ke = {
|
|
|
307
308
|
headerCell: p(({
|
|
308
309
|
column: a,
|
|
309
310
|
title: r
|
|
310
|
-
}) => [a.tooltip ? (i(), m("span",
|
|
311
|
+
}) => [a.tooltip ? (i(), m("span", Le, [O("span", null, se(r), 1), d(l(ce), {
|
|
311
312
|
title: a.tooltip,
|
|
312
313
|
placement: "bottom"
|
|
313
314
|
}, {
|
|
@@ -320,12 +321,12 @@ const ke = {
|
|
|
320
321
|
_: 2
|
|
321
322
|
}, 1032, ["title"])])) : E("", !0)]),
|
|
322
323
|
_: 2
|
|
323
|
-
}, [L(l(
|
|
324
|
+
}, [L(l(z)(T, ["title", "searchFormExtra"]), (a, r) => ({
|
|
324
325
|
name: r,
|
|
325
|
-
fn: p((n) => [
|
|
326
|
+
fn: p((n) => [w(e.$slots, r, de(ue(n || {})))])
|
|
326
327
|
}))]), 1040, ["class", "table-layout", "onChange", "columns"])], 6)], 2));
|
|
327
328
|
}
|
|
328
329
|
});
|
|
329
330
|
export {
|
|
330
|
-
|
|
331
|
+
Qe as default
|
|
331
332
|
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { defineComponent as V, ref as A, unref as o, useSlots as O, watch as T, openBlock as C, createBlock as K, mergeProps as w, withCtx as
|
|
1
|
+
import { defineComponent as V, ref as A, unref as o, useSlots as O, watch as T, openBlock as C, createBlock as K, mergeProps as w, withCtx as i, createVNode as M, createSlots as q, createElementBlock as G, Fragment as H, createElementVNode as b, normalizeClass as W, toDisplayString as U, createCommentVNode as $, renderList as J, renderSlot as Q, normalizeProps as X, guardReactiveProps as Y } from "vue";
|
|
2
2
|
import { Table as Z } from "ant-design-vue";
|
|
3
3
|
import { ApForm as y } from "../ap-form/index.mjs";
|
|
4
|
-
import { isNumber as
|
|
4
|
+
import { isNumber as m, cloneDeep as p, omit as I } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
6
|
import { useInjectForm as ee } from "../ap-form/context.mjs";
|
|
7
7
|
import "./style/index.css";
|
|
8
|
-
import { isDef as
|
|
8
|
+
import { isDef as c } from "../utils/index.mjs";
|
|
9
9
|
import te from "./hooks/use-get-columns.mjs";
|
|
10
|
+
import { getColumnIsRequired as oe } from "./utils.mjs";
|
|
10
11
|
import { useNamespace as ae } from "../config-provider/hooks/use-namespace.mjs";
|
|
11
|
-
import { useGlobalConfig as
|
|
12
|
-
const
|
|
12
|
+
import { useGlobalConfig as le } from "../config-provider/hooks/use-global-config.mjs";
|
|
13
|
+
const xe = /* @__PURE__ */ V({
|
|
13
14
|
name: "EditableTableInner",
|
|
14
15
|
__name: "form-item",
|
|
15
16
|
props: {
|
|
@@ -113,94 +114,91 @@ const he = /* @__PURE__ */ V({
|
|
|
113
114
|
expose: B
|
|
114
115
|
}) {
|
|
115
116
|
var h;
|
|
116
|
-
const
|
|
117
|
+
const l = R, {
|
|
117
118
|
formInstance: t,
|
|
118
119
|
model: D
|
|
119
|
-
} = ee(),
|
|
120
|
+
} = ee(), d = A(((h = o(D)) == null ? void 0 : h[l.name]) || []), F = O(), E = y.useWatch(l.name);
|
|
120
121
|
T(() => E.value, (e) => {
|
|
121
|
-
var
|
|
122
|
-
|
|
122
|
+
var a;
|
|
123
|
+
d.value = e, (a = l.onChange) == null || a.call(l, e);
|
|
123
124
|
});
|
|
124
125
|
const {
|
|
125
|
-
b:
|
|
126
|
+
b: f,
|
|
126
127
|
em: L
|
|
127
|
-
} = ae("editable-table"), v =
|
|
128
|
-
function S(e,
|
|
129
|
-
var
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
128
|
+
} = ae("editable-table"), v = le("uiMode", "aplus"), N = te(l);
|
|
129
|
+
function S(e, a) {
|
|
130
|
+
var u, s;
|
|
131
|
+
const n = ((u = o(d)) == null ? void 0 : u.length) || 0;
|
|
132
|
+
if (c(l.maxLength) && n >= l.maxLength)
|
|
132
133
|
return;
|
|
133
|
-
const
|
|
134
|
-
|
|
134
|
+
const r = [...o(d) || []];
|
|
135
|
+
c(a) ? r.splice(a, 0, {
|
|
135
136
|
...e || {}
|
|
136
|
-
}) :
|
|
137
|
+
}) : r.push({
|
|
137
138
|
...e || {}
|
|
138
|
-
}), (
|
|
139
|
+
}), (s = t == null ? void 0 : t.setFieldValue) == null || s.call(t, l.name, [...o(d) || [], e || {}]);
|
|
139
140
|
}
|
|
140
|
-
function k(e,
|
|
141
|
+
function k(e, a = "suffix") {
|
|
141
142
|
var g, x;
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
143
|
+
const n = ((g = o(d)) == null ? void 0 : g.length) || 0, r = m(e) ? e : e.length;
|
|
144
|
+
if (c(l.maxLength) && n + r > l.maxLength)
|
|
144
145
|
return;
|
|
145
|
-
const
|
|
146
|
-
|
|
146
|
+
const u = [...o(d) || []], s = m(e) ? new Array(e).fill({}) : p(e);
|
|
147
|
+
a === "suffix" ? u.push(...s) : u.unshift(...s), (x = t == null ? void 0 : t.setFieldValue) == null || x.call(t, l.name, u);
|
|
147
148
|
}
|
|
148
|
-
function
|
|
149
|
-
var
|
|
150
|
-
let
|
|
151
|
-
const
|
|
152
|
-
|
|
149
|
+
function _(e) {
|
|
150
|
+
var r;
|
|
151
|
+
let a = p(o(d) || []);
|
|
152
|
+
const n = m(e) ? [e] : e;
|
|
153
|
+
a = a.filter((u, s) => !n.includes(s)), (r = t == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, a);
|
|
153
154
|
}
|
|
154
|
-
function
|
|
155
|
-
return o(
|
|
155
|
+
function j() {
|
|
156
|
+
return o(d);
|
|
156
157
|
}
|
|
157
|
-
function
|
|
158
|
-
var
|
|
159
|
-
return (
|
|
158
|
+
function z(e) {
|
|
159
|
+
var a;
|
|
160
|
+
return (a = o(d)) == null ? void 0 : a[e];
|
|
160
161
|
}
|
|
161
|
-
function
|
|
162
|
-
var
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
...
|
|
166
|
-
...
|
|
167
|
-
}, (
|
|
162
|
+
function P(e, a) {
|
|
163
|
+
var r;
|
|
164
|
+
const n = p(o(d));
|
|
165
|
+
n[e] && (n[e] = {
|
|
166
|
+
...n[e],
|
|
167
|
+
...a
|
|
168
|
+
}, (r = t == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, [...n]));
|
|
168
169
|
}
|
|
169
170
|
return B({
|
|
170
171
|
add: S,
|
|
171
|
-
remove:
|
|
172
|
-
getRowData:
|
|
173
|
-
getRowsData:
|
|
174
|
-
setRowData:
|
|
172
|
+
remove: _,
|
|
173
|
+
getRowData: z,
|
|
174
|
+
getRowsData: j,
|
|
175
|
+
setRowData: P,
|
|
175
176
|
addMultiple: k
|
|
176
|
-
}), (e,
|
|
177
|
+
}), (e, a) => (C(), K(o(y).FormItem, w(e.formItem, {
|
|
177
178
|
name: e.name,
|
|
178
179
|
label: e.label
|
|
179
180
|
}), {
|
|
180
|
-
default:
|
|
181
|
-
class: [o(
|
|
181
|
+
default: i(() => [M(o(Z), w(o(I)(l, ["name", "maxLength"]), {
|
|
182
|
+
class: [o(f)(), o(v) === "admin" ? o(f)("admin") : null],
|
|
182
183
|
columns: o(N),
|
|
183
|
-
"data-source":
|
|
184
|
+
"data-source": d.value
|
|
184
185
|
}), q({
|
|
185
|
-
headerCell:
|
|
186
|
-
column:
|
|
187
|
-
}) => {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
class: W(o(L)("header-cell", "required"))
|
|
193
|
-
}, "*", 2), b("span", null, U(a.title), 1)], 64)) : $("", !0)];
|
|
194
|
-
}),
|
|
186
|
+
headerCell: i(({
|
|
187
|
+
column: n
|
|
188
|
+
}) => [o(oe)(n) ? (C(), G(H, {
|
|
189
|
+
key: 0
|
|
190
|
+
}, [b("span", {
|
|
191
|
+
class: W(o(L)("header-cell", "required"))
|
|
192
|
+
}, "*", 2), b("span", null, U(n.title), 1)], 64)) : $("", !0)]),
|
|
195
193
|
_: 2
|
|
196
|
-
}, [J(F, (
|
|
197
|
-
name:
|
|
198
|
-
fn:
|
|
194
|
+
}, [J(F, (n, r) => ({
|
|
195
|
+
name: r,
|
|
196
|
+
fn: i((u) => [Q(e.$slots, r, X(Y(u || {})))])
|
|
199
197
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
200
198
|
_: 3
|
|
201
199
|
}, 16, ["name", "label"]));
|
|
202
200
|
}
|
|
203
201
|
});
|
|
204
202
|
export {
|
|
205
|
-
|
|
203
|
+
xe as default
|
|
206
204
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { omit as h, isFunction as C, isBoolean as
|
|
3
|
-
import { getEditableComponent as
|
|
4
|
-
import { updateFormProps as
|
|
1
|
+
import { computed as b, createVNode as i, mergeProps as x } from "vue";
|
|
2
|
+
import { omit as h, isFunction as C, isBoolean as R } from "lodash-unified";
|
|
3
|
+
import { getEditableComponent as F, getRawDisplayValue as T } from "../utils.mjs";
|
|
4
|
+
import { updateFormProps as I, getFieldProps as N, getPlaceholder as V, getTableRenderProps as w } from "../../ap-table/utils.mjs";
|
|
5
5
|
import "../../config-provider/index.mjs";
|
|
6
|
-
import { apTableRenderItemMap as
|
|
7
|
-
import { Typography as
|
|
8
|
-
import { useLocale as
|
|
6
|
+
import { apTableRenderItemMap as L, noRenderAsFormItemValueList as M } from "../../ap-table/constants.mjs";
|
|
7
|
+
import { Typography as A } from "ant-design-vue";
|
|
8
|
+
import { useLocale as B } from "../../config-provider/hooks/use-locale.mjs";
|
|
9
9
|
const q = (t) => {
|
|
10
10
|
const {
|
|
11
11
|
t: u
|
|
12
|
-
} =
|
|
13
|
-
let
|
|
14
|
-
return
|
|
12
|
+
} = B(), f = b(() => {
|
|
13
|
+
let l = t.columns;
|
|
14
|
+
return l ? (l = l.map((e) => ({
|
|
15
15
|
...h(e, ["ellipsis"]),
|
|
16
16
|
customRender({
|
|
17
17
|
value: n,
|
|
@@ -20,32 +20,32 @@ const q = (t) => {
|
|
|
20
20
|
const c = C(e.editable) ? e.editable(a.text, a.record, a.index) : !!e.editable;
|
|
21
21
|
let r;
|
|
22
22
|
if (c) {
|
|
23
|
-
const d =
|
|
23
|
+
const d = F(e.valueType), o = I(e, N(e.fieldProps, {
|
|
24
24
|
value: n,
|
|
25
25
|
...a
|
|
26
26
|
})), s = {};
|
|
27
|
-
t.onFieldChange && (s[`onUpdate:${
|
|
27
|
+
t.onFieldChange && (s[`onUpdate:${o.valuePropName || "value"}`] = (y) => {
|
|
28
28
|
var p;
|
|
29
|
-
return (p = t.onFieldChange) == null ? void 0 : p.call(t, a.index, e.dataIndex,
|
|
29
|
+
return (p = t.onFieldChange) == null ? void 0 : p.call(t, a.index, e.dataIndex, y);
|
|
30
30
|
});
|
|
31
|
-
const
|
|
31
|
+
const g = {
|
|
32
32
|
name: [t.name, a.index, e.dataIndex],
|
|
33
|
-
...
|
|
33
|
+
...o || {},
|
|
34
34
|
// 格式化placeholder
|
|
35
|
-
placeholder:
|
|
35
|
+
placeholder: V(u, e.valueType, o == null ? void 0 : o.placeholder),
|
|
36
36
|
field: {
|
|
37
37
|
style: "width: 100%",
|
|
38
|
-
...(
|
|
38
|
+
...(o == null ? void 0 : o.field) || {},
|
|
39
39
|
...s
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
r = i(d,
|
|
42
|
+
r = i(d, g, null);
|
|
43
43
|
} else {
|
|
44
|
-
const d =
|
|
44
|
+
const d = L[e.valueType], o = w(e, {
|
|
45
45
|
value: n,
|
|
46
46
|
...a
|
|
47
47
|
});
|
|
48
|
-
r = m(e, n, i(d, x(
|
|
48
|
+
r = m(e, n, i(d, x(o, {
|
|
49
49
|
mode: "read"
|
|
50
50
|
}), null));
|
|
51
51
|
}
|
|
@@ -56,21 +56,21 @@ const q = (t) => {
|
|
|
56
56
|
originalNode: r
|
|
57
57
|
}) : r;
|
|
58
58
|
}
|
|
59
|
-
})),
|
|
59
|
+
})), l) : [];
|
|
60
60
|
});
|
|
61
|
-
function m(
|
|
62
|
-
return
|
|
63
|
-
copyable:
|
|
61
|
+
function m(l, e, n) {
|
|
62
|
+
return M.includes(l.valueType) ? n : l.copyable || l.ellipsis ? i(A.Paragraph, {
|
|
63
|
+
copyable: l.copyable ? {
|
|
64
64
|
text: e,
|
|
65
65
|
tooltip: !1
|
|
66
66
|
} : !1,
|
|
67
|
-
ellipsis:
|
|
67
|
+
ellipsis: l.ellipsis ? R(l.ellipsis) ? {
|
|
68
68
|
tooltip: e
|
|
69
69
|
} : {
|
|
70
|
-
...
|
|
70
|
+
...l.ellipsis,
|
|
71
71
|
tooltip: e
|
|
72
72
|
} : !1,
|
|
73
|
-
content:
|
|
73
|
+
content: l.ellipsis ? T(l, e) : n
|
|
74
74
|
}, null) : n;
|
|
75
75
|
}
|
|
76
76
|
return f;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as T, useSlots as K, ref as M, watch as q, unref as a, openBlock as w, createBlock as G, withCtx as c, createVNode as y, mergeProps as H, createSlots as U, createElementBlock as W, Fragment as $, createElementVNode as v, normalizeClass as J, toDisplayString as Q, createCommentVNode as X, renderList as Y, renderSlot as Z, normalizeProps as ee, guardReactiveProps as te } from "vue";
|
|
2
2
|
import { Table as ae } from "ant-design-vue";
|
|
3
|
-
import { ApForm as
|
|
4
|
-
import { isNumber as
|
|
3
|
+
import { ApForm as f } from "../ap-form/index.mjs";
|
|
4
|
+
import { isNumber as p, cloneDeep as x, omit as ne } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
6
|
import "../hooks/index.mjs";
|
|
7
|
-
import { isDef as
|
|
8
|
-
import oe from "./
|
|
7
|
+
import { isDef as h } from "../utils/index.mjs";
|
|
8
|
+
import { getColumnIsRequired as oe } from "./utils.mjs";
|
|
9
|
+
import le from "./hooks/use-get-columns.mjs";
|
|
9
10
|
import "./style/index.css";
|
|
10
|
-
import { useNamespace as
|
|
11
|
-
import { useGlobalConfig as
|
|
12
|
-
import { useControllableValue as
|
|
13
|
-
const
|
|
11
|
+
import { useNamespace as re } from "../config-provider/hooks/use-namespace.mjs";
|
|
12
|
+
import { useGlobalConfig as se } from "../config-provider/hooks/use-global-config.mjs";
|
|
13
|
+
import { useControllableValue as ue } from "../hooks/useControllableValue.mjs";
|
|
14
|
+
const be = /* @__PURE__ */ T({
|
|
14
15
|
name: "EditableTable",
|
|
15
16
|
__name: "index",
|
|
16
17
|
props: {
|
|
@@ -116,104 +117,101 @@ const ye = /* @__PURE__ */ I({
|
|
|
116
117
|
const l = b, {
|
|
117
118
|
b: g,
|
|
118
119
|
em: F
|
|
119
|
-
} =
|
|
120
|
-
value:
|
|
120
|
+
} = re("editable-table"), D = se("uiMode", "aplus"), _ = K(), E = B, {
|
|
121
|
+
value: s,
|
|
121
122
|
updateValue: L
|
|
122
|
-
} =
|
|
123
|
+
} = ue(l, E), u = M(), k = f.useWatch(l.name, u);
|
|
123
124
|
q(() => k.value, (e) => {
|
|
124
125
|
var n;
|
|
125
126
|
L(e), (n = l.onChange) == null || n.call(l, e);
|
|
126
127
|
});
|
|
127
|
-
const N =
|
|
128
|
+
const N = le(l);
|
|
128
129
|
function S() {
|
|
129
130
|
var e;
|
|
130
|
-
(e =
|
|
131
|
+
(e = u.value) == null || e.resetFields();
|
|
131
132
|
}
|
|
132
133
|
async function V(e, n) {
|
|
133
134
|
var t;
|
|
134
|
-
const
|
|
135
|
-
return
|
|
135
|
+
const o = await ((t = u.value) == null ? void 0 : t.validateFields(e, n));
|
|
136
|
+
return o == null ? void 0 : o[l.name];
|
|
136
137
|
}
|
|
137
|
-
function
|
|
138
|
-
var r,
|
|
139
|
-
const
|
|
140
|
-
if (
|
|
138
|
+
function z(e, n) {
|
|
139
|
+
var r, d, i;
|
|
140
|
+
const o = ((r = a(s)) == null ? void 0 : r.length) || 0;
|
|
141
|
+
if (h(l.maxLength) && o >= l.maxLength)
|
|
141
142
|
return;
|
|
142
|
-
const t = [...
|
|
143
|
-
|
|
143
|
+
const t = [...a(s) || []];
|
|
144
|
+
h(n) ? t.splice(n, 0, {
|
|
144
145
|
...e || {}
|
|
145
146
|
}) : t.push({
|
|
146
147
|
...e || {}
|
|
147
|
-
}), (
|
|
148
|
+
}), (i = (d = u.value) == null ? void 0 : d.setFieldValue) == null || i.call(d, l.name, t);
|
|
148
149
|
}
|
|
149
|
-
function
|
|
150
|
-
var
|
|
151
|
-
const
|
|
152
|
-
if (
|
|
150
|
+
function P(e, n = "suffix") {
|
|
151
|
+
var i, m, C;
|
|
152
|
+
const o = ((i = a(s)) == null ? void 0 : i.length) || 0, t = p(e) ? e : e.length;
|
|
153
|
+
if (h(l.maxLength) && o + t > l.maxLength)
|
|
153
154
|
return;
|
|
154
|
-
const r = [...
|
|
155
|
-
n === "suffix" ? r.push(...
|
|
155
|
+
const r = [...a(s) || []], d = p(e) ? new Array(e).fill({}) : x(e);
|
|
156
|
+
n === "suffix" ? r.push(...d) : r.unshift(...d), (C = (m = u.value) == null ? void 0 : m.setFieldValue) == null || C.call(m, l.name, r);
|
|
156
157
|
}
|
|
157
158
|
function j(e) {
|
|
158
159
|
var t, r;
|
|
159
|
-
let n =
|
|
160
|
-
const
|
|
161
|
-
n = n.filter((
|
|
160
|
+
let n = x(a(s) || []);
|
|
161
|
+
const o = p(e) ? [e] : e;
|
|
162
|
+
n = n.filter((d, i) => !o.includes(i)), (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, n);
|
|
162
163
|
}
|
|
163
164
|
function A() {
|
|
164
|
-
return
|
|
165
|
+
return a(s);
|
|
165
166
|
}
|
|
166
|
-
function
|
|
167
|
+
function I(e) {
|
|
167
168
|
var n;
|
|
168
|
-
return (n =
|
|
169
|
+
return (n = a(s)) == null ? void 0 : n[e];
|
|
169
170
|
}
|
|
170
|
-
function
|
|
171
|
+
function O(e, n) {
|
|
171
172
|
var t, r;
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
...
|
|
173
|
+
const o = x(a(s));
|
|
174
|
+
o[e] && (o[e] = {
|
|
175
|
+
...o[e],
|
|
175
176
|
...n
|
|
176
|
-
}, (r = (t =
|
|
177
|
+
}, (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, [...o]));
|
|
177
178
|
}
|
|
178
179
|
return R({
|
|
179
180
|
resetFields: S,
|
|
180
181
|
validateFields: V,
|
|
181
|
-
add:
|
|
182
|
+
add: z,
|
|
182
183
|
remove: j,
|
|
183
|
-
getRowData:
|
|
184
|
+
getRowData: I,
|
|
184
185
|
getRowsData: A,
|
|
185
|
-
setRowData:
|
|
186
|
-
addMultiple:
|
|
187
|
-
}), (e, n) => (w(), G(
|
|
186
|
+
setRowData: O,
|
|
187
|
+
addMultiple: P
|
|
188
|
+
}), (e, n) => (w(), G(a(f), {
|
|
188
189
|
"initial-values": {
|
|
189
|
-
[l.name]:
|
|
190
|
+
[l.name]: a(s)
|
|
190
191
|
},
|
|
191
192
|
ref_key: "formRef",
|
|
192
|
-
ref:
|
|
193
|
+
ref: u
|
|
193
194
|
}, {
|
|
194
|
-
default:
|
|
195
|
+
default: c(() => [y(a(f).FormItem, {
|
|
195
196
|
name: e.name,
|
|
196
197
|
"no-style": ""
|
|
197
198
|
}, {
|
|
198
|
-
default:
|
|
199
|
-
class: [
|
|
200
|
-
columns:
|
|
201
|
-
"data-source":
|
|
199
|
+
default: c(() => [y(a(ae), H(a(ne)(l, ["name", "value", "onUpdate:value", "maxLength"]), {
|
|
200
|
+
class: [a(g)(), a(D) === "admin" ? a(g)("admin") : null],
|
|
201
|
+
columns: a(N),
|
|
202
|
+
"data-source": a(s)
|
|
202
203
|
}), U({
|
|
203
|
-
headerCell:
|
|
204
|
-
column:
|
|
205
|
-
}) => {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
class: J(o(F)("header-cell", "required"))
|
|
211
|
-
}, "*", 2), v("span", null, Q(a.title), 1)], 64)) : X("", !0)];
|
|
212
|
-
}),
|
|
204
|
+
headerCell: c(({
|
|
205
|
+
column: o
|
|
206
|
+
}) => [a(oe)(o) ? (w(), W($, {
|
|
207
|
+
key: 0
|
|
208
|
+
}, [v("span", {
|
|
209
|
+
class: J(a(F)("header-cell", "required"))
|
|
210
|
+
}, "*", 2), v("span", null, Q(o.title), 1)], 64)) : X("", !0)]),
|
|
213
211
|
_: 2
|
|
214
|
-
}, [Y(_, (
|
|
212
|
+
}, [Y(_, (o, t) => ({
|
|
215
213
|
name: t,
|
|
216
|
-
fn:
|
|
214
|
+
fn: c((r) => [Z(e.$slots, t, ee(te(r || {})))])
|
|
217
215
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
218
216
|
_: 3
|
|
219
217
|
}, 8, ["name"])]),
|
|
@@ -222,5 +220,5 @@ const ye = /* @__PURE__ */ I({
|
|
|
222
220
|
}
|
|
223
221
|
});
|
|
224
222
|
export {
|
|
225
|
-
|
|
223
|
+
be as default
|
|
226
224
|
};
|