@next-bricks/advanced 0.6.1 → 0.7.0

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 (43) hide show
  1. package/dist/bricks.json +1 -1
  2. package/dist/chunks/2553.5cdf2c85.js +2 -0
  3. package/dist/chunks/2553.5cdf2c85.js.map +1 -0
  4. package/dist/chunks/4158.30eff24a.js +3 -0
  5. package/dist/chunks/4158.30eff24a.js.map +1 -0
  6. package/dist/chunks/4643.e9c1fa0c.js +2 -0
  7. package/dist/chunks/4643.e9c1fa0c.js.map +1 -0
  8. package/dist/chunks/7882.7705394d.js +2 -0
  9. package/dist/chunks/7882.7705394d.js.map +1 -0
  10. package/dist/chunks/9703.27cd3d59.js +2 -0
  11. package/dist/chunks/9703.27cd3d59.js.map +1 -0
  12. package/dist/chunks/{eo-cascader.3aecea58.js → eo-cascader.be17bc29.js} +2 -2
  13. package/dist/chunks/{eo-cascader.3aecea58.js.map → eo-cascader.be17bc29.js.map} +1 -1
  14. package/dist/chunks/eo-next-table.2c09f81e.js +2 -0
  15. package/dist/chunks/eo-next-table.2c09f81e.js.map +1 -0
  16. package/dist/chunks/{eo-table.a22495c0.js → eo-table.8d1c324b.js} +2 -2
  17. package/dist/chunks/{eo-table.a22495c0.js.map → eo-table.8d1c324b.js.map} +1 -1
  18. package/dist/chunks/{main.e794c7be.js → main.331abc39.js} +2 -2
  19. package/dist/chunks/main.331abc39.js.map +1 -0
  20. package/dist/examples.json +1 -1
  21. package/dist/index.6fcbf59c.js +2 -0
  22. package/dist/index.6fcbf59c.js.map +1 -0
  23. package/dist/manifest.json +28 -0
  24. package/dist/types.json +261 -0
  25. package/dist-types/next-table/Table.d.ts +8 -1
  26. package/dist-types/next-table/index.d.ts +9 -1
  27. package/dist-types/next-table/interface.d.ts +11 -1
  28. package/docs/eo-next-table.md +89 -0
  29. package/package.json +2 -2
  30. package/dist/chunks/2001.22032139.js +0 -2
  31. package/dist/chunks/2001.22032139.js.map +0 -1
  32. package/dist/chunks/4553.ebc88a76.js +0 -2
  33. package/dist/chunks/4553.ebc88a76.js.map +0 -1
  34. package/dist/chunks/5077.e0967b68.js +0 -3
  35. package/dist/chunks/5077.e0967b68.js.map +0 -1
  36. package/dist/chunks/8682.fa753f30.js +0 -2
  37. package/dist/chunks/8682.fa753f30.js.map +0 -1
  38. package/dist/chunks/eo-next-table.099c1f2f.js +0 -2
  39. package/dist/chunks/eo-next-table.099c1f2f.js.map +0 -1
  40. package/dist/chunks/main.e794c7be.js.map +0 -1
  41. package/dist/index.ab954402.js +0 -2
  42. package/dist/index.ab954402.js.map +0 -1
  43. /package/dist/chunks/{5077.e0967b68.js.LICENSE.txt → 4158.30eff24a.js.LICENSE.txt} +0 -0
package/dist/types.json CHANGED
@@ -1292,6 +1292,38 @@
1292
1292
  }
1293
1293
  }
1294
1294
  },
1295
+ {
1296
+ "name": "expandable",
1297
+ "annotation": {
1298
+ "type": "reference",
1299
+ "typeName": {
1300
+ "type": "identifier",
1301
+ "name": "ExpandableType"
1302
+ }
1303
+ }
1304
+ },
1305
+ {
1306
+ "name": "expandedRowKeys",
1307
+ "annotation": {
1308
+ "type": "array",
1309
+ "elementType": {
1310
+ "type": "parenthesizedType",
1311
+ "annotation": {
1312
+ "type": "union",
1313
+ "types": [
1314
+ {
1315
+ "type": "keyword",
1316
+ "value": "string"
1317
+ },
1318
+ {
1319
+ "type": "keyword",
1320
+ "value": "number"
1321
+ }
1322
+ ]
1323
+ }
1324
+ }
1325
+ }
1326
+ },
1295
1327
  {
1296
1328
  "name": "searchFields",
1297
1329
  "annotation": {
@@ -1469,6 +1501,67 @@
1469
1501
  ]
1470
1502
  }
