@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
|
@@ -8,7 +8,7 @@ exports.packageMetadata = {
|
|
|
8
8
|
name: '@progress/kendo-react-spreadsheet',
|
|
9
9
|
productName: 'KendoReact',
|
|
10
10
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
11
|
-
publishDate:
|
|
11
|
+
publishDate: 1692893863,
|
|
12
12
|
version: '',
|
|
13
13
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
14
14
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SpreadsheetToolProps } from './utils';
|
|
3
|
+
/**
|
|
4
|
+
* The props of the IncreaseDecimal tool component.
|
|
5
|
+
*/
|
|
6
|
+
export interface IncreaseDecimalProps extends SpreadsheetToolProps {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The IncreaseDecimal tool component.
|
|
10
|
+
*/
|
|
11
|
+
export declare const IncreaseDecimal: React.FunctionComponent<IncreaseDecimalProps>;
|
|
12
|
+
/**
|
|
13
|
+
* The props of the DecreaseDecimal tool component.
|
|
14
|
+
*/
|
|
15
|
+
export interface DecreaseDecimalProps extends SpreadsheetToolProps {
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The DecreaseDecimal tool component.
|
|
19
|
+
*/
|
|
20
|
+
export declare const DecreaseDecimal: React.FunctionComponent<DecreaseDecimalProps>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DecreaseDecimal = exports.IncreaseDecimal = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
|
|
6
|
+
const kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
7
|
+
const messages_1 = require("../messages");
|
|
8
|
+
const kendo_svg_icons_1 = require("@progress/kendo-svg-icons");
|
|
9
|
+
const adjustDecimalsTool = (settings) => {
|
|
10
|
+
const tool = props => {
|
|
11
|
+
const { icon, svgIcon, titleKey, value } = settings;
|
|
12
|
+
const { spreadsheetRef } = props;
|
|
13
|
+
const onClick = React.useCallback(() => {
|
|
14
|
+
if (spreadsheetRef.current) {
|
|
15
|
+
const options = {
|
|
16
|
+
command: 'AdjustDecimalsCommand', options: { value }
|
|
17
|
+
};
|
|
18
|
+
spreadsheetRef.current.executeCommand(options);
|
|
19
|
+
}
|
|
20
|
+
}, []);
|
|
21
|
+
return (React.createElement(kendo_react_buttons_1.Button, { type: "button", icon: icon, svgIcon: svgIcon, fillMode: "flat", onClick: onClick, title: (0, kendo_react_intl_1.useLocalization)().toLanguageString(titleKey, messages_1.messages[titleKey]) }));
|
|
22
|
+
};
|
|
23
|
+
return tool;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The IncreaseDecimal tool component.
|
|
27
|
+
*/
|
|
28
|
+
exports.IncreaseDecimal = adjustDecimalsTool({
|
|
29
|
+
icon: kendo_svg_icons_1.decimalIncreaseIcon.name,
|
|
30
|
+
svgIcon: kendo_svg_icons_1.decimalIncreaseIcon,
|
|
31
|
+
value: 1,
|
|
32
|
+
titleKey: messages_1.keys.increaseDecimal
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* The DecreaseDecimal tool component.
|
|
36
|
+
*/
|
|
37
|
+
exports.DecreaseDecimal = adjustDecimalsTool({
|
|
38
|
+
icon: kendo_svg_icons_1.decimalDecreaseIcon.name,
|
|
39
|
+
svgIcon: kendo_svg_icons_1.decimalDecreaseIcon,
|
|
40
|
+
value: -1,
|
|
41
|
+
titleKey: messages_1.keys.decreaseDecimal
|
|
42
|
+
});
|
|
@@ -16,3 +16,29 @@ export interface AlignmentProps extends SpreadsheetToolProps {
|
|
|
16
16
|
* The Alignment tool component.
|
|
17
17
|
*/
|
|
18
18
|
export declare const Alignment: React.FunctionComponent<AlignmentProps>;
|
|
19
|
+
/**
|
|
20
|
+
* The props of the AlignHorizontally tool component.
|
|
21
|
+
*/
|
|
22
|
+
export interface AlignHorizontallyProps extends SpreadsheetToolProps {
|
|
23
|
+
/**
|
|
24
|
+
* The value of the tool.
|
|
25
|
+
*/
|
|
26
|
+
value: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The props of the AlignVertically tool component.
|
|
30
|
+
*/
|
|
31
|
+
export interface AlignVerticallyProps extends SpreadsheetToolProps {
|
|
32
|
+
/**
|
|
33
|
+
* The value of the tool.
|
|
34
|
+
*/
|
|
35
|
+
value: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The AlignHorizontally tool component.
|
|
39
|
+
*/
|
|
40
|
+
export declare const AlignHorizontally: React.FunctionComponent<AlignHorizontallyProps>;
|
|
41
|
+
/**
|
|
42
|
+
* The AlignVertically tool component.
|
|
43
|
+
*/
|
|
44
|
+
export declare const AlignVertically: React.FunctionComponent<AlignVerticallyProps>;
|
package/dist/npm/tools/align.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Alignment = void 0;
|
|
3
|
+
exports.AlignVertically = exports.AlignHorizontally = exports.Alignment = void 0;
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
|
|
6
6
|
const kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
@@ -8,14 +8,21 @@ const kendo_svg_icons_1 = require("@progress/kendo-svg-icons");
|
|
|
8
8
|
const kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
9
9
|
const messages_1 = require("../messages");
|
|
10
10
|
const alignItems = [
|
|
11
|
-
{ icon: 'align-left', svgIcon: kendo_svg_icons_1.alignLeftIcon, textKey: messages_1.keys.alignLeft, commandName: 'textAlign', value: 'left' },
|
|
12
|
-
{ icon: 'align-center', svgIcon: kendo_svg_icons_1.alignCenterIcon, textKey: messages_1.keys.alignCenter, commandName: 'textAlign', value: 'center' },
|
|
13
|
-
{ icon: 'align-right', svgIcon: kendo_svg_icons_1.alignRightIcon, textKey: messages_1.keys.alignRight, commandName: 'textAlign', value: 'right' },
|
|
14
|
-
{ icon: 'align-justify', svgIcon: kendo_svg_icons_1.alignJustifyIcon, textKey: messages_1.keys.alignJustify, commandName: 'textAlign', value: 'justify' },
|
|
15
|
-
{ icon: 'align-top', svgIcon: kendo_svg_icons_1.alignTopIcon, textKey: messages_1.keys.alignTop, commandName: 'verticalAlign', value: 'top' },
|
|
16
|
-
{ icon: 'align-middle', svgIcon: kendo_svg_icons_1.alignMiddleIcon, textKey: messages_1.keys.alignMiddle, commandName: 'verticalAlign', value: 'center' },
|
|
17
|
-
{ icon: 'align-bottom', svgIcon: kendo_svg_icons_1.alignBottomIcon, textKey: messages_1.keys.alignBottom, commandName: 'verticalAlign', value: 'bottom' }
|
|
11
|
+
{ icon: 'align-left', svgIcon: kendo_svg_icons_1.alignLeftIcon, textKey: messages_1.keys.alignLeft, commandName: 'textAlign', value: 'left', selected: false },
|
|
12
|
+
{ icon: 'align-center', svgIcon: kendo_svg_icons_1.alignCenterIcon, textKey: messages_1.keys.alignCenter, commandName: 'textAlign', value: 'center', selected: false },
|
|
13
|
+
{ icon: 'align-right', svgIcon: kendo_svg_icons_1.alignRightIcon, textKey: messages_1.keys.alignRight, commandName: 'textAlign', value: 'right', selected: false },
|
|
14
|
+
{ icon: 'align-justify', svgIcon: kendo_svg_icons_1.alignJustifyIcon, textKey: messages_1.keys.alignJustify, commandName: 'textAlign', value: 'justify', selected: false },
|
|
15
|
+
{ icon: 'align-top', svgIcon: kendo_svg_icons_1.alignTopIcon, textKey: messages_1.keys.alignTop, commandName: 'verticalAlign', value: 'top', selected: false },
|
|
16
|
+
{ icon: 'align-middle', svgIcon: kendo_svg_icons_1.alignMiddleIcon, textKey: messages_1.keys.alignMiddle, commandName: 'verticalAlign', value: 'center', selected: false },
|
|
17
|
+
{ icon: 'align-bottom', svgIcon: kendo_svg_icons_1.alignBottomIcon, textKey: messages_1.keys.alignBottom, commandName: 'verticalAlign', value: 'bottom', selected: false }
|
|
18
18
|
];
|
|
19
|
+
const alignHorizontalItems = [
|
|
20
|
+
alignItems[0],
|
|
21
|
+
Object.assign(Object.assign({}, alignItems[1]), { textKey: messages_1.keys.center }),
|
|
22
|
+
alignItems[2],
|
|
23
|
+
Object.assign(Object.assign({}, alignItems[3]), { textKey: messages_1.keys.justify })
|
|
24
|
+
];
|
|
25
|
+
const alignVerticalItems = alignItems.filter(i => i.commandName === 'verticalAlign');
|
|
19
26
|
/**
|
|
20
27
|
* The Alignment tool component.
|
|
21
28
|
*/
|
|
@@ -44,3 +51,50 @@ const Alignment = props => {
|
|
|
44
51
|
};
|
|
45
52
|
exports.Alignment = Alignment;
|
|
46
53
|
exports.Alignment.displayName = 'Alignment';
|
|
54
|
+
const alignHorizontal = {
|
|
55
|
+
items: alignHorizontalItems,
|
|
56
|
+
icon: { icon: 'align-left', svgIcon: kendo_svg_icons_1.alignLeftIcon },
|
|
57
|
+
displayName: 'AlignHorizontally',
|
|
58
|
+
titleKey: messages_1.keys.alignHorizontally
|
|
59
|
+
};
|
|
60
|
+
const alignVertical = {
|
|
61
|
+
items: alignVerticalItems,
|
|
62
|
+
icon: { icon: 'align-bottom', svgIcon: kendo_svg_icons_1.alignBottomIcon },
|
|
63
|
+
displayName: 'AlignVertically',
|
|
64
|
+
titleKey: messages_1.keys.alignVertically
|
|
65
|
+
};
|
|
66
|
+
const createAlignTool = (settings) => {
|
|
67
|
+
const Tool = props => {
|
|
68
|
+
const { value, spreadsheetRef } = props;
|
|
69
|
+
const loc = (0, kendo_react_intl_1.useLocalization)();
|
|
70
|
+
const onItemClick = React.useCallback((event) => {
|
|
71
|
+
if (spreadsheetRef.current) {
|
|
72
|
+
const item = event.item;
|
|
73
|
+
const options = {
|
|
74
|
+
command: 'PropertyChangeCommand', options: { property: item.commandName, value: item.value || null }
|
|
75
|
+
};
|
|
76
|
+
spreadsheetRef.current.executeCommand(options);
|
|
77
|
+
}
|
|
78
|
+
}, []);
|
|
79
|
+
let items = settings.items.slice();
|
|
80
|
+
items = items.map(i => (Object.assign(Object.assign({}, i), { text: loc.toLanguageString(i.textKey, messages_1.messages[i.textKey]) })));
|
|
81
|
+
items = items.map(i => (Object.assign(Object.assign({}, i), { selected: i.value === value })));
|
|
82
|
+
const icons = Object.assign({}, settings.icon);
|
|
83
|
+
const selected = items.find(i => i.selected);
|
|
84
|
+
if (selected) {
|
|
85
|
+
icons.icon = selected.icon;
|
|
86
|
+
icons.svgIcon = selected.svgIcon;
|
|
87
|
+
}
|
|
88
|
+
return (React.createElement(kendo_react_buttons_1.DropDownButton, Object.assign({}, icons, { items: items, fillMode: "flat", onItemClick: onItemClick, title: loc.toLanguageString(settings.titleKey, messages_1.messages[settings.titleKey]), text: React.createElement(kendo_react_common_1.IconWrap, { name: "caret-alt-down", icon: kendo_svg_icons_1.caretAltDownIcon }) })));
|
|
89
|
+
};
|
|
90
|
+
Tool.displayName = settings.displayName;
|
|
91
|
+
return Tool;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* The AlignHorizontally tool component.
|
|
95
|
+
*/
|
|
96
|
+
exports.AlignHorizontally = createAlignTool(alignHorizontal);
|
|
97
|
+
/**
|
|
98
|
+
* The AlignVertically tool component.
|
|
99
|
+
*/
|
|
100
|
+
exports.AlignVertically = createAlignTool(alignVertical);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PropertyChangeToolProps } from './utils';
|
|
3
|
+
/**
|
|
4
|
+
* @hidden
|
|
5
|
+
*/
|
|
6
|
+
export interface CleanFormattingProps extends PropertyChangeToolProps {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export declare const CleanFormatting: React.FunctionComponent<CleanFormattingProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CleanFormatting = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const kendo_svg_icons_1 = require("@progress/kendo-svg-icons");
|
|
6
|
+
const kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
|
|
7
|
+
const kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
8
|
+
const messages_1 = require("../messages");
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
const CleanFormatting = props => {
|
|
13
|
+
const { spreadsheetRef } = props;
|
|
14
|
+
const onClick = React.useCallback(() => {
|
|
15
|
+
if (spreadsheetRef.current) {
|
|
16
|
+
spreadsheetRef.current.executeCommand({ command: 'PropertyCleanCommand' });
|
|
17
|
+
}
|
|
18
|
+
}, []);
|
|
19
|
+
return (React.createElement(kendo_react_buttons_1.Button, { type: "button", icon: 'clean-css', svgIcon: kendo_svg_icons_1.clearCssIcon, fillMode: "flat", onClick: onClick, title: (0, kendo_react_intl_1.useLocalization)().toLanguageString(messages_1.keys.cleanFormatting, messages_1.messages[messages_1.keys.cleanFormatting]) }));
|
|
20
|
+
};
|
|
21
|
+
exports.CleanFormatting = CleanFormatting;
|
|
@@ -19,6 +19,7 @@ const tableTools_1 = require("./tableTools");
|
|
|
19
19
|
const messages_1 = require("../messages");
|
|
20
20
|
const undo_1 = require("./undo");
|
|
21
21
|
const redo_1 = require("./redo");
|
|
22
|
+
const adjustDecimals_1 = require("./adjustDecimals");
|
|
22
23
|
/**
|
|
23
24
|
* The default toolbar configuration.
|
|
24
25
|
*/
|
|
@@ -37,16 +38,18 @@ exports.defaultTabs = [
|
|
|
37
38
|
kendo_react_buttons_1.ToolbarSeparator,
|
|
38
39
|
fontFamily_1.FontFamily,
|
|
39
40
|
fontSize_1.FontSize,
|
|
41
|
+
fontSize_1.IncreaseFontSize,
|
|
42
|
+
fontSize_1.DecreaseFontSize,
|
|
43
|
+
kendo_react_buttons_1.ToolbarSeparator,
|
|
40
44
|
[bold_1.Bold, italic_1.Italic, underline_1.Underline],
|
|
41
45
|
textColor_1.TextColor,
|
|
42
46
|
kendo_react_buttons_1.ToolbarSeparator,
|
|
43
47
|
backgroundColor_1.BackgroundColor,
|
|
44
48
|
kendo_react_buttons_1.ToolbarSeparator,
|
|
45
|
-
align_1.
|
|
49
|
+
align_1.AlignHorizontally,
|
|
50
|
+
align_1.AlignVertically,
|
|
46
51
|
textWrap_1.TextWrap,
|
|
47
52
|
kendo_react_buttons_1.ToolbarSeparator,
|
|
48
|
-
format_1.Format,
|
|
49
|
-
kendo_react_buttons_1.ToolbarSeparator,
|
|
50
53
|
gridLines_1.GridLines
|
|
51
54
|
]
|
|
52
55
|
}, {
|
|
@@ -56,5 +59,11 @@ exports.defaultTabs = [
|
|
|
56
59
|
kendo_react_buttons_1.ToolbarSeparator,
|
|
57
60
|
[tableTools_1.DeleteColumn, tableTools_1.DeleteRow]
|
|
58
61
|
]
|
|
62
|
+
}, {
|
|
63
|
+
textKey: messages_1.keys.formatTab,
|
|
64
|
+
tools: [
|
|
65
|
+
format_1.Format,
|
|
66
|
+
[adjustDecimals_1.DecreaseDecimal, adjustDecimals_1.IncreaseDecimal]
|
|
67
|
+
]
|
|
59
68
|
}
|
|
60
69
|
];
|
|
@@ -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 {};
|
|
@@ -1,27 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FontSize = void 0;
|
|
3
|
+
exports.DecreaseFontSize = exports.IncreaseFontSize = exports.FontSize = void 0;
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const kendo_react_dropdowns_1 = require("@progress/kendo-react-dropdowns");
|
|
6
6
|
const utils_1 = require("./utils");
|
|
7
7
|
const messages_1 = require("../messages");
|
|
8
8
|
const kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
9
|
+
const kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
|
|
10
|
+
const kendo_svg_icons_1 = require("@progress/kendo-svg-icons");
|
|
11
|
+
const toNumber = (value) => {
|
|
12
|
+
return typeof value === 'string' ? parseFloat(value) : value;
|
|
13
|
+
};
|
|
9
14
|
/**
|
|
10
15
|
* The FontSize tool component.
|
|
11
16
|
*/
|
|
12
17
|
const FontSize = props => {
|
|
13
|
-
const { spreadsheetRef
|
|
18
|
+
const { spreadsheetRef } = props;
|
|
19
|
+
const value = toNumber(props.value);
|
|
14
20
|
const onChange = React.useCallback((event) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
var _a;
|
|
22
|
+
const options = {
|
|
23
|
+
command: 'PropertyChangeCommand', options: { property: 'fontSize', value: event.value ? toNumber(event.value) : null }
|
|
24
|
+
};
|
|
25
|
+
if (event.nativeEvent.type === 'keydown' || event.nativeEvent.type === 'focusout') {
|
|
26
|
+
(_a = spreadsheetRef.current) === null || _a === void 0 ? void 0 : _a.executeCommand(options);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
var _a;
|
|
31
|
+
(_a = spreadsheetRef.current) === null || _a === void 0 ? void 0 : _a.executeCommand(options);
|
|
32
|
+
}, 0);
|
|
33
|
+
}
|
|
23
34
|
}, []);
|
|
24
35
|
return (React.createElement(kendo_react_dropdowns_1.ComboBox, { onChange: onChange, value: value, data: utils_1.FONT_SIZES, defaultValue: utils_1.DEFAULT_FONT_SIZE, allowCustom: true, fillMode: "flat", title: (0, kendo_react_intl_1.useLocalization)().toLanguageString(messages_1.keys.fontSize, messages_1.messages[messages_1.keys.fontSize]), tabIndex: -1, clearButton: false }));
|
|
25
36
|
};
|
|
26
37
|
exports.FontSize = FontSize;
|
|
27
38
|
exports.FontSize.displayName = 'FontSize';
|
|
39
|
+
const minFontSize = 1;
|
|
40
|
+
const maxFontSize = 409;
|
|
41
|
+
/**
|
|
42
|
+
* @hidden
|
|
43
|
+
*/
|
|
44
|
+
const fontSizeChangeTool = (settings) => {
|
|
45
|
+
const tool = props => {
|
|
46
|
+
const { property, icon, svgIcon, titleKey, step } = settings;
|
|
47
|
+
const { spreadsheetRef } = props;
|
|
48
|
+
const value = toNumber(props.value);
|
|
49
|
+
const onClick = React.useCallback(() => {
|
|
50
|
+
var _a;
|
|
51
|
+
const options = {
|
|
52
|
+
command: 'PropertyChangeCommand',
|
|
53
|
+
options: { property, value: Math.min(maxFontSize, Math.max(minFontSize, value + step)) }
|
|
54
|
+
};
|
|
55
|
+
(_a = spreadsheetRef.current) === null || _a === void 0 ? void 0 : _a.executeCommand(options);
|
|
56
|
+
}, [value]);
|
|
57
|
+
return (React.createElement(kendo_react_buttons_1.Button, { type: "button", icon: icon, svgIcon: svgIcon, fillMode: "flat", onClick: onClick, disabled: value + step < minFontSize || value + step > maxFontSize, title: (0, kendo_react_intl_1.useLocalization)().toLanguageString(titleKey, messages_1.messages[titleKey]) }));
|
|
58
|
+
};
|
|
59
|
+
tool.displayName = settings.displayName;
|
|
60
|
+
return tool;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* The IncreaseFontSize tool component.
|
|
64
|
+
*/
|
|
65
|
+
exports.IncreaseFontSize = fontSizeChangeTool({
|
|
66
|
+
property: 'fontSize',
|
|
67
|
+
icon: 'font-grow',
|
|
68
|
+
svgIcon: kendo_svg_icons_1.fontGrowIcon,
|
|
69
|
+
titleKey: messages_1.keys.fontSizeIncrease,
|
|
70
|
+
displayName: 'IncreaseFontSize',
|
|
71
|
+
step: 1
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* The DecreaseFontSize tool component.
|
|
75
|
+
*/
|
|
76
|
+
exports.DecreaseFontSize = fontSizeChangeTool({
|
|
77
|
+
property: 'fontSize',
|
|
78
|
+
icon: 'font-shrink',
|
|
79
|
+
svgIcon: kendo_svg_icons_1.fontShrinkIcon,
|
|
80
|
+
titleKey: messages_1.keys.fontSizeDecrease,
|
|
81
|
+
displayName: 'DecreaseFontSize',
|
|
82
|
+
step: -1
|
|
83
|
+
});
|
package/dist/npm/tools/index.js
CHANGED
|
@@ -21,6 +21,7 @@ __exportStar(require("./defaultTools"), exports);
|
|
|
21
21
|
__exportStar(require("./export"), exports);
|
|
22
22
|
__exportStar(require("./fontFamily"), exports);
|
|
23
23
|
__exportStar(require("./fontSize"), exports);
|
|
24
|
+
__exportStar(require("./cleanFormat"), exports);
|
|
24
25
|
__exportStar(require("./format"), exports);
|
|
25
26
|
__exportStar(require("./gridLines"), exports);
|
|
26
27
|
__exportStar(require("./italic"), exports);
|
package/dist/npm/tools/open.js
CHANGED
|
@@ -27,7 +27,7 @@ const Open = props => {
|
|
|
27
27
|
if (fileInfo[0] && fileInfo[0].getRawFile) {
|
|
28
28
|
const file = fileInfo[0].getRawFile();
|
|
29
29
|
if (spreadsheetRef.current) {
|
|
30
|
-
spreadsheetRef.current.
|
|
30
|
+
spreadsheetRef.current.executeCommand({ command: 'OpenCommand', options: { file } });
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}, []);
|
|
@@ -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 {};
|
|
@@ -8,7 +8,7 @@ const messages_1 = require("../messages");
|
|
|
8
8
|
const kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
9
9
|
const TableDataTool = (settings) => {
|
|
10
10
|
const tool = props => {
|
|
11
|
-
const { spreadsheetRef } = props;
|
|
11
|
+
const { spreadsheetRef, value } = props;
|
|
12
12
|
const onClick = React.useCallback(() => {
|
|
13
13
|
if (spreadsheetRef.current) {
|
|
14
14
|
const options = {
|
|
@@ -17,7 +17,7 @@ const TableDataTool = (settings) => {
|
|
|
17
17
|
spreadsheetRef.current.executeCommand(options);
|
|
18
18
|
}
|
|
19
19
|
}, []);
|
|
20
|
-
return (React.createElement(kendo_react_buttons_1.Button, { type: "button", icon: settings.icon, svgIcon: settings.svgIcon, fillMode: "flat", title: (0, kendo_react_intl_1.useLocalization)().toLanguageString(settings.titleKey, messages_1.messages[settings.titleKey]), onClick: onClick }));
|
|
20
|
+
return (React.createElement(kendo_react_buttons_1.Button, { type: "button", icon: settings.icon, svgIcon: settings.svgIcon, fillMode: "flat", title: (0, kendo_react_intl_1.useLocalization)().toLanguageString(settings.titleKey, messages_1.messages[settings.titleKey]), onClick: onClick, disabled: value && settings.disabled(value) }));
|
|
21
21
|
};
|
|
22
22
|
return tool;
|
|
23
23
|
};
|
|
@@ -26,40 +26,52 @@ const addColumnLeft = {
|
|
|
26
26
|
value: 'left',
|
|
27
27
|
icon: 'table-column-insert-left',
|
|
28
28
|
svgIcon: kendo_svg_icons_1.tableColumnInsertLeftIcon,
|
|
29
|
-
titleKey: messages_1.keys.addColumnLeft
|
|
29
|
+
titleKey: messages_1.keys.addColumnLeft,
|
|
30
|
+
disabled: (headers) => headers.allCols,
|
|
31
|
+
displayName: 'AddColumnLeft'
|
|
30
32
|
};
|
|
31
33
|
const addColumnRight = {
|
|
32
34
|
command: 'AddColumnCommand',
|
|
33
35
|
value: 'right',
|
|
34
36
|
icon: 'table-column-insert-right',
|
|
35
37
|
svgIcon: kendo_svg_icons_1.tableColumnInsertRightIcon,
|
|
36
|
-
titleKey: messages_1.keys.addColumnRight
|
|
38
|
+
titleKey: messages_1.keys.addColumnRight,
|
|
39
|
+
disabled: (headers) => headers.allCols,
|
|
40
|
+
displayName: 'AddColumnRight'
|
|
37
41
|
};
|
|
38
42
|
const addRowBelow = {
|
|
39
43
|
command: 'AddRowCommand',
|
|
40
44
|
value: 'below',
|
|
41
45
|
icon: 'table-row-insert-below',
|
|
42
46
|
svgIcon: kendo_svg_icons_1.tableRowInsertBelowIcon,
|
|
43
|
-
titleKey: messages_1.keys.addRowBelow
|
|
47
|
+
titleKey: messages_1.keys.addRowBelow,
|
|
48
|
+
disabled: (headers) => headers.allRows,
|
|
49
|
+
displayName: 'AddRowBelow'
|
|
44
50
|
};
|
|
45
51
|
const addRowAbove = {
|
|
46
52
|
command: 'AddRowCommand',
|
|
47
53
|
value: 'above',
|
|
48
54
|
icon: 'table-row-insert-above',
|
|
49
55
|
svgIcon: kendo_svg_icons_1.tableRowInsertAboveIcon,
|
|
50
|
-
titleKey: messages_1.keys.addRowAbove
|
|
56
|
+
titleKey: messages_1.keys.addRowAbove,
|
|
57
|
+
disabled: (headers) => headers.allRows,
|
|
58
|
+
displayName: 'AddRowAbove'
|
|
51
59
|
};
|
|
52
60
|
const deleteColumn = {
|
|
53
61
|
command: 'DeleteColumnCommand',
|
|
54
62
|
icon: 'table-column-delete',
|
|
55
63
|
svgIcon: kendo_svg_icons_1.tableColumnDeleteIcon,
|
|
56
|
-
titleKey: messages_1.keys.deleteColumn
|
|
64
|
+
titleKey: messages_1.keys.deleteColumn,
|
|
65
|
+
disabled: (headers) => headers.allCols,
|
|
66
|
+
displayName: 'DeleteColumn'
|
|
57
67
|
};
|
|
58
68
|
const deleteRow = {
|
|
59
69
|
command: 'DeleteRowCommand',
|
|
60
70
|
icon: 'table-row-delete',
|
|
61
71
|
svgIcon: kendo_svg_icons_1.tableRowDeleteIcon,
|
|
62
|
-
titleKey: messages_1.keys.deleteRow
|
|
72
|
+
titleKey: messages_1.keys.deleteRow,
|
|
73
|
+
disabled: (headers) => headers.allRows,
|
|
74
|
+
displayName: 'DeleteRow'
|
|
63
75
|
};
|
|
64
76
|
/**
|
|
65
77
|
* The AddColumnLeft tool component.
|