@zhenliang/sheet 0.0.1 → 0.0.3
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/editor/cascaderEditor/index.d.ts +5 -0
- package/dist/core/editor/cascaderEditor/index.js +36 -55
- package/dist/core/editor/dateEditor/index.d.ts +4 -0
- package/dist/core/editor/dateEditor/index.less +4 -0
- package/dist/core/editor/index.d.ts +4 -0
- package/dist/core/editor/index.js +4 -0
- package/dist/core/editor/numberEditor/index.d.ts +6 -0
- package/dist/core/editor/numberEditor/index.js +29 -0
- package/dist/core/editor/selectEditor/index.d.ts +5 -0
- package/dist/core/editor/selectEditor/index.js +2 -2
- package/dist/core/reducers/index.d.ts +9 -0
- package/dist/core/reducers/keyboardReducer.d.ts +2 -0
- package/dist/core/reducers/mouseReducer.d.ts +2 -0
- package/dist/core/reducers/sideEffectReducer.d.ts +4 -0
- package/dist/core/reducers/stateReducer.d.ts +2 -0
- package/dist/core/sheet/Cell.d.ts +4 -0
- package/dist/core/sheet/Cell.js +4 -6
- package/dist/core/sheet/DataEditor.d.ts +3 -0
- package/dist/core/sheet/DefaultCell.d.ts +11 -0
- package/dist/core/sheet/DefaultRow.d.ts +11 -0
- package/dist/core/sheet/DefaultRowMapper.d.ts +8 -0
- package/dist/core/sheet/DefaultShell.d.ts +8 -0
- package/dist/core/sheet/Event.d.ts +5 -0
- package/dist/core/sheet/Event.js +1 -1
- package/dist/core/sheet/ValueViewer.d.ts +3 -0
- package/dist/core/sheet/index.d.ts +5 -0
- package/dist/core/sheet/index.less +6 -1
- package/dist/core/sheet/useCellEvent.d.ts +3 -0
- package/dist/core/sheet/useContextMenu.d.ts +21 -0
- package/dist/core/sheet/useKeyBoardEvent.d.ts +3 -0
- package/dist/core/sheet/useMouseEvent.d.ts +3 -0
- package/dist/core/sheet/useVirtualList.d.ts +7 -0
- package/dist/core/shell/draggableShell/index.d.ts +6 -0
- package/dist/core/shell/tableShell.d.ts +6 -0
- package/dist/core/table/index.d.ts +4 -0
- package/dist/core/table/index.js +10 -3
- package/dist/core/table/useGroupConfig.d.ts +2 -0
- package/dist/core/table/useRowSelection.d.ts +1 -0
- package/dist/core/table/util.d.ts +8 -0
- package/dist/core/util.d.ts +55 -0
- package/dist/core/util.js +1 -0
- package/dist/core/viewer/btnViewer/index.d.ts +2 -0
- package/dist/core/viewer/btnViewer/index.js +37 -0
- package/dist/core/viewer/checkViewer/index.d.ts +2 -0
- package/dist/core/viewer/editViewer/index.d.ts +2 -0
- package/dist/core/viewer/editViewer/index.js +31 -0
- package/dist/core/viewer/groupViewer/index.d.ts +2 -0
- package/dist/core/viewer/index.d.ts +5 -0
- package/dist/core/viewer/index.js +5 -0
- package/dist/core/viewer/switchViewer/index.d.ts +2 -0
- package/dist/core/viewer/switchViewer/index.js +22 -0
- package/dist/example/antComponent.d.ts +3 -0
- package/dist/example/antComponent.js +216 -0
- package/dist/example/basic.d.ts +4 -0
- package/dist/example/ellipsis.d.ts +3 -0
- package/dist/example/fixed.d.ts +3 -0
- package/dist/example/group.d.ts +3 -0
- package/dist/example/selection.d.ts +4 -0
- package/dist/example/sheet.d.ts +4 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/useEventBus.d.ts +4 -0
- package/dist/hooks/useKeyboard.d.ts +18 -0
- package/dist/hooks/useMiddlewareReducer.d.ts +12 -0
- package/dist/hooks/useMouse.d.ts +11 -0
- package/dist/hooks/useSetState.d.ts +2 -0
- package/dist/hooks/useSheetEvent.d.ts +5 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -1
- package/dist/standardUtils/index.d.ts +9 -0
- package/dist/type/index.d.ts +2 -0
- package/dist/type/index.js +4 -0
- package/dist/type/sheet.d.ts +191 -0
- package/dist/type/sheet.js +8 -0
- package/dist/type/sheetTable.d.ts +55 -0
- package/dist/type/sheetTable.js +1 -0
- package/package.json +4 -4
- package/dist/core/shell/resizeShell.js +0 -57
- package/dist/example/draggable.js +0 -0
- package/dist/typings/sheet.d.ts +0 -209
- package/dist/typings/table.js +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useSheetEvent } from "../../../hooks";
|
|
2
|
+
import { Button, Divider } from 'antd';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
export var BtnViewer = function BtnViewer(props) {
|
|
7
|
+
var value = props.value,
|
|
8
|
+
row = props.row,
|
|
9
|
+
record = props.record;
|
|
10
|
+
var eventBus = useSheetEvent();
|
|
11
|
+
var handleClick = useCallback(function (event) {
|
|
12
|
+
eventBus && eventBus.emit('btn-click', event);
|
|
13
|
+
}, [eventBus, row, record, value]);
|
|
14
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
15
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
16
|
+
type: "link",
|
|
17
|
+
onClick: function onClick() {
|
|
18
|
+
return handleClick({
|
|
19
|
+
row: row,
|
|
20
|
+
type: 'copy'
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
children: "\u590D\u5236"
|
|
24
|
+
}, "copy"), /*#__PURE__*/_jsx(Divider, {
|
|
25
|
+
type: "vertical"
|
|
26
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
27
|
+
type: "link",
|
|
28
|
+
onClick: function onClick() {
|
|
29
|
+
return handleClick({
|
|
30
|
+
row: row,
|
|
31
|
+
type: 'delete'
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
children: "\u5220\u9664"
|
|
35
|
+
}, "delete")]
|
|
36
|
+
});
|
|
37
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { EditFilled } from '@ant-design/icons';
|
|
2
|
+
import { useSheetEvent } from "../../../hooks";
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
export var EditViewer = function EditViewer(props) {
|
|
7
|
+
var value = props.value,
|
|
8
|
+
row = props.row,
|
|
9
|
+
record = props.record;
|
|
10
|
+
var eventBus = useSheetEvent();
|
|
11
|
+
var handleClick = useCallback(function () {
|
|
12
|
+
if (!eventBus) return;
|
|
13
|
+
eventBus.emit('cell-edit', {
|
|
14
|
+
row: row,
|
|
15
|
+
record: record,
|
|
16
|
+
value: value
|
|
17
|
+
});
|
|
18
|
+
}, [eventBus, row, record, value]);
|
|
19
|
+
return /*#__PURE__*/_jsxs("span", {
|
|
20
|
+
style: {
|
|
21
|
+
display: 'flex',
|
|
22
|
+
justifyContent: 'space-between',
|
|
23
|
+
color: 'green'
|
|
24
|
+
},
|
|
25
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
26
|
+
children: value
|
|
27
|
+
}), /*#__PURE__*/_jsx(EditFilled, {
|
|
28
|
+
onClick: handleClick
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
31
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useSheetEvent } from "../../../hooks";
|
|
2
|
+
import { Switch } from 'antd';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
export var SwitchViewer = function SwitchViewer(props) {
|
|
6
|
+
var value = props.value,
|
|
7
|
+
row = props.row,
|
|
8
|
+
record = props.record;
|
|
9
|
+
var eventBus = useSheetEvent();
|
|
10
|
+
var handleChange = useCallback(function () {
|
|
11
|
+
if (!eventBus) return;
|
|
12
|
+
eventBus.emit('cell-switch', {
|
|
13
|
+
row: row,
|
|
14
|
+
record: record,
|
|
15
|
+
value: value
|
|
16
|
+
});
|
|
17
|
+
}, [eventBus, row, record, value]);
|
|
18
|
+
return /*#__PURE__*/_jsx(Switch, {
|
|
19
|
+
checked: value,
|
|
20
|
+
onChange: handleChange
|
|
21
|
+
});
|
|
22
|
+
};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
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."); }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
import { Modal } from 'antd';
|
|
18
|
+
import React, { useState } from 'react';
|
|
19
|
+
import { DateEditor, getCascaderEditor, getNumberEditor, getSelectEditor } from "../core/editor";
|
|
20
|
+
import Table from "../core/table";
|
|
21
|
+
import { BtnViewer } from "../core/viewer/btnViewer";
|
|
22
|
+
import { EditViewer } from "../core/viewer/editViewer";
|
|
23
|
+
import { SwitchViewer } from "../core/viewer/switchViewer";
|
|
24
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
|
+
var Precision2MoneyEditor = getNumberEditor({
|
|
26
|
+
max: 1000,
|
|
27
|
+
min: 0,
|
|
28
|
+
precision: 2,
|
|
29
|
+
addonAfter: '元'
|
|
30
|
+
});
|
|
31
|
+
var Precision2Number = getNumberEditor({
|
|
32
|
+
max: 1000,
|
|
33
|
+
min: 0,
|
|
34
|
+
precision: 2
|
|
35
|
+
});
|
|
36
|
+
var TypeSelector = getSelectEditor([{
|
|
37
|
+
value: '1',
|
|
38
|
+
label: '111111'
|
|
39
|
+
}, {
|
|
40
|
+
value: '2',
|
|
41
|
+
label: '222222'
|
|
42
|
+
}, {
|
|
43
|
+
value: '3',
|
|
44
|
+
label: '333333'
|
|
45
|
+
}]);
|
|
46
|
+
var CascaderSelector = getCascaderEditor([{
|
|
47
|
+
value: 'zhejiang',
|
|
48
|
+
label: 'Zhejiang',
|
|
49
|
+
children: [{
|
|
50
|
+
value: 'hangzhou',
|
|
51
|
+
label: 'Hangzhou',
|
|
52
|
+
children: [{
|
|
53
|
+
value: 'xihu',
|
|
54
|
+
label: 'West Lake'
|
|
55
|
+
}]
|
|
56
|
+
}]
|
|
57
|
+
}, {
|
|
58
|
+
value: 'jiangsu',
|
|
59
|
+
label: 'Jiangsu',
|
|
60
|
+
children: [{
|
|
61
|
+
value: 'nanjing',
|
|
62
|
+
label: 'Nanjing',
|
|
63
|
+
children: [{
|
|
64
|
+
value: 'zhonghuamen',
|
|
65
|
+
label: 'Zhong Hua Men'
|
|
66
|
+
}]
|
|
67
|
+
}]
|
|
68
|
+
}]);
|
|
69
|
+
var columns = [{
|
|
70
|
+
title: 'Full Name',
|
|
71
|
+
width: 100,
|
|
72
|
+
dataIndex: 'open',
|
|
73
|
+
key: 'open',
|
|
74
|
+
fixed: 'left',
|
|
75
|
+
render: SwitchViewer
|
|
76
|
+
}, {
|
|
77
|
+
title: 'Age',
|
|
78
|
+
width: 100,
|
|
79
|
+
dataIndex: 'age',
|
|
80
|
+
key: 'age',
|
|
81
|
+
editor: Precision2Number,
|
|
82
|
+
readonly: function readonly(value, record, row) {
|
|
83
|
+
return row === 1;
|
|
84
|
+
}
|
|
85
|
+
// fixed: 'left',
|
|
86
|
+
}, {
|
|
87
|
+
title: 'price',
|
|
88
|
+
width: 100,
|
|
89
|
+
dataIndex: 'price',
|
|
90
|
+
key: 'price',
|
|
91
|
+
editor: Precision2MoneyEditor,
|
|
92
|
+
readonly: function readonly(value, record, row) {
|
|
93
|
+
return row === 1;
|
|
94
|
+
}
|
|
95
|
+
// fixed: 'left',
|
|
96
|
+
}, {
|
|
97
|
+
title: 'date',
|
|
98
|
+
width: 150,
|
|
99
|
+
dataIndex: 'date',
|
|
100
|
+
key: 'date',
|
|
101
|
+
editor: DateEditor
|
|
102
|
+
// fixed: 'left',
|
|
103
|
+
}, {
|
|
104
|
+
title: 'select',
|
|
105
|
+
width: 200,
|
|
106
|
+
dataIndex: 'select',
|
|
107
|
+
editor: TypeSelector
|
|
108
|
+
}, {
|
|
109
|
+
title: 'Column 2',
|
|
110
|
+
width: 200,
|
|
111
|
+
dataIndex: 'address1',
|
|
112
|
+
key: '2',
|
|
113
|
+
editor: CascaderSelector
|
|
114
|
+
}, {
|
|
115
|
+
title: 'Column 3',
|
|
116
|
+
width: 200,
|
|
117
|
+
dataIndex: 'address2',
|
|
118
|
+
key: '3',
|
|
119
|
+
editable: false,
|
|
120
|
+
render: EditViewer
|
|
121
|
+
}, {
|
|
122
|
+
title: 'Column 4',
|
|
123
|
+
width: 200,
|
|
124
|
+
dataIndex: 'address3',
|
|
125
|
+
key: '4'
|
|
126
|
+
}, {
|
|
127
|
+
title: 'Column 5',
|
|
128
|
+
width: 200,
|
|
129
|
+
dataIndex: 'address4',
|
|
130
|
+
key: '5'
|
|
131
|
+
}, {
|
|
132
|
+
title: 'Column 6',
|
|
133
|
+
width: 200,
|
|
134
|
+
dataIndex: 'address5',
|
|
135
|
+
key: '6'
|
|
136
|
+
}, {
|
|
137
|
+
title: 'Column 7',
|
|
138
|
+
width: 200,
|
|
139
|
+
dataIndex: 'address6',
|
|
140
|
+
key: '7'
|
|
141
|
+
}, {
|
|
142
|
+
title: 'Column 8',
|
|
143
|
+
width: 200,
|
|
144
|
+
dataIndex: 'address7',
|
|
145
|
+
key: '8'
|
|
146
|
+
}, {
|
|
147
|
+
title: 'Action',
|
|
148
|
+
align: 'center',
|
|
149
|
+
key: 'operation',
|
|
150
|
+
fixed: 'right',
|
|
151
|
+
width: 150,
|
|
152
|
+
render: BtnViewer
|
|
153
|
+
}];
|
|
154
|
+
var data = [{
|
|
155
|
+
key: '1',
|
|
156
|
+
name: 'John Brown',
|
|
157
|
+
date: '2020-01-01',
|
|
158
|
+
open: true,
|
|
159
|
+
age: 32,
|
|
160
|
+
address1: 'West Lake',
|
|
161
|
+
address2: '打开对话框1',
|
|
162
|
+
select: '111111',
|
|
163
|
+
address: 'New York Park'
|
|
164
|
+
}, {
|
|
165
|
+
key: '2',
|
|
166
|
+
name: 'Jim Green',
|
|
167
|
+
open: false,
|
|
168
|
+
date: '1990-01-01',
|
|
169
|
+
address2: '打开对话框2',
|
|
170
|
+
age: 40,
|
|
171
|
+
select: '222222',
|
|
172
|
+
address: 'London Park'
|
|
173
|
+
}];
|
|
174
|
+
var App = function App() {
|
|
175
|
+
var _useState = useState(data),
|
|
176
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
177
|
+
state = _useState2[0],
|
|
178
|
+
setState = _useState2[1];
|
|
179
|
+
return /*#__PURE__*/_jsx(Table, {
|
|
180
|
+
columns: columns,
|
|
181
|
+
dataSource: state,
|
|
182
|
+
scroll: {
|
|
183
|
+
x: '100%'
|
|
184
|
+
},
|
|
185
|
+
onChange: function onChange() {},
|
|
186
|
+
eventHandler: {
|
|
187
|
+
'cell-edit': function cellEdit(value) {
|
|
188
|
+
var _ref = value,
|
|
189
|
+
row = _ref.row,
|
|
190
|
+
cellValue = _ref.value;
|
|
191
|
+
Modal.confirm({
|
|
192
|
+
title: "".concat(row, " - ").concat(cellValue, "\u7F16\u8F91\u70B9\u4EC0\u4E48")
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
'btn-click': function btnClick(value) {
|
|
196
|
+
var _ref2 = value,
|
|
197
|
+
row = _ref2.row,
|
|
198
|
+
type = _ref2.type;
|
|
199
|
+
Modal.confirm({
|
|
200
|
+
title: "".concat(row, " - ").concat(type, "\u63D0\u793A\u70B9\u4EC0\u4E48")
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
'cell-switch': function cellSwitch(value) {
|
|
204
|
+
var _ref3 = value,
|
|
205
|
+
row = _ref3.row,
|
|
206
|
+
cellValue = _ref3.value;
|
|
207
|
+
var newState = _toConsumableArray(state);
|
|
208
|
+
newState[row] = _objectSpread(_objectSpread({}, newState[row]), {}, {
|
|
209
|
+
open: !cellValue
|
|
210
|
+
});
|
|
211
|
+
setState(newState);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
export default App;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { useEventBus } from './useEventBus';
|
|
2
|
+
export { useKeyBoard } from './useKeyboard';
|
|
3
|
+
export { useMiddlewareReducer } from './useMiddlewareReducer';
|
|
4
|
+
export type { Dispatch, FunctionAction, NormalAction, } from './useMiddlewareReducer';
|
|
5
|
+
export { useMouse } from './useMouse';
|
|
6
|
+
export { useSetState } from './useSetState';
|
|
7
|
+
export { SheetEventContext, useSheetEvent } from './useSheetEvent';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare type KeyOrClipBoardEvent = (event: KeyboardEvent | ClipboardEvent, value?: any) => void;
|
|
2
|
+
declare type KeyboardHandler = {
|
|
3
|
+
move: KeyOrClipBoardEvent;
|
|
4
|
+
escape: KeyOrClipBoardEvent;
|
|
5
|
+
delete: KeyOrClipBoardEvent;
|
|
6
|
+
enter: KeyOrClipBoardEvent;
|
|
7
|
+
otherInput: KeyOrClipBoardEvent;
|
|
8
|
+
copy: KeyOrClipBoardEvent;
|
|
9
|
+
paste: KeyOrClipBoardEvent;
|
|
10
|
+
reverse: KeyOrClipBoardEvent;
|
|
11
|
+
cut: KeyOrClipBoardEvent;
|
|
12
|
+
};
|
|
13
|
+
export declare function move(keyCode: number, isShiftKey: boolean): {
|
|
14
|
+
row: number;
|
|
15
|
+
col: number;
|
|
16
|
+
} | undefined;
|
|
17
|
+
export declare const useKeyBoard: (handler: KeyboardHandler, listenElement: HTMLSpanElement | null) => void;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare type NormalAction = {
|
|
2
|
+
type: string;
|
|
3
|
+
payload?: any;
|
|
4
|
+
};
|
|
5
|
+
export declare type FunctionAction = (dispatch: any, getState?: () => any) => any;
|
|
6
|
+
export declare type Dispatch = (action: any) => any;
|
|
7
|
+
export declare type MiddlewareAPI<A> = {
|
|
8
|
+
getState: () => A;
|
|
9
|
+
dispatch: Dispatch;
|
|
10
|
+
};
|
|
11
|
+
export declare type Middleware<A> = (api: MiddlewareAPI<A>) => (next: Dispatch) => Dispatch;
|
|
12
|
+
export declare const useMiddlewareReducer: <A, B>(reducer: (state: A, action: B) => A, initialState: A, middleware?: Middleware<A>[]) => [A, Dispatch];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare type MouseHandler = {
|
|
2
|
+
mouseUp: (value: MouseEvent) => void;
|
|
3
|
+
mouseDown: (value: MouseEvent) => void;
|
|
4
|
+
mouseOver: (value: MouseEvent) => void;
|
|
5
|
+
mouseLeave: (value: MouseEvent) => void;
|
|
6
|
+
mouseEnter: (value: MouseEvent) => void;
|
|
7
|
+
doubleClick: (value: MouseEvent) => void;
|
|
8
|
+
loseFocus: (value: MouseEvent) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const useMouse: (handler: MouseHandler, listenElement: HTMLSpanElement | null) => void;
|
|
11
|
+
export {};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare 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 {};
|