@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.
Files changed (104) hide show
  1. package/es/index.mjs +60 -58
  2. package/es/src/ap-download/ap-download.vue.mjs +26 -26
  3. package/es/src/ap-form/ap-form-item-group/index.vue.mjs +26 -24
  4. package/es/src/ap-modal/index.d.ts +2 -2
  5. package/es/src/ap-modal/index.mjs +1 -1
  6. package/es/src/ap-modal/{type.d.ts → interface.d.ts} +3 -3
  7. package/es/src/ap-modal/utils/createModal.d.ts +1 -1
  8. package/es/src/ap-table/ap-table.vue.mjs +40 -40
  9. package/es/src/ap-table/interface.d.ts +2 -3
  10. package/es/src/ap-table/utils.d.ts +1 -1
  11. package/es/src/ap-table/utils.mjs +20 -20
  12. package/es/src/business/ap-batch-action/index.css +2 -0
  13. package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue.d.ts +13 -0
  14. package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue.mjs +4 -0
  15. package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue2.mjs +110 -0
  16. package/es/src/business/ap-batch-action-group/MenuItemGroup.vue.d.ts +17 -0
  17. package/es/src/business/ap-batch-action-group/MenuItemGroup.vue.mjs +4 -0
  18. package/es/src/business/ap-batch-action-group/MenuItemGroup.vue2.mjs +50 -0
  19. package/es/src/business/ap-batch-action-group/interface.d.ts +41 -0
  20. package/es/src/business/ap-batch-action-group/interface.mjs +1 -0
  21. package/es/src/business/ap-image/ApImage.vue.d.ts +65 -0
  22. package/es/src/business/ap-image/ApImage.vue.mjs +4 -0
  23. package/es/src/business/ap-image/ApImage.vue2.mjs +56 -0
  24. package/es/src/business/ap-image/hooks/useOss.d.ts +11 -0
  25. package/es/src/business/ap-image/hooks/useOss.mjs +37 -0
  26. package/es/src/business/ap-image/imgs/admin-fallback.jpg.mjs +4 -0
  27. package/es/src/business/ap-image/imgs/aplus-fallback.jpg.mjs +4 -0
  28. package/es/src/business/ap-label/ApLabel.d.ts +141 -0
  29. package/es/src/business/ap-label/ApLabel.mjs +49 -0
  30. package/es/src/business/ap-label/ApLabelGroup.mjs +11 -12
  31. package/es/src/business/ap-label/constans.d.ts +65 -1
  32. package/es/src/business/ap-label/constans.mjs +33 -2
  33. package/es/src/business/ap-label/index.d.ts +1 -1
  34. package/es/src/business/ap-label/interface.d.ts +2 -1
  35. package/es/src/business/index.d.ts +815 -164
  36. package/es/src/business/index.mjs +26 -20
  37. package/es/src/config-provider/constants.d.ts +1 -1
  38. package/es/src/editable-table/form-item.vue.mjs +47 -46
  39. package/es/src/editable-table/hooks/use-get-columns.d.ts +3 -2
  40. package/es/src/editable-table/hooks/use-get-columns.mjs +32 -32
  41. package/es/src/editable-table/index.vue.mjs +81 -80
  42. package/es/src/editable-table/interface.d.ts +7 -13
  43. package/es/src/editable-table/utils.d.ts +14 -2
  44. package/es/src/editable-table/utils.mjs +67 -58
  45. package/es/src/index.mjs +202 -200
  46. package/es/src/locale/lang/en.mjs +10 -7
  47. package/es/src/locale/lang/zh-cn.mjs +3 -0
  48. package/es/src/theme/ap-batch-action/ap-batch-action.css +2 -0
  49. package/lib/index.js +1 -1
  50. package/lib/src/ap-download/ap-download.vue.js +1 -1
  51. package/lib/src/ap-form/ap-form-item-group/index.vue.js +1 -1
  52. package/lib/src/ap-modal/index.d.ts +2 -2
  53. package/lib/src/ap-modal/index.js +1 -1
  54. package/lib/src/ap-modal/{type.d.ts → interface.d.ts} +3 -3
  55. package/lib/src/ap-modal/utils/createModal.d.ts +1 -1
  56. package/lib/src/ap-table/ap-table.vue.js +1 -1
  57. package/lib/src/ap-table/interface.d.ts +2 -3
  58. package/lib/src/ap-table/utils.d.ts +1 -1
  59. package/lib/src/ap-table/utils.js +1 -1
  60. package/lib/src/business/ap-batch-action/index.css +2 -0
  61. package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue.d.ts +13 -0
  62. package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue.js +1 -0
  63. package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue2.js +1 -0
  64. package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue.d.ts +17 -0
  65. package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue.js +1 -0
  66. package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue2.js +1 -0
  67. package/lib/src/business/ap-batch-action-group/interface.d.ts +41 -0
  68. package/lib/src/business/ap-batch-action-group/interface.js +1 -0
  69. package/lib/src/business/ap-image/ApImage.vue.d.ts +65 -0
  70. package/lib/src/business/{ap-label/ApLabel.vue.js → ap-image/ApImage.vue.js} +1 -1
  71. package/lib/src/business/ap-image/ApImage.vue2.js +1 -0
  72. package/lib/src/business/ap-image/hooks/useOss.d.ts +11 -0
  73. package/lib/src/business/ap-image/hooks/useOss.js +1 -0
  74. package/lib/src/business/ap-image/imgs/admin-fallback.jpg.js +1 -0
  75. package/lib/src/business/ap-image/imgs/aplus-fallback.jpg.js +1 -0
  76. package/lib/src/business/ap-label/ApLabel.d.ts +141 -0
  77. package/lib/src/business/ap-label/ApLabel.js +1 -0
  78. package/lib/src/business/ap-label/ApLabelGroup.js +1 -1
  79. package/lib/src/business/ap-label/constans.d.ts +65 -1
  80. package/lib/src/business/ap-label/constans.js +1 -1
  81. package/lib/src/business/ap-label/index.d.ts +1 -1
  82. package/lib/src/business/ap-label/interface.d.ts +2 -1
  83. package/lib/src/business/index.d.ts +815 -164
  84. package/lib/src/business/index.js +1 -1
  85. package/lib/src/config-provider/constants.d.ts +1 -1
  86. package/lib/src/editable-table/form-item.vue.js +1 -1
  87. package/lib/src/editable-table/hooks/use-get-columns.d.ts +3 -2
  88. package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
  89. package/lib/src/editable-table/index.vue.js +1 -1
  90. package/lib/src/editable-table/interface.d.ts +7 -13
  91. package/lib/src/editable-table/utils.d.ts +14 -2
  92. package/lib/src/editable-table/utils.js +1 -1
  93. package/lib/src/index.js +1 -1
  94. package/lib/src/locale/lang/en.js +1 -1
  95. package/lib/src/locale/lang/zh-cn.js +1 -1
  96. package/lib/src/theme/ap-batch-action/ap-batch-action.css +2 -0
  97. package/package.json +3 -3
  98. package/es/src/business/ap-label/ApLabel.vue.d.ts +0 -56
  99. package/es/src/business/ap-label/ApLabel.vue.mjs +0 -4
  100. package/es/src/business/ap-label/ApLabel.vue2.mjs +0 -85
  101. package/lib/src/business/ap-label/ApLabel.vue.d.ts +0 -56
  102. package/lib/src/business/ap-label/ApLabel.vue2.js +0 -1
  103. /package/es/src/ap-modal/{type.mjs → interface.mjs} +0 -0
  104. /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
