@aplus-frontend/ui 0.0.12 → 0.0.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/index.mjs +166 -158
- package/es/src/ap-action/item/index.vue2.mjs +5 -5
- package/es/src/ap-form/ap-form.vue2.mjs +22 -22
- package/es/src/ap-table/ap-table.vue.d.ts +5 -1
- package/es/src/business/index.d.ts +126 -0
- package/es/src/business/index.mjs +8 -0
- package/es/src/business/title/ApTitle.vue.d.ts +45 -0
- package/es/src/business/title/ApTitle.vue.mjs +50 -0
- package/es/src/business/title/ApTitle.vue2.mjs +4 -0
- package/es/src/business/title/interface.d.ts +21 -0
- package/es/src/business/title/style.css +39 -0
- package/es/src/components.d.ts +1 -0
- package/es/src/editable-table/form-item.vue.d.ts +304 -0
- package/es/src/editable-table/form-item.vue.mjs +189 -0
- package/es/src/editable-table/form-item.vue2.mjs +4 -0
- package/es/src/editable-table/hooks/use-get-columns.d.ts +5 -0
- package/es/src/editable-table/hooks/use-get-columns.mjs +76 -0
- package/es/src/editable-table/index.d.ts +5 -0
- package/es/src/editable-table/index.mjs +3 -0
- package/es/src/editable-table/index.vue.d.ts +196 -0
- package/es/src/editable-table/index.vue.mjs +209 -0
- package/es/src/editable-table/index.vue2.mjs +4 -0
- package/es/src/editable-table/interface.d.ts +71 -6
- package/es/src/editable-table/interface.mjs +1 -0
- package/es/src/editable-table/style/index.css +35 -0
- package/es/src/editable-table/utils.mjs +10 -0
- package/es/src/index.d.ts +2 -0
- package/es/src/index.mjs +229 -220
- package/es/src/theme/antd-global-overwrite/admin/index.css +8 -0
- package/es/src/theme/antd-global-overwrite/admin/table.css +8 -0
- package/es/src/theme/ap-title/ap-title.css +39 -0
- package/es/src/theme/editable-table/index.css +35 -0
- package/lib/index.js +1 -1
- package/lib/src/ap-action/item/index.vue2.js +1 -1
- package/lib/src/ap-form/ap-form.vue2.js +1 -1
- package/lib/src/ap-table/ap-table.vue.d.ts +5 -1
- package/lib/src/business/index.d.ts +126 -0
- package/lib/src/business/index.js +1 -0
- package/lib/src/business/title/ApTitle.vue.d.ts +45 -0
- package/lib/src/business/title/ApTitle.vue.js +1 -0
- package/lib/src/business/title/ApTitle.vue2.js +1 -0
- package/lib/src/business/title/interface.d.ts +21 -0
- package/lib/src/business/title/style.css +39 -0
- package/lib/src/components.d.ts +1 -0
- package/lib/src/editable-table/form-item.vue.d.ts +304 -0
- package/lib/src/editable-table/form-item.vue.js +1 -0
- package/lib/src/editable-table/form-item.vue2.js +1 -0
- package/lib/src/editable-table/hooks/use-get-columns.d.ts +5 -0
- package/lib/src/editable-table/hooks/use-get-columns.js +1 -0
- package/lib/src/editable-table/index.d.ts +5 -0
- package/lib/src/editable-table/index.js +1 -0
- package/lib/src/editable-table/index.vue.d.ts +196 -0
- package/lib/src/editable-table/index.vue.js +1 -0
- package/lib/src/editable-table/index.vue2.js +1 -0
- package/lib/src/editable-table/interface.d.ts +71 -6
- package/lib/src/editable-table/interface.js +1 -0
- package/lib/src/editable-table/style/index.css +35 -0
- package/lib/src/editable-table/utils.js +1 -0
- package/lib/src/index.d.ts +2 -0
- package/lib/src/index.js +1 -1
- package/lib/src/theme/antd-global-overwrite/admin/index.css +8 -0
- package/lib/src/theme/antd-global-overwrite/admin/table.css +8 -0
- package/lib/src/theme/ap-title/ap-title.css +39 -0
- package/lib/src/theme/editable-table/index.css +35 -0
- package/package.json +1 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { defineComponent as P, ref as L, unref as o, useSlots as V, watch as j, openBlock as f, createBlock as z, mergeProps as c, withCtx as i, createVNode as _, createSlots as O, createElementBlock as T, Fragment as K, createElementVNode as x, normalizeClass as q, toDisplayString as A, createCommentVNode as G, renderList as H, renderSlot as M, normalizeProps as W, guardReactiveProps as U } from "vue";
|
|
2
|
+
import { Table as $ } from "ant-design-vue";
|
|
3
|
+
import { ApForm as C } from "../ap-form/index.mjs";
|
|
4
|
+
import { cloneDeep as g, omit as J } from "lodash-unified";
|
|
5
|
+
import "../config-provider/index.mjs";
|
|
6
|
+
import { useInjectForm as Q } from "../ap-form/context.mjs";
|
|
7
|
+
import "./style/index.css";
|
|
8
|
+
import { isDef as X } from "../utils/index.mjs";
|
|
9
|
+
import Y from "./hooks/use-get-columns.mjs";
|
|
10
|
+
import { useNamespace as Z } from "../config-provider/hooks/use-namespace.mjs";
|
|
11
|
+
import { useGlobalConfig as I } from "../config-provider/hooks/use-global-config.mjs";
|
|
12
|
+
const pe = /* @__PURE__ */ P({
|
|
13
|
+
name: "EditableTableInner",
|
|
14
|
+
__name: "form-item",
|
|
15
|
+
props: {
|
|
16
|
+
dropdownPrefixCls: {},
|
|
17
|
+
pagination: {
|
|
18
|
+
type: [Boolean, Object],
|
|
19
|
+
default: !1
|
|
20
|
+
},
|
|
21
|
+
loading: {
|
|
22
|
+
type: [Boolean, Object],
|
|
23
|
+
default: void 0
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
default: "middle"
|
|
27
|
+
},
|
|
28
|
+
bordered: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: !1
|
|
31
|
+
},
|
|
32
|
+
locale: {},
|
|
33
|
+
onChange: {},
|
|
34
|
+
onResizeColumn: {},
|
|
35
|
+
rowSelection: {},
|
|
36
|
+
getPopupContainer: {},
|
|
37
|
+
scroll: {},
|
|
38
|
+
sortDirections: {
|
|
39
|
+
default: () => ["ascend", "descend"]
|
|
40
|
+
},
|
|
41
|
+
showSorterTooltip: {
|
|
42
|
+
type: [Boolean, Object],
|
|
43
|
+
default: !0
|
|
44
|
+
},
|
|
45
|
+
prefixCls: {},
|
|
46
|
+
rowKey: {
|
|
47
|
+
default: "key"
|
|
48
|
+
},
|
|
49
|
+
tableLayout: {
|
|
50
|
+
default: "fixed"
|
|
51
|
+
},
|
|
52
|
+
rowClassName: {},
|
|
53
|
+
title: {},
|
|
54
|
+
footer: {},
|
|
55
|
+
id: {},
|
|
56
|
+
showHeader: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: !0
|
|
59
|
+
},
|
|
60
|
+
components: {},
|
|
61
|
+
customRow: {},
|
|
62
|
+
customHeaderRow: {},
|
|
63
|
+
direction: {},
|
|
64
|
+
expandFixed: {
|
|
65
|
+
type: [String, Boolean],
|
|
66
|
+
default: !1
|
|
67
|
+
},
|
|
68
|
+
expandColumnWidth: {},
|
|
69
|
+
expandedRowKeys: {},
|
|
70
|
+
defaultExpandedRowKeys: {},
|
|
71
|
+
expandedRowRender: {},
|
|
72
|
+
expandRowByClick: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: !1
|
|
75
|
+
},
|
|
76
|
+
expandIcon: {},
|
|
77
|
+
onExpand: {},
|
|
78
|
+
onExpandedRowsChange: {},
|
|
79
|
+
defaultExpandAllRows: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: !1
|
|
82
|
+
},
|
|
83
|
+
indentSize: {
|
|
84
|
+
default: 15
|
|
85
|
+
},
|
|
86
|
+
expandIconColumnIndex: {},
|
|
87
|
+
showExpandColumn: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: !0
|
|
90
|
+
},
|
|
91
|
+
expandedRowClassName: {},
|
|
92
|
+
childrenColumnName: {
|
|
93
|
+
default: "children"
|
|
94
|
+
},
|
|
95
|
+
rowExpandable: {},
|
|
96
|
+
sticky: {
|
|
97
|
+
type: [Boolean, Object]
|
|
98
|
+
},
|
|
99
|
+
transformCellText: {},
|
|
100
|
+
columns: {},
|
|
101
|
+
value: {},
|
|
102
|
+
defaultValue: {},
|
|
103
|
+
"onUpdate:value": {},
|
|
104
|
+
maxLength: {},
|
|
105
|
+
onFieldChange: {},
|
|
106
|
+
label: {},
|
|
107
|
+
name: {},
|
|
108
|
+
formItem: {
|
|
109
|
+
default: () => ({})
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
setup(h, {
|
|
113
|
+
expose: w
|
|
114
|
+
}) {
|
|
115
|
+
var p;
|
|
116
|
+
const n = h, {
|
|
117
|
+
formInstance: t,
|
|
118
|
+
model: b
|
|
119
|
+
} = Q(), d = L(((p = o(b)) == null ? void 0 : p[n.name]) || []), y = V(), R = C.useWatch(n.name);
|
|
120
|
+
j(() => R.value, (a) => {
|
|
121
|
+
var l;
|
|
122
|
+
d.value = a, (l = n.onChange) == null || l.call(n, a);
|
|
123
|
+
});
|
|
124
|
+
const {
|
|
125
|
+
b: u,
|
|
126
|
+
em: B
|
|
127
|
+
} = Z("editable-table"), D = I("uiMode", "aplus"), E = Y(n);
|
|
128
|
+
function F(a) {
|
|
129
|
+
var e, r;
|
|
130
|
+
const l = ((e = o(d)) == null ? void 0 : e.length) || 0;
|
|
131
|
+
X(n.maxLength) && l >= n.maxLength || (r = t == null ? void 0 : t.setFieldValue) == null || r.call(t, n.name, [...o(d) || [], a || {}]);
|
|
132
|
+
}
|
|
133
|
+
function v(a) {
|
|
134
|
+
var e;
|
|
135
|
+
const l = g(o(d) || []);
|
|
136
|
+
l.splice(a, 1), (e = t == null ? void 0 : t.setFieldValue) == null || e.call(t, n.name, [...l]);
|
|
137
|
+
}
|
|
138
|
+
function S() {
|
|
139
|
+
return o(d);
|
|
140
|
+
}
|
|
141
|
+
function k(a) {
|
|
142
|
+
var l;
|
|
143
|
+
return (l = o(d)) == null ? void 0 : l[a];
|
|
144
|
+
}
|
|
145
|
+
function N(a, l) {
|
|
146
|
+
var r;
|
|
147
|
+
const e = g(o(d));
|
|
148
|
+
e[a] && (e[a] = {
|
|
149
|
+
...e[a],
|
|
150
|
+
...l
|
|
151
|
+
}, (r = t == null ? void 0 : t.setFieldValue) == null || r.call(t, n.name, [...e]));
|
|
152
|
+
}
|
|
153
|
+
return w({
|
|
154
|
+
add: F,
|
|
155
|
+
remove: v,
|
|
156
|
+
getRowData: k,
|
|
157
|
+
getRowsData: S,
|
|
158
|
+
setRowData: N
|
|
159
|
+
}), (a, l) => (f(), z(o(C).FormItem, c(a.formItem, {
|
|
160
|
+
name: a.name,
|
|
161
|
+
label: a.label
|
|
162
|
+
}), {
|
|
163
|
+
default: i(() => [_(o($), c(o(J)(n, ["name", "maxLength"]), {
|
|
164
|
+
class: [o(u)(), o(D) === "admin" ? o(u)("admin") : null],
|
|
165
|
+
columns: o(E),
|
|
166
|
+
"data-source": d.value
|
|
167
|
+
}), O({
|
|
168
|
+
headerCell: i(({
|
|
169
|
+
column: e
|
|
170
|
+
}) => {
|
|
171
|
+
var r, s, m;
|
|
172
|
+
return [(r = e == null ? void 0 : e.fieldProps) != null && r.required || (m = (s = e == null ? void 0 : e.fieldProps) == null ? void 0 : s.rules) != null && m.length ? (f(), T(K, {
|
|
173
|
+
key: 0
|
|
174
|
+
}, [x("span", {
|
|
175
|
+
class: q(o(B)("header-cell", "required"))
|
|
176
|
+
}, "*", 2), x("span", null, A(e.title), 1)], 64)) : G("", !0)];
|
|
177
|
+
}),
|
|
178
|
+
_: 2
|
|
179
|
+
}, [H(y, (e, r) => ({
|
|
180
|
+
name: r,
|
|
181
|
+
fn: i((s) => [M(a.$slots, r, W(U(s || {})))])
|
|
182
|
+
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
183
|
+
_: 3
|
|
184
|
+
}, 16, ["name", "label"]));
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
export {
|
|
188
|
+
pe as default
|
|
189
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { EditableTableFormItemProps, EditableTableProps, EditableColumnType } from '../interface';
|
|
2
|
+
import { ComputedRef } from 'vue';
|
|
3
|
+
|
|
4
|
+
declare const useGetColumns: (props: EditableTableProps | EditableTableFormItemProps) => ComputedRef< EditableColumnType<any, any>[]>;
|
|
5
|
+
export default useGetColumns;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { computed as x, createVNode as d, mergeProps as g } from "vue";
|
|
2
|
+
import { isFunction as C } from "lodash-unified";
|
|
3
|
+
import { getEditableComponent as T } from "../utils.mjs";
|
|
4
|
+
import { updateFormProps as h, getFieldProps as F, getPlaceholder as R, getTableRenderProps as I } from "../../ap-table/utils.mjs";
|
|
5
|
+
import "../../config-provider/index.mjs";
|
|
6
|
+
import { apTableRenderItemMap as v, noRenderAsFormItemValueList as L } from "../../ap-table/constants.mjs";
|
|
7
|
+
import { Typography as M } from "ant-design-vue";
|
|
8
|
+
import { useLocale as N } from "../../config-provider/hooks/use-locale.mjs";
|
|
9
|
+
const q = (a) => {
|
|
10
|
+
const {
|
|
11
|
+
t: u
|
|
12
|
+
} = N(), i = x(() => {
|
|
13
|
+
let n = a.columns;
|
|
14
|
+
return n ? (n = n.map((e) => ({
|
|
15
|
+
...e,
|
|
16
|
+
customRender({
|
|
17
|
+
value: o,
|
|
18
|
+
...l
|
|
19
|
+
}) {
|
|
20
|
+
if (e.customRender)
|
|
21
|
+
return e.customRender({
|
|
22
|
+
value: o,
|
|
23
|
+
...l,
|
|
24
|
+
column: e
|
|
25
|
+
});
|
|
26
|
+
{
|
|
27
|
+
if (C(e.editable) ? e.editable(l.text, l.record, l.index) : !!e.editable) {
|
|
28
|
+
const m = T(e.valueType), t = h(e, F(e.fieldProps, {
|
|
29
|
+
value: o,
|
|
30
|
+
...l
|
|
31
|
+
})), r = {};
|
|
32
|
+
a.onFieldChange && (r[`onUpdate:${t.valuePropName || "value"}`] = (y) => {
|
|
33
|
+
var c;
|
|
34
|
+
return (c = a.onFieldChange) == null ? void 0 : c.call(a, l.index, e.dataIndex, y);
|
|
35
|
+
});
|
|
36
|
+
const b = {
|
|
37
|
+
name: [a.name, l.index, e.dataIndex],
|
|
38
|
+
...t || {},
|
|
39
|
+
// 格式化placeholder
|
|
40
|
+
placeholder: R(u, e.valueType, t == null ? void 0 : t.placeholder),
|
|
41
|
+
field: {
|
|
42
|
+
style: "width: 100%",
|
|
43
|
+
...(t == null ? void 0 : t.field) || {},
|
|
44
|
+
...r
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
return d(m, b, null);
|
|
48
|
+
}
|
|
49
|
+
const s = v[e.valueType], f = I(e, {
|
|
50
|
+
value: o,
|
|
51
|
+
...l
|
|
52
|
+
});
|
|
53
|
+
return p(e, o, d(s, g(f, {
|
|
54
|
+
mode: "read"
|
|
55
|
+
}), null));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
})), n) : [];
|
|
59
|
+
});
|
|
60
|
+
function p(n, e, o) {
|
|
61
|
+
return L.includes(n.valueType) ? o : n.copyable || n.ellipsis ? d(M.Text, {
|
|
62
|
+
copyable: n.copyable ? {
|
|
63
|
+
text: e,
|
|
64
|
+
tooltip: !1
|
|
65
|
+
} : !1,
|
|
66
|
+
ellipsis: n.ellipsis ? {
|
|
67
|
+
tooltip: e
|
|
68
|
+
} : !1,
|
|
69
|
+
content: o
|
|
70
|
+
}, null) : o;
|
|
71
|
+
}
|
|
72
|
+
return i;
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
q as default
|
|
76
|
+
};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { EditableTableProps, EditableColumnType } from './interface';
|
|
2
|
+
import { NamePath, ValidateOptions } from 'ant-design-vue/es/form/interface';
|
|
3
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType, CSSProperties } from 'vue';
|
|
4
|
+
import { SpinSize } from 'ant-design-vue/es/spin/Spin';
|
|
5
|
+
import { VueTypeValidableDef } from '../../node_modules/vue-types';
|
|
6
|
+
import { TablePaginationConfig } from 'ant-design-vue';
|
|
7
|
+
import { TableLayout, GetRowKey } from 'ant-design-vue/es/vc-table/interface';
|
|
8
|
+
import { SortOrder } from 'ant-design-vue/es/table/interface';
|
|
9
|
+
import { TriggerType } from 'ant-design-vue/es/tooltip/abstractTooltipProps';
|
|
10
|
+
import { TooltipPlacement, AdjustOverflow } from 'ant-design-vue/es/tooltip';
|
|
11
|
+
import { LiteralUnion } from 'ant-design-vue/es/_util/type';
|
|
12
|
+
import { PresetColorType } from 'ant-design-vue/es/_util/colors';
|
|
13
|
+
import { AlignType, BuildInPlacements } from 'ant-design-vue/es/vc-trigger/interface';
|
|
14
|
+
|
|
15
|
+
type EditableTableSlots = {
|
|
16
|
+
default: any;
|
|
17
|
+
emptyText?: any;
|
|
18
|
+
expandIcon?: any;
|
|
19
|
+
title?: any;
|
|
20
|
+
footer?: any;
|
|
21
|
+
summary?: any;
|
|
22
|
+
expandedRowRender?: any;
|
|
23
|
+
expandColumnTitle?: any;
|
|
24
|
+
customFilterIcon?: any;
|
|
25
|
+
customFilterDropdown?: any;
|
|
26
|
+
headerCell?: (props: {
|
|
27
|
+
title: any;
|
|
28
|
+
column: EditableColumnType;
|
|
29
|
+
}) => void;
|
|
30
|
+
};
|
|
31
|
+
declare function resetFields(): void;
|
|
32
|
+
declare function validateFields(nameList?: NamePath[] | string, options?: ValidateOptions): Promise<any>;
|
|
33
|
+
declare function add(defaultValue?: any): void;
|
|
34
|
+
declare function remove(index: number): void;
|
|
35
|
+
declare function getRowsData(): any[];
|
|
36
|
+
declare function getRowData(index: number): any;
|
|
37
|
+
declare function setRowData(index: number, payload: any): void;
|
|
38
|
+
declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<EditableTableProps<any>>, {
|
|
39
|
+
bordered: boolean;
|
|
40
|
+
childrenColumnName: string;
|
|
41
|
+
defaultExpandAllRows: boolean;
|
|
42
|
+
expandFixed: boolean;
|
|
43
|
+
expandRowByClick: boolean;
|
|
44
|
+
indentSize: number;
|
|
45
|
+
rowKey: string;
|
|
46
|
+
showExpandColumn: boolean;
|
|
47
|
+
showHeader: boolean;
|
|
48
|
+
showSorterTooltip: boolean;
|
|
49
|
+
size: string;
|
|
50
|
+
sortDirections: () => string[];
|
|
51
|
+
pagination: boolean;
|
|
52
|
+
loading: undefined;
|
|
53
|
+
name: string;
|
|
54
|
+
tableLayout: string;
|
|
55
|
+
}>, {
|
|
56
|
+
resetFields: typeof resetFields;
|
|
57
|
+
validateFields: typeof validateFields;
|
|
58
|
+
add: typeof add;
|
|
59
|
+
remove: typeof remove;
|
|
60
|
+
getRowData: typeof getRowData;
|
|
61
|
+
getRowsData: typeof getRowsData;
|
|
62
|
+
setRowData: typeof setRowData;
|
|
63
|
+
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
64
|
+
"update:value": (...args: any[]) => void;
|
|
65
|
+
}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<EditableTableProps<any>>, {
|
|
66
|
+
bordered: boolean;
|
|
67
|
+
childrenColumnName: string;
|
|
68
|
+
defaultExpandAllRows: boolean;
|
|
69
|
+
expandFixed: boolean;
|
|
70
|
+
expandRowByClick: boolean;
|
|
71
|
+
indentSize: number;
|
|
72
|
+
rowKey: string;
|
|
73
|
+
showExpandColumn: boolean;
|
|
74
|
+
showHeader: boolean;
|
|
75
|
+
showSorterTooltip: boolean;
|
|
76
|
+
size: string;
|
|
77
|
+
sortDirections: () => string[];
|
|
78
|
+
pagination: boolean;
|
|
79
|
+
loading: undefined;
|
|
80
|
+
name: string;
|
|
81
|
+
tableLayout: string;
|
|
82
|
+
}>>> & {
|
|
83
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
loading: boolean | Partial< ExtractPropTypes<{
|
|
86
|
+
prefixCls: StringConstructor;
|
|
87
|
+
spinning: {
|
|
88
|
+
type: BooleanConstructor;
|
|
89
|
+
default: any;
|
|
90
|
+
};
|
|
91
|
+
size: PropType<SpinSize>;
|
|
92
|
+
wrapperClassName: StringConstructor;
|
|
93
|
+
tip: VueTypeValidableDef<any>;
|
|
94
|
+
delay: NumberConstructor;
|
|
95
|
+
indicator: VueTypeValidableDef<any>;
|
|
96
|
+
}>>;
|
|
97
|
+
size: "small" | "middle" | "large";
|
|
98
|
+
pagination: false | TablePaginationConfig;
|
|
99
|
+
name: any;
|
|
100
|
+
bordered: boolean;
|
|
101
|
+
tableLayout: TableLayout;
|
|
102
|
+
rowKey: string | GetRowKey<any>;
|
|
103
|
+
sortDirections: SortOrder[];
|
|
104
|
+
showSorterTooltip: boolean | Partial< ExtractPropTypes<{
|
|
105
|
+
title: VueTypeValidableDef<any>;
|
|
106
|
+
trigger: PropType< TriggerType | TriggerType[]>;
|
|
107
|
+
open: {
|
|
108
|
+
type: BooleanConstructor;
|
|
109
|
+
default: any;
|
|
110
|
+
};
|
|
111
|
+
visible: {
|
|
112
|
+
type: BooleanConstructor;
|
|
113
|
+
default: any;
|
|
114
|
+
};
|
|
115
|
+
placement: PropType<TooltipPlacement>;
|
|
116
|
+
color: PropType<LiteralUnion<PresetColorType>>;
|
|
117
|
+
transitionName: StringConstructor;
|
|
118
|
+
overlayStyle: {
|
|
119
|
+
type: PropType<CSSProperties>;
|
|
120
|
+
default: CSSProperties;
|
|
121
|
+
};
|
|
122
|
+
overlayInnerStyle: {
|
|
123
|
+
type: PropType<CSSProperties>;
|
|
124
|
+
default: CSSProperties;
|
|
125
|
+
};
|
|
126
|
+
overlayClassName: StringConstructor;
|
|
127
|
+
openClassName: StringConstructor;
|
|
128
|
+
prefixCls: StringConstructor;
|
|
129
|
+
mouseEnterDelay: NumberConstructor;
|
|
130
|
+
mouseLeaveDelay: NumberConstructor;
|
|
131
|
+
getPopupContainer: PropType<(triggerNode: HTMLElement) => HTMLElement>;
|
|
132
|
+
arrowPointAtCenter: {
|
|
133
|
+
type: BooleanConstructor;
|
|
134
|
+
default: any;
|
|
135
|
+
};
|
|
136
|
+
arrow: {
|
|
137
|
+
type: PropType<boolean | {
|
|
138
|
+
pointAtCenter?: boolean | undefined;
|
|
139
|
+
}>;
|
|
140
|
+
default: boolean | {
|
|
141
|
+
pointAtCenter?: boolean | undefined;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
autoAdjustOverflow: {
|
|
145
|
+
type: PropType<boolean | AdjustOverflow>;
|
|
146
|
+
default: boolean | AdjustOverflow;
|
|
147
|
+
};
|
|
148
|
+
destroyTooltipOnHide: {
|
|
149
|
+
type: BooleanConstructor;
|
|
150
|
+
default: any;
|
|
151
|
+
};
|
|
152
|
+
align: {
|
|
153
|
+
type: PropType<AlignType>;
|
|
154
|
+
default: AlignType;
|
|
155
|
+
};
|
|
156
|
+
builtinPlacements: {
|
|
157
|
+
type: PropType<BuildInPlacements>;
|
|
158
|
+
default: BuildInPlacements;
|
|
159
|
+
};
|
|
160
|
+
children: ArrayConstructor;
|
|
161
|
+
onVisibleChange: PropType<(vis: boolean) => void>;
|
|
162
|
+
'onUpdate:visible': PropType<(vis: boolean) => void>;
|
|
163
|
+
onOpenChange: PropType<(vis: boolean) => void>;
|
|
164
|
+
'onUpdate:open': PropType<(vis: boolean) => void>;
|
|
165
|
+
}>>;
|
|
166
|
+
showHeader: boolean;
|
|
167
|
+
expandFixed: boolean | "left" | "right";
|
|
168
|
+
expandRowByClick: boolean;
|
|
169
|
+
defaultExpandAllRows: boolean;
|
|
170
|
+
indentSize: number;
|
|
171
|
+
showExpandColumn: boolean;
|
|
172
|
+
childrenColumnName: string;
|
|
173
|
+
}, {}>, Readonly<EditableTableSlots> & EditableTableSlots>;
|
|
174
|
+
export default _default;
|
|
175
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
176
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
177
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
178
|
+
type: PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
179
|
+
} : {
|
|
180
|
+
type: PropType<T[K]>;
|
|
181
|
+
required: true;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
type __VLS_WithDefaults<P, D> = {
|
|
185
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
186
|
+
default: D[K];
|
|
187
|
+
}> : P[K];
|
|
188
|
+
};
|
|
189
|
+
type __VLS_Prettify<T> = {
|
|
190
|
+
[K in keyof T]: T[K];
|
|
191
|
+
} & {};
|
|
192
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
193
|
+
new (): {
|
|
194
|
+
$slots: S;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { defineComponent as L, useSlots as z, ref as j, watch as I, unref as o, openBlock as p, createBlock as O, withCtx as i, createVNode as c, mergeProps as T, createSlots as K, createElementBlock as q, Fragment as A, createElementVNode as x, normalizeClass as G, toDisplayString as H, createCommentVNode as M, renderList as U, renderSlot as W, normalizeProps as $, guardReactiveProps as J } from "vue";
|
|
2
|
+
import { Table as Q } from "ant-design-vue";
|
|
3
|
+
import { ApForm as u } from "../ap-form/index.mjs";
|
|
4
|
+
import { cloneDeep as C, omit as X } from "lodash-unified";
|
|
5
|
+
import "../config-provider/index.mjs";
|
|
6
|
+
import "../hooks/index.mjs";
|
|
7
|
+
import { isDef as Y } from "../utils/index.mjs";
|
|
8
|
+
import Z from "./hooks/use-get-columns.mjs";
|
|
9
|
+
import "./style/index.css";
|
|
10
|
+
import { useNamespace as ee } from "../config-provider/hooks/use-namespace.mjs";
|
|
11
|
+
import { useGlobalConfig as ae } from "../config-provider/hooks/use-global-config.mjs";
|
|
12
|
+
import { useControllableValue as te } from "../hooks/useControllableValue.mjs";
|
|
13
|
+
const xe = /* @__PURE__ */ L({
|
|
14
|
+
name: "EditableTable",
|
|
15
|
+
__name: "index",
|
|
16
|
+
props: {
|
|
17
|
+
dropdownPrefixCls: {},
|
|
18
|
+
pagination: {
|
|
19
|
+
type: [Boolean, Object],
|
|
20
|
+
default: !1
|
|
21
|
+
},
|
|
22
|
+
loading: {
|
|
23
|
+
type: [Boolean, Object],
|
|
24
|
+
default: void 0
|
|
25
|
+
},
|
|
26
|
+
size: {
|
|
27
|
+
default: "middle"
|
|
28
|
+
},
|
|
29
|
+
bordered: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: !1
|
|
32
|
+
},
|
|
33
|
+
locale: {},
|
|
34
|
+
onChange: {},
|
|
35
|
+
onResizeColumn: {},
|
|
36
|
+
rowSelection: {},
|
|
37
|
+
getPopupContainer: {},
|
|
38
|
+
scroll: {},
|
|
39
|
+
sortDirections: {
|
|
40
|
+
default: () => ["ascend", "descend"]
|
|
41
|
+
},
|
|
42
|
+
showSorterTooltip: {
|
|
43
|
+
type: [Boolean, Object],
|
|
44
|
+
default: !0
|
|
45
|
+
},
|
|
46
|
+
prefixCls: {},
|
|
47
|
+
rowKey: {
|
|
48
|
+
default: "key"
|
|
49
|
+
},
|
|
50
|
+
tableLayout: {
|
|
51
|
+
default: "fixed"
|
|
52
|
+
},
|
|
53
|
+
rowClassName: {},
|
|
54
|
+
title: {},
|
|
55
|
+
footer: {},
|
|
56
|
+
id: {},
|
|
57
|
+
showHeader: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: !0
|
|
60
|
+
},
|
|
61
|
+
components: {},
|
|
62
|
+
customRow: {},
|
|
63
|
+
customHeaderRow: {},
|
|
64
|
+
direction: {},
|
|
65
|
+
expandFixed: {
|
|
66
|
+
type: [String, Boolean],
|
|
67
|
+
default: !1
|
|
68
|
+
},
|
|
69
|
+
expandColumnWidth: {},
|
|
70
|
+
expandedRowKeys: {},
|
|
71
|
+
defaultExpandedRowKeys: {},
|
|
72
|
+
expandedRowRender: {},
|
|
73
|
+
expandRowByClick: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: !1
|
|
76
|
+
},
|
|
77
|
+
expandIcon: {},
|
|
78
|
+
onExpand: {},
|
|
79
|
+
onExpandedRowsChange: {},
|
|
80
|
+
defaultExpandAllRows: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: !1
|
|
83
|
+
},
|
|
84
|
+
indentSize: {
|
|
85
|
+
default: 15
|
|
86
|
+
},
|
|
87
|
+
expandIconColumnIndex: {},
|
|
88
|
+
showExpandColumn: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: !0
|
|
91
|
+
},
|
|
92
|
+
expandedRowClassName: {},
|
|
93
|
+
childrenColumnName: {
|
|
94
|
+
default: "children"
|
|
95
|
+
},
|
|
96
|
+
rowExpandable: {},
|
|
97
|
+
sticky: {
|
|
98
|
+
type: [Boolean, Object]
|
|
99
|
+
},
|
|
100
|
+
transformCellText: {},
|
|
101
|
+
columns: {},
|
|
102
|
+
value: {},
|
|
103
|
+
defaultValue: {},
|
|
104
|
+
"onUpdate:value": {},
|
|
105
|
+
maxLength: {},
|
|
106
|
+
name: {
|
|
107
|
+
default: "ap-editable-table-inner-name"
|
|
108
|
+
},
|
|
109
|
+
onFieldChange: {}
|
|
110
|
+
},
|
|
111
|
+
emits: ["update:value"],
|
|
112
|
+
setup(g, {
|
|
113
|
+
expose: h,
|
|
114
|
+
emit: w
|
|
115
|
+
}) {
|
|
116
|
+
const l = g, {
|
|
117
|
+
b: m,
|
|
118
|
+
em: y
|
|
119
|
+
} = ee("editable-table"), v = ae("uiMode", "aplus"), b = z(), R = w, {
|
|
120
|
+
value: s,
|
|
121
|
+
updateValue: B
|
|
122
|
+
} = te(l, R), d = j(), F = u.useWatch(l.name, d);
|
|
123
|
+
I(() => F.value, (t) => {
|
|
124
|
+
var n;
|
|
125
|
+
B(t), (n = l.onChange) == null || n.call(l, t);
|
|
126
|
+
});
|
|
127
|
+
const D = Z(l);
|
|
128
|
+
function E() {
|
|
129
|
+
var t;
|
|
130
|
+
(t = d.value) == null || t.resetFields();
|
|
131
|
+
}
|
|
132
|
+
async function _(t, n) {
|
|
133
|
+
var a;
|
|
134
|
+
const e = await ((a = d.value) == null ? void 0 : a.validateFields(t, n));
|
|
135
|
+
return e == null ? void 0 : e[l.name];
|
|
136
|
+
}
|
|
137
|
+
function k(t) {
|
|
138
|
+
var e, a, r;
|
|
139
|
+
const n = ((e = o(s)) == null ? void 0 : e.length) || 0;
|
|
140
|
+
Y(l.maxLength) && n >= l.maxLength || (r = (a = d.value) == null ? void 0 : a.setFieldValue) == null || r.call(a, l.name, [...o(s) || [], t || {}]);
|
|
141
|
+
}
|
|
142
|
+
function S(t) {
|
|
143
|
+
var e, a;
|
|
144
|
+
const n = C(o(s) || []);
|
|
145
|
+
n.splice(t, 1), (a = (e = d.value) == null ? void 0 : e.setFieldValue) == null || a.call(e, l.name, [...n]);
|
|
146
|
+
}
|
|
147
|
+
function V() {
|
|
148
|
+
return o(s);
|
|
149
|
+
}
|
|
150
|
+
function N(t) {
|
|
151
|
+
var n;
|
|
152
|
+
return (n = o(s)) == null ? void 0 : n[t];
|
|
153
|
+
}
|
|
154
|
+
function P(t, n) {
|
|
155
|
+
var a, r;
|
|
156
|
+
const e = C(o(s));
|
|
157
|
+
e[t] && (e[t] = {
|
|
158
|
+
...e[t],
|
|
159
|
+
...n
|
|
160
|
+
}, (r = (a = d.value) == null ? void 0 : a.setFieldValue) == null || r.call(a, l.name, [...e]));
|
|
161
|
+
}
|
|
162
|
+
return h({
|
|
163
|
+
resetFields: E,
|
|
164
|
+
validateFields: _,
|
|
165
|
+
add: k,
|
|
166
|
+
remove: S,
|
|
167
|
+
getRowData: N,
|
|
168
|
+
getRowsData: V,
|
|
169
|
+
setRowData: P
|
|
170
|
+
}), (t, n) => (p(), O(o(u), {
|
|
171
|
+
"initial-values": {
|
|
172
|
+
[l.name]: o(s)
|
|
173
|
+
},
|
|
174
|
+
ref_key: "formRef",
|
|
175
|
+
ref: d
|
|
176
|
+
}, {
|
|
177
|
+
default: i(() => [c(o(u).FormItem, {
|
|
178
|
+
name: t.name,
|
|
179
|
+
"no-style": ""
|
|
180
|
+
}, {
|
|
181
|
+
default: i(() => [c(o(Q), T(o(X)(l, ["name", "value", "onUpdate:value", "maxLength"]), {
|
|
182
|
+
class: [o(m)(), o(v) === "admin" ? o(m)("admin") : null],
|
|
183
|
+
columns: o(D),
|
|
184
|
+
"data-source": o(s)
|
|
185
|
+
}), K({
|
|
186
|
+
headerCell: i(({
|
|
187
|
+
column: e
|
|
188
|
+
}) => {
|
|
189
|
+
var a, r, f;
|
|
190
|
+
return [(a = e == null ? void 0 : e.fieldProps) != null && a.required || (f = (r = e == null ? void 0 : e.fieldProps) == null ? void 0 : r.rules) != null && f.length ? (p(), q(A, {
|
|
191
|
+
key: 0
|
|
192
|
+
}, [x("span", {
|
|
193
|
+
class: G(o(y)("header-cell", "required"))
|
|
194
|
+
}, "*", 2), x("span", null, H(e.title), 1)], 64)) : M("", !0)];
|
|
195
|
+
}),
|
|
196
|
+
_: 2
|
|
197
|
+
}, [U(b, (e, a) => ({
|
|
198
|
+
name: a,
|
|
199
|
+
fn: i((r) => [W(t.$slots, a, $(J(r || {})))])
|
|
200
|
+
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
201
|
+
_: 3
|
|
202
|
+
}, 8, ["name"])]),
|
|
203
|
+
_: 3
|
|
204
|
+
}, 8, ["initial-values"]));
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
export {
|
|
208
|
+
xe as default
|
|
209
|
+
};
|