@next-bricks/advanced 0.7.1 → 0.9.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 (70) hide show
  1. package/dist/bricks.json +1 -1
  2. package/dist/chunks/1303.f9a141a9.js +2 -0
  3. package/dist/chunks/1303.f9a141a9.js.map +1 -0
  4. package/dist/chunks/{2108.68af1eee.js → 2108.0d33f648.js} +2 -2
  5. package/dist/chunks/{2108.68af1eee.js.map → 2108.0d33f648.js.map} +1 -1
  6. package/dist/chunks/5163.cbfe1feb.js +2 -0
  7. package/dist/chunks/5163.cbfe1feb.js.map +1 -0
  8. package/dist/chunks/5381.7f5fc929.js +2 -0
  9. package/dist/chunks/5381.7f5fc929.js.map +1 -0
  10. package/dist/chunks/5491.da516674.js +2 -0
  11. package/dist/chunks/5491.da516674.js.map +1 -0
  12. package/dist/chunks/5636.90726873.js +2 -0
  13. package/dist/chunks/{5636.12dd2cb9.js.map → 5636.90726873.js.map} +1 -1
  14. package/dist/chunks/6653.215bb757.js +2 -0
  15. package/dist/chunks/6653.215bb757.js.map +1 -0
  16. package/dist/chunks/6660.af1b959a.js +2 -0
  17. package/dist/chunks/6660.af1b959a.js.map +1 -0
  18. package/dist/chunks/6805.82916868.js +2 -0
  19. package/dist/chunks/6805.82916868.js.map +1 -0
  20. package/dist/chunks/7067.9d9578ca.js +2 -0
  21. package/dist/chunks/7067.9d9578ca.js.map +1 -0
  22. package/dist/chunks/7089.b4f733fa.js +2 -0
  23. package/dist/chunks/7089.b4f733fa.js.map +1 -0
  24. package/dist/chunks/{8498.c282e08e.js → 8498.000d98f7.js} +2 -2
  25. package/dist/chunks/8498.000d98f7.js.map +1 -0
  26. package/dist/chunks/9703.b224693b.js +2 -0
  27. package/dist/chunks/9703.b224693b.js.map +1 -0
  28. package/dist/chunks/eo-next-table.cbb9ed2e.js +2 -0
  29. package/dist/chunks/eo-next-table.cbb9ed2e.js.map +1 -0
  30. package/dist/chunks/eo-table.ad5ebc15.js +2 -0
  31. package/dist/chunks/{eo-table.8d1c324b.js.map → eo-table.ad5ebc15.js.map} +1 -1
  32. package/dist/chunks/main.64df5122.js +2 -0
  33. package/dist/chunks/main.64df5122.js.map +1 -0
  34. package/dist/examples.json +1 -1
  35. package/dist/index.9e96a07d.js +2 -0
  36. package/dist/index.9e96a07d.js.map +1 -0
  37. package/dist/manifest.json +68 -0
  38. package/dist/types.json +476 -2
  39. package/dist-types/next-table/Row.d.ts +9 -0
  40. package/dist-types/next-table/Table.d.ts +18 -2
  41. package/dist-types/next-table/index.d.ts +38 -1
  42. package/dist-types/next-table/interface.d.ts +23 -3
  43. package/dist-types/next-table/utils.d.ts +16 -0
  44. package/docs/eo-next-table.md +516 -0
  45. package/package.json +2 -2
  46. package/dist/chunks/3914.d7f14c10.js +0 -2
  47. package/dist/chunks/3914.d7f14c10.js.map +0 -1
  48. package/dist/chunks/5202.31f6c01a.js +0 -2
  49. package/dist/chunks/5202.31f6c01a.js.map +0 -1
  50. package/dist/chunks/5381.3beebdb0.js +0 -2
  51. package/dist/chunks/5381.3beebdb0.js.map +0 -1
  52. package/dist/chunks/5636.12dd2cb9.js +0 -2
  53. package/dist/chunks/6653.20094386.js +0 -2
  54. package/dist/chunks/6653.20094386.js.map +0 -1
  55. package/dist/chunks/6660.84288c37.js +0 -2
  56. package/dist/chunks/6660.84288c37.js.map +0 -1
  57. package/dist/chunks/7782.8fe619f8.js +0 -2
  58. package/dist/chunks/7782.8fe619f8.js.map +0 -1
  59. package/dist/chunks/7882.7705394d.js +0 -2
  60. package/dist/chunks/7882.7705394d.js.map +0 -1
  61. package/dist/chunks/8498.c282e08e.js.map +0 -1
  62. package/dist/chunks/9703.27cd3d59.js +0 -2
  63. package/dist/chunks/9703.27cd3d59.js.map +0 -1
  64. package/dist/chunks/eo-next-table.2c09f81e.js +0 -2
  65. package/dist/chunks/eo-next-table.2c09f81e.js.map +0 -1
  66. package/dist/chunks/eo-table.8d1c324b.js +0 -2
  67. package/dist/chunks/main.331abc39.js +0 -2
  68. package/dist/chunks/main.331abc39.js.map +0 -1
  69. package/dist/index.6fcbf59c.js +0 -2
  70. package/dist/index.6fcbf59c.js.map +0 -1
