@aplus-frontend/ui 0.6.0-beta.3 → 0.6.0-beta.5
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-action/group/index.vue.d.ts +1 -1
- package/es/src/ap-action/item-dropdown/index.vue.d.ts +1 -1
- package/es/src/ap-field/date/index.vue.d.ts +1 -1
- package/es/src/ap-field/date-range/index.vue.d.ts +1 -1
- package/es/src/ap-field/number/index.vue.d.ts +1 -1
- package/es/src/ap-field/rate/index.vue.d.ts +1 -1
- package/es/src/ap-field/select/index.vue.d.ts +1 -1
- package/es/src/ap-field/tree-select/index.vue.d.ts +1 -1
- package/es/src/ap-form/item/index.vue.d.ts +1 -1
- package/es/src/ap-form/items/number/index.vue.d.ts +8 -8
- package/es/src/ap-form/items/select/index.vue.d.ts +8 -8
- package/es/src/ap-form/items/text/index.vue.d.ts +2 -2
- package/es/src/ap-form/items/text/password.vue.d.ts +2 -2
- package/es/src/ap-form/items/tree-select/index.vue.d.ts +8 -8
- package/es/src/ap-form/render/item.vue.d.ts +1 -1
- package/es/src/ap-grid/editable/form-item.vue.mjs +91 -83
- package/es/src/ap-grid/editable/index.vue.mjs +86 -78
- package/es/src/ap-grid/index.vue.mjs +39 -35
- package/es/src/ap-info-layout/ap-info-layout-admin/ApInfoLayoutAdmin.vue.d.ts +1 -1
- package/es/src/ap-table/ap-table.vue2.mjs +22 -18
- package/es/src/ap-table/constants.d.ts +30 -30
- package/es/src/ap-table/utils.d.ts +14 -14
- package/es/src/business/ap-expand-alert/ApExpandAlert.vue.d.ts +3 -3
- package/es/src/business/ap-expand-alert/ApExpandAlert.vue2.mjs +25 -25
- package/es/src/business/ap-expand-alert/index.d.ts +4 -4
- package/es/src/business/ap-label/ApLabel.d.ts +1 -1
- package/es/src/business/ap-label/index.d.ts +3 -3
- package/es/src/business/ap-ladder/ApLadder.d.ts +1 -1
- package/es/src/business/ap-ladder/index.d.ts +3 -3
- package/es/src/business/ap-status/interface.d.ts +1 -1
- package/es/src/business/ap-view/ap-view.vue2.mjs +60 -58
- package/es/src/business/ap-view/components/menu-list-content.vue2.mjs +79 -73
- package/es/src/business/ap-view/hooks/use-view-provide.d.ts +1 -0
- package/es/src/business/batch-input-group/form-item.vue.d.ts +1 -1
- package/es/src/business/batch-input-group/index.vue.d.ts +1 -1
- package/es/src/check-card/group.vue.d.ts +1 -1
- package/es/src/config-provider/config-provider-props.d.ts +0 -5
- package/es/src/config-provider/config-provider-props.mjs +0 -4
- package/es/src/config-provider/config-provider.d.ts +0 -138
- package/es/src/config-provider/config-provider.mjs +21 -26
- package/es/src/config-provider/hooks/use-global-config.d.ts +0 -5
- package/es/src/config-provider/index.d.ts +0 -652
- package/es/src/editable-table/form-item.vue.d.ts +2 -14
- package/es/src/editable-table/form-item.vue.mjs +84 -76
- package/es/src/editable-table/index.vue.d.ts +2 -16
- package/es/src/editable-table/index.vue.mjs +91 -83
- package/es/src/editable-table/interface.d.ts +7 -0
- package/lib/src/ap-action/group/index.vue.d.ts +1 -1
- package/lib/src/ap-action/item-dropdown/index.vue.d.ts +1 -1
- package/lib/src/ap-field/date/index.vue.d.ts +1 -1
- package/lib/src/ap-field/date-range/index.vue.d.ts +1 -1
- package/lib/src/ap-field/number/index.vue.d.ts +1 -1
- package/lib/src/ap-field/rate/index.vue.d.ts +1 -1
- package/lib/src/ap-field/select/index.vue.d.ts +1 -1
- package/lib/src/ap-field/tree-select/index.vue.d.ts +1 -1
- package/lib/src/ap-form/item/index.vue.d.ts +1 -1
- package/lib/src/ap-form/items/number/index.vue.d.ts +8 -8
- package/lib/src/ap-form/items/select/index.vue.d.ts +8 -8
- package/lib/src/ap-form/items/text/index.vue.d.ts +2 -2
- package/lib/src/ap-form/items/text/password.vue.d.ts +2 -2
- package/lib/src/ap-form/items/tree-select/index.vue.d.ts +8 -8
- package/lib/src/ap-form/render/item.vue.d.ts +1 -1
- package/lib/src/ap-grid/editable/form-item.vue.js +1 -1
- package/lib/src/ap-grid/editable/index.vue.js +1 -1
- package/lib/src/ap-grid/index.vue.js +1 -1
- package/lib/src/ap-info-layout/ap-info-layout-admin/ApInfoLayoutAdmin.vue.d.ts +1 -1
- package/lib/src/ap-table/ap-table.vue2.js +1 -1
- package/lib/src/ap-table/constants.d.ts +30 -30
- package/lib/src/ap-table/utils.d.ts +14 -14
- package/lib/src/business/ap-expand-alert/ApExpandAlert.vue.d.ts +3 -3
- package/lib/src/business/ap-expand-alert/ApExpandAlert.vue2.js +1 -1
- package/lib/src/business/ap-expand-alert/index.d.ts +4 -4
- package/lib/src/business/ap-label/ApLabel.d.ts +1 -1
- package/lib/src/business/ap-label/index.d.ts +3 -3
- package/lib/src/business/ap-ladder/ApLadder.d.ts +1 -1
- package/lib/src/business/ap-ladder/index.d.ts +3 -3
- package/lib/src/business/ap-status/interface.d.ts +1 -1
- package/lib/src/business/ap-view/ap-view.vue2.js +1 -1
- package/lib/src/business/ap-view/components/menu-list-content.vue2.js +1 -1
- package/lib/src/business/ap-view/hooks/use-view-provide.d.ts +1 -0
- package/lib/src/business/batch-input-group/form-item.vue.d.ts +1 -1
- package/lib/src/business/batch-input-group/index.vue.d.ts +1 -1
- package/lib/src/check-card/group.vue.d.ts +1 -1
- package/lib/src/config-provider/config-provider-props.d.ts +0 -5
- package/lib/src/config-provider/config-provider-props.js +1 -1
- package/lib/src/config-provider/config-provider.d.ts +0 -138
- package/lib/src/config-provider/config-provider.js +1 -1
- package/lib/src/config-provider/hooks/use-global-config.d.ts +0 -5
- package/lib/src/config-provider/index.d.ts +0 -652
- package/lib/src/editable-table/form-item.vue.d.ts +2 -14
- package/lib/src/editable-table/form-item.vue.js +1 -1
- package/lib/src/editable-table/index.vue.d.ts +2 -16
- package/lib/src/editable-table/index.vue.js +1 -1
- package/lib/src/editable-table/interface.d.ts +7 -0
- package/package.json +1 -1
- package/theme/antd-global-overwrite/admin/index.css +3 -0
- package/theme/antd-global-overwrite/admin/index.less +1 -0
- package/theme/antd-global-overwrite/admin/tooltip.css +3 -0
- package/theme/antd-global-overwrite/admin/tooltip.less +3 -0
- package/theme/antd-global-overwrite/aplus/index.css +3 -0
- package/theme/antd-global-overwrite/aplus/index.less +1 -0
- package/theme/antd-global-overwrite/aplus/tooltip.css +3 -0
- package/theme/antd-global-overwrite/aplus/tooltip.less +3 -0
- package/theme/ap-action/item-dropdown.css +17 -0
- package/theme/ap-action/item.css +17 -0
- package/theme/ap-appendix/ap-appendix.css +17 -0
- package/theme/ap-attachment/ap-attachment.css +17 -0
- package/theme/ap-batch-action/ap-batch-action.css +17 -0
- package/theme/ap-button/ap-button.css +17 -0
- package/theme/ap-card/ap-card.css +17 -0
- package/theme/ap-descriptions/ap-descriptions.css +17 -0
- package/theme/ap-download/ap-download.css +17 -0
- package/theme/ap-expand-alert/ap-expand-alert.css +17 -0
- package/theme/ap-field/checkbox.css +17 -0
- package/theme/ap-field/index.css +17 -0
- package/theme/ap-field/number.css +17 -0
- package/theme/ap-field/radio.css +17 -0
- package/theme/ap-field/text-area.css +17 -0
- package/theme/ap-form/ap-form-item-group.css +17 -0
- package/theme/ap-form/ap-form-item.css +22 -2
- package/theme/ap-form/ap-form-item.less +9 -3
- package/theme/ap-form/drawer-form.css +17 -0
- package/theme/ap-form/index.css +22 -2
- package/theme/ap-form/item-text-group.css +17 -0
- package/theme/ap-form/item-text.css +17 -0
- package/theme/ap-form/modal-form.css +17 -0
- package/theme/ap-form/search-form-sorter.css +17 -0
- package/theme/ap-form/search-form.css +22 -2
- package/theme/ap-grid/editable.css +17 -0
- package/theme/ap-grid/index.css +39 -2
- package/theme/ap-grid/index.less +1 -0
- package/theme/ap-group-search/ap-extension-select.css +17 -0
- package/theme/ap-group-search/ap-group-search.css +17 -0
- package/theme/ap-group-search/ap-popover-select.css +17 -0
- package/theme/ap-image/ap-image.css +17 -0
- package/theme/ap-input-radio/ap-input-radio.css +17 -0
- package/theme/ap-label/ap-label.css +17 -0
- package/theme/ap-ladder/ap-ladder.css +17 -0
- package/theme/ap-layout/ap-info-layout.css +17 -0
- package/theme/ap-list/index.css +17 -0
- package/theme/ap-product-info/ap-product-info.css +17 -0
- package/theme/ap-select-layout/ap-select-layout.css +17 -0
- package/theme/ap-size-input/ap-size-input.css +17 -0
- package/theme/ap-status/ap-status.css +17 -0
- package/theme/ap-summary/index.css +17 -0
- package/theme/ap-table/ap-table-index.css +17 -0
- package/theme/ap-table/ap-table-paragraph-ellipsis.css +17 -0
- package/theme/ap-table/ap-table.css +39 -2
- package/theme/ap-table/ap-table.less +1 -0
- package/theme/ap-table/setting/index.css +17 -0
- package/theme/ap-table/setting/modal.css +17 -0
- package/theme/ap-table/setting/select-group.css +17 -0
- package/theme/ap-table/setting/sortable-item-meta.css +17 -0
- package/theme/ap-table/setting/sortable-item.css +17 -0
- package/theme/ap-table/setting/sorter.css +17 -0
- package/theme/ap-table-modal/index.css +39 -2
- package/theme/ap-tag/ap-tag-group.css +17 -0
- package/theme/ap-tag/ap-tag.css +18 -1
- package/theme/ap-tag/ap-tag.less +1 -1
- package/theme/ap-title/ap-title.css +17 -0
- package/theme/ap-upload/index.css +17 -0
- package/theme/ap-upload/multiple-file.css +17 -0
- package/theme/ap-upload/picture.css +17 -0
- package/theme/ap-upload/single-file.css +17 -0
- package/theme/ap-upload/upload.css +17 -0
- package/theme/ap-upload-single/index.css +17 -0
- package/theme/ap-view/ap-view.css +17 -0
- package/theme/batch-input-group/index.css +17 -0
- package/theme/batch-input-group/popover-input.css +17 -0
- package/theme/check-card/index.css +17 -0
- package/theme/editable-table/index.css +22 -2
- package/theme/full-screen/index.css +17 -0
- package/theme/index.css +149 -3
- package/theme/index.less +1 -0
- package/theme/mask/index.css +17 -0
- package/theme/mixins/mixins.css +17 -0
- package/theme/mixins/mixins.less +28 -0
- package/theme/scroll-bar/index.css +17 -0
- package/theme/scroll-view/index.css +17 -0
- package/theme/splitter/index.css +17 -0
- package/theme/text/group.css +17 -0
- package/theme/text/index.css +17 -0
- package/theme/ui-mode.css +92 -0
- package/theme/ui-mode.less +93 -0
- package/theme/work-order-modal/index.css +17 -0
- package/es/src/config-provider/css-var.d.ts +0 -139
- package/es/src/config-provider/css-var.mjs +0 -278
- package/lib/src/config-provider/css-var.d.ts +0 -139
- package/lib/src/config-provider/css-var.js +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as A, useSlots as H, toRef as W, ref as h, unref as r, watch as G, nextTick as U, createBlock as $, openBlock as q, mergeProps as y, withCtx as g, createVNode as J, createSlots as Q, renderList as X, renderSlot as Y, normalizeProps as Z, guardReactiveProps as I } from "vue";
|
|
2
2
|
import { ApForm as C } from "../../ap-form/index.mjs";
|
|
3
|
-
import { isArray as
|
|
3
|
+
import { isArray as w, isUndefined as M, isNumber as m, cloneDeep as ee, omit as oe } from "lodash-unified";
|
|
4
4
|
import "../../config-provider/index.mjs";
|
|
5
|
-
import { isDef as
|
|
6
|
-
import { useGetEditableColumns as
|
|
5
|
+
import { isDef as b } from "../../utils/index.mjs";
|
|
6
|
+
import { useGetEditableColumns as te } from "../hooks/use-editable-columns.mjs";
|
|
7
7
|
import "../index.vue2.mjs";
|
|
8
|
-
import { useInjectForm as
|
|
9
|
-
import { useNamespace as
|
|
10
|
-
import { useGlobalConfig as
|
|
8
|
+
import { useInjectForm as ae } from "../../ap-form/context.mjs";
|
|
9
|
+
import { useNamespace as le } from "../../config-provider/hooks/use-namespace.mjs";
|
|
10
|
+
import { useGlobalConfig as fe } from "../../config-provider/hooks/use-global-config.mjs";
|
|
11
11
|
import ne from "../index.vue.mjs";
|
|
12
|
-
const
|
|
12
|
+
const Ce = /* @__PURE__ */ A({
|
|
13
13
|
name: "EditableGrid",
|
|
14
14
|
__name: "form-item",
|
|
15
15
|
props: {
|
|
@@ -157,126 +157,134 @@ const ge = /* @__PURE__ */ P({
|
|
|
157
157
|
default: () => ({})
|
|
158
158
|
}
|
|
159
159
|
},
|
|
160
|
-
setup(
|
|
161
|
-
expose:
|
|
160
|
+
setup(x, {
|
|
161
|
+
expose: R
|
|
162
162
|
}) {
|
|
163
|
-
const
|
|
164
|
-
b:
|
|
165
|
-
} =
|
|
166
|
-
function
|
|
167
|
-
return
|
|
163
|
+
const B = H(), l = x, {
|
|
164
|
+
b: S
|
|
165
|
+
} = le("editable-grid");
|
|
166
|
+
function F(e, t) {
|
|
167
|
+
return w(t) ? t.reduce((f, a) => f == null ? void 0 : f[a], e) : e == null ? void 0 : e[t];
|
|
168
168
|
}
|
|
169
169
|
const {
|
|
170
|
-
internalInstance:
|
|
171
|
-
model:
|
|
172
|
-
} =
|
|
173
|
-
|
|
174
|
-
var
|
|
175
|
-
await
|
|
170
|
+
internalInstance: o,
|
|
171
|
+
model: v
|
|
172
|
+
} = ae(), p = W(l.name), d = h(F(r(v), p.value) || []), N = C.useWatch(p);
|
|
173
|
+
G(() => N.value, async (e) => {
|
|
174
|
+
var t;
|
|
175
|
+
await U(), d.value = e, (t = l.onChange) == null || t.call(l, e);
|
|
176
176
|
}, {
|
|
177
177
|
deep: !0
|
|
178
178
|
});
|
|
179
|
-
const c = h(),
|
|
180
|
-
function
|
|
181
|
-
var
|
|
182
|
-
const
|
|
183
|
-
if (
|
|
179
|
+
const c = h(), D = fe("valueTypeMap"), V = te(l, D);
|
|
180
|
+
function L(e, t) {
|
|
181
|
+
var n;
|
|
182
|
+
const f = ((n = r(d)) == null ? void 0 : n.length) || 0;
|
|
183
|
+
if (b(l.maxLength) && f >= l.maxLength)
|
|
184
184
|
return;
|
|
185
185
|
const a = {
|
|
186
186
|
...e || {}
|
|
187
187
|
};
|
|
188
|
-
|
|
189
|
-
if (!
|
|
190
|
-
|
|
188
|
+
o == null || o.setFieldValue(l.name, a, !0, (s, u) => {
|
|
189
|
+
if (!s[u]) {
|
|
190
|
+
s[u] = [a];
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
|
-
|
|
193
|
+
M(t) ? s[u].push(a) : s[u].splice(t, 0, a);
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
|
-
function
|
|
197
|
-
var
|
|
198
|
-
const
|
|
199
|
-
if (
|
|
196
|
+
function T(e, t = "suffix") {
|
|
197
|
+
var s;
|
|
198
|
+
const f = ((s = r(d)) == null ? void 0 : s.length) || 0, a = m(e) ? e : e.length;
|
|
199
|
+
if (b(l.maxLength) && f + a > l.maxLength)
|
|
200
200
|
return;
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
if (!
|
|
204
|
-
|
|
201
|
+
const n = m(e) ? new Array(e).fill(0).map(() => ({})) : ee(e);
|
|
202
|
+
o == null || o.setFieldValue(l.name, n, !0, (u, i) => {
|
|
203
|
+
if (!u[i]) {
|
|
204
|
+
u[i] = [...n];
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
|
-
|
|
207
|
+
t === "suffix" ? u[i].push(...n) : u[i].unshift(...n);
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
210
|
+
function k(e) {
|
|
211
|
+
const t = new Set(m(e) ? [e] : e);
|
|
212
|
+
o == null || o.setFieldValue(l.name, void 0, !0, (f, a) => {
|
|
213
|
+
f[a] = f[a].filter((n, s) => !t.has(s));
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
|
-
function T() {
|
|
217
|
-
return u(d);
|
|
218
|
-
}
|
|
219
216
|
function _(e) {
|
|
220
|
-
var
|
|
221
|
-
|
|
217
|
+
var f;
|
|
218
|
+
const t = new Set(w(e) ? e : [e]);
|
|
219
|
+
t.size !== 0 && ((f = o == null ? void 0 : o.setFieldValue) == null || f.call(o, l.name, void 0, !0, (a, n) => {
|
|
220
|
+
a[n] = a[n].filter((s) => !t.has(s[l.rowKey]));
|
|
221
|
+
}));
|
|
222
222
|
}
|
|
223
|
-
function j(
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
223
|
+
function j() {
|
|
224
|
+
return r(d);
|
|
225
|
+
}
|
|
226
|
+
function E(e) {
|
|
227
|
+
var t;
|
|
228
|
+
return (t = r(d)) == null ? void 0 : t[e];
|
|
229
|
+
}
|
|
230
|
+
function O(e, t, f = !0) {
|
|
231
|
+
o == null || o.setFieldValue(l.name, void 0, !0, (a, n) => {
|
|
232
|
+
if (!(!a[n] || !a[n][e])) {
|
|
233
|
+
if (!f) {
|
|
234
|
+
const s = Object.keys(a[n][e]);
|
|
235
|
+
for (const u of s)
|
|
236
|
+
u !== l.rowKey && delete a[n][e][u];
|
|
230
237
|
}
|
|
231
|
-
Object.assign(a[
|
|
232
|
-
...
|
|
238
|
+
Object.assign(a[n][e], {
|
|
239
|
+
...t
|
|
233
240
|
});
|
|
234
241
|
}
|
|
235
242
|
});
|
|
236
243
|
}
|
|
237
|
-
function
|
|
238
|
-
|
|
244
|
+
function z(e) {
|
|
245
|
+
o == null || o.setFieldValue(l.name, e);
|
|
239
246
|
}
|
|
240
|
-
function
|
|
241
|
-
var
|
|
242
|
-
const
|
|
243
|
-
(
|
|
247
|
+
function K(e) {
|
|
248
|
+
var f;
|
|
249
|
+
const t = e === "end" ? d.value.length - 1 : e;
|
|
250
|
+
(f = c.value) == null || f.scrollToRow(t);
|
|
244
251
|
}
|
|
245
|
-
function
|
|
252
|
+
function P() {
|
|
246
253
|
var e;
|
|
247
|
-
(e =
|
|
254
|
+
(e = o == null ? void 0 : o.setFieldValue) == null || e.call(o, l.name, []);
|
|
248
255
|
}
|
|
249
|
-
return
|
|
250
|
-
add:
|
|
251
|
-
remove:
|
|
252
|
-
getRowData:
|
|
253
|
-
getRowsData:
|
|
254
|
-
setRowData:
|
|
255
|
-
addMultiple:
|
|
256
|
-
scrollTo:
|
|
257
|
-
setTableData:
|
|
258
|
-
clear:
|
|
259
|
-
|
|
256
|
+
return R({
|
|
257
|
+
add: L,
|
|
258
|
+
remove: k,
|
|
259
|
+
getRowData: E,
|
|
260
|
+
getRowsData: j,
|
|
261
|
+
setRowData: O,
|
|
262
|
+
addMultiple: T,
|
|
263
|
+
scrollTo: K,
|
|
264
|
+
setTableData: z,
|
|
265
|
+
clear: P,
|
|
266
|
+
removeByKey: _
|
|
267
|
+
}), (e, t) => (q(), $(r(C).FormItem, y(e.formItem, {
|
|
260
268
|
name: e.name,
|
|
261
269
|
label: e.label
|
|
262
270
|
}), {
|
|
263
|
-
default: g(() => [
|
|
271
|
+
default: g(() => [J(ne, y(r(oe)(l, ["name", "value", "onUpdate:value", "maxLength", "onChange", "defaultValue", "formItem"]), {
|
|
264
272
|
ref_key: "tableRef",
|
|
265
273
|
ref: c,
|
|
266
|
-
class:
|
|
267
|
-
columns:
|
|
274
|
+
class: r(S)(),
|
|
275
|
+
columns: r(V),
|
|
268
276
|
"data-source": d.value,
|
|
269
277
|
"search-form": !1
|
|
270
|
-
}),
|
|
278
|
+
}), Q({
|
|
271
279
|
_: 2
|
|
272
|
-
}, [
|
|
280
|
+
}, [X(B, (f, a) => ({
|
|
273
281
|
name: a,
|
|
274
|
-
fn: g((
|
|
282
|
+
fn: g((n) => [Y(e.$slots, a, Z(I(n || {})))])
|
|
275
283
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
276
284
|
_: 3
|
|
277
285
|
}, 16, ["name", "label"]));
|
|
278
286
|
}
|
|
279
287
|
});
|
|
280
288
|
export {
|
|
281
|
-
|
|
289
|
+
Ce as default
|
|
282
290
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as $, useSlots as q, ref as v, watch as x, unref as u, createBlock as J, openBlock as Q, withCtx as h, createVNode as b, mergeProps as X, createSlots as Y, renderList as Z, renderSlot as M, normalizeProps as ee, guardReactiveProps as te } from "vue";
|
|
2
2
|
import { ApForm as y } from "../../ap-form/index.mjs";
|
|
3
|
-
import { isEqual as ae, isArray as
|
|
3
|
+
import { isEqual as ae, isArray as g, isUndefined as oe, isNumber as C, cloneDeep as le, omit as ne } from "lodash-unified";
|
|
4
4
|
import "../../config-provider/index.mjs";
|
|
5
5
|
import "../../hooks/index.mjs";
|
|
6
6
|
import { isDef as R } from "../../utils/index.mjs";
|
|
7
|
-
import { useGetEditableColumns as
|
|
7
|
+
import { useGetEditableColumns as se } from "../hooks/use-editable-columns.mjs";
|
|
8
8
|
import "../index.vue2.mjs";
|
|
9
|
-
import { useNamespace as
|
|
10
|
-
import { useControllableValue as
|
|
11
|
-
import { useGlobalConfig as
|
|
12
|
-
import
|
|
13
|
-
const
|
|
9
|
+
import { useNamespace as re } from "../../config-provider/hooks/use-namespace.mjs";
|
|
10
|
+
import { useControllableValue as ue } from "../../hooks/useControllableValue.mjs";
|
|
11
|
+
import { useGlobalConfig as ie } from "../../config-provider/hooks/use-global-config.mjs";
|
|
12
|
+
import fe from "../index.vue.mjs";
|
|
13
|
+
const Re = /* @__PURE__ */ $({
|
|
14
14
|
name: "EditableGrid",
|
|
15
15
|
__name: "index",
|
|
16
16
|
props: {
|
|
@@ -161,147 +161,155 @@ const be = /* @__PURE__ */ U({
|
|
|
161
161
|
expose: S,
|
|
162
162
|
emit: F
|
|
163
163
|
}) {
|
|
164
|
-
const N =
|
|
164
|
+
const N = q(), o = B, {
|
|
165
165
|
b: V
|
|
166
|
-
} =
|
|
166
|
+
} = re("editable-grid"), _ = F, w = v(), {
|
|
167
167
|
value: m,
|
|
168
|
-
updateValue:
|
|
169
|
-
} =
|
|
168
|
+
updateValue: L
|
|
169
|
+
} = ue(o, _), i = v(), k = ie("valueTypeMap"), c = y.useWatch(o.name, i);
|
|
170
170
|
x(() => c.value, (e) => {
|
|
171
|
-
var
|
|
172
|
-
|
|
171
|
+
var t;
|
|
172
|
+
L(e), (t = o.onChange) == null || t.call(o, e);
|
|
173
173
|
}, {
|
|
174
174
|
deep: !0,
|
|
175
175
|
flush: "post"
|
|
176
176
|
}), x(m, (e) => {
|
|
177
|
-
var
|
|
178
|
-
e !== u(c) && (ae(e, u(c)) || (
|
|
177
|
+
var t;
|
|
178
|
+
e !== u(c) && (ae(e, u(c)) || (t = i.value) == null || t.setFieldValue(o.name, e));
|
|
179
179
|
}, {
|
|
180
180
|
deep: !0
|
|
181
181
|
});
|
|
182
|
-
const
|
|
183
|
-
function
|
|
182
|
+
const D = se(o, k);
|
|
183
|
+
function E() {
|
|
184
184
|
var e;
|
|
185
|
-
(e =
|
|
185
|
+
(e = i.value) == null || e.resetFields();
|
|
186
186
|
}
|
|
187
187
|
function T(e) {
|
|
188
|
-
return e ? (
|
|
188
|
+
return e ? (g(e) ? e : [e]).map((a) => g(a) ? [o.name, ...a] : [o.name, a]) : void 0;
|
|
189
189
|
}
|
|
190
|
-
async function j(e,
|
|
190
|
+
async function j(e, t) {
|
|
191
191
|
var l;
|
|
192
|
-
const
|
|
193
|
-
return
|
|
192
|
+
const a = await ((l = i.value) == null ? void 0 : l.validateFields(T(e), t));
|
|
193
|
+
return a == null ? void 0 : a[o.name];
|
|
194
194
|
}
|
|
195
|
-
function O(e,
|
|
195
|
+
function O(e, t) {
|
|
196
196
|
var s, n, r;
|
|
197
|
-
const
|
|
198
|
-
if (R(
|
|
197
|
+
const a = ((s = u(m)) == null ? void 0 : s.length) || 0;
|
|
198
|
+
if (R(o.maxLength) && a >= o.maxLength)
|
|
199
199
|
return;
|
|
200
200
|
const l = {
|
|
201
201
|
...e || {}
|
|
202
202
|
};
|
|
203
|
-
(r = (n =
|
|
204
|
-
if (!d[
|
|
205
|
-
d[
|
|
203
|
+
(r = (n = i.value) == null ? void 0 : n.setFieldValue) == null || r.call(n, o.name, l, !0, (d, f) => {
|
|
204
|
+
if (!d[f]) {
|
|
205
|
+
d[f] = [l];
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
|
-
|
|
208
|
+
oe(t) ? d[f].push(l) : d[f].splice(t, 0, l);
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function z(e, t = "suffix") {
|
|
212
212
|
var n, r, d;
|
|
213
|
-
const
|
|
214
|
-
if (R(
|
|
213
|
+
const a = ((n = u(m)) == null ? void 0 : n.length) || 0, l = C(e) ? e : e.length;
|
|
214
|
+
if (R(o.maxLength) && a + l > o.maxLength)
|
|
215
215
|
return;
|
|
216
|
-
const s =
|
|
217
|
-
(d = (r =
|
|
218
|
-
if (!
|
|
219
|
-
|
|
216
|
+
const s = C(e) ? new Array(e).fill(0).map(() => ({})) : le(e);
|
|
217
|
+
(d = (r = i.value) == null ? void 0 : r.setFieldValue) == null || d.call(r, o.name, s, !0, (f, p) => {
|
|
218
|
+
if (!f[p]) {
|
|
219
|
+
f[p] = [...s];
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
|
-
|
|
222
|
+
t === "suffix" ? f[p].push(...s) : f[p].unshift(...s);
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
|
-
function
|
|
226
|
-
var
|
|
227
|
-
const
|
|
228
|
-
(l = (
|
|
229
|
-
s[n] = s[n].filter((r, d) => !
|
|
225
|
+
function A(e) {
|
|
226
|
+
var a, l;
|
|
227
|
+
const t = new Set(C(e) ? [e] : e);
|
|
228
|
+
(l = (a = i.value) == null ? void 0 : a.setFieldValue) == null || l.call(a, o.name, void 0, !0, (s, n) => {
|
|
229
|
+
s[n] = s[n].filter((r, d) => !t.has(d));
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
|
+
function K(e) {
|
|
233
|
+
var a, l;
|
|
234
|
+
const t = new Set(g(e) ? e : [e]);
|
|
235
|
+
t.size !== 0 && ((l = (a = i.value) == null ? void 0 : a.setFieldValue) == null || l.call(a, o.name, void 0, !0, (s, n) => {
|
|
236
|
+
s[n] = s[n].filter((r) => !t.has(r[o.rowKey]));
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
232
239
|
function I() {
|
|
233
240
|
return u(m);
|
|
234
241
|
}
|
|
235
242
|
function P(e) {
|
|
236
|
-
var
|
|
237
|
-
(
|
|
243
|
+
var t;
|
|
244
|
+
(t = i.value) == null || t.setFieldValue(o.name, e);
|
|
238
245
|
}
|
|
239
246
|
function H(e) {
|
|
240
|
-
var
|
|
241
|
-
return (
|
|
247
|
+
var t;
|
|
248
|
+
return (t = u(m)) == null ? void 0 : t[e];
|
|
242
249
|
}
|
|
243
|
-
function
|
|
250
|
+
function W(e, t, a = !0) {
|
|
244
251
|
var l, s;
|
|
245
|
-
(s = (l =
|
|
252
|
+
(s = (l = i.value) == null ? void 0 : l.setFieldValue) == null || s.call(l, o.name, void 0, !0, (n, r) => {
|
|
246
253
|
if (!(!n[r] || !n[r][e])) {
|
|
247
|
-
if (!
|
|
254
|
+
if (!a) {
|
|
248
255
|
const d = Object.keys(n[r][e]);
|
|
249
|
-
for (const
|
|
250
|
-
|
|
256
|
+
for (const f of d)
|
|
257
|
+
f !== o.rowKey && delete n[r][e][f];
|
|
251
258
|
}
|
|
252
259
|
Object.assign(n[r][e], {
|
|
253
|
-
...
|
|
260
|
+
...t
|
|
254
261
|
});
|
|
255
262
|
}
|
|
256
263
|
});
|
|
257
264
|
}
|
|
258
|
-
function
|
|
259
|
-
var
|
|
260
|
-
const
|
|
261
|
-
(
|
|
265
|
+
function G(e) {
|
|
266
|
+
var a;
|
|
267
|
+
const t = e === "end" ? m.value.length - 1 : e;
|
|
268
|
+
(a = w.value) == null || a.scrollToRow(t);
|
|
262
269
|
}
|
|
263
|
-
function
|
|
264
|
-
var e,
|
|
265
|
-
(
|
|
270
|
+
function U() {
|
|
271
|
+
var e, t;
|
|
272
|
+
(t = (e = i.value) == null ? void 0 : e.setFieldValue) == null || t.call(e, o.name, []);
|
|
266
273
|
}
|
|
267
274
|
return S({
|
|
268
|
-
resetFields:
|
|
275
|
+
resetFields: E,
|
|
269
276
|
validateFields: j,
|
|
270
277
|
add: O,
|
|
271
|
-
remove:
|
|
278
|
+
remove: A,
|
|
272
279
|
getRowData: H,
|
|
273
280
|
getRowsData: I,
|
|
274
|
-
setRowData:
|
|
275
|
-
addMultiple:
|
|
276
|
-
scrollTo:
|
|
277
|
-
clear:
|
|
278
|
-
setTableData: P
|
|
279
|
-
|
|
281
|
+
setRowData: W,
|
|
282
|
+
addMultiple: z,
|
|
283
|
+
scrollTo: G,
|
|
284
|
+
clear: U,
|
|
285
|
+
setTableData: P,
|
|
286
|
+
removeByKey: K
|
|
287
|
+
}), (e, t) => (Q(), J(u(y), {
|
|
280
288
|
ref_key: "formRef",
|
|
281
|
-
ref:
|
|
289
|
+
ref: i,
|
|
282
290
|
"initial-values": {
|
|
283
|
-
[
|
|
291
|
+
[o.name]: u(m)
|
|
284
292
|
},
|
|
285
293
|
style: {
|
|
286
294
|
height: "100%"
|
|
287
295
|
}
|
|
288
296
|
}, {
|
|
289
|
-
default: h(() => [
|
|
297
|
+
default: h(() => [b(u(y).FormItem, {
|
|
290
298
|
name: e.name,
|
|
291
299
|
"no-style": ""
|
|
292
300
|
}, {
|
|
293
|
-
default: h(() => [
|
|
301
|
+
default: h(() => [b(fe, X(u(ne)(o, ["name", "value", "onUpdate:value", "maxLength", "onChange", "defaultValue"]), {
|
|
294
302
|
ref_key: "tableRef",
|
|
295
|
-
ref:
|
|
303
|
+
ref: w,
|
|
296
304
|
class: u(V)(),
|
|
297
|
-
columns: u(
|
|
305
|
+
columns: u(D),
|
|
298
306
|
"data-source": u(m),
|
|
299
307
|
"search-form": !1
|
|
300
|
-
}),
|
|
308
|
+
}), Y({
|
|
301
309
|
_: 2
|
|
302
|
-
}, [
|
|
310
|
+
}, [Z(N, (a, l) => ({
|
|
303
311
|
name: l,
|
|
304
|
-
fn: h((s) => [
|
|
312
|
+
fn: h((s) => [M(e.$slots, l, ee(te(s || {})))])
|
|
305
313
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
306
314
|
_: 3
|
|
307
315
|
}, 8, ["name"])]),
|
|
@@ -310,5 +318,5 @@ const be = /* @__PURE__ */ U({
|
|
|
310
318
|
}
|
|
311
319
|
});
|
|
312
320
|
export {
|
|
313
|
-
|
|
321
|
+
Re as default
|
|
314
322
|
};
|