dcp-design-react 1.12.16 → 1.12.17

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.
@@ -1,37 +1,37 @@
1
- /*
2
- * @Author: 焦质晔
3
- * @Date: 2021-07-23 18:58:43
4
- * @Last Modified by: 焦质晔
5
- * @Last Modified time: 2021-07-23 18:58:43
6
- */
7
- @import '../themes/index';
8
-
9
- .reset-container() {
10
- box-sizing: border-box;
11
- margin: 0;
12
- padding: 0;
13
- color: @--text-color;
14
- font-variant: @font-variant-base;
15
- line-height: @--line-height-base;
16
- list-style: none;
17
- font-feature-settings: @font-feature-settings-base;
18
- }
19
-
20
- .box-sizing-content() {
21
- box-sizing: border-box;
22
- }
23
-
24
- .text-overflow-cut() {
25
- overflow: hidden;
26
- text-overflow: ellipsis;
27
- white-space: nowrap;
28
- }
29
-
30
- .text-ellipsis-2 () {
31
- display: -webkit-box;
32
- -webkit-box-orient: vertical;
33
- -webkit-line-clamp: 2;
34
- line-clamp: 2;
35
- overflow: hidden;
36
- text-overflow: ellipsis;
37
- }
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2021-07-23 18:58:43
4
+ * @Last Modified by: 焦质晔
5
+ * @Last Modified time: 2021-07-23 18:58:43
6
+ */
7
+ @import '../themes/index';
8
+
9
+ .reset-container() {
10
+ box-sizing: border-box;
11
+ margin: 0;
12
+ padding: 0;
13
+ color: @--text-color;
14
+ font-variant: @font-variant-base;
15
+ line-height: @--line-height-base;
16
+ list-style: none;
17
+ font-feature-settings: @font-feature-settings-base;
18
+ }
19
+
20
+ .box-sizing-content() {
21
+ box-sizing: border-box;
22
+ }
23
+
24
+ .text-overflow-cut() {
25
+ overflow: hidden;
26
+ text-overflow: ellipsis;
27
+ white-space: nowrap;
28
+ }
29
+
30
+ .text-ellipsis-2 () {
31
+ display: -webkit-box;
32
+ -webkit-box-orient: vertical;
33
+ -webkit-line-clamp: 2;
34
+ line-clamp: 2;
35
+ overflow: hidden;
36
+ text-overflow: ellipsis;
37
+ }
@@ -23,5 +23,5 @@ export type NodeType = {
23
23
  data: IRecord;
24
24
  props: IProps;
25
25
  };
26
- declare const DraggableTr: React.ForwardRefExoticComponent<IProps & React.RefAttributes<any>>;
26
+ declare const DraggableTr: React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLTableRowElement>>;
27
27
  export default DraggableTr;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { IColumn, IRecord, IRowKey } from '../table/types';
