@aplus-frontend/ui 0.1.16 → 0.1.18
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 +60 -58
- package/es/src/ap-download/ap-download.vue.mjs +26 -26
- package/es/src/ap-form/ap-form-item-group/index.vue.mjs +26 -24
- package/es/src/ap-modal/index.d.ts +2 -2
- package/es/src/ap-modal/index.mjs +1 -1
- package/es/src/ap-modal/{type.d.ts → interface.d.ts} +3 -3
- package/es/src/ap-modal/utils/createModal.d.ts +1 -1
- package/es/src/ap-table/ap-table.vue.mjs +40 -40
- package/es/src/ap-table/interface.d.ts +2 -3
- package/es/src/ap-table/utils.d.ts +1 -1
- package/es/src/ap-table/utils.mjs +20 -20
- package/es/src/business/ap-batch-action/index.css +2 -0
- package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue.d.ts +13 -0
- package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue.mjs +4 -0
- package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue2.mjs +110 -0
- package/es/src/business/ap-batch-action-group/MenuItemGroup.vue.d.ts +17 -0
- package/es/src/business/ap-batch-action-group/MenuItemGroup.vue.mjs +4 -0
- package/es/src/business/ap-batch-action-group/MenuItemGroup.vue2.mjs +50 -0
- package/es/src/business/ap-batch-action-group/interface.d.ts +41 -0
- package/es/src/business/ap-batch-action-group/interface.mjs +1 -0
- package/es/src/business/ap-image/ApImage.vue.d.ts +65 -0
- package/es/src/business/ap-image/ApImage.vue.mjs +4 -0
- package/es/src/business/ap-image/ApImage.vue2.mjs +56 -0
- package/es/src/business/ap-image/hooks/useOss.d.ts +11 -0
- package/es/src/business/ap-image/hooks/useOss.mjs +37 -0
- package/es/src/business/ap-image/imgs/admin-fallback.jpg.mjs +4 -0
- package/es/src/business/ap-image/imgs/aplus-fallback.jpg.mjs +4 -0
- package/es/src/business/ap-label/ApLabel.d.ts +141 -0
- package/es/src/business/ap-label/ApLabel.mjs +49 -0
- package/es/src/business/ap-label/ApLabelGroup.mjs +11 -12
- package/es/src/business/ap-label/constans.d.ts +65 -1
- package/es/src/business/ap-label/constans.mjs +33 -2
- package/es/src/business/ap-label/index.d.ts +1 -1
- package/es/src/business/ap-label/interface.d.ts +2 -1
- package/es/src/business/index.d.ts +815 -164
- package/es/src/business/index.mjs +26 -20
- package/es/src/config-provider/constants.d.ts +1 -1
- package/es/src/editable-table/form-item.vue.mjs +47 -46
- package/es/src/editable-table/hooks/use-get-columns.d.ts +3 -2
- package/es/src/editable-table/hooks/use-get-columns.mjs +32 -32
- package/es/src/editable-table/index.vue.mjs +81 -80
- package/es/src/editable-table/interface.d.ts +7 -13
- package/es/src/editable-table/utils.d.ts +14 -2
- package/es/src/editable-table/utils.mjs +67 -58
- package/es/src/index.mjs +202 -200
- package/es/src/locale/lang/en.mjs +10 -7
- package/es/src/locale/lang/zh-cn.mjs +3 -0
- package/es/src/theme/ap-batch-action/ap-batch-action.css +2 -0
- package/lib/index.js +1 -1
- package/lib/src/ap-download/ap-download.vue.js +1 -1
- package/lib/src/ap-form/ap-form-item-group/index.vue.js +1 -1
- package/lib/src/ap-modal/index.d.ts +2 -2
- package/lib/src/ap-modal/index.js +1 -1
- package/lib/src/ap-modal/{type.d.ts → interface.d.ts} +3 -3
- package/lib/src/ap-modal/utils/createModal.d.ts +1 -1
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/ap-table/interface.d.ts +2 -3
- package/lib/src/ap-table/utils.d.ts +1 -1
- package/lib/src/ap-table/utils.js +1 -1
- package/lib/src/business/ap-batch-action/index.css +2 -0
- package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue.d.ts +13 -0
- package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue.js +1 -0
- package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue2.js +1 -0
- package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue.d.ts +17 -0
- package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue.js +1 -0
- package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue2.js +1 -0
- package/lib/src/business/ap-batch-action-group/interface.d.ts +41 -0
- package/lib/src/business/ap-batch-action-group/interface.js +1 -0
- package/lib/src/business/ap-image/ApImage.vue.d.ts +65 -0
- package/lib/src/business/{ap-label/ApLabel.vue.js → ap-image/ApImage.vue.js} +1 -1
- package/lib/src/business/ap-image/ApImage.vue2.js +1 -0
- package/lib/src/business/ap-image/hooks/useOss.d.ts +11 -0
- package/lib/src/business/ap-image/hooks/useOss.js +1 -0
- package/lib/src/business/ap-image/imgs/admin-fallback.jpg.js +1 -0
- package/lib/src/business/ap-image/imgs/aplus-fallback.jpg.js +1 -0
- package/lib/src/business/ap-label/ApLabel.d.ts +141 -0
- package/lib/src/business/ap-label/ApLabel.js +1 -0
- package/lib/src/business/ap-label/ApLabelGroup.js +1 -1
- package/lib/src/business/ap-label/constans.d.ts +65 -1
- package/lib/src/business/ap-label/constans.js +1 -1
- package/lib/src/business/ap-label/index.d.ts +1 -1
- package/lib/src/business/ap-label/interface.d.ts +2 -1
- package/lib/src/business/index.d.ts +815 -164
- package/lib/src/business/index.js +1 -1
- package/lib/src/config-provider/constants.d.ts +1 -1
- package/lib/src/editable-table/form-item.vue.js +1 -1
- package/lib/src/editable-table/hooks/use-get-columns.d.ts +3 -2
- package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
- package/lib/src/editable-table/index.vue.js +1 -1
- package/lib/src/editable-table/interface.d.ts +7 -13
- package/lib/src/editable-table/utils.d.ts +14 -2
- 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-batch-action/ap-batch-action.css +2 -0
- package/package.json +3 -3
- package/es/src/business/ap-label/ApLabel.vue.d.ts +0 -56
- package/es/src/business/ap-label/ApLabel.vue.mjs +0 -4
- package/es/src/business/ap-label/ApLabel.vue2.mjs +0 -85
- package/lib/src/business/ap-label/ApLabel.vue.d.ts +0 -56
- package/lib/src/business/ap-label/ApLabel.vue2.js +0 -1
- /package/es/src/ap-modal/{type.mjs → interface.mjs} +0 -0
- /package/lib/src/ap-modal/{type.js → interface.js} +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ColumnType, TableProps } from 'ant-design-vue/es/table';
|
|
2
|
-
import { ApTableValueFields, ApTableValueTypes, ValueEnum } from '../ap-table';
|
|
2
|
+
import { ApTableValueFields, ApTableValueTypes, CommonFieldReturnType, FieldPropsType, ValueEnum } from '../ap-table';
|
|
3
3
|
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
7
|
import { EllipsisConfig } from 'ant-design-vue/es/typography/Base';
|
|
8
8
|
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import { Recordable } from '../type';
|
|
10
|
+
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
|
+
children?: EditableColumnType<RecordType, ExtraValueType, ValueType, MergedValueType>;
|
|
11
12
|
/**
|
|
12
13
|
* 在title之后展示一个icon并触发tooltip
|
|
13
14
|
*/
|
|
@@ -31,22 +32,15 @@ export type EditableColumnType<RecordType = any, ValueType extends ApTableValueT
|
|
|
31
32
|
/**
|
|
32
33
|
* 自定义表单,适用于内置`valueType`不满足的情况下使用
|
|
33
34
|
*/
|
|
34
|
-
customRenderFormItem?: (config: EditableColumnType<RecordType
|
|
35
|
+
customRenderFormItem?: (config: EditableColumnType<RecordType>, fieldProps: Recordable, editable: boolean) => any;
|
|
35
36
|
/**
|
|
36
37
|
* 指定值类型(将会用于普通列和可编辑表格的渲染)
|
|
37
38
|
*/
|
|
38
|
-
valueType?:
|
|
39
|
+
valueType?: MergedValueType;
|
|
39
40
|
/**
|
|
40
41
|
* 值类型额外配置的参数(支持函数)
|
|
41
42
|
*/
|
|
42
|
-
fieldProps?: ApTableValueFields[ValueType]
|
|
43
|
-
value: any;
|
|
44
|
-
text: any;
|
|
45
|
-
record: RecordType;
|
|
46
|
-
index: number;
|
|
47
|
-
renderIndex: number;
|
|
48
|
-
column: EditableColumnType<RecordType, ValueType>;
|
|
49
|
-
}) => ApTableValueFields[ValueType]);
|
|
43
|
+
fieldProps?: FieldPropsType<Extract<MergedValueType, ValueType> extends never ? CommonFieldReturnType : ApTableValueFields[Extract<MergedValueType, ValueType>], RecordType, ExtraValueType, ValueType, MergedValueType>;
|
|
50
44
|
/**
|
|
51
45
|
* 自定义渲染,添加了`editable`以及`originalNode`
|
|
52
46
|
* @param opt
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EditableColumnType } from './interface';
|
|
2
2
|
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
3
|
+
import { ValueTypeRenderConfig } from '../config-provider';
|
|
3
4
|
/**
|
|
4
5
|
* 获取编辑模式下默认映射的组件
|
|
5
6
|
* @param valueType
|
|
@@ -8,10 +9,11 @@ import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-
|
|
|
8
9
|
export declare function getEditableComponent(valueType: EditableColumnType['valueType']): any;
|
|
9
10
|
/**
|
|
10
11
|
* 获取可编辑表格的某列字段是否是required
|
|
12
|
+
* @description 请注意,此方法只根据`fieldProps.required`和`fieldProps.rules`来判断,并不会关注当前列是否可以渲染编辑节点
|
|
11
13
|
* @param column
|
|
12
14
|
* @returns
|
|
13
15
|
*/
|
|
14
|
-
export declare function getColumnIsRequired(column: EditableColumnType<any, 'text'>): boolean;
|
|
16
|
+
export declare function getColumnIsRequired(column: EditableColumnType<any, 'tex', 'text'>): boolean;
|
|
15
17
|
/**
|
|
16
18
|
* 获取ellipsis模式下最终需要渲染的字符串
|
|
17
19
|
* @param column
|
|
@@ -27,4 +29,14 @@ export declare function mergeClass(current: string, classNames?: string | string
|
|
|
27
29
|
* @param options
|
|
28
30
|
*/
|
|
29
31
|
export declare function scrollToRowIndex(index: number, container?: HTMLElement, options?: StandardBehaviorOptions): void;
|
|
30
|
-
|
|
32
|
+
/**
|
|
33
|
+
* 获取最终需要渲染到单元格的节点
|
|
34
|
+
* @param column 表格列配置
|
|
35
|
+
* @param editable 是否可编辑
|
|
36
|
+
* @param innerProps props
|
|
37
|
+
* @param value 当前表格映射的值
|
|
38
|
+
* @param record 当前行数据
|
|
39
|
+
* @param extraValueTypes 自定义valueType映射
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
export declare function getFinalNode(column: EditableColumnType, editable: boolean, innerProps: Record<string, any>, value: any, record: any, extraRenderMap?: Record<string, ValueTypeRenderConfig>): any;
|
|
@@ -1,91 +1,100 @@
|
|
|
1
|
-
import { isVNode as
|
|
2
|
-
import { isFunction as
|
|
3
|
-
import { apTableFormItemMap as
|
|
4
|
-
import { isDef as
|
|
5
|
-
import { getValueStr as
|
|
6
|
-
import
|
|
7
|
-
import { Typography as
|
|
1
|
+
import { isVNode as F, createVNode as f, mergeProps as g } from "vue";
|
|
2
|
+
import { isFunction as b, isArray as T, isBoolean as h, omit as P } from "lodash-unified";
|
|
3
|
+
import { apTableFormItemMap as V, noRenderAsFormItemValueList as j, apTableRenderItemMap as q } from "../ap-table/constants.mjs";
|
|
4
|
+
import { isDef as w } from "../utils/index.mjs";
|
|
5
|
+
import { getValueStr as S } from "../ap-field/number/helper.mjs";
|
|
6
|
+
import A from "scroll-into-view-if-needed";
|
|
7
|
+
import { Typography as v } from "ant-design-vue";
|
|
8
8
|
import "../ap-form/index.mjs";
|
|
9
|
-
import { objectToString as
|
|
10
|
-
import
|
|
11
|
-
function
|
|
12
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
13
|
-
}
|
|
14
|
-
function F(e) {
|
|
15
|
-
return c[e];
|
|
9
|
+
import { objectToString as C } from "../ap-table/utils.mjs";
|
|
10
|
+
import m from "../ap-form/ap-form-item.vue.mjs";
|
|
11
|
+
function y(e) {
|
|
12
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !F(e);
|
|
16
13
|
}
|
|
17
14
|
function N(e) {
|
|
15
|
+
return V[e];
|
|
16
|
+
}
|
|
17
|
+
function Q(e) {
|
|
18
18
|
if (!e.fieldProps)
|
|
19
19
|
return !1;
|
|
20
|
-
const
|
|
21
|
-
return
|
|
20
|
+
const t = b(e.fieldProps) ? e.fieldProps({}) : e.fieldProps;
|
|
21
|
+
return w(t.required) ? t.required : (T(t.rules) ? t.rules : t.rules ? [t.rules] : []).some((r) => r.required);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function _(e, t) {
|
|
24
24
|
if (e.valueType === "text" || e.valueType === "textArea")
|
|
25
|
-
return
|
|
25
|
+
return t || "--";
|
|
26
26
|
if (e.valueType === "number") {
|
|
27
|
-
const o = e.fieldProps ?
|
|
28
|
-
return
|
|
27
|
+
const o = e.fieldProps ? b(e.fieldProps) ? e.fieldProps({}) : e.fieldProps : {};
|
|
28
|
+
return S(t, o) || "--";
|
|
29
29
|
}
|
|
30
|
-
return
|
|
30
|
+
return C(t);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function R(e, t) {
|
|
33
33
|
const o = [e];
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
o.unshift(...
|
|
34
|
+
if (t) {
|
|
35
|
+
const r = T(t) ? t : [t];
|
|
36
|
+
o.unshift(...r);
|
|
37
37
|
}
|
|
38
38
|
return o.join(" ");
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
const
|
|
42
|
-
|
|
40
|
+
function U(e, t = document.body, o = {}) {
|
|
41
|
+
const r = t.querySelectorAll("tr.ant-table-row")[e];
|
|
42
|
+
r && A(r, {
|
|
43
43
|
scrollMode: "if-needed",
|
|
44
44
|
block: "nearest",
|
|
45
45
|
behavior: "smooth",
|
|
46
46
|
...o
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
return
|
|
49
|
+
function D(e, t, o) {
|
|
50
|
+
return j.includes(e.valueType) ? o : e.copyable || e.ellipsis ? f(v.Paragraph, {
|
|
51
51
|
copyable: e.copyable ? {
|
|
52
|
-
text:
|
|
52
|
+
text: t,
|
|
53
53
|
tooltip: !1
|
|
54
54
|
} : !1,
|
|
55
|
-
ellipsis: e.ellipsis ?
|
|
56
|
-
tooltip:
|
|
55
|
+
ellipsis: e.ellipsis ? h(e.ellipsis) ? {
|
|
56
|
+
tooltip: t
|
|
57
57
|
} : {
|
|
58
58
|
...e.ellipsis,
|
|
59
|
-
tooltip:
|
|
59
|
+
tooltip: t
|
|
60
60
|
} : !1,
|
|
61
|
-
content: e.ellipsis ?
|
|
61
|
+
content: e.ellipsis ? _(e, t) : o
|
|
62
62
|
}, null) : o;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
if (
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
l = h(e, t, n(i, d(o.field, {
|
|
73
|
-
mode: "read"
|
|
74
|
-
}), null));
|
|
64
|
+
function W(e, t, o, r, I, i) {
|
|
65
|
+
var c, a;
|
|
66
|
+
if (t) {
|
|
67
|
+
if (e.customRenderFormItem) {
|
|
68
|
+
const n = e.customRenderFormItem(e, o.field, t);
|
|
69
|
+
return f(m, P(o, ["field"]), y(n) ? n : {
|
|
70
|
+
default: () => [n]
|
|
71
|
+
});
|
|
75
72
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
const l = N(e.valueType);
|
|
74
|
+
if (l)
|
|
75
|
+
return f(l, o, null);
|
|
76
|
+
const s = i == null ? void 0 : i[e.valueType], u = (c = s == null ? void 0 : s.renderFormItem) == null ? void 0 : c.call(s, o.field);
|
|
77
|
+
return u ? f(m, o, y(u) ? u : {
|
|
78
|
+
default: () => [u]
|
|
79
|
+
}) : null;
|
|
80
|
+
}
|
|
81
|
+
let p;
|
|
82
|
+
const d = q[e.valueType];
|
|
83
|
+
if (d)
|
|
84
|
+
p = f(d, g(o.field, {
|
|
85
|
+
mode: "read"
|
|
86
|
+
}), null);
|
|
87
|
+
else {
|
|
88
|
+
const l = i == null ? void 0 : i[e.valueType];
|
|
89
|
+
p = (a = l == null ? void 0 : l.render) == null ? void 0 : a.call(l, r, I, o.field);
|
|
81
90
|
}
|
|
82
|
-
return
|
|
91
|
+
return p ? D(e, r, p) : null;
|
|
83
92
|
}
|
|
84
93
|
export {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
94
|
+
Q as getColumnIsRequired,
|
|
95
|
+
N as getEditableComponent,
|
|
96
|
+
W as getFinalNode,
|
|
97
|
+
_ as getRawDisplayValue,
|
|
98
|
+
R as mergeClass,
|
|
99
|
+
U as scrollToRowIndex
|
|
91
100
|
};
|