- export type EditableColumnType<RecordType = any, ValueType extends ApTableValueTypes = ApTableValueTypes> = ValueType extends ApTableValueTypes ? Omit<ColumnType<RecordType>, 'children' | 'customRender' | 'ellipsis'> & {
10
- children?: EditableColumnType<RecordType, ValueType>;
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, ValueType>, fieldProps: Record<string, any>, editable: boolean) => any;
35
+ customRenderFormItem?: (config: EditableColumnType<RecordType>, fieldProps: Recordable, editable: boolean) => any;
35
36
  /**
36
37
  * 指定值类型(将会用于普通列和可编辑表格的渲染)
37
38
  */
38
- valueType?: ValueType;
39
+ valueType?: MergedValueType;
39
40
  /**
40
41
  * 值类型额外配置的参数(支持函数)
41
42
  */
42
- fieldProps?: ApTableValueFields[ValueType] | ((opt: {
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
- export declare function getFinalNode(column: EditableColumnType, editable: boolean, innerProps: Record<string, any>, value: any): any;
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 f, createVNode as n, mergeProps as d } from "vue";
2
- import { isFunction as p, isArray as s, isBoolean as a, omit as u } from "lodash-unified";
3
- import { apTableFormItemMap as c, noRenderAsFormItemValueList as m, apTableRenderItemMap as y } 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";
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 I } from "../ap-table/utils.mjs";
10
- import P from "../ap-form/ap-form-item.vue.mjs";
11
- function R(e) {
12
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
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 r = p(e.fieldProps) ? e.fieldProps({}) : e.fieldProps;
21
- return b(r.required) ? r.required : (s(r.rules) ? r.rules : r.rules ? [r.rules] : []).some((t) => t.required);
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 V(e, r) {
23
+ function _(e, t) {
24
24
  if (e.valueType === "text" || e.valueType === "textArea")
25
- return r || "--";
25
+ return t || "--";
26
26
  if (e.valueType === "number") {
27
- const o = e.fieldProps ? p(e.fieldProps) ? e.fieldProps({}) : e.fieldProps : {};
28
- return g(r, o) || "--";
27
+ const o = e.fieldProps ? b(e.fieldProps) ? e.fieldProps({}) : e.fieldProps : {};
28
+ return S(t, o) || "--";
29
29
  }
30
- return I(r);
30
+ return C(t);
31
31
  }
32
- function O(e, r) {
32
+ function R(e, t) {
33
33
  const o = [e];
34
- if (r) {
35
- const t = s(r) ? r : [r];
36
- o.unshift(...t);
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 k(e, r = document.body, o = {}) {
41
- const t = r.querySelectorAll("tr.ant-table-row")[e];
42
- t && T(t, {
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 h(e, r, o) {
50
- return m.includes(e.valueType) ? o : e.copyable || e.ellipsis ? n(C.Paragraph, {
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: r,
52
+ text: t,
53
53
  tooltip: !1
54
54
  } : !1,
55
- ellipsis: e.ellipsis ? a(e.ellipsis) ? {
56
- tooltip: r
55
+ ellipsis: e.ellipsis ? h(e.ellipsis) ? {
56
+ tooltip: t
57
57
  } : {
58
58
  ...e.ellipsis,
59
- tooltip: r
59
+ tooltip: t
60
60
  } : !1,
61
- content: e.ellipsis ? V(e, r) : o
61
+ content: e.ellipsis ? _(e, t) : o
62
62
  }, null) : o;
63
63
  }
64
- function B(e, r, o, t) {
65
- let l;
66
- if (e.valueType)
67
- if (r) {
68
- const i = F(e.valueType);
69
- l = n(i, o, null);
70
- } else {
71
- const i = y[e.valueType];
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
- if (e.customRenderFormItem) {
77
- const i = e.customRenderFormItem(e, o.field, r);
78
- l = n(P, u(o, ["field"]), R(i) ? i : {
79
- default: () => [i]
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 l;
91
+ return p ? D(e, r, p) : null;
83
92
  }
84
93
  export {
85
- N as getColumnIsRequired,
86
- F as getEditableComponent,
87
- B as getFinalNode,
88
- V as getRawDisplayValue,
89
- O as mergeClass,
90
- k as scrollToRowIndex
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
  };