@zhenliang/sheet 0.2.5-beta.1 → 0.2.5-beta.11
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/editor/InputOptionsEditor/DropMenu.d.ts +10 -0
- package/dist/core/editor/InputOptionsEditor/DropMenu.js +52 -0
- package/dist/core/editor/InputOptionsEditor/index.d.ts +2 -11
- package/dist/core/editor/InputOptionsEditor/index.js +176 -395
- package/dist/core/editor/InputOptionsEditor/index.less +2 -1
- package/dist/core/editor/InputOptionsEditor/keyEventEffect.d.ts +16 -0
- package/dist/core/editor/InputOptionsEditor/keyEventEffect.js +305 -0
- package/dist/core/editor/InputOptionsEditor/utils.d.ts +22 -1
- package/dist/core/editor/InputOptionsEditor/utils.js +51 -6
- package/dist/core/editor/InputOptionsEditor/vaildFormula.js +14 -2
- package/dist/core/editor/numberEditor/index.d.ts +1 -0
- package/dist/core/editor/numberEditor/index.js +2 -2
- package/dist/core/sheet/Cell.js +1 -1
- package/dist/example/basic.js +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { OptionItem } from './utils';
|
|
3
|
+
import './index.less';
|
|
4
|
+
interface DropMenuProps {
|
|
5
|
+
options: OptionItem[];
|
|
6
|
+
onOptionClick: (opt: OptionItem) => void;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
}
|
|
9
|
+
declare const DropMenu: ({ options, onOptionClick, style }: DropMenuProps) => JSX.Element;
|
|
10
|
+
export default DropMenu;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { InfoCircleOutlined } from '@ant-design/icons';
|
|
2
|
+
import { Menu, Tooltip } from 'antd';
|
|
3
|
+
import "./index.less";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
var renderMenuItems = function renderMenuItems(items, onOptionClick) {
|
|
7
|
+
return items.map(function (opt) {
|
|
8
|
+
if (opt.children && opt.children.length > 0) {
|
|
9
|
+
return /*#__PURE__*/_jsx(Menu.SubMenu, {
|
|
10
|
+
title: opt.label,
|
|
11
|
+
className: "formula-editor-dropdown-submenu",
|
|
12
|
+
children: renderMenuItems(opt.children, onOptionClick)
|
|
13
|
+
}, opt.value);
|
|
14
|
+
}
|
|
15
|
+
return /*#__PURE__*/_jsxs(Menu.Item, {
|
|
16
|
+
className: "formula-editor-dropdown-item",
|
|
17
|
+
onClick: function onClick() {
|
|
18
|
+
return onOptionClick(opt);
|
|
19
|
+
},
|
|
20
|
+
children: [opt.label, opt.info ? /*#__PURE__*/_jsx(Tooltip, {
|
|
21
|
+
title: opt.info,
|
|
22
|
+
children: /*#__PURE__*/_jsx(InfoCircleOutlined, {
|
|
23
|
+
style: {
|
|
24
|
+
color: '#FF9900',
|
|
25
|
+
marginLeft: 4
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
}) : null]
|
|
29
|
+
}, opt.value);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
var DropMenu = function DropMenu(_ref) {
|
|
33
|
+
var options = _ref.options,
|
|
34
|
+
onOptionClick = _ref.onOptionClick,
|
|
35
|
+
style = _ref.style;
|
|
36
|
+
return /*#__PURE__*/_jsx(Menu, {
|
|
37
|
+
className: "formula-editor-dropdown",
|
|
38
|
+
style: style,
|
|
39
|
+
onMouseDown: function onMouseDown(e) {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
e.stopPropagation();
|
|
42
|
+
},
|
|
43
|
+
children: options.length === 0 ? /*#__PURE__*/_jsx(Menu.Item, {
|
|
44
|
+
disabled: true,
|
|
45
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
46
|
+
className: "formula-editor-dropdown-no-data",
|
|
47
|
+
children: "\u6682\u65E0\u6570\u636E"
|
|
48
|
+
})
|
|
49
|
+
}, "no-data") : renderMenuItems(options, onOptionClick)
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
export default DropMenu;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import type { SheetType } from "../../../type";
|
|
2
2
|
import './index.less';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: string;
|
|
6
|
-
info?: string;
|
|
7
|
-
children?: OptionItem[];
|
|
8
|
-
}
|
|
9
|
-
export interface FormulaInputProps {
|
|
10
|
-
options: OptionItem[];
|
|
11
|
-
value?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare const getFormulaInputEditor: (options: OptionItem[], replaceIndex?: string) => SheetType.CellEditor;
|
|
3
|
+
import { inputProps, OptionItem } from './utils';
|
|
4
|
+
export declare const getFormulaInputEditor: (options: OptionItem[], replaceIndex?: string, extraProps?: inputProps, getExtraProps?: ((props: SheetType.CellEditorProps) => inputProps) | undefined, choseEditor?: ((record: any) => boolean) | undefined) => SheetType.CellEditor;
|
|
14
5
|
export default getFormulaInputEditor;
|