@progress/kendo-angular-spreadsheet 14.3.0-develop.1 → 14.3.0-develop.10

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.
@@ -22,6 +22,7 @@ export declare class FormulaInputDirective {
22
22
  ariaHasPopup: string;
23
23
  ariaExpanded: string;
24
24
  get ariaControls(): string;
25
+ formulaListMaxHeight: string;
25
26
  list: FormulaListComponent;
26
27
  data: any[];
27
28
  constructor(element: ElementRef, popupService: PopupService, spreadsheetService: SpreadsheetService, localization: SpreadsheetLocalizationService);
@@ -33,5 +34,5 @@ export declare class FormulaInputDirective {
33
34
  private unfocus;
34
35
  private focusNext;
35
36
  static ɵfac: i0.ɵɵFactoryDeclaration<FormulaInputDirective, never>;
36
- static ɵdir: i0.ɵɵDirectiveDeclaration<FormulaInputDirective, "[kendoSpreadsheetFormulaInput]", never, {}, {}, never>;
37
+ static ɵdir: i0.ɵɵDirectiveDeclaration<FormulaInputDirective, "[kendoSpreadsheetFormulaInput]", never, { "formulaListMaxHeight": "formulaListMaxHeight"; }, {}, never>;
37
38
  }
@@ -13,11 +13,12 @@ export declare class FormulaListComponent {
13
13
  element: ElementRef;
14
14
  private spreadsheetService;
15
15
  id: string;
16
+ maxHeight: string;
16
17
  data: any[];
17
18
  itemClick: (value: any) => void;
18
19
  formulaFxIcon: SVGIcon;
19
20
  constructor(element: ElementRef, spreadsheetService: SpreadsheetService);
20
21
  handleMouseDown: (ev: MouseEvent) => void;
21
22
  static ɵfac: i0.ɵɵFactoryDeclaration<FormulaListComponent, never>;
22
- static ɵcmp: i0.ɵɵComponentDeclaration<FormulaListComponent, "kendo-spreadsheet-formula-list", never, { "data": "data"; "itemClick": "itemClick"; }, {}, never, never>;
23
+ static ɵcmp: i0.ɵɵComponentDeclaration<FormulaListComponent, "kendo-spreadsheet-formula-list", never, { "maxHeight": "maxHeight"; "data": "data"; "itemClick": "itemClick"; }, {}, never, never>;
23
24
  }
@@ -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;
@@ -2,7 +2,7 @@
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 { Directive, ElementRef, HostBinding } from '@angular/core';
5
+ import { Directive, ElementRef, HostBinding, Input } from '@angular/core';
6
6
  import { FormulaListComponent } from './list.component';
7
7
  import { PopupService } from '@progress/kendo-angular-popup';
8
8
  import { SpreadsheetService } from '../common/spreadsheet.service';
@@ -46,6 +46,23 @@ export class FormulaInputDirective {
46
46
  }
47
47
  if (next) {
48
48
  next.classList.add('k-focus');
49
+ const { offsetTop, offsetHeight, parentElement } = next;
50
+ if (dir > 0) {
51
+ if (offsetTop + offsetHeight >= parentElement.offsetHeight + parentElement.scrollTop) {
52
+ parentElement.scrollTop = Math.min(parentElement.scrollTop + offsetHeight, parentElement.scrollHeight - parentElement.offsetHeight);
53
+ }
54
+ if (next === items[0]) {
55
+ next.scrollIntoView();
56
+ }
57
+ }
58
+ else {
59
+ if (offsetTop <= parentElement.scrollTop) {
60
+ parentElement.scrollTop = Math.max(parentElement.scrollTop - offsetHeight, 0);
61
+ }
62
+ if (next === items[items.length - 1]) {
63
+ next.scrollIntoView();
64
+ }
65
+ }
49
66
  }
50
67
  };
51
68
  }
@@ -110,6 +127,7 @@ export class FormulaInputDirective {
110
127
  this.list = list;
111
128
  list.data = this.data;
112
129
  list.itemClick = this.handler;
130
+ list.maxHeight = this.formulaListMaxHeight;
113
131
  this.ariaExpanded = 'true';
114
132
  },