1471
1503
  }
1504
+ },
1505
+ {
1506
+ "name": "row.expand",
1507
+ "detail": {
1508
+ "annotation": {
1509
+ "type": "typeLiteral",
1510
+ "members": [
1511
+ {
1512
+ "type": "propertySignature",
1513
+ "key": {
1514
+ "type": "identifier",
1515
+ "name": "expanded"
1516
+ },
1517
+ "annotation": {
1518
+ "type": "keyword",
1519
+ "value": "boolean"
1520
+ },
1521
+ "computed": false
1522
+ },
1523
+ {
1524
+ "type": "propertySignature",
1525
+ "key": {
1526
+ "type": "identifier",
1527
+ "name": "record"
1528
+ },
1529
+ "annotation": {
1530
+ "type": "reference",
1531
+ "typeName": {
1532
+ "type": "identifier",
1533
+ "name": "RecordType"
1534
+ }
1535
+ },
1536
+ "computed": false
1537
+ }
1538
+ ]
1539
+ }
1540
+ }
1541
+ },
1542
+ {
1543
+ "name": "expanded.rows.change",
1544
+ "detail": {
1545
+ "annotation": {
1546
+ "type": "array",
1547
+ "elementType": {
1548
+ "type": "parenthesizedType",
1549
+ "annotation": {
1550
+ "type": "union",
1551
+ "types": [
1552
+ {
1553
+ "type": "keyword",
1554
+ "value": "string"
1555
+ },
1556
+ {
1557
+ "type": "keyword",
1558
+ "value": "number"
1559
+ }
1560
+ ]
1561
+ }
1562
+ }
1563
+ }
1564
+ }
1472
1565
  }
1473
1566
  ],
1474
1567
  "methods": [
@@ -1871,6 +1964,174 @@
1871
1964
  }
1872
1965
  }
1873
1966
  ]
1967
+ },
1968
+ {
1969
+ "type": "typeAlias",
1970
+ "name": "ExpandableType",
1971
+ "annotation": {
1972
+ "type": "union",
1973
+ "types": [
1974
+ {
1975
+ "type": "keyword",
1976
+ "value": "boolean"
1977
+ },
1978
+ {
1979
+ "type": "reference",
1980
+ "typeName": {
1981
+ "type": "identifier",
1982
+ "name": "ExpandableConfig"
1983
+ }
1984
+ },
1985
+ {
1986
+ "type": "keyword",
1987
+ "value": "undefined"
1988
+ }
1989
+ ]
1990
+ }
1991
+ },
1992
+ {
1993
+ "type": "interface",
1994
+ "name": "ExpandableConfig",
1995
+ "body": [
1996
+ {
1997
+ "type": "propertySignature",
1998
+ "key": {
1999
+ "type": "identifier",
2000
+ "name": "expandIconBrick"
2001
+ },
2002
+ "annotation": {
2003
+ "type": "typeLiteral",
2004
+ "members": [
2005
+ {
2006
+ "type": "propertySignature",
2007
+ "key": {
2008
+ "type": "identifier",
2009
+ "name": "useBrick"
2010
+ },
2011
+ "annotation": {
2012
+ "type": "reference",
2013
+ "typeName": {
2014
+ "type": "identifier",
2015
+ "name": "UseBrickConf"
2016
+ }
2017
+ },
2018
+ "computed": false
2019
+ }
2020
+ ]
2021
+ },
2022
+ "optional": true,
2023
+ "computed": false
2024
+ },
2025
+ {
2026
+ "type": "propertySignature",
2027
+ "key": {
2028
+ "type": "identifier",
2029
+ "name": "expandedRowBrick"
2030
+ },
2031
+ "annotation": {
2032
+ "type": "typeLiteral",
2033
+ "members": [
2034
+ {
2035
+ "type": "propertySignature",
2036
+ "key": {
2037
+ "type": "identifier",
2038
+ "name": "useBrick"
2039
+ },
2040
+ "annotation": {
2041
+ "type": "reference",
2042
+ "typeName": {
2043
+ "type": "identifier",
2044
+ "name": "UseBrickConf"
2045
+ }
2046
+ },
2047
+ "computed": false
2048
+ }
2049
+ ]
2050
+ },
2051
+ "optional": true,
2052
+ "computed": false
2053
+ },
2054
+ {
2055
+ "type": "propertySignature",
2056
+ "key": {
2057
+ "type": "identifier",
2058
+ "name": "rowExpandable"
2059
+ },
2060
+ "annotation": {
2061
+ "type": "union",
2062
+ "types": [
2063
+ {
2064
+ "type": "keyword",
2065
+ "value": "string"
2066
+ },
2067
+ {
2068
+ "type": "keyword",
2069
+ "value": "boolean"
2070
+ }
2071
+ ]
2072
+ },
2073
+ "optional": true,
2074
+ "computed": false
2075
+ }
2076
+ ],
2077
+ "extends": [
2078
+ {
2079
+ "type": "expressionWithTypeArguments",
2080
+ "expression": {
2081
+ "type": "identifier",
2082
+ "name": "Pick"
2083
+ },
2084
+ "typeParameters": {
2085
+ "type": "typeParameterInstantiation",
2086
+ "params": [
2087
+ {
2088
+ "type": "reference",
2089
+ "typeName": {
2090
+ "type": "identifier",
2091
+ "name": "TableExpandableConfig"
2092
+ },
2093
+ "typeParameters": {
2094
+ "type": "typeParameterInstantiation",
2095
+ "params": [
2096
+ {
2097
+ "type": "reference",
2098
+ "typeName": {
2099
+ "type": "identifier",
2100
+ "name": "RecordType"
2101
+ }
2102
+ }
2103
+ ]
2104
+ }
2105
+ },
2106
+ {
2107
+ "type": "union",
2108
+ "types": [
2109
+ {
2110
+ "type": "jsLiteral",
2111
+ "value": "columnWidth"
2112
+ },
2113
+ {
2114
+ "type": "jsLiteral",
2115
+ "value": "expandRowByClick"
2116
+ },
2117
+ {
2118
+ "type": "jsLiteral",
2119
+ "value": "defaultExpandAllRows"
2120
+ },
2121
+ {
2122
+ "type": "jsLiteral",
2123
+ "value": "fixed"
2124
+ },
2125
+ {
2126
+ "type": "jsLiteral",
2127
+ "value": "showExpandColumn"
2128
+ }
2129
+ ]
2130
+ }
2131
+ ]
2132
+ }
2133
+ }
2134
+ ]
1874
2135
  }
