@zhenliang/sheet 0.1.6 → 0.1.7-3.beta.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.
- package/dist/assets/arrow-mac-down.svg +19 -0
- package/dist/assets/arrow-mac-right.svg +17 -0
- package/dist/assets/arrow-windows-down.svg +17 -0
- package/dist/assets/arrow-windows-right.svg +17 -0
- package/dist/core/config.d.ts +3 -0
- package/dist/core/config.js +4 -1
- package/dist/core/editor/cascaderEditor/index.d.ts +1 -1
- package/dist/core/editor/cascaderEditor/index.js +12 -11
- package/dist/core/editor/cascaderEditor/index.less +15 -7
- package/dist/core/editor/dateEditor/index.js +31 -8
- package/dist/core/editor/dateEditor/index.less +9 -2
- package/dist/core/editor/numberEditor/index.d.ts +3 -1
- package/dist/core/editor/numberEditor/index.js +62 -27
- package/dist/core/editor/numberEditor/index.less +3 -2
- package/dist/core/editor/selectEditor/index.d.ts +1 -1
- package/dist/core/editor/selectEditor/index.js +34 -19
- package/dist/core/editor/selectEditor/index.less +16 -5
- package/dist/core/reducers/index.d.ts +2 -2
- package/dist/core/reducers/index.js +8 -1
- package/dist/core/reducers/keyboardReducer.js +39 -9
- package/dist/core/reducers/mouseReducer.js +115 -11
- package/dist/core/reducers/sideEffectReducer.d.ts +1 -1
- package/dist/core/reducers/sideEffectReducer.js +146 -41
- package/dist/core/reducers/stateReducer.d.ts +1 -0
- package/dist/core/reducers/stateReducer.js +96 -27
- package/dist/core/sheet/Cell.d.ts +1 -1
- package/dist/core/sheet/Cell.js +33 -24
- package/dist/core/sheet/Control.d.ts +21 -0
- package/dist/core/sheet/Control.js +83 -0
- package/dist/core/sheet/DataEditor.js +3 -3
- package/dist/core/sheet/DefaultCell.d.ts +8 -3
- package/dist/core/sheet/DefaultCell.js +12 -8
- package/dist/core/sheet/DefaultRow.js +3 -9
- package/dist/core/sheet/DefaultRowMapper.d.ts +3 -0
- package/dist/core/sheet/DefaultRowMapper.js +22 -6
- package/dist/core/sheet/DefaultShell.js +1 -1
- package/dist/core/sheet/Event.d.ts +1 -1
- package/dist/core/sheet/Event.js +1 -1
- package/dist/core/sheet/Menu.d.ts +6 -0
- package/dist/core/sheet/Menu.js +21 -0
- package/dist/core/sheet/ValueViewer.js +1 -1
- package/dist/core/sheet/index.js +249 -88
- package/dist/core/sheet/index.less +199 -107
- package/dist/core/sheet/searchInput.d.ts +15 -0
- package/dist/core/sheet/searchInput.js +78 -0
- package/dist/core/sheet/useCellEvent.js +1 -1
- package/dist/core/sheet/useContextMenu.d.ts +1 -1
- package/dist/core/sheet/useContextMenu.js +13 -10
- package/dist/core/sheet/useKeyBoardEvent.js +19 -2
- package/dist/core/sheet/useMouseEvent.js +19 -12
- package/dist/core/sheet/useSearchInput.d.ts +11 -0
- package/dist/core/sheet/useSearchInput.js +65 -0
- package/dist/core/sheet/useSelectVisible.d.ts +1 -1
- package/dist/core/sheet/useSelectVisible.js +17 -7
- package/dist/core/sheet/useVirtualList.d.ts +10 -1
- package/dist/core/sheet/useVirtualList.js +44 -28
- package/dist/core/sheet/var.less +41 -34
- package/dist/core/shell/draggableShell/index.d.ts +4 -1
- package/dist/core/shell/draggableShell/index.js +133 -50
- package/dist/core/shell/tableShell.d.ts +4 -1
- package/dist/core/shell/tableShell.js +82 -34
- package/dist/core/table/addButton.d.ts +6 -0
- package/dist/core/table/addButton.js +103 -0
- package/dist/core/table/events.d.ts +1 -3
- package/dist/core/table/events.js +28 -34
- package/dist/core/table/index.js +97 -190
- package/dist/core/table/index.less +12 -0
- package/dist/core/table/useGroupConfig.d.ts +4 -1
- package/dist/core/table/useGroupConfig.js +139 -14
- package/dist/core/table/useRowSelection.d.ts +3 -0
- package/dist/core/table/useRowSelection.js +68 -2
- package/dist/core/util.d.ts +10 -4
- package/dist/core/util.js +121 -69
- package/dist/core/viewer/btnViewer/index.js +3 -3
- package/dist/core/viewer/cascaderViewer/index.js +6 -1
- package/dist/core/viewer/checkViewer/index.js +2 -2
- package/dist/core/viewer/editViewer/index.js +3 -3
- package/dist/core/viewer/groupViewer/index.js +26 -10
- package/dist/core/viewer/selectorViewer/index.js +7 -3
- package/dist/core/viewer/switchViewer/index.js +10 -4
- package/dist/example/antComponent.d.ts +1 -1
- package/dist/example/antComponent.js +63 -37
- package/dist/example/basic.d.ts +1 -1
- package/dist/example/basic.js +20 -14
- package/dist/example/ellipsis.d.ts +1 -1
- package/dist/example/ellipsis.js +3 -2
- package/dist/example/fixed.d.ts +1 -1
- package/dist/example/fixed.js +3 -2
- package/dist/example/group.js +40 -17
- package/dist/example/selection.d.ts +1 -1
- package/dist/example/selection.js +9 -8
- package/dist/example/sheet.d.ts +1 -1
- package/dist/example/sheet.js +21 -22
- package/dist/example/valuationAnalyze.d.ts +1 -0
- package/dist/example/valuationAnalyze.js +3 -4
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useEventBus.d.ts +1 -0
- package/dist/hooks/useEventBus.js +2 -2
- package/dist/hooks/useGroupConfig.d.ts +4 -0
- package/dist/hooks/useGroupConfig.js +5 -0
- package/dist/hooks/useKeyboard.d.ts +5 -2
- package/dist/hooks/useKeyboard.js +17 -3
- package/dist/hooks/useMiddlewareReducer.d.ts +5 -5
- package/dist/hooks/useMiddlewareReducer.js +3 -3
- package/dist/hooks/useMouse.d.ts +1 -1
- package/dist/hooks/useMouse.js +7 -7
- package/dist/hooks/useSetState.js +7 -7
- package/dist/hooks/useSheetEvent.d.ts +1 -1
- package/dist/hooks/useSheetEvent.js +2 -2
- package/dist/hooks/useWidthConfig.d.ts +3 -3
- package/dist/hooks/useWidthConfig.js +2 -2
- package/dist/standardUtils/index.d.ts +1 -1
- package/dist/standardUtils/index.js +1 -1
- package/dist/type/sheet.d.ts +76 -31
- package/dist/type/sheetTable.d.ts +21 -12
- package/package.json +7 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="react" />
|
|
3
3
|
import Events from 'events';
|
|
4
|
-
export declare const SheetEventContext: import("react").Context<Events | undefined>;
|
|
4
|
+
export declare const SheetEventContext: import("../../node_modules/@types/react").Context<Events | undefined>;
|
|
5
5
|
export declare function useSheetEvent(): Events;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createContext, useContext } from
|
|
2
|
-
export var SheetEventContext =
|
|
1
|
+
import { createContext, useContext } from "../../node_modules/@types/react";
|
|
2
|
+
export var SheetEventContext = createContext(undefined);
|
|
3
3
|
export function useSheetEvent() {
|
|
4
4
|
return useContext(SheetEventContext);
|
|
5
5
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export declare const WidthContext: import("react").Context<
|
|
4
|
-
export declare function useWidth():
|
|
2
|
+
import { WidthConfigContext } from '../type/sheet';
|
|
3
|
+
export declare const WidthContext: import("../../node_modules/@types/react").Context<WidthConfigContext>;
|
|
4
|
+
export declare function useWidth(): WidthConfigContext;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createContext, useContext } from
|
|
2
|
-
export var WidthContext =
|
|
1
|
+
import { createContext, useContext } from "../../node_modules/@types/react";
|
|
2
|
+
export var WidthContext = createContext({});
|
|
3
3
|
export function useWidth() {
|
|
4
4
|
return useContext(WidthContext);
|
|
5
5
|
}
|
|
@@ -2,7 +2,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
2
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
-
function _iterableToArrayLimit(
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
export var formatPrecision = function formatPrecision(value) {
|
|
8
8
|
var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
package/dist/type/sheet.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
/// <reference types="node" />
|
|
3
2
|
import type { EventEmitter } from 'events';
|
|
3
|
+
import { CSSProperties } from "../../node_modules/@types/react";
|
|
4
4
|
import { SheetTableType, SheetType } from '.';
|
|
5
5
|
export declare enum CellAlign {
|
|
6
6
|
left = "left",
|
|
@@ -8,8 +8,10 @@ export declare enum CellAlign {
|
|
|
8
8
|
right = "right",
|
|
9
9
|
unset = "unset"
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export type Cell = {
|
|
12
12
|
id: string;
|
|
13
|
+
row?: number;
|
|
14
|
+
col?: number;
|
|
13
15
|
key?: string;
|
|
14
16
|
readonly?: boolean;
|
|
15
17
|
component?: CellViewer;
|
|
@@ -20,55 +22,70 @@ export declare type Cell = {
|
|
|
20
22
|
record?: Record<string, unknown>;
|
|
21
23
|
disableEvents?: boolean;
|
|
22
24
|
dataEditor?: CellEditor;
|
|
25
|
+
dataIndex?: string;
|
|
23
26
|
valueViewer?: CellViewer;
|
|
27
|
+
searchKey?: (value: unknown, record?: unknown) => string;
|
|
24
28
|
className?: string;
|
|
25
29
|
align?: CellAlign;
|
|
26
30
|
fixed?: Omit<CellAlign, 'center'>;
|
|
27
31
|
value?: string | number | null;
|
|
32
|
+
allowClear?: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type FixedInfo = {
|
|
35
|
+
isFirstFixedRight: boolean;
|
|
36
|
+
isLastFixedLeft: boolean;
|
|
37
|
+
fixPosition: number;
|
|
38
|
+
isScrolledOver?: boolean;
|
|
39
|
+
isScrolledToEnd?: boolean;
|
|
28
40
|
};
|
|
29
|
-
export
|
|
41
|
+
export type CellViewerProps = {
|
|
30
42
|
value: unknown;
|
|
31
43
|
record?: Record<string, unknown>;
|
|
32
44
|
row?: number;
|
|
33
45
|
col?: number;
|
|
34
46
|
cell?: Cell;
|
|
35
47
|
};
|
|
36
|
-
export
|
|
48
|
+
export type CellEditorProps = {
|
|
37
49
|
value: unknown;
|
|
38
50
|
cell?: Cell;
|
|
39
51
|
onChange: (value: unknown) => void;
|
|
40
52
|
onConfirm: (value: unknown) => void;
|
|
41
53
|
} & CellViewerProps;
|
|
42
|
-
export
|
|
54
|
+
export type CellEditor = React.FC<CellEditorProps> & {
|
|
43
55
|
checker?: (value: unknown, record?: Record<string, unknown>) => boolean;
|
|
44
56
|
formatter?: (value: unknown, record?: Record<string, unknown>) => unknown;
|
|
45
57
|
parser?: (value: unknown, record?: Record<string, unknown>) => unknown;
|
|
46
58
|
};
|
|
47
|
-
export
|
|
48
|
-
export
|
|
59
|
+
export type CellViewer = React.FC<CellViewerProps>;
|
|
60
|
+
export type CellPosition = {
|
|
49
61
|
row: number;
|
|
50
62
|
col: number;
|
|
51
63
|
};
|
|
52
|
-
export
|
|
64
|
+
export type CellData = {
|
|
53
65
|
id: string;
|
|
54
66
|
cell: Cell;
|
|
55
67
|
row: number;
|
|
56
68
|
col: number;
|
|
69
|
+
key?: string;
|
|
57
70
|
value?: string;
|
|
58
71
|
};
|
|
59
|
-
export
|
|
60
|
-
export
|
|
61
|
-
export
|
|
72
|
+
export type CellNavigable = (cell?: Cell, row?: number, col?: number) => boolean;
|
|
73
|
+
export type CellChangeHandler = (cells: CellData[], additions?: CellData[]) => void;
|
|
74
|
+
export type RowGroup = {
|
|
62
75
|
groupName: string;
|
|
63
76
|
groupStart: number;
|
|
64
77
|
groupEnd: number;
|
|
65
78
|
};
|
|
66
|
-
export
|
|
79
|
+
export type RowGroupConfig = {
|
|
67
80
|
defaultOpen?: boolean;
|
|
68
81
|
groups: RowGroup[];
|
|
69
82
|
groupOpen: boolean[];
|
|
70
83
|
};
|
|
71
|
-
export
|
|
84
|
+
export type GroupMap = Map<number, SheetType.RowGroup & {
|
|
85
|
+
isStart: boolean;
|
|
86
|
+
isOpen: boolean;
|
|
87
|
+
}>;
|
|
88
|
+
export type MenuRenderProps = {
|
|
72
89
|
position?: {
|
|
73
90
|
top: number;
|
|
74
91
|
left: number;
|
|
@@ -76,8 +93,9 @@ export declare type MenuRenderProps = {
|
|
|
76
93
|
cell?: CellPosition;
|
|
77
94
|
onContextMenu?: (event: any) => void;
|
|
78
95
|
};
|
|
79
|
-
export
|
|
96
|
+
export type SheetInstance = {
|
|
80
97
|
zoomTo: (row?: number) => void;
|
|
98
|
+
goTo: (row: number, col: number) => void;
|
|
81
99
|
pushToHistory: (value: OperateHistory) => void;
|
|
82
100
|
selectRow: (row?: number) => void;
|
|
83
101
|
select: (props: {
|
|
@@ -85,33 +103,48 @@ export declare type SheetInstance = {
|
|
|
85
103
|
end: SheetType.CellPosition;
|
|
86
104
|
}) => void;
|
|
87
105
|
popHistory: () => OperateHistory;
|
|
106
|
+
dropHistory: () => OperateHistory[];
|
|
88
107
|
};
|
|
89
|
-
export
|
|
108
|
+
export type SheetProps = {
|
|
90
109
|
sheetInstance?: React.MutableRefObject<SheetInstance | null>;
|
|
91
110
|
sheetRenderer?: any;
|
|
92
111
|
rowRenderer?: any;
|
|
112
|
+
emptyRenderer?: any;
|
|
93
113
|
className?: string;
|
|
94
114
|
data: Cell[][];
|
|
95
115
|
freePaste?: boolean;
|
|
96
116
|
virtualized?: boolean;
|
|
97
117
|
showBackEdit?: boolean;
|
|
98
|
-
backEditStyle?: Partial<
|
|
118
|
+
backEditStyle?: Partial<CSSProperties>;
|
|
119
|
+
searchStyle?: Partial<CSSProperties>;
|
|
120
|
+
sticky?: boolean;
|
|
99
121
|
groupConfig?: RowGroupConfig;
|
|
100
122
|
onCellsChanged?: CellChangeHandler;
|
|
101
123
|
menuRenderer?: React.FC<MenuRenderProps>;
|
|
102
124
|
onContextMenu?: (event: any) => void;
|
|
125
|
+
handleAdd?: () => void;
|
|
103
126
|
scroll?: {
|
|
104
127
|
x?: number | string;
|
|
105
128
|
y?: number | string;
|
|
106
129
|
};
|
|
107
130
|
rowClassName?: string | ((record: Record<string, unknown>, index: number) => string);
|
|
108
131
|
children?: any[];
|
|
132
|
+
boldScroll?: boolean;
|
|
133
|
+
hideColBar?: boolean;
|
|
134
|
+
showQuickLocationBtn?: boolean;
|
|
135
|
+
ControlContainer?: React.FC;
|
|
109
136
|
};
|
|
110
|
-
export
|
|
137
|
+
export type WidthConfigContext = {
|
|
111
138
|
onChange?: (value: Record<number | string, number>) => void;
|
|
112
139
|
widths?: Record<number | string, number>;
|
|
113
140
|
};
|
|
114
|
-
export
|
|
141
|
+
export type GroupConfigContext = {
|
|
142
|
+
onChange?: (value: RowGroupConfig) => void;
|
|
143
|
+
config?: RowGroupConfig & {
|
|
144
|
+
configMap: GroupMap;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
export type SheetShell = Pick<SheetTableType.TableProps, 'columns'> & {
|
|
115
148
|
className?: string;
|
|
116
149
|
showGroup?: boolean;
|
|
117
150
|
showSelect?: boolean;
|
|
@@ -126,24 +159,24 @@ export declare type SheetShell = Pick<SheetTableType.TableProps, 'columns'> & {
|
|
|
126
159
|
};
|
|
127
160
|
};
|
|
128
161
|
};
|
|
129
|
-
export
|
|
162
|
+
export type SheetRow = {
|
|
130
163
|
row: number;
|
|
131
164
|
cells: Cell[];
|
|
132
165
|
selected: boolean;
|
|
133
166
|
children: React.ElementType;
|
|
134
167
|
};
|
|
135
|
-
export
|
|
168
|
+
export type windowAssertion = {
|
|
136
169
|
clipboardData?: {
|
|
137
170
|
getData?: (type: string) => string;
|
|
138
171
|
setData?: (type: string, data: string) => string;
|
|
139
172
|
};
|
|
140
173
|
};
|
|
141
|
-
export
|
|
174
|
+
export type refAssertion = {
|
|
142
175
|
contains?: (target: EventTarget | null) => boolean;
|
|
143
176
|
focus?: () => boolean;
|
|
144
177
|
} & HTMLSpanElement;
|
|
145
|
-
export
|
|
146
|
-
export
|
|
178
|
+
export type AttributesRenderer = (cell: Cell, row: number, col: number) => Record<string, string>;
|
|
179
|
+
export type CellProps = {
|
|
147
180
|
row: number;
|
|
148
181
|
col: number;
|
|
149
182
|
cell: Cell;
|
|
@@ -151,8 +184,17 @@ export declare type CellProps = {
|
|
|
151
184
|
dataEditor?: React.ElementType;
|
|
152
185
|
valueViewer?: React.ElementType;
|
|
153
186
|
attributesRenderer?: AttributesRenderer;
|
|
187
|
+
cellFixedInfo: SheetType.FixedInfo;
|
|
154
188
|
};
|
|
155
|
-
export
|
|
189
|
+
export type SearchState = {
|
|
190
|
+
showSearch: boolean;
|
|
191
|
+
searchText: string;
|
|
192
|
+
searchTotal: number;
|
|
193
|
+
searchCurrent: number;
|
|
194
|
+
searchResultList?: CellPosition[];
|
|
195
|
+
searchCalledCount: number;
|
|
196
|
+
};
|
|
197
|
+
export type UpdateStateType = {
|
|
156
198
|
eventBus: EventEmitter;
|
|
157
199
|
start: CellPosition;
|
|
158
200
|
end: CellPosition;
|
|
@@ -163,9 +205,11 @@ export declare type UpdateStateType = {
|
|
|
163
205
|
value?: string;
|
|
164
206
|
};
|
|
165
207
|
history: OperateHistory[];
|
|
208
|
+
recoverHisotry: OperateHistory[];
|
|
166
209
|
freePaste?: boolean;
|
|
167
210
|
data: Cell[][];
|
|
168
211
|
mouseDown: boolean;
|
|
212
|
+
isIndex: boolean;
|
|
169
213
|
lastSelected?: {
|
|
170
214
|
start?: CellPosition;
|
|
171
215
|
end?: CellPosition;
|
|
@@ -182,17 +226,18 @@ export declare type UpdateStateType = {
|
|
|
182
226
|
confirm?: boolean;
|
|
183
227
|
};
|
|
184
228
|
cellChangeHandler: (cells: CellData[], additions?: CellData[]) => void;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
export
|
|
188
|
-
|
|
229
|
+
fixedInfo: SheetType.FixedInfo[];
|
|
230
|
+
} & SearchState;
|
|
231
|
+
export type UpdateFocus = (start: CellPosition, end: CellPosition) => void;
|
|
232
|
+
export type Options<T = any> = {
|
|
233
|
+
value: string | number;
|
|
189
234
|
label: string;
|
|
190
235
|
} & T;
|
|
191
|
-
export
|
|
236
|
+
export type OptionsType = Options<{
|
|
192
237
|
disabled?: boolean;
|
|
193
238
|
children?: OptionsType[];
|
|
194
239
|
}>;
|
|
195
|
-
export
|
|
240
|
+
export type OperateHistory = {
|
|
196
241
|
changes: Partial<CellData>[];
|
|
197
242
|
type: OperateType;
|
|
198
243
|
rowInfo?: {
|
|
@@ -201,4 +246,4 @@ export declare type OperateHistory = {
|
|
|
201
246
|
};
|
|
202
247
|
extraInfo?: Record<string, unknown>;
|
|
203
248
|
};
|
|
204
|
-
export
|
|
249
|
+
export type OperateType = 'Edit' | 'Paste' | 'Delete' | 'DeleteRow' | 'NewRow' | 'Custom';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ReactNode } from
|
|
1
|
+
import { CSSProperties, ReactNode } from "../../node_modules/@types/react";
|
|
2
2
|
import { SheetType } from '.';
|
|
3
|
-
export
|
|
3
|
+
export type refAssertion = {
|
|
4
4
|
contains?: (target: EventTarget | null) => boolean;
|
|
5
5
|
focus?: () => boolean;
|
|
6
6
|
} & HTMLTableSectionElement;
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
7
|
+
export type CellFixed = SheetType.CellAlign;
|
|
8
|
+
export type RecordRowMap<T> = (value: unknown, record: Record<string, unknown>, index: number, colIndex?: number) => T;
|
|
9
|
+
export type ColumnProps = {
|
|
10
10
|
/**
|
|
11
11
|
* @description 对齐
|
|
12
12
|
* @default "left"
|
|
@@ -23,7 +23,7 @@ export declare type ColumnProps = {
|
|
|
23
23
|
*/
|
|
24
24
|
width?: string | number;
|
|
25
25
|
dataIndex?: string;
|
|
26
|
-
title: string | ReactNode
|
|
26
|
+
title: string | ReactNode;
|
|
27
27
|
titleConfig?: {
|
|
28
28
|
colSpan?: number;
|
|
29
29
|
className?: string;
|
|
@@ -34,26 +34,29 @@ export declare type ColumnProps = {
|
|
|
34
34
|
key?: string;
|
|
35
35
|
editable?: boolean | RecordRowMap<boolean>;
|
|
36
36
|
readonly?: boolean | RecordRowMap<boolean>;
|
|
37
|
+
allowClear?: boolean;
|
|
37
38
|
render?: SheetType.CellViewer;
|
|
38
39
|
editor?: SheetType.CellEditor;
|
|
40
|
+
searchKey?: (value: unknown, record: Record<string, unknown>) => string;
|
|
39
41
|
};
|
|
40
|
-
export
|
|
42
|
+
export type TableChange = {
|
|
43
|
+
col?: number;
|
|
41
44
|
row: number;
|
|
42
45
|
id: string;
|
|
43
46
|
key: string;
|
|
44
47
|
value: unknown;
|
|
45
48
|
};
|
|
46
|
-
export
|
|
49
|
+
export type TableRowSelection = {
|
|
47
50
|
rowSelected?: string[];
|
|
48
51
|
onChange?: (selectedRowKeys: string[], selectedRows: Record<string, unknown>[]) => void;
|
|
49
52
|
};
|
|
50
|
-
export
|
|
53
|
+
export type TableGroupConfig = {
|
|
51
54
|
defaultOpen?: boolean;
|
|
52
55
|
rowGroup?: SheetType.RowGroupConfig;
|
|
53
56
|
onChange?: (value: SheetType.RowGroupConfig) => void;
|
|
54
57
|
};
|
|
55
|
-
export
|
|
56
|
-
export
|
|
58
|
+
export type EventHandler = (value: any) => void;
|
|
59
|
+
export type TableProps = {
|
|
57
60
|
/**
|
|
58
61
|
* @description 表格类名
|
|
59
62
|
* @default "undefined"
|
|
@@ -67,6 +70,7 @@ export declare type TableProps = {
|
|
|
67
70
|
columns: ColumnProps[];
|
|
68
71
|
virtualized?: boolean;
|
|
69
72
|
dataSource: Record<string, unknown>[];
|
|
73
|
+
emptyRenderer?: any;
|
|
70
74
|
rowClassName?: string | ((record: Record<string, unknown>, index: number) => string);
|
|
71
75
|
rowKey?: string | ((record: Record<string, unknown>, index: number) => string);
|
|
72
76
|
scroll?: {
|
|
@@ -77,12 +81,17 @@ export declare type TableProps = {
|
|
|
77
81
|
draggable?: boolean;
|
|
78
82
|
freePaste?: boolean;
|
|
79
83
|
showBackEdit?: boolean;
|
|
80
|
-
backEditStyle?: Partial<
|
|
84
|
+
backEditStyle?: Partial<CSSProperties>;
|
|
85
|
+
searchStyle?: Partial<CSSProperties>;
|
|
81
86
|
rowSelection?: TableRowSelection;
|
|
82
87
|
groupConfig?: TableGroupConfig;
|
|
83
88
|
menuRenderer?: React.FC<SheetType.MenuRenderProps>;
|
|
84
89
|
onContextMenu?: (event: any) => void;
|
|
85
90
|
onChange: (changes: TableChange[], extChanges?: TableChange[]) => void;
|
|
86
91
|
handleAdd?: () => void;
|
|
92
|
+
handleBatchAdd?: (value: number) => void;
|
|
87
93
|
eventHandler?: Record<'reverse' | 'btn-click' | 'cell-edit' | 'cell-switch' | string, undefined | EventHandler>;
|
|
94
|
+
boldScroll?: boolean;
|
|
95
|
+
showQuickLocationBtn?: boolean;
|
|
96
|
+
ControlContainer?: React.FC;
|
|
88
97
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhenliang/sheet",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.73.beta.0",
|
|
4
4
|
"description": "A react library developed with dumi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -49,6 +49,8 @@
|
|
|
49
49
|
"events": "^3.3.0",
|
|
50
50
|
"lodash": "^4.17.21",
|
|
51
51
|
"moment": "^2.29.4",
|
|
52
|
+
"react": "17.x",
|
|
53
|
+
"react-dom": "17.x",
|
|
52
54
|
"redux-logger": "^3.0.6",
|
|
53
55
|
"redux-thunk": "^2.4.2"
|
|
54
56
|
},
|
|
@@ -56,8 +58,8 @@
|
|
|
56
58
|
"@commitlint/cli": "^17.1.2",
|
|
57
59
|
"@commitlint/config-conventional": "^17.1.0",
|
|
58
60
|
"@types/lodash": "^4.14.195",
|
|
59
|
-
"@types/react": "
|
|
60
|
-
"@types/react-dom": "
|
|
61
|
+
"@types/react": "17.0.40",
|
|
62
|
+
"@types/react-dom": "17.0.13",
|
|
61
63
|
"@umijs/lint": "^4.0.0",
|
|
62
64
|
"dumi": "^2.2.0",
|
|
63
65
|
"eslint": "^8.23.0",
|
|
@@ -78,5 +80,6 @@
|
|
|
78
80
|
},
|
|
79
81
|
"authors": [
|
|
80
82
|
"fizz.zhou@ap.jll.com"
|
|
81
|
-
]
|
|
83
|
+
],
|
|
84
|
+
"preid": "beta"
|
|
82
85
|
}
|