@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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g filter="url(#filter0_d_932_2301)">
|
|
3
|
+
<path d="M10 5.5V12.5H6L12 18.5L18 12.5H14V5.5H10Z" fill="white" />
|
|
4
|
+
<path d="M13.0002 6.5V13.5H15.5902L12.0002 17.09L8.41016 13.5H11.0002V6.5H13.0002Z" fill="black" />
|
|
5
|
+
</g>
|
|
6
|
+
<defs>
|
|
7
|
+
<filter id="filter0_d_932_2301" x="4.2" y="4.7" width="15.6" height="16.6" filterUnits="userSpaceOnUse"
|
|
8
|
+
color-interpolation-filters="sRGB">
|
|
9
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix" />
|
|
10
|
+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
|
|
11
|
+
result="hardAlpha" />
|
|
12
|
+
<feOffset dy="1" />
|
|
13
|
+
<feGaussianBlur stdDeviation="0.9" />
|
|
14
|
+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.65 0" />
|
|
15
|
+
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_932_2301" />
|
|
16
|
+
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_932_2301" result="shape" />
|
|
17
|
+
</filter>
|
|
18
|
+
</defs>
|
|
19
|
+
</svg>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g filter="url(#filter0_d_932_2297)">
|
|
3
|
+
<path d="M12.5 18L18.5 12L12.5 6V10H5.5V14H12.5V18Z" fill="white"/>
|
|
4
|
+
<path d="M6.5 11H13.5V8.40997L17.09 12L13.5 15.59V13H6.5V11Z" fill="black"/>
|
|
5
|
+
</g>
|
|
6
|
+
<defs>
|
|
7
|
+
<filter id="filter0_d_932_2297" x="3.7" y="5.2" width="16.6" height="15.6" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
8
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
9
|
+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
10
|
+
<feOffset dy="1"/>
|
|
11
|
+
<feGaussianBlur stdDeviation="0.9"/>
|
|
12
|
+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.65 0"/>
|
|
13
|
+
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_932_2297"/>
|
|
14
|
+
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_932_2297" result="shape"/>
|
|
15
|
+
</filter>
|
|
16
|
+
</defs>
|
|
17
|
+
</svg>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g filter="url(#filter0_d_932_2293)">
|
|
3
|
+
<path d="M10 5.5V12.5H6L12 18.5L18 12.5H14V5.5H10Z" fill="black"/>
|
|
4
|
+
<path d="M13.0002 6.5V13.5H15.5902L12.0002 17.09L8.41016 13.5H11.0002V6.5H13.0002Z" fill="white"/>
|
|
5
|
+
</g>
|
|
6
|
+
<defs>
|
|
7
|
+
<filter id="filter0_d_932_2293" x="4.2" y="4.7" width="15.6" height="16.6" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
8
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
9
|
+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
10
|
+
<feOffset dy="1"/>
|
|
11
|
+
<feGaussianBlur stdDeviation="0.9"/>
|
|
12
|
+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.65 0"/>
|
|
13
|
+
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_932_2293"/>
|
|
14
|
+
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_932_2293" result="shape"/>
|
|
15
|
+
</filter>
|
|
16
|
+
</defs>
|
|
17
|
+
</svg>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g filter="url(#filter0_d_932_2289)">
|
|
3
|
+
<path d="M12.5 18L18.5 12L12.5 6V10H5.5V14H12.5V18Z" fill="black"/>
|
|
4
|
+
<path d="M6.5 11H13.5V8.40997L17.09 12L13.5 15.59V13H6.5V11Z" fill="white"/>
|
|
5
|
+
</g>
|
|
6
|
+
<defs>
|
|
7
|
+
<filter id="filter0_d_932_2289" x="3.7" y="5.2" width="16.6" height="15.6" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
8
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
9
|
+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
10
|
+
<feOffset dy="1"/>
|
|
11
|
+
<feGaussianBlur stdDeviation="0.9"/>
|
|
12
|
+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.65 0"/>
|
|
13
|
+
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_932_2289"/>
|
|
14
|
+
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_932_2289" result="shape"/>
|
|
15
|
+
</filter>
|
|
16
|
+
</defs>
|
|
17
|
+
</svg>
|
package/dist/core/config.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ export declare const DOWN_KEY = 40;
|
|
|
8
8
|
export declare const DELETE_KEY = 46;
|
|
9
9
|
export declare const BACKSPACE_KEY = 8;
|
|
10
10
|
export declare const Z_KEY = 90;
|
|
11
|
+
export declare const F_KEY = 70;
|
|
11
12
|
export declare const C_KEY = 67;
|
|
12
13
|
export declare const V_KEY = 86;
|
|
13
14
|
export declare const X_KEY = 88;
|
|
15
|
+
export declare const A_KEY = 65;
|
|
16
|
+
export declare const Y_KEY = 89;
|
package/dist/core/config.js
CHANGED
|
@@ -8,6 +8,9 @@ export var DOWN_KEY = 40;
|
|
|
8
8
|
export var DELETE_KEY = 46;
|
|
9
9
|
export var BACKSPACE_KEY = 8;
|
|
10
10
|
export var Z_KEY = 90;
|
|
11
|
+
export var F_KEY = 70;
|
|
11
12
|
export var C_KEY = 67;
|
|
12
13
|
export var V_KEY = 86;
|
|
13
|
-
export var X_KEY = 88;
|
|
14
|
+
export var X_KEY = 88;
|
|
15
|
+
export var A_KEY = 65;
|
|
16
|
+
export var Y_KEY = 89;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SheetType } from "../../../type";
|
|
2
2
|
import 'antd/es/cascader/style/index.css';
|
|
3
3
|
import './index.less';
|
|
4
|
-
declare const getCascaderEditor: (options: SheetType.OptionsType[]) => SheetType.CellEditor;
|
|
4
|
+
declare const getCascaderEditor: (options: SheetType.OptionsType[], getCustomOptions?: ((props: SheetType.CellEditorProps) => SheetType.OptionsType[]) | undefined) => SheetType.CellEditor;
|
|
5
5
|
export default getCascaderEditor;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Cascader } from 'antd';
|
|
2
2
|
import 'antd/es/cascader/style/index.css';
|
|
3
|
-
import {
|
|
3
|
+
import { isNil } from 'lodash';
|
|
4
|
+
import { useMemo } from "../../../../node_modules/@types/react";
|
|
4
5
|
import { optionsToValuesFromLabelOrValue, valuesTransferToLabel } from "../../util";
|
|
5
6
|
import "./index.less";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
var getCascaderEditor = function getCascaderEditor(options) {
|
|
7
|
+
import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
|
|
8
|
+
var getCascaderEditor = function getCascaderEditor(options, getCustomOptions) {
|
|
8
9
|
var CascaderEditor = function CascaderEditor(props) {
|
|
9
10
|
var value = props.value,
|
|
10
11
|
onConfirm = props.onConfirm;
|
|
@@ -15,6 +16,7 @@ var getCascaderEditor = function getCascaderEditor(options) {
|
|
|
15
16
|
var handleChange = function handleChange(opt) {
|
|
16
17
|
onConfirm(opt ? opt[opt.length - 1] : null);
|
|
17
18
|
};
|
|
19
|
+
var customOptions = getCustomOptions ? getCustomOptions(props) : options;
|
|
18
20
|
return /*#__PURE__*/_jsx(Cascader, {
|
|
19
21
|
autoFocus: true,
|
|
20
22
|
open: true,
|
|
@@ -22,17 +24,13 @@ var getCascaderEditor = function getCascaderEditor(options) {
|
|
|
22
24
|
onMouseDown: function onMouseDown(event) {
|
|
23
25
|
event.stopPropagation();
|
|
24
26
|
},
|
|
25
|
-
value: val
|
|
26
|
-
|
|
27
|
-
,
|
|
27
|
+
value: val,
|
|
28
|
+
allowClear: true,
|
|
28
29
|
displayRender: function displayRender(label) {
|
|
29
30
|
return label[label.length - 1];
|
|
30
31
|
},
|
|
31
|
-
onChange: handleChange
|
|
32
|
-
|
|
33
|
-
// onKeyDown={handleKeyDown}
|
|
34
|
-
,
|
|
35
|
-
options: options
|
|
32
|
+
onChange: handleChange,
|
|
33
|
+
options: customOptions
|
|
36
34
|
});
|
|
37
35
|
};
|
|
38
36
|
CascaderEditor.formatter = function (value) {
|
|
@@ -44,6 +42,9 @@ var getCascaderEditor = function getCascaderEditor(options) {
|
|
|
44
42
|
return res.length ? res[res.length - 1] : null;
|
|
45
43
|
};
|
|
46
44
|
CascaderEditor.checker = function (value) {
|
|
45
|
+
if (isNil(value)) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
47
48
|
var res = optionsToValuesFromLabelOrValue(options, value);
|
|
48
49
|
return !!res.length;
|
|
49
50
|
};
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
.cascader-editor{
|
|
1
|
+
.harvest-sheet-container .cascader-editor{
|
|
2
2
|
width: 100%;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
height: 38px;
|
|
4
|
+
display: block;
|
|
6
5
|
|
|
7
6
|
.ant-select-selector{
|
|
8
7
|
.ant-select-selection-search{
|
|
9
|
-
height:
|
|
8
|
+
height: 38px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ant-select-selection-item{
|
|
12
|
+
height: inherit;
|
|
13
|
+
line-height: 38px;
|
|
14
|
+
font-size: 12px;
|
|
10
15
|
}
|
|
11
16
|
|
|
12
17
|
border: none !important;
|
|
13
18
|
background: transparent !important;
|
|
14
19
|
box-shadow: none !important;
|
|
15
20
|
color: #292c33;
|
|
16
|
-
height: 20px !important;
|
|
17
21
|
padding:0 !important;
|
|
18
22
|
|
|
19
23
|
input{
|
|
@@ -21,4 +25,8 @@
|
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
.ant-cascader-menu {
|
|
29
|
+
font-size: 12px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
function ownKeys(
|
|
3
|
-
function _objectSpread(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
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(
|
|
6
|
-
function _toPrimitive(
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import { DatePicker } from 'antd';
|
|
8
8
|
import 'antd/es/date-picker/style/index.css';
|
|
9
|
+
import { isNil } from 'lodash';
|
|
9
10
|
import moment from 'moment';
|
|
10
|
-
import { useEffect, useMemo, useRef } from
|
|
11
|
+
import { useEffect, useMemo, useRef } from "../../../../node_modules/@types/react";
|
|
11
12
|
import "./index.less";
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
|
|
13
14
|
export var getDateEditor = function getDateEditor(dateProps) {
|
|
14
15
|
var DateEditor = function DateEditor(props) {
|
|
15
16
|
var value = props.value,
|
|
@@ -18,7 +19,7 @@ export var getDateEditor = function getDateEditor(dateProps) {
|
|
|
18
19
|
var dateRef = useRef(null);
|
|
19
20
|
useEffect(function () {
|
|
20
21
|
var _dateRef$current;
|
|
21
|
-
dateRef === null || dateRef === void 0
|
|
22
|
+
dateRef === null || dateRef === void 0 || (_dateRef$current = dateRef.current) === null || _dateRef$current === void 0 || _dateRef$current.focus();
|
|
22
23
|
}, []);
|
|
23
24
|
var val = useMemo(function () {
|
|
24
25
|
return value && moment(value);
|
|
@@ -29,6 +30,18 @@ export var getDateEditor = function getDateEditor(dateProps) {
|
|
|
29
30
|
};
|
|
30
31
|
return /*#__PURE__*/_jsx(DatePicker, _objectSpread({
|
|
31
32
|
open: true,
|
|
33
|
+
inputRender: function inputRender(props) {
|
|
34
|
+
return /*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({}, props), {}, {
|
|
35
|
+
onKeyDownCapture: function onKeyDownCapture(e) {
|
|
36
|
+
if (e.key !== 'Enter') {
|
|
37
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
38
|
+
} else {
|
|
39
|
+
onChange(e.target.value);
|
|
40
|
+
onConfirm(e.target.value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
},
|
|
32
45
|
ref: dateRef,
|
|
33
46
|
className: "date-editor",
|
|
34
47
|
value: val,
|
|
@@ -39,13 +52,23 @@ export var getDateEditor = function getDateEditor(dateProps) {
|
|
|
39
52
|
}, dateProps));
|
|
40
53
|
};
|
|
41
54
|
DateEditor.checker = function (value) {
|
|
55
|
+
if (isNil(value)) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
42
58
|
var reg = /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1])$/;
|
|
43
59
|
return reg.test(value);
|
|
44
60
|
};
|
|
45
61
|
DateEditor.formatter = function (value) {
|
|
46
62
|
var _DateEditor$checker;
|
|
63
|
+
if (isNil(value)) return value;
|
|
47
64
|
if (!(DateEditor !== null && DateEditor !== void 0 && (_DateEditor$checker = DateEditor.checker) !== null && _DateEditor$checker !== void 0 && _DateEditor$checker.call(DateEditor, value))) return null;
|
|
48
65
|
return value.replace('/', '-').replace('/', '-');
|
|
49
66
|
};
|
|
67
|
+
DateEditor.parser = function (value) {
|
|
68
|
+
var _DateEditor$checker2;
|
|
69
|
+
if (isNil(value)) return value;
|
|
70
|
+
if (!(DateEditor !== null && DateEditor !== void 0 && (_DateEditor$checker2 = DateEditor.checker) !== null && _DateEditor$checker2 !== void 0 && _DateEditor$checker2.call(DateEditor, value))) return null;
|
|
71
|
+
return value.replace('/', '-').replace('/', '-');
|
|
72
|
+
};
|
|
50
73
|
return DateEditor;
|
|
51
74
|
};
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
.date-editor{
|
|
1
|
+
.harvest-sheet-container .date-editor{
|
|
2
2
|
width:100%;
|
|
3
3
|
border:none !important;
|
|
4
4
|
box-shadow: none !important;
|
|
5
5
|
background: transparent !important;
|
|
6
|
-
|
|
6
|
+
padding:4px 0;
|
|
7
|
+
height: 38px;
|
|
8
|
+
display: block;
|
|
7
9
|
|
|
8
10
|
input{
|
|
9
11
|
font-size: var(--cell-font-size);
|
|
10
12
|
}
|
|
13
|
+
|
|
14
|
+
.ant-picker-input{
|
|
15
|
+
height: 30px;
|
|
16
|
+
|
|
17
|
+
}
|
|
11
18
|
}
|
|
@@ -2,5 +2,7 @@ import type { SheetType } from "../../../type";
|
|
|
2
2
|
import { InputNumberProps } from 'antd';
|
|
3
3
|
import 'antd/es/input-number/style/index.css';
|
|
4
4
|
import './index.less';
|
|
5
|
+
type inputProps = Partial<Pick<InputNumberProps, 'max' | 'min' | 'addonBefore' | 'addonAfter' | 'precision'>>;
|
|
5
6
|
export declare const NumberEditor: SheetType.CellEditor;
|
|
6
|
-
export declare const getNumberEditor: (extraProps?:
|
|
7
|
+
export declare const getNumberEditor: (extraProps?: inputProps, getExtraProps?: ((props: SheetType.CellEditorProps) => inputProps) | undefined) => SheetType.CellEditor;
|
|
8
|
+
export {};
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
function _typeof(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _excluded = ["precision"];
|
|
3
|
-
function ownKeys(
|
|
4
|
-
function _objectSpread(
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
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; }
|
|
6
|
-
function _toPropertyKey(
|
|
7
|
-
function _toPrimitive(
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
8
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
9
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
10
|
import { formatPrecision } from "../../../standardUtils";
|
|
11
11
|
import { InputNumber as AntInputNumber } from 'antd';
|
|
12
12
|
import 'antd/es/input-number/style/index.css';
|
|
13
|
-
import { isNil } from 'lodash';
|
|
14
|
-
import { useCallback, useEffect, useRef } from
|
|
13
|
+
import { isNil, isNumber } from 'lodash';
|
|
14
|
+
import { useCallback, useEffect, useRef } from "../../../../node_modules/@types/react";
|
|
15
15
|
import "./index.less";
|
|
16
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
|
|
17
|
+
var isNumeric = function isNumeric(str) {
|
|
18
|
+
// 使用正则表达式匹配数字,包括整数和小数
|
|
19
|
+
return /^-?\d+(\.\d+)?$/.test(str);
|
|
20
|
+
};
|
|
17
21
|
export var NumberEditor = function NumberEditor(props) {
|
|
18
22
|
var value = props.value,
|
|
19
23
|
onChange = props.onChange;
|
|
20
24
|
var inputNumberRef = useRef(null);
|
|
21
25
|
useEffect(function () {
|
|
22
26
|
var _inputNumberRef$curre;
|
|
23
|
-
inputNumberRef === null || inputNumberRef === void 0
|
|
27
|
+
inputNumberRef === null || inputNumberRef === void 0 || (_inputNumberRef$curre = inputNumberRef.current) === null || _inputNumberRef$curre === void 0 || _inputNumberRef$curre.focus();
|
|
24
28
|
}, []);
|
|
25
29
|
return /*#__PURE__*/_jsx(AntInputNumber, {
|
|
26
30
|
ref: inputNumberRef,
|
|
@@ -34,45 +38,72 @@ export var NumberEditor = function NumberEditor(props) {
|
|
|
34
38
|
onChange: onChange
|
|
35
39
|
});
|
|
36
40
|
};
|
|
37
|
-
export var getNumberEditor = function getNumberEditor(extraProps) {
|
|
41
|
+
export var getNumberEditor = function getNumberEditor(extraProps, getExtraProps) {
|
|
38
42
|
var NumberEditor = function NumberEditor(props) {
|
|
39
43
|
var value = props.value,
|
|
40
44
|
onChange = props.onChange;
|
|
41
45
|
var inputNumberRef = useRef(null);
|
|
46
|
+
var _ref = getExtraProps ? getExtraProps(props) : extraProps !== null && extraProps !== void 0 ? extraProps : {},
|
|
47
|
+
precision = _ref.precision,
|
|
48
|
+
inputArgs = _objectWithoutProperties(_ref, _excluded);
|
|
49
|
+
var max = inputArgs.max,
|
|
50
|
+
min = inputArgs.min;
|
|
51
|
+
var handleChange = useCallback(function (value) {
|
|
52
|
+
onChange(!isNil(value) ? value : null);
|
|
53
|
+
}, [onChange]);
|
|
42
54
|
useEffect(function () {
|
|
43
55
|
var _inputNumberRef$curre2;
|
|
44
|
-
inputNumberRef === null || inputNumberRef === void 0
|
|
56
|
+
inputNumberRef === null || inputNumberRef === void 0 || (_inputNumberRef$curre2 = inputNumberRef.current) === null || _inputNumberRef$curre2 === void 0 || _inputNumberRef$curre2.focus();
|
|
45
57
|
}, []);
|
|
46
|
-
var
|
|
47
|
-
precision = _ref.precision,
|
|
48
|
-
inputArgs = _objectWithoutProperties(_ref, _excluded);
|
|
49
|
-
var valueFormatter = useCallback(function (value) {
|
|
58
|
+
var baseFormatter = useCallback(function (value) {
|
|
50
59
|
if (!value) {
|
|
51
60
|
return '';
|
|
52
61
|
}
|
|
53
|
-
if (
|
|
62
|
+
if (!isNumeric("".concat(value))) {
|
|
54
63
|
return value;
|
|
55
64
|
}
|
|
56
|
-
var hasDecimal = value - Math.floor(value) > 0;
|
|
65
|
+
var hasDecimal = +value - Math.floor(+value) > 0;
|
|
57
66
|
if (hasDecimal) {
|
|
58
67
|
return formatPrecision(value, precision);
|
|
59
68
|
}
|
|
60
69
|
return String(value);
|
|
61
70
|
}, []);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
71
|
+
// 去掉多余的0
|
|
72
|
+
var valueFormatter = useCallback(function (value) {
|
|
73
|
+
var baseValue = baseFormatter(value);
|
|
74
|
+
return baseValue ? "".concat(parseFloat(baseValue)) : '';
|
|
75
|
+
}, []);
|
|
76
|
+
/**
|
|
77
|
+
* 重新声明,后面有需求可以改一下
|
|
78
|
+
*/
|
|
79
|
+
var valueParser = baseFormatter;
|
|
65
80
|
return /*#__PURE__*/_jsx(AntInputNumber, _objectSpread(_objectSpread({
|
|
66
81
|
ref: inputNumberRef
|
|
67
82
|
}, inputArgs), {}, {
|
|
68
83
|
formatter: valueFormatter,
|
|
84
|
+
parser: valueParser,
|
|
69
85
|
controls: false,
|
|
70
86
|
className: "number-editor",
|
|
71
87
|
onMouseDown: function onMouseDown(e) {
|
|
72
88
|
return e.stopPropagation();
|
|
73
89
|
},
|
|
74
90
|
value: value,
|
|
75
|
-
onChange: handleChange
|
|
91
|
+
onChange: handleChange,
|
|
92
|
+
onInput: function onInput(value) {
|
|
93
|
+
// 将截断最大最小放到 input 事件中
|
|
94
|
+
if (!isNumber(+value)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (!value) {
|
|
98
|
+
handleChange(null);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (max && +value > max) {
|
|
102
|
+
handleChange(max);
|
|
103
|
+
} else if (min && +value < min) {
|
|
104
|
+
handleChange(min);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
76
107
|
}));
|
|
77
108
|
};
|
|
78
109
|
NumberEditor.formatter = function (value) {
|
|
@@ -84,17 +115,21 @@ export var getNumberEditor = function getNumberEditor(extraProps) {
|
|
|
84
115
|
return result;
|
|
85
116
|
};
|
|
86
117
|
NumberEditor.parser = function (value) {
|
|
87
|
-
var _extraProps$precision;
|
|
88
|
-
|
|
118
|
+
var _String2, _extraProps$precision;
|
|
119
|
+
var result = parseFloat((_String2 = String(value)) === null || _String2 === void 0 ? void 0 : _String2.replace(/,/g, ''));
|
|
120
|
+
if (isNil(result) || isNaN(result)) {
|
|
89
121
|
return null;
|
|
90
122
|
}
|
|
91
|
-
return Number(formatPrecision(
|
|
123
|
+
return Number(formatPrecision(result, (_extraProps$precision = extraProps === null || extraProps === void 0 ? void 0 : extraProps.precision) !== null && _extraProps$precision !== void 0 ? _extraProps$precision : 0));
|
|
92
124
|
};
|
|
93
125
|
NumberEditor.checker = function (value) {
|
|
94
|
-
var
|
|
126
|
+
var _String3;
|
|
127
|
+
if (isNil(value)) {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
95
130
|
// parse number with thousands separator
|
|
96
|
-
var result = parseFloat((
|
|
97
|
-
if (isNaN(result)
|
|
131
|
+
var result = parseFloat((_String3 = String(value)) === null || _String3 === void 0 ? void 0 : _String3.replace(/,/g, ''));
|
|
132
|
+
if (isNaN(result)) {
|
|
98
133
|
return false;
|
|
99
134
|
}
|
|
100
135
|
return true;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
.number-editor{
|
|
1
|
+
.harvest-sheet-container .number-editor{
|
|
2
2
|
border: none !important;
|
|
3
3
|
background: transparent !important;
|
|
4
4
|
width:100%;
|
|
5
|
-
height:
|
|
5
|
+
height:var(--cell-inner-height) ;
|
|
6
|
+
display: block;
|
|
6
7
|
font-size: 12px;
|
|
7
8
|
box-shadow: none !important;
|
|
8
9
|
text-align: inherit !important;
|
|
@@ -2,5 +2,5 @@ import type { SheetType } from "../../../type";
|
|
|
2
2
|
import { SelectProps } from 'antd';
|
|
3
3
|
import 'antd/es/select/style/index.css';
|
|
4
4
|
import './index.less';
|
|
5
|
-
export declare const getSelectEditor: (options: SheetType.Options[], valueKey?: string, extra?: React.ReactNode, selectProps?: Partial<SelectProps
|
|
5
|
+
export declare const getSelectEditor: (options: SheetType.Options[], valueKey?: string, extra?: React.ReactNode, selectProps?: Partial<SelectProps>, getCustomOptions?: ((props: SheetType.CellEditorProps) => SheetType.Options[]) | undefined) => SheetType.CellEditor;
|
|
6
6
|
export default getSelectEditor;
|
|
@@ -1,23 +1,35 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
function ownKeys(
|
|
3
|
-
function _objectSpread(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
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(
|
|
6
|
-
function _toPrimitive(
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
13
|
/* eslint-disable eqeqeq */
|
|
8
14
|
|
|
9
15
|
import { Select } from 'antd';
|
|
10
16
|
import 'antd/es/select/style/index.css';
|
|
11
17
|
import { isNil } from 'lodash';
|
|
18
|
+
import { useState } from "../../../../node_modules/@types/react";
|
|
12
19
|
import "./index.less";
|
|
13
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
import { Fragment as _Fragment } from "../../../../node_modules/@types/react/jsx-runtime";
|
|
21
|
+
import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
|
|
22
|
+
import { jsxs as _jsxs } from "../../../../node_modules/@types/react/jsx-runtime";
|
|
16
23
|
export var getSelectEditor = function getSelectEditor(options) {
|
|
17
24
|
var valueKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'value';
|
|
18
25
|
var extra = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : /*#__PURE__*/_jsx(_Fragment, {});
|
|
19
26
|
var selectProps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
27
|
+
var getCustomOptions = arguments.length > 4 ? arguments[4] : undefined;
|
|
20
28
|
var SelectEditor = function SelectEditor(props) {
|
|
29
|
+
var _useState = useState(true),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
isOpen = _useState2[0],
|
|
32
|
+
setIsOpen = _useState2[1];
|
|
21
33
|
var value = props.value,
|
|
22
34
|
onConfirm = props.onConfirm;
|
|
23
35
|
var handleChange = function handleChange(opt) {
|
|
@@ -31,29 +43,32 @@ export var getSelectEditor = function getSelectEditor(options) {
|
|
|
31
43
|
}
|
|
32
44
|
};
|
|
33
45
|
var dropdown = function dropdown(menu) {
|
|
34
|
-
return /*#__PURE__*/_jsxs(
|
|
46
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
47
|
+
onClick: function onClick() {
|
|
48
|
+
setIsOpen(false);
|
|
49
|
+
},
|
|
35
50
|
children: [menu, extra]
|
|
36
51
|
});
|
|
37
52
|
};
|
|
38
|
-
|
|
53
|
+
var customOptions = getCustomOptions ? getCustomOptions(props) : options;
|
|
54
|
+
return /*#__PURE__*/_jsx(Select, _objectSpread({
|
|
39
55
|
autoFocus: true,
|
|
40
56
|
className: "select-editor",
|
|
41
|
-
|
|
42
|
-
allowClear: true,
|
|
43
|
-
open: true,
|
|
57
|
+
open: isOpen,
|
|
44
58
|
onMouseDown: function onMouseDown(e) {
|
|
45
59
|
e.stopPropagation();
|
|
46
60
|
},
|
|
47
|
-
value: SelectEditor.
|
|
61
|
+
value: SelectEditor.parser ? SelectEditor.parser(value) : value,
|
|
48
62
|
onChange: handleChange,
|
|
49
63
|
onKeyDown: handleKeyDown,
|
|
50
|
-
options:
|
|
51
|
-
popupClassName:
|
|
52
|
-
dropdownRender: dropdown
|
|
53
|
-
|
|
64
|
+
options: customOptions,
|
|
65
|
+
popupClassName: "select-editor-dropdown",
|
|
66
|
+
dropdownRender: dropdown,
|
|
67
|
+
allowClear: true
|
|
68
|
+
}, selectProps));
|
|
54
69
|
};
|
|
55
70
|
SelectEditor.checker = function (value) {
|
|
56
|
-
if (isNil(value)) return true;
|
|
71
|
+
if (isNil(value) && selectProps.allowClear !== false) return true;
|
|
57
72
|
return options.some(function (item) {
|
|
58
73
|
return item.value == value;
|
|
59
74
|
}) || options.some(function (item) {
|