@aplus-frontend/ui 0.1.11 → 0.1.13
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-download/utils/getFileInfo.mjs +6 -6
- package/es/src/editable-table/form-item.vue.mjs +10 -8
- package/es/src/editable-table/index.vue.mjs +89 -84
- package/lib/src/ap-download/utils/getFileInfo.js +1 -1
- package/lib/src/editable-table/form-item.vue.js +1 -1
- package/lib/src/editable-table/index.vue.js +1 -1
- package/package.json +1 -1
|
@@ -6,13 +6,13 @@ function K(t, r) {
|
|
|
6
6
|
if (Array.isArray(r))
|
|
7
7
|
return r.map((p) => ({
|
|
8
8
|
path: p == null ? void 0 : p[y.pathKey],
|
|
9
|
-
fileName: p == null ? void 0 : p[y.
|
|
9
|
+
fileName: p == null ? void 0 : p[y.nameKey]
|
|
10
10
|
}));
|
|
11
11
|
if (typeof r == "object")
|
|
12
12
|
return [
|
|
13
13
|
{
|
|
14
14
|
path: r == null ? void 0 : r[y.pathKey],
|
|
15
|
-
fileName: r == null ? void 0 : r[y.
|
|
15
|
+
fileName: r == null ? void 0 : r[y.nameKey]
|
|
16
16
|
}
|
|
17
17
|
];
|
|
18
18
|
} else if (typeof t == "object") {
|
|
@@ -21,13 +21,13 @@ function K(t, r) {
|
|
|
21
21
|
if (Array.isArray(r))
|
|
22
22
|
return r.map((p) => ({
|
|
23
23
|
path: p == null ? void 0 : p[(t == null ? void 0 : t.pathKey) || y.pathKey],
|
|
24
|
-
fileName: p == null ? void 0 : p[(t == null ? void 0 : t.nameKey) || y.
|
|
24
|
+
fileName: p == null ? void 0 : p[(t == null ? void 0 : t.nameKey) || y.nameKey]
|
|
25
25
|
}));
|
|
26
26
|
if (typeof r == "object")
|
|
27
27
|
return [
|
|
28
28
|
{
|
|
29
29
|
path: r == null ? void 0 : r[(t == null ? void 0 : t.pathKey) || y.pathKey],
|
|
30
|
-
fileName: r == null ? void 0 : r[(t == null ? void 0 : t.nameKey) || y.
|
|
30
|
+
fileName: r == null ? void 0 : r[(t == null ? void 0 : t.nameKey) || y.nameKey]
|
|
31
31
|
}
|
|
32
32
|
];
|
|
33
33
|
} else
|
|
@@ -35,8 +35,8 @@ function K(t, r) {
|
|
|
35
35
|
}
|
|
36
36
|
function g(t, r) {
|
|
37
37
|
t.length === 4 && (t = `#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`);
|
|
38
|
-
const p = parseInt(t.slice(1, 3), 16), s = parseInt(t.slice(3, 5), 16),
|
|
39
|
-
return `#${p.toString(16).padStart(2, "0")}${s.toString(16).padStart(2, "0")}${
|
|
38
|
+
const p = parseInt(t.slice(1, 3), 16), s = parseInt(t.slice(3, 5), 16), n = parseInt(t.slice(5, 7), 16), u = Math.round(r * 255).toString(16).padStart(2, "0");
|
|
39
|
+
return `#${p.toString(16).padStart(2, "0")}${s.toString(16).padStart(2, "0")}${n.toString(16).padStart(2, "0")}${u}`;
|
|
40
40
|
}
|
|
41
41
|
export {
|
|
42
42
|
K as getFileInfo,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as V, ref as x, unref as t, useSlots as A, watch as O, openBlock as C, createBlock as K, mergeProps as w, withCtx as
|
|
1
|
+
import { defineComponent as V, ref as x, unref as t, useSlots as A, watch as O, openBlock as C, createBlock as K, mergeProps as w, withCtx as u, createVNode as q, createSlots as H, createElementBlock as I, Fragment as W, createElementVNode as b, normalizeClass as $, toDisplayString as G, createCommentVNode as M, renderList as U, renderSlot as J, normalizeProps as Q, guardReactiveProps as X } from "vue";
|
|
2
2
|
import { Table as Y } 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 f, omit as Z } 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";
|
|
@@ -120,6 +120,8 @@ const ge = /* @__PURE__ */ V({
|
|
|
120
120
|
O(() => F.value, (e) => {
|
|
121
121
|
var o;
|
|
122
122
|
r.value = e, (o = n.onChange) == null || o.call(n, e);
|
|
123
|
+
}, {
|
|
124
|
+
deep: !0
|
|
123
125
|
});
|
|
124
126
|
const {
|
|
125
127
|
b: E,
|
|
@@ -139,15 +141,15 @@ const ge = /* @__PURE__ */ V({
|
|
|
139
141
|
}
|
|
140
142
|
function S(e, o = "suffix") {
|
|
141
143
|
var g;
|
|
142
|
-
const a = ((g = t(r)) == null ? void 0 : g.length) || 0, s =
|
|
144
|
+
const a = ((g = t(r)) == null ? void 0 : g.length) || 0, s = m(e) ? e : e.length;
|
|
143
145
|
if (c(n.maxLength) && a + s > n.maxLength)
|
|
144
146
|
return;
|
|
145
|
-
const d = [...t(r) || []], h =
|
|
147
|
+
const d = [...t(r) || []], h = m(e) ? new Array(e).fill({}) : f(e);
|
|
146
148
|
o === "suffix" ? d.push(...h) : d.unshift(...h), l == null || l.setFieldValue(n.name, d);
|
|
147
149
|
}
|
|
148
150
|
function _(e) {
|
|
149
151
|
let o = f(t(r) || []);
|
|
150
|
-
const a =
|
|
152
|
+
const a = m(e) ? [e] : e;
|
|
151
153
|
o = o.filter((s, d) => !a.includes(d)), l == null || l.setFieldValue(n.name, o);
|
|
152
154
|
}
|
|
153
155
|
function T() {
|
|
@@ -181,14 +183,14 @@ const ge = /* @__PURE__ */ V({
|
|
|
181
183
|
name: e.name,
|
|
182
184
|
label: e.label
|
|
183
185
|
}), {
|
|
184
|
-
default:
|
|
186
|
+
default: u(() => [q(t(Y), w(t(Z)(n, ["name", "maxLength", "onChange"]), {
|
|
185
187
|
class: t(E)(),
|
|
186
188
|
columns: t(N),
|
|
187
189
|
"data-source": r.value,
|
|
188
190
|
ref_key: "tableRef",
|
|
189
191
|
ref: i
|
|
190
192
|
}), H({
|
|
191
|
-
headerCell:
|
|
193
|
+
headerCell: u(({
|
|
192
194
|
column: a
|
|
193
195
|
}) => [t(ae)(a) ? (C(), I(W, {
|
|
194
196
|
key: 0
|
|
@@ -198,7 +200,7 @@ const ge = /* @__PURE__ */ V({
|
|
|
198
200
|
_: 2
|
|
199
201
|
}, [U(v, (a, s) => ({
|
|
200
202
|
name: s,
|
|
201
|
-
fn:
|
|
203
|
+
fn: u((d) => [J(e.$slots, s, Q(X(d || {})))])
|
|
202
204
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
203
205
|
_: 3
|
|
204
206
|
}, 16, ["name", "label"]));
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
1
|
+
import { defineComponent as M, useSlots as U, ref as y, watch as W, unref as l, openBlock as w, createBlock as $, withCtx as c, createVNode as v, mergeProps as G, createSlots as J, createElementBlock as Q, Fragment as X, createElementVNode as b, normalizeClass as Y, toDisplayString as Z, createCommentVNode as ee, renderList as te, renderSlot as ae, normalizeProps as ne, guardReactiveProps as oe } from "vue";
|
|
2
|
+
import { Table as le } from "ant-design-vue";
|
|
3
3
|
import { ApForm as f } from "../ap-form/index.mjs";
|
|
4
|
-
import { isNumber as p, cloneDeep as h, omit as
|
|
4
|
+
import { isArray as R, isNumber as p, cloneDeep as h, omit as re } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
6
|
import "../hooks/index.mjs";
|
|
7
7
|
import { isDef as x } from "../utils/index.mjs";
|
|
8
|
-
import { scrollToRowIndex as
|
|
9
|
-
import
|
|
8
|
+
import { scrollToRowIndex as se, getColumnIsRequired as ue } from "./utils.mjs";
|
|
9
|
+
import de from "./hooks/use-get-columns.mjs";
|
|
10
10
|
import "./style/index.css";
|
|
11
|
-
import { useNamespace as
|
|
12
|
-
import { useControllableValue as
|
|
13
|
-
const
|
|
11
|
+
import { useNamespace as ie } from "../config-provider/hooks/use-namespace.mjs";
|
|
12
|
+
import { useControllableValue as me } from "../hooks/useControllableValue.mjs";
|
|
13
|
+
const Be = /* @__PURE__ */ M({
|
|
14
14
|
name: "EditableTable",
|
|
15
15
|
__name: "index",
|
|
16
16
|
props: {
|
|
@@ -109,116 +109,121 @@ const be = /* @__PURE__ */ q({
|
|
|
109
109
|
onFieldChange: {}
|
|
110
110
|
},
|
|
111
111
|
emits: ["update:value"],
|
|
112
|
-
setup(
|
|
113
|
-
expose:
|
|
114
|
-
emit:
|
|
112
|
+
setup(B, {
|
|
113
|
+
expose: F,
|
|
114
|
+
emit: D
|
|
115
115
|
}) {
|
|
116
|
-
const
|
|
117
|
-
b:
|
|
118
|
-
em:
|
|
119
|
-
} =
|
|
116
|
+
const o = B, {
|
|
117
|
+
b: _,
|
|
118
|
+
em: N
|
|
119
|
+
} = ie("editable-table"), k = U(), E = D, g = y(), {
|
|
120
120
|
value: s,
|
|
121
121
|
updateValue: L
|
|
122
|
-
} =
|
|
123
|
-
|
|
124
|
-
var
|
|
125
|
-
L(e), (
|
|
122
|
+
} = me(o, E), u = y(), S = f.useWatch(o.name, u);
|
|
123
|
+
W(() => S.value, (e) => {
|
|
124
|
+
var n;
|
|
125
|
+
L(e), (n = o.onChange) == null || n.call(o, e);
|
|
126
|
+
}, {
|
|
127
|
+
deep: !0
|
|
126
128
|
});
|
|
127
|
-
const
|
|
128
|
-
function
|
|
129
|
+
const V = de(o);
|
|
130
|
+
function A() {
|
|
129
131
|
var e;
|
|
130
132
|
(e = u.value) == null || e.resetFields();
|
|
131
133
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
function T(e) {
|
|
135
|
+
return e ? (R(e) ? e : [e]).map((t) => R(t) ? [o.name, ...t] : [o.name, t]) : void 0;
|
|
136
|
+
}
|
|
137
|
+
async function z(e, n) {
|
|
138
|
+
var a;
|
|
139
|
+
const t = await ((a = u.value) == null ? void 0 : a.validateFields(T(e), n));
|
|
140
|
+
return t == null ? void 0 : t[o.name];
|
|
136
141
|
}
|
|
137
|
-
function
|
|
142
|
+
function I(e, n) {
|
|
138
143
|
var r, d, i;
|
|
139
|
-
const
|
|
140
|
-
if (x(
|
|
144
|
+
const t = ((r = l(s)) == null ? void 0 : r.length) || 0;
|
|
145
|
+
if (x(o.maxLength) && t >= o.maxLength)
|
|
141
146
|
return;
|
|
142
|
-
const
|
|
143
|
-
x(
|
|
147
|
+
const a = [...l(s) || []];
|
|
148
|
+
x(n) ? a.splice(n, 0, {
|
|
144
149
|
...e || {}
|
|
145
|
-
}) :
|
|
150
|
+
}) : a.push({
|
|
146
151
|
...e || {}
|
|
147
|
-
}), (i = (d = u.value) == null ? void 0 : d.setFieldValue) == null || i.call(d,
|
|
152
|
+
}), (i = (d = u.value) == null ? void 0 : d.setFieldValue) == null || i.call(d, o.name, a);
|
|
148
153
|
}
|
|
149
|
-
function
|
|
154
|
+
function P(e, n = "suffix") {
|
|
150
155
|
var i, m, C;
|
|
151
|
-
const
|
|
152
|
-
if (x(
|
|
156
|
+
const t = ((i = l(s)) == null ? void 0 : i.length) || 0, a = p(e) ? e : e.length;
|
|
157
|
+
if (x(o.maxLength) && t + a > o.maxLength)
|
|
153
158
|
return;
|
|
154
|
-
const r = [...
|
|
155
|
-
|
|
159
|
+
const r = [...l(s) || []], d = p(e) ? new Array(e).fill({}) : h(e);
|
|
160
|
+
n === "suffix" ? r.push(...d) : r.unshift(...d), (C = (m = u.value) == null ? void 0 : m.setFieldValue) == null || C.call(m, o.name, r);
|
|
156
161
|
}
|
|
157
|
-
function
|
|
158
|
-
var
|
|
159
|
-
let
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
+
function j(e) {
|
|
163
|
+
var a, r;
|
|
164
|
+
let n = h(l(s) || []);
|
|
165
|
+
const t = p(e) ? [e] : e;
|
|
166
|
+
n = n.filter((d, i) => !t.includes(i)), (r = (a = u.value) == null ? void 0 : a.setFieldValue) == null || r.call(a, o.name, n);
|
|
162
167
|
}
|
|
163
|
-
function
|
|
164
|
-
return
|
|
168
|
+
function O() {
|
|
169
|
+
return l(s);
|
|
165
170
|
}
|
|
166
|
-
function
|
|
167
|
-
var
|
|
168
|
-
return (
|
|
171
|
+
function K(e) {
|
|
172
|
+
var n;
|
|
173
|
+
return (n = l(s)) == null ? void 0 : n[e];
|
|
169
174
|
}
|
|
170
|
-
function
|
|
171
|
-
var
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
...
|
|
175
|
-
...
|
|
176
|
-
}, (r = (
|
|
175
|
+
function q(e, n) {
|
|
176
|
+
var a, r;
|
|
177
|
+
const t = h(l(s));
|
|
178
|
+
t[e] && (t[e] = {
|
|
179
|
+
...t[e],
|
|
180
|
+
...n
|
|
181
|
+
}, (r = (a = u.value) == null ? void 0 : a.setFieldValue) == null || r.call(a, o.name, [...t]));
|
|
177
182
|
}
|
|
178
|
-
function
|
|
179
|
-
var
|
|
180
|
-
const
|
|
181
|
-
|
|
183
|
+
function H(e, n) {
|
|
184
|
+
var a;
|
|
185
|
+
const t = e === "end" ? s.value.length - 1 : e;
|
|
186
|
+
se(t, (a = g.value) == null ? void 0 : a.$el, n);
|
|
182
187
|
}
|
|
183
|
-
return
|
|
184
|
-
resetFields:
|
|
185
|
-
validateFields:
|
|
186
|
-
add:
|
|
187
|
-
remove:
|
|
188
|
-
getRowData:
|
|
189
|
-
getRowsData:
|
|
190
|
-
setRowData:
|
|
191
|
-
addMultiple:
|
|
192
|
-
scrollTo:
|
|
193
|
-
}), (e,
|
|
188
|
+
return F({
|
|
189
|
+
resetFields: A,
|
|
190
|
+
validateFields: z,
|
|
191
|
+
add: I,
|
|
192
|
+
remove: j,
|
|
193
|
+
getRowData: K,
|
|
194
|
+
getRowsData: O,
|
|
195
|
+
setRowData: q,
|
|
196
|
+
addMultiple: P,
|
|
197
|
+
scrollTo: H
|
|
198
|
+
}), (e, n) => (w(), $(l(f), {
|
|
194
199
|
"initial-values": {
|
|
195
|
-
[
|
|
200
|
+
[o.name]: l(s)
|
|
196
201
|
},
|
|
197
202
|
ref_key: "formRef",
|
|
198
203
|
ref: u
|
|
199
204
|
}, {
|
|
200
|
-
default: c(() => [v(
|
|
205
|
+
default: c(() => [v(l(f).FormItem, {
|
|
201
206
|
name: e.name,
|
|
202
207
|
"no-style": ""
|
|
203
208
|
}, {
|
|
204
|
-
default: c(() => [v(
|
|
205
|
-
class:
|
|
206
|
-
columns:
|
|
207
|
-
"data-source":
|
|
209
|
+
default: c(() => [v(l(le), G(l(re)(o, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
|
|
210
|
+
class: l(_)(),
|
|
211
|
+
columns: l(V),
|
|
212
|
+
"data-source": l(s),
|
|
208
213
|
ref_key: "tableRef",
|
|
209
214
|
ref: g
|
|
210
|
-
}),
|
|
215
|
+
}), J({
|
|
211
216
|
headerCell: c(({
|
|
212
|
-
column:
|
|
213
|
-
}) => [
|
|
217
|
+
column: t
|
|
218
|
+
}) => [l(ue)(t) ? (w(), Q(X, {
|
|
214
219
|
key: 0
|
|
215
220
|
}, [b("span", {
|
|
216
|
-
class:
|
|
217
|
-
}, "*", 2), b("span", null,
|
|
221
|
+
class: Y(l(N)("header-cell", "required"))
|
|
222
|
+
}, "*", 2), b("span", null, Z(t.title), 1)], 64)) : ee("", !0)]),
|
|
218
223
|
_: 2
|
|
219
|
-
}, [
|
|
220
|
-
name:
|
|
221
|
-
fn: c((r) => [
|
|
224
|
+
}, [te(k, (t, a) => ({
|
|
225
|
+
name: a,
|
|
226
|
+
fn: c((r) => [ae(e.$slots, a, ne(oe(r || {})))])
|
|
222
227
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
223
228
|
_: 3
|
|
224
229
|
}, 8, ["name"])]),
|
|
@@ -227,5 +232,5 @@ const be = /* @__PURE__ */ q({
|
|
|
227
232
|
}
|
|
228
233
|
});
|
|
229
234
|
export {
|
|
230
|
-
|
|
235
|
+
Be as default
|
|
231
236
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("../interface.js");function s(t,r){if(t===!0){if(typeof r=="string")return r;if(Array.isArray(r))return r.map(p=>({path:p==null?void 0:p[y.ApDownLoadNeedNameKeyDefault.pathKey],fileName:p==null?void 0:p[y.ApDownLoadNeedNameKeyDefault.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("../interface.js");function s(t,r){if(t===!0){if(typeof r=="string")return r;if(Array.isArray(r))return r.map(p=>({path:p==null?void 0:p[y.ApDownLoadNeedNameKeyDefault.pathKey],fileName:p==null?void 0:p[y.ApDownLoadNeedNameKeyDefault.nameKey]}));if(typeof r=="object")return[{path:r==null?void 0:r[y.ApDownLoadNeedNameKeyDefault.pathKey],fileName:r==null?void 0:r[y.ApDownLoadNeedNameKeyDefault.nameKey]}]}else if(typeof t=="object"){if(typeof r=="string")return r;if(Array.isArray(r))return r.map(p=>({path:p==null?void 0:p[(t==null?void 0:t.pathKey)||y.ApDownLoadNeedNameKeyDefault.pathKey],fileName:p==null?void 0:p[(t==null?void 0:t.nameKey)||y.ApDownLoadNeedNameKeyDefault.nameKey]}));if(typeof r=="object")return[{path:r==null?void 0:r[(t==null?void 0:t.pathKey)||y.ApDownLoadNeedNameKeyDefault.pathKey],fileName:r==null?void 0:r[(t==null?void 0:t.nameKey)||y.ApDownLoadNeedNameKeyDefault.nameKey]}]}else return r}function K(t,r){t.length===4&&(t=`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`);const p=parseInt(t.slice(1,3),16),n=parseInt(t.slice(3,5),16),u=parseInt(t.slice(5,7),16),o=Math.round(r*255).toString(16).padStart(2,"0");return`#${p.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}${u.toString(16).padStart(2,"0")}${o}`}exports.getFileInfo=s;exports.getHexWithOpacity=K;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),L=require("ant-design-vue"),h=require("../ap-form/index.js"),d=require("lodash-unified");require("../config-provider/index.js");const _=require("../ap-form/context.js");require("./style/index.css");const f=require("../utils/index.js"),P=require("./hooks/use-get-columns.js"),g=require("./utils.js"),T=require("../config-provider/hooks/use-namespace.js"),V=e.defineComponent({name:"EditableTableInner",__name:"form-item",props:{dropdownPrefixCls:{},pagination:{type:[Boolean,Object],default:!1},loading:{type:[Boolean,Object],default:void 0},size:{default:"middle"},bordered:{type:Boolean,default:!1},locale:{},onResizeColumn:{},rowSelection:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!0},prefixCls:{},rowKey:{default:"key"},tableLayout:{default:"fixed"},rowClassName:{},title:{},footer:{},id:{},showHeader:{type:Boolean,default:!0},components:{},customRow:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean],default:!1},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean,default:!1},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean,default:!1},indentSize:{default:15},expandIconColumnIndex:{},showExpandColumn:{type:Boolean,default:!0},expandedRowClassName:{},childrenColumnName:{default:"children"},rowExpandable:{},sticky:{type:[Boolean,Object]},transformCellText:{},columns:{},value:{},defaultValue:{},"onUpdate:value":{},onChange:{},maxLength:{},onFieldChange:{},label:{},name:{},formItem:{default:()=>({})}},setup(x,{expose:C}){var i;const a=x,{internalInstance:l,model:b}=_.useInjectForm(),r=e.ref(((i=e.unref(b))==null?void 0:i[a.name])||[]),w=e.useSlots(),y=h.ApForm.useWatch(a.name);e.watch(()=>y.value,t=>{var n;r.value=t,(n=a.onChange)==null||n.call(a,t)});const{b:R,em:D}=T.useNamespace("editable-table"),c=e.ref(),B=P.default(a);function q(t,n){var s;const o=((s=e.unref(r))==null?void 0:s.length)||0;if(f.isDef(a.maxLength)&&o>=a.maxLength)return;const u=[...e.unref(r)||[]];f.isDef(n)?u.splice(n,0,{...t||{}}):u.push({...t||{}}),l==null||l.setFieldValue(a.name,[...e.unref(r)||[],t||{}])}function v(t,n="suffix"){var p;const o=((p=e.unref(r))==null?void 0:p.length)||0,u=d.isNumber(t)?t:t.length;if(f.isDef(a.maxLength)&&o+u>a.maxLength)return;const s=[...e.unref(r)||[]],m=d.isNumber(t)?new Array(t).fill({}):d.cloneDeep(t);n==="suffix"?s.push(...m):s.unshift(...m),l==null||l.setFieldValue(a.name,s)}function N(t){let n=d.cloneDeep(e.unref(r)||[]);const o=d.isNumber(t)?[t]:t;n=n.filter((u,s)=>!o.includes(s)),l==null||l.setFieldValue(a.name,n)}function F(){return e.unref(r)}function E(t){var n;return(n=e.unref(r))==null?void 0:n[t]}function S(t,n){const o=d.cloneDeep(e.unref(r));o[t]&&(o[t]={...o[t],...n},l==null||l.setFieldValue(a.name,[...o]))}function k(t,n){var u;const o=t==="end"?r.value.length-1:t;g.scrollToRowIndex(o,(u=c.value)==null?void 0:u.$el,n)}return C({add:q,remove:N,getRowData:E,getRowsData:F,setRowData:S,addMultiple:v,scrollTo:k}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(h.ApForm).FormItem,e.mergeProps(t.formItem,{name:t.name,label:t.label}),{default:e.withCtx(()=>[e.createVNode(e.unref(L.Table),e.mergeProps(e.unref(d.omit)(a,["name","maxLength","onChange"]),{class:e.unref(R)(),columns:e.unref(B),"data-source":r.value,ref_key:"tableRef",ref:c}),e.createSlots({headerCell:e.withCtx(({column:o})=>[e.unref(g.getColumnIsRequired)(o)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(D)("header-cell","required"))},"*",2),e.createElementVNode("span",null,e.toDisplayString(o.title),1)],64)):e.createCommentVNode("",!0)]),_:2},[e.renderList(w,(o,u)=>({name:u,fn:e.withCtx(s=>[e.renderSlot(t.$slots,u,e.normalizeProps(e.guardReactiveProps(s||{})))])}))]),1040,["class","columns","data-source"])]),_:3},16,["name","label"]))}});exports.default=V;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),L=require("ant-design-vue"),h=require("../ap-form/index.js"),d=require("lodash-unified");require("../config-provider/index.js");const _=require("../ap-form/context.js");require("./style/index.css");const f=require("../utils/index.js"),P=require("./hooks/use-get-columns.js"),g=require("./utils.js"),T=require("../config-provider/hooks/use-namespace.js"),V=e.defineComponent({name:"EditableTableInner",__name:"form-item",props:{dropdownPrefixCls:{},pagination:{type:[Boolean,Object],default:!1},loading:{type:[Boolean,Object],default:void 0},size:{default:"middle"},bordered:{type:Boolean,default:!1},locale:{},onResizeColumn:{},rowSelection:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!0},prefixCls:{},rowKey:{default:"key"},tableLayout:{default:"fixed"},rowClassName:{},title:{},footer:{},id:{},showHeader:{type:Boolean,default:!0},components:{},customRow:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean],default:!1},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean,default:!1},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean,default:!1},indentSize:{default:15},expandIconColumnIndex:{},showExpandColumn:{type:Boolean,default:!0},expandedRowClassName:{},childrenColumnName:{default:"children"},rowExpandable:{},sticky:{type:[Boolean,Object]},transformCellText:{},columns:{},value:{},defaultValue:{},"onUpdate:value":{},onChange:{},maxLength:{},onFieldChange:{},label:{},name:{},formItem:{default:()=>({})}},setup(x,{expose:C}){var i;const a=x,{internalInstance:l,model:b}=_.useInjectForm(),r=e.ref(((i=e.unref(b))==null?void 0:i[a.name])||[]),w=e.useSlots(),y=h.ApForm.useWatch(a.name);e.watch(()=>y.value,t=>{var n;r.value=t,(n=a.onChange)==null||n.call(a,t)},{deep:!0});const{b:R,em:D}=T.useNamespace("editable-table"),c=e.ref(),B=P.default(a);function q(t,n){var s;const o=((s=e.unref(r))==null?void 0:s.length)||0;if(f.isDef(a.maxLength)&&o>=a.maxLength)return;const u=[...e.unref(r)||[]];f.isDef(n)?u.splice(n,0,{...t||{}}):u.push({...t||{}}),l==null||l.setFieldValue(a.name,[...e.unref(r)||[],t||{}])}function v(t,n="suffix"){var p;const o=((p=e.unref(r))==null?void 0:p.length)||0,u=d.isNumber(t)?t:t.length;if(f.isDef(a.maxLength)&&o+u>a.maxLength)return;const s=[...e.unref(r)||[]],m=d.isNumber(t)?new Array(t).fill({}):d.cloneDeep(t);n==="suffix"?s.push(...m):s.unshift(...m),l==null||l.setFieldValue(a.name,s)}function N(t){let n=d.cloneDeep(e.unref(r)||[]);const o=d.isNumber(t)?[t]:t;n=n.filter((u,s)=>!o.includes(s)),l==null||l.setFieldValue(a.name,n)}function F(){return e.unref(r)}function E(t){var n;return(n=e.unref(r))==null?void 0:n[t]}function S(t,n){const o=d.cloneDeep(e.unref(r));o[t]&&(o[t]={...o[t],...n},l==null||l.setFieldValue(a.name,[...o]))}function k(t,n){var u;const o=t==="end"?r.value.length-1:t;g.scrollToRowIndex(o,(u=c.value)==null?void 0:u.$el,n)}return C({add:q,remove:N,getRowData:E,getRowsData:F,setRowData:S,addMultiple:v,scrollTo:k}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(h.ApForm).FormItem,e.mergeProps(t.formItem,{name:t.name,label:t.label}),{default:e.withCtx(()=>[e.createVNode(e.unref(L.Table),e.mergeProps(e.unref(d.omit)(a,["name","maxLength","onChange"]),{class:e.unref(R)(),columns:e.unref(B),"data-source":r.value,ref_key:"tableRef",ref:c}),e.createSlots({headerCell:e.withCtx(({column:o})=>[e.unref(g.getColumnIsRequired)(o)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(D)("header-cell","required"))},"*",2),e.createElementVNode("span",null,e.toDisplayString(o.title),1)],64)):e.createCommentVNode("",!0)]),_:2},[e.renderList(w,(o,u)=>({name:u,fn:e.withCtx(s=>[e.renderSlot(t.$slots,u,e.normalizeProps(e.guardReactiveProps(s||{})))])}))]),1040,["class","columns","data-source"])]),_:3},16,["name","label"]))}});exports.default=V;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),j=require("ant-design-vue"),m=require("../ap-form/index.js"),s=require("lodash-unified");require("../config-provider/index.js");require("../hooks/index.js");const p=require("../utils/index.js"),g=require("./utils.js"),z=require("./hooks/use-get-columns.js");require("./style/index.css");const I=require("../config-provider/hooks/use-namespace.js"),O=require("../hooks/useControllableValue.js"),M=e.defineComponent({name:"EditableTable",__name:"index",props:{dropdownPrefixCls:{},pagination:{type:[Boolean,Object],default:!1},loading:{type:[Boolean,Object],default:void 0},size:{default:"middle"},bordered:{type:Boolean,default:!1},locale:{},onResizeColumn:{},rowSelection:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!0},prefixCls:{},rowKey:{default:"key"},tableLayout:{default:"fixed"},rowClassName:{},title:{},footer:{},id:{},showHeader:{type:Boolean,default:!0},components:{},customRow:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean],default:!1},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean,default:!1},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean,default:!1},indentSize:{default:15},expandIconColumnIndex:{},showExpandColumn:{type:Boolean,default:!0},expandedRowClassName:{},childrenColumnName:{default:"children"},rowExpandable:{},sticky:{type:[Boolean,Object]},transformCellText:{},columns:{},value:{},defaultValue:{},"onUpdate:value":{},onChange:{},maxLength:{},name:{default:"ap-editable-table-inner-name"},onFieldChange:{}},emits:["update:value"],setup(C,{expose:w,emit:y}){const l=C,{b,em:v}=I.useNamespace("editable-table"),R=e.useSlots(),D=y,h=e.ref(),{value:u,updateValue:B}=O.useControllableValue(l,D),i=e.ref(),F=m.ApForm.useWatch(l.name,i);e.watch(()=>F.value,n=>{var o;B(n),(o=l.onChange)==null||o.call(l,n)},{deep:!0});const N=z.default(l);function q(){var n;(n=i.value)==null||n.resetFields()}function _(n){return n?(s.isArray(n)?n:[n]).map(t=>s.isArray(t)?[l.name,...t]:[l.name,t]):void 0}async function V(n,o){var a;const t=await((a=i.value)==null?void 0:a.validateFields(_(n),o));return t==null?void 0:t[l.name]}function k(n,o){var r,d,c;const t=((r=e.unref(u))==null?void 0:r.length)||0;if(p.isDef(l.maxLength)&&t>=l.maxLength)return;const a=[...e.unref(u)||[]];p.isDef(o)?a.splice(o,0,{...n||{}}):a.push({...n||{}}),(c=(d=i.value)==null?void 0:d.setFieldValue)==null||c.call(d,l.name,a)}function A(n,o="suffix"){var c,f,x;const t=((c=e.unref(u))==null?void 0:c.length)||0,a=s.isNumber(n)?n:n.length;if(p.isDef(l.maxLength)&&t+a>l.maxLength)return;const r=[...e.unref(u)||[]],d=s.isNumber(n)?new Array(n).fill({}):s.cloneDeep(n);o==="suffix"?r.push(...d):r.unshift(...d),(x=(f=i.value)==null?void 0:f.setFieldValue)==null||x.call(f,l.name,r)}function E(n){var a,r;let o=s.cloneDeep(e.unref(u)||[]);const t=s.isNumber(n)?[n]:n;o=o.filter((d,c)=>!t.includes(c)),(r=(a=i.value)==null?void 0:a.setFieldValue)==null||r.call(a,l.name,o)}function S(){return e.unref(u)}function L(n){var o;return(o=e.unref(u))==null?void 0:o[n]}function T(n,o){var a,r;const t=s.cloneDeep(e.unref(u));t[n]&&(t[n]={...t[n],...o},(r=(a=i.value)==null?void 0:a.setFieldValue)==null||r.call(a,l.name,[...t]))}function P(n,o){var a;const t=n==="end"?u.value.length-1:n;g.scrollToRowIndex(t,(a=h.value)==null?void 0:a.$el,o)}return w({resetFields:q,validateFields:V,add:k,remove:E,getRowData:L,getRowsData:S,setRowData:T,addMultiple:A,scrollTo:P}),(n,o)=>(e.openBlock(),e.createBlock(e.unref(m.ApForm),{"initial-values":{[l.name]:e.unref(u)},ref_key:"formRef",ref:i},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ApForm).FormItem,{name:n.name,"no-style":""},{default:e.withCtx(()=>[e.createVNode(e.unref(j.Table),e.mergeProps(e.unref(s.omit)(l,["name","value","onUpdate:value","maxLength","onChange"]),{class:e.unref(b)(),columns:e.unref(N),"data-source":e.unref(u),ref_key:"tableRef",ref:h}),e.createSlots({headerCell:e.withCtx(({column:t})=>[e.unref(g.getColumnIsRequired)(t)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(v)("header-cell","required"))},"*",2),e.createElementVNode("span",null,e.toDisplayString(t.title),1)],64)):e.createCommentVNode("",!0)]),_:2},[e.renderList(R,(t,a)=>({name:a,fn:e.withCtx(r=>[e.renderSlot(n.$slots,a,e.normalizeProps(e.guardReactiveProps(r||{})))])}))]),1040,["class","columns","data-source"])]),_:3},8,["name"])]),_:3},8,["initial-values"]))}});exports.default=M;
|