3
+ import { type CellEditRef } from '../edit';
3
4
  type ICellProps = {
4
5
  row: IRecord;
5
6
  column: IColumn;
@@ -9,5 +10,5 @@ type ICellProps = {
9
10
  showTitle?: boolean;
10
11
  onUnmount?: () => void;
11
12
  };
12
- declare const Cell: React.ForwardRefExoticComponent<ICellProps & React.RefAttributes<any>>;
13
+ declare const Cell: React.ForwardRefExoticComponent<ICellProps & React.RefAttributes<CellEditRef>>;
13
14
  export default Cell;
@@ -1,12 +1,11 @@
1
1
  /// <reference types="react" />
2
- import type { TableBodyRef, IColumn, IFetchParams, IPagination, IRecord, IRowColSpan, IRowKey, IRule, IMergeCellItem, IMergedCell } from '../table/types';
2
+ import type { IColumn, IFetchParams, IPagination, IRecord, IRowColSpan, IRowKey, IRule, IMergeCellItem, IMergedCell } from '../table/types';
3
3
  import type { ITableRef } from '../hooks/useTableRef';
4
4
  import type { ITableState } from '../hooks/useTableState';
5
5
  import type { ComponentSize } from '../../../_utils/types';
6
6
  export type ITableContext = {
7
7
  getRowKey: (row: IRecord, index: number) => IRowKey;
8
8
  tableRef: React.MutableRefObject<ITableRef>;
9
- tableBodyRef: React.RefObject<TableBodyRef>;
10
9
  prefixCls: string;
11
10
  $size: ComponentSize;
12
11
  tableFlatData: IRecord[];
@@ -14,7 +13,7 @@ export type ITableContext = {
14
13
  editableColumns: IColumn[];
15
14
  leftFixedColumns: IColumn[];
16
15
  rightFixedColumns: IColumn[];
17
- treeExpandIndex: string;
16
+ expandIconIndex: string;
18
17
  sorter: ITableState['sorter'];
19
18
  filters: ITableState['filters'];
20
19
  superFilters: ITableState['superFilters'];
@@ -7,7 +7,7 @@ type ICellEditProps = {
7
7
  columnKey: string;
8
8
  children?: React.ReactNode;
9
9
  };
10
- type CellEditRef = {
10
+ export type CellEditRef = {
11
11
  focus: () => void;
12
12
  blur: () => void;
13
13
  isEditable: () => boolean;
@@ -1,11 +1,10 @@
1
1
  import React from 'react';
2
2
  import type { ITableRef } from './useTableRef';
3
- import type { getRowKeyType, IColumn, IFetchParams, IPagination, IRecord, IRowKey, IRule, IValidItem, TableRef, ToolBoxRef, TableBodyRef, ColumnDefineRef } from '../table/types';
3
+ import type { getRowKeyType, IColumn, IFetchParams, IPagination, IRecord, IRowKey, IRule, IValidItem, TableRef, ToolBoxRef, ColumnDefineRef } from '../table/types';
4
4
  type IExtra = {
5
5
  getRowKey: getRowKeyType;
6
6
  tableRef: React.MutableRefObject<ITableRef>;
7
7
  toolBoxRef: React.RefObject<ToolBoxRef>;
8
- tableBodyRef: React.RefObject<TableBodyRef>;
9
8
  columnFilterRef: React.RefObject<ColumnDefineRef>;
10
9
  flattenColumns: IColumn[];
11
10
  editableColumns: IColumn[];
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { ITableRef } from './useTableRef';
3
- import type { TableBodyRef, IColumn, IPagination, IRowKey, ITableProps, IDerivedRowKeys } from '../table/types';
3
+ import type { IColumn, IPagination, IRowKey, ITableProps, IDerivedRowKeys } from '../table/types';
4
4
  import type { ComponentSize } from '../../../_utils/types';
5
5
  type IExtra = {
6
6
  tableRef: React.MutableRefObject<ITableRef>;
7
- tableBodyRef: React.RefObject<TableBodyRef>;
8
7
  $size: ComponentSize;
9
8
  pagination: IPagination;
10
9
  selectionKeys: IDerivedRowKeys;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { getRowKeyType } from '../table/types';
3
- import type { IColumn, IMergeCellItem, IRecord, IRowKey, ITableProps, TableBodyRef } from '../table/types';
3
+ import type { IColumn, IMergeCellItem, IRecord, IRowKey, ITableProps } from '../table/types';
4
4
  import type { ITableState } from './useTableState';
5
5
  import type { ITableRef } from './useTableRef';
6
6
  import type { ComponentSize } from '../../../_utils/types';
@@ -9,7 +9,6 @@ type IExtra = {
9
9
  tableRef: React.MutableRefObject<ITableRef>;
10
10
  topElementRef: React.RefObject<HTMLDivElement>;
11
11
  tableElementRef: React.RefObject<HTMLDivElement>;
12
- tableBodyRef: React.RefObject<TableBodyRef>;
13
12
  $size: ComponentSize;
14
13
  tableColumns: IColumn[];
15
14
  flattenColumns: IColumn[];
@@ -29,7 +29,7 @@ declare const useTableMemo: <T extends ITableProps>(props: T, extra: IExtra) =>
29
29
  rightFixedColumns: IColumn[];
30
30
  tableRowHeight: number;
31
31
  derivedMergeCells: IMergeCellItem[];
32
- treeExpandIndex: string;
32
+ expandIconIndex: string;
33
33
  showSummary: boolean;
34
34
  showFooter: boolean;
35
35
  isHeadGroup: boolean;
@@ -3,7 +3,7 @@ import TableManager from '../manager';
3
3
  import Store from '../store';
4
4
  import type { Nullable } from '../../../_utils/types';
5
5
  import type { ScrollbarRef } from '../../../scrollbar/src/scrollbar';
6
- import type { getRowKeyType, IColumn, IFieldAuthItem, InsertMode, IRecord, IRowKey, ITableProps } from '../table/types';
6
+ import type { getRowKeyType, IColumn, IFieldAuthItem, InsertMode, IRecord, IRowKey, ITableProps, TableBodyRef } from '../table/types';
7
7
  export type ITableRef = {
8
8
  props: ITableProps;
9
9
  uid: string;
@@ -16,6 +16,7 @@ export type ITableRef = {
16
16
  fieldAuth: Record<string, IFieldAuthItem>;
17
17
  columnsDefined: boolean;
18
18
  scrollBarRef: React.RefObject<ScrollbarRef>;
19
+ tableBodyRef: React.RefObject<TableBodyRef>;
19
20
  store: Store;
20
21
  resizeState: {
21
22
  width: number;
@@ -53,7 +54,7 @@ declare const useTableRef: <T extends ITableProps>(props: T, { getRowKey }: IExt
53
54
  setSummaries: (option: ITableRef['summaries']) => void;
54
55
  setScrollXLoad: (value: boolean) => void;
55
56
  setScrollYLoad: (value: boolean) => void;
56
- setSelectionRows: (selectKeys: IRecord[]) => void;
57
+ setSelectionRows: (records: IRecord[]) => void;
57
58
  setUnMounted: (value: boolean) => void;
58
59
  clearElementStore: () => void;
59
60
  props: ITableProps;
@@ -67,6 +68,7 @@ declare const useTableRef: <T extends ITableProps>(props: T, { getRowKey }: IExt
67
68
  fieldAuth: Record<string, IFieldAuthItem>;
68
69
  columnsDefined: boolean;
69
70
  scrollBarRef: React.RefObject<ScrollbarRef>;
71
+ tableBodyRef: React.RefObject<TableBodyRef>;
70
72
  store: Store;
71
73
  resizeState: {
72
74
  width: number;
@@ -253,6 +253,14 @@ export type ISummation = {
253
253
  };
254
254
  onChange?: (summationRows: Record<string, number | string>[]) => void;
255
255
  };
256
+ export type ITreeDropEvent = {
257
+ node: IRecord;
258
+ dragNode: IRecord;
259
+ dragNodesKeys: IRowKey[];
260
+ dropPosition: number;
261
+ dropToGap?: boolean;
262
+ event: React.MouseEvent<HTMLElement>;
263
+ };
256
264
  export type IExportExcel = {
257
265
  fileName?: string;
258
266
  fetch?: {
@@ -373,7 +381,7 @@ export type ITableProps = {
373
381
  tableData: IRecord[];
374
382
  }) => IRowColSpan | [number, number];
375
383
  rowDraggable?: boolean;
376
- beforeRowDrop?: (options: any, tableData: IRecord[]) => boolean;
384
+ beforeRowDrop?: (options: ITreeDropEvent, tableData: IRecord[]) => boolean;
377
385
  initialSorter?: ISorter;
378
386
  initialFilter?: IFilter;
379
387
  rowSelection?: IRowSelection;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import dayjs, { Dayjs } from 'dayjs';
3
- import type { IColumn, IDerivedRowKeys, IMergeCellItem, IRecord, IRowKey, ISorter } from '../table/types';
2
+ import dayjs, { type Dayjs } from 'dayjs';
3
+ import type { IColumn, IDerivedRowKeys, IFilter, IMergeCellItem, IRecord, IRowKey, ISorter } from '../table/types';
4
4
  import type { Nullable, AnyObject } from '../../../_utils/types';
5
5
  export declare const columnsFlatMap: (columns: IColumn[]) => IColumn[];
6
6
  export declare const createFilterColumns: (columns: IColumn[]) => IColumn[];
@@ -36,6 +36,8 @@ export declare const formatDisplayPrecision: (value: number | string, precision:
36
36
  export declare const stringToNumber: (value: string) => number | '';
37
37
  export declare const getDate: (dateString: string | undefined, format: string) => dayjs.Dayjs | null;
38
38
  export declare const formatDate: (date: Dayjs | Date | null, format: string) => string;
39
+ export declare const formatSorterValue: (sorter: ISorter) => ISorter;
40
+ export declare const formatFilterValue: (filters: IFilter, showFilterType: boolean) => IFilter;
39
41
  export declare const createUidKey: (prefix?: string) => string;
40
42
  export declare const getTextFromVNode: <T extends string | number>(node: React.ReactNode | T) => T[];
41
43
  export declare const getTHeadTitle: (title: React.ReactNode | string) => string;