dcp-design-react 1.11.20 → 1.11.22

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,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { TableBodyRef, IColumn, IDerivedRowKey, IFetchParams, IPagination, IRecord, IRowColSpan, IRowKey, IRule, IMergeCellItem, IMergedCell } from '../table/types';
2
+ import type { TableBodyRef, 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';
@@ -72,8 +72,6 @@ export type ITableContext = {
72
72
  doFieldValidate: (rules: IRule[], val: unknown, rowKey: IRowKey, columnKey: string, columnTitle: string) => void;
73
73
  createTableData: (list: IRecord[]) => void;
74
74
  createGroupData: (records: IRecord[]) => IRecord[];
75
- findParentRowKeys: (deriveRowKeys: IDerivedRowKey[], key: IRowKey) => IRowKey[];
76
- getAllChildRowKeys: (deriveRowKeys: IDerivedRowKey[]) => IRowKey[];
77
75
  scrollBottomDebouncer: (event: React.MouseEvent<HTMLDivElement>) => void;
78
76
  resetTableScroll: () => void;
79
77
  clearTableSorter: () => void;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { ITableRef } from './useTableRef';
3
3
  import type { ITableState } from './useTableState';
4
- import type { getRowKeyType, IColumn, IDerivedRowKey, IFetchParams, IFieldAuthItem, IFilter, IPagination, IRecord, IRowKey, IRule, ISorter, ISuperFilter, ITableProps, IValidItem, TableBodyRef } from '../table/types';
4
+ import type { getRowKeyType, IColumn, IFetchParams, IFieldAuthItem, IFilter, IPagination, IRecord, IRowKey, IRule, ISorter, ISuperFilter, ITableProps, IValidItem, TableBodyRef } from '../table/types';
5
5
  import type { ComponentSize } from '../../../_utils/types';
6
6
  type IExtra = {
7
7
  getRowKey: getRowKeyType;
@@ -64,8 +64,6 @@ declare const useTableCore: <T extends ITableProps>(props: T, extra: IExtra) =>
64
64
  createTableData: (list: IRecord[]) => void;
65
65
  createGroupData: (list: IRecord[]) => IRecord<any>[];
66
66
  setSelectionKeysEffect: (selectedKeys: IRowKey[]) => void;
67
- findParentRowKeys: (deriveRowKeyList: IDerivedRowKey[], key: IRowKey) => (string | number)[];
68
- getAllChildRowKeys: (deriveRowKeyList: IDerivedRowKey[]) => (string | number)[];
69
67
  doFieldValidate: (rules: IRule[], val: unknown, rowKey: IRowKey, columnKey: string, columnTitle: string) => void;
70
68
  getTableLog: () => {
71
69
  required: IValidItem[];
@@ -140,6 +140,7 @@ export type IEditerReturn = {
140
140
  columns?: IColumn[];
141
141
  rowKey?: ((row: IRecord, index: number) => IRowKey) | IRowKey;
142
142
  webPagination?: boolean;
143
+ topBarExtra?: React.ReactNode;
143
144
  };
144
145
  tree?: {
145
146
  fetch?: IFetch & {
@@ -45,6 +45,8 @@ export declare const groupByProps: (array?: IRecord[], props?: string[]) => any[
45
45
  export declare const deepGetColumn: (arr: IColumn[], value: string) => IColumn[] | undefined;
46
46
  export declare const deepGetRowkey: (arr: IRecord[], value: IRowKey) => IRowKey[] | undefined;
47
47
  export declare const deepFindRecord: (arr: IRecord[], fn: (node: IRecord) => boolean) => Nullable<IRecord>;
48
+ export declare const findParentRowKeys: (deriveRowKeyList: IDerivedRowKey[], key: IRowKey) => (string | number)[];
49
+ export declare const getAllChildRowKeys: (deriveRowKeyList: IDerivedRowKey[]) => (string | number)[];
48
50
  export declare const deepTreeFilter: (tree: any[], fn: (node: unknown) => boolean) => any[];
49
51
  export declare const flatToTree: (list: any[], id: string, pid: string) => any[];
50
52
  export declare const sortableFormatter: <T>(items: T[]) => T[];
@@ -1,103 +1,104 @@
1
- /*
2
- * @Author: 焦质晔
3
- * @Date: 2020-02-28 22:13:54
4
- * @Last Modified by: 焦质晔
5
- * @Last Modified time: 2024-12-01 18:48:00
6
- */
7
- .body--row {
8
- &-draggable {
9
- position: relative;
10
- .drop-indicator {
11
- position: absolute;
12
- right: 0;
13
- bottom: 0;
14
- z-index: 5;
15
- height: 2px;
16
- background-color: @v-primary-color;
17
- border-radius: 1px;
18
- pointer-events: none;
19
- &::after {
20
- position: absolute;
21
- top: -3px;
22
- left: 0;
23
- width: 8px;
24
- height: 8px;
25
- background-color: #fff;
26
- border: 2px solid @v-primary-color;
27
- border-radius: 50%;
28
- content: '';
29
- }
30
- }
31
- }
32
- }
33
- .body--column {
34
- .cell--edit {
35
- margin: 0 -1 * (@v-module-distance - 1px);
36
- // placeholder
37
- input::placeholder {
38
- text-align: left;
39
- }
40
- // search
41
- .ant-input-search {
42
- width: calc(100% + 1px);
43
- & > .ant-input-group > .ant-input-group-addon {
44
- line-height: 1;
45
- }
46
- }
47
- // search-helper-multiple
48
- .search-helper-multiple {
49
- .ant-input-group > .ant-select:first-child {
50
- z-index: 1;
51
- .ant-select-selector {
52
- border-top-right-radius: 0;
53
- border-bottom-right-radius: 0;
54
- }
55
- }
56
- .ant-select-multiple {
57
- .ant-select-selection-overflow-item-rest {
58
- pointer-events: none;
59
- }
60
- }
61
- }
62
- // textArea
63
- textarea[class='ant-input'] {
64
- resize: none;
65
- }
66
- &.is-error {
67
- position: relative;
68
- .ant-input,
69
- .ant-input-affix-wrapper {
70
- border-color: @v-danger-color;
71
- box-shadow: none;
72
- z-index: 1;
73
- }
74
- .ant-input-search {
75
- & + .cell-error {
76
- right: 38px;
77
- }
78
- }
79
- .cell-error {
80
- position: absolute;
81
- top: calc(50% - 9px);
82
- font-size: @v-font-size-small;
83
- color: @v-danger-color;
84
- right: 8px;
85
- pointer-events: none;
86
- z-index: 1;
87
- }
88
- }
89
- }
90
- &.col--center {
91
- .cell--edit .ant-input {
92
- text-align: center;
93
- }
94
- }
95
- &.col--right {
96
- .cell--edit .ant-input {
97
- text-align: right;
98
- }
99
- }
100
- &.selected {
101
- background-color: @v-table-row-selected-background-color !important;
102
- }
103
- }
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2020-02-28 22:13:54
4
+ * @Last Modified by: 焦质晔
5
+ * @Last Modified time: 2024-12-01 18:48:00
6
+ */
7
+ .body--row {
8
+ &-draggable {
9
+ position: relative;
10
+ .drop-indicator {
11
+ position: absolute;
12
+ right: 0;
13
+ bottom: 0;
14
+ z-index: 5;
15
+ height: 2px;
16
+ background-color: @v-primary-color;
17
+ border-radius: 1px;
18
+ pointer-events: none;
19
+ &::after {
20
+ position: absolute;
21
+ top: -3px;
22
+ left: 0;
23
+ width: 8px;
24
+ height: 8px;
25
+ background-color: #fff;
26
+ border: 2px solid @v-primary-color;
27
+ border-radius: 50%;
28
+ content: '';
29
+ }
30
+ }
31
+ }
32
+ }
33
+ .body--column {
34
+ .cell--edit {
35
+ margin: 0 -1 * (@v-module-distance - 1px);
36
+ // placeholder
37
+ input::placeholder {
38
+ text-align: left;
39
+ }
40
+ // search
41
+ .ant-input-search {
42
+ width: calc(100% + 1px);
43
+ & > .ant-input-group > .ant-input-group-addon {
44
+ line-height: 1;
45
+ }
46
+ }
47
+ // search-helper-multiple
48
+ .search-helper-multiple {
49
+ .ant-input-group > .ant-select:first-child {
50
+ z-index: 1;
51
+ .ant-select-selector {
52
+ border-top-right-radius: 0;
53
+ border-bottom-right-radius: 0;
54
+ }
55
+ }
56
+ .ant-select-multiple {
57
+ .ant-select-selection-overflow-item-rest {
58
+ pointer-events: none;
59
+ }
60
+ }
61
+ }
62
+ // textArea
63
+ textarea[class='ant-input'] {
64
+ resize: none;
65
+ }
66
+ &.is-error {
67
+ position: relative;
68
+ .ant-input,
69
+ .ant-input-affix-wrapper,
70
+ .ant-select > .ant-select-selector {
71
+ border-color: @v-danger-color;
72
+ box-shadow: none;
73
+ z-index: 1;
74
+ }
75
+ .ant-input-search {
76
+ & + .cell-error {
77
+ right: 38px;
78
+ }
79
+ }
80
+ .cell-error {
81
+ position: absolute;
82
+ top: calc(50% - 9px);
83
+ font-size: @v-font-size-small;
84
+ color: @v-danger-color;
85
+ right: 8px;
86
+ pointer-events: none;
87
+ z-index: 1;
88
+ }
89
+ }
90
+ }
91
+ &.col--center {
92
+ .cell--edit .ant-input {
93
+ text-align: center;
94
+ }
95
+ }
96
+ &.col--right {
97
+ .cell--edit .ant-input {
98
+ text-align: right;
99
+ }
100
+ }
101
+ &.selected {
102
+ background-color: @v-table-row-selected-background-color !important;
103
+ }
104
+ }
@@ -110,16 +110,25 @@ export declare class Virtualizer<TScrollElement extends Element | Window, TItemE
110
110
  private getFurthestMeasurement;
111
111
  private getMeasurementOptions;
112
112
  private getMeasurements;
113
- calculateRange: () => {
114
- startIndex: number;
115
- endIndex: number;
116
- } | null;
117
- getVirtualIndexes: () => number[];
113
+ calculateRange: {
114
+ (): {
115
+ startIndex: number;
116
+ endIndex: number;
117
+ } | null;
118
+ updateDeps(newDeps: [VirtualItem[], number, number]): void;
119
+ };
120
+ getVirtualIndexes: {
121
+ (): number[];
122
+ updateDeps(newDeps: [(range: Range) => number[], number, number, number | null, number | null]): void;
123
+ };
118
124
  indexFromElement: (node: TItemElement) => number;
119
125
  private _measureElement;
120
126
  resizeItem: (index: number, size: number) => void;
121
127
  measureElement: (node: TItemElement | null | undefined) => void;
122
- getVirtualItems: () => VirtualItem[];
128
+ getVirtualItems: {
129
+ (): VirtualItem[];
130
+ updateDeps(newDeps: [number[], VirtualItem[]]): void;
131
+ };
123
132
  getVirtualItemForOffset: (offset: number) => VirtualItem | undefined;
124
133
  getOffsetForAlignment: (toOffset: number, align: ScrollAlignment) => number;
125
134
  getOffsetForIndex: (index: number, align?: ScrollAlignment) => readonly [number, "auto"] | readonly [number, "center"] | readonly [number, "end"] | readonly [number, "start"] | undefined;
@@ -7,7 +7,10 @@ export declare function memo<TDeps extends ReadonlyArray<any>, TResult>(getDeps:
7
7
  debug?: () => boolean;
8
8
  onChange?: (result: TResult) => void;
9
9
  initialDeps?: TDeps;
10
- }): () => TResult;
10
+ }): {
11
+ (): TResult;
12
+ updateDeps(newDeps: [...TDeps]): void;
13
+ };
11
14
  export declare function notUndefined<T>(value: T | undefined, msg?: string): T;
12
15
  export declare const approxEqual: (a: number, b: number) => boolean;
13
16
  export declare const debounce: (targetWindow: Window & typeof globalThis, fn: AnyFunction<any>, ms: number) => (this: any, ...args: Array<any>) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcp-design-react",
3
- "version": "1.11.20",
3
+ "version": "1.11.22",
4
4
  "description": "A Component Library for React",
5
5
  "keywords": [
6
6
  "React",
@@ -122,8 +122,8 @@
122
122
  "lint-staged": "^10.5.4",
123
123
  "mockjs": "^1.1.0",
124
124
  "prettier": "^2.8.8",
125
- "react": "^17.0.2",
126
- "react-dom": "^17.0.2",
125
+ "react": "^18.2.0",
126
+ "react-dom": "^18.2.0",
127
127
  "rimraf": "^3.0.2",
128
128
  "rollup": "^2.79.1",
129
129
  "style-loader": "^3.3.4",