@aplus-frontend/ui 0.0.12 → 0.0.14

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 (151) hide show
  1. package/es/index.mjs +146 -140
  2. package/es/src/ap-action/item/index.vue2.mjs +5 -5
  3. package/es/src/ap-field/checkbox/index.vue.mjs +2 -0
  4. package/es/src/ap-field/date/index.vue.mjs +2 -0
  5. package/es/src/ap-field/date-range/index.vue.mjs +2 -0
  6. package/es/src/ap-field/interface.d.ts +2 -0
  7. package/es/src/ap-field/number/index.vue.mjs +2 -0
  8. package/es/src/ap-field/radio/index.vue.mjs +9 -7
  9. package/es/src/ap-field/rate/index.vue.mjs +4 -2
  10. package/es/src/ap-field/segmented/index.vue.mjs +15 -13
  11. package/es/src/ap-field/select/index.vue.mjs +18 -16
  12. package/es/src/ap-field/slider/index.vue.mjs +11 -9
  13. package/es/src/ap-field/switch/index.vue.mjs +10 -8
  14. package/es/src/ap-field/text/index.vue.d.ts +1 -1
  15. package/es/src/ap-field/text/index.vue2.mjs +12 -10
  16. package/es/src/ap-field/text/password.vue.d.ts +1 -1
  17. package/es/src/ap-field/text/password.vue.mjs +16 -14
  18. package/es/src/ap-field/text-area/index.vue.d.ts +1 -1
  19. package/es/src/ap-field/text-area/index.vue.mjs +2 -0
  20. package/es/src/ap-form/ap-form.vue2.mjs +22 -22
  21. package/es/src/ap-table/ap-table.vue.d.ts +5 -1
  22. package/es/src/ap-table/constants.d.ts +715 -487
  23. package/es/src/ap-table/utils.d.ts +3 -3
  24. package/es/src/business/index.d.ts +123 -0
  25. package/es/src/business/index.mjs +7 -0
  26. package/es/src/business/title/ApTitle.vue.d.ts +45 -0
  27. package/es/src/business/title/ApTitle.vue.mjs +4 -0
  28. package/es/src/business/title/ApTitle.vue2.mjs +50 -0
  29. package/es/src/business/title/interface.d.ts +21 -0
  30. package/es/src/business/title/style.css +39 -0
  31. package/es/src/components.d.ts +1 -0
  32. package/es/src/config-provider/config-provider-props.d.ts +1 -1
  33. package/es/src/config-provider/config-provider-props.mjs +5 -6
  34. package/es/src/config-provider/config-provider.d.ts +11 -11
  35. package/es/src/config-provider/hooks/use-global-config.d.ts +1 -1
  36. package/es/src/config-provider/index.d.ts +31 -31
  37. package/es/src/description/description.vue.d.ts +1 -1
  38. package/es/src/description/index.d.ts +3 -3
  39. package/es/src/editable-table/form-item.vue.d.ts +304 -0
  40. package/es/src/editable-table/form-item.vue.mjs +189 -0
  41. package/es/src/editable-table/form-item.vue2.mjs +4 -0
  42. package/es/src/editable-table/hooks/use-get-columns.d.ts +5 -0
  43. package/es/src/editable-table/hooks/use-get-columns.mjs +76 -0
  44. package/es/src/editable-table/index.d.ts +5 -0
  45. package/es/src/editable-table/index.mjs +3 -0
  46. package/es/src/editable-table/index.vue.d.ts +196 -0
  47. package/es/src/editable-table/index.vue.mjs +209 -0
  48. package/es/src/editable-table/index.vue2.mjs +4 -0
  49. package/es/src/editable-table/interface.d.ts +71 -6
  50. package/es/src/editable-table/interface.mjs +1 -0
  51. package/es/src/editable-table/style/index.css +35 -0
  52. package/es/src/editable-table/utils.mjs +10 -0
  53. package/es/src/icon-picker/icon-picker.vue.d.ts +2 -2
  54. package/es/src/icon-picker/index.d.ts +26 -26
  55. package/es/src/index.d.ts +2 -0
  56. package/es/src/index.mjs +232 -225
  57. package/es/src/modal/basic.vue.d.ts +1 -1
  58. package/es/src/modal/components/modal-footer.vue.d.ts +1 -1
  59. package/es/src/modal/index.d.ts +2 -2
  60. package/es/src/pro-form/components/api-cascader.vue.d.ts +1 -1
  61. package/es/src/pro-form/components/api-radio-group.vue.d.ts +1 -1
  62. package/es/src/pro-form/components/api-select.vue.d.ts +2 -2
  63. package/es/src/pro-form/components/api-transfer.vue.d.ts +1 -1
  64. package/es/src/pro-form/components/api-tree-select.vue.d.ts +1 -1
  65. package/es/src/pro-form/components/api-tree.vue.d.ts +1 -1
  66. package/es/src/pro-form/hooks/use-label-width.d.ts +6 -6
  67. package/es/src/pro-form/pro-form.vue.d.ts +1 -1
  68. package/es/src/pro-table/components/editable/editable-cell.vue.d.ts +1 -1
  69. package/es/src/pro-table/pro-table.vue.d.ts +1 -1
  70. package/es/src/scroll-bar/index.d.ts +12 -12
  71. package/es/src/theme/antd-global-overwrite/admin/index.css +8 -0
  72. package/es/src/theme/antd-global-overwrite/admin/table.css +8 -0
  73. package/es/src/theme/ap-title/ap-title.css +39 -0
  74. package/es/src/theme/editable-table/index.css +35 -0
  75. package/es/src/utils/config-provider-preset.d.ts +12 -12
  76. package/lib/index.js +1 -1
  77. package/lib/src/ap-action/item/index.vue2.js +1 -1
  78. package/lib/src/ap-field/checkbox/index.vue.js +1 -1
  79. package/lib/src/ap-field/date/index.vue.js +1 -1
  80. package/lib/src/ap-field/date-range/index.vue.js +1 -1
  81. package/lib/src/ap-field/interface.d.ts +2 -0
  82. package/lib/src/ap-field/number/index.vue.js +1 -1
  83. package/lib/src/ap-field/radio/index.vue.js +1 -1
  84. package/lib/src/ap-field/rate/index.vue.js +1 -1
  85. package/lib/src/ap-field/segmented/index.vue.js +1 -1
  86. package/lib/src/ap-field/select/index.vue.js +1 -1
  87. package/lib/src/ap-field/slider/index.vue.js +1 -1
  88. package/lib/src/ap-field/switch/index.vue.js +1 -1
  89. package/lib/src/ap-field/text/index.vue.d.ts +1 -1
  90. package/lib/src/ap-field/text/index.vue2.js +1 -1
  91. package/lib/src/ap-field/text/password.vue.d.ts +1 -1
  92. package/lib/src/ap-field/text/password.vue.js +1 -1
  93. package/lib/src/ap-field/text-area/index.vue.d.ts +1 -1
  94. package/lib/src/ap-field/text-area/index.vue.js +1 -1
  95. package/lib/src/ap-form/ap-form.vue2.js +1 -1
  96. package/lib/src/ap-table/ap-table.vue.d.ts +5 -1
  97. package/lib/src/ap-table/constants.d.ts +715 -487
  98. package/lib/src/ap-table/utils.d.ts +3 -3
  99. package/lib/src/business/index.d.ts +123 -0
  100. package/lib/src/business/index.js +1 -0
  101. package/lib/src/business/title/ApTitle.vue.d.ts +45 -0
  102. package/lib/src/business/title/ApTitle.vue.js +1 -0
  103. package/lib/src/business/title/ApTitle.vue2.js +1 -0
  104. package/lib/src/business/title/interface.d.ts +21 -0
  105. package/lib/src/business/title/style.css +39 -0
  106. package/lib/src/components.d.ts +1 -0
  107. package/lib/src/config-provider/config-provider-props.d.ts +1 -1
  108. package/lib/src/config-provider/config-provider-props.js +1 -1
  109. package/lib/src/config-provider/config-provider.d.ts +11 -11
  110. package/lib/src/config-provider/hooks/use-global-config.d.ts +1 -1
  111. package/lib/src/config-provider/index.d.ts +31 -31
  112. package/lib/src/description/description.vue.d.ts +1 -1
  113. package/lib/src/description/index.d.ts +3 -3
  114. package/lib/src/editable-table/form-item.vue.d.ts +304 -0
  115. package/lib/src/editable-table/form-item.vue.js +1 -0
  116. package/lib/src/editable-table/form-item.vue2.js +1 -0
  117. package/lib/src/editable-table/hooks/use-get-columns.d.ts +5 -0
  118. package/lib/src/editable-table/hooks/use-get-columns.js +1 -0
  119. package/lib/src/editable-table/index.d.ts +5 -0
  120. package/lib/src/editable-table/index.js +1 -0
  121. package/lib/src/editable-table/index.vue.d.ts +196 -0
  122. package/lib/src/editable-table/index.vue.js +1 -0
  123. package/lib/src/editable-table/index.vue2.js +1 -0
  124. package/lib/src/editable-table/interface.d.ts +71 -6
  125. package/lib/src/editable-table/interface.js +1 -0
  126. package/lib/src/editable-table/style/index.css +35 -0
  127. package/lib/src/editable-table/utils.js +1 -0
  128. package/lib/src/icon-picker/icon-picker.vue.d.ts +2 -2
  129. package/lib/src/icon-picker/index.d.ts +26 -26
  130. package/lib/src/index.d.ts +2 -0
  131. package/lib/src/index.js +1 -1
  132. package/lib/src/modal/basic.vue.d.ts +1 -1
  133. package/lib/src/modal/components/modal-footer.vue.d.ts +1 -1
  134. package/lib/src/modal/index.d.ts +2 -2
  135. package/lib/src/pro-form/components/api-cascader.vue.d.ts +1 -1
  136. package/lib/src/pro-form/components/api-radio-group.vue.d.ts +1 -1
  137. package/lib/src/pro-form/components/api-select.vue.d.ts +2 -2
  138. package/lib/src/pro-form/components/api-transfer.vue.d.ts +1 -1
  139. package/lib/src/pro-form/components/api-tree-select.vue.d.ts +1 -1
  140. package/lib/src/pro-form/components/api-tree.vue.d.ts +1 -1
  141. package/lib/src/pro-form/hooks/use-label-width.d.ts +6 -6
  142. package/lib/src/pro-form/pro-form.vue.d.ts +1 -1
  143. package/lib/src/pro-table/components/editable/editable-cell.vue.d.ts +1 -1
  144. package/lib/src/pro-table/pro-table.vue.d.ts +1 -1
  145. package/lib/src/scroll-bar/index.d.ts +12 -12
  146. package/lib/src/theme/antd-global-overwrite/admin/index.css +8 -0
  147. package/lib/src/theme/antd-global-overwrite/admin/table.css +8 -0
  148. package/lib/src/theme/ap-title/ap-title.css +39 -0
  149. package/lib/src/theme/editable-table/index.css +35 -0
  150. package/lib/src/utils/config-provider-preset.d.ts +12 -12
  151. package/package.json +1 -1
