@progress/kendo-angular-spreadsheet 14.3.0-develop.3 → 14.3.0-develop.4
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/common/spreadsheet.service.d.ts +1 -0
- package/esm2020/common/spreadsheet.service.mjs +1 -0
- package/esm2020/localization/messages.mjs +13 -1
- package/esm2020/package-metadata.mjs +2 -2
- package/esm2020/sheets-bar/sheets-bar.component.mjs +132 -58
- package/esm2020/sheets-bar/utils.mjs +22 -18
- package/esm2020/spreadsheet.component.mjs +47 -6
- package/esm2020/tools/align/horizontal-align-tool.directive.mjs +1 -3
- package/esm2020/tools/align/vertical-align-tool.directive.mjs +1 -3
- package/esm2020/utils.mjs +2 -1
- package/fesm2015/progress-kendo-angular-spreadsheet.mjs +201 -82
- package/fesm2020/progress-kendo-angular-spreadsheet.mjs +218 -90
- package/localization/messages.d.ts +25 -1
- package/models/sheet-info.d.ts +1 -0
- package/package.json +13 -13
- package/schematics/ngAdd/index.js +1 -1
- package/sheets-bar/sheets-bar.component.d.ts +6 -3
- package/sheets-bar/utils.d.ts +1 -1
- package/spreadsheet.component.d.ts +4 -0
@@ -14,6 +14,7 @@ import * as i0 from "@angular/core";
|
|
14
14
|
export declare class SpreadsheetService {
|
15
15
|
spreadsheet: SpreadsheetWidget;
|
16
16
|
sheetsChanged: Subject<SheetsChanges>;
|
17
|
+
onSheetsBarFocus: Subject<any>;
|
17
18
|
activeSheetChanged: Subject<Sheet>;
|
18
19
|
selectionChanged: Subject<Range>;
|
19
20
|
dialogContainer: ViewContainerRef;
|
@@ -12,6 +12,7 @@ let spreadsheetCounter = 0;
|
|
12
12
|
export class SpreadsheetService {
|
13
13
|
constructor() {
|
14
14
|
this.sheetsChanged = new Subject();
|
15
|
+
this.onSheetsBarFocus = new Subject();
|
15
16
|
this.activeSheetChanged = new Subject();
|
16
17
|
this.selectionChanged = new Subject();
|
17
18
|
spreadsheetCounter++;
|
@@ -11,7 +11,7 @@ import * as i0 from "@angular/core";
|
|
11
11
|
export class MessagesDirective extends ComponentMessages {
|
12
12
|
}
|
13
13
|
MessagesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MessagesDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
14
|
-
MessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: MessagesDirective, selector: "[kendoSpreadsheetMessages]", inputs: { home: "home", file: "file", insert: "insert", formatTab: "formatTab", saveFile: "saveFile", loadFile: "loadFile", bold: "bold", italic: "italic", underline: "underline", format: "format", fontFamily: "fontFamily", fontSize: "fontSize", undo: "undo", redo: "redo", background: "background", color: "color", gridLines: "gridLines", addColumnLeft: "addColumnLeft", addColumnRight: "addColumnRight", addRowBelow: "addRowBelow", addRowAbove: "addRowAbove", deleteColumn: "deleteColumn", deleteRow: "deleteRow", wrap: "wrap", align: "align", alignHorizontal: "alignHorizontal", alignVertical: "alignVertical", alignLeft: "alignLeft", alignCenter: "alignCenter", alignRight: "alignRight", alignJustify: "alignJustify", alignTop: "alignTop", alignMiddle: "alignMiddle", alignBottom: "alignBottom", dialogApply: "dialogApply", dialogCancel: "dialogCancel", dialogDelete: "dialogDelete", dialogRename: "dialogRename", dialogInsert: "dialogInsert", dialogRemoveLink: "dialogRemoveLink", delete: "delete", rename: "rename", nameBox: "nameBox", formulaInput: "formulaInput", addSheet: "addSheet", sheetsMenu: "sheetsMenu", view: "view", merge: "merge", mergeHorizontally: "mergeHorizontally", mergeVertically: "mergeVertically", mergeAll: "mergeAll", unmerge: "unmerge", insertLink: "insertLink", increaseDecimal: "increaseDecimal", decreaseDecimal: "decreaseDecimal", increaseFontSize: "increaseFontSize", decreaseFontSize: "decreaseFontSize", openUnsupported: "openUnsupported", modifyMerged: "modifyMerged", cannotModifyDisabled: "cannotModifyDisabled", dialogOk: "dialogOk", dialogError: "dialogError", duplicateSheetName: "duplicateSheetName", copy: "copy", cut: "cut", paste: "paste", hideRow: "hideRow", unhideRow: "unhideRow", hideColumn: "hideColumn", unhideColumn: "unhideColumn" }, usesInheritance: true, ngImport: i0 });
|
14
|
+
MessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: MessagesDirective, selector: "[kendoSpreadsheetMessages]", inputs: { home: "home", file: "file", insert: "insert", formatTab: "formatTab", saveFile: "saveFile", loadFile: "loadFile", bold: "bold", italic: "italic", underline: "underline", format: "format", fontFamily: "fontFamily", fontSize: "fontSize", undo: "undo", redo: "redo", background: "background", color: "color", gridLines: "gridLines", addColumnLeft: "addColumnLeft", addColumnRight: "addColumnRight", addRowBelow: "addRowBelow", addRowAbove: "addRowAbove", deleteColumn: "deleteColumn", deleteRow: "deleteRow", wrap: "wrap", align: "align", alignHorizontal: "alignHorizontal", alignVertical: "alignVertical", alignLeft: "alignLeft", alignCenter: "alignCenter", alignRight: "alignRight", alignJustify: "alignJustify", alignTop: "alignTop", alignMiddle: "alignMiddle", alignBottom: "alignBottom", dialogApply: "dialogApply", dialogCancel: "dialogCancel", dialogDelete: "dialogDelete", dialogRename: "dialogRename", dialogInsert: "dialogInsert", dialogRemoveLink: "dialogRemoveLink", delete: "delete", rename: "rename", nameBox: "nameBox", formulaInput: "formulaInput", addSheet: "addSheet", sheetsMenu: "sheetsMenu", view: "view", merge: "merge", mergeHorizontally: "mergeHorizontally", mergeVertically: "mergeVertically", mergeAll: "mergeAll", unmerge: "unmerge", insertLink: "insertLink", increaseDecimal: "increaseDecimal", decreaseDecimal: "decreaseDecimal", increaseFontSize: "increaseFontSize", decreaseFontSize: "decreaseFontSize", openUnsupported: "openUnsupported", modifyMerged: "modifyMerged", cannotModifyDisabled: "cannotModifyDisabled", dialogOk: "dialogOk", dialogError: "dialogError", duplicateSheetName: "duplicateSheetName", copy: "copy", cut: "cut", paste: "paste", hideRow: "hideRow", unhideRow: "unhideRow", hideColumn: "hideColumn", unhideColumn: "unhideColumn", sheetDelete: "sheetDelete", sheetRename: "sheetRename", sheetHide: "sheetHide", sheetDuplicate: "sheetDuplicate", sheetMoveLeft: "sheetMoveLeft", sheetMoveRight: "sheetMoveRight" }, usesInheritance: true, ngImport: i0 });
|
15
15
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MessagesDirective, decorators: [{
|
16
16
|
type: Directive,
|
17
17
|
args: [{
|
@@ -157,4 +157,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
157
157
|
type: Input
|
158
158
|
}], unhideColumn: [{
|
159
159
|
type: Input
|
160
|
+
}], sheetDelete: [{
|
161
|
+
type: Input
|
162
|
+
}], sheetRename: [{
|
163
|
+
type: Input
|
164
|
+
}], sheetHide: [{
|
165
|
+
type: Input
|
166
|
+
}], sheetDuplicate: [{
|
167
|
+
type: Input
|
168
|
+
}], sheetMoveLeft: [{
|
169
|
+
type: Input
|
170
|
+
}], sheetMoveRight: [{
|
171
|
+
type: Input
|
160
172
|
}] } });
|
@@ -9,7 +9,7 @@ export const packageMetadata = {
|
|
9
9
|
name: '@progress/kendo-angular-spreadsheet',
|
10
10
|
productName: 'Kendo UI for Angular',
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
12
|
-
publishDate:
|
13
|
-
version: '14.3.0-develop.
|
12
|
+
publishDate: 1701780650,
|
13
|
+
version: '14.3.0-develop.4',
|
14
14
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning',
|
15
15
|
};
|
@@ -3,7 +3,7 @@
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
5
5
|
import { Component, ElementRef, HostBinding, Input, NgZone, QueryList, Renderer2, ViewChild, ViewChildren } from '@angular/core';
|
6
|
-
import { caretAltDownIcon, menuIcon, plusIcon, caretAltLeftIcon, caretAltRightIcon, eyeIcon } from '@progress/kendo-svg-icons';
|
6
|
+
import { caretAltDownIcon, menuIcon, plusIcon, caretAltLeftIcon, caretAltRightIcon, eyeIcon, eyeSlashIcon } from '@progress/kendo-svg-icons';
|
7
7
|
import { SpreadsheetService } from '../common/spreadsheet.service';
|
8
8
|
import { ButtonComponent, DropDownButtonComponent } from '@progress/kendo-angular-buttons';
|
9
9
|
import { Keys, isDocumentAvailable, isPresent } from '@progress/kendo-angular-common';
|
@@ -14,6 +14,7 @@ import { ActionDialogComponent } from './action-dialog.component';
|
|
14
14
|
import { TabStripComponent } from '@progress/kendo-angular-layout';
|
15
15
|
import { mapToSheetDescriptor } from '../utils';
|
16
16
|
import { getSheetActions } from './utils';
|
17
|
+
import { Subscription } from 'rxjs';
|
17
18
|
import * as i0 from "@angular/core";
|
18
19
|
import * as i1 from "../common/spreadsheet.service";
|
19
20
|
import * as i2 from "../localization/spreadsheet-localization.service";
|
@@ -34,14 +35,23 @@ export class SheetsBarComponent {
|
|
34
35
|
this.dialogService = dialogService;
|
35
36
|
this.ngZone = ngZone;
|
36
37
|
this.hostClasses = true;
|
38
|
+
this.subs = new Subscription();
|
37
39
|
this.plusIcon = plusIcon;
|
38
40
|
this.menuIcon = menuIcon;
|
39
41
|
this.caretAltDownIcon = caretAltDownIcon;
|
40
42
|
this.caretAltLeftIcon = caretAltLeftIcon;
|
41
43
|
this.caretAltRightIcon = caretAltRightIcon;
|
42
44
|
this.selected = false;
|
45
|
+
this.sheetsMenuList = [];
|
43
46
|
this.openedDdb = null;
|
44
|
-
this.
|
47
|
+
this.hiddenStateIcons = {
|
48
|
+
hidden: 'eye-slash',
|
49
|
+
visible: 'eye'
|
50
|
+
};
|
51
|
+
this.hiddenStateSVGIcons = {
|
52
|
+
hidden: eyeSlashIcon,
|
53
|
+
visible: eyeIcon
|
54
|
+
};
|
45
55
|
this.onAddClick = () => {
|
46
56
|
if (this.spreadsheetService.spreadsheet) {
|
47
57
|
this.spreadsheetService.spreadsheet.view.sheetsbar.onAddSelect();
|
@@ -63,21 +73,52 @@ export class SheetsBarComponent {
|
|
63
73
|
this.spreadsheetService.spreadsheet.insertSheet({ data: { ...sheetToCopy.toJSON(), name: newName }, index: sheetInfo.index + 1 });
|
64
74
|
this.selectSheet(newName);
|
65
75
|
},
|
66
|
-
move: (sheetInfo,
|
67
|
-
const
|
68
|
-
|
76
|
+
move: (sheetInfo, itemKey) => {
|
77
|
+
const isMoveRight = itemKey === 'sheetMoveRight';
|
78
|
+
let oldIndex = -1;
|
79
|
+
let newIndex = -1;
|
80
|
+
if (isMoveRight) {
|
81
|
+
for (let i = 0; i < this.sheets.length; i++) {
|
82
|
+
if (this.sheets[i].text === sheetInfo.text) {
|
83
|
+
oldIndex = i;
|
84
|
+
}
|
85
|
+
if (oldIndex > -1 && i > oldIndex && this.sheets[i].state === 'visible') {
|
86
|
+
newIndex = i;
|
87
|
+
break;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
else {
|
92
|
+
for (let i = this.sheets.length - 1; i >= 0; i--) {
|
93
|
+
if (this.sheets[i].text === sheetInfo.text) {
|
94
|
+
oldIndex = i;
|
95
|
+
}
|
96
|
+
if (oldIndex > -1 && i < oldIndex && this.sheets[i].state === 'visible') {
|
97
|
+
newIndex = i;
|
98
|
+
break;
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
69
102
|
const sheetsBar = this.spreadsheetService.spreadsheet.view.sheetsbar;
|
70
103
|
sheetsBar.onSheetReorderEnd({ oldIndex, newIndex });
|
71
104
|
this.notifySheetsChange();
|
105
|
+
},
|
106
|
+
hide: (sheet) => {
|
107
|
+
sheet.state = 'hidden';
|
108
|
+
const sheets = this.spreadsheetService.spreadsheet.sheets();
|
109
|
+
const sheetIndex = sheets.findIndex(s => s.name() === sheet.text);
|
110
|
+
sheets[sheetIndex]._state('hidden');
|
111
|
+
const newSelectedIndex = sheetIndex < sheets.length - 1 ? sheetIndex + 1 : 0;
|
112
|
+
const sheetToSelect = sheets[newSelectedIndex].name();
|
113
|
+
this.selectSheet(sheetToSelect);
|
114
|
+
this.notifySheetsChange();
|
72
115
|
}
|
73
116
|
};
|
117
|
+
this.subs.add(spreadsheetService.onSheetsBarFocus.subscribe(() => ngZone.run(() => this.tabstrip.selectTab(this.sheets.findIndex(sh => sh.text === spreadsheetService.currentActiveSheet)))));
|
74
118
|
}
|
75
119
|
get activeSheet() {
|
76
120
|
return this.spreadsheetService.spreadsheet?.activeSheet()?.name();
|
77
121
|
}
|
78
|
-
get sheetsMenuList() {
|
79
|
-
return this.sheets?.map(sheet => ({ text: sheet.text, icon: 'eye', svgIcon: this.eyeIcon }));
|
80
|
-
}
|
81
122
|
get tablistId() {
|
82
123
|
return this.spreadsheetService.tablistId;
|
83
124
|
}
|
@@ -93,10 +134,26 @@ export class SheetsBarComponent {
|
|
93
134
|
this.renderer.setAttribute(tablist, 'id', this.tablistId);
|
94
135
|
this.tabListSub = this.renderer.listen(tablist, 'keydown', this.onTabListKeyDown.bind(this));
|
95
136
|
}
|
137
|
+
ngOnChanges(changes) {
|
138
|
+
if (changes['sheets']) {
|
139
|
+
this.sheetsMenuList = this.sheets?.map(sheet => ({
|
140
|
+
text: sheet.text,
|
141
|
+
icon: this.hiddenStateIcons[sheet.state],
|
142
|
+
svgIcon: this.hiddenStateSVGIcons[sheet.state]
|
143
|
+
}));
|
144
|
+
this.sheets = changes['sheets'].currentValue?.map((sheet, _, items) => ({
|
145
|
+
...sheet,
|
146
|
+
sheetActions: getSheetActions(items, sheet)
|
147
|
+
.map(item => ({ ...item, text: this.messageFor(item.messageKey) }))
|
148
|
+
}));
|
149
|
+
}
|
150
|
+
;
|
151
|
+
}
|
96
152
|
ngOnDestroy() {
|
97
153
|
if (this.tabListSub) {
|
98
154
|
this.tabListSub();
|
99
155
|
}
|
156
|
+
this.subs.unsubscribe();
|
100
157
|
}
|
101
158
|
onTabSelect(ev) {
|
102
159
|
if (ev.title !== this.activeSheet) {
|
@@ -122,11 +179,13 @@ export class SheetsBarComponent {
|
|
122
179
|
this.openDialog(dataItem, sheet);
|
123
180
|
}
|
124
181
|
else {
|
125
|
-
this.actionsCallback[dataItem.commandName](sheet, dataItem.
|
182
|
+
this.actionsCallback[dataItem.commandName](sheet, dataItem.messageKey);
|
126
183
|
}
|
127
184
|
}
|
128
185
|
onMenuItemClick(item) {
|
129
186
|
const sheet = this.sheets.find(s => s.text === item.text);
|
187
|
+
sheet.state = 'visible';
|
188
|
+
this.spreadsheetService.spreadsheet.sheets().find(sh => sh.name() === sheet.text)._state('visible');
|
130
189
|
this.selectSheet(sheet.text);
|
131
190
|
}
|
132
191
|
messageFor(key) {
|
@@ -195,21 +254,30 @@ export class SheetsBarComponent {
|
|
195
254
|
this.ngZone.run(() => {
|
196
255
|
const newSheets = this.spreadsheetService.spreadsheet.sheets();
|
197
256
|
const sheetDesc = mapToSheetDescriptor(newSheets);
|
198
|
-
this.sheets = sheetDesc
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
257
|
+
this.sheets = sheetDesc
|
258
|
+
.flatMap((item, index, items) => item.state === 'visible' ? [{
|
259
|
+
...item,
|
260
|
+
state: item.state || 'visible',
|
261
|
+
inEdit: false,
|
262
|
+
first: index === 0,
|
263
|
+
last: index === items.length - 1,
|
264
|
+
text: item.name,
|
265
|
+
active: (item.name === this.activeSheet) || items.length === 1,
|
266
|
+
index,
|
267
|
+
sheetActions: getSheetActions(items, item)
|
268
|
+
.map(item => ({ ...item, text: this.messageFor(item.messageKey) }))
|
269
|
+
}] : []);
|
270
|
+
this.sheetsMenuList = this.sheets?.map(sheet => ({
|
271
|
+
text: sheet.text,
|
272
|
+
icon: this.hiddenStateIcons[sheet.state],
|
273
|
+
svgIcon: this.hiddenStateSVGIcons[sheet.state]
|
207
274
|
}));
|
208
275
|
});
|
276
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => this.spreadsheetService.spreadsheet.view.clipboard.focus());
|
209
277
|
}
|
210
278
|
}
|
211
279
|
SheetsBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SheetsBarComponent, deps: [{ token: i1.SpreadsheetService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i2.SpreadsheetLocalizationService }, { token: i3.DialogService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
212
|
-
SheetsBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SheetsBarComponent, selector: "[kendoSpreadsheetSheetsBar]", inputs: { sheets: "sheets", sheetDescriptors: "sheetDescriptors" }, host: { properties: { "class.k-spreadsheet-sheets-bar": "this.hostClasses" } }, viewQueries: [{ propertyName: "addButton", first: true, predicate: ["addButton"], descendants: true }, { propertyName: "menuButton", first: true, predicate: ["menuButton"], descendants: true }, { propertyName: "tabstrip", first: true, predicate: ["tabstrip"], descendants: true }, { propertyName: "actionDdbs", predicate: ["sheetDdb"], descendants: true }, { propertyName: "actionDdbRefs", predicate: ["sheetDdb"], descendants: true, read: ElementRef }], ngImport: i0, template: `
|
280
|
+
SheetsBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SheetsBarComponent, selector: "[kendoSpreadsheetSheetsBar]", inputs: { sheets: "sheets", sheetDescriptors: "sheetDescriptors" }, host: { properties: { "class.k-spreadsheet-sheets-bar": "this.hostClasses" } }, viewQueries: [{ propertyName: "addButton", first: true, predicate: ["addButton"], descendants: true }, { propertyName: "menuButton", first: true, predicate: ["menuButton"], descendants: true }, { propertyName: "tabstrip", first: true, predicate: ["tabstrip"], descendants: true }, { propertyName: "actionDdbs", predicate: ["sheetDdb"], descendants: true }, { propertyName: "actionDdbRefs", predicate: ["sheetDdb"], descendants: true, read: ElementRef }], usesOnChanges: true, ngImport: i0, template: `
|
213
281
|
<button kendoButton #addButton
|
214
282
|
[title]="messageFor('addSheet')"
|
215
283
|
type="button"
|
@@ -237,27 +305,30 @@ SheetsBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
|
|
237
305
|
[scrollable]="{prevButtonIcon: 'caret-alt-left', prevSVGButtonIcon: caretAltLeftIcon, nextButtonIcon: 'caret-alt-right', nextSVGButtonIcon: caretAltRightIcon}"
|
238
306
|
class="k-spreadsheet-sheets k-overflow-hidden"
|
239
307
|
(tabSelect)="onTabSelect($event)">
|
240
|
-
<
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
<
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
308
|
+
<ng-container *ngFor="let sheet of sheets">
|
309
|
+
<kendo-tabstrip-tab
|
310
|
+
*ngIf="sheet.state === 'visible'"
|
311
|
+
[title]="sheet.text"
|
312
|
+
[selected]="sheet.text === activeSheet">
|
313
|
+
<ng-template kendoTabTemplate>
|
314
|
+
<span class="k-link">{{sheet.text}}</span>
|
315
|
+
<kendo-dropdownbutton #sheetDdb
|
316
|
+
fillMode="flat"
|
317
|
+
icon="caret-alt-down"
|
318
|
+
[svgIcon]="caretAltDownIcon"
|
319
|
+
buttonClass="k-menu-button"
|
320
|
+
[data]="sheet.sheetActions"
|
321
|
+
[buttonAttributes]="{'aria-hidden': 'true', 'tabindex': '-1', role: 'presentation'}"
|
322
|
+
(open)="onOpen(sheetDdb)"
|
323
|
+
(close)="onClose()"
|
324
|
+
(click)="$event.stopPropagation()"
|
325
|
+
(itemClick)="onActionClick($event, sheet)">
|
326
|
+
</kendo-dropdownbutton>
|
327
|
+
</ng-template>
|
328
|
+
</kendo-tabstrip-tab>
|
329
|
+
</ng-container>
|
259
330
|
</kendo-tabstrip>
|
260
|
-
`, isInline: true, components: [{ type: i4.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { type: i4.DropDownButtonComponent, selector: "kendo-dropdownbutton", inputs: ["arrowIcon", "icon", "svgIcon", "iconClass", "imageUrl", "textField", "data", "size", "rounded", "fillMode", "themeColor", "buttonAttributes"], outputs: ["itemClick", "focus", "blur"], exportAs: ["kendoDropDownButton"] }, { type: i5.TabStripComponent, selector: "kendo-tabstrip", inputs: ["height", "animate", "tabAlignment", "tabPosition", "keepTabContent", "closable", "scrollable", "closeIcon", "closeIconClass", "closeSVGIcon", "showContentArea"], outputs: ["tabSelect", "tabClose", "tabScroll"], exportAs: ["kendoTabStrip"] }, { type: i5.TabStripTabComponent, selector: "kendo-tabstrip-tab", inputs: ["title", "disabled", "cssClass", "cssStyle", "selected", "closable", "closeIcon", "closeIconClass", "closeSVGIcon"], exportAs: ["kendoTabStripTab"] }], directives: [{ type: i6.EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.TabTemplateDirective, selector: "[kendoTabTemplate]" }] });
|
331
|
+
`, isInline: true, components: [{ type: i4.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { type: i4.DropDownButtonComponent, selector: "kendo-dropdownbutton", inputs: ["arrowIcon", "icon", "svgIcon", "iconClass", "imageUrl", "textField", "data", "size", "rounded", "fillMode", "themeColor", "buttonAttributes"], outputs: ["itemClick", "focus", "blur"], exportAs: ["kendoDropDownButton"] }, { type: i5.TabStripComponent, selector: "kendo-tabstrip", inputs: ["height", "animate", "tabAlignment", "tabPosition", "keepTabContent", "closable", "scrollable", "closeIcon", "closeIconClass", "closeSVGIcon", "showContentArea"], outputs: ["tabSelect", "tabClose", "tabScroll"], exportAs: ["kendoTabStrip"] }, { type: i5.TabStripTabComponent, selector: "kendo-tabstrip-tab", inputs: ["title", "disabled", "cssClass", "cssStyle", "selected", "closable", "closeIcon", "closeIconClass", "closeSVGIcon"], exportAs: ["kendoTabStripTab"] }], directives: [{ type: i6.EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.TabTemplateDirective, selector: "[kendoTabTemplate]" }] });
|
261
332
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SheetsBarComponent, decorators: [{
|
262
333
|
type: Component,
|
263
334
|
args: [{
|
@@ -290,25 +361,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
290
361
|
[scrollable]="{prevButtonIcon: 'caret-alt-left', prevSVGButtonIcon: caretAltLeftIcon, nextButtonIcon: 'caret-alt-right', nextSVGButtonIcon: caretAltRightIcon}"
|
291
362
|
class="k-spreadsheet-sheets k-overflow-hidden"
|
292
363
|
(tabSelect)="onTabSelect($event)">
|
293
|
-
<
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
<
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
364
|
+
<ng-container *ngFor="let sheet of sheets">
|
365
|
+
<kendo-tabstrip-tab
|
366
|
+
*ngIf="sheet.state === 'visible'"
|
367
|
+
[title]="sheet.text"
|
368
|
+
[selected]="sheet.text === activeSheet">
|
369
|
+
<ng-template kendoTabTemplate>
|
370
|
+
<span class="k-link">{{sheet.text}}</span>
|
371
|
+
<kendo-dropdownbutton #sheetDdb
|
372
|
+
fillMode="flat"
|
373
|
+
icon="caret-alt-down"
|
374
|
+
[svgIcon]="caretAltDownIcon"
|
375
|
+
buttonClass="k-menu-button"
|
376
|
+
[data]="sheet.sheetActions"
|
377
|
+
[buttonAttributes]="{'aria-hidden': 'true', 'tabindex': '-1', role: 'presentation'}"
|
378
|
+
(open)="onOpen(sheetDdb)"
|
379
|
+
(close)="onClose()"
|
380
|
+
(click)="$event.stopPropagation()"
|
381
|
+
(itemClick)="onActionClick($event, sheet)">
|
382
|
+
</kendo-dropdownbutton>
|
383
|
+
</ng-template>
|
384
|
+
</kendo-tabstrip-tab>
|
385
|
+
</ng-container>
|
312
386
|
</kendo-tabstrip>
|
313
387
|
`
|
314
388
|
}]
|
@@ -2,44 +2,48 @@
|
|
2
2
|
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
5
|
-
import { trashIcon, pencilIcon, copyIcon, arrowRightIcon, arrowLeftIcon } from '@progress/kendo-svg-icons';
|
5
|
+
import { trashIcon, pencilIcon, copyIcon, arrowRightIcon, arrowLeftIcon, eyeSlashIcon } from '@progress/kendo-svg-icons';
|
6
6
|
/**
|
7
7
|
* @hidden
|
8
8
|
*/
|
9
|
-
export const getSheetActions = (
|
9
|
+
export const getSheetActions = (items, item) => {
|
10
|
+
const visibleItems = items.filter(item => item.state === 'visible');
|
11
|
+
const itemIndex = item ? visibleItems.findIndex(i => i === item) : 0;
|
10
12
|
return [{
|
11
|
-
|
13
|
+
messageKey: 'sheetDelete',
|
12
14
|
icon: 'trash',
|
13
15
|
svgIcon: trashIcon,
|
14
16
|
commandName: 'delete',
|
15
17
|
dialogButton: 'dialogDelete',
|
16
|
-
disabled:
|
17
|
-
},
|
18
|
-
|
19
|
-
text: 'Duplicate',
|
18
|
+
disabled: visibleItems.length === 1
|
19
|
+
}, {
|
20
|
+
messageKey: 'sheetDuplicate',
|
20
21
|
icon: 'copy',
|
21
22
|
svgIcon: copyIcon,
|
22
23
|
commandName: 'copy'
|
23
|
-
},
|
24
|
-
|
25
|
-
text: 'Rename',
|
24
|
+
}, {
|
25
|
+
messageKey: 'sheetRename',
|
26
26
|
icon: 'pencil',
|
27
27
|
svgIcon: pencilIcon,
|
28
28
|
commandName: 'rename',
|
29
29
|
dialogButton: 'dialogRename'
|
30
|
-
},
|
31
|
-
|
32
|
-
|
30
|
+
}, {
|
31
|
+
messageKey: 'sheetHide',
|
32
|
+
icon: 'eye-slash',
|
33
|
+
svgIcon: eyeSlashIcon,
|
34
|
+
commandName: 'hide',
|
35
|
+
disabled: visibleItems.length === 1
|
36
|
+
}, {
|
37
|
+
messageKey: 'sheetMoveRight',
|
33
38
|
icon: 'arrow-right',
|
34
39
|
svgIcon: arrowRightIcon,
|
35
40
|
commandName: 'move',
|
36
|
-
disabled:
|
37
|
-
},
|
38
|
-
|
39
|
-
text: 'Move Left',
|
41
|
+
disabled: visibleItems.length === 1 || itemIndex === visibleItems.length - 1
|
42
|
+
}, {
|
43
|
+
messageKey: 'sheetMoveLeft',
|
40
44
|
icon: 'arrow-left',
|
41
45
|
svgIcon: arrowLeftIcon,
|
42
46
|
commandName: 'move',
|
43
|
-
disabled:
|
47
|
+
disabled: visibleItems.length === 1 || itemIndex === 0
|
44
48
|
}];
|
45
49
|
};
|
@@ -12,7 +12,7 @@ import { SpreadsheetService } from './common/spreadsheet.service';
|
|
12
12
|
import { SpreadsheetToolsService } from './tools/tools.service';
|
13
13
|
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
14
14
|
import { SpreadsheetLocalizationService } from './localization/spreadsheet-localization.service';
|
15
|
-
import { hasObservers, isDocumentAvailable, isPresent, shouldShowValidationUI } from '@progress/kendo-angular-common';
|
15
|
+
import { Keys, hasObservers, isDocumentAvailable, isPresent, shouldShowValidationUI } from '@progress/kendo-angular-common';
|
16
16
|
import { mapToSheetDescriptor } from './utils';
|
17
17
|
import { PopupService } from '@progress/kendo-angular-popup';
|
18
18
|
import { FormulaInputDirective } from './action-bar/formula-input.directive';
|
@@ -160,6 +160,16 @@ export class SpreadsheetComponent {
|
|
160
160
|
this.showLicenseWatermark = false;
|
161
161
|
this.contextMenuItems = [];
|
162
162
|
this.subs = new Subscription();
|
163
|
+
/**
|
164
|
+
* @hidden
|
165
|
+
*/
|
166
|
+
this.onKeyDown = (e) => {
|
167
|
+
const isCtrl = e.ctrlKey || e.metaKey;
|
168
|
+
const shift = e.shiftKey;
|
169
|
+
if (isCtrl && shift && e.keyCode === Keys.KeyS) {
|
170
|
+
this.spreadsheetService.onSheetsBarFocus.next();
|
171
|
+
}
|
172
|
+
};
|
163
173
|
this.onChange = (e) => {
|
164
174
|
hasObservers(this.change) && this.change.emit(e);
|
165
175
|
this.spreadsheetService.selectionChanged.next(e.range);
|
@@ -253,13 +263,13 @@ export class SpreadsheetComponent {
|
|
253
263
|
set sheets(value) {
|
254
264
|
const items = value.map((item, index, items) => ({
|
255
265
|
...item,
|
266
|
+
state: item.state || 'visible',
|
256
267
|
inEdit: false,
|
257
268
|
first: index === 0,
|
258
269
|
last: index === items.length - 1,
|
259
270
|
text: item.name,
|
260
271
|
active: (item.name === this.activeSheet) || items.length === 1,
|
261
|
-
index
|
262
|
-
sheetActions: getSheetActions(index, items)
|
272
|
+
index
|
263
273
|
}));
|
264
274
|
this._sheetsInfo = items;
|
265
275
|
}
|
@@ -281,6 +291,7 @@ export class SpreadsheetComponent {
|
|
281
291
|
spreadsheet.bind('changeFormat', this.onChangeFormat);
|
282
292
|
spreadsheet.bind('excelImport', this.onExcelImport);
|
283
293
|
spreadsheet.bind('excelExport', this.onExcelExport);
|
294
|
+
spreadsheet.bind('keydown', this.onKeyDown);
|
284
295
|
spreadsheet.view.bind('update', this.updateState);
|
285
296
|
spreadsheet.view.bind('message', this.onMessage);
|
286
297
|
spreadsheet.bind('contextmenu', this.onContextMenu.bind(this));
|
@@ -292,7 +303,13 @@ export class SpreadsheetComponent {
|
|
292
303
|
if (!this.sheetsInfo) {
|
293
304
|
this.ngZone.run(() => {
|
294
305
|
const defaultSheetDescriptors = mapToSheetDescriptor([spreadsheet?.activeSheet()]);
|
295
|
-
this._sheetsInfo = [{
|
306
|
+
this._sheetsInfo = [{
|
307
|
+
text: this.spreadsheetService.currentActiveSheet,
|
308
|
+
first: true, last: true,
|
309
|
+
state: 'visible',
|
310
|
+
...defaultSheetDescriptors,
|
311
|
+
sheetActions: getSheetActions(defaultSheetDescriptors).map(item => ({ ...item, text: this.messageFor(item.messageKey) }))
|
312
|
+
}];
|
296
313
|
});
|
297
314
|
}
|
298
315
|
});
|
@@ -767,7 +784,19 @@ SpreadsheetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
|
|
767
784
|
i18n-hideColumn="kendo.spreadsheet.hideColumn|The Hide column command text."
|
768
785
|
hideColumn="Hide"
|
769
786
|
i18n-unhideColumn="kendo.spreadsheet.unhideColumn|The Unhide column command text."
|
770
|
-
unhideColumn="Unhide"
|
787
|
+
unhideColumn="Unhide"
|
788
|
+
i18n-sheetDelete="kendo.spreadsheet.sheetDelete|The text of the Sheet menu Delete option."
|
789
|
+
sheetDelete="Delete"
|
790
|
+
i18n-sheetRename="kendo.spreadsheet.sheetRename|The text of the Sheet menu Rename option."
|
791
|
+
sheetRename="Rename"
|
792
|
+
i18n-sheetDuplicate="kendo.spreadsheet.sheetDuplicate|The text of the Sheet menu Duplicate option."
|
793
|
+
sheetDuplicate="Duplicate"
|
794
|
+
i18n-sheetHide="kendo.spreadsheet.sheetHide|The text of the Sheet menu Hide option."
|
795
|
+
sheetHide="Hide"
|
796
|
+
i18n-sheetMoveLeft="kendo.spreadsheet.sheetMoveLeft|The text of the Sheet menu Move Left option."
|
797
|
+
sheetMoveLeft="Move Left"
|
798
|
+
i18n-sheetMoveRight="kendo.spreadsheet.sheetMoveRight|The text of the Sheet menu Move Right option."
|
799
|
+
sheetMoveRight="Move Right">
|
771
800
|
</ng-container>
|
772
801
|
<div class="k-spreadsheet-header">
|
773
802
|
<kendo-menu kendoSpreadsheetMenu (select)="onMenuItemSelect($event)">
|
@@ -1034,7 +1063,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
1034
1063
|
i18n-hideColumn="kendo.spreadsheet.hideColumn|The Hide column command text."
|
1035
1064
|
hideColumn="Hide"
|
1036
1065
|
i18n-unhideColumn="kendo.spreadsheet.unhideColumn|The Unhide column command text."
|
1037
|
-
unhideColumn="Unhide"
|
1066
|
+
unhideColumn="Unhide"
|
1067
|
+
i18n-sheetDelete="kendo.spreadsheet.sheetDelete|The text of the Sheet menu Delete option."
|
1068
|
+
sheetDelete="Delete"
|
1069
|
+
i18n-sheetRename="kendo.spreadsheet.sheetRename|The text of the Sheet menu Rename option."
|
1070
|
+
sheetRename="Rename"
|
1071
|
+
i18n-sheetDuplicate="kendo.spreadsheet.sheetDuplicate|The text of the Sheet menu Duplicate option."
|
1072
|
+
sheetDuplicate="Duplicate"
|
1073
|
+
i18n-sheetHide="kendo.spreadsheet.sheetHide|The text of the Sheet menu Hide option."
|
1074
|
+
sheetHide="Hide"
|
1075
|
+
i18n-sheetMoveLeft="kendo.spreadsheet.sheetMoveLeft|The text of the Sheet menu Move Left option."
|
1076
|
+
sheetMoveLeft="Move Left"
|
1077
|
+
i18n-sheetMoveRight="kendo.spreadsheet.sheetMoveRight|The text of the Sheet menu Move Right option."
|
1078
|
+
sheetMoveRight="Move Right">
|
1038
1079
|
</ng-container>
|
1039
1080
|
<div class="k-spreadsheet-header">
|
1040
1081
|
<kendo-menu kendoSpreadsheetMenu (select)="onMenuItemSelect($event)">
|
@@ -29,9 +29,7 @@ export class SpreadsheetHorizontalTextAlignDirective {
|
|
29
29
|
host.icon = commandIcons[this.commandName];
|
30
30
|
host.arrowIcon = true;
|
31
31
|
host.fillMode = 'flat';
|
32
|
-
host.data = ALIGNS
|
33
|
-
.filter(value => value.commandName === 'textAlign')
|
34
|
-
.map(item => ({ ...item, textKey: localization.get(item.commandId) }));
|
32
|
+
host.data = ALIGNS.flatMap(item => item.commandName === 'textAlign' ? [{ ...item, textKey: localization.get(item.commandId) }] : []);
|
35
33
|
this.subs.add(host.itemClick.subscribe((e) => this.onItemClick(e)));
|
36
34
|
host.title = localization.get(this.commandName);
|
37
35
|
host.textField = 'textKey';
|
@@ -29,9 +29,7 @@ export class SpreadsheetVerticalTextAlignDirective {
|
|
29
29
|
host.icon = commandIcons[this.commandName];
|
30
30
|
host.arrowIcon = true;
|
31
31
|
host.fillMode = 'flat';
|
32
|
-
host.data = ALIGNS
|
33
|
-
.filter(value => value.commandName === 'verticalAlign')
|
34
|
-
.map(item => ({ ...item, textKey: localization.get(item.commandId) }));
|
32
|
+
host.data = ALIGNS.flatMap(item => item.commandName === 'verticalAlign' ? [{ ...item, textKey: localization.get(item.commandId) }] : []);
|
35
33
|
this.subs.add(host.itemClick.subscribe((e) => this.onItemClick(e)));
|
36
34
|
host.title = localization.get(this.commandName);
|
37
35
|
host.textField = 'textKey';
|
package/esm2020/utils.mjs
CHANGED