@aplus-frontend/ui 0.0.22 → 0.0.24
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/group.vue.d.ts +1 -1
- package/es/src/check-card/group.vue.mjs +1 -1
- package/es/src/check-card/index.vue.d.ts +1 -1
- package/es/src/check-card/index.vue2.mjs +40 -36
- package/es/src/check-card/interface.d.ts +1 -1
- package/es/src/check-card/style/index.css +1 -0
- package/es/src/editable-table/form-item.vue.d.ts +755 -105
- package/es/src/editable-table/form-item.vue.mjs +80 -65
- package/es/src/editable-table/hooks/use-get-columns.mjs +27 -27
- package/es/src/editable-table/index.vue.d.ts +527 -112
- package/es/src/editable-table/index.vue.mjs +93 -78
- package/es/src/editable-table/interface.d.ts +11 -5
- 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/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/group.vue.d.ts +1 -1
- package/lib/src/check-card/group.vue.js +1 -1
- package/lib/src/check-card/index.vue.d.ts +1 -1
- package/lib/src/check-card/index.vue2.js +1 -1
- package/lib/src/check-card/interface.d.ts +1 -1
- package/lib/src/check-card/style/index.css +1 -0
- package/lib/src/editable-table/form-item.vue.d.ts +755 -105
- 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.d.ts +527 -112
- package/lib/src/editable-table/index.vue.js +1 -1
- package/lib/src/editable-table/interface.d.ts +11 -5
- 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/package.json +5 -5
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
3
|
-
import { ApForm as
|
|
4
|
-
import { cloneDeep 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
|
+
import { Table as Z } from "ant-design-vue";
|
|
3
|
+
import { ApForm as y } from "../ap-form/index.mjs";
|
|
4
|
+
import { isNumber as m, cloneDeep as p, omit as I } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
|
-
import { useInjectForm as
|
|
6
|
+
import { useInjectForm as ee } from "../ap-form/context.mjs";
|
|
7
7
|
import "./style/index.css";
|
|
8
|
-
import { isDef as
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
8
|
+
import { isDef as c } from "../utils/index.mjs";
|
|
9
|
+
import te from "./hooks/use-get-columns.mjs";
|
|
10
|
+
import { getColumnIsRequired as oe } from "./utils.mjs";
|
|
11
|
+
import { useNamespace as ae } from "../config-provider/hooks/use-namespace.mjs";
|
|
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: {
|
|
@@ -109,81 +110,95 @@ const pe = /* @__PURE__ */ P({
|
|
|
109
110
|
default: () => ({})
|
|
110
111
|
}
|
|
111
112
|
},
|
|
112
|
-
setup(
|
|
113
|
-
expose:
|
|
113
|
+
setup(R, {
|
|
114
|
+
expose: B
|
|
114
115
|
}) {
|
|
115
|
-
var
|
|
116
|
-
const
|
|
116
|
+
var h;
|
|
117
|
+
const l = R, {
|
|
117
118
|
formInstance: t,
|
|
118
|
-
model:
|
|
119
|
-
} =
|
|
120
|
-
|
|
121
|
-
var
|
|
122
|
-
d.value =
|
|
119
|
+
model: D
|
|
120
|
+
} = ee(), d = A(((h = o(D)) == null ? void 0 : h[l.name]) || []), F = O(), E = y.useWatch(l.name);
|
|
121
|
+
T(() => E.value, (e) => {
|
|
122
|
+
var a;
|
|
123
|
+
d.value = e, (a = l.onChange) == null || a.call(l, e);
|
|
123
124
|
});
|
|
124
125
|
const {
|
|
125
|
-
b:
|
|
126
|
-
em:
|
|
127
|
-
} =
|
|
128
|
-
function
|
|
129
|
-
var
|
|
130
|
-
const
|
|
131
|
-
|
|
126
|
+
b: f,
|
|
127
|
+
em: L
|
|
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)
|
|
133
|
+
return;
|
|
134
|
+
const r = [...o(d) || []];
|
|
135
|
+
c(a) ? r.splice(a, 0, {
|
|
136
|
+
...e || {}
|
|
137
|
+
}) : r.push({
|
|
138
|
+
...e || {}
|
|
139
|
+
}), (s = t == null ? void 0 : t.setFieldValue) == null || s.call(t, l.name, [...o(d) || [], e || {}]);
|
|
132
140
|
}
|
|
133
|
-
function
|
|
134
|
-
var
|
|
135
|
-
const
|
|
136
|
-
|
|
141
|
+
function k(e, a = "suffix") {
|
|
142
|
+
var g, x;
|
|
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)
|
|
145
|
+
return;
|
|
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);
|
|
137
148
|
}
|
|
138
|
-
function
|
|
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);
|
|
154
|
+
}
|
|
155
|
+
function j() {
|
|
139
156
|
return o(d);
|
|
140
157
|
}
|
|
141
|
-
function
|
|
142
|
-
var
|
|
143
|
-
return (
|
|
158
|
+
function z(e) {
|
|
159
|
+
var a;
|
|
160
|
+
return (a = o(d)) == null ? void 0 : a[e];
|
|
144
161
|
}
|
|
145
|
-
function
|
|
162
|
+
function P(e, a) {
|
|
146
163
|
var r;
|
|
147
|
-
const
|
|
148
|
-
e
|
|
149
|
-
...e
|
|
150
|
-
...
|
|
151
|
-
}, (r = t == null ? void 0 : t.setFieldValue) == null || r.call(t,
|
|
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]));
|
|
152
169
|
}
|
|
153
|
-
return
|
|
154
|
-
add:
|
|
155
|
-
remove:
|
|
156
|
-
getRowData:
|
|
157
|
-
getRowsData:
|
|
158
|
-
setRowData:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
170
|
+
return B({
|
|
171
|
+
add: S,
|
|
172
|
+
remove: _,
|
|
173
|
+
getRowData: z,
|
|
174
|
+
getRowsData: j,
|
|
175
|
+
setRowData: P,
|
|
176
|
+
addMultiple: k
|
|
177
|
+
}), (e, a) => (C(), K(o(y).FormItem, w(e.formItem, {
|
|
178
|
+
name: e.name,
|
|
179
|
+
label: e.label
|
|
162
180
|
}), {
|
|
163
|
-
default: i(() => [
|
|
164
|
-
class: [o(
|
|
165
|
-
columns: o(
|
|
181
|
+
default: i(() => [M(o(Z), w(o(I)(l, ["name", "maxLength"]), {
|
|
182
|
+
class: [o(f)(), o(v) === "admin" ? o(f)("admin") : null],
|
|
183
|
+
columns: o(N),
|
|
166
184
|
"data-source": d.value
|
|
167
|
-
}),
|
|
185
|
+
}), q({
|
|
168
186
|
headerCell: i(({
|
|
169
|
-
column:
|
|
170
|
-
}) => {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
class: q(o(B)("header-cell", "required"))
|
|
176
|
-
}, "*", 2), x("span", null, A(e.title), 1)], 64)) : G("", !0)];
|
|
177
|
-
}),
|
|
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)]),
|
|
178
193
|
_: 2
|
|
179
|
-
}, [
|
|
194
|
+
}, [J(F, (n, r) => ({
|
|
180
195
|
name: r,
|
|
181
|
-
fn: i((
|
|
196
|
+
fn: i((u) => [Q(e.$slots, r, X(Y(u || {})))])
|
|
182
197
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
183
198
|
_: 3
|
|
184
199
|
}, 16, ["name", "label"]));
|
|
185
200
|
}
|
|
186
201
|
});
|
|
187
202
|
export {
|
|
188
|
-
|
|
203
|
+
xe as default
|
|
189
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;
|