@@ -0,0 +1,196 @@
1
+ import { EditableTableProps, EditableColumnType } from './interface';
2
+ import { NamePath, ValidateOptions } from 'ant-design-vue/es/form/interface';
3
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType, CSSProperties } from 'vue';
4
+ import { SpinSize } from 'ant-design-vue/es/spin/Spin';
5
+ import { VueTypeValidableDef } from '../../node_modules/vue-types';
6
+ import { TablePaginationConfig } from 'ant-design-vue';
7
+ import { TableLayout, GetRowKey } from 'ant-design-vue/es/vc-table/interface';
8
+ import { SortOrder } from 'ant-design-vue/es/table/interface';
9
+ import { TriggerType } from 'ant-design-vue/es/tooltip/abstractTooltipProps';
10
+ import { TooltipPlacement, AdjustOverflow } from 'ant-design-vue/es/tooltip';
11
+ import { LiteralUnion } from 'ant-design-vue/es/_util/type';
12
+ import { PresetColorType } from 'ant-design-vue/es/_util/colors';
13
+ import { AlignType, BuildInPlacements } from 'ant-design-vue/es/vc-trigger/interface';
14
+
15
+ type EditableTableSlots = {
16
+ default: any;
17
+ emptyText?: any;
18
+ expandIcon?: any;
19
+ title?: any;
20
+ footer?: any;
21
+ summary?: any;
22
+ expandedRowRender?: any;
23
+ expandColumnTitle?: any;
24
+ customFilterIcon?: any;
25
+ customFilterDropdown?: any;
26
+ headerCell?: (props: {
27
+ title: any;
28
+ column: EditableColumnType;
29
+ }) => void;
30
+ };
31
+ declare function resetFields(): void;
32
+ declare function validateFields(nameList?: NamePath[] | string, options?: ValidateOptions): Promise<any>;
33
+ declare function add(defaultValue?: any): void;
34
+ declare function remove(index: number): void;
35
+ declare function getRowsData(): any[];
36
+ declare function getRowData(index: number): any;
37
+ declare function setRowData(index: number, payload: any): void;
38
+ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<EditableTableProps<any>>, {
39
+ bordered: boolean;
40
+ childrenColumnName: string;
41
+ defaultExpandAllRows: boolean;
42
+ expandFixed: boolean;
43
+ expandRowByClick: boolean;
44
+ indentSize: number;
45
+ rowKey: string;
46
+ showExpandColumn: boolean;
47
+ showHeader: boolean;
48
+ showSorterTooltip: boolean;
49
+ size: string;
50
+ sortDirections: () => string[];
51
+ pagination: boolean;
52
+ loading: undefined;
53
+ name: string;
54
+ tableLayout: string;
55
+ }>, {
56
+ resetFields: typeof resetFields;
57
+ validateFields: typeof validateFields;
58
+ add: typeof add;
59
+ remove: typeof remove;
60
+ getRowData: typeof getRowData;
61
+ getRowsData: typeof getRowsData;
62
+ setRowData: typeof setRowData;
63
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
64
+ "update:value": (...args: any[]) => void;
65
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<EditableTableProps<any>>, {
66
+ bordered: boolean;
67
+ childrenColumnName: string;
68
+ defaultExpandAllRows: boolean;
69
+ expandFixed: boolean;
70
+ expandRowByClick: boolean;
71
+ indentSize: number;
72
+ rowKey: string;
73
+ showExpandColumn: boolean;
74
+ showHeader: boolean;
75
+ showSorterTooltip: boolean;
76
+ size: string;
77
+ sortDirections: () => string[];
78
+ pagination: boolean;
79
+ loading: undefined;
80
+ name: string;
81
+ tableLayout: string;
82
+ }>>> & {
83
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
84
+ }, {
85
+ loading: boolean | Partial< ExtractPropTypes<{
86
+ prefixCls: StringConstructor;
87
+ spinning: {
88
+ type: BooleanConstructor;
89
+ default: any;
90
+ };
91
+ size: PropType<SpinSize>;
92
+ wrapperClassName: StringConstructor;
93
+ tip: VueTypeValidableDef<any>;
94
+ delay: NumberConstructor;
95
+ indicator: VueTypeValidableDef<any>;
96
+ }>>;
97
+ size: "small" | "middle" | "large";
98
+ pagination: false | TablePaginationConfig;
99
+ name: any;
100
+ bordered: boolean;
101
+ tableLayout: TableLayout;
102
+ rowKey: string | GetRowKey<any>;
103
+ sortDirections: SortOrder[];
104
+ showSorterTooltip: boolean | Partial< ExtractPropTypes<{
105
+ title: VueTypeValidableDef<any>;
106
+ trigger: PropType< TriggerType | TriggerType[]>;
107
+ open: {
108
+ type: BooleanConstructor;
109
+ default: any;
110
+ };
111
+ visible: {
112
+ type: BooleanConstructor;
113
+ default: any;
114
+ };
115
+ placement: PropType<TooltipPlacement>;
116
+ color: PropType<LiteralUnion<PresetColorType>>;
117
+ transitionName: StringConstructor;
118
+ overlayStyle: {
119
+ type: PropType<CSSProperties>;
120
+ default: CSSProperties;
121
+ };
122
+ overlayInnerStyle: {
123
+ type: PropType<CSSProperties>;
124
+ default: CSSProperties;
125
+ };
126
+ overlayClassName: StringConstructor;
127
+ openClassName: StringConstructor;
128
+ prefixCls: StringConstructor;
129
+ mouseEnterDelay: NumberConstructor;
130
+ mouseLeaveDelay: NumberConstructor;
131
+ getPopupContainer: PropType<(triggerNode: HTMLElement) => HTMLElement>;
132
+ arrowPointAtCenter: {
133
+ type: BooleanConstructor;
134
+ default: any;
135
+ };
136
+ arrow: {
137
+ type: PropType<boolean | {
138
+ pointAtCenter?: boolean | undefined;
139
+ }>;
140
+ default: boolean | {
141
+ pointAtCenter?: boolean | undefined;
142
+ };
143
+ };
144
+ autoAdjustOverflow: {
145
+ type: PropType<boolean | AdjustOverflow>;
146
+ default: boolean | AdjustOverflow;
147
+ };
148
+ destroyTooltipOnHide: {
149
+ type: BooleanConstructor;
150
+ default: any;
151
+ };
152
+ align: {
153
+ type: PropType<AlignType>;
154
+ default: AlignType;
155
+ };
156
+ builtinPlacements: {
157
+ type: PropType<BuildInPlacements>;
158
+ default: BuildInPlacements;
159
+ };
160
+ children: ArrayConstructor;
161
+ onVisibleChange: PropType<(vis: boolean) => void>;
162
+ 'onUpdate:visible': PropType<(vis: boolean) => void>;
163
+ onOpenChange: PropType<(vis: boolean) => void>;
164
+ 'onUpdate:open': PropType<(vis: boolean) => void>;
165
+ }>>;
166
+ showHeader: boolean;
167
+ expandFixed: boolean | "left" | "right";
168
+ expandRowByClick: boolean;
169
+ defaultExpandAllRows: boolean;
170
+ indentSize: number;
171
+ showExpandColumn: boolean;
172
+ childrenColumnName: string;
173
+ }, {}>, Readonly<EditableTableSlots> & EditableTableSlots>;
174
+ export default _default;
175
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
176
+ type __VLS_TypePropsToRuntimeProps<T> = {
177
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
178
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
179
+ } : {
180
+ type: PropType<T[K]>;
181
+ required: true;
182
+ };
183
+ };
184
+ type __VLS_WithDefaults<P, D> = {
185
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
186
+ default: D[K];
187
+ }> : P[K];
188
+ };
189
+ type __VLS_Prettify<T> = {
190
+ [K in keyof T]: T[K];
191
+ } & {};
192
+ type __VLS_WithTemplateSlots<T, S> = T & {
193
+ new (): {
194
+ $slots: S;
195
+ };
196
+ };
@@ -0,0 +1,209 @@
1
+ import { defineComponent as L, useSlots as z, ref as j, watch as I, unref as o, openBlock as p, createBlock as O, withCtx as i, createVNode as c, mergeProps as T, createSlots as K, createElementBlock as q, Fragment as A, createElementVNode as x, normalizeClass as G, toDisplayString as H, createCommentVNode as M, renderList as U, renderSlot as W, normalizeProps as $, guardReactiveProps as J } from "vue";
2
+ import { Table as Q } from "ant-design-vue";
3
+ import { ApForm as u } from "../ap-form/index.mjs";
4
+ import { cloneDeep as C, omit as X } from "lodash-unified";
5
+ import "../config-provider/index.mjs";
6
+ import "../hooks/index.mjs";
7
+ import { isDef as Y } from "../utils/index.mjs";
8
+ import Z from "./hooks/use-get-columns.mjs";
9
+ import "./style/index.css";
10
+ import { useNamespace as ee } from "../config-provider/hooks/use-namespace.mjs";
11
+ import { useGlobalConfig as ae } from "../config-provider/hooks/use-global-config.mjs";
12
+ import { useControllableValue as te } from "../hooks/useControllableValue.mjs";
13
+ const xe = /* @__PURE__ */ L({
14
+ name: "EditableTable",
15
+ __name: "index",
16
+ props: {
17
+ dropdownPrefixCls: {},
18
+ pagination: {
19
+ type: [Boolean, Object],
20
+ default: !1
21
+ },
22
+ loading: {
23
+ type: [Boolean, Object],
24
+ default: void 0
25
+ },
26
+ size: {
27
+ default: "middle"
28
+ },
29
+ bordered: {
30
+ type: Boolean,
31
+ default: !1
32
+ },
33
+ locale: {},
34
+ onChange: {},
35
+ onResizeColumn: {},
36
+ rowSelection: {},
37
+ getPopupContainer: {},
38
+ scroll: {},
39
+ sortDirections: {
40
+ default: () => ["ascend", "descend"]
41
+ },
42
+ showSorterTooltip: {
43
+ type: [Boolean, Object],
44
+ default: !0
45
+ },
46
+ prefixCls: {},
47
+ rowKey: {
48
+ default: "key"
49
+ },
50
+ tableLayout: {
51
+ default: "fixed"
52
+ },
53
+ rowClassName: {},
54
+ title: {},
55
+ footer: {},
56
+ id: {},
57
+ showHeader: {
58
+ type: Boolean,
59
+ default: !0
60
+ },
61
+ components: {},
62
+ customRow: {},
63
+ customHeaderRow: {},
64
+ direction: {},
65
+ expandFixed: {
66
+ type: [String, Boolean],
67
+ default: !1
68
+ },
69
+ expandColumnWidth: {},
70
+ expandedRowKeys: {},
71
+ defaultExpandedRowKeys: {},
72
+ expandedRowRender: {},
73
+ expandRowByClick: {
74
+ type: Boolean,
75
+ default: !1
76
+ },
77
+ expandIcon: {},
78
+ onExpand: {},
79
+ onExpandedRowsChange: {},
80
+ defaultExpandAllRows: {
81
+ type: Boolean,
82
+ default: !1
83
+ },
84
+ indentSize: {
85
+ default: 15
86
+ },
87
+ expandIconColumnIndex: {},
88
+ showExpandColumn: {
89
+ type: Boolean,
90
+ default: !0
91
+ },
92
+ expandedRowClassName: {},
93
+ childrenColumnName: {
94
+ default: "children"
95
+ },
96
+ rowExpandable: {},
97
+ sticky: {
98
+ type: [Boolean, Object]
99
+ },
100
+ transformCellText: {},
101
+ columns: {},
102
+ value: {},
103
+ defaultValue: {},
104
+ "onUpdate:value": {},
105
+ maxLength: {},
106
+ name: {
107
+ default: "ap-editable-table-inner-name"
108
+ },
109
+ onFieldChange: {}
110
+ },
111
+ emits: ["update:value"],
112
+ setup(g, {
113
+ expose: h,
114
+ emit: w
115
+ }) {
116
+ const l = g, {
117
+ b: m,
118
+ em: y
119
+ } = ee("editable-table"), v = ae("uiMode", "aplus"), b = z(), R = w, {
120
+ value: s,
121
+ updateValue: B
122
+ } = te(l, R), d = j(), F = u.useWatch(l.name, d);
123
+ I(() => F.value, (t) => {
124
+ var n;
125
+ B(t), (n = l.onChange) == null || n.call(l, t);
126
+ });
127
+ const D = Z(l);
128
+ function E() {
129
+ var t;
130
+ (t = d.value) == null || t.resetFields();
131
+ }
132
+ async function _(t, n) {
133
+ var a;
134
+ const e = await ((a = d.value) == null ? void 0 : a.validateFields(t, n));
135
+ return e == null ? void 0 : e[l.name];
136
+ }
137
+ function k(t) {
138
+ var e, a, r;
139
+ const n = ((e = o(s)) == null ? void 0 : e.length) || 0;
140
+ Y(l.maxLength) && n >= l.maxLength || (r = (a = d.value) == null ? void 0 : a.setFieldValue) == null || r.call(a, l.name, [...o(s) || [], t || {}]);
141
+ }
142
+ function S(t) {
143
+ var e, a;
144
+ const n = C(o(s) || []);
145
+ n.splice(t, 1), (a = (e = d.value) == null ? void 0 : e.setFieldValue) == null || a.call(e, l.name, [...n]);
146
+ }
147
+ function V() {
148
+ return o(s);
149
+ }
150
+ function N(t) {
151
+ var n;
152
+ return (n = o(s)) == null ? void 0 : n[t];
153
+ }
154
+ function P(t, n) {
155
+ var a, r;
156
+ const e = C(o(s));
157
+ e[t] && (e[t] = {
158
+ ...e[t],
159
+ ...n
160
+ }, (r = (a = d.value) == null ? void 0 : a.setFieldValue) == null || r.call(a, l.name, [...e]));
161
+ }
162
+ return h({
163
+ resetFields: E,
164
+ validateFields: _,
165
+ add: k,
166
+ remove: S,
167
+ getRowData: N,
168
+ getRowsData: V,
169
+ setRowData: P
170
+ }), (t, n) => (p(), O(o(u), {
171
+ "initial-values": {
172
+ [l.name]: o(s)
173
+ },
174
+ ref_key: "formRef",
175
+ ref: d
176
+ }, {
177
+ default: i(() => [c(o(u).FormItem, {
178
+ name: t.name,
179
+ "no-style": ""
180
+ }, {
181
+ default: i(() => [c(o(Q), T(o(X)(l, ["name", "value", "onUpdate:value", "maxLength"]), {
182
+ class: [o(m)(), o(v) === "admin" ? o(m)("admin") : null],
183
+ columns: o(D),
184
+ "data-source": o(s)
185
+ }), K({
186
+ headerCell: i(({
187
+ column: e
188
+ }) => {
189
+ var a, r, f;
190
+ return [(a = e == null ? void 0 : e.fieldProps) != null && a.required || (f = (r = e == null ? void 0 : e.fieldProps) == null ? void 0 : r.rules) != null && f.length ? (p(), q(A, {
191
+ key: 0
192
+ }, [x("span", {
193
+ class: G(o(y)("header-cell", "required"))
194
+ }, "*", 2), x("span", null, H(e.title), 1)], 64)) : M("", !0)];
195
+ }),
196
+ _: 2
197
+ }, [U(b, (e, a) => ({
198
+ name: a,
199
+ fn: i((r) => [W(t.$slots, a, $(J(r || {})))])
200
+ }))]), 1040, ["class", "columns", "data-source"])]),
201
+ _: 3
202
+ }, 8, ["name"])]),
203
+ _: 3
204
+ }, 8, ["initial-values"]));
205
+ }
206
+ });
207
+ export {
208
+ xe as default
209
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -1,6 +1,8 @@
1
1
  import { ColumnType, TableProps } from 'ant-design-vue/es/table';
2
2
  import { ApTableValueFields, ValueEnum } from '../ap-table';
3
- import { InternalNamePath, NamePath, ValidateOptions } from 'ant-design-vue/es/form/interface';
3
+ import { NamePath, ValidateOptions } from 'ant-design-vue/es/form/interface';
4
+ import { DataIndex } from 'ant-design-vue/es/vc-table/interface';
5
+ import { FormItemProps } from 'ant-design-vue';
4
6
 
5
7
  export type EditableColumnType<ValueType extends keyof ApTableValueFields = 'text', RecordType = any> = Omit<ColumnType<RecordType>, 'children'> & {
6
8
  /**
@@ -21,6 +23,7 @@ export type EditableColumnType<ValueType extends keyof ApTableValueFields = 'tex
21
23
  valueEnum?: ValueEnum;
22
24
  /**
23
25
  * 自定义表单
26
+ * @deprecated 未实现,请使用`customRender`
24
27
  */
25
28
  customRenderFormItem?: (config: EditableColumnType<ValueType, RecordType>) => any;
26
29
  /**
@@ -45,9 +48,13 @@ export type EditableTableProps<RecordType = any> = Omit<TableProps<RecordType>,
45
48
  */
46
49
  columns?: EditableColumnType<any, RecordType>[];
47
50
  /**
48
- * 同dataSource,传入的数组数据将作为表单的初始数据
51
+ * 表格数据v-model
49
52
  */
50
53
  value?: RecordType[];
54
+ /**
55
+ * 表格数据默认值(只生效一次,如果是异步数据,请使用`v-model`)
56
+ */
57
+ defaultValue?: RecordType[];
51
58
  'onUpdate:value'?: (value: RecordType[]) => void;
52
59
  /**
53
60
  * 数据修改时触发onChange(也包含数据的删除)
@@ -60,14 +67,72 @@ export type EditableTableProps<RecordType = any> = Omit<TableProps<RecordType>,
60
67
  */
61
68
  maxLength?: number;
62
69
  /**
63
- * 设置可编辑表格的名字,如果是作为其它表单的一部分,需要设置此字段
70
+ * 设置可编辑表格的名字,如果不传,将会使用默认值
64
71
  */
65
72
  name?: any;
73
+ /**
74
+ * 当字段值变更的时候触发(注意,向表单设置值并不会触发)
75
+ * @returns
76
+ */
77
+ onFieldChange?: (rowIndex: number, fieldName: DataIndex, newValue: any) => void;
78
+ };
79
+ export type EditableTableFormItemProps<RecordType = any> = Omit<EditableTableProps<RecordType>, 'name'> & {
80
+ label?: string;
81
+ /**
82
+ * FormItem的name 暂不支持传入数组类型
83
+ */
84
+ name: string;
85
+ /**
86
+ * 额外的表单项配置属性
87
+ */
88
+ formItem?: Partial<Omit<FormItemProps, 'name' | 'label'>>;
66
89
  };
67
- export type EditableTableExpose<ModelType = any> = {
90
+ export type EditableTableExpose<ModelType = any, RecordType = any> = {
91
+ /**
92
+ * 重设可编辑表格数据
93
+ * @param name
94
+ * @returns
95
+ */
68
96
  resetFields: (name?: NamePath) => void;
97
+ /**
98
+ * 作为单独的表单使用时,校验表格数据
99
+ * @param nameList
100
+ * @param options
101
+ * @returns
102
+ */
69
103
  validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<ModelType>> | undefined;
70
- getFieldsValue: (nameList?: true | InternalNamePath[]) => Partial<ModelType> | undefined;
71
- add: (defaultValue?: any) => void;
104
+ /**
105
+ * 添加一行数据
106
+ * @param defaultValue
107
+ * @returns
108
+ */
109
+ add: (defaultValue?: Partial<RecordType>) => void;
110
+ /**
111
+ * 删除一行数据
112
+ * @param index
113
+ * @returns
114
+ */
72
115
  remove: (index: number) => void;
116
+ /**
117
+ * 获取所有行的数据
118
+ * @returns
119
+ */
120
+ getRowsData: () => RecordType[];
121
+ /**
122
+ * 获取指定行的数据
123
+ * @returns
124
+ */
125
+ getRowData: (index: number) => RecordType | undefined;
126
+ /**
127
+ * 设置表格行数据(数据会进行浅层合并)
128
+ * @param index
129
+ * @param data
130
+ * @returns
131
+ */
132
+ setRowData: (index: number, data: Partial<RecordType>) => void;
73
133
  };
134
+ /**
135
+ * 可编辑表格作为表单项暴露的实例
136
+ * @description 作为Form表单使用时不再暴露表单相关的API
137
+ */
138
+ export type EditableTableFormItemExpose<ModelType = any, RecordType = any> = Omit<EditableTableExpose<ModelType, RecordType>, 'resetFields' | 'validateFields'>;
@@ -5,7 +5,42 @@
5
5
  .aplus-editable-table .ant-form-item {
6
6
  margin-bottom: 20px;
7
7
  }
8
+ .aplus-editable-table .ant-form-item-explain-error {
9
+ line-height: 20px;
10
+ }
8
11
  .aplus-editable-table__header-cell--required {
9
12
  color: #FF4D4F;
10
13
  padding-right: 2px;
11
14
  }
15
+ .aplus-editable-table .ant-pagination {
16
+ margin-bottom: 0 !important;
17
+ }
18
+ .aplus-editable-table .ant-pagination .ant-pagination-total-text {
19
+ flex: 1;
20
+ }
21
+ .aplus-editable-table tr > th.ant-table-cell {
22
+ background-color: #F2F6F9;
23
+ border-bottom-color: #E9EDF3;
24
+ }
25
+ .aplus-editable-table tr > th.ant-table-cell::before {
26
+ display: none;
27
+ }
28
+ .aplus-editable-table tr > td.ant-table-cell {
29
+ border-top-color: #E9EDF3;
30
+ }
31
+ .aplus-editable-table-admin .ant-pagination {
32
+ margin-bottom: 0 !important;
33
+ }
34
+ .aplus-editable-table-admin .ant-pagination .ant-pagination-total-text {
35
+ flex: 1;
36
+ }
37
+ .aplus-editable-table-admin tr > th.ant-table-cell {
38
+ background-color: #FAFAFA;
39
+ border-bottom-color: #E9E9E9;
40
+ }
41
+ .aplus-editable-table-admin tr > th.ant-table-cell::before {
42
+ display: none;
43
+ }
44
+ .aplus-editable-table-admin tr > td.ant-table-cell {
45
+ border-top-color: #E9E9E9;
46
+ }
@@ -0,0 +1,10 @@
1
+ import { apTableFormItemMap as o } from "../ap-table/constants.mjs";
2
+ function r(e) {
3
+ const n = o[e];
4
+ return n || console.warn(
5
+ `${e} can not render because of no default renderer, use customRender instead.`
6
+ ), n;
7
+ }
8
+ export {
9
+ r as getEditableComponent
10
+ };
@@ -26,10 +26,10 @@ declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRunt
26
26
  }, {
27
27
  mode: "svg" | "iconify";
28
28
  width: string;
29
- value: string;
30
29
  copy: boolean;
31
- allowClear: boolean;
30
+ value: string;
32
31
  readonly: boolean;
32
+ allowClear: boolean;
33
33
  pageSize: number;
34
34
  }, {}>;
35
35
  export default _default;