@aplus-frontend/ui 0.1.1 → 0.1.3
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 +42 -41
- package/es/src/ap-action/item/index.vue2.mjs +13 -13
- package/es/src/business/ap-input-radio/ApInputRadio.vue.d.ts +37 -0
- package/es/src/business/ap-input-radio/ApInputRadio.vue.mjs +4 -0
- package/es/src/business/ap-input-radio/ApInputRadio.vue2.mjs +59 -0
- package/es/src/business/ap-input-radio/index.d.ts +3 -0
- package/es/src/business/ap-input-radio/interface.d.ts +14 -0
- package/es/src/business/ap-input-radio/style.css +7 -0
- package/es/src/business/ap-select-layout/index.css +1 -0
- package/es/src/business/index.d.ts +152 -1
- package/es/src/business/index.mjs +15 -12
- package/es/src/editable-table/hooks/use-get-columns.mjs +46 -64
- package/es/src/editable-table/interface.d.ts +2 -3
- package/es/src/editable-table/utils.d.ts +1 -0
- package/es/src/editable-table/utils.mjs +75 -35
- package/es/src/index.mjs +188 -187
- package/es/src/locale/lang/en.mjs +22 -22
- package/es/src/locale/lang/zh-cn.mjs +22 -22
- package/es/src/theme/ap-input-radio/ap-input-radio.css +7 -0
- package/es/src/theme/ap-select-layout/ap-select-layout.css +1 -0
- package/lib/index.js +1 -1
- package/lib/src/ap-action/item/index.vue2.js +1 -1
- package/lib/src/business/ap-input-radio/ApInputRadio.vue.d.ts +37 -0
- package/lib/src/business/ap-input-radio/ApInputRadio.vue.js +1 -0
- package/lib/src/business/ap-input-radio/ApInputRadio.vue2.js +1 -0
- package/lib/src/business/ap-input-radio/index.d.ts +3 -0
- package/lib/src/business/ap-input-radio/interface.d.ts +14 -0
- package/lib/src/business/ap-input-radio/style.css +7 -0
- package/lib/src/business/ap-select-layout/index.css +1 -0
- package/lib/src/business/index.d.ts +152 -1
- package/lib/src/business/index.js +1 -1
- package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
- package/lib/src/editable-table/interface.d.ts +2 -3
- package/lib/src/editable-table/utils.d.ts +1 -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-input-radio/ap-input-radio.css +7 -0
- package/lib/src/theme/ap-select-layout/ap-select-layout.css +1 -0
- package/package.json +2 -2
|
@@ -1,81 +1,63 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { omit as
|
|
3
|
-
import {
|
|
4
|
-
import { updateFormProps as
|
|
1
|
+
import { computed as f } from "vue";
|
|
2
|
+
import { omit as g, isFunction as F } from "lodash-unified";
|
|
3
|
+
import { mergeClass as b, getFinalNode as x } from "../utils.mjs";
|
|
4
|
+
import { updateFormProps as R, getFieldProps as h, getPlaceholder as C, getTableRenderProps as I } from "../../ap-table/utils.mjs";
|
|
5
5
|
import "../../config-provider/index.mjs";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { useLocale as D } from "../../config-provider/hooks/use-locale.mjs";
|
|
9
|
-
const v = (t) => {
|
|
6
|
+
import { useLocale as y } from "../../config-provider/hooks/use-locale.mjs";
|
|
7
|
+
const $ = (o) => {
|
|
10
8
|
const {
|
|
11
|
-
t:
|
|
12
|
-
} =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
t: i
|
|
10
|
+
} = y();
|
|
11
|
+
return f(() => {
|
|
12
|
+
let d = o.columns;
|
|
13
|
+
return d ? (d = d.map((e) => ({
|
|
14
|
+
...g(e, ["ellipsis"]),
|
|
16
15
|
customRender({
|
|
17
|
-
value:
|
|
18
|
-
...
|
|
16
|
+
value: t,
|
|
17
|
+
...l
|
|
19
18
|
}) {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
const a = F(e.editable) ? e.editable(l.text, l.record, l.index) : !!e.editable;
|
|
20
|
+
if (!e.valueType && !e.customRender && !e.customRenderFormItem)
|
|
21
|
+
return console.warn("can not render table cell because no `valueType` / `customRender` / `customRenderFormItem`"), null;
|
|
22
|
+
let c;
|
|
23
|
+
if (a) {
|
|
24
|
+
const n = R(e, h(e.fieldProps, {
|
|
25
|
+
value: t,
|
|
26
|
+
...l
|
|
27
|
+
})), u = {};
|
|
28
|
+
o.onFieldChange && (u[`onUpdate:${n.valuePropName || "value"}`] = (s) => {
|
|
29
|
+
var m;
|
|
30
|
+
return (m = o.onFieldChange) == null ? void 0 : m.call(o, l.index, e.dataIndex, s);
|
|
31
|
+
}), c = {
|
|
32
|
+
name: [o.name, l.index, e.dataIndex],
|
|
33
|
+
...n || {},
|
|
34
34
|
// 格式化placeholder
|
|
35
|
-
placeholder:
|
|
35
|
+
placeholder: C(i, e.valueType, n == null ? void 0 : n.placeholder),
|
|
36
36
|
field: {
|
|
37
37
|
style: "width: 100%",
|
|
38
|
-
...(
|
|
39
|
-
...
|
|
40
|
-
class:
|
|
38
|
+
...(n == null ? void 0 : n.field) || {},
|
|
39
|
+
...u,
|
|
40
|
+
class: b("is-editable", n.class)
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}), null));
|
|
52
|
-
}
|
|
43
|
+
} else
|
|
44
|
+
c = {
|
|
45
|
+
field: I(e, {
|
|
46
|
+
value: t,
|
|
47
|
+
...l
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
const r = x(e, a, c, t);
|
|
53
51
|
return e.customRender ? e.customRender({
|
|
54
|
-
value:
|
|
55
|
-
...
|
|
56
|
-
editable:
|
|
52
|
+
value: t,
|
|
53
|
+
...l,
|
|
54
|
+
editable: a,
|
|
57
55
|
originalNode: r
|
|
58
56
|
}) : r;
|
|
59
57
|
}
|
|
60
|
-
})),
|
|
58
|
+
})), d) : [];
|
|
61
59
|
});
|
|
62
|
-
function m(l, e, n) {
|
|
63
|
-
return A.includes(l.valueType) ? n : l.copyable || l.ellipsis ? s(B.Paragraph, {
|
|
64
|
-
copyable: l.copyable ? {
|
|
65
|
-
text: e,
|
|
66
|
-
tooltip: !1
|
|
67
|
-
} : !1,
|
|
68
|
-
ellipsis: l.ellipsis ? R(l.ellipsis) ? {
|
|
69
|
-
tooltip: e
|
|
70
|
-
} : {
|
|
71
|
-
...l.ellipsis,
|
|
72
|
-
tooltip: e
|
|
73
|
-
} : !1,
|
|
74
|
-
content: l.ellipsis ? I(l, e) : n
|
|
75
|
-
}, null) : n;
|
|
76
|
-
}
|
|
77
|
-
return f;
|
|
78
60
|
};
|
|
79
61
|
export {
|
|
80
|
-
|
|
62
|
+
$ as default
|
|
81
63
|
};
|
|
@@ -29,10 +29,9 @@ export type EditableColumnType<RecordType = any, ValueType extends ApTableValueT
|
|
|
29
29
|
*/
|
|
30
30
|
valueEnum?: ValueEnum;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @deprecated 未实现,请使用`customRender`
|
|
32
|
+
* 自定义表单,适用于内置`valueType`不满足的情况下使用
|
|
34
33
|
*/
|
|
35
|
-
customRenderFormItem?: (config: EditableColumnType<RecordType, ValueType
|
|
34
|
+
customRenderFormItem?: (config: EditableColumnType<RecordType, ValueType>, fieldProps: Record<string, any>, editable: boolean) => any;
|
|
36
35
|
/**
|
|
37
36
|
* 指定值类型(将会用于普通列和可编辑表格的渲染)
|
|
38
37
|
*/
|
|
@@ -27,3 +27,4 @@ export declare function mergeClass(current: string, classNames?: string | string
|
|
|
27
27
|
* @param options
|
|
28
28
|
*/
|
|
29
29
|
export declare function scrollToRowIndex(index: number, container?: HTMLElement, options?: StandardBehaviorOptions): void;
|
|
30
|
+
export declare function getFinalNode(column: EditableColumnType, editable: boolean, innerProps: Record<string, any>, value: any): any;
|
|
@@ -1,50 +1,90 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { isVNode as f, createVNode as s, mergeProps as d } from "vue";
|
|
2
|
+
import { isFunction as n, isArray as p, isBoolean as a, omit as u } from "lodash-unified";
|
|
3
|
+
import { apTableFormItemMap as c, noRenderAsFormItemValueList as y, apTableRenderItemMap as m } from "../ap-table/constants.mjs";
|
|
4
|
+
import { isDef as b } from "../utils/index.mjs";
|
|
5
|
+
import { getValueStr as g } from "../ap-field/number/helper.mjs";
|
|
6
|
+
import T from "scroll-into-view-if-needed";
|
|
7
|
+
import { Typography as C } from "ant-design-vue";
|
|
8
|
+
import "../ap-form/index.mjs";
|
|
9
|
+
import I from "../ap-form/ap-form-item.vue.mjs";
|
|
10
|
+
function P(e) {
|
|
11
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
|
|
12
|
+
}
|
|
13
|
+
function R(e) {
|
|
14
|
+
return c[e];
|
|
15
|
+
}
|
|
16
|
+
function _(e) {
|
|
17
|
+
if (!e.fieldProps)
|
|
14
18
|
return !1;
|
|
15
|
-
const
|
|
16
|
-
return
|
|
17
|
-
}
|
|
18
|
-
function
|
|
19
|
-
if (
|
|
20
|
-
return
|
|
21
|
-
if (
|
|
22
|
-
const o =
|
|
23
|
-
return
|
|
19
|
+
const r = n(e.fieldProps) ? e.fieldProps({}) : e.fieldProps;
|
|
20
|
+
return b(r.required) ? r.required : (p(r.rules) ? r.rules : r.rules ? [r.rules] : []).some((t) => t.required);
|
|
21
|
+
}
|
|
22
|
+
function F(e, r) {
|
|
23
|
+
if (e.valueType === "text" || e.valueType === "textArea")
|
|
24
|
+
return r || "--";
|
|
25
|
+
if (e.valueType === "number") {
|
|
26
|
+
const o = e.fieldProps ? n(e.fieldProps) ? e.fieldProps({}) : e.fieldProps : {};
|
|
27
|
+
return g(r, o) || "--";
|
|
24
28
|
}
|
|
25
|
-
return
|
|
29
|
+
return r;
|
|
26
30
|
}
|
|
27
|
-
function
|
|
28
|
-
const o = [
|
|
29
|
-
if (
|
|
30
|
-
const t =
|
|
31
|
+
function D(e, r) {
|
|
32
|
+
const o = [e];
|
|
33
|
+
if (r) {
|
|
34
|
+
const t = p(r) ? r : [r];
|
|
31
35
|
o.unshift(...t);
|
|
32
36
|
}
|
|
33
37
|
return o.join(" ");
|
|
34
38
|
}
|
|
35
|
-
function
|
|
36
|
-
const t =
|
|
37
|
-
console.log(t), t &&
|
|
39
|
+
function N(e, r = document.body, o = {}) {
|
|
40
|
+
const t = r.querySelectorAll("tr.ant-table-row")[e];
|
|
41
|
+
console.log(t), t && T(t, {
|
|
38
42
|
scrollMode: "if-needed",
|
|
39
43
|
block: "nearest",
|
|
40
44
|
behavior: "smooth",
|
|
41
45
|
...o
|
|
42
46
|
});
|
|
43
47
|
}
|
|
48
|
+
function V(e, r, o) {
|
|
49
|
+
return y.includes(e.valueType) ? o : e.copyable || e.ellipsis ? s(C.Paragraph, {
|
|
50
|
+
copyable: e.copyable ? {
|
|
51
|
+
text: r,
|
|
52
|
+
tooltip: !1
|
|
53
|
+
} : !1,
|
|
54
|
+
ellipsis: e.ellipsis ? a(e.ellipsis) ? {
|
|
55
|
+
tooltip: r
|
|
56
|
+
} : {
|
|
57
|
+
...e.ellipsis,
|
|
58
|
+
tooltip: r
|
|
59
|
+
} : !1,
|
|
60
|
+
content: e.ellipsis ? F(e, r) : o
|
|
61
|
+
}, null) : o;
|
|
62
|
+
}
|
|
63
|
+
function O(e, r, o, t) {
|
|
64
|
+
let l;
|
|
65
|
+
if (e.valueType)
|
|
66
|
+
if (r) {
|
|
67
|
+
const i = R(e.valueType);
|
|
68
|
+
l = s(i, o, null);
|
|
69
|
+
} else {
|
|
70
|
+
const i = m[e.valueType];
|
|
71
|
+
l = V(e, t, s(i, d(o.field, {
|
|
72
|
+
mode: "read"
|
|
73
|
+
}), null));
|
|
74
|
+
}
|
|
75
|
+
if (e.customRenderFormItem) {
|
|
76
|
+
const i = e.customRenderFormItem(e, o.field, r);
|
|
77
|
+
l = s(I, u(o, ["field"]), P(i) ? i : {
|
|
78
|
+
default: () => [i]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return l;
|
|
82
|
+
}
|
|
44
83
|
export {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
84
|
+
_ as getColumnIsRequired,
|
|
85
|
+
R as getEditableComponent,
|
|
86
|
+
O as getFinalNode,
|
|
87
|
+
F as getRawDisplayValue,
|
|
88
|
+
D as mergeClass,
|
|
89
|
+
N as scrollToRowIndex
|
|
50
90
|
};
|