115
133
  close: () => {
@@ -128,7 +146,7 @@ export class FormulaInputDirective {
128
146
  }
129
147
  }
130
148
  FormulaInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FormulaInputDirective, deps: [{ token: i0.ElementRef }, { token: i1.PopupService }, { token: i2.SpreadsheetService }, { token: i3.SpreadsheetLocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
131
- FormulaInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: FormulaInputDirective, selector: "[kendoSpreadsheetFormulaInput]", host: { properties: { "class.k-spreadsheet-formula-input": "this.hostClasses", "attr.title": "this.title", "attr.role": "this.role", "attr.aria-haspopup": "this.ariaHasPopup", "attr.aria-expanded": "this.ariaExpanded", "attr.aria-controls": "this.ariaControls" } }, ngImport: i0 });
149
+ FormulaInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: FormulaInputDirective, selector: "[kendoSpreadsheetFormulaInput]", inputs: { formulaListMaxHeight: "formulaListMaxHeight" }, host: { properties: { "class.k-spreadsheet-formula-input": "this.hostClasses", "attr.title": "this.title", "attr.role": "this.role", "attr.aria-haspopup": "this.ariaHasPopup", "attr.aria-expanded": "this.ariaExpanded", "attr.aria-controls": "this.ariaControls" } }, ngImport: i0 });
132
150
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FormulaInputDirective, decorators: [{
133
151
  type: Directive,
134
152
  args: [{
@@ -152,4 +170,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
152
170
  }], ariaControls: [{
153
171
  type: HostBinding,
154
172
  args: ['attr.aria-controls']
173
+ }], formulaListMaxHeight: [{
174
+ type: Input
155
175
  }] } });
@@ -26,10 +26,12 @@ export class FormulaListComponent {
26
26
  }
27
27
  }
28
28
  FormulaListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FormulaListComponent, deps: [{ token: i0.ElementRef }, { token: i1.SpreadsheetService }], target: i0.ɵɵFactoryTarget.Component });
29
- FormulaListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: FormulaListComponent, selector: "kendo-spreadsheet-formula-list", inputs: { data: "data", itemClick: "itemClick" }, host: { properties: { "attr.id": "this.id" } }, ngImport: i0, template: `
29
+ FormulaListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: FormulaListComponent, selector: "kendo-spreadsheet-formula-list", inputs: { maxHeight: "maxHeight", data: "data", itemClick: "itemClick" }, host: { properties: { "attr.id": "this.id" } }, ngImport: i0, template: `
30
30
  <ul #ulRef
31
31
  class="k-spreadsheet-formula-list k-list-ul k-list-md k-group k-reset"
32
32
  role="menu"
33
+ [style.overflowY]="'auto'"
34
+ [style.maxHeight]="maxHeight"
33
35
  [kendoEventsOutsideAngular]="{mousedown: handleMouseDown}">
34
36
  <li *ngFor="let item of data"
35
37
  (click)="itemClick(item.text)"
@@ -51,6 +53,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
51
53
  <ul #ulRef
52
54
  class="k-spreadsheet-formula-list k-list-ul k-list-md k-group k-reset"
53
55
  role="menu"
56
+ [style.overflowY]="'auto'"
57
+ [style.maxHeight]="maxHeight"
54
58
  [kendoEventsOutsideAngular]="{mousedown: handleMouseDown}">
55
59
  <li *ngFor="let item of data"
56
60
  (click)="itemClick(item.text)"
