@progress/kendo-react-spreadsheet 5.17.0-dev.202308241527 → 5.17.0-dev.202308250719
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 +13 -2
- package/dist/es/messages.d.ts +20 -0
- package/dist/es/messages.js +68 -8
- 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/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 +13 -2
- package/dist/npm/messages.d.ts +20 -0
- package/dist/npm/messages.js +68 -8
- 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/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 +12 -12
package/dist/es/FormulaInput.js
CHANGED
|
@@ -109,7 +109,7 @@ export const FormulaInput = React.forwardRef((props, ref) => {
|
|
|
109
109
|
}, []);
|
|
110
110
|
return (React.createElement(React.Fragment, null,
|
|
111
111
|
React.createElement("div", { className: classNames('k-spreadsheet-formula-input', props.className), contentEditable: "true", spellCheck: "false", style: { whiteSpace: 'pre' }, ref: elementRef }),
|
|
112
|
-
React.createElement(Popup, { show: showPopup, anchor: elementRef.current, animate: { openDuration: 100, closeDuration: 100 }, contentKey: popupContentKey },
|
|
112
|
+
React.createElement(Popup, { show: showPopup, anchor: elementRef.current, animate: { openDuration: 100, closeDuration: 100 }, contentKey: popupContentKey, popupClass: "k-list-container" },
|
|
113
113
|
React.createElement(List, { data: data, ref: listRef, onItemClick: onItemClick }))));
|
|
114
114
|
});
|
|
115
115
|
FormulaInput.displayName = 'FormulaInput';
|
package/dist/es/List.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { IconWrap } from '@progress/kendo-react-common';
|
|
3
|
+
import { formulaFxIcon } from '@progress/kendo-svg-icons';
|
|
2
4
|
/**
|
|
3
5
|
* @hidden
|
|
4
6
|
*/
|
|
@@ -10,8 +12,11 @@ export const List = React.forwardRef((props, ref) => {
|
|
|
10
12
|
props
|
|
11
13
|
}));
|
|
12
14
|
React.useImperativeHandle(ref, () => target.current);
|
|
13
|
-
return (React.createElement("
|
|
14
|
-
React.createElement("
|
|
15
|
+
return (React.createElement("div", { className: "k-list k-list-md" },
|
|
16
|
+
React.createElement("div", { className: "k-list-content" },
|
|
17
|
+
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) },
|
|
18
|
+
React.createElement(IconWrap, { name: "formula-fx", icon: formulaFxIcon }),
|
|
19
|
+
React.createElement("span", { className: "k-list-item-text" }, item.text))))))));
|
|
15
20
|
});
|
|
16
21
|
List.displayName = 'List';
|
|
17
22
|
List.propTypes = {};
|
package/dist/es/Spreadsheet.js
CHANGED
|
@@ -22,11 +22,21 @@ const toolsValueMap = {
|
|
|
22
22
|
Underline: (state) => state.underline,
|
|
23
23
|
FontFamily: (state) => state.fontFamily,
|
|
24
24
|
FontSize: (state) => state.fontSize,
|
|
25
|
+
IncreaseFontSize: (state) => state.fontSize,
|
|
26
|
+
DecreaseFontSize: (state) => state.fontSize,
|
|
25
27
|
TextColor: (state) => state.color,
|
|
26
28
|
BackgroundColor: (state) => state.background,
|
|
27
29
|
Alignment: (state) => ({ textAlign: state.textAlign, verticalAlign: state.verticalAlign }),
|
|
30
|
+
AlignHorizontally: (state) => state.textAlign,
|
|
31
|
+
AlignVertically: (state) => state.verticalAlign,
|
|
28
32
|
TextWrap: (state) => state.wrap,
|
|
29
|
-
GridLines: (state) => state.gridLines
|
|
33
|
+
GridLines: (state) => state.gridLines,
|
|
34
|
+
AddColumnLeft: (state) => state.selectedHeaders,
|
|
35
|
+
AddColumnRight: (state) => state.selectedHeaders,
|
|
36
|
+
AddRowBelow: (state) => state.selectedHeaders,
|
|
37
|
+
AddRowAbove: (state) => state.selectedHeaders,
|
|
38
|
+
DeleteColumn: (state) => state.selectedHeaders,
|
|
39
|
+
DeleteRow: (state) => state.selectedHeaders
|
|
30
40
|
};
|
|
31
41
|
const noInnerButton = ':not(.k-dropdownlist button)' +
|
|
32
42
|
':not(.k-combobox button)' +
|
|
@@ -131,7 +141,8 @@ export const Spreadsheet = React.forwardRef((props, ref) => {
|
|
|
131
141
|
state[tool] = e.range.sheet().showGridLines();
|
|
132
142
|
}
|
|
133
143
|
});
|
|
134
|
-
|
|
144
|
+
state.selectedHeaders = e.range.sheet().selectedHeaders();
|
|
145
|
+
if (Object.keys(state).some(k => state[k] !== prevState.current[k])) {
|
|
135
146
|
setToolsState(state);
|
|
136
147
|
}
|
|
137
148
|
}, []);
|
package/dist/es/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,7 @@ export declare const messages: {
|
|
|
36
45
|
"spreadsheet.file": string;
|
|
37
46
|
"spreadsheet.insert": string;
|
|
38
47
|
"spreadsheet.addNewSheet": string;
|
|
48
|
+
"spreadsheet.formatTab": string;
|
|
39
49
|
"spreadsheet.modifyMerged": string;
|
|
40
50
|
"spreadsheet.cannotModifyDisabled": string;
|
|
41
51
|
"spreadsheet.openUnsupported": string;
|
|
@@ -52,16 +62,25 @@ export declare const keys: {
|
|
|
52
62
|
undo: string;
|
|
53
63
|
redo: string;
|
|
54
64
|
fontSize: string;
|
|
65
|
+
fontSizeIncrease: string;
|
|
66
|
+
fontSizeDecrease: string;
|
|
55
67
|
fontName: string;
|
|
68
|
+
cleanFormatting: string;
|
|
56
69
|
format: string;
|
|
70
|
+
alignHorizontally: string;
|
|
71
|
+
alignVertically: string;
|
|
57
72
|
align: string;
|
|
58
73
|
alignLeft: string;
|
|
59
74
|
alignRight: string;
|
|
60
75
|
alignCenter: string;
|
|
76
|
+
center: string;
|
|
61
77
|
alignJustify: string;
|
|
78
|
+
justify: string;
|
|
62
79
|
alignTop: string;
|
|
63
80
|
alignMiddle: string;
|
|
64
81
|
alignBottom: string;
|
|
82
|
+
increaseDecimal: string;
|
|
83
|
+
decreaseDecimal: string;
|
|
65
84
|
textColor: string;
|
|
66
85
|
background: string;
|
|
67
86
|
addRowAbove: string;
|
|
@@ -85,4 +104,5 @@ export declare const keys: {
|
|
|
85
104
|
modifyMerged: string;
|
|
86
105
|
cannotModifyDisabled: string;
|
|
87
106
|
openUnsupported: string;
|
|
107
|
+
formatTab: string;
|
|
88
108
|
};
|
package/dist/es/messages.js
CHANGED
|
@@ -58,14 +58,34 @@ const redo = 'spreadsheet.redo';
|
|
|
58
58
|
* @hidden
|
|
59
59
|
*/
|
|
60
60
|
const fontSize = 'spreadsheet.fontSize';
|
|
61
|
+
/**
|
|
62
|
+
* @hidden
|
|
63
|
+
*/
|
|
64
|
+
const fontSizeIncrease = 'spreadsheet.fontSizeIncrease';
|
|
65
|
+
/**
|
|
66
|
+
* @hidden
|
|
67
|
+
*/
|
|
68
|
+
const fontSizeDecrease = 'spreadsheet.fontSizeDecrease';
|
|
61
69
|
/**
|
|
62
70
|
* @hidden
|
|
63
71
|
*/
|
|
64
72
|
const fontName = 'spreadsheet.fontName';
|
|
73
|
+
/**
|
|
74
|
+
* @hidden
|
|
75
|
+
*/
|
|
76
|
+
const cleanFormatting = 'spreadsheet.cleanFormatting';
|
|
65
77
|
/**
|
|
66
78
|
* @hidden
|
|
67
79
|
*/
|
|
68
80
|
const format = 'spreadsheet.format';
|
|
81
|
+
/**
|
|
82
|
+
* @hidden
|
|
83
|
+
*/
|
|
84
|
+
const alignHorizontally = 'spreadsheet.alignHorizontally';
|
|
85
|
+
/**
|
|
86
|
+
* @hidden
|
|
87
|
+
*/
|
|
88
|
+
const alignVertically = 'spreadsheet.alignVertically';
|
|
69
89
|
/**
|
|
70
90
|
* @hidden
|
|
71
91
|
*/
|
|
@@ -82,10 +102,18 @@ const alignRight = 'spreadsheet.alignRight';
|
|
|
82
102
|
* @hidden
|
|
83
103
|
*/
|
|
84
104
|
const alignCenter = 'spreadsheet.alignCenter';
|
|
105
|
+
/**
|
|
106
|
+
* @hidden
|
|
107
|
+
*/
|
|
108
|
+
const center = 'spreadsheet.center';
|
|
85
109
|
/**
|
|
86
110
|
* @hidden
|
|
87
111
|
*/
|
|
88
112
|
const alignJustify = 'spreadsheet.alignJustify';
|
|
113
|
+
/**
|
|
114
|
+
* @hidden
|
|
115
|
+
*/
|
|
116
|
+
const justify = 'spreadsheet.justify';
|
|
89
117
|
/**
|
|
90
118
|
* @hidden
|
|
91
119
|
*/
|
|
@@ -98,6 +126,14 @@ const alignMiddle = 'spreadsheet.alignMiddle';
|
|
|
98
126
|
* @hidden
|
|
99
127
|
*/
|
|
100
128
|
const alignBottom = 'spreadsheet.alignBottom';
|
|
129
|
+
/**
|
|
130
|
+
* @hidden
|
|
131
|
+
*/
|
|
132
|
+
const increaseDecimal = 'spreadsheet.increaseDecimal';
|
|
133
|
+
/**
|
|
134
|
+
* @hidden
|
|
135
|
+
*/
|
|
136
|
+
const decreaseDecimal = 'spreadsheet.decreaseDecimal';
|
|
101
137
|
/**
|
|
102
138
|
* @hidden
|
|
103
139
|
*/
|
|
@@ -130,6 +166,10 @@ const file = 'spreadsheet.file';
|
|
|
130
166
|
* @hidden
|
|
131
167
|
*/
|
|
132
168
|
const insert = 'spreadsheet.insert';
|
|
169
|
+
/**
|
|
170
|
+
* @hidden
|
|
171
|
+
*/
|
|
172
|
+
const formatTab = 'spreadsheet.formatTab';
|
|
133
173
|
/**
|
|
134
174
|
* @hidden
|
|
135
175
|
*/
|
|
@@ -164,16 +204,25 @@ export const messages = {
|
|
|
164
204
|
[undo]: 'Undo',
|
|
165
205
|
[redo]: 'Redo',
|
|
166
206
|
[fontSize]: 'Font size',
|
|
207
|
+
[fontSizeIncrease]: 'Increase Font size',
|
|
208
|
+
[fontSizeDecrease]: 'Decrease Font size',
|
|
167
209
|
[fontName]: 'Font',
|
|
210
|
+
[cleanFormatting]: 'Clean formatting',
|
|
168
211
|
[format]: 'Custom format...',
|
|
212
|
+
[alignHorizontally]: 'Align horizontally',
|
|
213
|
+
[alignVertically]: 'Align vertically',
|
|
169
214
|
[align]: 'Align',
|
|
170
|
-
[alignLeft]: 'Align
|
|
171
|
-
[alignRight]: 'Align
|
|
172
|
-
[alignCenter]: 'Align
|
|
173
|
-
[alignJustify]: 'Align
|
|
174
|
-
[
|
|
175
|
-
[
|
|
176
|
-
[
|
|
215
|
+
[alignLeft]: 'Align left',
|
|
216
|
+
[alignRight]: 'Align right',
|
|
217
|
+
[alignCenter]: 'Align center',
|
|
218
|
+
[alignJustify]: 'Align justify',
|
|
219
|
+
[center]: 'Center',
|
|
220
|
+
[justify]: 'Justify',
|
|
221
|
+
[alignTop]: 'Align top',
|
|
222
|
+
[alignMiddle]: 'Align middle',
|
|
223
|
+
[alignBottom]: 'Align bottom',
|
|
224
|
+
[increaseDecimal]: 'Increase decimal',
|
|
225
|
+
[decreaseDecimal]: 'Decrease decimal',
|
|
177
226
|
[textColor]: 'Text Color',
|
|
178
227
|
[background]: 'Background color',
|
|
179
228
|
[addRowAbove]: 'Add row above',
|
|
@@ -192,6 +241,7 @@ export const messages = {
|
|
|
192
241
|
[file]: 'File',
|
|
193
242
|
[insert]: 'Insert',
|
|
194
243
|
[addNewSheet]: 'Add new sheet',
|
|
244
|
+
[formatTab]: 'Format',
|
|
195
245
|
[modifyMerged]: 'Cannot change part of a merged cell.',
|
|
196
246
|
[cannotModifyDisabled]: 'Cannot modify disabled cells.',
|
|
197
247
|
[openUnsupported]: 'Unsupported format. Please select an .xlsx file.',
|
|
@@ -208,16 +258,25 @@ export const keys = {
|
|
|
208
258
|
undo,
|
|
209
259
|
redo,
|
|
210
260
|
fontSize,
|
|
261
|
+
fontSizeIncrease,
|
|
262
|
+
fontSizeDecrease,
|
|
211
263
|
fontName,
|
|
264
|
+
cleanFormatting,
|
|
212
265
|
format,
|
|
266
|
+
alignHorizontally,
|
|
267
|
+
alignVertically,
|
|
213
268
|
align,
|
|
214
269
|
alignLeft,
|
|
215
270
|
alignRight,
|
|
216
271
|
alignCenter,
|
|
272
|
+
center,
|
|
217
273
|
alignJustify,
|
|
274
|
+
justify,
|
|
218
275
|
alignTop,
|
|
219
276
|
alignMiddle,
|
|
220
277
|
alignBottom,
|
|
278
|
+
increaseDecimal,
|
|
279
|
+
decreaseDecimal,
|
|
221
280
|
textColor,
|
|
222
281
|
background,
|
|
223
282
|
addRowAbove,
|
|
@@ -240,5 +299,6 @@ export const keys = {
|
|
|
240
299
|
ok,
|
|
241
300
|
modifyMerged,
|
|
242
301
|
cannotModifyDisabled,
|
|
243
|
-
openUnsupported
|
|
302
|
+
openUnsupported,
|
|
303
|
+
formatTab
|
|
244
304
|
};
|
|
@@ -5,7 +5,7 @@ export const packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-react-spreadsheet',
|
|
6
6
|
productName: 'KendoReact',
|
|
7
7
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1692947099,
|
|
9
9
|
version: '',
|
|
10
10
|
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'
|
|
11
11
|
};
|
|
@@ -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,39 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Button } from '@progress/kendo-react-buttons';
|
|
3
|
+
import { useLocalization } from '@progress/kendo-react-intl';
|
|
4
|
+
import { messages, keys } from '../messages';
|
|
5
|
+
import { decimalIncreaseIcon, decimalDecreaseIcon } from '@progress/kendo-svg-icons';
|
|
6
|
+
const adjustDecimalsTool = (settings) => {
|
|
7
|
+
const tool = props => {
|
|
8
|
+
const { icon, svgIcon, titleKey, value } = settings;
|
|
9
|
+
const { spreadsheetRef } = props;
|
|
10
|
+
const onClick = React.useCallback(() => {
|
|
11
|
+
if (spreadsheetRef.current) {
|
|
12
|
+
const options = {
|
|
13
|
+
command: 'AdjustDecimalsCommand', options: { value }
|
|
14
|
+
};
|
|
15
|
+
spreadsheetRef.current.executeCommand(options);
|
|
16
|
+
}
|
|
17
|
+
}, []);
|
|
18
|
+
return (React.createElement(Button, { type: "button", icon: icon, svgIcon: svgIcon, fillMode: "flat", onClick: onClick, title: useLocalization().toLanguageString(titleKey, messages[titleKey]) }));
|
|
19
|
+
};
|
|
20
|
+
return tool;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The IncreaseDecimal tool component.
|
|
24
|
+
*/
|
|
25
|
+
export const IncreaseDecimal = adjustDecimalsTool({
|
|
26
|
+
icon: decimalIncreaseIcon.name,
|
|
27
|
+
svgIcon: decimalIncreaseIcon,
|
|
28
|
+
value: 1,
|
|
29
|
+
titleKey: keys.increaseDecimal
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* The DecreaseDecimal tool component.
|
|
33
|
+
*/
|
|
34
|
+
export const DecreaseDecimal = adjustDecimalsTool({
|
|
35
|
+
icon: decimalDecreaseIcon.name,
|
|
36
|
+
svgIcon: decimalDecreaseIcon,
|
|
37
|
+
value: -1,
|
|
38
|
+
titleKey: keys.decreaseDecimal
|
|
39
|
+
});
|
package/dist/es/tools/align.d.ts
CHANGED
|
@@ -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/es/tools/align.js
CHANGED
|
@@ -5,14 +5,21 @@ import { alignLeftIcon, alignCenterIcon, alignRightIcon, alignJustifyIcon, align
|
|
|
5
5
|
import { useLocalization } from '@progress/kendo-react-intl';
|
|
6
6
|
import { keys, messages } from '../messages';
|
|
7
7
|
const alignItems = [
|
|
8
|
-
{ icon: 'align-left', svgIcon: alignLeftIcon, textKey: keys.alignLeft, commandName: 'textAlign', value: 'left' },
|
|
9
|
-
{ icon: 'align-center', svgIcon: alignCenterIcon, textKey: keys.alignCenter, commandName: 'textAlign', value: 'center' },
|
|
10
|
-
{ icon: 'align-right', svgIcon: alignRightIcon, textKey: keys.alignRight, commandName: 'textAlign', value: 'right' },
|
|
11
|
-
{ icon: 'align-justify', svgIcon: alignJustifyIcon, textKey: keys.alignJustify, commandName: 'textAlign', value: 'justify' },
|
|
12
|
-
{ icon: 'align-top', svgIcon: alignTopIcon, textKey: keys.alignTop, commandName: 'verticalAlign', value: 'top' },
|
|
13
|
-
{ icon: 'align-middle', svgIcon: alignMiddleIcon, textKey: keys.alignMiddle, commandName: 'verticalAlign', value: 'center' },
|
|
14
|
-
{ icon: 'align-bottom', svgIcon: alignBottomIcon, textKey: keys.alignBottom, commandName: 'verticalAlign', value: 'bottom' }
|
|
8
|
+
{ icon: 'align-left', svgIcon: alignLeftIcon, textKey: keys.alignLeft, commandName: 'textAlign', value: 'left', selected: false },
|
|
9
|
+
{ icon: 'align-center', svgIcon: alignCenterIcon, textKey: keys.alignCenter, commandName: 'textAlign', value: 'center', selected: false },
|
|
10
|
+
{ icon: 'align-right', svgIcon: alignRightIcon, textKey: keys.alignRight, commandName: 'textAlign', value: 'right', selected: false },
|
|
11
|
+
{ icon: 'align-justify', svgIcon: alignJustifyIcon, textKey: keys.alignJustify, commandName: 'textAlign', value: 'justify', selected: false },
|
|
12
|
+
{ icon: 'align-top', svgIcon: alignTopIcon, textKey: keys.alignTop, commandName: 'verticalAlign', value: 'top', selected: false },
|
|
13
|
+
{ icon: 'align-middle', svgIcon: alignMiddleIcon, textKey: keys.alignMiddle, commandName: 'verticalAlign', value: 'center', selected: false },
|
|
14
|
+
{ icon: 'align-bottom', svgIcon: alignBottomIcon, textKey: keys.alignBottom, commandName: 'verticalAlign', value: 'bottom', selected: false }
|
|
15
15
|
];
|
|
16
|
+
const alignHorizontalItems = [
|
|
17
|
+
alignItems[0],
|
|
18
|
+
Object.assign(Object.assign({}, alignItems[1]), { textKey: keys.center }),
|
|
19
|
+
alignItems[2],
|
|
20
|
+
Object.assign(Object.assign({}, alignItems[3]), { textKey: keys.justify })
|
|
21
|
+
];
|
|
22
|
+
const alignVerticalItems = alignItems.filter(i => i.commandName === 'verticalAlign');
|
|
16
23
|
/**
|
|
17
24
|
* The Alignment tool component.
|
|
18
25
|
*/
|
|
@@ -40,3 +47,50 @@ export const Alignment = props => {
|
|
|
40
47
|
return (React.createElement(DropDownButton, { icon: "align-left", svgIcon: alignLeftIcon, items: items, fillMode: "flat", onItemClick: onItemClick, title: loc.toLanguageString(keys.align, messages[keys.align]), text: React.createElement(IconWrap, { name: "caret-alt-down", icon: caretAltDownIcon }) }));
|
|
41
48
|
};
|
|
42
49
|
Alignment.displayName = 'Alignment';
|
|
50
|
+
const alignHorizontal = {
|
|
51
|
+
items: alignHorizontalItems,
|
|
52
|
+
icon: { icon: 'align-left', svgIcon: alignLeftIcon },
|
|
53
|
+
displayName: 'AlignHorizontally',
|
|
54
|
+
titleKey: keys.alignHorizontally
|
|
55
|
+
};
|
|
56
|
+
const alignVertical = {
|
|
57
|
+
items: alignVerticalItems,
|
|
58
|
+
icon: { icon: 'align-bottom', svgIcon: alignBottomIcon },
|
|
59
|
+
displayName: 'AlignVertically',
|
|
60
|
+
titleKey: keys.alignVertically
|
|
61
|
+
};
|
|
62
|
+
const createAlignTool = (settings) => {
|
|
63
|
+
const Tool = props => {
|
|
64
|
+
const { value, spreadsheetRef } = props;
|
|
65
|
+
const loc = useLocalization();
|
|
66
|
+
const onItemClick = React.useCallback((event) => {
|
|
67
|
+
if (spreadsheetRef.current) {
|
|
68
|
+
const item = event.item;
|
|
69
|
+
const options = {
|
|
70
|
+
command: 'PropertyChangeCommand', options: { property: item.commandName, value: item.value || null }
|
|
71
|
+
};
|
|
72
|
+
spreadsheetRef.current.executeCommand(options);
|
|
73
|
+
}
|
|
74
|
+
}, []);
|
|
75
|
+
let items = settings.items.slice();
|
|
76
|
+
items = items.map(i => (Object.assign(Object.assign({}, i), { text: loc.toLanguageString(i.textKey, messages[i.textKey]) })));
|
|
77
|
+
items = items.map(i => (Object.assign(Object.assign({}, i), { selected: i.value === value })));
|
|
78
|
+
const icons = Object.assign({}, settings.icon);
|
|
79
|
+
const selected = items.find(i => i.selected);
|
|
80
|
+
if (selected) {
|
|
81
|
+
icons.icon = selected.icon;
|
|
82
|
+
icons.svgIcon = selected.svgIcon;
|
|
83
|
+
}
|
|
84
|
+
return (React.createElement(DropDownButton, Object.assign({}, icons, { items: items, fillMode: "flat", onItemClick: onItemClick, title: loc.toLanguageString(settings.titleKey, messages[settings.titleKey]), text: React.createElement(IconWrap, { name: "caret-alt-down", icon: caretAltDownIcon }) })));
|
|
85
|
+
};
|
|
86
|
+
Tool.displayName = settings.displayName;
|
|
87
|
+
return Tool;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* The AlignHorizontally tool component.
|
|
91
|
+
*/
|
|
92
|
+
export const AlignHorizontally = createAlignTool(alignHorizontal);
|
|
93
|
+
/**
|
|
94
|
+
* The AlignVertically tool component.
|
|
95
|
+
*/
|
|
96
|
+
export const 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,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { clearCssIcon } from '@progress/kendo-svg-icons';
|
|
3
|
+
import { Button } from '@progress/kendo-react-buttons';
|
|
4
|
+
import { useLocalization } from '@progress/kendo-react-intl';
|
|
5
|
+
import { messages, keys } from '../messages';
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export const CleanFormatting = props => {
|
|
10
|
+
const { spreadsheetRef } = props;
|
|
11
|
+
const onClick = React.useCallback(() => {
|
|
12
|
+
if (spreadsheetRef.current) {
|
|
13
|
+
spreadsheetRef.current.executeCommand({ command: 'PropertyCleanCommand' });
|
|
14
|
+
}
|
|
15
|
+
}, []);
|
|
16
|
+
return (React.createElement(Button, { type: "button", icon: 'clean-css', svgIcon: clearCssIcon, fillMode: "flat", onClick: onClick, title: useLocalization().toLanguageString(keys.cleanFormatting, messages[keys.cleanFormatting]) }));
|
|
17
|
+
};
|
|
@@ -5,10 +5,10 @@ import { Bold } from './bold';
|
|
|
5
5
|
import { Italic } from './italic';
|
|
6
6
|
import { Underline } from './underline';
|
|
7
7
|
import { FontFamily } from './fontFamily';
|
|
8
|
-
import { FontSize } from './fontSize';
|
|
8
|
+
import { DecreaseFontSize, FontSize, IncreaseFontSize } from './fontSize';
|
|
9
9
|
import { TextColor } from './textColor';
|
|
10
10
|
import { BackgroundColor } from './backgroundColor';
|
|
11
|
-
import {
|
|
11
|
+
import { AlignHorizontally, AlignVertically } from './align';
|
|
12
12
|
import { TextWrap } from './textWrap';
|
|
13
13
|
import { GridLines } from './gridLines';
|
|
14
14
|
import { Format } from './format';
|
|
@@ -16,6 +16,7 @@ import { AddColumnLeft, AddColumnRight, AddRowAbove, AddRowBelow, DeleteColumn,
|
|
|
16
16
|
import { keys } from '../messages';
|
|
17
17
|
import { Undo } from './undo';
|
|
18
18
|
import { Redo } from './redo';
|
|
19
|
+
import { DecreaseDecimal, IncreaseDecimal } from './adjustDecimals';
|
|
19
20
|
/**
|
|
20
21
|
* The default toolbar configuration.
|
|
21
22
|
*/
|
|
@@ -34,16 +35,18 @@ export const defaultTabs = [
|
|
|
34
35
|
ToolbarSeparator,
|
|
35
36
|
FontFamily,
|
|
36
37
|
FontSize,
|
|
38
|
+
IncreaseFontSize,
|
|
39
|
+
DecreaseFontSize,
|
|
40
|
+
ToolbarSeparator,
|
|
37
41
|
[Bold, Italic, Underline],
|
|
38
42
|
TextColor,
|
|
39
43
|
ToolbarSeparator,
|
|
40
44
|
BackgroundColor,
|
|
41
45
|
ToolbarSeparator,
|
|
42
|
-
|
|
46
|
+
AlignHorizontally,
|
|
47
|
+
AlignVertically,
|
|
43
48
|
TextWrap,
|
|
44
49
|
ToolbarSeparator,
|
|
45
|
-
Format,
|
|
46
|
-
ToolbarSeparator,
|
|
47
50
|
GridLines
|
|
48
51
|
]
|
|
49
52
|
}, {
|
|
@@ -53,5 +56,11 @@ export const defaultTabs = [
|
|
|
53
56
|
ToolbarSeparator,
|
|
54
57
|
[DeleteColumn, DeleteRow]
|
|
55
58
|
]
|
|
59
|
+
}, {
|
|
60
|
+
textKey: keys.formatTab,
|
|
61
|
+
tools: [
|
|
62
|
+
Format,
|
|
63
|
+
[DecreaseDecimal, IncreaseDecimal]
|
|
64
|
+
]
|
|
56
65
|
}
|
|
57
66
|
];
|
|
@@ -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 {};
|