@progress/kendo-react-spreadsheet 5.17.0-dev.202308231321 → 5.17.0-dev.202308241633
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/cdn/js/kendo-react-spreadsheet.js +1 -1
- package/dist/es/FormulaInput.js +1 -1
- package/dist/es/List.js +7 -2
- package/dist/es/Spreadsheet.js +35 -3
- package/dist/es/messages.d.ts +30 -0
- package/dist/es/messages.js +99 -9
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/tools/adjustDecimals.d.ts +20 -0
- package/dist/es/tools/adjustDecimals.js +39 -0
- package/dist/es/tools/align.d.ts +26 -0
- package/dist/es/tools/align.js +61 -7
- package/dist/es/tools/cleanFormat.d.ts +11 -0
- package/dist/es/tools/cleanFormat.js +17 -0
- package/dist/es/tools/defaultTools.js +14 -5
- package/dist/es/tools/fontSize.d.ts +29 -1
- package/dist/es/tools/fontSize.js +65 -9
- package/dist/es/tools/index.d.ts +1 -0
- package/dist/es/tools/index.js +1 -0
- package/dist/es/tools/open.js +1 -1
- package/dist/es/tools/tableTools.d.ts +14 -6
- package/dist/es/tools/tableTools.js +20 -8
- package/dist/npm/FormulaInput.js +1 -1
- package/dist/npm/List.js +7 -2
- package/dist/npm/Spreadsheet.js +34 -2
- package/dist/npm/messages.d.ts +30 -0
- package/dist/npm/messages.js +99 -9
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/tools/adjustDecimals.d.ts +20 -0
- package/dist/npm/tools/adjustDecimals.js +42 -0
- package/dist/npm/tools/align.d.ts +26 -0
- package/dist/npm/tools/align.js +62 -8
- package/dist/npm/tools/cleanFormat.d.ts +11 -0
- package/dist/npm/tools/cleanFormat.js +21 -0
- package/dist/npm/tools/defaultTools.js +12 -3
- package/dist/npm/tools/fontSize.d.ts +29 -1
- package/dist/npm/tools/fontSize.js +66 -10
- package/dist/npm/tools/index.d.ts +1 -0
- package/dist/npm/tools/index.js +1 -0
- package/dist/npm/tools/open.js +1 -1
- package/dist/npm/tools/tableTools.d.ts +14 -6
- package/dist/npm/tools/tableTools.js +20 -8
- package/dist/systemjs/kendo-react-spreadsheet.js +1 -1
- package/package.json +14 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { DropDownToolProps } from './utils';
|
|
2
|
+
import { DropDownToolProps, SpreadsheetToolProps } from './utils';
|
|
3
3
|
/**
|
|
4
4
|
* The props of the FontSize tool component.
|
|
5
5
|
*/
|
|
@@ -9,3 +9,31 @@ export interface FontSizeProps extends DropDownToolProps {
|
|
|
9
9
|
* The FontSize tool component.
|
|
10
10
|
*/
|
|
11
11
|
export declare const FontSize: React.FunctionComponent<FontSizeProps>;
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
interface FontSizeChangeToolProps extends SpreadsheetToolProps {
|
|
16
|
+
/**
|
|
17
|
+
* The selected state of the tool.
|
|
18
|
+
*/
|
|
19
|
+
value: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The props of the IncreaseFontSize tool component.
|
|
23
|
+
*/
|
|
24
|
+
export interface IncreaseFontSizeProps extends FontSizeChangeToolProps {
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The IncreaseFontSize tool component.
|
|
28
|
+
*/
|
|
29
|
+
export declare const IncreaseFontSize: React.FunctionComponent<IncreaseFontSizeProps>;
|
|
30
|
+
/**
|
|
31
|
+
* The props of the DecreaseFontSize tool component.
|
|
32
|
+
*/
|
|
33
|
+
export interface DecreaseFontSizeProps extends FontSizeChangeToolProps {
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The DecreaseFontSize tool component.
|
|
37
|
+
*/
|
|
38
|
+
export declare const DecreaseFontSize: React.FunctionComponent<DecreaseFontSizeProps>;
|
|
39
|
+
export {};
|
|
@@ -3,21 +3,77 @@ import { ComboBox } from '@progress/kendo-react-dropdowns';
|
|
|
3
3
|
import { DEFAULT_FONT_SIZE, FONT_SIZES } from './utils';
|
|
4
4
|
import { keys, messages } from '../messages';
|
|
5
5
|
import { useLocalization } from '@progress/kendo-react-intl';
|
|
6
|
+
import { Button } from '@progress/kendo-react-buttons';
|
|
7
|
+
import { fontGrowIcon, fontShrinkIcon } from '@progress/kendo-svg-icons';
|
|
8
|
+
const toNumber = (value) => {
|
|
9
|
+
return typeof value === 'string' ? parseFloat(value) : value;
|
|
10
|
+
};
|
|
6
11
|
/**
|
|
7
12
|
* The FontSize tool component.
|
|
8
13
|
*/
|
|
9
14
|
export const FontSize = props => {
|
|
10
|
-
const { spreadsheetRef
|
|
15
|
+
const { spreadsheetRef } = props;
|
|
16
|
+
const value = toNumber(props.value);
|
|
11
17
|
const onChange = React.useCallback((event) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
var _a;
|
|
19
|
+
const options = {
|
|
20
|
+
command: 'PropertyChangeCommand', options: { property: 'fontSize', value: event.value ? toNumber(event.value) : null }
|
|
21
|
+
};
|
|
22
|
+
if (event.nativeEvent.type === 'keydown' || event.nativeEvent.type === 'focusout') {
|
|
23
|
+
(_a = spreadsheetRef.current) === null || _a === void 0 ? void 0 : _a.executeCommand(options);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
var _a;
|
|
28
|
+
(_a = spreadsheetRef.current) === null || _a === void 0 ? void 0 : _a.executeCommand(options);
|
|
29
|
+
}, 0);
|
|
30
|
+
}
|
|
20
31
|
}, []);
|
|
21
32
|
return (React.createElement(ComboBox, { onChange: onChange, value: value, data: FONT_SIZES, defaultValue: DEFAULT_FONT_SIZE, allowCustom: true, fillMode: "flat", title: useLocalization().toLanguageString(keys.fontSize, messages[keys.fontSize]), tabIndex: -1, clearButton: false }));
|
|
22
33
|
};
|
|
23
34
|
FontSize.displayName = 'FontSize';
|
|
35
|
+
const minFontSize = 1;
|
|
36
|
+
const maxFontSize = 409;
|
|
37
|
+
/**
|
|
38
|
+
* @hidden
|
|
39
|
+
*/
|
|
40
|
+
const fontSizeChangeTool = (settings) => {
|
|
41
|
+
const tool = props => {
|
|
42
|
+
const { property, icon, svgIcon, titleKey, step } = settings;
|
|
43
|
+
const { spreadsheetRef } = props;
|
|
44
|
+
const value = toNumber(props.value);
|
|
45
|
+
const onClick = React.useCallback(() => {
|
|
46
|
+
var _a;
|
|
47
|
+
const options = {
|
|
48
|
+
command: 'PropertyChangeCommand',
|
|
49
|
+
options: { property, value: Math.min(maxFontSize, Math.max(minFontSize, value + step)) }
|
|
50
|
+
};
|
|
51
|
+
(_a = spreadsheetRef.current) === null || _a === void 0 ? void 0 : _a.executeCommand(options);
|
|
52
|
+
}, [value]);
|
|
53
|
+
return (React.createElement(Button, { type: "button", icon: icon, svgIcon: svgIcon, fillMode: "flat", onClick: onClick, disabled: value + step < minFontSize || value + step > maxFontSize, title: useLocalization().toLanguageString(titleKey, messages[titleKey]) }));
|
|
54
|
+
};
|
|
55
|
+
tool.displayName = settings.displayName;
|
|
56
|
+
return tool;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The IncreaseFontSize tool component.
|
|
60
|
+
*/
|
|
61
|
+
export const IncreaseFontSize = fontSizeChangeTool({
|
|
62
|
+
property: 'fontSize',
|
|
63
|
+
icon: 'font-grow',
|
|
64
|
+
svgIcon: fontGrowIcon,
|
|
65
|
+
titleKey: keys.fontSizeIncrease,
|
|
66
|
+
displayName: 'IncreaseFontSize',
|
|
67
|
+
step: 1
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* The DecreaseFontSize tool component.
|
|
71
|
+
*/
|
|
72
|
+
export const DecreaseFontSize = fontSizeChangeTool({
|
|
73
|
+
property: 'fontSize',
|
|
74
|
+
icon: 'font-shrink',
|
|
75
|
+
svgIcon: fontShrinkIcon,
|
|
76
|
+
titleKey: keys.fontSizeDecrease,
|
|
77
|
+
displayName: 'DecreaseFontSize',
|
|
78
|
+
step: -1
|
|
79
|
+
});
|
package/dist/es/tools/index.d.ts
CHANGED
package/dist/es/tools/index.js
CHANGED
package/dist/es/tools/open.js
CHANGED
|
@@ -24,7 +24,7 @@ export const Open = props => {
|
|
|
24
24
|
if (fileInfo[0] && fileInfo[0].getRawFile) {
|
|
25
25
|
const file = fileInfo[0].getRawFile();
|
|
26
26
|
if (spreadsheetRef.current) {
|
|
27
|
-
spreadsheetRef.current.
|
|
27
|
+
spreadsheetRef.current.executeCommand({ command: 'OpenCommand', options: { file } });
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}, []);
|
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SpreadsheetToolProps } from './utils';
|
|
3
|
+
import { SelectedHeaders } from '@progress/kendo-spreadsheet-common';
|
|
4
|
+
interface TableToolProps extends SpreadsheetToolProps {
|
|
5
|
+
/**
|
|
6
|
+
* @hidden
|
|
7
|
+
*/
|
|
8
|
+
value: SelectedHeaders;
|
|
9
|
+
}
|
|
3
10
|
/**
|
|
4
11
|
* The props of the AddColumnLeft tool component.
|
|
5
12
|
*/
|
|
6
|
-
export interface AddColumnLeftProps extends
|
|
13
|
+
export interface AddColumnLeftProps extends TableToolProps {
|
|
7
14
|
}
|
|
8
15
|
/**
|
|
9
16
|
* The props of the AddColumnRight tool component.
|
|
10
17
|
*/
|
|
11
|
-
export interface AddColumnRightProps extends
|
|
18
|
+
export interface AddColumnRightProps extends TableToolProps {
|
|
12
19
|
}
|
|
13
20
|
/**
|
|
14
21
|
* The props of the AddRowBelow tool component.
|
|
15
22
|
*/
|
|
16
|
-
export interface AddRowBelowProps extends
|
|
23
|
+
export interface AddRowBelowProps extends TableToolProps {
|
|
17
24
|
}
|
|
18
25
|
/**
|
|
19
26
|
* The props of the AddRowAbove tool component.
|
|
20
27
|
*/
|
|
21
|
-
export interface AddRowAboveProps extends
|
|
28
|
+
export interface AddRowAboveProps extends TableToolProps {
|
|
22
29
|
}
|
|
23
30
|
/**
|
|
24
31
|
* The props of the DeleteColumn tool component.
|
|
25
32
|
*/
|
|
26
|
-
export interface DeleteColumnProps extends
|
|
33
|
+
export interface DeleteColumnProps extends TableToolProps {
|
|
27
34
|
}
|
|
28
35
|
/**
|
|
29
36
|
* The props of the DeleteRow tool component.
|
|
30
37
|
*/
|
|
31
|
-
export interface DeleteRowProps extends
|
|
38
|
+
export interface DeleteRowProps extends TableToolProps {
|
|
32
39
|
}
|
|
33
40
|
/**
|
|
34
41
|
* The AddColumnLeft tool component.
|
|
@@ -54,3 +61,4 @@ export declare const DeleteColumn: React.FunctionComponent<DeleteColumnProps>;
|
|
|
54
61
|
* The DeleteRow tool component.
|
|
55
62
|
*/
|
|
56
63
|
export declare const DeleteRow: React.FunctionComponent<DeleteRowProps>;
|
|
64
|
+
export {};
|
|
@@ -5,7 +5,7 @@ import { keys, messages } from '../messages';
|
|
|
5
5
|
import { useLocalization } from '@progress/kendo-react-intl';
|
|
6
6
|
const TableDataTool = (settings) => {
|
|
7
7
|
const tool = props => {
|
|
8
|
-
const { spreadsheetRef } = props;
|
|
8
|
+
const { spreadsheetRef, value } = props;
|
|
9
9
|
const onClick = React.useCallback(() => {
|
|
10
10
|
if (spreadsheetRef.current) {
|
|
11
11
|
const options = {
|
|
@@ -14,7 +14,7 @@ const TableDataTool = (settings) => {
|
|
|
14
14
|
spreadsheetRef.current.executeCommand(options);
|
|
15
15
|
}
|
|
16
16
|
}, []);
|
|
17
|
-
return (React.createElement(Button, { type: "button", icon: settings.icon, svgIcon: settings.svgIcon, fillMode: "flat", title: useLocalization().toLanguageString(settings.titleKey, messages[settings.titleKey]), onClick: onClick }));
|
|
17
|
+
return (React.createElement(Button, { type: "button", icon: settings.icon, svgIcon: settings.svgIcon, fillMode: "flat", title: useLocalization().toLanguageString(settings.titleKey, messages[settings.titleKey]), onClick: onClick, disabled: value && settings.disabled(value) }));
|
|
18
18
|
};
|
|
19
19
|
return tool;
|
|
20
20
|
};
|
|
@@ -23,40 +23,52 @@ const addColumnLeft = {
|
|
|
23
23
|
value: 'left',
|
|
24
24
|
icon: 'table-column-insert-left',
|
|
25
25
|
svgIcon: tableColumnInsertLeftIcon,
|
|
26
|
-
titleKey: keys.addColumnLeft
|
|
26
|
+
titleKey: keys.addColumnLeft,
|
|
27
|
+
disabled: (headers) => headers.allCols,
|
|
28
|
+
displayName: 'AddColumnLeft'
|
|
27
29
|
};
|
|
28
30
|
const addColumnRight = {
|
|
29
31
|
command: 'AddColumnCommand',
|
|
30
32
|
value: 'right',
|
|
31
33
|
icon: 'table-column-insert-right',
|
|
32
34
|
svgIcon: tableColumnInsertRightIcon,
|
|
33
|
-
titleKey: keys.addColumnRight
|
|
35
|
+
titleKey: keys.addColumnRight,
|
|
36
|
+
disabled: (headers) => headers.allCols,
|
|
37
|
+
displayName: 'AddColumnRight'
|
|
34
38
|
};
|
|
35
39
|
const addRowBelow = {
|
|
36
40
|
command: 'AddRowCommand',
|
|
37
41
|
value: 'below',
|
|
38
42
|
icon: 'table-row-insert-below',
|
|
39
43
|
svgIcon: tableRowInsertBelowIcon,
|
|
40
|
-
titleKey: keys.addRowBelow
|
|
44
|
+
titleKey: keys.addRowBelow,
|
|
45
|
+
disabled: (headers) => headers.allRows,
|
|
46
|
+
displayName: 'AddRowBelow'
|
|
41
47
|
};
|
|
42
48
|
const addRowAbove = {
|
|
43
49
|
command: 'AddRowCommand',
|
|
44
50
|
value: 'above',
|
|
45
51
|
icon: 'table-row-insert-above',
|
|
46
52
|
svgIcon: tableRowInsertAboveIcon,
|
|
47
|
-
titleKey: keys.addRowAbove
|
|
53
|
+
titleKey: keys.addRowAbove,
|
|
54
|
+
disabled: (headers) => headers.allRows,
|
|
55
|
+
displayName: 'AddRowAbove'
|
|
48
56
|
};
|
|
49
57
|
const deleteColumn = {
|
|
50
58
|
command: 'DeleteColumnCommand',
|
|
51
59
|
icon: 'table-column-delete',
|
|
52
60
|
svgIcon: tableColumnDeleteIcon,
|
|
53
|
-
titleKey: keys.deleteColumn
|
|
61
|
+
titleKey: keys.deleteColumn,
|
|
62
|
+
disabled: (headers) => headers.allCols,
|
|
63
|
+
displayName: 'DeleteColumn'
|
|
54
64
|
};
|
|
55
65
|
const deleteRow = {
|
|
56
66
|
command: 'DeleteRowCommand',
|
|
57
67
|
icon: 'table-row-delete',
|
|
58
68
|
svgIcon: tableRowDeleteIcon,
|
|
59
|
-
titleKey: keys.deleteRow
|
|
69
|
+
titleKey: keys.deleteRow,
|
|
70
|
+
disabled: (headers) => headers.allRows,
|
|
71
|
+
displayName: 'DeleteRow'
|
|
60
72
|
};
|
|
61
73
|
/**
|
|
62
74
|
* The AddColumnLeft tool component.
|
package/dist/npm/FormulaInput.js
CHANGED
|
@@ -112,7 +112,7 @@ exports.FormulaInput = React.forwardRef((props, ref) => {
|
|
|
112
112
|
}, []);
|
|
113
113
|
return (React.createElement(React.Fragment, null,
|
|
114
114
|
React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-spreadsheet-formula-input', props.className), contentEditable: "true", spellCheck: "false", style: { whiteSpace: 'pre' }, ref: elementRef }),
|
|
115
|
-
React.createElement(kendo_react_popup_1.Popup, { show: showPopup, anchor: elementRef.current, animate: { openDuration: 100, closeDuration: 100 }, contentKey: popupContentKey },
|
|
115
|
+
React.createElement(kendo_react_popup_1.Popup, { show: showPopup, anchor: elementRef.current, animate: { openDuration: 100, closeDuration: 100 }, contentKey: popupContentKey, popupClass: "k-list-container" },
|
|
116
116
|
React.createElement(List_1.List, { data: data, ref: listRef, onItemClick: onItemClick }))));
|
|
117
117
|
});
|
|
118
118
|
exports.FormulaInput.displayName = 'FormulaInput';
|
package/dist/npm/List.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.List = void 0;
|
|
4
4
|
const React = require("react");
|
|
5
|
+
const kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
6
|
+
const kendo_svg_icons_1 = require("@progress/kendo-svg-icons");
|
|
5
7
|
/**
|
|
6
8
|
* @hidden
|
|
7
9
|
*/
|
|
@@ -13,8 +15,11 @@ exports.List = React.forwardRef((props, ref) => {
|
|
|
13
15
|
props
|
|
14
16
|
}));
|
|
15
17
|
React.useImperativeHandle(ref, () => target.current);
|
|
16
|
-
return (React.createElement("
|
|
17
|
-
React.createElement("
|
|
18
|
+
return (React.createElement("div", { className: "k-list k-list-md" },
|
|
19
|
+
React.createElement("div", { className: "k-list-content" },
|
|
20
|
+
React.createElement("ul", { ref: ulRef, className: "k-spreadsheet-formula-list k-list-ul", onMouseDown: e => e.preventDefault(), style: { maxHeight: 280 } }, props.data.map((item) => (React.createElement("li", { key: item.text, className: "k-list-item", onClick: () => props.onItemClick(item.value) },
|
|
21
|
+
React.createElement(kendo_react_common_1.IconWrap, { name: "formula-fx", icon: kendo_svg_icons_1.formulaFxIcon }),
|
|
22
|
+
React.createElement("span", { className: "k-list-item-text" }, item.text))))))));
|
|
18
23
|
});
|
|
19
24
|
exports.List.displayName = 'List';
|
|
20
25
|
exports.List.propTypes = {};
|
package/dist/npm/Spreadsheet.js
CHANGED
|
@@ -5,6 +5,7 @@ const React = require("react");
|
|
|
5
5
|
const PropTypes = require("prop-types");
|
|
6
6
|
const kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
|
|
7
7
|
const kendo_react_layout_1 = require("@progress/kendo-react-layout");
|
|
8
|
+
const kendo_react_dialogs_1 = require("@progress/kendo-react-dialogs");
|
|
8
9
|
const FormulaInput_1 = require("./FormulaInput");
|
|
9
10
|
const NameBox_1 = require("./NameBox");
|
|
10
11
|
const SheetsBar_1 = require("./SheetsBar");
|
|
@@ -24,11 +25,21 @@ const toolsValueMap = {
|
|
|
24
25
|
Underline: (state) => state.underline,
|
|
25
26
|
FontFamily: (state) => state.fontFamily,
|
|
26
27
|
FontSize: (state) => state.fontSize,
|
|
28
|
+
IncreaseFontSize: (state) => state.fontSize,
|
|
29
|
+
DecreaseFontSize: (state) => state.fontSize,
|
|
27
30
|
TextColor: (state) => state.color,
|
|
28
31
|
BackgroundColor: (state) => state.background,
|
|
29
32
|
Alignment: (state) => ({ textAlign: state.textAlign, verticalAlign: state.verticalAlign }),
|
|
33
|
+
AlignHorizontally: (state) => state.textAlign,
|
|
34
|
+
AlignVertically: (state) => state.verticalAlign,
|
|
30
35
|
TextWrap: (state) => state.wrap,
|
|
31
|
-
GridLines: (state) => state.gridLines
|
|
36
|
+
GridLines: (state) => state.gridLines,
|
|
37
|
+
AddColumnLeft: (state) => state.selectedHeaders,
|
|
38
|
+
AddColumnRight: (state) => state.selectedHeaders,
|
|
39
|
+
AddRowBelow: (state) => state.selectedHeaders,
|
|
40
|
+
AddRowAbove: (state) => state.selectedHeaders,
|
|
41
|
+
DeleteColumn: (state) => state.selectedHeaders,
|
|
42
|
+
DeleteRow: (state) => state.selectedHeaders
|
|
32
43
|
};
|
|
33
44
|
const noInnerButton = ':not(.k-dropdownlist button)' +
|
|
34
45
|
':not(.k-combobox button)' +
|
|
@@ -59,6 +70,7 @@ exports.Spreadsheet = React.forwardRef((props, ref) => {
|
|
|
59
70
|
else {
|
|
60
71
|
toolbarTools.push(...toolbar);
|
|
61
72
|
}
|
|
73
|
+
const [dialog, setDialog] = React.useState(null);
|
|
62
74
|
const [tab, setTab] = React.useState(toolbarTools.findIndex(t => t.selected) || 0);
|
|
63
75
|
const [_init, setInit] = React.useState(false);
|
|
64
76
|
const elementRef = React.useRef(null);
|
|
@@ -71,6 +83,7 @@ exports.Spreadsheet = React.forwardRef((props, ref) => {
|
|
|
71
83
|
prevState.current = toolsState;
|
|
72
84
|
const propsRef = React.useRef({});
|
|
73
85
|
propsRef.current = props;
|
|
86
|
+
const loc = (0, kendo_react_intl_1.useLocalization)();
|
|
74
87
|
const onSelect = React.useCallback((event) => {
|
|
75
88
|
if (propsRef.current.onSelect) {
|
|
76
89
|
propsRef.current.onSelect.call(undefined, event);
|
|
@@ -131,10 +144,24 @@ exports.Spreadsheet = React.forwardRef((props, ref) => {
|
|
|
131
144
|
state[tool] = e.range.sheet().showGridLines();
|
|
132
145
|
}
|
|
133
146
|
});
|
|
134
|
-
|
|
147
|
+
state.selectedHeaders = e.range.sheet().selectedHeaders();
|
|
148
|
+
if (Object.keys(state).some(k => state[k] !== prevState.current[k])) {
|
|
135
149
|
setToolsState(state);
|
|
136
150
|
}
|
|
137
151
|
}, []);
|
|
152
|
+
const onMessage = React.useCallback((e) => {
|
|
153
|
+
const name = e.name;
|
|
154
|
+
const key = messages_1.keys[name];
|
|
155
|
+
setDialog({
|
|
156
|
+
title: e.title === 'Error' ? loc.toLanguageString(messages_1.keys.error, messages_1.messages[messages_1.keys.error] || e.title) : e.title,
|
|
157
|
+
message: key ? loc.toLanguageString(key, messages_1.messages[key] || e.text) : e.text,
|
|
158
|
+
close: e.close
|
|
159
|
+
});
|
|
160
|
+
}, []);
|
|
161
|
+
const onDialogClose = React.useCallback(() => {
|
|
162
|
+
setDialog(null);
|
|
163
|
+
dialog === null || dialog === void 0 ? void 0 : dialog.close();
|
|
164
|
+
}, [dialog]);
|
|
138
165
|
const intl = (0, kendo_react_intl_1.useInternationalization)();
|
|
139
166
|
const localization = (0, kendo_react_intl_1.useLocalization)();
|
|
140
167
|
React.useEffect(() => {
|
|
@@ -159,6 +186,7 @@ exports.Spreadsheet = React.forwardRef((props, ref) => {
|
|
|
159
186
|
spreadsheet.bind('excelImport', onExcelImport);
|
|
160
187
|
spreadsheet.bind('excelExport', onExcelExport);
|
|
161
188
|
spreadsheet.view.bind('update', onUpdateTools);
|
|
189
|
+
spreadsheet.view.bind('message', onMessage);
|
|
162
190
|
const sheet = spreadsheet.activeSheet();
|
|
163
191
|
if (sheet) {
|
|
164
192
|
onUpdateTools({ range: sheet.range(sheet.activeCell()) });
|
|
@@ -201,6 +229,10 @@ exports.Spreadsheet = React.forwardRef((props, ref) => {
|
|
|
201
229
|
React.createElement("div", { tabIndex: 0, className: "k-spreadsheet-clipboard", contentEditable: "true" }),
|
|
202
230
|
React.createElement(FormulaInput_1.FormulaInput, { ref: formulaCellInputRef, className: "k-spreadsheet-cell-editor" })),
|
|
203
231
|
React.createElement(SheetsBar_1.SheetsBar, { spreadsheetRef: spreadsheetRef }),
|
|
232
|
+
dialog && (React.createElement(kendo_react_dialogs_1.Dialog, { title: dialog.title, onClose: onDialogClose },
|
|
233
|
+
React.createElement("div", null, dialog.message),
|
|
234
|
+
React.createElement(kendo_react_dialogs_1.DialogActionsBar, { layout: 'start' },
|
|
235
|
+
React.createElement(kendo_react_buttons_1.Button, { themeColor: 'primary', onClick: onDialogClose }, loc.toLanguageString(messages_1.keys.ok, messages_1.messages[messages_1.keys.ok]))))),
|
|
204
236
|
showLicenseWatermark && React.createElement(kendo_react_common_1.WatermarkOverlay, null)));
|
|
205
237
|
});
|
|
206
238
|
exports.Spreadsheet.displayName = 'KendoReactSpreadsheet';
|
package/dist/npm/messages.d.ts
CHANGED
|
@@ -8,16 +8,25 @@ export declare const messages: {
|
|
|
8
8
|
"spreadsheet.undo": string;
|
|
9
9
|
"spreadsheet.redo": string;
|
|
10
10
|
"spreadsheet.fontSize": string;
|
|
11
|
+
"spreadsheet.fontSizeIncrease": string;
|
|
12
|
+
"spreadsheet.fontSizeDecrease": string;
|
|
11
13
|
"spreadsheet.fontName": string;
|
|
14
|
+
"spreadsheet.cleanFormatting": string;
|
|
12
15
|
"spreadsheet.format": string;
|
|
16
|
+
"spreadsheet.alignHorizontally": string;
|
|
17
|
+
"spreadsheet.alignVertically": string;
|
|
13
18
|
"spreadsheet.align": string;
|
|
14
19
|
"spreadsheet.alignLeft": string;
|
|
15
20
|
"spreadsheet.alignRight": string;
|
|
16
21
|
"spreadsheet.alignCenter": string;
|
|
17
22
|
"spreadsheet.alignJustify": string;
|
|
23
|
+
"spreadsheet.center": string;
|
|
24
|
+
"spreadsheet.justify": string;
|
|
18
25
|
"spreadsheet.alignTop": string;
|
|
19
26
|
"spreadsheet.alignMiddle": string;
|
|
20
27
|
"spreadsheet.alignBottom": string;
|
|
28
|
+
"spreadsheet.increaseDecimal": string;
|
|
29
|
+
"spreadsheet.decreaseDecimal": string;
|
|
21
30
|
"spreadsheet.textColor": string;
|
|
22
31
|
"spreadsheet.background": string;
|
|
23
32
|
"spreadsheet.addRowAbove": string;
|
|
@@ -36,6 +45,12 @@ export declare const messages: {
|
|
|
36
45
|
"spreadsheet.file": string;
|
|
37
46
|
"spreadsheet.insert": string;
|
|
38
47
|
"spreadsheet.addNewSheet": string;
|
|
48
|
+
"spreadsheet.formatTab": string;
|
|
49
|
+
"spreadsheet.modifyMerged": string;
|
|
50
|
+
"spreadsheet.cannotModifyDisabled": string;
|
|
51
|
+
"spreadsheet.openUnsupported": string;
|
|
52
|
+
"spreadsheet.error": string;
|
|
53
|
+
"spreadsheet.ok": string;
|
|
39
54
|
};
|
|
40
55
|
/**
|
|
41
56
|
* @hidden
|
|
@@ -47,16 +62,25 @@ export declare const keys: {
|
|
|
47
62
|
undo: string;
|
|
48
63
|
redo: string;
|
|
49
64
|
fontSize: string;
|
|
65
|
+
fontSizeIncrease: string;
|
|
66
|
+
fontSizeDecrease: string;
|
|
50
67
|
fontName: string;
|
|
68
|
+
cleanFormatting: string;
|
|
51
69
|
format: string;
|
|
70
|
+
alignHorizontally: string;
|
|
71
|
+
alignVertically: string;
|
|
52
72
|
align: string;
|
|
53
73
|
alignLeft: string;
|
|
54
74
|
alignRight: string;
|
|
55
75
|
alignCenter: string;
|
|
76
|
+
center: string;
|
|
56
77
|
alignJustify: string;
|
|
78
|
+
justify: string;
|
|
57
79
|
alignTop: string;
|
|
58
80
|
alignMiddle: string;
|
|
59
81
|
alignBottom: string;
|
|
82
|
+
increaseDecimal: string;
|
|
83
|
+
decreaseDecimal: string;
|
|
60
84
|
textColor: string;
|
|
61
85
|
background: string;
|
|
62
86
|
addRowAbove: string;
|
|
@@ -75,4 +99,10 @@ export declare const keys: {
|
|
|
75
99
|
home: string;
|
|
76
100
|
insert: string;
|
|
77
101
|
addNewSheet: string;
|
|
102
|
+
error: string;
|
|
103
|
+
ok: string;
|
|
104
|
+
modifyMerged: string;
|
|
105
|
+
cannotModifyDisabled: string;
|
|
106
|
+
openUnsupported: string;
|
|
107
|
+
formatTab: string;
|
|
78
108
|
};
|
package/dist/npm/messages.js
CHANGED
|
@@ -61,14 +61,34 @@ const redo = 'spreadsheet.redo';
|
|
|
61
61
|
* @hidden
|
|
62
62
|
*/
|
|
63
63
|
const fontSize = 'spreadsheet.fontSize';
|
|
64
|
+
/**
|
|
65
|
+
* @hidden
|
|
66
|
+
*/
|
|
67
|
+
const fontSizeIncrease = 'spreadsheet.fontSizeIncrease';
|
|
68
|
+
/**
|
|
69
|
+
* @hidden
|
|
70
|
+
*/
|
|
71
|
+
const fontSizeDecrease = 'spreadsheet.fontSizeDecrease';
|
|
64
72
|
/**
|
|
65
73
|
* @hidden
|
|
66
74
|
*/
|
|
67
75
|
const fontName = 'spreadsheet.fontName';
|
|
76
|
+
/**
|
|
77
|
+
* @hidden
|
|
78
|
+
*/
|
|
79
|
+
const cleanFormatting = 'spreadsheet.cleanFormatting';
|
|
68
80
|
/**
|
|
69
81
|
* @hidden
|
|
70
82
|
*/
|
|
71
83
|
const format = 'spreadsheet.format';
|
|
84
|
+
/**
|
|
85
|
+
* @hidden
|
|
86
|
+
*/
|
|
87
|
+
const alignHorizontally = 'spreadsheet.alignHorizontally';
|
|
88
|
+
/**
|
|
89
|
+
* @hidden
|
|
90
|
+
*/
|
|
91
|
+
const alignVertically = 'spreadsheet.alignVertically';
|
|
72
92
|
/**
|
|
73
93
|
* @hidden
|
|
74
94
|
*/
|
|
@@ -85,10 +105,18 @@ const alignRight = 'spreadsheet.alignRight';
|
|
|
85
105
|
* @hidden
|
|
86
106
|
*/
|
|
87
107
|
const alignCenter = 'spreadsheet.alignCenter';
|
|
108
|
+
/**
|
|
109
|
+
* @hidden
|
|
110
|
+
*/
|
|
111
|
+
const center = 'spreadsheet.center';
|
|
88
112
|
/**
|
|
89
113
|
* @hidden
|
|
90
114
|
*/
|
|
91
115
|
const alignJustify = 'spreadsheet.alignJustify';
|
|
116
|
+
/**
|
|
117
|
+
* @hidden
|
|
118
|
+
*/
|
|
119
|
+
const justify = 'spreadsheet.justify';
|
|
92
120
|
/**
|
|
93
121
|
* @hidden
|
|
94
122
|
*/
|
|
@@ -101,6 +129,14 @@ const alignMiddle = 'spreadsheet.alignMiddle';
|
|
|
101
129
|
* @hidden
|
|
102
130
|
*/
|
|
103
131
|
const alignBottom = 'spreadsheet.alignBottom';
|
|
132
|
+
/**
|
|
133
|
+
* @hidden
|
|
134
|
+
*/
|
|
135
|
+
const increaseDecimal = 'spreadsheet.increaseDecimal';
|
|
136
|
+
/**
|
|
137
|
+
* @hidden
|
|
138
|
+
*/
|
|
139
|
+
const decreaseDecimal = 'spreadsheet.decreaseDecimal';
|
|
104
140
|
/**
|
|
105
141
|
* @hidden
|
|
106
142
|
*/
|
|
@@ -133,10 +169,34 @@ const file = 'spreadsheet.file';
|
|
|
133
169
|
* @hidden
|
|
134
170
|
*/
|
|
135
171
|
const insert = 'spreadsheet.insert';
|
|
172
|
+
/**
|
|
173
|
+
* @hidden
|
|
174
|
+
*/
|
|
175
|
+
const formatTab = 'spreadsheet.formatTab';
|
|
136
176
|
/**
|
|
137
177
|
* @hidden
|
|
138
178
|
*/
|
|
139
179
|
const addNewSheet = 'spreadsheet.addNewSheet';
|
|
180
|
+
/**
|
|
181
|
+
* @hidden
|
|
182
|
+
*/
|
|
183
|
+
const error = 'spreadsheet.error';
|
|
184
|
+
/**
|
|
185
|
+
* @hidden
|
|
186
|
+
*/
|
|
187
|
+
const ok = 'spreadsheet.ok';
|
|
188
|
+
/**
|
|
189
|
+
* @hidden
|
|
190
|
+
*/
|
|
191
|
+
const modifyMerged = 'spreadsheet.modifyMerged';
|
|
192
|
+
/**
|
|
193
|
+
* @hidden
|
|
194
|
+
*/
|
|
195
|
+
const cannotModifyDisabled = 'spreadsheet.cannotModifyDisabled';
|
|
196
|
+
/**
|
|
197
|
+
* @hidden
|
|
198
|
+
*/
|
|
199
|
+
const openUnsupported = 'spreadsheet.openUnsupported';
|
|
140
200
|
/**
|
|
141
201
|
* @hidden
|
|
142
202
|
*/
|
|
@@ -147,16 +207,25 @@ exports.messages = {
|
|
|
147
207
|
[undo]: 'Undo',
|
|
148
208
|
[redo]: 'Redo',
|
|
149
209
|
[fontSize]: 'Font size',
|
|
210
|
+
[fontSizeIncrease]: 'Increase Font size',
|
|
211
|
+
[fontSizeDecrease]: 'Decrease Font size',
|
|
150
212
|
[fontName]: 'Font',
|
|
213
|
+
[cleanFormatting]: 'Clean formatting',
|
|
151
214
|
[format]: 'Custom format...',
|
|
215
|
+
[alignHorizontally]: 'Align horizontally',
|
|
216
|
+
[alignVertically]: 'Align vertically',
|
|
152
217
|
[align]: 'Align',
|
|
153
|
-
[alignLeft]: 'Align
|
|
154
|
-
[alignRight]: 'Align
|
|
155
|
-
[alignCenter]: 'Align
|
|
156
|
-
[alignJustify]: 'Align
|
|
157
|
-
[
|
|
158
|
-
[
|
|
159
|
-
[
|
|
218
|
+
[alignLeft]: 'Align left',
|
|
219
|
+
[alignRight]: 'Align right',
|
|
220
|
+
[alignCenter]: 'Align center',
|
|
221
|
+
[alignJustify]: 'Align justify',
|
|
222
|
+
[center]: 'Center',
|
|
223
|
+
[justify]: 'Justify',
|
|
224
|
+
[alignTop]: 'Align top',
|
|
225
|
+
[alignMiddle]: 'Align middle',
|
|
226
|
+
[alignBottom]: 'Align bottom',
|
|
227
|
+
[increaseDecimal]: 'Increase decimal',
|
|
228
|
+
[decreaseDecimal]: 'Decrease decimal',
|
|
160
229
|
[textColor]: 'Text Color',
|
|
161
230
|
[background]: 'Background color',
|
|
162
231
|
[addRowAbove]: 'Add row above',
|
|
@@ -174,7 +243,13 @@ exports.messages = {
|
|
|
174
243
|
[home]: 'Home',
|
|
175
244
|
[file]: 'File',
|
|
176
245
|
[insert]: 'Insert',
|
|
177
|
-
[addNewSheet]: 'Add new sheet'
|
|
246
|
+
[addNewSheet]: 'Add new sheet',
|
|
247
|
+
[formatTab]: 'Format',
|
|
248
|
+
[modifyMerged]: 'Cannot change part of a merged cell.',
|
|
249
|
+
[cannotModifyDisabled]: 'Cannot modify disabled cells.',
|
|
250
|
+
[openUnsupported]: 'Unsupported format. Please select an .xlsx file.',
|
|
251
|
+
[error]: 'Error',
|
|
252
|
+
[ok]: 'OK'
|
|
178
253
|
};
|
|
179
254
|
/**
|
|
180
255
|
* @hidden
|
|
@@ -186,16 +261,25 @@ exports.keys = {
|
|
|
186
261
|
undo,
|
|
187
262
|
redo,
|
|
188
263
|
fontSize,
|
|
264
|
+
fontSizeIncrease,
|
|
265
|
+
fontSizeDecrease,
|
|
189
266
|
fontName,
|
|
267
|
+
cleanFormatting,
|
|
190
268
|
format,
|
|
269
|
+
alignHorizontally,
|
|
270
|
+
alignVertically,
|
|
191
271
|
align,
|
|
192
272
|
alignLeft,
|
|
193
273
|
alignRight,
|
|
194
274
|
alignCenter,
|
|
275
|
+
center,
|
|
195
276
|
alignJustify,
|
|
277
|
+
justify,
|
|
196
278
|
alignTop,
|
|
197
279
|
alignMiddle,
|
|
198
280
|
alignBottom,
|
|
281
|
+
increaseDecimal,
|
|
282
|
+
decreaseDecimal,
|
|
199
283
|
textColor,
|
|
200
284
|
background,
|
|
201
285
|
addRowAbove,
|
|
@@ -213,5 +297,11 @@ exports.keys = {
|
|
|
213
297
|
file,
|
|
214
298
|
home,
|
|
215
299
|
insert,
|
|
216
|
-
addNewSheet
|
|
300
|
+
addNewSheet,
|
|
301
|
+
error,
|
|
302
|
+
ok,
|
|
303
|
+
modifyMerged,
|
|
304
|
+
cannotModifyDisabled,
|
|
305
|
+
openUnsupported,
|
|
306
|
+
formatTab
|
|
217
307
|
};
|