@aplus-frontend/ui 0.4.34 → 0.5.0-beta.1

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 (101) hide show
  1. package/es/index.mjs +14 -12
  2. package/es/src/ap-grid/constants.d.ts +9 -0
  3. package/es/src/ap-grid/constants.mjs +12 -0
  4. package/es/src/ap-grid/hooks/use-inner-params.d.ts +10 -0
  5. package/es/src/ap-grid/hooks/use-inner-params.mjs +41 -0
  6. package/es/src/ap-grid/hooks/use-render-columns.d.ts +6 -0
  7. package/es/src/ap-grid/hooks/use-render-columns.mjs +29 -0
  8. package/es/src/ap-grid/index.d.ts +3 -0
  9. package/es/src/ap-grid/index.mjs +2 -0
  10. package/es/src/ap-grid/index.vue.d.ts +44 -0
  11. package/es/src/ap-grid/index.vue.mjs +356 -0
  12. package/es/src/ap-grid/index.vue2.mjs +4 -0
  13. package/es/src/ap-grid/interface.d.ts +264 -0
  14. package/es/src/ap-grid/interface.mjs +1 -0
  15. package/es/src/ap-grid/style/css.d.ts +0 -0
  16. package/es/src/ap-grid/style/css.js +1 -0
  17. package/es/src/ap-grid/style/index.d.ts +0 -0
  18. package/es/src/ap-grid/style/index.js +1 -0
  19. package/es/src/ap-grid/utils/col.d.ts +20 -0
  20. package/es/src/ap-grid/utils/col.mjs +106 -0
  21. package/es/src/ap-grid/utils/renderer.d.ts +3 -0
  22. package/es/src/ap-grid/utils/renderer.mjs +21 -0
  23. package/es/src/ap-grid/utils/table.d.ts +13 -0
  24. package/es/src/ap-grid/utils/table.mjs +64 -0
  25. package/es/src/ap-table/ap-table.vue.d.ts +2 -0
  26. package/es/src/ap-table/components/setting/select-group/index.vue2.mjs +38 -38
  27. package/es/src/ap-table/components/setting/sortable/item.vue2.mjs +9 -9
  28. package/es/src/ap-table/components/setting/tree-select/index.vue2.mjs +21 -21
  29. package/es/src/ap-table/components/setting/utils.d.ts +15 -3
  30. package/es/src/ap-table/components/setting/utils.mjs +49 -38
  31. package/es/src/ap-table/context.d.ts +2 -1
  32. package/es/src/ap-table/context.mjs +8 -7
  33. package/es/src/ap-table/hooks/use-table-column-state.mjs +79 -70
  34. package/es/src/ap-table/hooks/use-table-paging-ng.d.ts +8 -2
  35. package/es/src/ap-table/hooks/use-table-paging-ng.mjs +43 -40
  36. package/es/src/ap-table/hooks/use-table-row-selection.d.ts +12 -0
  37. package/es/src/ap-table/hooks/use-table-row-selection.mjs +41 -27
  38. package/es/src/ap-table/interface.d.ts +4 -0
  39. package/es/src/ap-table/utils.d.ts +1 -1
  40. package/es/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +2 -0
  41. package/es/src/business/ap-table-modal/hooks/use-table-modal.d.ts +2 -0
  42. package/es/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +2 -0
  43. package/es/src/business/ap-table-modal/index.d.ts +8 -0
  44. package/es/src/business/ap-table-modal/table-modal.vue.d.ts +4 -0
  45. package/es/src/business/hooks/usePageListApTable.d.ts +2 -0
  46. package/es/src/index.d.ts +1 -0
  47. package/es/src/index.mjs +244 -241
  48. package/es/src/path-map.mjs +2 -1
  49. package/lib/index.js +1 -1
  50. package/lib/src/ap-grid/constants.d.ts +9 -0
  51. package/lib/src/ap-grid/constants.js +1 -0
  52. package/lib/src/ap-grid/hooks/use-inner-params.d.ts +10 -0
  53. package/lib/src/ap-grid/hooks/use-inner-params.js +1 -0
  54. package/lib/src/ap-grid/hooks/use-render-columns.d.ts +6 -0
  55. package/lib/src/ap-grid/hooks/use-render-columns.js +1 -0
  56. package/lib/src/ap-grid/index.d.ts +3 -0
  57. package/lib/src/ap-grid/index.js +1 -0
  58. package/lib/src/ap-grid/index.vue.d.ts +44 -0
  59. package/lib/src/ap-grid/index.vue.js +1 -0
  60. package/lib/src/ap-grid/index.vue2.js +1 -0
  61. package/lib/src/ap-grid/interface.d.ts +264 -0
  62. package/lib/src/ap-grid/interface.js +1 -0
  63. package/lib/src/ap-grid/style/css.cjs +1 -0
  64. package/lib/src/ap-grid/style/css.d.ts +0 -0
  65. package/lib/src/ap-grid/style/index.cjs +1 -0
  66. package/lib/src/ap-grid/style/index.d.ts +0 -0
  67. package/lib/src/ap-grid/utils/col.d.ts +20 -0
  68. package/lib/src/ap-grid/utils/col.js +1 -0
  69. package/lib/src/ap-grid/utils/renderer.d.ts +3 -0
  70. package/lib/src/ap-grid/utils/renderer.js +1 -0
  71. package/lib/src/ap-grid/utils/table.d.ts +13 -0
  72. package/lib/src/ap-grid/utils/table.js +1 -0
  73. package/lib/src/ap-table/ap-table.vue.d.ts +2 -0
  74. package/lib/src/ap-table/components/setting/select-group/index.vue2.js +1 -1
  75. package/lib/src/ap-table/components/setting/sortable/item.vue2.js +1 -1
  76. package/lib/src/ap-table/components/setting/tree-select/index.vue2.js +1 -1
  77. package/lib/src/ap-table/components/setting/utils.d.ts +15 -3
  78. package/lib/src/ap-table/components/setting/utils.js +1 -1
  79. package/lib/src/ap-table/context.d.ts +2 -1
  80. package/lib/src/ap-table/context.js +1 -1
  81. package/lib/src/ap-table/hooks/use-table-column-state.js +1 -1
  82. package/lib/src/ap-table/hooks/use-table-paging-ng.d.ts +8 -2
  83. package/lib/src/ap-table/hooks/use-table-paging-ng.js +1 -1
  84. package/lib/src/ap-table/hooks/use-table-row-selection.d.ts +12 -0
  85. package/lib/src/ap-table/hooks/use-table-row-selection.js +1 -1
  86. package/lib/src/ap-table/interface.d.ts +4 -0
  87. package/lib/src/ap-table/utils.d.ts +1 -1
  88. package/lib/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +2 -0
  89. package/lib/src/business/ap-table-modal/hooks/use-table-modal.d.ts +2 -0
  90. package/lib/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +2 -0
  91. package/lib/src/business/ap-table-modal/index.d.ts +8 -0
  92. package/lib/src/business/ap-table-modal/table-modal.vue.d.ts +4 -0
  93. package/lib/src/business/hooks/usePageListApTable.d.ts +2 -0
  94. package/lib/src/index.d.ts +1 -0
  95. package/lib/src/index.js +1 -1
  96. package/lib/src/path-map.js +1 -1
  97. package/package.json +3 -1
  98. package/theme/ap-grid/index.css +302 -0
  99. package/theme/ap-grid/index.less +65 -0
  100. package/theme/index.css +51 -0
  101. package/theme/index.less +1 -0
