@next-bricks/advanced 0.0.3
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/dist/bricks.json +13 -0
- package/dist/chunks/1415.5425612a.js +2 -0
- package/dist/chunks/1415.5425612a.js.map +1 -0
- package/dist/chunks/1646.23f9d8b5.js +2 -0
- package/dist/chunks/1646.23f9d8b5.js.map +1 -0
- package/dist/chunks/1779.48e1d1a2.js +3 -0
- package/dist/chunks/1779.48e1d1a2.js.LICENSE.txt +16 -0
- package/dist/chunks/1779.48e1d1a2.js.map +1 -0
- package/dist/chunks/2024.670e2e7e.js +2 -0
- package/dist/chunks/2024.670e2e7e.js.map +1 -0
- package/dist/chunks/2108.341c60e9.js +2 -0
- package/dist/chunks/2108.341c60e9.js.map +1 -0
- package/dist/chunks/2241.3caef649.js +3 -0
- package/dist/chunks/2241.3caef649.js.LICENSE.txt +19 -0
- package/dist/chunks/2241.3caef649.js.map +1 -0
- package/dist/chunks/2323.5722f8ad.js +2 -0
- package/dist/chunks/2323.5722f8ad.js.map +1 -0
- package/dist/chunks/2754.8c6b03f9.js +2 -0
- package/dist/chunks/2754.8c6b03f9.js.map +1 -0
- package/dist/chunks/3494.90b068cb.js +2 -0
- package/dist/chunks/3494.90b068cb.js.map +1 -0
- package/dist/chunks/3914.8c47fde6.js +2 -0
- package/dist/chunks/3914.8c47fde6.js.map +1 -0
- package/dist/chunks/4049.e3f15353.js +2 -0
- package/dist/chunks/4049.e3f15353.js.map +1 -0
- package/dist/chunks/4454.5e95cc1a.js +2 -0
- package/dist/chunks/4454.5e95cc1a.js.map +1 -0
- package/dist/chunks/4717.b9d4a3a0.js +2 -0
- package/dist/chunks/4717.b9d4a3a0.js.map +1 -0
- package/dist/chunks/4728.542c3425.js +2 -0
- package/dist/chunks/4728.542c3425.js.map +1 -0
- package/dist/chunks/4795.8cfdba50.js +2 -0
- package/dist/chunks/4795.8cfdba50.js.map +1 -0
- package/dist/chunks/4991.2a6b7815.js +2 -0
- package/dist/chunks/4991.2a6b7815.js.map +1 -0
- package/dist/chunks/5151.299f947f.js +2 -0
- package/dist/chunks/5151.299f947f.js.map +1 -0
- package/dist/chunks/5202.77ec812a.js +2 -0
- package/dist/chunks/5202.77ec812a.js.map +1 -0
- package/dist/chunks/5628.621f7c8f.js +2 -0
- package/dist/chunks/5628.621f7c8f.js.map +1 -0
- package/dist/chunks/5637.751a0dbd.js +2 -0
- package/dist/chunks/5637.751a0dbd.js.map +1 -0
- package/dist/chunks/6205.fa6fe46d.js +2 -0
- package/dist/chunks/6205.fa6fe46d.js.map +1 -0
- package/dist/chunks/6473.4d756176.js +2 -0
- package/dist/chunks/6473.4d756176.js.map +1 -0
- package/dist/chunks/6635.67c4a68b.js +3 -0
- package/dist/chunks/6635.67c4a68b.js.LICENSE.txt +8 -0
- package/dist/chunks/6635.67c4a68b.js.map +1 -0
- package/dist/chunks/7164.e917e6fe.js +2 -0
- package/dist/chunks/7164.e917e6fe.js.map +1 -0
- package/dist/chunks/7179.895664ac.js +2 -0
- package/dist/chunks/7179.895664ac.js.map +1 -0
- package/dist/chunks/7244.99a25642.js +2 -0
- package/dist/chunks/7244.99a25642.js.map +1 -0
- package/dist/chunks/7746.8fe33796.js +2 -0
- package/dist/chunks/7746.8fe33796.js.map +1 -0
- package/dist/chunks/7822.65dffea5.js +2 -0
- package/dist/chunks/7822.65dffea5.js.map +1 -0
- package/dist/chunks/7915.ac44f536.js +2 -0
- package/dist/chunks/7915.ac44f536.js.map +1 -0
- package/dist/chunks/8008.8c310528.js +3 -0
- package/dist/chunks/8008.8c310528.js.LICENSE.txt +3 -0
- package/dist/chunks/8008.8c310528.js.map +1 -0
- package/dist/chunks/8207.2f6bff53.js +2 -0
- package/dist/chunks/8207.2f6bff53.js.map +1 -0
- package/dist/chunks/873.d88602ac.js +2 -0
- package/dist/chunks/873.d88602ac.js.map +1 -0
- package/dist/chunks/9431.f9e15525.js +2 -0
- package/dist/chunks/9431.f9e15525.js.map +1 -0
- package/dist/chunks/9549.88a18c15.js +2 -0
- package/dist/chunks/9549.88a18c15.js.map +1 -0
- package/dist/chunks/general-table.29ed5154.js +2 -0
- package/dist/chunks/general-table.29ed5154.js.map +1 -0
- package/dist/chunks/main.a58c24cb.js +2 -0
- package/dist/chunks/main.a58c24cb.js.map +1 -0
- package/dist/chunks/react.cc9b94a2.js +2 -0
- package/dist/chunks/react.cc9b94a2.js.LICENSE.txt +39 -0
- package/dist/index.c97f378f.js +2 -0
- package/dist/index.c97f378f.js.map +1 -0
- package/dist-types/bootstrap.d.ts +1 -0
- package/dist-types/index.d.ts +1 -0
- package/dist-types/interface.d.ts +1 -0
- package/dist-types/table/BrickTable.d.ts +40 -0
- package/dist-types/table/index.d.ts +500 -0
- package/dist-types/table/index.spec.d.ts +1 -0
- package/dist-types/table/utils.d.ts +6 -0
- package/package.json +62 -0
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ReactNextElement } from "@next-core/react-element";
|
|
3
|
+
import { ColumnProps, TablePaginationConfig, TableProps } from "antd/es/table";
|
|
4
|
+
import { BrickEventsMap, UseSingleBrickConf } from "@next-core/types";
|
|
5
|
+
import { TableRowSelection, RowSelectionType } from "antd/lib/table/interface.js";
|
|
6
|
+
import type { DataIndex } from "rc-table/lib/interface.js";
|
|
7
|
+
import type { SizeType } from "antd/lib/config-provider/SizeContext.js";
|
|
8
|
+
import type { GeneralIconProps } from "@next-bricks/icons/general-icon";
|
|
9
|
+
import "@next-core/theme";
|
|
10
|
+
export interface RowDisabledProps {
|
|
11
|
+
field: string;
|
|
12
|
+
value: any;
|
|
13
|
+
operator: "$eq" | "$ne" | "$lt" | "$lte" | "$gt" | "$gte" | "$isEqual" | "$notEqual" | "$in" | "$nin" | "$exists";
|
|
14
|
+
}
|
|
15
|
+
export interface CellStatusProps {
|
|
16
|
+
dataIndex?: string;
|
|
17
|
+
mapping: Array<{
|
|
18
|
+
leftBorderColor: string;
|
|
19
|
+
value: any;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export interface CustomColumnComponent {
|
|
23
|
+
/** 构件名称 */
|
|
24
|
+
brick: string | any;
|
|
25
|
+
/** 字段值、列表项和 index 对应所用构件的属性的 key */
|
|
26
|
+
fields?: {
|
|
27
|
+
value?: string;
|
|
28
|
+
item?: string;
|
|
29
|
+
index?: string;
|
|
30
|
+
};
|
|
31
|
+
/** 构件属性 */
|
|
32
|
+
properties?: Record<string, any>;
|
|
33
|
+
/** 事件 */
|
|
34
|
+
events?: BrickEventsMap;
|
|
35
|
+
}
|
|
36
|
+
export interface CustomColumn extends ColumnProps<Record<string, any>> {
|
|
37
|
+
/**
|
|
38
|
+
* 支持为某列自定义展示构件
|
|
39
|
+
*/
|
|
40
|
+
useBrick?: UseSingleBrickConf;
|
|
41
|
+
/**
|
|
42
|
+
* 字段的值展示时的后缀
|
|
43
|
+
*/
|
|
44
|
+
valueSuffix?: string;
|
|
45
|
+
/**
|
|
46
|
+
* 支持为某列的表头自定义展示构件,可通过 DATA.title 获取标题文本
|
|
47
|
+
*/
|
|
48
|
+
headerBrick?: {
|
|
49
|
+
useBrick: UseSingleBrickConf;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* 在渲染自定义构件的场景下额外设置单元格的状态样式, `dataIndex` 表示取哪一列的字段值作为判断数据,不填的话默认取当前列的字段,`mapping` 表示判断的条件,条件被成功匹配时用当前的样式。目前仅支持单元格 `leftBorderColor` 属性的设置
|
|
53
|
+
*/
|
|
54
|
+
cellStatus?: CellStatusProps;
|
|
55
|
+
/**
|
|
56
|
+
* 设置列的每个单元格样式
|
|
57
|
+
*/
|
|
58
|
+
cellStyle?: React.CSSProperties;
|
|
59
|
+
/**
|
|
60
|
+
* 单元格内元素的垂直对齐方式
|
|
61
|
+
*/
|
|
62
|
+
verticalAlign?: "top" | "bottom";
|
|
63
|
+
/**
|
|
64
|
+
* 每条记录的控制列合并的值的 key
|
|
65
|
+
*/
|
|
66
|
+
colSpanKey?: string;
|
|
67
|
+
/**
|
|
68
|
+
* 每条记录的控制行合并的值的 key
|
|
69
|
+
*/
|
|
70
|
+
rowSpanKey?: string;
|
|
71
|
+
/**
|
|
72
|
+
* 自定义筛选菜单
|
|
73
|
+
*/
|
|
74
|
+
filterDropdownBrick?: {
|
|
75
|
+
useBrick: UseSingleBrickConf;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @id advanced.general-table
|
|
80
|
+
* @name advanced.general-table
|
|
81
|
+
* @docKind brick
|
|
82
|
+
* @description 通用表格构件
|
|
83
|
+
* @author sailor
|
|
84
|
+
* @noInheritDoc
|
|
85
|
+
*/
|
|
86
|
+
declare class TableComponent extends ReactNextElement {
|
|
87
|
+
#private;
|
|
88
|
+
/**
|
|
89
|
+
* @kind CustomColumn[]
|
|
90
|
+
* @required false
|
|
91
|
+
* @default -
|
|
92
|
+
* @description 扩展自 ant-design 的 Column 相关配置项,具体查阅:[Column](https://ant.design/components/table-cn/#Column)
|
|
93
|
+
* @group basic
|
|
94
|
+
*/
|
|
95
|
+
set columns(value: CustomColumn[]);
|
|
96
|
+
get columns(): CustomColumn[];
|
|
97
|
+
/**
|
|
98
|
+
* @kind any[]
|
|
99
|
+
* @required false
|
|
100
|
+
* @default -
|
|
101
|
+
* @description 数据源,通过 useResolves 从后台接口获取或者直接在 storyboard 中配置
|
|
102
|
+
* @group basic
|
|
103
|
+
*/
|
|
104
|
+
set dataSource(value: Record<string, any>[]);
|
|
105
|
+
/**
|
|
106
|
+
* @required false
|
|
107
|
+
* @default true
|
|
108
|
+
* @description 是否显示外层卡片
|
|
109
|
+
* @group basic
|
|
110
|
+
*/
|
|
111
|
+
accessor showCard: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* @required false
|
|
114
|
+
* @default -
|
|
115
|
+
* @description 表格行是否可选择,具体查阅:[rowSelection](https://ant.design/components/table-cn/#rowSelection)
|
|
116
|
+
* @group basic
|
|
117
|
+
*/
|
|
118
|
+
accessor rowSelection: false | TableRowSelection<any> | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* @required false
|
|
121
|
+
* @default "key"
|
|
122
|
+
* @description 指定每一行的 key,不指定则默认为索引 index。强烈建议设置该属性,否则在某些情况下可能行为不如预期。
|
|
123
|
+
* @group basic
|
|
124
|
+
*/
|
|
125
|
+
accessor rowKey: string | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* @required false
|
|
128
|
+
* @default -
|
|
129
|
+
* @description 隐藏相应列(输入对应的 dataIndex 或者 key 即可)
|
|
130
|
+
* @group basic
|
|
131
|
+
*/
|
|
132
|
+
accessor hiddenColumns: Array<string | number> | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* @required false
|
|
135
|
+
* @default false
|
|
136
|
+
* @description 是否显示已选择信息和清除按钮。仅在设置了`rowSelection`时有效。默认不显示
|
|
137
|
+
* @group rowSelection
|
|
138
|
+
*/
|
|
139
|
+
accessor showSelectInfo: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* @required false
|
|
142
|
+
* @default -
|
|
143
|
+
* @description 表头过滤的过滤项,key 为 column 的 dataIndex,value 为过滤值集合。
|
|
144
|
+
* @group paginationAndFilter
|
|
145
|
+
*/
|
|
146
|
+
accessor filters: Record<string, string[]> | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* @required false
|
|
149
|
+
* @default -
|
|
150
|
+
* @description ant-design 的 Table 相关配置项,具体查阅:[Table](https://ant.design/components/table-cn/#Table),其中分页配置和行选择配值在构件中设置了常用的默认配置,也可自行覆盖,具体描述见下表
|
|
151
|
+
* @group other
|
|
152
|
+
*/
|
|
153
|
+
accessor configProps: any;
|
|
154
|
+
/**
|
|
155
|
+
* @required false
|
|
156
|
+
* @default -
|
|
157
|
+
* @description 被排序列的 dataIndex。通常来自于 url 参数,可以设置成 ${QUERY.sort}。
|
|
158
|
+
* @group paginationAndFilter
|
|
159
|
+
*/
|
|
160
|
+
accessor sort: string | undefined | null;
|
|
161
|
+
/**
|
|
162
|
+
* @required false
|
|
163
|
+
* @default -
|
|
164
|
+
* @description 升序/降序,可以设置成 ${QUERY.order}。
|
|
165
|
+
* @group paginationAndFilter
|
|
166
|
+
*/
|
|
167
|
+
accessor order: string | number | undefined | null;
|
|
168
|
+
/**
|
|
169
|
+
* @required false
|
|
170
|
+
* @default -
|
|
171
|
+
* @description 配置每一行是否禁用,其中 `field` 表示数据源中的字段路径, `value` 表示与其字段比较的值, `operator` 表示两者比较的方法,结果为 `true` 时会禁用当前行, 需要注意的是该配置需要在 `rowSelection: true` 的前提下使用,并且设置 `rowKey` 属性赋予每行唯一的 key,防止顺序变化时造成的错误勾选(如上 demo 所示)
|
|
172
|
+
* @group rowSelection
|
|
173
|
+
*/
|
|
174
|
+
accessor rowDisabledConfig: RowDisabledProps | RowDisabledProps[] | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* @kind {useBrick:UseBrickConf}
|
|
177
|
+
* @required false
|
|
178
|
+
* @default -
|
|
179
|
+
* @description 自定义行展开的构件 [UseBrickConf](/next-docs/docs/api-reference/brick-types.usesinglebrickconf)
|
|
180
|
+
* @group expand
|
|
181
|
+
*/
|
|
182
|
+
accessor expandedRowBrick: {
|
|
183
|
+
useBrick?: UseSingleBrickConf;
|
|
184
|
+
} | undefined;
|
|
185
|
+
/**
|
|
186
|
+
* @kind { collapsedIcon: MenuIcon,expandedIcon: MenuIcon}
|
|
187
|
+
* @required false
|
|
188
|
+
* @default {collapsedIcon:{lib:'antd',icon:'down',theme:'outlined'},expandedIcon:{lib:'antd',icon:'right',theme:'outlined'}}
|
|
189
|
+
* @description 自定义展开图标。
|
|
190
|
+
* @group expand
|
|
191
|
+
*/
|
|
192
|
+
accessor expandIcon: {
|
|
193
|
+
collapsedIcon: GeneralIconProps;
|
|
194
|
+
expandedIcon: GeneralIconProps;
|
|
195
|
+
} | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* @required false
|
|
198
|
+
* @default true
|
|
199
|
+
* @description 展开的图标是否为一个单元格,默认显示在第一列;设置为 false 的时候,可以通过`expandIconColumnIndex`属性设置展开的图标在哪一列
|
|
200
|
+
* @group expand
|
|
201
|
+
*/
|
|
202
|
+
accessor expandIconAsCell: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* @required false
|
|
205
|
+
* @default -
|
|
206
|
+
* @description 展开的图标显示在哪一列,如果没有 rowSelection,默认显示在第一列,否则显示在选择框后面。当`expandIconAsCell`为 false 时,该属性生效。
|
|
207
|
+
* @group expand
|
|
208
|
+
*/
|
|
209
|
+
accessor expandIconColumnIndex: number | undefined;
|
|
210
|
+
/**
|
|
211
|
+
* @required false
|
|
212
|
+
* @default false
|
|
213
|
+
* @description 通过点击行来展开子行
|
|
214
|
+
* @group expand
|
|
215
|
+
*/
|
|
216
|
+
accessor expandRowByClick: boolean | undefined;
|
|
217
|
+
/**
|
|
218
|
+
* @required false
|
|
219
|
+
* @default -
|
|
220
|
+
* @description 优化渲染的列(输入对应的 dataIndex),针对配置了 useBrick 的列。当前 antd 在更新 state 的时候,会全量渲染单元格,如果确定某一列在后续操作中不需要重新渲染,例如仅作为展示的单元格,可通过该属性设置以优化性能。注意,在树形表格中,当某一列内包含展开/收起按钮,则不应该设置该列。
|
|
221
|
+
* @group advanced
|
|
222
|
+
*/
|
|
223
|
+
accessor optimizedColumns: Array<string | number> | undefined;
|
|
224
|
+
/**
|
|
225
|
+
* @required false
|
|
226
|
+
* @default false
|
|
227
|
+
* @description 树形数据展示时是否需要去除空数组
|
|
228
|
+
* @group expand
|
|
229
|
+
*/
|
|
230
|
+
accessor stripEmptyExpandableChildren: boolean;
|
|
231
|
+
/**
|
|
232
|
+
* @required false
|
|
233
|
+
* @default false
|
|
234
|
+
* @description 初始时,是否展开所有行
|
|
235
|
+
* @group expand
|
|
236
|
+
*/
|
|
237
|
+
accessor defaultExpandAllRows: boolean | undefined;
|
|
238
|
+
/**
|
|
239
|
+
* @required false
|
|
240
|
+
* @default false
|
|
241
|
+
* @description 是否显示省略信息
|
|
242
|
+
* @group basic
|
|
243
|
+
*/
|
|
244
|
+
accessor ellipsisInfo: boolean | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* @required false
|
|
247
|
+
* @default -
|
|
248
|
+
* @description 展开的行的 rowKey
|
|
249
|
+
* @group expand
|
|
250
|
+
*/
|
|
251
|
+
accessor expandedRowKeys: string[] | undefined;
|
|
252
|
+
/**
|
|
253
|
+
* @required false
|
|
254
|
+
* @default false
|
|
255
|
+
* @description 表格树形数据展示的时候,行选择父节点的时候是否同步勾选/取消勾选所有子节点,并且被同步勾选的子节点不能单独取消。注意,该属性必须设置 `rowKey` 属性。
|
|
256
|
+
* @group expand
|
|
257
|
+
*/
|
|
258
|
+
accessor selectAllChildren: boolean | undefined;
|
|
259
|
+
/**
|
|
260
|
+
* @required false
|
|
261
|
+
* @default false
|
|
262
|
+
* @description 是否默认选择所有行。注意,该属性必须设置 `rowKey` 属性。
|
|
263
|
+
* @group expand
|
|
264
|
+
*/
|
|
265
|
+
accessor defaultSelectAll: boolean | undefined;
|
|
266
|
+
private _disabledChildrenKeys;
|
|
267
|
+
/**
|
|
268
|
+
* @required false
|
|
269
|
+
* @default children
|
|
270
|
+
* @description 指定树形结构的列名
|
|
271
|
+
* @group expand
|
|
272
|
+
*/
|
|
273
|
+
accessor childrenColumnName: string;
|
|
274
|
+
/**
|
|
275
|
+
* @required false
|
|
276
|
+
* @default true
|
|
277
|
+
* @description 是否支持排序。默认开启,当对应列的sorter设置成true时则可排序。sortable为false时则排序都不生效。
|
|
278
|
+
* @group paginationAndFilter
|
|
279
|
+
*/
|
|
280
|
+
accessor sortable: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* @kind object
|
|
283
|
+
* @required false
|
|
284
|
+
* @default -
|
|
285
|
+
* @description 设置相关字段取自哪里,具体描述见下表
|
|
286
|
+
* @group advanced
|
|
287
|
+
*/
|
|
288
|
+
set fields(value: any);
|
|
289
|
+
/**
|
|
290
|
+
* @required false
|
|
291
|
+
* @default false
|
|
292
|
+
* @description 是否前端进行搜索,配合`presentational-bricks.brick-input`使用
|
|
293
|
+
* @group paginationAndFilter
|
|
294
|
+
*/
|
|
295
|
+
accessor frontSearch: boolean | undefined;
|
|
296
|
+
/**
|
|
297
|
+
* @required false
|
|
298
|
+
* @default -
|
|
299
|
+
* @description 前端搜索参数
|
|
300
|
+
* @group paginationAndFilter
|
|
301
|
+
*/
|
|
302
|
+
accessor frontSearchQuery: string;
|
|
303
|
+
/**
|
|
304
|
+
* @required false
|
|
305
|
+
* @default false
|
|
306
|
+
* @description 是否精确搜索
|
|
307
|
+
* @group paginationAndFilter
|
|
308
|
+
*/
|
|
309
|
+
accessor exactSearch: boolean | undefined;
|
|
310
|
+
/**
|
|
311
|
+
* @required false
|
|
312
|
+
* @default -
|
|
313
|
+
* @description 进行前端搜索的字段,支持嵌套的写法如["name","value.a"],不配置的时候默认为对所有 columns 的 dataIndex[]进行前端搜索
|
|
314
|
+
* @group paginationAndFilter
|
|
315
|
+
*/
|
|
316
|
+
accessor frontSearchFilterKeys: string[] | undefined;
|
|
317
|
+
/**
|
|
318
|
+
* @required false
|
|
319
|
+
* @default -
|
|
320
|
+
* @description 页码。后台搜索的时候一般不需要配置,列表接口返回格式通常为{list:[],page:1,pageSize:10,total:20},即默认取自 page;前台搜索的时候,一般配置成 "${query.page=1|number}"
|
|
321
|
+
* @group paginationAndFilter
|
|
322
|
+
*/
|
|
323
|
+
accessor page: number | undefined;
|
|
324
|
+
/**
|
|
325
|
+
* @required false
|
|
326
|
+
* @default -
|
|
327
|
+
* @description 页码条数。后台搜索的时候一般不需要配置,列表接口返回格式通常为{list:[],page:1,pageSize:10,total:20},即默认取自 pageSize/page_size;前台搜索的时候,一般配置成 "${query.pageSize=10|number}"
|
|
328
|
+
* @group paginationAndFilter
|
|
329
|
+
*/
|
|
330
|
+
accessor pageSize: number | undefined;
|
|
331
|
+
/**
|
|
332
|
+
* @kind {
|
|
333
|
+
* x?: string | number | true;
|
|
334
|
+
* y?: number | string;
|
|
335
|
+
* } & {
|
|
336
|
+
* scrollToFirstRowOnChange?: boolean;
|
|
337
|
+
* }
|
|
338
|
+
* @required false
|
|
339
|
+
* @default { x: true }
|
|
340
|
+
* @description 表格是否可滚动,也可以指定滚动区域的宽、高,配置项。详见 [scroll](https://ant.design/components/table-cn/#scroll)
|
|
341
|
+
* @group other
|
|
342
|
+
*/
|
|
343
|
+
accessor scrollConfigs: TableProps<unknown>["scroll"];
|
|
344
|
+
/**
|
|
345
|
+
* @required false
|
|
346
|
+
* @default "q"
|
|
347
|
+
* @description 把过滤条件更新到 url 时的字段名
|
|
348
|
+
* @group paginationAndFilter
|
|
349
|
+
*/
|
|
350
|
+
accessor qField: string;
|
|
351
|
+
/**
|
|
352
|
+
* @required false
|
|
353
|
+
* @default false
|
|
354
|
+
* @description 表格行是否可拖拽,注意,树形数据的表格不支持该功能
|
|
355
|
+
* @group basic
|
|
356
|
+
*/
|
|
357
|
+
accessor tableDraggable: boolean | undefined;
|
|
358
|
+
/**
|
|
359
|
+
* @required false
|
|
360
|
+
* @default false
|
|
361
|
+
* @description 是否展示斑马纹
|
|
362
|
+
* @group ui
|
|
363
|
+
*/
|
|
364
|
+
accessor zebraPattern: boolean | undefined;
|
|
365
|
+
/**
|
|
366
|
+
* @required false
|
|
367
|
+
* @default false
|
|
368
|
+
* @description 翻页时是否记住之前选中的项。注意,选中项的rowKey将保存在url中,如果不设置rowKey,该设置不生效。如果选择太多可能会造成url过长,请谨慎使用
|
|
369
|
+
* @group other
|
|
370
|
+
*/
|
|
371
|
+
accessor storeCheckedByUrl: boolean | undefined;
|
|
372
|
+
/**
|
|
373
|
+
* @required false
|
|
374
|
+
* @default -
|
|
375
|
+
* @description 额外的行,通常为跨页勾选时,不在当前页的行
|
|
376
|
+
* @group other
|
|
377
|
+
*/
|
|
378
|
+
accessor extraRows: Record<string, unknown>[];
|
|
379
|
+
/**
|
|
380
|
+
* @required false
|
|
381
|
+
* @default false
|
|
382
|
+
* @description 当所有子节点选中时,自动选中父节点
|
|
383
|
+
* @group expand
|
|
384
|
+
*/
|
|
385
|
+
accessor autoSelectParentWhenAllChildrenSelected: boolean | undefined;
|
|
386
|
+
/**
|
|
387
|
+
* @required -
|
|
388
|
+
* @default -
|
|
389
|
+
* @description 表格表头是否透明
|
|
390
|
+
* @group ui
|
|
391
|
+
*/
|
|
392
|
+
accessor thTransparent: boolean | undefined;
|
|
393
|
+
/**
|
|
394
|
+
* @required false
|
|
395
|
+
* @default true
|
|
396
|
+
* @description 是否显示表头
|
|
397
|
+
* @group ui
|
|
398
|
+
*/
|
|
399
|
+
accessor showHeader: boolean;
|
|
400
|
+
/**
|
|
401
|
+
* @required false
|
|
402
|
+
* @default -
|
|
403
|
+
* @description 是否显示分页
|
|
404
|
+
* @group paginationAndFilter
|
|
405
|
+
*/
|
|
406
|
+
accessor pagination: false | TablePaginationConfig | undefined;
|
|
407
|
+
/**
|
|
408
|
+
* @required false
|
|
409
|
+
* @default -
|
|
410
|
+
* @description 表格大小(antd原生size)
|
|
411
|
+
* @group ui
|
|
412
|
+
*/
|
|
413
|
+
accessor size: SizeType;
|
|
414
|
+
/**
|
|
415
|
+
* @required false
|
|
416
|
+
* @default -
|
|
417
|
+
* @description 选框类型(单选/多选)
|
|
418
|
+
* @group rowSelection
|
|
419
|
+
*/
|
|
420
|
+
accessor type: RowSelectionType | undefined;
|
|
421
|
+
/**
|
|
422
|
+
* @required false
|
|
423
|
+
* @default true
|
|
424
|
+
* @description 是否更新 url 参数。设置为否之后,如果是后台进行分页/排序等功能,则需要结合事件进行编排。如果是前台进行分页/排序,则不需要。
|
|
425
|
+
* @group other
|
|
426
|
+
*/
|
|
427
|
+
accessor shouldUpdateUrlParams: boolean;
|
|
428
|
+
/**
|
|
429
|
+
* @required false
|
|
430
|
+
* @default true
|
|
431
|
+
* @description 更新 url 参数时是否触发页面重新渲染。仅在`shouldUpdateUrlParams`为true时有效。
|
|
432
|
+
* @group other
|
|
433
|
+
*/
|
|
434
|
+
accessor shouldRenderWhenUrlParamsUpdate: boolean;
|
|
435
|
+
get processedDataSource(): Record<string, any>[];
|
|
436
|
+
get processConfigProps(): any;
|
|
437
|
+
get processedColumns(): CustomColumn[];
|
|
438
|
+
private _originalDataSource;
|
|
439
|
+
private _dataSource;
|
|
440
|
+
private _pureSource;
|
|
441
|
+
private _columns;
|
|
442
|
+
private _finalConfigProps;
|
|
443
|
+
private _error;
|
|
444
|
+
private _selectUpdateEventName;
|
|
445
|
+
private _selectUpdateEventDetailKeys;
|
|
446
|
+
private _selectUpdateEventDetailField;
|
|
447
|
+
private _selectUpdateEventDetailExtra;
|
|
448
|
+
private _fields;
|
|
449
|
+
/**
|
|
450
|
+
* @default []
|
|
451
|
+
* @required false
|
|
452
|
+
* @description 指定选中项的 key 数组
|
|
453
|
+
* @group rowSelection
|
|
454
|
+
*/
|
|
455
|
+
accessor selectedRowKeys: React.Key[];
|
|
456
|
+
private _selected;
|
|
457
|
+
private _selectedRow;
|
|
458
|
+
private _selectedRows;
|
|
459
|
+
private _allChildren;
|
|
460
|
+
private _isInSelect;
|
|
461
|
+
/**
|
|
462
|
+
* @description 搜索过滤
|
|
463
|
+
*/
|
|
464
|
+
filterSourceData(event: CustomEvent): void;
|
|
465
|
+
handleFrontendDataChange(data?: Record<string, any>[], columns?: CustomColumn[]): Record<string, any>[];
|
|
466
|
+
handleFrontendFilterSource(data: Record<string, any>[], q: string, columns: CustomColumn[], filterKeys?: DataIndex[]): Record<string, any>[];
|
|
467
|
+
private _getRowKey;
|
|
468
|
+
private _findParentByChildKeyValue;
|
|
469
|
+
private _handleRowSelectChange;
|
|
470
|
+
private _getSelectedRowsWithChildren;
|
|
471
|
+
private _handleOnSelect;
|
|
472
|
+
private _handleSelectAll;
|
|
473
|
+
private _getCheckedFromUrl;
|
|
474
|
+
private _updateUrlChecked;
|
|
475
|
+
private _handleOnChange;
|
|
476
|
+
private renderSelectInfo;
|
|
477
|
+
private handleFrontendSorter;
|
|
478
|
+
private handleFrontendFilters;
|
|
479
|
+
private frontendSearch;
|
|
480
|
+
private _handleOnExpand;
|
|
481
|
+
private _handleOnExpandedRowsChange;
|
|
482
|
+
private _handleOnDrag;
|
|
483
|
+
/**
|
|
484
|
+
* @description 展开所有行
|
|
485
|
+
*/
|
|
486
|
+
expandAll(): void;
|
|
487
|
+
getModifyColumns(): CustomColumn[];
|
|
488
|
+
render(): JSX.Element;
|
|
489
|
+
private _getAllRows;
|
|
490
|
+
private _handleDefaultSelectAll;
|
|
491
|
+
private _initConfigProps;
|
|
492
|
+
_test_only_getOriginalDataSource(): Record<string, any>[];
|
|
493
|
+
updateData(event: CustomEvent): void;
|
|
494
|
+
updateError(event: CustomEvent): void;
|
|
495
|
+
set selectUpdateEventName(value: string);
|
|
496
|
+
set selectUpdateEventDetailKeys(value: string[]);
|
|
497
|
+
set selectUpdateEventDetailField(value: string);
|
|
498
|
+
set selectUpdateEventDetailExtra(value: any);
|
|
499
|
+
}
|
|
500
|
+
export { TableComponent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.jsx";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type CellStatusProps } from "./index.js";
|
|
2
|
+
export declare const compareFunMap: Record<string, any>;
|
|
3
|
+
export declare function getCellStyle(cellStatus: CellStatusProps, item: Record<string, any>, value?: any): Record<string, string>;
|
|
4
|
+
export declare const getKeysOfData: (data: Record<string, any>[], rowKey: string, childrenColumnName: string, keys: string[]) => void;
|
|
5
|
+
export declare const getRowsOfData: (data: Record<string, any>[], childrenColumnName: string, rows: Record<string, any>[]) => void;
|
|
6
|
+
export declare function stripEmptyExpandableChildrenByName(name: string, data?: Record<string, any>[]): Record<string, any>[];
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@next-bricks/advanced",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"homepage": "https://github.com/easyops-cn/next-core/tree/master/bricks/basic",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git@github.com:easyops-cn/next-core.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "GPL-3.0",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"sideEffects": true,
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"dist-types"
|
|
15
|
+
],
|
|
16
|
+
"nx": {
|
|
17
|
+
"targets": {
|
|
18
|
+
"build": {
|
|
19
|
+
"outputs": [
|
|
20
|
+
"{projectRoot}/dist",
|
|
21
|
+
"{projectRoot}/dist-types"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"exports": {
|
|
27
|
+
"./package.json": "./package.json",
|
|
28
|
+
"./*": {
|
|
29
|
+
"types": "./dist-types/*/index.d.ts"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"start": "cross-env NODE_ENV=development build-next-bricks --watch",
|
|
34
|
+
"build": "npm run build:main && npm run build:types",
|
|
35
|
+
"build:main": "cross-env NODE_ENV=production build-next-bricks",
|
|
36
|
+
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist-types --project tsconfig.json",
|
|
37
|
+
"test": "cross-env NODE_ENV='test' test-next",
|
|
38
|
+
"test:ci": "cross-env NODE_ENV='test' CI=true test-next"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@next-bricks/icons": "^0.0.3",
|
|
42
|
+
"@next-core/element": "^1.0.2",
|
|
43
|
+
"@next-core/http": "^1.0.2",
|
|
44
|
+
"@next-core/react-element": "^1.0.2",
|
|
45
|
+
"@next-core/react-runtime": "^1.0.5",
|
|
46
|
+
"@next-core/runtime": "^1.0.5",
|
|
47
|
+
"@next-core/theme": "^1.0.2",
|
|
48
|
+
"@next-core/types": "^1.0.3",
|
|
49
|
+
"antd": "^5.2.3",
|
|
50
|
+
"classnames": "^2.3.2",
|
|
51
|
+
"immutability-helper": "^3.1.1",
|
|
52
|
+
"lodash": "^4.17.21",
|
|
53
|
+
"react": "0.0.0-experimental-ee8509801-20230117",
|
|
54
|
+
"react-dnd": "^16.0.1",
|
|
55
|
+
"react-dnd-html5-backend": "^16.0.1"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@next-core/build-next-bricks": "^1.1.0",
|
|
59
|
+
"@next-core/test-next": "^1.0.2"
|
|
60
|
+
},
|
|
61
|
+
"gitHead": "2234d08a3409a41b7cacea7b4dedbee308c26997"
|
|
62
|
+
}
|