@zhenliang/sheet 0.1.22 → 0.1.24
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/core/config.d.ts +13 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +13 -0
- package/dist/core/editor/cascaderEditor/index.d.ts +5 -0
- package/dist/core/editor/cascaderEditor/index.d.ts.map +1 -0
- package/dist/core/editor/cascaderEditor/index.js +53 -0
- package/dist/core/editor/cascaderEditor/index.less +32 -0
- package/dist/core/editor/dateEditor/index.d.ts +5 -0
- package/dist/core/editor/dateEditor/index.d.ts.map +1 -0
- package/dist/core/editor/dateEditor/index.js +56 -0
- package/dist/core/editor/dateEditor/index.less +18 -0
- package/dist/core/editor/index.d.ts +4 -0
- package/dist/core/editor/index.d.ts.map +1 -0
- package/dist/core/editor/index.js +4 -0
- package/dist/core/editor/numberEditor/index.d.ts +8 -0
- package/dist/core/editor/numberEditor/index.d.ts.map +1 -0
- package/dist/core/editor/numberEditor/index.js +107 -0
- package/dist/core/editor/numberEditor/index.less +30 -0
- package/dist/core/editor/selectEditor/index.d.ts +6 -0
- package/dist/core/editor/selectEditor/index.d.ts.map +1 -0
- package/dist/core/editor/selectEditor/index.js +96 -0
- package/dist/core/editor/selectEditor/index.less +48 -0
- package/dist/core/reducers/index.d.ts +9 -0
- package/dist/core/reducers/index.d.ts.map +1 -0
- package/dist/core/reducers/index.js +38 -0
- package/dist/core/reducers/keyboardReducer.d.ts +2 -0
- package/dist/core/reducers/keyboardReducer.d.ts.map +1 -0
- package/dist/core/reducers/keyboardReducer.js +93 -0
- package/dist/core/reducers/mouseReducer.d.ts +2 -0
- package/dist/core/reducers/mouseReducer.d.ts.map +1 -0
- package/dist/core/reducers/mouseReducer.js +164 -0
- package/dist/core/reducers/sideEffectReducer.d.ts +4 -0
- package/dist/core/reducers/sideEffectReducer.d.ts.map +1 -0
- package/dist/core/reducers/sideEffectReducer.js +378 -0
- package/dist/core/reducers/stateReducer.d.ts +2 -0
- package/dist/core/reducers/stateReducer.d.ts.map +1 -0
- package/dist/core/reducers/stateReducer.js +174 -0
- package/dist/core/sheet/Cell.d.ts +4 -0
- package/dist/core/sheet/Cell.d.ts.map +1 -0
- package/dist/core/sheet/Cell.js +181 -0
- package/dist/core/sheet/DataEditor.d.ts +3 -0
- package/dist/core/sheet/DataEditor.d.ts.map +1 -0
- package/dist/core/sheet/DataEditor.js +24 -0
- package/dist/core/sheet/DefaultCell.d.ts +12 -0
- package/dist/core/sheet/DefaultCell.d.ts.map +1 -0
- package/dist/core/sheet/DefaultCell.js +31 -0
- package/dist/core/sheet/DefaultRow.d.ts +12 -0
- package/dist/core/sheet/DefaultRow.d.ts.map +1 -0
- package/dist/core/sheet/DefaultRow.js +28 -0
- package/dist/core/sheet/DefaultRowMapper.d.ts +8 -0
- package/dist/core/sheet/DefaultRowMapper.d.ts.map +1 -0
- package/dist/core/sheet/DefaultRowMapper.js +18 -0
- package/dist/core/sheet/DefaultShell.d.ts +8 -0
- package/dist/core/sheet/DefaultShell.d.ts.map +1 -0
- package/dist/core/sheet/DefaultShell.js +12 -0
- package/dist/core/sheet/Event.d.ts +5 -0
- package/dist/core/sheet/Event.d.ts.map +1 -0
- package/dist/core/sheet/Event.js +17 -0
- package/dist/core/sheet/ValueViewer.d.ts +3 -0
- package/dist/core/sheet/ValueViewer.d.ts.map +1 -0
- package/dist/core/sheet/ValueViewer.js +9 -0
- package/dist/core/sheet/index.d.ts +5 -0
- package/dist/core/sheet/index.d.ts.map +1 -0
- package/dist/core/sheet/index.js +262 -0
- package/dist/core/sheet/index.less +307 -0
- package/dist/core/sheet/useCellEvent.d.ts +3 -0
- package/dist/core/sheet/useCellEvent.d.ts.map +1 -0
- package/dist/core/sheet/useCellEvent.js +22 -0
- package/dist/core/sheet/useContextMenu.d.ts +21 -0
- package/dist/core/sheet/useContextMenu.d.ts.map +1 -0
- package/dist/core/sheet/useContextMenu.js +86 -0
- package/dist/core/sheet/useKeyBoardEvent.d.ts +3 -0
- package/dist/core/sheet/useKeyBoardEvent.d.ts.map +1 -0
- package/dist/core/sheet/useKeyBoardEvent.js +66 -0
- package/dist/core/sheet/useMouseEvent.d.ts +3 -0
- package/dist/core/sheet/useMouseEvent.d.ts.map +1 -0
- package/dist/core/sheet/useMouseEvent.js +298 -0
- package/dist/core/sheet/useSelectVisible.d.ts +2 -0
- package/dist/core/sheet/useSelectVisible.d.ts.map +1 -0
- package/dist/core/sheet/useSelectVisible.js +57 -0
- package/dist/core/sheet/useVirtualList.d.ts +7 -0
- package/dist/core/sheet/useVirtualList.d.ts.map +1 -0
- package/dist/core/sheet/useVirtualList.js +103 -0
- package/dist/core/sheet/var.less +41 -0
- package/dist/core/shell/draggableShell/index.d.ts +6 -0
- package/dist/core/shell/draggableShell/index.d.ts.map +1 -0
- package/dist/core/shell/draggableShell/index.js +197 -0
- package/dist/core/shell/draggableShell/index.less +16 -0
- package/dist/core/shell/tableShell.d.ts +6 -0
- package/dist/core/shell/tableShell.d.ts.map +1 -0
- package/dist/core/shell/tableShell.js +109 -0
- package/dist/core/table/events.d.ts +15 -0
- package/dist/core/table/events.d.ts.map +1 -0
- package/dist/core/table/events.js +95 -0
- package/dist/core/table/index.d.ts +4 -0
- package/dist/core/table/index.d.ts.map +1 -0
- package/dist/core/table/index.js +313 -0
- package/dist/core/table/useGroupConfig.d.ts +2 -0
- package/dist/core/table/useGroupConfig.d.ts.map +1 -0
- package/dist/core/table/useGroupConfig.js +65 -0
- package/dist/core/table/useRowSelection.d.ts +2 -0
- package/dist/core/table/useRowSelection.d.ts.map +1 -0
- package/dist/core/table/useRowSelection.js +24 -0
- package/dist/core/table/util.d.ts +8 -0
- package/dist/core/table/util.d.ts.map +1 -0
- package/dist/core/table/util.js +29 -0
- package/dist/core/util.d.ts +58 -0
- package/dist/core/util.d.ts.map +1 -0
- package/dist/core/util.js +457 -0
- package/dist/core/viewer/btnViewer/index.d.ts +2 -0
- package/dist/core/viewer/btnViewer/index.d.ts.map +1 -0
- package/dist/core/viewer/btnViewer/index.js +37 -0
- package/dist/core/viewer/cascaderViewer/index.d.ts +2 -0
- package/dist/core/viewer/cascaderViewer/index.d.ts.map +1 -0
- package/dist/core/viewer/cascaderViewer/index.js +16 -0
- package/dist/core/viewer/checkViewer/index.d.ts +2 -0
- package/dist/core/viewer/checkViewer/index.d.ts.map +1 -0
- package/dist/core/viewer/checkViewer/index.js +23 -0
- package/dist/core/viewer/editViewer/index.d.ts +2 -0
- package/dist/core/viewer/editViewer/index.d.ts.map +1 -0
- package/dist/core/viewer/editViewer/index.js +32 -0
- package/dist/core/viewer/groupViewer/index.d.ts +2 -0
- package/dist/core/viewer/groupViewer/index.d.ts.map +1 -0
- package/dist/core/viewer/groupViewer/index.js +38 -0
- package/dist/core/viewer/index.d.ts +7 -0
- package/dist/core/viewer/index.d.ts.map +1 -0
- package/dist/core/viewer/index.js +7 -0
- package/dist/core/viewer/selectorViewer/index.d.ts +2 -0
- package/dist/core/viewer/selectorViewer/index.d.ts.map +1 -0
- package/dist/core/viewer/selectorViewer/index.js +16 -0
- package/dist/core/viewer/switchViewer/index.d.ts +2 -0
- package/dist/core/viewer/switchViewer/index.d.ts.map +1 -0
- package/dist/core/viewer/switchViewer/index.js +22 -0
- package/dist/example/antComponent.d.ts +3 -0
- package/dist/example/antComponent.d.ts.map +1 -0
- package/dist/example/antComponent.js +313 -0
- package/dist/example/basic.d.ts +4 -0
- package/dist/example/basic.d.ts.map +1 -0
- package/dist/example/basic.js +121 -0
- package/dist/example/ellipsis.d.ts +3 -0
- package/dist/example/ellipsis.d.ts.map +1 -0
- package/dist/example/ellipsis.js +64 -0
- package/dist/example/fixed.d.ts +3 -0
- package/dist/example/fixed.d.ts.map +1 -0
- package/dist/example/fixed.js +89 -0
- package/dist/example/group.d.ts +3 -0
- package/dist/example/group.d.ts.map +1 -0
- package/dist/example/group.js +123 -0
- package/dist/example/index.less +5 -0
- package/dist/example/selection.d.ts +4 -0
- package/dist/example/selection.d.ts.map +1 -0
- package/dist/example/selection.js +86 -0
- package/dist/example/sheet.d.ts +4 -0
- package/dist/example/sheet.d.ts.map +1 -0
- package/dist/example/sheet.js +397 -0
- package/dist/example/valuationAnalyze.d.ts +3 -0
- package/dist/example/valuationAnalyze.d.ts.map +1 -0
- package/dist/example/valuationAnalyze.js +227 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/useEventBus.d.ts +4 -0
- package/dist/hooks/useEventBus.d.ts.map +1 -0
- package/dist/hooks/useEventBus.js +17 -0
- package/dist/hooks/useKeyboard.d.ts +18 -0
- package/dist/hooks/useKeyboard.d.ts.map +1 -0
- package/dist/hooks/useKeyboard.js +108 -0
- package/dist/hooks/useMiddlewareReducer.d.ts +12 -0
- package/dist/hooks/useMiddlewareReducer.d.ts.map +1 -0
- package/dist/hooks/useMiddlewareReducer.js +47 -0
- package/dist/hooks/useMouse.d.ts +11 -0
- package/dist/hooks/useMouse.d.ts.map +1 -0
- package/dist/hooks/useMouse.js +68 -0
- package/dist/hooks/useSetState.d.ts +2 -0
- package/dist/hooks/useSetState.d.ts.map +1 -0
- package/dist/hooks/useSetState.js +27 -0
- package/dist/hooks/useSheetEvent.d.ts +5 -0
- package/dist/hooks/useSheetEvent.d.ts.map +1 -0
- package/dist/hooks/useSheetEvent.js +5 -0
- package/dist/hooks/useWidthConfig.d.ts +4 -0
- package/dist/hooks/useWidthConfig.d.ts.map +1 -0
- package/dist/hooks/useWidthConfig.js +5 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/standardUtils/index.d.ts +9 -0
- package/dist/standardUtils/index.d.ts.map +1 -0
- package/dist/standardUtils/index.js +32 -0
- package/dist/type/index.d.ts +2 -0
- package/dist/type/index.d.ts.map +1 -0
- package/dist/type/index.js +4 -0
- package/dist/type/sheet.d.ts +205 -0
- package/dist/type/sheet.d.ts.map +1 -0
- package/dist/type/sheet.js +9 -0
- package/dist/type/sheetTable.d.ts +89 -0
- package/dist/type/sheetTable.d.ts.map +1 -0
- package/dist/type/sheetTable.js +1 -0
- package/dist/typings/index.d.ts +1 -0
- package/package.json +1 -1
- package/changes.md +0 -45
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type ValueParams = string | number | null | undefined;
|
|
2
|
+
export declare const formatPrecision: (value: ValueParams, precision?: number) => string;
|
|
3
|
+
/**
|
|
4
|
+
* 千位分隔符
|
|
5
|
+
* @param value 需要千分符格式化的数据
|
|
6
|
+
* @returns 含千分符的字符串
|
|
7
|
+
*/
|
|
8
|
+
export declare const thousandsSeparator: (value: string | number) => string;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAEtD,eAAO,MAAM,eAAe,UAAW,WAAW,+BASjD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,UAAW,MAAM,GAAG,MAAM,WAOxD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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
|
+
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
|
+
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(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
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
export var formatPrecision = function formatPrecision(value) {
|
|
8
|
+
var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
9
|
+
if (Number.isNaN(Number(value)) || value === null || value === 0) {
|
|
10
|
+
return '0';
|
|
11
|
+
}
|
|
12
|
+
var b = Math.pow(10, precision);
|
|
13
|
+
var res = Math.round(Number(value) * b) / b;
|
|
14
|
+
return res.toFixed(precision);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 千位分隔符
|
|
19
|
+
* @param value 需要千分符格式化的数据
|
|
20
|
+
* @returns 含千分符的字符串
|
|
21
|
+
*/
|
|
22
|
+
export var thousandsSeparator = function thousandsSeparator(value) {
|
|
23
|
+
var _String$split = String(value).split('.'),
|
|
24
|
+
_String$split2 = _slicedToArray(_String$split, 2),
|
|
25
|
+
integer = _String$split2[0],
|
|
26
|
+
decimal = _String$split2[1];
|
|
27
|
+
var formattedData = integer === null || integer === void 0 ? void 0 : integer.replace(/(\d{1,3})(?=(\d{3})+$)/g, '$1,');
|
|
28
|
+
if (decimal && decimal.length) {
|
|
29
|
+
formattedData += ".".concat(decimal);
|
|
30
|
+
}
|
|
31
|
+
return formattedData;
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,cAAc,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import type { EventEmitter } from 'events';
|
|
4
|
+
import { SheetTableType, SheetType } from '.';
|
|
5
|
+
export declare enum CellAlign {
|
|
6
|
+
left = "left",
|
|
7
|
+
center = "center",
|
|
8
|
+
right = "right",
|
|
9
|
+
unset = "unset"
|
|
10
|
+
}
|
|
11
|
+
export type Cell = {
|
|
12
|
+
id: string;
|
|
13
|
+
key?: string;
|
|
14
|
+
readonly?: boolean;
|
|
15
|
+
component?: CellViewer;
|
|
16
|
+
editable?: boolean;
|
|
17
|
+
colSpan?: number;
|
|
18
|
+
rowSpan?: number;
|
|
19
|
+
width?: number;
|
|
20
|
+
record?: Record<string, unknown>;
|
|
21
|
+
disableEvents?: boolean;
|
|
22
|
+
dataEditor?: CellEditor;
|
|
23
|
+
valueViewer?: CellViewer;
|
|
24
|
+
className?: string;
|
|
25
|
+
align?: CellAlign;
|
|
26
|
+
fixed?: Omit<CellAlign, 'center'>;
|
|
27
|
+
value?: string | number | null;
|
|
28
|
+
};
|
|
29
|
+
export type CellViewerProps = {
|
|
30
|
+
value: unknown;
|
|
31
|
+
record?: Record<string, unknown>;
|
|
32
|
+
row?: number;
|
|
33
|
+
col?: number;
|
|
34
|
+
cell?: Cell;
|
|
35
|
+
};
|
|
36
|
+
export type CellEditorProps = {
|
|
37
|
+
value: unknown;
|
|
38
|
+
cell?: Cell;
|
|
39
|
+
onChange: (value: unknown) => void;
|
|
40
|
+
onConfirm: (value: unknown) => void;
|
|
41
|
+
} & CellViewerProps;
|
|
42
|
+
export type CellEditor = React.FC<CellEditorProps> & {
|
|
43
|
+
checker?: (value: unknown, record?: Record<string, unknown>) => boolean;
|
|
44
|
+
formatter?: (value: unknown, record?: Record<string, unknown>) => unknown;
|
|
45
|
+
parser?: (value: unknown, record?: Record<string, unknown>) => unknown;
|
|
46
|
+
};
|
|
47
|
+
export type CellViewer = React.FC<CellViewerProps>;
|
|
48
|
+
export type CellPosition = {
|
|
49
|
+
row: number;
|
|
50
|
+
col: number;
|
|
51
|
+
};
|
|
52
|
+
export type CellData = {
|
|
53
|
+
id: string;
|
|
54
|
+
cell: Cell;
|
|
55
|
+
row: number;
|
|
56
|
+
col: number;
|
|
57
|
+
value?: string;
|
|
58
|
+
};
|
|
59
|
+
export type CellNavigable = (cell?: Cell, row?: number, col?: number) => boolean;
|
|
60
|
+
export type CellChangeHandler = (cells: CellData[], additions?: CellData[]) => void;
|
|
61
|
+
export type RowGroup = {
|
|
62
|
+
groupName: string;
|
|
63
|
+
groupStart: number;
|
|
64
|
+
groupEnd: number;
|
|
65
|
+
};
|
|
66
|
+
export type RowGroupConfig = {
|
|
67
|
+
defaultOpen?: boolean;
|
|
68
|
+
groups: RowGroup[];
|
|
69
|
+
groupOpen: boolean[];
|
|
70
|
+
};
|
|
71
|
+
export type MenuRenderProps = {
|
|
72
|
+
position?: {
|
|
73
|
+
top: number;
|
|
74
|
+
left: number;
|
|
75
|
+
};
|
|
76
|
+
cell?: CellPosition;
|
|
77
|
+
onContextMenu?: (event: any) => void;
|
|
78
|
+
};
|
|
79
|
+
export type SheetInstance = {
|
|
80
|
+
zoomTo: (row?: number) => void;
|
|
81
|
+
pushToHistory: (value: OperateHistory) => void;
|
|
82
|
+
selectRow: (row?: number) => void;
|
|
83
|
+
select: (props: {
|
|
84
|
+
start: SheetType.CellPosition;
|
|
85
|
+
end: SheetType.CellPosition;
|
|
86
|
+
}) => void;
|
|
87
|
+
popHistory: () => OperateHistory;
|
|
88
|
+
};
|
|
89
|
+
export type SheetProps = {
|
|
90
|
+
sheetInstance?: React.MutableRefObject<SheetInstance | null>;
|
|
91
|
+
sheetRenderer?: any;
|
|
92
|
+
rowRenderer?: any;
|
|
93
|
+
className?: string;
|
|
94
|
+
data: Cell[][];
|
|
95
|
+
freePaste?: boolean;
|
|
96
|
+
virtualized?: boolean;
|
|
97
|
+
showBackEdit?: boolean;
|
|
98
|
+
backEditStyle?: Partial<CSSStyleDeclaration>;
|
|
99
|
+
sticky?: boolean;
|
|
100
|
+
groupConfig?: RowGroupConfig;
|
|
101
|
+
onCellsChanged?: CellChangeHandler;
|
|
102
|
+
menuRenderer?: React.FC<MenuRenderProps>;
|
|
103
|
+
onContextMenu?: (event: any) => void;
|
|
104
|
+
scroll?: {
|
|
105
|
+
x?: number | string;
|
|
106
|
+
y?: number | string;
|
|
107
|
+
};
|
|
108
|
+
rowClassName?: string | ((record: Record<string, unknown>, index: number) => string);
|
|
109
|
+
children?: any[];
|
|
110
|
+
};
|
|
111
|
+
export type WidthConfig = {
|
|
112
|
+
onChange?: (value: Record<number | string, number>) => void;
|
|
113
|
+
widths?: Record<number | string, number>;
|
|
114
|
+
};
|
|
115
|
+
export type SheetShell = Pick<SheetTableType.TableProps, 'columns'> & {
|
|
116
|
+
className?: string;
|
|
117
|
+
showGroup?: boolean;
|
|
118
|
+
showSelect?: boolean;
|
|
119
|
+
controlWidth?: number;
|
|
120
|
+
controlProps?: {
|
|
121
|
+
check?: {
|
|
122
|
+
checked: boolean;
|
|
123
|
+
indeterminate?: boolean;
|
|
124
|
+
};
|
|
125
|
+
group?: {
|
|
126
|
+
open: boolean;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
export type SheetRow = {
|
|
131
|
+
row: number;
|
|
132
|
+
cells: Cell[];
|
|
133
|
+
selected: boolean;
|
|
134
|
+
children: React.ElementType;
|
|
135
|
+
};
|
|
136
|
+
export type windowAssertion = {
|
|
137
|
+
clipboardData?: {
|
|
138
|
+
getData?: (type: string) => string;
|
|
139
|
+
setData?: (type: string, data: string) => string;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
export type refAssertion = {
|
|
143
|
+
contains?: (target: EventTarget | null) => boolean;
|
|
144
|
+
focus?: () => boolean;
|
|
145
|
+
} & HTMLSpanElement;
|
|
146
|
+
export type AttributesRenderer = (cell: Cell, row: number, col: number) => Record<string, string>;
|
|
147
|
+
export type CellProps = {
|
|
148
|
+
row: number;
|
|
149
|
+
col: number;
|
|
150
|
+
cell: Cell;
|
|
151
|
+
cellRenderer?: React.ElementType;
|
|
152
|
+
dataEditor?: React.ElementType;
|
|
153
|
+
valueViewer?: React.ElementType;
|
|
154
|
+
attributesRenderer?: AttributesRenderer;
|
|
155
|
+
};
|
|
156
|
+
export type UpdateStateType = {
|
|
157
|
+
eventBus: EventEmitter;
|
|
158
|
+
start: CellPosition;
|
|
159
|
+
end: CellPosition;
|
|
160
|
+
selecting: boolean;
|
|
161
|
+
forceEdit: boolean;
|
|
162
|
+
clear: CellPosition;
|
|
163
|
+
editing: CellPosition & {
|
|
164
|
+
value?: string;
|
|
165
|
+
};
|
|
166
|
+
history: OperateHistory[];
|
|
167
|
+
freePaste?: boolean;
|
|
168
|
+
data: Cell[][];
|
|
169
|
+
mouseDown: boolean;
|
|
170
|
+
lastSelected?: {
|
|
171
|
+
start?: CellPosition;
|
|
172
|
+
end?: CellPosition;
|
|
173
|
+
};
|
|
174
|
+
groupConfig?: {
|
|
175
|
+
groups: RowGroup[];
|
|
176
|
+
groupOpen: boolean[];
|
|
177
|
+
};
|
|
178
|
+
lastFocus: {
|
|
179
|
+
id: string;
|
|
180
|
+
col: number;
|
|
181
|
+
}[];
|
|
182
|
+
lastEditing: CellPosition & {
|
|
183
|
+
confirm?: boolean;
|
|
184
|
+
};
|
|
185
|
+
cellChangeHandler: (cells: CellData[], additions?: CellData[]) => void;
|
|
186
|
+
};
|
|
187
|
+
export type UpdateFocus = (start: CellPosition, end: CellPosition) => void;
|
|
188
|
+
export type Options<T = any> = {
|
|
189
|
+
value: string | number;
|
|
190
|
+
label: string;
|
|
191
|
+
} & T;
|
|
192
|
+
export type OptionsType = Options<{
|
|
193
|
+
disabled?: boolean;
|
|
194
|
+
children?: OptionsType[];
|
|
195
|
+
}>;
|
|
196
|
+
export type OperateHistory = {
|
|
197
|
+
changes: Partial<CellData>[];
|
|
198
|
+
type: OperateType;
|
|
199
|
+
rowInfo?: {
|
|
200
|
+
newRow?: number;
|
|
201
|
+
deleteRow?: number;
|
|
202
|
+
};
|
|
203
|
+
extraInfo?: Record<string, unknown>;
|
|
204
|
+
};
|
|
205
|
+
export type OperateType = 'Edit' | 'Paste' | 'Delete' | 'DeleteRow' | 'NewRow' | 'Custom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["sheet.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAE9C,oBAAY,SAAS;IACnB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,SAAS,CAAC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AG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACzC,WAAW,EAAE,YAAY,GAAG;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAClD,iBAAiB,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;CACxE,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,KAAK,IAAI,CAAC;AAE3E,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,GAAG,IAAI;IAC7B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,CAAC,CAAC;AAEN,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;CAC1B,CAAC,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC7B,IAAI,EAAE,WAAW,CAAC;IAElB,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,WAAW,GAEnB,MAAM,GACN,OAAO,GACP,QAAQ,GAER,WAAW,GACX,QAAQ,GACR,QAAQ,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SheetType } from '.';
|
|
3
|
+
export type refAssertion = {
|
|
4
|
+
contains?: (target: EventTarget | null) => boolean;
|
|
5
|
+
focus?: () => boolean;
|
|
6
|
+
} & HTMLTableSectionElement;
|
|
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
|
+
/**
|
|
11
|
+
* @description 对齐
|
|
12
|
+
* @default "left"
|
|
13
|
+
*/
|
|
14
|
+
align?: SheetType.CellAlign;
|
|
15
|
+
/**
|
|
16
|
+
* @description 固定
|
|
17
|
+
* @default "undefined"
|
|
18
|
+
*/
|
|
19
|
+
fixed?: Omit<CellFixed, 'center'>;
|
|
20
|
+
/**
|
|
21
|
+
* @description 列宽
|
|
22
|
+
* @default "undefined"
|
|
23
|
+
*/
|
|
24
|
+
width?: string | number;
|
|
25
|
+
dataIndex?: string;
|
|
26
|
+
title: string | ReactNode | ReactNode[] | React.FC;
|
|
27
|
+
titleConfig?: {
|
|
28
|
+
colSpan?: number;
|
|
29
|
+
className?: string;
|
|
30
|
+
};
|
|
31
|
+
cellConfig?: {
|
|
32
|
+
className?: string | RecordRowMap<string>;
|
|
33
|
+
};
|
|
34
|
+
key?: string;
|
|
35
|
+
editable?: boolean | RecordRowMap<boolean>;
|
|
36
|
+
readonly?: boolean | RecordRowMap<boolean>;
|
|
37
|
+
render?: SheetType.CellViewer;
|
|
38
|
+
editor?: SheetType.CellEditor;
|
|
39
|
+
};
|
|
40
|
+
export type TableChange = {
|
|
41
|
+
col?: number;
|
|
42
|
+
row: number;
|
|
43
|
+
id: string;
|
|
44
|
+
key: string;
|
|
45
|
+
value: unknown;
|
|
46
|
+
};
|
|
47
|
+
export type TableRowSelection = {
|
|
48
|
+
rowSelected?: string[];
|
|
49
|
+
onChange?: (selectedRowKeys: string[], selectedRows: Record<string, unknown>[]) => void;
|
|
50
|
+
};
|
|
51
|
+
export type TableGroupConfig = {
|
|
52
|
+
defaultOpen?: boolean;
|
|
53
|
+
rowGroup?: SheetType.RowGroupConfig;
|
|
54
|
+
onChange?: (value: SheetType.RowGroupConfig) => void;
|
|
55
|
+
};
|
|
56
|
+
export type EventHandler = (value: any) => void;
|
|
57
|
+
export type TableProps = {
|
|
58
|
+
/**
|
|
59
|
+
* @description 表格类名
|
|
60
|
+
* @default "undefined"
|
|
61
|
+
*/
|
|
62
|
+
className?: string;
|
|
63
|
+
/**
|
|
64
|
+
* @description sheet的一些定义方法可执行
|
|
65
|
+
* @default "object"
|
|
66
|
+
*/
|
|
67
|
+
sheetInstance?: React.MutableRefObject<SheetType.SheetInstance | null>;
|
|
68
|
+
columns: ColumnProps[];
|
|
69
|
+
virtualized?: boolean;
|
|
70
|
+
dataSource: Record<string, unknown>[];
|
|
71
|
+
rowClassName?: string | ((record: Record<string, unknown>, index: number) => string);
|
|
72
|
+
rowKey?: string | ((record: Record<string, unknown>, index: number) => string);
|
|
73
|
+
scroll?: {
|
|
74
|
+
x?: number | string;
|
|
75
|
+
y?: number | string;
|
|
76
|
+
};
|
|
77
|
+
sticky?: boolean;
|
|
78
|
+
draggable?: boolean;
|
|
79
|
+
freePaste?: boolean;
|
|
80
|
+
showBackEdit?: boolean;
|
|
81
|
+
backEditStyle?: Partial<CSSStyleDeclaration>;
|
|
82
|
+
rowSelection?: TableRowSelection;
|
|
83
|
+
groupConfig?: TableGroupConfig;
|
|
84
|
+
menuRenderer?: React.FC<SheetType.MenuRenderProps>;
|
|
85
|
+
onContextMenu?: (event: any) => void;
|
|
86
|
+
onChange: (changes: TableChange[], extChanges?: TableChange[]) => void;
|
|
87
|
+
handleAdd?: () => void;
|
|
88
|
+
eventHandler?: Record<'reverse' | 'btn-click' | 'cell-edit' | 'cell-switch' | string, undefined | EventHandler>;
|
|
89
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheetTable.d.ts","sourceRoot":"","sources":["sheetTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAE9B,MAAM,MAAM,Y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EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IACjE,MAAM,CAAC,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACtD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC7C,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAE/B,YAAY,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACnD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAErC,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,UAAU,CAAC,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;IACvE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CACnB,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,aAAa,GAAG,MAAM,EAC9D,SAAS,GAAG,YAAY,CACzB,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module '*.less';
|
package/package.json
CHANGED
package/changes.md
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
### 为什么要重写
|
|
2
|
-
|
|
3
|
-
#### 存在问题
|
|
4
|
-
|
|
5
|
-
1、表格选择逻辑与虚拟列表的冲突
|
|
6
|
-
2、表格的刷新机制: setRefresh(在多人开发的时候不便维护)
|
|
7
|
-
3、回调地狱
|
|
8
|
-
4、无法从 jll-portal 中剥离,有些地方与业务字段耦合
|
|
9
|
-
|
|
10
|
-
#### 后果
|
|
11
|
-
|
|
12
|
-
1、新增功能难度大
|
|
13
|
-
2、修改容易出 bug
|
|
14
|
-
3、不利于业务代码优化和重构
|
|
15
|
-
|
|
16
|
-
### 重写后的表格
|
|
17
|
-
|
|
18
|
-
#### 优点
|
|
19
|
-
|
|
20
|
-
1、维护性
|
|
21
|
-
2、扩展性
|
|
22
|
-
3、新的功能
|
|
23
|
-
|
|
24
|
-
#### 新的 API
|
|
25
|
-
|
|
26
|
-
1、TableProps
|
|
27
|
-
|
|
28
|
-
| 表头 | 表头 | 表头 |
|
|
29
|
-
| -------------------------------------------- | ----------------------- | ---- |
|
|
30
|
-
| className | container 类名 | 无 | |
|
|
31
|
-
| | sheetInstance | sheet 对外暴露的一些 API | 选中行,参与回滚等 | |
|
|
32
|
-
|
|
33
|
-
| columns | 表格列 | 无 ,必填 |
|
|
34
|
-
| dataSource | 数据源 | 无,必填 |
|
|
35
|
-
| virtualized |虚拟列表 | false |
|
|
36
|
-
| draggable | 列宽可调整 | false |
|
|
37
|
-
| rowClassName | 行类名 | 无 |
|
|
38
|
-
| rowKey | 唯一标识字段 | key , id |
|
|
39
|
-
| scroll | 同 antd table | {y:Math.min(400,row \* 40)} |
|
|
40
|
-
| rowSelection | 选中行的配置 | 尚未完全实现 |
|
|
41
|
-
| groupConfig | 表格分组 | 表格内部自动支持,对外配置尚未完全实现 |
|
|
42
|
-
| onChange | 表格 cell change handler | 无 |
|
|
43
|
-
| eventHandler | 自定义事件 handler | Record<string,(value:unknown)=>void> |
|
|
44
|
-
|
|
45
|
-
2、 ColumnProps
|