@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
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
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as PropTypes from 'prop-types';
|
|
3
|
-
import { ButtonGroup, Toolbar, ToolbarSeparator } from '@progress/kendo-react-buttons';
|
|
3
|
+
import { Button, ButtonGroup, Toolbar, ToolbarSeparator } from '@progress/kendo-react-buttons';
|
|
4
4
|
import { TabStrip, TabStripTab } from '@progress/kendo-react-layout';
|
|
5
|
+
import { Dialog, DialogActionsBar } from '@progress/kendo-react-dialogs';
|
|
5
6
|
import { FormulaInput } from './FormulaInput';
|
|
6
7
|
import { NameBox } from './NameBox';
|
|
7
8
|
import { SheetsBar } from './SheetsBar';
|
|
@@ -21,11 +22,21 @@ const toolsValueMap = {
|
|
|
21
22
|
Underline: (state) => state.underline,
|
|
22
23
|
FontFamily: (state) => state.fontFamily,
|
|
23
24
|
FontSize: (state) => state.fontSize,
|
|
25
|
+
IncreaseFontSize: (state) => state.fontSize,
|
|
26
|
+
DecreaseFontSize: (state) => state.fontSize,
|
|
24
27
|
TextColor: (state) => state.color,
|
|
25
28
|
BackgroundColor: (state) => state.background,
|
|
26
29
|
Alignment: (state) => ({ textAlign: state.textAlign, verticalAlign: state.verticalAlign }),
|
|
30
|
+
AlignHorizontally: (state) => state.textAlign,
|
|
31
|
+
AlignVertically: (state) => state.verticalAlign,
|
|
27
32
|
TextWrap: (state) => state.wrap,
|
|
28
|
-
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
|
|
29
40
|
};
|
|
30
41
|
const noInnerButton = ':not(.k-dropdownlist button)' +
|
|
31
42
|
':not(.k-combobox button)' +
|
|
@@ -56,6 +67,7 @@ export const Spreadsheet = React.forwardRef((props, ref) => {
|
|
|
56
67
|
else {
|
|
57
68
|
toolbarTools.push(...toolbar);
|
|
58
69
|
}
|
|
70
|
+
const [dialog, setDialog] = React.useState(null);
|
|
59
71
|
const [tab, setTab] = React.useState(toolbarTools.findIndex(t => t.selected) || 0);
|
|
60
72
|
const [_init, setInit] = React.useState(false);
|
|
61
73
|
const elementRef = React.useRef(null);
|
|
@@ -68,6 +80,7 @@ export const Spreadsheet = React.forwardRef((props, ref) => {
|
|
|
68
80
|
prevState.current = toolsState;
|
|
69
81
|
const propsRef = React.useRef({});
|
|
70
82
|
propsRef.current = props;
|
|
83
|
+
const loc = useLocalization();
|
|
71
84
|
const onSelect = React.useCallback((event) => {
|
|
72
85
|
if (propsRef.current.onSelect) {
|
|
73
86
|
propsRef.current.onSelect.call(undefined, event);
|
|
@@ -128,10 +141,24 @@ export const Spreadsheet = React.forwardRef((props, ref) => {
|
|
|
128
141
|
state[tool] = e.range.sheet().showGridLines();
|
|
129
142
|
}
|
|
130
143
|
});
|
|
131
|
-
|
|
144
|
+
state.selectedHeaders = e.range.sheet().selectedHeaders();
|
|
145
|
+
if (Object.keys(state).some(k => state[k] !== prevState.current[k])) {
|
|
132
146
|
setToolsState(state);
|
|
133
147
|
}
|
|
134
148
|
}, []);
|
|
149
|
+
const onMessage = React.useCallback((e) => {
|
|
150
|
+
const name = e.name;
|
|
151
|
+
const key = keys[name];
|
|
152
|
+
setDialog({
|
|
153
|
+
title: e.title === 'Error' ? loc.toLanguageString(keys.error, messages[keys.error] || e.title) : e.title,
|
|
154
|
+
message: key ? loc.toLanguageString(key, messages[key] || e.text) : e.text,
|
|
155
|
+
close: e.close
|
|
156
|
+
});
|
|
157
|
+
}, []);
|
|
158
|
+
const onDialogClose = React.useCallback(() => {
|
|
159
|
+
setDialog(null);
|
|
160
|
+
dialog === null || dialog === void 0 ? void 0 : dialog.close();
|
|
161
|
+
}, [dialog]);
|
|
135
162
|
const intl = useInternationalization();
|
|
136
163
|
const localization = useLocalization();
|
|
137
164
|
React.useEffect(() => {
|
|
@@ -156,6 +183,7 @@ export const Spreadsheet = React.forwardRef((props, ref) => {
|
|
|
156
183
|
spreadsheet.bind('excelImport', onExcelImport);
|
|
157
184
|
spreadsheet.bind('excelExport', onExcelExport);
|
|
158
185
|
spreadsheet.view.bind('update', onUpdateTools);
|
|
186
|
+
spreadsheet.view.bind('message', onMessage);
|
|
159
187
|
const sheet = spreadsheet.activeSheet();
|
|
160
188
|
if (sheet) {
|
|
161
189
|
onUpdateTools({ range: sheet.range(sheet.activeCell()) });
|
|
@@ -198,6 +226,10 @@ export const Spreadsheet = React.forwardRef((props, ref) => {
|
|
|
198
226
|
React.createElement("div", { tabIndex: 0, className: "k-spreadsheet-clipboard", contentEditable: "true" }),
|
|
199
227
|
React.createElement(FormulaInput, { ref: formulaCellInputRef, className: "k-spreadsheet-cell-editor" })),
|
|
200
228
|
React.createElement(SheetsBar, { spreadsheetRef: spreadsheetRef }),
|
|
229
|
+
dialog && (React.createElement(Dialog, { title: dialog.title, onClose: onDialogClose },
|
|
230
|
+
React.createElement("div", null, dialog.message),
|
|
231
|
+
React.createElement(DialogActionsBar, { layout: 'start' },
|
|
232
|
+
React.createElement(Button, { themeColor: 'primary', onClick: onDialogClose }, loc.toLanguageString(keys.ok, messages[keys.ok]))))),
|
|
201
233
|
showLicenseWatermark && React.createElement(WatermarkOverlay, null)));
|
|
202
234
|
});
|
|
203
235
|
Spreadsheet.displayName = 'KendoReactSpreadsheet';
|
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,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/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,10 +166,34 @@ 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
|
*/
|
|
136
176
|
const addNewSheet = 'spreadsheet.addNewSheet';
|
|
177
|
+
/**
|
|
178
|
+
* @hidden
|
|
179
|
+
*/
|
|
180
|
+
const error = 'spreadsheet.error';
|
|
181
|
+
/**
|
|
182
|
+
* @hidden
|
|
183
|
+
*/
|
|
184
|
+
const ok = 'spreadsheet.ok';
|
|
185
|
+
/**
|
|
186
|
+
* @hidden
|
|
187
|
+
*/
|
|
188
|
+
const modifyMerged = 'spreadsheet.modifyMerged';
|
|
189
|
+
/**
|
|
190
|
+
* @hidden
|
|
191
|
+
*/
|
|
192
|
+
const cannotModifyDisabled = 'spreadsheet.cannotModifyDisabled';
|
|
193
|
+
/**
|
|
194
|
+
* @hidden
|
|
195
|
+
*/
|
|
196
|
+
const openUnsupported = 'spreadsheet.openUnsupported';
|
|
137
197
|
/**
|
|
138
198
|
* @hidden
|
|
139
199
|
*/
|
|
@@ -144,16 +204,25 @@ export const messages = {
|
|
|
144
204
|
[undo]: 'Undo',
|
|
145
205
|
[redo]: 'Redo',
|
|
146
206
|
[fontSize]: 'Font size',
|
|
207
|
+
[fontSizeIncrease]: 'Increase Font size',
|
|
208
|
+
[fontSizeDecrease]: 'Decrease Font size',
|
|
147
209
|
[fontName]: 'Font',
|
|
210
|
+
[cleanFormatting]: 'Clean formatting',
|
|
148
211
|
[format]: 'Custom format...',
|
|
212
|
+
[alignHorizontally]: 'Align horizontally',
|
|
213
|
+
[alignVertically]: 'Align vertically',
|
|
149
214
|
[align]: 'Align',
|
|
150
|
-
[alignLeft]: 'Align
|
|
151
|
-
[alignRight]: 'Align
|
|
152
|
-
[alignCenter]: 'Align
|
|
153
|
-
[alignJustify]: 'Align
|
|
154
|
-
[
|
|
155
|
-
[
|
|
156
|
-
[
|
|
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',
|
|
157
226
|
[textColor]: 'Text Color',
|
|
158
227
|
[background]: 'Background color',
|
|
159
228
|
[addRowAbove]: 'Add row above',
|
|
@@ -171,7 +240,13 @@ export const messages = {
|
|
|
171
240
|
[home]: 'Home',
|
|
172
241
|
[file]: 'File',
|
|
173
242
|
[insert]: 'Insert',
|
|
174
|
-
[addNewSheet]: 'Add new sheet'
|
|
243
|
+
[addNewSheet]: 'Add new sheet',
|
|
244
|
+
[formatTab]: 'Format',
|
|
245
|
+
[modifyMerged]: 'Cannot change part of a merged cell.',
|
|
246
|
+
[cannotModifyDisabled]: 'Cannot modify disabled cells.',
|
|
247
|
+
[openUnsupported]: 'Unsupported format. Please select an .xlsx file.',
|
|
248
|
+
[error]: 'Error',
|
|
249
|
+
[ok]: 'OK'
|
|
175
250
|
};
|
|
176
251
|
/**
|
|
177
252
|
* @hidden
|
|
@@ -183,16 +258,25 @@ export const keys = {
|
|
|
183
258
|
undo,
|
|
184
259
|
redo,
|
|
185
260
|
fontSize,
|
|
261
|
+
fontSizeIncrease,
|
|
262
|
+
fontSizeDecrease,
|
|
186
263
|
fontName,
|
|
264
|
+
cleanFormatting,
|
|
187
265
|
format,
|
|
266
|
+
alignHorizontally,
|
|
267
|
+
alignVertically,
|
|
188
268
|
align,
|
|
189
269
|
alignLeft,
|
|
190
270
|
alignRight,
|
|
191
271
|
alignCenter,
|
|
272
|
+
center,
|
|
192
273
|
alignJustify,
|
|
274
|
+
justify,
|
|
193
275
|
alignTop,
|
|
194
276
|
alignMiddle,
|
|
195
277
|
alignBottom,
|
|
278
|
+
increaseDecimal,
|
|
279
|
+
decreaseDecimal,
|
|
196
280
|
textColor,
|
|
197
281
|
background,
|
|
198
282
|
addRowAbove,
|
|
@@ -210,5 +294,11 @@ export const keys = {
|
|
|
210
294
|
file,
|
|
211
295
|
home,
|
|
212
296
|
insert,
|
|
213
|
-
addNewSheet
|
|
297
|
+
addNewSheet,
|
|
298
|
+
error,
|
|
299
|
+
ok,
|
|
300
|
+
modifyMerged,
|
|
301
|
+
cannotModifyDisabled,
|
|
302
|
+
openUnsupported,
|
|
303
|
+
formatTab
|
|
214
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: 1692893863,
|
|
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
|
];
|