1875
2136
  ]
1876
2137
  }
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { Column, RecordType, DataSource, PaginationType, RowSelectionType } from "./interface.js";
2
+ import { Column, RecordType, DataSource, PaginationType, RowSelectionType, ExpandableType } from "./interface.js";
3
3
  import { RowSelectMethod } from "antd/es/table/interface.js";
4
4
  interface NextTableComponentProps {
5
5
  shadowRoot: ShadowRoot | null;
@@ -10,6 +10,8 @@ interface NextTableComponentProps {
10
10
  rowSelection?: RowSelectionType;
11
11
  selectedRowKeys?: (string | number)[];
12
12
  hiddenColumns?: (string | number)[];
13
+ expandable?: ExpandableType;
14
+ expandedRowKeys?: (string | number)[];
13
15
  searchFields?: (string | string[])[];
14
16
  onPageChange?: (detail: {
15
17
  page: number;
@@ -26,6 +28,11 @@ interface NextTableComponentProps {
26
28
  type: RowSelectMethod;
27
29
  };
28
30
  }) => void;
31
+ onRowExpand?: (detail: {
32
+ expanded: boolean;
33
+ record: RecordType;
34
+ }) => void;
35
+ onExpandedRowsChange?: (detail: (string | number)[]) => void;
29
36
  }
30
37
  export interface NextTableComponentRef {
31
38
  search: (params: {
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" resolution-mode="require"/>
2
2
  import { ReactNextElement } from "@next-core/react-element";
3
3
  import "@next-core/theme";
4
- import { Column, DataSource, PaginationType, RowSelectionType } from "./interface.js";
4
+ import { Column, DataSource, ExpandableType, PaginationType, RowSelectionType } from "./interface.js";
5
5
  /**
6
6
  * 大型表格
7
7
  */
@@ -35,6 +35,14 @@ export declare class EoNextTable extends ReactNextElement {
35
35
  * 隐藏的列(输入对应的 column.key)
36
36
  */
37
37
  accessor hiddenColumns: (string | number)[] | undefined;
38
+ /**
39
+ * 表格行展开配置
40
+ */
41
+ accessor expandable: ExpandableType;
42
+ /**
43
+ * 展开项的 key
44
+ */
45
+ accessor expandedRowKeys: (string | number)[] | undefined;
38
46
  /**
39
47
  * 进行前端搜索的字段,支持嵌套的写法。不配置的时候默认为对所有 column.dataIndex 进行前端搜索
40
48
  */
@@ -1,5 +1,5 @@
1
1
  import type { ColumnType, TablePaginationConfig } from "antd/es/table";
2
- import type { TableRowSelection } from "antd/es/table/interface.js";
2
+ import type { ExpandableConfig as TableExpandableConfig, TableRowSelection } from "antd/es/table/interface.js";
3
3
  import type { UseBrickConf } from "@next-core/types";
4
4
  export type RecordType = Record<string, any>;
5
5
  export interface Column extends ColumnType<RecordType> {
@@ -24,4 +24,14 @@ interface RowSelectionConfig extends Pick<TableRowSelection<RecordType>, "column
24
24
  showSelectInfo?: boolean;
25
25
  }
26
26
  export type RowSelectionType = boolean | RowSelectionConfig | undefined;
27
+ interface ExpandableConfig extends Pick<TableExpandableConfig<RecordType>, "columnWidth" | "expandRowByClick" | "defaultExpandAllRows" | "fixed" | "showExpandColumn"> {
28
+ expandIconBrick?: {
29
+ useBrick: UseBrickConf;
30
+ };
31
+ expandedRowBrick?: {
32
+ useBrick: UseBrickConf;
33
+ };
34
+ rowExpandable?: string | boolean;
35
+ }
36
+ export type ExpandableType = boolean | ExpandableConfig | undefined;
27
37
  export {};
@@ -253,3 +253,92 @@
253
253
  age: 16
254
254
  address: Taiwan
255
255
  ```
256
+
257
+ ### Expandable
258
+
259
+ ```yaml preview
260
+ - brick: eo-next-table
261
+ events:
262
+ row.expand:
263
+ - action: console.log
264
+ expanded.rows.change:
265
+ - action: console.log
266
+ properties:
267
+ expandable:
268
+ columnWidth: 100px
269
+ rowExpandable: <% DATA.rowData.key % 2 === 0 %>
270
+ expandIconBrick:
271
+ useBrick:
272
+ brick: eo-link
273
+ properties:
274
+ disabled: "<% !DATA.expandable %>"
275
+ textContent: "<% DATA.expanded ? '点击收起' : '点击展开' %>"
276
+ expandedRowBrick:
277
+ useBrick:
278
+ brick: div
279
+ properties:
280
+ textContent: <% DATA.rowData.name %>
281
+ pagination:
282
+ pageSizeOptions:
283
+ - 5
284
+ - 10
285
+ - 20
286
+ columns:
287
+ - dataIndex: name
288
+ key: name
289
+ title: Name
290
+ - dataIndex: age
291
+ key: age
292
+ title: Age
293
+ - dataIndex: address
294
+ key: address
295
+ title: Address
296
+ dataSource:
297
+ pageSize: 5
298
+ page: 1
299
+ list:
300
+ - key: 0
301
+ name: Jack
302
+ age: 18
303
+ address: Guangzhou
304
+ - key: 1
305
+ name: Alex
306
+ age: 20
307
+ address: Shanghai
308
+ - key: 2
309
+ name: Lucy
310
+ age: 16
311
+ address: Yunnan
312
+ - key: 3
313
+ name: Sam
314
+ age: 28
315
+ address: Guangzhou
316
+ - key: 4
317
+ name: Bob
318
+ age: 35
319
+ address: Hainan
320
+ - key: 5
321
+ name: Ava
322
+ age: 23
323
+ address: Beijing
324
+ - key: 6
325
+ name: Sophia
326
+ age: 20
327
+ address: Shanghai
328
+ - key: 7
329
+ name: Charlotte
330
+ age: 33
331
+ address: Chongqing
332
+ - key: 8
333
+ name: Mia
334
+ age: 18
335
+ address: Chengdu
336
+ - key: 9
337
+ name: Noah
338
+ age: 38
339
+ address: Hainan
340
+ - key: 10
341
+ name: William
342
+ age: 16
343
+ address: Taiwan
344
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/advanced",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "homepage": "https://github.com/easyops-cn/next-bricks/tree/master/bricks/basic",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,5 +37,5 @@
37
37
  "@next-core/build-next-bricks": "^1.14.2",
38
38
  "@next-core/test-next": "^1.0.10"
39
39
  },
40
- "gitHead": "2a18694d5ca14e9edd1c9a41522b1098b7729783"
40
+ "gitHead": "f37227b7c2e7fb8478d479ed94cb8ec4a741cf4e"
41
41
  }