@@ -68,6 +72,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
68
72
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.SpreadsheetService }]; }, propDecorators: { id: [{
69
73
  type: HostBinding,
70
74
  args: ['attr.id']
75
+ }], maxHeight: [{
76
+ type: Input
71
77
  }], data: [{
72
78
  type: Input
73
79
  }], itemClick: [{
@@ -8,6 +8,7 @@ import { Injectable } from '@angular/core';
8
8
  import { Subject } from 'rxjs';
9
9
  import { SpreadsheetService } from './spreadsheet.service';
10
10
  import { take } from 'rxjs/operators';
11
+ import { replaceMessagePlaceholder } from '../utils';
11
12
  import * as i0 from "@angular/core";
12
13
  import * as i1 from "./spreadsheet.service";
13
14
  import * as i2 from "@progress/kendo-angular-l10n";
@@ -41,10 +42,22 @@ export class ErrorHandlingService {
41
42
  this.openDialog(messageData);
42
43
  }
43
44
  openDialog(messageData) {
45
+ let dialogContent;
46
+ if (messageData.name === 'message') {
47
+ const localizationMsg = this.messageFor('invalidNameError');
48
+ let inputValue = messageData.text.split(' ').pop();
49
+ if (messageData.text.startsWith('Parse')) {
50
+ inputValue = inputValue.substring(0, inputValue.length - 1);
51
+ }
52
+ dialogContent = replaceMessagePlaceholder(localizationMsg, 'inputValue', inputValue);
53
+ }
54
+ else {
55
+ dialogContent = this.messageFor(messageData.name);
56
+ }
44
57
  const dialogSettings = {
45
58
  appendTo: this.spreadsheetService.dialogContainer,
46
59
  title: this.messageFor('dialogError'),
47
- content: this.messageFor(messageData.name),
60
+ content: dialogContent,
48
61
  actions: [{
49
62
  text: this.messageFor('dialogOk'),
50
63
  themeColor: 'primary'
@@ -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", invalidNameError: "invalidNameError" }, 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,18 @@ 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
172
+ }], invalidNameError: [{
173
+ type: Input
160
174
  }] } });
@@ -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: 1701695065,
13
- version: '14.3.0-develop.1',
12
+ publishDate: 1702298332,
13
+ version: '14.3.0-develop.10',
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
  };
@@ -42,7 +42,7 @@ ActionDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
42
42
  </div>
43
43
  </div>
44
44
  </form>
45
- `, isInline: true, components: [{ type: i2.LabelComponent, selector: "kendo-label", inputs: ["text", "for", "optional", "labelCssStyle", "labelCssClass"], exportAs: ["kendoLabel"] }, { type: i3.TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "successSvgIcon", "errorIcon", "errorSvgIcon", "clearButtonIcon", "clearButtonSvgIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
45
+ `, isInline: true, components: [{ type: i2.LabelComponent, selector: "kendo-label", inputs: ["text", "for", "optional", "labelCssStyle", "labelCssClass"], exportAs: ["kendoLabel"] }, { type: i3.TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "type", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "successSvgIcon", "errorIcon", "errorSvgIcon", "clearButtonIcon", "clearButtonSvgIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
46
46
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ActionDialogComponent, decorators: [{
47
47
  type: Component,
48
48
  args: [{
@@ -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.eyeIcon = eyeIcon;
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,54 @@ 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, itemText) => {
67
- const oldIndex = this.spreadsheetService.spreadsheet.sheets().findIndex(sheet => sheet.name() === sheetInfo.text);
68
- const newIndex = itemText === 'Move Right' ? oldIndex + 1 : oldIndex - 1;
76
+ move: (sheetInfo, itemKey) => {
77
+ const isMoveRight = itemKey === 'sheetMoveRight';
78
+ let oldIndex = -1;
79
+ let newIndex = -1;
80
+ const sheets = this.spreadsheetService.spreadsheet.sheets();
81
+ if (isMoveRight) {
82
+ for (let i = 0; i < sheets.length; i++) {
83
+ if (sheets[i].name() === sheetInfo.text) {
84
+ oldIndex = i;
85
+ }
86
+ if (oldIndex > -1 && i > oldIndex && sheets[i]._state() === 'visible') {
87
+ newIndex = i;
88
+ break;
89
+ }
90
+ }
91
+ }
92
+ else {
93
+ for (let i = sheets.length - 1; i >= 0; i--) {
94
+ if (sheets[i].name() === sheetInfo.text) {
95
+ oldIndex = i;
96
+ }
97
+ if (oldIndex > -1 && (i < oldIndex) && sheets[i]._state() === 'visible') {
98
+ newIndex = i;
99
+ break;
100
+ }
101
+ }
102
+ }
69
103
  const sheetsBar = this.spreadsheetService.spreadsheet.view.sheetsbar;
70
104
  sheetsBar.onSheetReorderEnd({ oldIndex, newIndex });
105
+ this.selectSheet(sheetInfo.text);
106
+ this.notifySheetsChange();
107
+ },
108
+ hide: (sheet) => {
109
+ sheet.state = 'hidden';
110
+ const sheets = this.spreadsheetService.spreadsheet.sheets();
111
+ const sheetIndex = sheets.findIndex(s => s.name() === sheet.text);
112
+ sheets[sheetIndex]._state('hidden');
113
+ const newSelectedIndex = sheetIndex < sheets.length - 1 ? sheetIndex + 1 : 0;
114
+ const sheetToSelect = sheets[newSelectedIndex].name();
115
+ this.selectSheet(sheetToSelect);
71
116
  this.notifySheetsChange();
72
117
  }
73
118
  };
119
+ this.subs.add(spreadsheetService.onSheetsBarFocus.subscribe(() => ngZone.run(() => this.tabstrip.selectTab(this.sheets.findIndex(sh => sh.text === spreadsheetService.currentActiveSheet)))));
74
120
  }
75
121
  get activeSheet() {
76
122
  return this.spreadsheetService.spreadsheet?.activeSheet()?.name();
77
123
  }
78
- get sheetsMenuList() {
79
- return this.sheets?.map(sheet => ({ text: sheet.text, icon: 'eye', svgIcon: this.eyeIcon }));
80
- }
81
124
  get tablistId() {
82
125
  return this.spreadsheetService.tablistId;
83
126
  }
@@ -93,10 +136,26 @@ export class SheetsBarComponent {
93
136
  this.renderer.setAttribute(tablist, 'id', this.tablistId);
94
137
  this.tabListSub = this.renderer.listen(tablist, 'keydown', this.onTabListKeyDown.bind(this));
95
138
  }
139
+ ngOnChanges(changes) {
140
+ if (changes['sheets']) {
141
+ this.sheetsMenuList = this.sheets?.map(sheet => ({
142
+ text: sheet.text,
143
+ icon: this.hiddenStateIcons[sheet.state],
144
+ svgIcon: this.hiddenStateSVGIcons[sheet.state]
145
+ }));
146
+ this.sheets = changes['sheets'].currentValue?.map((sheet, _, items) => ({
147
+ ...sheet,
148
+ sheetActions: getSheetActions(items, sheet)
149
+ .map(item => ({ ...item, text: this.messageFor(item.messageKey) }))
150
+ }));
151
+ }
152
+ ;
153
+ }
96
154
  ngOnDestroy() {
97
155
  if (this.tabListSub) {
98
156
  this.tabListSub();
99
157
  }
158
+ this.subs.unsubscribe();
100
159
  }
101
160
  onTabSelect(ev) {
102
161
  if (ev.title !== this.activeSheet) {
@@ -122,11 +181,13 @@ export class SheetsBarComponent {
122
181
  this.openDialog(dataItem, sheet);
123
182
  }
124
183
  else {
125
- this.actionsCallback[dataItem.commandName](sheet, dataItem.text);
184
+ this.actionsCallback[dataItem.commandName](sheet, dataItem.messageKey);
126
185
  }
127
186
  }
128
187
  onMenuItemClick(item) {
129
188
  const sheet = this.sheets.find(s => s.text === item.text);
189
+ sheet.state = 'visible';
190
+ this.spreadsheetService.spreadsheet.sheets().find(sh => sh.name() === sheet.text)._state('visible');
130
191
  this.selectSheet(sheet.text);
131
192
  }
132
193
  messageFor(key) {
@@ -153,7 +214,9 @@ export class SheetsBarComponent {
153
214
  if (event.text === this.messageFor(dataItem.dialogButton)) {
154
215
  const sheetsBar = this.spreadsheetService.spreadsheet.view.sheetsbar;
155
216
  if (sheetsBar) {
156
- dataItem.commandName === 'delete' ? sheetsBar.onSheetRemove(sheet.text) : sheetsBar.onSheetRename(dialogContent.value, this.sheets.indexOf(sheet));
217
+ const allSheets = this.spreadsheetService.spreadsheet.sheets();
218
+ const sheetIndex = allSheets.findIndex(s => s.name() === sheet.text);
219
+ dataItem.commandName === 'delete' ? sheetsBar.onSheetRemove(sheet.text) : sheetsBar.onSheetRename(dialogContent.value, sheetIndex);
157
220
  this.notifySheetsChange();
158
221
  }
159
222
  }
@@ -195,21 +258,29 @@ export class SheetsBarComponent {
195
258
  this.ngZone.run(() => {
196
259
  const newSheets = this.spreadsheetService.spreadsheet.sheets();
197
260
  const sheetDesc = mapToSheetDescriptor(newSheets);
198
- this.sheets = sheetDesc.map((item, index, items) => ({
199
- ...item,
200
- inEdit: false,
201
- first: index === 0,
202
- last: index === items.length - 1,
203
- text: item.name,
204
- active: (item.name === this.activeSheet) || items.length === 1,
205
- index,
206
- sheetActions: getSheetActions(index, items)
261
+ this.sheets = sheetDesc
262
+ .flatMap((item, index, items) => item.state === 'visible' ? [{
263
+ ...item,
264
+ inEdit: false,
265
+ first: index === 0,
266
+ last: index === items.length - 1,
267
+ text: item.name,
268
+ active: (item.name === this.activeSheet) || items.length === 1,
269
+ index,
270
+ sheetActions: getSheetActions(items, item)
271
+ .map(item => ({ ...item, text: this.messageFor(item.messageKey) }))
272
+ }] : []);
273
+ this.sheetsMenuList = this.sheets?.map(sheet => ({
274
+ text: sheet.text,
275
+ icon: this.hiddenStateIcons[sheet.state],
276
+ svgIcon: this.hiddenStateSVGIcons[sheet.state]
207
277
  }));
208
278
  });
279
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => this.spreadsheetService.spreadsheet.view.clipboard.focus());
209
280
  }
210
281
  }
211
282
  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: `
283
+ 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
284
  <button kendoButton #addButton
214
285
  [title]="messageFor('addSheet')"
215
286
  type="button"
@@ -237,27 +308,30 @@ SheetsBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
237
308
  [scrollable]="{prevButtonIcon: 'caret-alt-left', prevSVGButtonIcon: caretAltLeftIcon, nextButtonIcon: 'caret-alt-right', nextSVGButtonIcon: caretAltRightIcon}"
238
309
  class="k-spreadsheet-sheets k-overflow-hidden"
239
310
  (tabSelect)="onTabSelect($event)">
240
- <kendo-tabstrip-tab *ngFor="let sheet of sheets"
241
- [title]="sheet.text"
242
- [selected]="sheet.text === activeSheet">
243
- <ng-template kendoTabTemplate>
244
- <span class="k-link">{{sheet.text}}</span>
245
- <kendo-dropdownbutton #sheetDdb
246
- fillMode="flat"
247
- icon="caret-alt-down"
248
- [svgIcon]="caretAltDownIcon"
249
- buttonClass="k-menu-button"
250
- [data]="sheet.sheetActions"
251
- [buttonAttributes]="{'aria-hidden': 'true', 'tabindex': '-1', role: 'presentation'}"
252
- (open)="onOpen(sheetDdb)"
253
- (close)="onClose()"
254
- (click)="$event.stopPropagation()"
255
- (itemClick)="onActionClick($event, sheet)">
256
- </kendo-dropdownbutton>
257
- </ng-template>
258
- </kendo-tabstrip-tab>
311
+ <ng-container *ngFor="let sheet of sheets">
312
+ <kendo-tabstrip-tab
313
+ *ngIf="sheet.state === 'visible'"
314
+ [title]="sheet.text"
315
+ [selected]="sheet.text === activeSheet">
316
+ <ng-template kendoTabTemplate>
317
+ <span class="k-link">{{sheet.text}}</span>
318
+ <kendo-dropdownbutton #sheetDdb
319
+ fillMode="flat"
320
+ icon="caret-alt-down"
321
+ [svgIcon]="caretAltDownIcon"
322
+ buttonClass="k-menu-button"
323
+ [data]="sheet.sheetActions"
324
+ [buttonAttributes]="{'aria-hidden': 'true', 'tabindex': '-1', role: 'presentation'}"
325
+ (open)="onOpen(sheetDdb)"
326
+ (close)="onClose()"
327
+ (click)="$event.stopPropagation()"
328
+ (itemClick)="onActionClick($event, sheet)">
329
+ </kendo-dropdownbutton>
330
+ </ng-template>
331
+ </kendo-tabstrip-tab>
332
+ </ng-container>
259
333
  </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]" }] });
334
+ `, 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
335
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SheetsBarComponent, decorators: [{
262
336
  type: Component,
263
337
  args: [{
@@ -290,25 +364,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
290
364
  [scrollable]="{prevButtonIcon: 'caret-alt-left', prevSVGButtonIcon: caretAltLeftIcon, nextButtonIcon: 'caret-alt-right', nextSVGButtonIcon: caretAltRightIcon}"
291
365
  class="k-spreadsheet-sheets k-overflow-hidden"
292
366
  (tabSelect)="onTabSelect($event)">
293
- <kendo-tabstrip-tab *ngFor="let sheet of sheets"
294
- [title]="sheet.text"
295
- [selected]="sheet.text === activeSheet">
296
- <ng-template kendoTabTemplate>
297
- <span class="k-link">{{sheet.text}}</span>
298
- <kendo-dropdownbutton #sheetDdb
299
- fillMode="flat"
300
- icon="caret-alt-down"
301
- [svgIcon]="caretAltDownIcon"
302
- buttonClass="k-menu-button"
303
- [data]="sheet.sheetActions"
304
- [buttonAttributes]="{'aria-hidden': 'true', 'tabindex': '-1', role: 'presentation'}"
305
- (open)="onOpen(sheetDdb)"
306
- (close)="onClose()"
307
- (click)="$event.stopPropagation()"
308
- (itemClick)="onActionClick($event, sheet)">
309
- </kendo-dropdownbutton>
310
- </ng-template>
311
- </kendo-tabstrip-tab>
367
+ <ng-container *ngFor="let sheet of sheets">
368
+ <kendo-tabstrip-tab
369
+ *ngIf="sheet.state === 'visible'"
370
+ [title]="sheet.text"
371
+ [selected]="sheet.text === activeSheet">
372
+ <ng-template kendoTabTemplate>
373
+ <span class="k-link">{{sheet.text}}</span>
374
+ <kendo-dropdownbutton #sheetDdb
375
+ fillMode="flat"
376
+ icon="caret-alt-down"
377
+ [svgIcon]="caretAltDownIcon"
378
+ buttonClass="k-menu-button"
379
+ [data]="sheet.sheetActions"
380
+ [buttonAttributes]="{'aria-hidden': 'true', 'tabindex': '-1', role: 'presentation'}"
381
+ (open)="onOpen(sheetDdb)"
382
+ (close)="onClose()"
383
+ (click)="$event.stopPropagation()"
384
+ (itemClick)="onActionClick($event, sheet)">
385
+ </kendo-dropdownbutton>
386
+ </ng-template>
387
+ </kendo-tabstrip-tab>
388
+ </ng-container>
312
389
  </kendo-tabstrip>
313
390
  `
314
391
  }]
@@ -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 = (index, items) => {
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
- text: 'Delete',
13
+ messageKey: 'sheetDelete',
12
14
  icon: 'trash',
13
15
  svgIcon: trashIcon,
14
16
  commandName: 'delete',
15
17
  dialogButton: 'dialogDelete',
16
- disabled: items.length === 1
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
- text: 'Move Right',
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: index === items.length - 1
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: index === 0
47
+ disabled: visibleItems.length === 1 || itemIndex === 0
44
48
  }];
45
49
  };