@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,20 +1,8 @@
|
|
|
1
|
-
import { EditableColumnType, EditableTableFormItemProps } from './interface';
|
|
2
|
-
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
1
|
+
import { EditableColumnType, EditableTableFormItemExpose, EditableTableFormItemProps } from './interface';
|
|
3
2
|
import { VNodeProps, AllowedComponentProps, ComponentCustomProps, PublicProps, ShallowUnwrapRef, VNode } from 'vue';
|
|
4
|
-
import { UnwrapRefSimple } from '@vue/reactivity';
|
|
5
3
|
declare const _default: <RecordType = any>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
6
4
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, never> & EditableTableFormItemProps<RecordType> & Partial<{}>> & PublicProps;
|
|
7
|
-
expose(exposed: ShallowUnwrapRef<
|
|
8
|
-
add: (defaultValue?: any, insertIndex?: number) => void;
|
|
9
|
-
remove: (index: number | number[]) => void;
|
|
10
|
-
getRowData: (index: number) => RecordType | UnwrapRefSimple<RecordType>;
|
|
11
|
-
getRowsData: () => RecordType[] | UnwrapRefSimple<RecordType>[];
|
|
12
|
-
setRowData: (index: number, payload: any, merge?: boolean) => void;
|
|
13
|
-
addMultiple: (list: number | Partial<RecordType>[], insetIn?: "prefix" | "suffix") => void;
|
|
14
|
-
scrollTo: (index: number | "end", options?: StandardBehaviorOptions) => void;
|
|
15
|
-
setTableData: (nextTableData: RecordType[]) => void;
|
|
16
|
-
clear: () => void;
|
|
17
|
-
}>): void;
|
|
5
|
+
expose(exposed: ShallowUnwrapRef<EditableTableFormItemExpose>): void;
|
|
18
6
|
attrs: any;
|
|
19
7
|
slots: Readonly<{
|
|
20
8
|
default: any;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
3
|
-
import { ApForm as
|
|
4
|
-
import { isArray as
|
|
1
|
+
import { defineComponent as G, ref as c, unref as s, useSlots as H, toRef as U, watch as W, nextTick as $, createBlock as q, openBlock as J, mergeProps as h, withCtx as w, createVNode as Q, createSlots as X, renderList as Y, renderSlot as Z, normalizeProps as I, guardReactiveProps as M } from "vue";
|
|
2
|
+
import { Table as ee } from "@aplus-frontend/antdv";
|
|
3
|
+
import { ApForm as x } from "../ap-form/index.mjs";
|
|
4
|
+
import { isArray as g, isUndefined as oe, isNumber as m, cloneDeep as te, omit as y } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
|
-
import { useInjectForm as
|
|
6
|
+
import { useInjectForm as ae } from "../ap-form/context.mjs";
|
|
7
7
|
import { isDef as b } from "../utils/index.mjs";
|
|
8
|
-
import
|
|
9
|
-
import { scrollToRowIndex as
|
|
8
|
+
import le from "./hooks/use-get-columns.mjs";
|
|
9
|
+
import { scrollToRowIndex as ue } from "./utils.mjs";
|
|
10
10
|
import { useNamespace as ne } from "../config-provider/hooks/use-namespace.mjs";
|
|
11
|
-
import { useGlobalConfig as
|
|
12
|
-
const
|
|
11
|
+
import { useGlobalConfig as fe } from "../config-provider/hooks/use-global-config.mjs";
|
|
12
|
+
const ye = /* @__PURE__ */ G({
|
|
13
13
|
name: "EditableTableInner",
|
|
14
14
|
__name: "form-item",
|
|
15
15
|
props: {
|
|
@@ -109,119 +109,127 @@ const we = /* @__PURE__ */ O({
|
|
|
109
109
|
default: () => ({})
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
|
-
setup(
|
|
113
|
-
expose:
|
|
112
|
+
setup(C, {
|
|
113
|
+
expose: R
|
|
114
114
|
}) {
|
|
115
|
-
const l =
|
|
116
|
-
function
|
|
117
|
-
return
|
|
115
|
+
const l = C;
|
|
116
|
+
function B(e, a) {
|
|
117
|
+
return g(a) ? a.reduce((u, t) => u == null ? void 0 : u[t], e) : e == null ? void 0 : e[a];
|
|
118
118
|
}
|
|
119
119
|
const {
|
|
120
|
-
internalInstance:
|
|
121
|
-
model:
|
|
122
|
-
} =
|
|
123
|
-
|
|
124
|
-
var
|
|
125
|
-
await
|
|
120
|
+
internalInstance: o,
|
|
121
|
+
model: F
|
|
122
|
+
} = ae(), d = c(B(s(F), l.name) || []), T = H(), D = U(l, "name"), V = x.useWatch(D);
|
|
123
|
+
W(() => V.value, async (e) => {
|
|
124
|
+
var a;
|
|
125
|
+
await $(), d.value = e, (a = l.onChange) == null || a.call(l, e);
|
|
126
126
|
}, {
|
|
127
127
|
deep: !0
|
|
128
128
|
});
|
|
129
129
|
const {
|
|
130
130
|
b: L
|
|
131
|
-
} = ne("editable-table"), p = c(),
|
|
132
|
-
function
|
|
133
|
-
var
|
|
134
|
-
const
|
|
135
|
-
if (b(l.maxLength) &&
|
|
131
|
+
} = ne("editable-table"), p = c(), S = fe("valueTypeMap"), v = le(l, S);
|
|
132
|
+
function N(e, a) {
|
|
133
|
+
var n;
|
|
134
|
+
const u = ((n = s(d)) == null ? void 0 : n.length) || 0;
|
|
135
|
+
if (b(l.maxLength) && u >= l.maxLength)
|
|
136
136
|
return;
|
|
137
|
-
const
|
|
137
|
+
const t = {
|
|
138
138
|
...e || {}
|
|
139
139
|
};
|
|
140
|
-
|
|
141
|
-
if (!r
|
|
142
|
-
r
|
|
140
|
+
o == null || o.setFieldValue(l.name, t, !0, (f, r) => {
|
|
141
|
+
if (!f[r]) {
|
|
142
|
+
f[r] = [t];
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
|
-
|
|
145
|
+
oe(a) ? f[r].push(t) : f[r].splice(a, 0, t);
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
var
|
|
150
|
-
const
|
|
151
|
-
if (b(l.maxLength) &&
|
|
148
|
+
function E(e, a = "suffix") {
|
|
149
|
+
var f;
|
|
150
|
+
const u = ((f = s(d)) == null ? void 0 : f.length) || 0, t = m(e) ? e : e.length;
|
|
151
|
+
if (b(l.maxLength) && u + t > l.maxLength)
|
|
152
152
|
return;
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
if (!
|
|
156
|
-
|
|
153
|
+
const n = m(e) ? new Array(e).fill(0).map(() => ({})) : te(e);
|
|
154
|
+
o == null || o.setFieldValue(l.name, n, !0, (r, i) => {
|
|
155
|
+
if (!r[i]) {
|
|
156
|
+
r[i] = [...n];
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
a === "suffix" ? r[i].push(...n) : r[i].unshift(...n);
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
function _(e) {
|
|
163
|
+
const a = new Set(m(e) ? [e] : e);
|
|
164
|
+
o == null || o.setFieldValue(l.name, void 0, !0, (u, t) => {
|
|
165
|
+
u[t] = u[t].filter((n, f) => !a.has(f));
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function k(e) {
|
|
169
|
+
var u;
|
|
170
|
+
const a = new Set(g(e) ? e : [e]);
|
|
171
|
+
a.size !== 0 && ((u = o == null ? void 0 : o.setFieldValue) == null || u.call(o, l.name, void 0, !0, (t, n) => {
|
|
172
|
+
t[n] = t[n].filter((f) => !a.has(f[l.rowKey]));
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
function j() {
|
|
169
176
|
return s(d);
|
|
170
177
|
}
|
|
171
|
-
function
|
|
172
|
-
var
|
|
173
|
-
return (
|
|
178
|
+
function z(e) {
|
|
179
|
+
var a;
|
|
180
|
+
return (a = s(d)) == null ? void 0 : a[e];
|
|
174
181
|
}
|
|
175
|
-
function
|
|
176
|
-
|
|
177
|
-
!
|
|
178
|
-
...
|
|
179
|
-
...
|
|
182
|
+
function K(e, a, u = !0) {
|
|
183
|
+
o == null || o.setFieldValue(l.name, void 0, !0, (t, n) => {
|
|
184
|
+
!t[n] || !t[n][e] || (t[n][e] = {
|
|
185
|
+
...u ? t[n][e] : {},
|
|
186
|
+
...a
|
|
180
187
|
});
|
|
181
188
|
});
|
|
182
189
|
}
|
|
183
190
|
function P(e) {
|
|
184
|
-
|
|
191
|
+
o == null || o.setFieldValue(l.name, e);
|
|
185
192
|
}
|
|
186
|
-
function
|
|
187
|
-
var
|
|
188
|
-
const
|
|
189
|
-
|
|
193
|
+
function A(e, a) {
|
|
194
|
+
var t;
|
|
195
|
+
const u = e === "end" ? d.value.length - 1 : e;
|
|
196
|
+
ue(u, (t = p.value) == null ? void 0 : t.$el, a);
|
|
190
197
|
}
|
|
191
|
-
function
|
|
198
|
+
function O() {
|
|
192
199
|
var e;
|
|
193
|
-
(e =
|
|
200
|
+
(e = o == null ? void 0 : o.setFieldValue) == null || e.call(o, l.name, []);
|
|
194
201
|
}
|
|
195
|
-
return
|
|
196
|
-
add:
|
|
197
|
-
remove:
|
|
198
|
-
getRowData:
|
|
199
|
-
getRowsData:
|
|
200
|
-
setRowData:
|
|
201
|
-
addMultiple:
|
|
202
|
-
scrollTo:
|
|
202
|
+
return R({
|
|
203
|
+
add: N,
|
|
204
|
+
remove: _,
|
|
205
|
+
getRowData: z,
|
|
206
|
+
getRowsData: j,
|
|
207
|
+
setRowData: K,
|
|
208
|
+
addMultiple: E,
|
|
209
|
+
scrollTo: A,
|
|
203
210
|
setTableData: P,
|
|
204
|
-
clear:
|
|
205
|
-
|
|
211
|
+
clear: O,
|
|
212
|
+
removeByKey: k
|
|
213
|
+
}), (e, a) => (J(), q(s(x).FormItem, h(e.formItem, {
|
|
206
214
|
name: e.name,
|
|
207
215
|
label: e.label
|
|
208
216
|
}), {
|
|
209
|
-
default:
|
|
217
|
+
default: w(() => [Q(s(ee), h(s(y)(l, ["name", "maxLength", "onChange"]), {
|
|
210
218
|
ref_key: "tableRef",
|
|
211
219
|
ref: p,
|
|
212
220
|
class: s(L)(),
|
|
213
|
-
columns: s(
|
|
221
|
+
columns: s(v),
|
|
214
222
|
"data-source": d.value
|
|
215
|
-
}),
|
|
223
|
+
}), X({
|
|
216
224
|
_: 2
|
|
217
|
-
}, [
|
|
218
|
-
name:
|
|
219
|
-
fn:
|
|
225
|
+
}, [Y(s(y)(T, ["headerCell"]), (u, t) => ({
|
|
226
|
+
name: t,
|
|
227
|
+
fn: w((n) => [Z(e.$slots, t, I(M(n || {})))])
|
|
220
228
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
221
229
|
_: 3
|
|
222
230
|
}, 16, ["name", "label"]));
|
|
223
231
|
}
|
|
224
232
|
});
|
|
225
233
|
export {
|
|
226
|
-
|
|
234
|
+
ye as default
|
|
227
235
|
};
|
|
@@ -1,25 +1,11 @@
|
|
|
1
|
-
import { EditableTableProps, EditableColumnType } from './interface';
|
|
2
|
-
import { NamePath, ValidateOptions } from '@aplus-frontend/antdv/es/form/interface';
|
|
1
|
+
import { EditableTableProps, EditableColumnType, EditableTableExpose } from './interface';
|
|
3
2
|
import { Recordable } from '../type';
|
|
4
|
-
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
5
3
|
import { VNodeProps, AllowedComponentProps, ComponentCustomProps, PublicProps, ShallowUnwrapRef, VNode } from 'vue';
|
|
6
4
|
declare const _default: <RecordType extends Recordable = any>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
7
5
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
8
6
|
readonly "onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
9
7
|
} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, "onUpdate:value"> & EditableTableProps<RecordType> & Partial<{}>> & PublicProps;
|
|
10
|
-
expose(exposed: ShallowUnwrapRef<
|
|
11
|
-
resetFields: () => void;
|
|
12
|
-
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<any>;
|
|
13
|
-
add: (defaultValue?: Partial<RecordType>, insertIndex?: number) => void;
|
|
14
|
-
remove: (index: number | number[]) => void;
|
|
15
|
-
getRowData: (index: number) => RecordType;
|
|
16
|
-
getRowsData: () => RecordType[];
|
|
17
|
-
setRowData: (index: number, payload: any, merge?: boolean) => void;
|
|
18
|
-
addMultiple: (list: number | Partial<RecordType>[], insetIn?: "prefix" | "suffix") => void;
|
|
19
|
-
scrollTo: (index: number | "end", options?: StandardBehaviorOptions) => void;
|
|
20
|
-
clear: () => void;
|
|
21
|
-
setTableData: (nextTableData: RecordType[]) => void;
|
|
22
|
-
}>): void;
|
|
8
|
+
expose(exposed: ShallowUnwrapRef<EditableTableExpose>): void;
|
|
23
9
|
attrs: any;
|
|
24
10
|
slots: Readonly<{
|
|
25
11
|
default: any;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
1
|
+
import { defineComponent as q, useSlots as J, ref as y, watch as C, unref as r, createBlock as Q, openBlock as X, withCtx as h, createVNode as b, mergeProps as Y, createSlots as Z, renderList as M, renderSlot as ee, normalizeProps as te, guardReactiveProps as ae } from "vue";
|
|
2
|
+
import { Table as ne } from "@aplus-frontend/antdv";
|
|
3
3
|
import { ApForm as x } from "../ap-form/index.mjs";
|
|
4
|
-
import { isEqual as
|
|
4
|
+
import { isEqual as oe, isArray as v, isUndefined as le, isNumber as g, cloneDeep as ue, omit as R } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
6
|
import "../hooks/index.mjs";
|
|
7
7
|
import { isDef as F } from "../utils/index.mjs";
|
|
8
|
-
import { scrollToRowIndex as
|
|
9
|
-
import
|
|
10
|
-
import { useNamespace as
|
|
11
|
-
import { useControllableValue as
|
|
8
|
+
import { scrollToRowIndex as se } from "./utils.mjs";
|
|
9
|
+
import re from "./hooks/use-get-columns.mjs";
|
|
10
|
+
import { useNamespace as ie } from "../config-provider/hooks/use-namespace.mjs";
|
|
11
|
+
import { useControllableValue as fe } from "../hooks/useControllableValue.mjs";
|
|
12
12
|
import { useGlobalConfig as de } from "../config-provider/hooks/use-global-config.mjs";
|
|
13
|
-
const
|
|
13
|
+
const Fe = /* @__PURE__ */ q({
|
|
14
14
|
name: "EditableTable",
|
|
15
15
|
__name: "index",
|
|
16
16
|
props: {
|
|
@@ -113,137 +113,145 @@ const Re = /* @__PURE__ */ $({
|
|
|
113
113
|
expose: V,
|
|
114
114
|
emit: T
|
|
115
115
|
}) {
|
|
116
|
-
const
|
|
117
|
-
b:
|
|
118
|
-
} =
|
|
116
|
+
const o = B, {
|
|
117
|
+
b: D
|
|
118
|
+
} = ie("editable-table"), L = J(), S = T, w = y(), {
|
|
119
119
|
value: m,
|
|
120
|
-
updateValue:
|
|
121
|
-
} =
|
|
122
|
-
|
|
120
|
+
updateValue: _
|
|
121
|
+
} = fe(o, S), i = y(), E = de("valueTypeMap"), c = x.useWatch(o.name, i);
|
|
122
|
+
C(() => c.value, (e) => {
|
|
123
123
|
var t;
|
|
124
|
-
|
|
124
|
+
_(e), (t = o.onChange) == null || t.call(o, e);
|
|
125
125
|
}, {
|
|
126
126
|
deep: !0,
|
|
127
127
|
flush: "post"
|
|
128
|
-
}),
|
|
128
|
+
}), C(m, (e) => {
|
|
129
129
|
var t;
|
|
130
|
-
e !==
|
|
130
|
+
e !== r(c) && (oe(e, r(c)) || (t = i.value) == null || t.setFieldValue(o.name, e));
|
|
131
131
|
}, {
|
|
132
132
|
deep: !0
|
|
133
133
|
});
|
|
134
|
-
const
|
|
134
|
+
const N = re(o, E);
|
|
135
135
|
function k() {
|
|
136
136
|
var e;
|
|
137
137
|
(e = i.value) == null || e.resetFields();
|
|
138
138
|
}
|
|
139
139
|
function A(e) {
|
|
140
|
-
return e ? (
|
|
140
|
+
return e ? (v(e) ? e : [e]).map((a) => v(a) ? [o.name, ...a] : [o.name, a]) : void 0;
|
|
141
141
|
}
|
|
142
|
-
async function
|
|
143
|
-
var
|
|
144
|
-
const
|
|
145
|
-
return
|
|
142
|
+
async function z(e, t) {
|
|
143
|
+
var n;
|
|
144
|
+
const a = await ((n = i.value) == null ? void 0 : n.validateFields(A(e), t));
|
|
145
|
+
return a == null ? void 0 : a[o.name];
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
var l, u,
|
|
149
|
-
const
|
|
150
|
-
if (F(
|
|
147
|
+
function I(e, t) {
|
|
148
|
+
var l, u, s;
|
|
149
|
+
const a = ((l = r(m)) == null ? void 0 : l.length) || 0;
|
|
150
|
+
if (F(o.maxLength) && a >= o.maxLength)
|
|
151
151
|
return;
|
|
152
|
-
const
|
|
152
|
+
const n = {
|
|
153
153
|
...e || {}
|
|
154
154
|
};
|
|
155
|
-
(
|
|
156
|
-
if (!d
|
|
157
|
-
d
|
|
155
|
+
(s = (u = i.value) == null ? void 0 : u.setFieldValue) == null || s.call(u, o.name, n, !0, (f, d) => {
|
|
156
|
+
if (!f[d]) {
|
|
157
|
+
f[d] = [n];
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
|
|
160
|
+
le(t) ? f[d].push(n) : f[d].splice(t, 0, n);
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
var u,
|
|
165
|
-
const
|
|
166
|
-
if (F(
|
|
163
|
+
function K(e, t = "suffix") {
|
|
164
|
+
var u, s, f;
|
|
165
|
+
const a = ((u = r(m)) == null ? void 0 : u.length) || 0, n = g(e) ? e : e.length;
|
|
166
|
+
if (F(o.maxLength) && a + n > o.maxLength)
|
|
167
167
|
return;
|
|
168
|
-
const l = g(e) ? new Array(e).fill(0).map(() => ({})) :
|
|
169
|
-
(
|
|
170
|
-
if (!
|
|
171
|
-
|
|
168
|
+
const l = g(e) ? new Array(e).fill(0).map(() => ({})) : ue(e);
|
|
169
|
+
(f = (s = i.value) == null ? void 0 : s.setFieldValue) == null || f.call(s, o.name, l, !0, (d, p) => {
|
|
170
|
+
if (!d[p]) {
|
|
171
|
+
d[p] = [...l];
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
|
-
t === "suffix" ?
|
|
174
|
+
t === "suffix" ? d[p].push(...l) : d[p].unshift(...l);
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
|
-
function
|
|
178
|
-
var
|
|
177
|
+
function P(e) {
|
|
178
|
+
var a, n;
|
|
179
179
|
const t = new Set(g(e) ? [e] : e);
|
|
180
|
-
(
|
|
181
|
-
l[u] = l[u].filter((
|
|
180
|
+
(n = (a = i.value) == null ? void 0 : a.setFieldValue) == null || n.call(a, o.name, void 0, !0, (l, u) => {
|
|
181
|
+
l[u] = l[u].filter((s, f) => !t.has(f));
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
|
+
function j(e) {
|
|
185
|
+
var a, n;
|
|
186
|
+
const t = new Set(v(e) ? e : [e]);
|
|
187
|
+
t.size !== 0 && ((n = (a = i.value) == null ? void 0 : a.setFieldValue) == null || n.call(a, o.name, void 0, !0, (l, u) => {
|
|
188
|
+
l[u] = l[u].filter((s) => !t.has(s[o.rowKey]));
|
|
189
|
+
}));
|
|
190
|
+
}
|
|
184
191
|
function O() {
|
|
185
|
-
return
|
|
192
|
+
return r(m);
|
|
186
193
|
}
|
|
187
|
-
function
|
|
194
|
+
function U(e) {
|
|
188
195
|
var t;
|
|
189
|
-
(t = i.value) == null || t.setFieldValue(
|
|
196
|
+
(t = i.value) == null || t.setFieldValue(o.name, e);
|
|
190
197
|
}
|
|
191
|
-
function
|
|
198
|
+
function G(e) {
|
|
192
199
|
var t;
|
|
193
|
-
return (t =
|
|
200
|
+
return (t = r(m)) == null ? void 0 : t[e];
|
|
194
201
|
}
|
|
195
|
-
function
|
|
196
|
-
var
|
|
197
|
-
(l = (
|
|
198
|
-
!u[
|
|
199
|
-
...
|
|
202
|
+
function H(e, t, a = !0) {
|
|
203
|
+
var n, l;
|
|
204
|
+
(l = (n = i.value) == null ? void 0 : n.setFieldValue) == null || l.call(n, o.name, void 0, !0, (u, s) => {
|
|
205
|
+
!u[s] || !u[s][e] || (u[s][e] = {
|
|
206
|
+
...a ? u[s][e] : {},
|
|
200
207
|
...t
|
|
201
208
|
});
|
|
202
209
|
});
|
|
203
210
|
}
|
|
204
|
-
function
|
|
205
|
-
var
|
|
206
|
-
const
|
|
207
|
-
|
|
211
|
+
function W(e, t) {
|
|
212
|
+
var n;
|
|
213
|
+
const a = e === "end" ? m.value.length - 1 : e;
|
|
214
|
+
se(a, (n = w.value) == null ? void 0 : n.$el, t);
|
|
208
215
|
}
|
|
209
|
-
function
|
|
216
|
+
function $() {
|
|
210
217
|
var e, t;
|
|
211
|
-
(t = (e = i.value) == null ? void 0 : e.setFieldValue) == null || t.call(e,
|
|
218
|
+
(t = (e = i.value) == null ? void 0 : e.setFieldValue) == null || t.call(e, o.name, []);
|
|
212
219
|
}
|
|
213
220
|
return V({
|
|
214
221
|
resetFields: k,
|
|
215
|
-
validateFields:
|
|
216
|
-
add:
|
|
217
|
-
remove:
|
|
218
|
-
getRowData:
|
|
222
|
+
validateFields: z,
|
|
223
|
+
add: I,
|
|
224
|
+
remove: P,
|
|
225
|
+
getRowData: G,
|
|
219
226
|
getRowsData: O,
|
|
220
|
-
setRowData:
|
|
221
|
-
addMultiple:
|
|
222
|
-
scrollTo:
|
|
223
|
-
clear:
|
|
224
|
-
setTableData:
|
|
225
|
-
|
|
227
|
+
setRowData: H,
|
|
228
|
+
addMultiple: K,
|
|
229
|
+
scrollTo: W,
|
|
230
|
+
clear: $,
|
|
231
|
+
setTableData: U,
|
|
232
|
+
removeByKey: j
|
|
233
|
+
}), (e, t) => (X(), Q(r(x), {
|
|
226
234
|
ref_key: "formRef",
|
|
227
235
|
ref: i,
|
|
228
236
|
"initial-values": {
|
|
229
|
-
[
|
|
237
|
+
[o.name]: r(m)
|
|
230
238
|
}
|
|
231
239
|
}, {
|
|
232
|
-
default: h(() => [
|
|
240
|
+
default: h(() => [b(r(x).FormItem, {
|
|
233
241
|
name: e.name,
|
|
234
242
|
"no-style": ""
|
|
235
243
|
}, {
|
|
236
|
-
default: h(() => [
|
|
244
|
+
default: h(() => [b(r(ne), Y(r(R)(o, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
|
|
237
245
|
ref_key: "tableRef",
|
|
238
|
-
ref:
|
|
239
|
-
class:
|
|
240
|
-
columns:
|
|
241
|
-
"data-source":
|
|
242
|
-
}),
|
|
246
|
+
ref: w,
|
|
247
|
+
class: r(D)(),
|
|
248
|
+
columns: r(N),
|
|
249
|
+
"data-source": r(m)
|
|
250
|
+
}), Z({
|
|
243
251
|
_: 2
|
|
244
|
-
}, [
|
|
245
|
-
name:
|
|
246
|
-
fn: h((l) => [
|
|
252
|
+
}, [M(r(R)(L, ["headerCell"]), (a, n) => ({
|
|
253
|
+
name: n,
|
|
254
|
+
fn: h((l) => [ee(e.$slots, n, te(ae(l || {})))])
|
|
247
255
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
248
256
|
_: 3
|
|
249
257
|
}, 8, ["name"])]),
|
|
@@ -252,5 +260,5 @@ const Re = /* @__PURE__ */ $({
|
|
|
252
260
|
}
|
|
253
261
|
});
|
|
254
262
|
export {
|
|
255
|
-
|
|
263
|
+
Fe as default
|
|
256
264
|
};
|
|
@@ -7,6 +7,7 @@ import { EllipsisConfig } from '@aplus-frontend/antdv/es/typography/Base';
|
|
|
7
7
|
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
8
8
|
import { Recordable } from '../type';
|
|
9
9
|
import { ApFormItemProps } from '../ap-form';
|
|
10
|
+
import { Key } from '@aplus-frontend/antdv/es/_util/type';
|
|
10
11
|
export type EditableColumnType<RecordType = any, ExtraValueType = 'text', ValueType extends ApTableValueTypes = ApTableValueTypes, MergedValueType extends ExtraValueType | ValueType = ExtraValueType | ValueType> = MergedValueType extends ExtraValueType | ValueType ? Omit<ColumnType<RecordType>, 'children' | 'customRender' | 'ellipsis'> & {
|
|
11
12
|
children?: EditableColumnType<RecordType, ExtraValueType, ValueType, MergedValueType>[];
|
|
12
13
|
/**
|
|
@@ -138,6 +139,12 @@ export type EditableTableExpose<ModelType = any, RecordType = any> = {
|
|
|
138
139
|
* @returns
|
|
139
140
|
*/
|
|
140
141
|
remove: (index: number | number[]) => void;
|
|
142
|
+
/**
|
|
143
|
+
* 通过key删除数据
|
|
144
|
+
* @param key
|
|
145
|
+
* @returns
|
|
146
|
+
*/
|
|
147
|
+
removeByKey: (key: Key | Key[]) => void;
|
|
141
148
|
/**
|
|
142
149
|
* 清空所有数据
|
|
143
150
|
* @returns
|
|
@@ -4,8 +4,8 @@ import { Trigger } from '@aplus-frontend/antdv/es/dropdown/props';
|
|
|
4
4
|
import { GroupActionTypes } from '..';
|
|
5
5
|
declare const _default: DefineComponent<ApActionGroupProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ApActionGroupProps> & Readonly<{}>, {
|
|
6
6
|
placement: "top" | "topLeft" | "bottom" | "topRight" | "bottomLeft" | "bottomRight" | "topCenter" | "bottomCenter";
|
|
7
|
-
count: number;
|
|
8
7
|
trigger: Trigger | Trigger[];
|
|
9
8
|
actions: GroupActionTypes[];
|
|
9
|
+
count: number;
|
|
10
10
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
11
11
|
export default _default;
|
|
@@ -16,8 +16,8 @@ declare const __VLS_component: DefineComponent<ApActionItemDropdownProps, {}, {}
|
|
|
16
16
|
visible: boolean;
|
|
17
17
|
color: ActionColor;
|
|
18
18
|
disabled: boolean;
|
|
19
|
-
trigger: Trigger | Trigger[];
|
|
20
19
|
loading: boolean;
|
|
20
|
+
trigger: Trigger | Trigger[];
|
|
21
21
|
actions: MixedActionTypes[];
|
|
22
22
|
showIcon: boolean;
|
|
23
23
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
@@ -33,8 +33,8 @@ declare const __VLS_component: DefineComponent<ApFieldDateProps, {}, {}, {}, {},
|
|
|
33
33
|
mode: FieldMode;
|
|
34
34
|
open: boolean;
|
|
35
35
|
disabled: boolean;
|
|
36
|
-
bordered: boolean;
|
|
37
36
|
autofocus: boolean;
|
|
37
|
+
bordered: boolean;
|
|
38
38
|
format: LiteralUnion<ApFormatPresetType, string>;
|
|
39
39
|
clearIcon: string | number | boolean | void | VNode<RendererNode, RendererElement, {
|
|
40
40
|
[key: string]: any;
|
|
@@ -41,8 +41,8 @@ declare const __VLS_component: DefineComponent<ApFieldDateRangeProps, {}, {}, {}
|
|
|
41
41
|
[key: string]: any;
|
|
42
42
|
}> | null;
|
|
43
43
|
disabled: boolean | [boolean, boolean];
|
|
44
|
-
bordered: boolean;
|
|
45
44
|
autofocus: boolean;
|
|
45
|
+
bordered: boolean;
|
|
46
46
|
format: LiteralUnion<ApFormatPresetType, string>;
|
|
47
47
|
clearIcon: string | number | boolean | void | VNode<RendererNode, RendererElement, {
|
|
48
48
|
[key: string]: any;
|
|
@@ -353,8 +353,8 @@ declare const __VLS_component: DefineComponent<ApFieldNumberProps, {
|
|
|
353
353
|
}>, {
|
|
354
354
|
step: ValueType;
|
|
355
355
|
disabled: boolean;
|
|
356
|
-
bordered: boolean;
|
|
357
356
|
keyboard: boolean;
|
|
357
|
+
bordered: boolean;
|
|
358
358
|
max: ValueType;
|
|
359
359
|
min: ValueType;
|
|
360
360
|
controls: boolean;
|
|
@@ -109,9 +109,9 @@ declare const __VLS_component: DefineComponent<ApFieldRateProps, {
|
|
|
109
109
|
}>, {
|
|
110
110
|
mode: FieldMode;
|
|
111
111
|
disabled: boolean;
|
|
112
|
-
count: number;
|
|
113
112
|
autofocus: boolean;
|
|
114
113
|
allowClear: boolean;
|
|
114
|
+
count: number;
|
|
115
115
|
allowHalf: boolean;
|
|
116
116
|
character: any;
|
|
117
117
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
@@ -449,9 +449,9 @@ declare const __VLS_component: DefineComponent<ApFieldSelectProps, {
|
|
|
449
449
|
open: boolean;
|
|
450
450
|
multiple: boolean;
|
|
451
451
|
disabled: boolean;
|
|
452
|
-
bordered: boolean;
|
|
453
452
|
loading: boolean;
|
|
454
453
|
autofocus: boolean;
|
|
454
|
+
bordered: boolean;
|
|
455
455
|
virtual: boolean;
|
|
456
456
|
lazy: boolean;
|
|
457
457
|
allowClear: boolean;
|
|
@@ -593,9 +593,9 @@ declare const __VLS_component: DefineComponent<ApFieldTreeSelectProps, {
|
|
|
593
593
|
open: boolean;
|
|
594
594
|
multiple: boolean;
|
|
595
595
|
disabled: boolean;
|
|
596
|
-
bordered: boolean;
|
|
597
596
|
loading: boolean;
|
|
598
597
|
autofocus: boolean;
|
|
598
|
+
bordered: boolean;
|
|
599
599
|
virtual: boolean;
|
|
600
600
|
dropdownMatchSelectWidth: number | boolean;
|
|
601
601
|
allowClear: boolean;
|