@aplus-frontend/ui 0.0.20 → 0.0.22
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 +34 -32
- package/es/src/ap-form/hooks/use-watch.d.ts +2 -2
- package/es/src/ap-form/modal-form/index.vue.mjs +41 -39
- package/es/src/ap-list/hooks/use-offline-list.d.ts +21 -0
- package/es/src/ap-list/hooks/use-offline-list.mjs +32 -0
- package/es/src/ap-list/index.d.ts +4 -0
- package/es/src/ap-list/index.mjs +2 -0
- package/es/src/ap-list/index.vue.d.ts +153 -0
- package/es/src/ap-list/index.vue.mjs +137 -0
- package/es/src/ap-list/index.vue2.mjs +4 -0
- package/es/src/ap-list/interface.d.ts +100 -0
- package/es/src/ap-list/interface.mjs +1 -0
- package/es/src/ap-list/style/index.css +11 -0
- package/es/src/ap-table/ap-table.vue.mjs +123 -113
- package/es/src/ap-table/interface.d.ts +8 -6
- package/es/src/ap-table/style/ap-table.css +19 -0
- package/es/src/ap-table/utils.d.ts +826 -670
- package/es/src/editable-table/hooks/use-get-columns.d.ts +3 -25
- package/es/src/editable-table/hooks/use-get-columns.mjs +47 -45
- package/es/src/editable-table/interface.d.ts +6 -1
- package/es/src/editable-table/style/index.css +3 -0
- package/es/src/index.d.ts +1 -0
- package/es/src/index.mjs +230 -227
- package/es/src/theme/ap-list/index.css +11 -0
- package/es/src/theme/ap-table/ap-table.css +19 -0
- package/es/src/theme/editable-table/index.css +3 -0
- package/lib/index.js +1 -1
- package/lib/src/ap-form/hooks/use-watch.d.ts +2 -2
- package/lib/src/ap-form/modal-form/index.vue.js +1 -1
- package/lib/src/ap-list/hooks/use-offline-list.d.ts +21 -0
- package/lib/src/ap-list/hooks/use-offline-list.js +1 -0
- package/lib/src/ap-list/index.d.ts +4 -0
- package/lib/src/ap-list/index.js +1 -0
- package/lib/src/ap-list/index.vue.d.ts +153 -0
- package/lib/src/ap-list/index.vue.js +1 -0
- package/lib/src/ap-list/index.vue2.js +1 -0
- package/lib/src/ap-list/interface.d.ts +100 -0
- package/lib/src/ap-list/interface.js +1 -0
- package/lib/src/ap-list/style/index.css +11 -0
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/ap-table/interface.d.ts +8 -6
- package/lib/src/ap-table/style/ap-table.css +19 -0
- package/lib/src/ap-table/utils.d.ts +826 -670
- package/lib/src/editable-table/hooks/use-get-columns.d.ts +3 -25
- package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
- package/lib/src/editable-table/interface.d.ts +6 -1
- package/lib/src/editable-table/style/index.css +3 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +1 -1
- package/lib/src/theme/ap-list/index.css +11 -0
- package/lib/src/theme/ap-table/ap-table.css +19 -0
- package/lib/src/theme/editable-table/index.css +3 -0
- package/package.json +1 -1
|
@@ -1,28 +1,6 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
1
2
|
import { EditableTableFormItemProps, EditableTableProps } from '../interface';
|
|
2
|
-
import {
|
|
3
|
-
import { TableColumnType } from 'ant-design-vue';
|
|
4
|
-
import { ValueEnum } from '../..';
|
|
3
|
+
import { ColumnType } from 'ant-design-vue/es/table';
|
|
5
4
|
|
|
6
|
-
declare const useGetColumns: (props: EditableTableProps | EditableTableFormItemProps) => ComputedRef<
|
|
7
|
-
children?: (Omit< TableColumnType<any>, "children" | "customRender"> & any) | undefined;
|
|
8
|
-
tooltip?: string | undefined;
|
|
9
|
-
copyable?: boolean | undefined;
|
|
10
|
-
editable?: boolean | ((text: any, record: any, index: number) => boolean) | undefined;
|
|
11
|
-
valueEnum?: ValueEnum | undefined;
|
|
12
|
-
customRenderFormItem?: ((config: Omit< TableColumnType<any>, "children" | "customRender"> & any) => any) | undefined;
|
|
13
|
-
valueType?: any;
|
|
14
|
-
fieldProps?: any;
|
|
15
|
-
customRender?: ((opt: {
|
|
16
|
-
value: any;
|
|
17
|
-
text: any;
|
|
18
|
-
record: any;
|
|
19
|
-
index: number;
|
|
20
|
-
renderIndex: number;
|
|
21
|
-
column: TableColumnType<any>;
|
|
22
|
-
editable?: boolean | undefined;
|
|
23
|
-
originalNode?: VNode<RendererNode, RendererElement, {
|
|
24
|
-
[key: string]: any;
|
|
25
|
-
}> | undefined;
|
|
26
|
-
}) => any) | undefined;
|
|
27
|
-
})[]>;
|
|
5
|
+
declare const useGetColumns: (props: EditableTableProps | EditableTableFormItemProps) => ComputedRef<ColumnType<any>[]>;
|
|
28
6
|
export default useGetColumns;
|
|
@@ -1,78 +1,80 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { isFunction as C } from "lodash-unified";
|
|
3
|
-
import { getEditableComponent as
|
|
4
|
-
import { updateFormProps as
|
|
1
|
+
import { computed as y, createVNode as i, mergeProps as x } from "vue";
|
|
2
|
+
import { omit as h, isFunction as C, isBoolean as F } from "lodash-unified";
|
|
3
|
+
import { getEditableComponent as R } from "../utils.mjs";
|
|
4
|
+
import { updateFormProps as T, getFieldProps as I, getPlaceholder as N, getTableRenderProps as L } from "../../ap-table/utils.mjs";
|
|
5
5
|
import "../../config-provider/index.mjs";
|
|
6
|
-
import { apTableRenderItemMap as
|
|
7
|
-
import { Typography as
|
|
8
|
-
import { useLocale as
|
|
9
|
-
const
|
|
6
|
+
import { apTableRenderItemMap as M, noRenderAsFormItemValueList as V } from "../../ap-table/constants.mjs";
|
|
7
|
+
import { Typography as w } from "ant-design-vue";
|
|
8
|
+
import { useLocale as A } from "../../config-provider/hooks/use-locale.mjs";
|
|
9
|
+
const q = (t) => {
|
|
10
10
|
const {
|
|
11
|
-
t:
|
|
12
|
-
} =
|
|
13
|
-
let o =
|
|
11
|
+
t: u
|
|
12
|
+
} = A(), f = y(() => {
|
|
13
|
+
let o = t.columns;
|
|
14
14
|
return o ? (o = o.map((e) => ({
|
|
15
|
-
...e,
|
|
15
|
+
...h(e, ["ellipsis"]),
|
|
16
16
|
customRender({
|
|
17
|
-
value:
|
|
18
|
-
...
|
|
17
|
+
value: n,
|
|
18
|
+
...a
|
|
19
19
|
}) {
|
|
20
|
-
const
|
|
21
|
-
let
|
|
22
|
-
if (
|
|
23
|
-
const
|
|
24
|
-
value:
|
|
25
|
-
...
|
|
26
|
-
})),
|
|
27
|
-
|
|
20
|
+
const c = C(e.editable) ? e.editable(a.text, a.record, a.index) : !!e.editable;
|
|
21
|
+
let r;
|
|
22
|
+
if (c) {
|
|
23
|
+
const d = R(e.valueType), l = T(e, I(e.fieldProps, {
|
|
24
|
+
value: n,
|
|
25
|
+
...a
|
|
26
|
+
})), s = {};
|
|
27
|
+
t.onFieldChange && (s[`onUpdate:${l.valuePropName || "value"}`] = (g) => {
|
|
28
28
|
var p;
|
|
29
|
-
return (p =
|
|
29
|
+
return (p = t.onFieldChange) == null ? void 0 : p.call(t, a.index, e.dataIndex, g);
|
|
30
30
|
});
|
|
31
31
|
const b = {
|
|
32
|
-
name: [
|
|
33
|
-
...
|
|
32
|
+
name: [t.name, a.index, e.dataIndex],
|
|
33
|
+
...l || {},
|
|
34
34
|
// 格式化placeholder
|
|
35
|
-
placeholder:
|
|
35
|
+
placeholder: N(u, e.valueType, l == null ? void 0 : l.placeholder),
|
|
36
36
|
field: {
|
|
37
37
|
style: "width: 100%",
|
|
38
|
-
...(
|
|
39
|
-
...
|
|
38
|
+
...(l == null ? void 0 : l.field) || {},
|
|
39
|
+
...s
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
r = i(d, b, null);
|
|
43
43
|
} else {
|
|
44
|
-
const
|
|
45
|
-
value:
|
|
46
|
-
...
|
|
44
|
+
const d = M[e.valueType], l = L(e, {
|
|
45
|
+
value: n,
|
|
46
|
+
...a
|
|
47
47
|
});
|
|
48
|
-
|
|
48
|
+
r = m(e, n, i(d, x(l, {
|
|
49
49
|
mode: "read"
|
|
50
50
|
}), null));
|
|
51
51
|
}
|
|
52
52
|
return e.customRender ? e.customRender({
|
|
53
|
-
value:
|
|
54
|
-
...
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}) : d;
|
|
53
|
+
value: n,
|
|
54
|
+
...a,
|
|
55
|
+
editable: c,
|
|
56
|
+
originalNode: r
|
|
57
|
+
}) : r;
|
|
59
58
|
}
|
|
60
59
|
})), o) : [];
|
|
61
60
|
});
|
|
62
|
-
function m(o, e,
|
|
63
|
-
return
|
|
61
|
+
function m(o, e, n) {
|
|
62
|
+
return V.includes(o.valueType) ? n : o.copyable || o.ellipsis ? i(w.Paragraph, {
|
|
64
63
|
copyable: o.copyable ? {
|
|
65
64
|
text: e,
|
|
66
65
|
tooltip: !1
|
|
67
66
|
} : !1,
|
|
68
|
-
ellipsis: o.ellipsis ? {
|
|
67
|
+
ellipsis: o.ellipsis ? F(o.ellipsis) ? {
|
|
68
|
+
tooltip: e
|
|
69
|
+
} : {
|
|
70
|
+
...o.ellipsis,
|
|
69
71
|
tooltip: e
|
|
70
72
|
} : !1,
|
|
71
|
-
content:
|
|
72
|
-
}, null) :
|
|
73
|
+
content: o.ellipsis ? e : n
|
|
74
|
+
}, null) : n;
|
|
73
75
|
}
|
|
74
76
|
return f;
|
|
75
77
|
};
|
|
76
78
|
export {
|
|
77
|
-
|
|
79
|
+
q as default
|
|
78
80
|
};
|
|
@@ -4,8 +4,9 @@ import { NamePath, ValidateOptions } from 'ant-design-vue/es/form/interface';
|
|
|
4
4
|
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
|
+
import { EllipsisConfig } from 'ant-design-vue/es/typography/Base';
|
|
7
8
|
|
|
8
|
-
export type EditableColumnType<RecordType = any, ValueType extends ApTableValueTypes = ApTableValueTypes> = ValueType extends ApTableValueTypes ? Omit<ColumnType<RecordType>, 'children' | 'customRender'> & {
|
|
9
|
+
export type EditableColumnType<RecordType = any, ValueType extends ApTableValueTypes = ApTableValueTypes> = ValueType extends ApTableValueTypes ? Omit<ColumnType<RecordType>, 'children' | 'customRender' | 'ellipsis'> & {
|
|
9
10
|
children?: EditableColumnType<RecordType, ValueType>;
|
|
10
11
|
/**
|
|
11
12
|
* 在title之后展示一个icon并触发tooltip
|
|
@@ -15,6 +16,10 @@ export type EditableColumnType<RecordType = any, ValueType extends ApTableValueT
|
|
|
15
16
|
* 是否可以复制(不可编辑模式下可用)
|
|
16
17
|
*/
|
|
17
18
|
copyable?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 是否省略自动溢出,自动溢出省略,为对象时可设置省略行数、是否可展开、添加后缀等
|
|
21
|
+
*/
|
|
22
|
+
ellipsis?: boolean | EllipsisConfig;
|
|
18
23
|
/**
|
|
19
24
|
* 是否可编辑
|
|
20
25
|
*/
|
package/es/src/index.d.ts
CHANGED