@aplus-frontend/ui 0.0.38 → 0.0.40
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 +149 -148
- package/es/src/ap-field/interface.d.ts +1 -1
- package/es/src/ap-field/text-area/index.vue.mjs +9 -10
- package/es/src/ap-form/ap-form-item-group/index.vue.mjs +28 -27
- package/es/src/ap-form/search-form/index.vue.mjs +107 -102
- package/es/src/ap-form/style/ap-form-item.css +6 -6
- package/es/src/ap-table/ap-table.vue.d.ts +16 -4
- package/es/src/ap-table/ap-table.vue.mjs +68 -66
- package/es/src/ap-table/constants.d.ts +8 -14
- package/es/src/ap-table/hooks/use-table-row-selection.d.ts +1 -1
- package/es/src/ap-table/interface.d.ts +6 -2
- package/es/src/business/ap-export-group/ApExportGroup.vue.d.ts +14 -0
- package/es/src/business/ap-export-group/ApExportGroup.vue.mjs +4 -0
- package/es/src/business/ap-export-group/ApExportGroup.vue2.mjs +117 -0
- package/es/src/business/ap-export-group/interface.d.ts +37 -0
- package/es/src/business/ap-export-group/interface.mjs +4 -0
- package/es/src/business/expandAlert/ApExpandAlert.vue2.mjs +1 -1
- package/es/src/business/expandAlert/interface.d.ts +1 -1
- package/es/src/business/index.d.ts +105 -0
- package/es/src/business/index.mjs +12 -9
- package/es/src/config-provider/config-provider.mjs +22 -17
- package/es/src/editable-table/form-item.vue.d.ts +4 -0
- package/es/src/editable-table/form-item.vue.mjs +83 -75
- package/es/src/editable-table/index.vue.d.ts +4 -0
- package/es/src/editable-table/index.vue.mjs +80 -72
- package/es/src/editable-table/interface.d.ts +8 -0
- package/es/src/editable-table/utils.d.ts +8 -0
- package/es/src/editable-table/utils.mjs +29 -18
- package/es/src/index.mjs +175 -174
- package/es/src/locale/lang/en.mjs +6 -0
- package/es/src/locale/lang/zh-cn.mjs +6 -0
- package/es/src/theme/ap-form/ap-form-item.css +6 -6
- package/es/src/theme/css-var/index.d.ts +7 -0
- package/es/src/theme/css-var/index.mjs +45 -0
- package/lib/index.js +1 -1
- package/lib/src/ap-field/interface.d.ts +1 -1
- package/lib/src/ap-field/text-area/index.vue.js +1 -1
- package/lib/src/ap-form/ap-form-item-group/index.vue.js +1 -1
- package/lib/src/ap-form/search-form/index.vue.js +1 -1
- package/lib/src/ap-form/style/ap-form-item.css +6 -6
- package/lib/src/ap-table/ap-table.vue.d.ts +16 -4
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/ap-table/constants.d.ts +8 -14
- package/lib/src/ap-table/hooks/use-table-row-selection.d.ts +1 -1
- package/lib/src/ap-table/interface.d.ts +6 -2
- package/lib/src/business/ap-export-group/ApExportGroup.vue.d.ts +14 -0
- package/lib/src/business/ap-export-group/ApExportGroup.vue.js +1 -0
- package/lib/src/business/ap-export-group/ApExportGroup.vue2.js +1 -0
- package/lib/src/business/ap-export-group/interface.d.ts +37 -0
- package/lib/src/business/ap-export-group/interface.js +1 -0
- package/lib/src/business/expandAlert/ApExpandAlert.vue2.js +1 -1
- package/lib/src/business/expandAlert/interface.d.ts +1 -1
- package/lib/src/business/index.d.ts +105 -0
- package/lib/src/business/index.js +1 -1
- package/lib/src/config-provider/config-provider.js +1 -1
- package/lib/src/editable-table/form-item.vue.d.ts +4 -0
- package/lib/src/editable-table/form-item.vue.js +1 -1
- package/lib/src/editable-table/index.vue.d.ts +4 -0
- package/lib/src/editable-table/index.vue.js +1 -1
- package/lib/src/editable-table/interface.d.ts +8 -0
- package/lib/src/editable-table/utils.d.ts +8 -0
- package/lib/src/editable-table/utils.js +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/locale/lang/en.js +1 -1
- package/lib/src/locale/lang/zh-cn.js +1 -1
- package/lib/src/theme/ap-form/ap-form-item.css +6 -6
- package/lib/src/theme/css-var/index.d.ts +7 -0
- package/lib/src/theme/css-var/index.js +1 -0
- package/package.json +8 -7
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
1
|
+
import { defineComponent as q, useSlots as G, ref as y, watch as H, unref as o, openBlock as b, createBlock as U, withCtx as c, createVNode as v, mergeProps as W, createSlots as $, createElementBlock as J, Fragment as Q, createElementVNode as R, normalizeClass as X, toDisplayString as Y, createCommentVNode as Z, renderList as ee, renderSlot as te, normalizeProps as ae, guardReactiveProps as ne } from "vue";
|
|
2
|
+
import { Table as oe } 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 { isNumber as p, cloneDeep as h, omit as le } 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 { getColumnIsRequired as
|
|
9
|
-
import
|
|
8
|
+
import { scrollToRowIndex as re, getColumnIsRequired as se } from "./utils.mjs";
|
|
9
|
+
import ue from "./hooks/use-get-columns.mjs";
|
|
10
10
|
import "./style/index.css";
|
|
11
|
-
import { useNamespace as
|
|
12
|
-
import { useGlobalConfig as
|
|
13
|
-
import { useControllableValue as
|
|
14
|
-
const
|
|
11
|
+
import { useNamespace as de } from "../config-provider/hooks/use-namespace.mjs";
|
|
12
|
+
import { useGlobalConfig as ie } from "../config-provider/hooks/use-global-config.mjs";
|
|
13
|
+
import { useControllableValue as me } from "../hooks/useControllableValue.mjs";
|
|
14
|
+
const Fe = /* @__PURE__ */ q({
|
|
15
15
|
name: "EditableTable",
|
|
16
16
|
__name: "index",
|
|
17
17
|
props: {
|
|
@@ -110,108 +110,116 @@ const be = /* @__PURE__ */ T({
|
|
|
110
110
|
onFieldChange: {}
|
|
111
111
|
},
|
|
112
112
|
emits: ["update:value"],
|
|
113
|
-
setup(
|
|
114
|
-
expose:
|
|
115
|
-
emit:
|
|
113
|
+
setup(B, {
|
|
114
|
+
expose: F,
|
|
115
|
+
emit: D
|
|
116
116
|
}) {
|
|
117
|
-
const l =
|
|
117
|
+
const l = B, {
|
|
118
118
|
b: g,
|
|
119
|
-
em:
|
|
120
|
-
} =
|
|
119
|
+
em: _
|
|
120
|
+
} = de("editable-table"), k = ie("uiMode", "aplus"), E = G(), L = D, C = y(), {
|
|
121
121
|
value: s,
|
|
122
|
-
updateValue:
|
|
123
|
-
} =
|
|
124
|
-
|
|
125
|
-
var
|
|
126
|
-
|
|
122
|
+
updateValue: N
|
|
123
|
+
} = me(l, L), u = y(), S = f.useWatch(l.name, u);
|
|
124
|
+
H(() => S.value, (e) => {
|
|
125
|
+
var a;
|
|
126
|
+
N(e), (a = l.onChange) == null || a.call(l, e);
|
|
127
127
|
});
|
|
128
|
-
const
|
|
129
|
-
function
|
|
128
|
+
const V = ue(l);
|
|
129
|
+
function T() {
|
|
130
130
|
var e;
|
|
131
131
|
(e = u.value) == null || e.resetFields();
|
|
132
132
|
}
|
|
133
|
-
async function
|
|
133
|
+
async function z(e, a) {
|
|
134
134
|
var t;
|
|
135
|
-
const
|
|
136
|
-
return
|
|
135
|
+
const n = await ((t = u.value) == null ? void 0 : t.validateFields(e, a));
|
|
136
|
+
return n == null ? void 0 : n[l.name];
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function I(e, a) {
|
|
139
139
|
var r, d, i;
|
|
140
|
-
const
|
|
141
|
-
if (x(l.maxLength) &&
|
|
140
|
+
const n = ((r = o(s)) == null ? void 0 : r.length) || 0;
|
|
141
|
+
if (x(l.maxLength) && n >= l.maxLength)
|
|
142
142
|
return;
|
|
143
|
-
const t = [...
|
|
144
|
-
x(
|
|
143
|
+
const t = [...o(s) || []];
|
|
144
|
+
x(a) ? t.splice(a, 0, {
|
|
145
145
|
...e || {}
|
|
146
146
|
}) : t.push({
|
|
147
147
|
...e || {}
|
|
148
148
|
}), (i = (d = u.value) == null ? void 0 : d.setFieldValue) == null || i.call(d, l.name, t);
|
|
149
149
|
}
|
|
150
|
-
function P(e,
|
|
151
|
-
var i, m,
|
|
152
|
-
const
|
|
153
|
-
if (x(l.maxLength) &&
|
|
150
|
+
function P(e, a = "suffix") {
|
|
151
|
+
var i, m, w;
|
|
152
|
+
const n = ((i = o(s)) == null ? void 0 : i.length) || 0, t = p(e) ? e : e.length;
|
|
153
|
+
if (x(l.maxLength) && n + t > l.maxLength)
|
|
154
154
|
return;
|
|
155
|
-
const r = [...
|
|
156
|
-
|
|
155
|
+
const r = [...o(s) || []], d = p(e) ? new Array(e).fill({}) : h(e);
|
|
156
|
+
a === "suffix" ? r.push(...d) : r.unshift(...d), (w = (m = u.value) == null ? void 0 : m.setFieldValue) == null || w.call(m, l.name, r);
|
|
157
157
|
}
|
|
158
158
|
function j(e) {
|
|
159
159
|
var t, r;
|
|
160
|
-
let
|
|
161
|
-
const
|
|
162
|
-
|
|
160
|
+
let a = h(o(s) || []);
|
|
161
|
+
const n = p(e) ? [e] : e;
|
|
162
|
+
a = a.filter((d, i) => !n.includes(i)), (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, a);
|
|
163
163
|
}
|
|
164
164
|
function A() {
|
|
165
|
-
return
|
|
165
|
+
return o(s);
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
var
|
|
169
|
-
return (
|
|
167
|
+
function O(e) {
|
|
168
|
+
var a;
|
|
169
|
+
return (a = o(s)) == null ? void 0 : a[e];
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function K(e, a) {
|
|
172
172
|
var t, r;
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
...
|
|
176
|
-
...
|
|
177
|
-
}, (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, [...
|
|
173
|
+
const n = h(o(s));
|
|
174
|
+
n[e] && (n[e] = {
|
|
175
|
+
...n[e],
|
|
176
|
+
...a
|
|
177
|
+
}, (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, [...n]));
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
function M(e, a) {
|
|
180
|
+
var t;
|
|
181
|
+
const n = e === "end" ? s.value.length - 1 : e;
|
|
182
|
+
re(n, (t = C.value) == null ? void 0 : t.$el, a);
|
|
183
|
+
}
|
|
184
|
+
return F({
|
|
185
|
+
resetFields: T,
|
|
186
|
+
validateFields: z,
|
|
187
|
+
add: I,
|
|
183
188
|
remove: j,
|
|
184
|
-
getRowData:
|
|
189
|
+
getRowData: O,
|
|
185
190
|
getRowsData: A,
|
|
186
|
-
setRowData:
|
|
187
|
-
addMultiple: P
|
|
188
|
-
|
|
191
|
+
setRowData: K,
|
|
192
|
+
addMultiple: P,
|
|
193
|
+
scrollTo: M
|
|
194
|
+
}), (e, a) => (b(), U(o(f), {
|
|
189
195
|
"initial-values": {
|
|
190
|
-
[l.name]:
|
|
196
|
+
[l.name]: o(s)
|
|
191
197
|
},
|
|
192
198
|
ref_key: "formRef",
|
|
193
199
|
ref: u
|
|
194
200
|
}, {
|
|
195
|
-
default: c(() => [
|
|
201
|
+
default: c(() => [v(o(f).FormItem, {
|
|
196
202
|
name: e.name,
|
|
197
203
|
"no-style": ""
|
|
198
204
|
}, {
|
|
199
|
-
default: c(() => [
|
|
200
|
-
class: [
|
|
201
|
-
columns:
|
|
202
|
-
"data-source":
|
|
203
|
-
|
|
205
|
+
default: c(() => [v(o(oe), W(o(le)(l, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
|
|
206
|
+
class: [o(g)(), o(k) === "admin" ? o(g)("admin") : null],
|
|
207
|
+
columns: o(V),
|
|
208
|
+
"data-source": o(s),
|
|
209
|
+
ref_key: "tableRef",
|
|
210
|
+
ref: C
|
|
211
|
+
}), $({
|
|
204
212
|
headerCell: c(({
|
|
205
|
-
column:
|
|
206
|
-
}) => [
|
|
213
|
+
column: n
|
|
214
|
+
}) => [o(se)(n) ? (b(), J(Q, {
|
|
207
215
|
key: 0
|
|
208
|
-
}, [
|
|
209
|
-
class:
|
|
210
|
-
}, "*", 2),
|
|
216
|
+
}, [R("span", {
|
|
217
|
+
class: X(o(_)("header-cell", "required"))
|
|
218
|
+
}, "*", 2), R("span", null, Y(n.title), 1)], 64)) : Z("", !0)]),
|
|
211
219
|
_: 2
|
|
212
|
-
}, [
|
|
220
|
+
}, [ee(E, (n, t) => ({
|
|
213
221
|
name: t,
|
|
214
|
-
fn: c((r) => [
|
|
222
|
+
fn: c((r) => [te(e.$slots, t, ae(ne(r || {})))])
|
|
215
223
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
216
224
|
_: 3
|
|
217
225
|
}, 8, ["name"])]),
|
|
@@ -220,5 +228,5 @@ const be = /* @__PURE__ */ T({
|
|
|
220
228
|
}
|
|
221
229
|
});
|
|
222
230
|
export {
|
|
223
|
-
|
|
231
|
+
Fe as default
|
|
224
232
|
};
|
|
@@ -5,6 +5,7 @@ import { DataIndex } from 'ant-design-vue/es/vc-table/interface';
|
|
|
5
5
|
import { FormItemProps } from 'ant-design-vue';
|
|
6
6
|
import { VNode } from 'vue';
|
|
7
7
|
import { EllipsisConfig } from 'ant-design-vue/es/typography/Base';
|
|
8
|
+
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
8
9
|
|
|
9
10
|
export type EditableColumnType<RecordType = any, ValueType extends ApTableValueTypes = ApTableValueTypes> = ValueType extends ApTableValueTypes ? Omit<ColumnType<RecordType>, 'children' | 'customRender' | 'ellipsis'> & {
|
|
10
11
|
children?: EditableColumnType<RecordType, ValueType>;
|
|
@@ -158,6 +159,13 @@ export type EditableTableExpose<ModelType = any, RecordType = any> = {
|
|
|
158
159
|
* @returns
|
|
159
160
|
*/
|
|
160
161
|
setRowData: (index: number, data: Partial<RecordType>) => void;
|
|
162
|
+
/**
|
|
163
|
+
* 滚动到表格的某行
|
|
164
|
+
* @param index
|
|
165
|
+
* @param options
|
|
166
|
+
* @returns
|
|
167
|
+
*/
|
|
168
|
+
scrollTo: (index: number | 'end', options?: StandardBehaviorOptions) => void;
|
|
161
169
|
};
|
|
162
170
|
/**
|
|
163
171
|
* 可编辑表格作为表单项暴露的实例
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EditableColumnType } from './interface';
|
|
2
|
+
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* 获取编辑模式下默认映射的组件
|
|
@@ -20,3 +21,10 @@ export declare function getColumnIsRequired(column: EditableColumnType<any, 'tex
|
|
|
20
21
|
*/
|
|
21
22
|
export declare function getRawDisplayValue(column: EditableColumnType, value: any): any;
|
|
22
23
|
export declare function mergeClass(current: string, classNames?: string | string[]): string;
|
|
24
|
+
/**
|
|
25
|
+
* 滚动到表格的某行
|
|
26
|
+
* @param index
|
|
27
|
+
* @param container
|
|
28
|
+
* @param options
|
|
29
|
+
*/
|
|
30
|
+
export declare function scrollToRowIndex(index: number, container?: HTMLElement, options?: StandardBehaviorOptions): void;
|
|
@@ -1,39 +1,50 @@
|
|
|
1
|
-
import { isFunction as
|
|
1
|
+
import { isFunction as i, isArray as n } from "lodash-unified";
|
|
2
2
|
import { apTableFormItemMap as s } from "../ap-table/constants.mjs";
|
|
3
3
|
import { isDef as f } from "../utils/index.mjs";
|
|
4
|
-
import { getValueStr as
|
|
5
|
-
|
|
4
|
+
import { getValueStr as l } from "../ap-field/number/helper.mjs";
|
|
5
|
+
import d from "scroll-into-view-if-needed";
|
|
6
|
+
function m(r) {
|
|
6
7
|
const e = s[r];
|
|
7
8
|
return e || console.warn(
|
|
8
9
|
`${r} can not render because of no default renderer, use customRender instead.`
|
|
9
10
|
), e;
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
+
function b(r) {
|
|
12
13
|
if (!r.fieldProps)
|
|
13
14
|
return !1;
|
|
14
|
-
const e =
|
|
15
|
-
return f(e.required) ? e.required : (n(e.rules) ? e.rules : e.rules ? [e.rules] : []).some((
|
|
15
|
+
const e = i(r.fieldProps) ? r.fieldProps({}) : r.fieldProps;
|
|
16
|
+
return f(e.required) ? e.required : (n(e.rules) ? e.rules : e.rules ? [e.rules] : []).some((t) => t.required);
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
+
function g(r, e) {
|
|
18
19
|
if (r.valueType === "text" || r.valueType === "textArea")
|
|
19
20
|
return e || "--";
|
|
20
21
|
if (r.valueType === "number") {
|
|
21
|
-
const
|
|
22
|
-
return
|
|
22
|
+
const o = r.fieldProps ? i(r.fieldProps) ? r.fieldProps({}) : r.fieldProps : {};
|
|
23
|
+
return l(e, o) || "--";
|
|
23
24
|
}
|
|
24
25
|
return e;
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
const
|
|
27
|
+
function w(r, e) {
|
|
28
|
+
const o = [r];
|
|
28
29
|
if (e) {
|
|
29
|
-
const
|
|
30
|
-
|
|
30
|
+
const t = n(e) ? e : [e];
|
|
31
|
+
o.unshift(...t);
|
|
31
32
|
}
|
|
32
|
-
return
|
|
33
|
+
return o.join(" ");
|
|
34
|
+
}
|
|
35
|
+
function y(r, e = document.body, o = {}) {
|
|
36
|
+
const t = e.querySelectorAll("tr.ant-table-row")[r];
|
|
37
|
+
console.log(t), t && d(t, {
|
|
38
|
+
scrollMode: "if-needed",
|
|
39
|
+
block: "nearest",
|
|
40
|
+
behavior: "smooth",
|
|
41
|
+
...o
|
|
42
|
+
});
|
|
33
43
|
}
|
|
34
44
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
b as getColumnIsRequired,
|
|
46
|
+
m as getEditableComponent,
|
|
47
|
+
g as getRawDisplayValue,
|
|
48
|
+
w as mergeClass,
|
|
49
|
+
y as scrollToRowIndex
|
|
39
50
|
};
|