@@ -1,18 +1,28 @@
1
1
  import React from "react";
2
- import { Column, RecordType, DataSource, PaginationType, RowSelectionType, ExpandableType } from "./interface.js";
2
+ import { Column, RecordType, DataSource, PaginationType, RowSelectionType, ExpandableType, Sort } from "./interface.js";
3
3
  import { RowSelectMethod } from "antd/es/table/interface.js";
4
+ import type { TableProps } from "antd/es/table";
4
5
  interface NextTableComponentProps {
5
6
  shadowRoot: ShadowRoot | null;
6
- rowKey?: string;
7
+ rowKey: string;
7
8
  columns?: Column[];
8
9
  dataSource?: DataSource;
10
+ frontSearch?: boolean;
9
11
  pagination?: PaginationType;
12
+ multiSort?: boolean;
13
+ sort?: Sort | Sort[];
10
14
  rowSelection?: RowSelectionType;
11
15
  selectedRowKeys?: (string | number)[];
12
16
  hiddenColumns?: (string | number)[];
13
17
  expandable?: ExpandableType;
14
18
  expandedRowKeys?: (string | number)[];
19
+ childrenColumnName: string;
20
+ rowDraggable?: boolean;
15
21
  searchFields?: (string | string[])[];
22
+ size?: TableProps<RecordType>["size"];
23
+ showHeader?: boolean;
24
+ scrollConfig?: TableProps<RecordType>["scroll"];
25
+ optimizedColumns?: (string | number)[];
16
26
  onPageChange?: (detail: {
17
27
  page: number;
18
28
  pageSize: number;
@@ -21,6 +31,7 @@ interface NextTableComponentProps {
21
31
  page: number;
22
32
  pageSize: number;
23
33
  }) => void;
34
+ onSort?: (detail?: Sort | Sort[]) => void;
24
35
  onRowSelect?: (detail: {
25
36
  keys: (string | number)[];
26
37
  rows: RecordType[];
@@ -33,6 +44,11 @@ interface NextTableComponentProps {
33
44
  record: RecordType;
34
45
  }) => void;
35
46
  onExpandedRowsChange?: (detail: (string | number)[]) => void;
47
+ onRowDrag?: (detail: {
48
+ list: RecordType[];
49
+ active: RecordType;
50
+ over: RecordType;
51
+ }) => void;
36
52
  }
37
53
  export interface NextTableComponentRef {
38
54
  search: (params: {
@@ -1,7 +1,8 @@
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, ExpandableType, PaginationType, RowSelectionType } from "./interface.js";
4
+ import { Column, DataSource, ExpandableType, PaginationType, RecordType, RowSelectionType, Sort } from "./interface.js";
5
+ import type { TableProps } from "antd/es/table";
5
6
  /**
6
7
  * 大型表格
7
8
  */
@@ -19,10 +20,22 @@ export declare class EoNextTable extends ReactNextElement {
19
20
  * 数据源
20
21
  */
21
22
  accessor dataSource: DataSource | undefined;
23
+ /**
24
+ * 是否前端搜索
25
+ */
26
+ accessor frontSearch: boolean | undefined;
22
27
  /**
23
28
  * 分页配置
24
29
  */
25
30
  accessor pagination: PaginationType;
31
+ /**
32
+ * 是否支持多列排序,前端搜索时需设置 column.sortPriority 优先级
33
+ */
34
+ accessor multiSort: boolean | undefined;
35
+ /**
36
+ * 排序信息
37
+ */
38
+ accessor sort: Sort | Sort[] | undefined;
26
39
  /**
27
40
  * 表格行可选择配置
28
41
  */
@@ -43,10 +56,34 @@ export declare class EoNextTable extends ReactNextElement {
43
56
  * 展开项的 key
44
57
  */
45
58
  accessor expandedRowKeys: (string | number)[] | undefined;
59
+ /**
60
+ * 树形结构的列名
61
+ */
62
+ accessor childrenColumnName: string;
63
+ /**
64
+ * 表格行拖拽配置
65
+ */
66
+ accessor rowDraggable: boolean | undefined;
46
67
  /**
47
68
  * 进行前端搜索的字段,支持嵌套的写法。不配置的时候默认为对所有 column.dataIndex 进行前端搜索
48
69
  */
49
70
  accessor searchFields: (string | string[])[] | undefined;
71
+ /**
72
+ * 表格大小
73
+ */
74
+ accessor size: TableProps<RecordType>["size"];
75
+ /**
76
+ * 是否显示表头
77
+ */
78
+ accessor showHeader: boolean;
79
+ /**
80
+ * 滚动配置
81
+ */
82
+ accessor scrollConfig: TableProps<RecordType>["scroll"];
83
+ /**
84
+ * 优化渲染的列(输入对应的 column.key)
85
+ */
86
+ accessor optimizedColumns: (string | number)[] | undefined;
50
87
  /**
51
88
  * 前端搜索
52
89
  */
@@ -1,14 +1,29 @@
1
1
  import type { ColumnType, TablePaginationConfig } from "antd/es/table";
2
- import type { ExpandableConfig as TableExpandableConfig, TableRowSelection } from "antd/es/table/interface.js";
2
+ import type { SortOrder, ExpandableConfig as TableExpandableConfig, TableRowSelection } from "antd/es/table/interface.js";
3
3
  import type { UseBrickConf } from "@next-core/types";
4
+ import { CSSProperties } from "react";
4
5
  export type RecordType = Record<string, any>;
5
- export interface Column extends ColumnType<RecordType> {
6
+ export interface Column extends Pick<ColumnType<RecordType>, "align" | "colSpan" | "dataIndex" | "ellipsis" | "fixed" | "key" | "rowScope" | "showSorterTooltip" | "sortDirections" | "title" | "width"> {
6
7
  /** 表头自定义展示构件 */
7
8
  headerBrick?: {
8
9
  useBrick: UseBrickConf;
9
10
  };
10
11
  /** 内容自定义展示构件 */
11
12
  useBrick?: UseBrickConf;
13
+ /** 记录表格列合并的值的 key */
14
+ cellColSpanKey?: string;
15
+ /** 记录表格行合并的值的 key */
16
+ cellRowSpanKey?: string;
17
+ /** 是否可排序 */
18
+ sortable?: boolean;
19
+ /** 前端搜索时,多列排序优先级,数字越大优先级越高 */
20
+ sortPriority?: number;
21
+ /** 垂直对齐方式 */
22
+ verticalAlign?: CSSProperties["verticalAlign"];
23
+ /** 单元格样式 */
24
+ cellStyle?: CSSProperties;
25
+ /** 头部单元格样式 */
26
+ headerStyle?: CSSProperties;
12
27
  }
13
28
  export interface DataSource {
14
29
  list?: RecordType[];
@@ -20,8 +35,9 @@ interface PaginationConfig extends Pick<TablePaginationConfig, "disabled" | "hid
20
35
  showTotal?: boolean;
21
36
  }
22
37
  export type PaginationType = false | PaginationConfig | undefined;
23
- interface RowSelectionConfig extends Pick<TableRowSelection<RecordType>, "columnWidth" | "fixed" | "hideSelectAll" | "preserveSelectedRowKeys" | "type"> {
38
+ interface RowSelectionConfig extends Pick<TableRowSelection<RecordType>, "columnWidth" | "fixed" | "hideSelectAll" | "preserveSelectedRowKeys" | "type" | "checkStrictly"> {
24
39
  showSelectInfo?: boolean;
40
+ rowDisabled?: string | boolean;
25
41
  }
26
42
  export type RowSelectionType = boolean | RowSelectionConfig | undefined;
27
43
  interface ExpandableConfig extends Pick<TableExpandableConfig<RecordType>, "columnWidth" | "expandRowByClick" | "defaultExpandAllRows" | "fixed" | "showExpandColumn"> {
@@ -34,4 +50,8 @@ interface ExpandableConfig extends Pick<TableExpandableConfig<RecordType>, "colu
34
50
  rowExpandable?: string | boolean;
35
51
  }
36
52
  export type ExpandableType = boolean | ExpandableConfig | undefined;
53
+ export interface Sort {
54
+ columnKey?: string | number;
55
+ order?: SortOrder;
56
+ }
37
57
  export {};
@@ -1,3 +1,4 @@
1
+ import { Column, RecordType } from "./interface.js";
1
2
  export declare const DEFAULT_PAGE_SIZE = 20;
2
3
  export declare const DEFAULT_PAGE = 1;
3
4
  export declare const defaultPaginationConfig: {
@@ -9,3 +10,18 @@ export declare const defaultRowSelectionConfig: {
9
10
  showSelectInfo: boolean;
10
11
  };
11
12
  export declare function getSearchKeywords(value: unknown): string[];
13
+ export declare function getValueByDataIndex(record: RecordType, dataIndex: Column["dataIndex"]): any;
14
+ export declare function searchList({ list, columns, q, searchFields, childrenColumnName, }: {
15
+ list?: RecordType[];
16
+ columns?: Column[];
17
+ q?: string;
18
+ searchFields?: (string | string[])[];
19
+ childrenColumnName: string;
20
+ }): RecordType[] | undefined;
21
+ export declare function isPlainObject(value: unknown): value is Record<string, any>;
22
+ export declare function getAllKeys({ list, rowKey, childrenColumnName, }: {
23
+ list?: RecordType[];
24
+ rowKey: string;
25
+ childrenColumnName: string;
26
+ }): (string | number)[];
27
+ export declare function naturalComparator(a: unknown, b: unknown): number;