@@ -0,0 +1,264 @@
1
+ import { ApFormSearchFormProps } from '../ap-form/interface';
2
+ import { ApTablePaginationConfig, ApTableValueFields, ApTableValueTypes, CommonFieldReturnType, ExtraProColumnType, FieldPropsType, RequestData, ValueEnum } from '../ap-table/interface';
3
+ import { Recordable } from '../type';
4
+ import { TableProps } from '@aplus-frontend/antdv';
5
+ import { ColumnFilterItem, SortOrder, TableRowSelection } from '@aplus-frontend/antdv/es/table/interface';
6
+ import { ComputedRef, CSSProperties, Ref, VNode } from 'vue';
7
+ import { VxeTablePropTypes, VxeColumnPropTypes, VxeTableProps, VxeTableDefines, VxeColumnSlots } from 'vxe-table';
8
+ export type ColConfigType = VxeTableDefines.ColumnOptions;
9
+ export type ApGridColumnType<RecordType = any, ExtraValueType = 'text', ValueType extends ApTableValueTypes = ApTableValueTypes, MergedValueType extends ExtraValueType | ValueType = ExtraValueType | ValueType> = MergedValueType extends ExtraValueType | ValueType ? Omit<ExtraProColumnType<RecordType>, 'sorter' | 'rowSpan' | 'customCell' | 'customHeaderCell' | 'minWidth'> & {
10
+ children?: ApGridColumnType<RecordType, ExtraValueType, ValueType, MergedValueType>[];
11
+ /**
12
+ * 表单项所占据的格子数(1-24格)
13
+ */
14
+ span?: number;
15
+ /**
16
+ * 列的最小宽度
17
+ */
18
+ minWidth?: string | number;
19
+ /**
20
+ * 在title之后展示一个icon并触发tooltip
21
+ */
22
+ tooltip?: string;
23
+ /**
24
+ * 是否可以复制
25
+ * @deprecated 暂未实现
26
+ */
27
+ copyable?: boolean;
28
+ /**
29
+ * 配置溢出隐藏的方式
30
+ */
31
+ ellipsis?: VxeTablePropTypes.ShowOverflow;
32
+ /**
33
+ * 是否搜索表单中隐藏
34
+ */
35
+ hideInSearch?: boolean;
36
+ /**
37
+ * 是否在表格中隐藏
38
+ */
39
+ hideInTable?: boolean;
40
+ /**
41
+ * 值的枚举,会自动转化把值当成 key 来取出要显示的内容(也会作为select等组件的选项)
42
+ */
43
+ valueEnum?: ValueEnum;
44
+ /**
45
+ * 自定义查询表单渲染
46
+ */
47
+ customRenderFormItem?: (config: ApGridColumnType<RecordType>) => any;
48
+ /**
49
+ * 自定义渲染文本,和customRender相比,其必须返回字符串,并且后续的渲染(例如copy/ellipsis)都将使用这个值
50
+ */
51
+ renderText?: (option: {
52
+ value: any;
53
+ text: any;
54
+ record: RecordType;
55
+ index: number;
56
+ renderIndex: number;
57
+ column: ApGridColumnType<RecordType>;
58
+ }) => string;
59
+ /**
60
+ * 指定值类型(将会用于默认渲染和查询表单生成)
61
+ */
62
+ valueType?: MergedValueType;
63
+ /**
64
+ * 值类型额外配置的参数(用于查询表单渲染)
65
+ */
66
+ fieldProps?: FieldPropsType<Extract<MergedValueType, ValueType> extends never ? CommonFieldReturnType : ApTableValueFields[Extract<MergedValueType, ValueType>], RecordType, ExtraValueType, ValueType, MergedValueType>;
67
+ /**
68
+ * 用于表单项排序的字段
69
+ * @description 值越大,越排在前面,请设置正整数,设置为0或负数将会无效
70
+ */
71
+ order?: number;
72
+ /**
73
+ * 用于指定列排序,设置为true表示后端排序,否则为前端排序
74
+ * Table同时只能设置一种排序类型,当至少有一个后端排序列时,显式设置为前端排序的列将不会生效
75
+ */
76
+ sorter?: true | {
77
+ type?: VxeColumnPropTypes.SortType;
78
+ by?: VxeColumnPropTypes.SortBy;
79
+ };
80
+ /**
81
+ * 表头的菜单筛选项,设置为true后会尝试使用valueEnum生成filters
82
+ */
83
+ filters?: Omit<ColumnFilterItem, 'children'>[] | true;
84
+ /**
85
+ * 自定义渲染,添加了`originalNode、originalText`
86
+ * @param opt
87
+ * @returns
88
+ */
89
+ customRender?: (opt: {
90
+ value: any;
91
+ text: any;
92
+ record: RecordType;
93
+ index: number;
94
+ renderIndex: number;
95
+ column: ApGridColumnType<RecordType>;
96
+ originalNode?: VNode;
97
+ originalText?: any;
98
+ }) => any;
99
+ } : never;
100
+ export type ApGridRowSelection<RecordType> = Pick<TableRowSelection<RecordType>, 'defaultSelectedRowKeys' | 'type' | 'preserveSelectedRowKeys' | 'onChange' | 'fixed' | 'columnWidth' | 'columnTitle'> & {
101
+ /**
102
+ * 设置禁用的列
103
+ * @param row
104
+ * @returns
105
+ */
106
+ disabled?: (row: RecordType) => boolean;
107
+ };
108
+ export type ApGridProps<RecordType = any, ParamsType = any> = Omit<TableProps<RecordType>, 'columns' | 'pagination' | 'dataSource' | 'size' | 'rowSelection' | 'rowKey' | 'rowClassName' | 'footer'> & Pick<VxeTableProps<RecordType>, 'rowClassName' | 'stripe' | 'headerRowClassName' | 'footerRowClassName' | 'cellClassName' | 'headerCellClassName' | 'footerCellClassName' | 'rowStyle' | 'headerRowStyle' | 'footerRowStyle' | 'cellStyle' | 'headerCellStyle' | 'footerCellStyle' | 'height' | 'minHeight' | 'maxHeight' | 'mergeCells' | 'mergeFooterItems' | 'cellConfig'> & {
109
+ /**
110
+ * 列配置
111
+ */
112
+ columns?: ApGridColumnType<RecordType, any>[];
113
+ /**
114
+ * 行选中配置
115
+ */
116
+ rowSelection?: true | ApGridRowSelection<RecordType>;
117
+ /**
118
+ * 是否启用卡片样式
119
+ */
120
+ card?: boolean;
121
+ /**
122
+ * request额外请求的参数
123
+ * 如果传入响应式数据,将会在变更后重新执行
124
+ */
125
+ params?: ParamsType | Ref<ParamsType>;
126
+ /**
127
+ * 请求获取dataSource
128
+ * @param params
129
+ * @returns
130
+ */
131
+ request?: (params: Partial<ParamsType> & {
132
+ pageSize: number;
133
+ current: number;
134
+ sort?: Record<string, SortOrder>;
135
+ filter?: Recordable<any>;
136
+ }) => Promise<Partial<RequestData<RecordType>>>;
137
+ /**
138
+ * 表格的默认数据源,这些数据源将会在第一次请求后被替换
139
+ */
140
+ defaultData?: RecordType[];
141
+ /**
142
+ * 表格的最终数据源(设置后request和defaultData都不会生效),离线表格的效果
143
+ */
144
+ dataSource?: RecordType[];
145
+ /**
146
+ * 表格loading状态变更后触发
147
+ * @param loading
148
+ * @returns
149
+ */
150
+ onLoadingChange?: (loading: boolean) => void;
151
+ /**
152
+ * 查询表单配置,设置为false表示不渲染查询表单
153
+ */
154
+ searchForm?: false | ApFormSearchFormProps;
155
+ /**
156
+ * 查询表单提交之前,一般用于自定义对查询数据进行变更
157
+ * @param params
158
+ * @returns
159
+ */
160
+ beforeSearchSubmit?: (params: Partial<ParamsType>) => any;
161
+ /**
162
+ * 是否显示分页器(特定的分页器)或者指定默认的当前页和pageSize
163
+ */
164
+ pagination?: false | ApTablePaginationConfig;
165
+ /**
166
+ * 自定义查询表单容器样式
167
+ */
168
+ searchFormWrapperStyle?: CSSProperties;
169
+ /**
170
+ * 自定义表格样式
171
+ */
172
+ tableWrapperStyle?: CSSProperties;
173
+ /**
174
+ * 是否手动发起第一次网络请求
175
+ */
176
+ manual?: boolean;
177
+ /**
178
+ * 表格尺寸(只支持中等大小和小尺寸)
179
+ */
180
+ size?: 'medium' | 'small' | 'mini';
181
+ /**
182
+ * 表格是否自适应高度
183
+ * @deprecated 暂未实现
184
+ */
185
+ adaptive?: boolean;
186
+ /**
187
+ * 设置表格列是否可以resize,还可以进行更多可变尺寸配置
188
+ */
189
+ columnResizable?: boolean | VxeTablePropTypes.ResizableConfig;
190
+ rowKey?: string;
191
+ /**
192
+ * 指定用于渲染footer的数据,支持函数
193
+ */
194
+ footer?: VxeTablePropTypes.FooterData | VxeTablePropTypes.FooterMethod<RecordType>;
195
+ /**
196
+ * 设置虚拟滚动
197
+ */
198
+ virtual?: false | ApGridVirtualConfig;
199
+ /**
200
+ * 设置可展开及其配置
201
+ */
202
+ expandable?: VxeTablePropTypes.ExpandConfig<RecordType> & {
203
+ /**
204
+ * 自定义渲染内容
205
+ */
206
+ renderContent: VxeColumnSlots<RecordType>['content'];
207
+ /**
208
+ * 展开列占据的宽度,默认为auto
209
+ */
210
+ width?: string | number;
211
+ /**
212
+ * 展开列的title
213
+ */
214
+ title?: string;
215
+ };
216
+ };
217
+ export type ApGridVirtualConfig = {
218
+ x?: false | number;
219
+ y?: false | number;
220
+ };
221
+ export type ApGridColumnProps<RecordType> = {
222
+ column: ApGridColumnType<RecordType>;
223
+ };
224
+ export type ApGridExpose<SearchParamsType = Recordable, RecordType = any> = {
225
+ /**
226
+ * 表格查询提交(重制页码但查询参数不会重置)
227
+ * @returns
228
+ */
229
+ submit: () => void;
230
+ /**
231
+ * 表格查询重置(重置页码和查询参数)
232
+ * @returns
233
+ */
234
+ reset: () => void;
235
+ /**
236
+ * 表格刷新当页数据
237
+ * @returns
238
+ */
239
+ refresh: () => void;
240
+ /**
241
+ * 设置查询表单数据
242
+ * @param values
243
+ * @returns
244
+ */
245
+ setSearchFormValues: (values: Partial<SearchParamsType>) => void;
246
+ /**
247
+ * 获取查询表单数据
248
+ * @param transform 是否获取转换后的数据 默认为`false`
249
+ * @returns
250
+ */
251
+ getSearchFormValues: (transform?: boolean) => (Partial<SearchParamsType> & Recordable<any>) | undefined;
252
+ /**
253
+ * 获取最终现实的列配置
254
+ * @returns
255
+ */
256
+ getShowColumns: () => ApGridColumnType<RecordType>[];
257
+ /**
258
+ * 行选中相关
259
+ */
260
+ rowSelection: {
261
+ selectedRows: ComputedRef<RecordType[]>;
262
+ clearAll: () => void;
263
+ };
264
+ };
@@ -0,0 +1 @@
1
+
File without changes
@@ -0,0 +1 @@
1
+ import '@aplus-frontend/ui/theme/ap-grid/index.css';
File without changes
@@ -0,0 +1 @@
1
+ import '@aplus-frontend/ui/theme/ap-grid/index.less';
@@ -0,0 +1,20 @@
1
+ import { ApGridColumnType, ColConfigType } from '../interface';
2
+ import { ValueTypeRenderConfig } from '../../config-provider';
3
+ /**
4
+ * 转换分组页
5
+ * @param columnConfig
6
+ * @returns
7
+ */
8
+ export declare function transformToColGroup<RecordType>(columnConfig: ApGridColumnType<RecordType>, color: string, className: string): ColConfigType;
9
+ /**
10
+ * 转换渲染列
11
+ * @param columnConfig
12
+ * @returns
13
+ */
14
+ export declare function transformToColumn<RecordType>(columnConfig: ApGridColumnType<RecordType>, color: string, className: string, extraValueType?: Record<string, ValueTypeRenderConfig>): ColConfigType;
15
+ /**
16
+ * 将ApColumn风格的列配置转换成适合VxeTable渲染的数据结构
17
+ * @param rawColumn
18
+ * @returns
19
+ */
20
+ export declare function transformCol<RecordType>(rawColumn: ApGridColumnType<RecordType>, color: string, className: string, extraValueType?: Record<string, ValueTypeRenderConfig>): ColConfigType;
@@ -0,0 +1,106 @@
1
+ import { createVNode as E, Fragment as M } from "vue";
2
+ import { isUndefined as S, isArray as B, isString as v, isBoolean as F, pick as w } from "lodash-unified";
3
+ import { valueEnumToArray as W, getTableTitle as A, getTableRenderType as j, getTableRenderProps as k, getTableCellRenderNode as z } from "../../ap-table/utils.mjs";
4
+ function O(e) {
5
+ if (!S(e))
6
+ return B(e) ? e.reduce((r, i) => v(i) ? `${r}.${i}` : `${r}[${i}]`, "") : String(e);
7
+ }
8
+ function R(e) {
9
+ if (e)
10
+ return e === !0 ? "left" : e;
11
+ }
12
+ function G(e) {
13
+ return F(e) ? {
14
+ sortable: e
15
+ } : e ? {
16
+ sortable: !0,
17
+ sortType: e == null ? void 0 : e.type,
18
+ sortBy: e == null ? void 0 : e.by
19
+ } : {
20
+ sortable: !1
21
+ };
22
+ }
23
+ function H(e) {
24
+ let r;
25
+ return F(e.filters) && e.valueEnum ? r = W(e.valueEnum) : r = e.filters, r == null ? void 0 : r.map((i) => ({
26
+ label: v(i.text) ? i.text : "",
27
+ value: i.value
28
+ }));
29
+ }
30
+ function N(e) {
31
+ if (e)
32
+ return (r) => e(r.value, r.row);
33
+ }
34
+ function u(e, r, i) {
35
+ const d = w(e, ["width", "minWidth", "align"]);
36
+ return d.field = O(e.dataIndex), d.fixed = R(e.fixed), d.title = e.title, d.slots = {
37
+ header: () => A(e, i, void 0, r)
38
+ }, d.headerAlign = e.align, d.showOverflow = e.ellipsis, d.showHeaderOverflow = e.ellipsis, d;
39
+ }
40
+ function y(e, r, i, d) {
41
+ const t = w(e, ["width", "minWidth", "align", "resizable"]);
42
+ t.field = O(e.dataIndex), t.fixed = R(e.fixed), t.headerAlign = e.align, t.footerAlign = e.align, t.showOverflow = e.ellipsis, t.showFooterOverflow = e.ellipsis, Object.assign(t, G(e.sorter)), t.filters = H(e), t.filterMultiple = e.filterMultiple, t.filterMethod = N(e.onFilter), t.title = e.title;
43
+ const h = ({
44
+ value: s,
45
+ ...n
46
+ }) => {
47
+ var p, x;
48
+ const l = j(e), a = k({
49
+ ...e,
50
+ valueType: l
51
+ }, {
52
+ value: s,
53
+ ...n
54
+ }), f = z(l, a, n.record, d), $ = ((p = e.renderText) == null ? void 0 : p.call(e, {
55
+ value: s,
56
+ ...n
57
+ })) || s;
58
+ let T = e.renderText ? E(M, null, [(x = e.renderText) == null ? void 0 : x.call(e, {
59
+ value: s,
60
+ ...n
61
+ })]) : f;
62
+ return e.customRender && (T = e.customRender({
63
+ value: s,
64
+ ...n,
65
+ column: e,
66
+ originalNode: T,
67
+ originalText: $
68
+ })), T;
69
+ };
70
+ return t.slots = {
71
+ header: () => A(e, i, void 0, r),
72
+ default: ({
73
+ row: s,
74
+ rowIndex: n
75
+ }) => h({
76
+ value: s[t.field],
77
+ text: s[t.field],
78
+ record: s,
79
+ index: n,
80
+ renderIndex: n,
81
+ column: e
82
+ })
83
+ }, t;
84
+ }
85
+ function I(e, r, i, d) {
86
+ var s;
87
+ if (!((s = e.children) != null && s.length))
88
+ return y(e, r, i, d);
89
+ function t(n) {
90
+ return n.map((l) => {
91
+ var a;
92
+ if ((a = l.children) != null && a.length) {
93
+ const f = u(l, r, i);
94
+ return f.children = t(l.children), f;
95
+ }
96
+ return y(l, r, i, d);
97
+ });
98
+ }
99
+ const h = u(e, r, i);
100
+ return h.children = t(e.children), h;
101
+ }
102
+ export {
103
+ I as transformCol,
104
+ u as transformToColGroup,
105
+ y as transformToColumn
106
+ };
@@ -0,0 +1,3 @@
1
+ import { ApGridColumnType } from '../interface';
2
+ import { ValueTypeRenderConfig } from '../../config-provider';
3
+ export declare function renderWithColumns<RecordType>(columns: ApGridColumnType<RecordType>[], color: string, className: string, extraValueType?: Record<string, ValueTypeRenderConfig>): import("vue/jsx-runtime").JSX.Element[];
@@ -0,0 +1,21 @@
1
+ import { createVNode as m } from "vue";
2
+ import { VxeColumn as u, VxeColgroup as p } from "vxe-table";
3
+ import { transformCol as d } from "./col.mjs";
4
+ function n(r) {
5
+ var e;
6
+ return (e = r.children) != null && e.length ? m(p, r, {
7
+ ...r.slots || {},
8
+ default: () => {
9
+ var t;
10
+ return (t = r.children) == null ? void 0 : t.map((o) => n(o));
11
+ }
12
+ }) : m(u, r, {
13
+ ...r.slots || {}
14
+ });
15
+ }
16
+ function C(r, e, t, o) {
17
+ return r.map((l) => n(d(l, e, t, o)));
18
+ }
19
+ export {
20
+ C as renderWithColumns
21
+ };
@@ -0,0 +1,13 @@
1
+ import { VxeTableEventProps, VxeTableProps } from 'vxe-table';
2
+ import { ApGridProps, ApGridRowSelection } from '../interface';
3
+ import { RowSelectionType } from '@aplus-frontend/antdv/es/table/interface';
4
+ export declare function toVxeProps<RecordType>(props: any): VxeTableProps<RecordType> & VxeTableEventProps<RecordType>;
5
+ export declare function getRowSelectionProps(rowSelection: ApGridRowSelection<any> | true): {
6
+ type: RowSelectionType;
7
+ width: string | number;
8
+ };
9
+ export declare function getRowExpandProps(config: ApGridProps['expandable']): {
10
+ readonly type: "expand";
11
+ readonly title: string | undefined;
12
+ readonly width: string | number;
13
+ };
@@ -0,0 +1,64 @@
1
+ import { isUndefined as d, omit as a, isFunction as c, isNumber as f } from "lodash-unified";
2
+ const h = 30, b = 50;
3
+ function y(e) {
4
+ var i, l, n;
5
+ const t = {
6
+ ...e
7
+ };
8
+ if (e.columnResizable && (t.columnConfig ? t.columnConfig.resizable = !0 : t.columnConfig = {
9
+ resizable: !0
10
+ }), e.rowSelection) {
11
+ const o = e.rowSelection === !0 ? {} : e.rowSelection;
12
+ o.type === "radio" ? t.radioConfig = {
13
+ highlight: !0,
14
+ checkMethod({ row: r }) {
15
+ return o.disabled ? !o.disabled(r) : !0;
16
+ },
17
+ checkRowKey: (i = o.defaultSelectedRowKeys) == null ? void 0 : i[0],
18
+ reserve: d(o.preserveSelectedRowKeys) ? !0 : o.preserveSelectedRowKeys
19
+ } : t.checkboxConfig = {
20
+ highlight: !0,
21
+ checkMethod({ row: r }) {
22
+ return o.disabled ? !o.disabled(r) : !0;
23
+ },
24
+ checkRowKeys: o.defaultSelectedRowKeys,
25
+ reserve: d(o.preserveSelectedRowKeys) ? !0 : o.preserveSelectedRowKeys
26
+ };
27
+ }
28
+ return t.border = e.bordered, e.expandable && (t.expandConfig = a(e.expandable, [
29
+ "renderContent",
30
+ "width",
31
+ "title"
32
+ ])), e.footer && (t.showFooter = !0, c(e.footer) ? t.footerMethod = e.footer : t.footerData = e.footer), e.virtual === !1 ? (t.virtualXConfig = {
33
+ enabled: !1
34
+ }, t.virtualYConfig = {
35
+ enabled: !1
36
+ }) : (u(t, "X", (l = e.virtual) == null ? void 0 : l.x), u(t, "Y", (n = e.virtual) == null ? void 0 : n.y)), t;
37
+ }
38
+ function u(e, t, i) {
39
+ const l = t === "X", n = l ? "virtualXConfig" : "virtualYConfig", o = i !== !1, r = l ? h : b, s = f(i) && i >= 0 ? i : r;
40
+ e[n] = {
41
+ enabled: o,
42
+ gt: s
43
+ };
44
+ }
45
+ function C(e) {
46
+ const t = e === !0 || !e.type ? "checkbox" : e.type, i = e === !0 ? 60 : e.columnWidth || 60;
47
+ return {
48
+ type: t,
49
+ width: i
50
+ };
51
+ }
52
+ function R(e) {
53
+ const t = (e == null ? void 0 : e.width) || "auto";
54
+ return {
55
+ type: "expand",
56
+ title: e == null ? void 0 : e.title,
57
+ width: t
58
+ };
59
+ }
60
+ export {
61
+ R as getRowExpandProps,
62
+ C as getRowSelectionProps,
63
+ y as toVxeProps
64
+ };
@@ -20,6 +20,8 @@ declare const _default: <RecordType>(__VLS_props: NonNullable<Awaited<typeof __V
20
20
  unSelectAll: () => void;
21
21
  clearAll: () => void;
22
22
  toggleSelect: (item: RecordType) => void;
23
+ selectMulti: (items: RecordType[]) => void;
24
+ unSelectMulti: (items: RecordType[]) => void;
23
25
  selectedRows: ComputedRef<RecordType[]>;
24
26
  };
25
27
  scrollBar: {
@@ -1,21 +1,21 @@
1
- import { defineComponent as E, ref as P, computed as f, unref as r, watch as U, createElementBlock as p, openBlock as s, createElementVNode as v, normalizeClass as x, createVNode as u, withCtx as i, createBlock as h, resolveDynamicComponent as k, Fragment as D, renderList as L, mergeProps as j } from "vue";
2
- import { Checkbox as w, Row as z, Col as F } from "@aplus-frontend/antdv";
1
+ import { defineComponent as P, ref as U, computed as p, unref as l, watch as x, createElementBlock as v, openBlock as s, createElementVNode as k, normalizeClass as D, createVNode as u, withCtx as i, createBlock as h, resolveDynamicComponent as w, Fragment as L, renderList as j, mergeProps as z } from "vue";
2
+ import { Checkbox as b, Row as F, Col as I } from "@aplus-frontend/antdv";
3
3
  import "../../../../config-provider/index.mjs";
4
- import { useInjectApTable as I } from "../../../context.mjs";
5
- import { cloneLabelNode as b } from "../utils.mjs";
6
- import { useNamespace as R } from "../../../../config-provider/hooks/use-namespace.mjs";
7
- const K = /* @__PURE__ */ E({
4
+ import { useInjectApTable as R } from "../../../context.mjs";
5
+ import { getLabelNode as C } from "../utils.mjs";
6
+ import { useNamespace as T } from "../../../../config-provider/hooks/use-namespace.mjs";
7
+ const M = /* @__PURE__ */ P({
8
8
  __name: "index",
9
9
  props: {
10
10
  value: {}
11
11
  },
12
12
  setup(y) {
13
- const t = y, { b: C } = R("select-group"), c = P(!1), { columnsBackup: _ } = I(), m = f(() => {
13
+ const t = y, { b: _ } = T("select-group"), d = U(!1), { columnsBackup: g, renderConfig: m } = R(), f = p(() => {
14
14
  var e;
15
- return (e = r(_)) == null ? void 0 : e.find(
15
+ return (e = l(g)) == null ? void 0 : e.find(
16
16
  (n) => {
17
- var l;
18
- return n.key === ((l = t.value) == null ? void 0 : l.key);
17
+ var r;
18
+ return n.key === ((r = t.value) == null ? void 0 : r.key);
19
19
  }
20
20
  );
21
21
  });
@@ -26,24 +26,24 @@ const K = /* @__PURE__ */ E({
26
26
  disabled: t.value.disabled || (e == null ? void 0 : e.disabled)
27
27
  };
28
28
  }
29
- function g(o) {
29
+ function A(o) {
30
30
  const e = t.value;
31
- e.children.forEach((n) => n.show = o), e.show = o, c.value = !1;
31
+ e.children.forEach((n) => n.show = o), e.show = o, d.value = !1;
32
32
  }
33
- function A(o, e) {
34
- const n = t.value, l = n.children.find((a) => a.key === o);
35
- if (!l)
33
+ function B(o, e) {
34
+ const n = t.value, r = n.children.find((a) => a.key === o);
35
+ if (!r)
36
36
  return;
37
- l.show = e;
38
- const d = n.children.every((a) => a.show), N = n.children.some((a) => a.show);
39
- n.show = d, c.value = N && !d;
37
+ r.show = e;
38
+ const c = n.children.every((a) => a.show), E = n.children.some((a) => a.show);
39
+ n.show = c, d.value = E && !c;
40
40
  }
41
- const B = f(() => t.value.disabled || t.value.children.every((o) => o.disabled));
42
- return U(
41
+ const N = p(() => t.value.disabled || t.value.children.every((o) => o.disabled));
42
+ return x(
43
43
  () => t.value,
44
44
  (o) => {
45
- const e = o.children.every((l) => l.show), n = o.children.some((l) => l.show);
46
- c.value = n && !e, o.show !== e && (o.show = e);
45
+ const e = o.children.every((r) => r.show), n = o.children.some((r) => r.show);
46
+ d.value = n && !e, o.show !== e && (o.show = e);
47
47
  },
48
48
  {
49
49
  deep: !0,
@@ -51,35 +51,35 @@ const K = /* @__PURE__ */ E({
51
51
  }
52
52
  ), (o, e) => {
53
53
  var n;
54
- return s(), p("div", null, [
55
- v("div", {
56
- class: x(r(C)("header"))
54
+ return s(), v("div", null, [
55
+ k("div", {
56
+ class: D(l(_)("header"))
57
57
  }, [
58
- u(r(w), {
59
- indeterminate: c.value,
58
+ u(l(b), {
59
+ indeterminate: d.value,
60
60
  checked: (n = o.value) == null ? void 0 : n.show,
61
- disabled: B.value,
62
- "onUpdate:checked": g
61
+ disabled: N.value,
62
+ "onUpdate:checked": A
63
63
  }, {
64
64
  default: i(() => [
65
- (s(), h(k(r(b)(m.value.title))))
65
+ (s(), h(w(l(C)(f.value, l(m)))))
66
66
  ]),
67
67
  _: 1
68
68
  }, 8, ["indeterminate", "checked", "disabled"])
69
69
  ], 2),
70
- v("div", null, [
71
- u(r(z), { align: "middle" }, {
70
+ k("div", null, [
71
+ u(l(F), { align: "middle" }, {
72
72
  default: i(() => [
73
- (s(!0), p(D, null, L(m.value.children, (l) => (s(), h(r(F), {
74
- key: l.key,
73
+ (s(!0), v(L, null, j(f.value.children, (r) => (s(), h(l(I), {
74
+ key: r.key,
75
75
  span: 8
76
76
  }, {
77
77
  default: i(() => [
78
- u(r(w), j({ ref_for: !0 }, S(l), {
79
- "onUpdate:checked": (d) => A(l.key, d)
78
+ u(l(b), z({ ref_for: !0 }, S(r), {
79
+ "onUpdate:checked": (c) => B(r.key, c)
80
80
  }), {
81
81
  default: i(() => [
82
- (s(), h(k(r(b)(l.title))))
82
+ (s(), h(w(l(C)(r, l(m)))))
83
83
  ]),
84
84
  _: 2
85
85
  }, 1040, ["onUpdate:checked"])
@@ -95,5 +95,5 @@ const K = /* @__PURE__ */ E({
95
95
  }
96
96
  });
97
97
  export {
98
- K as default
98
+ M as default
99
99
  };