@colijnit/corecomponents_v12 12.0.21 → 12.0.22

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.
Files changed (73) hide show
  1. package/bundles/colijnit-corecomponents_v12.umd.js +724 -53
  2. package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
  3. package/colijnit-corecomponents_v12.d.ts +13 -9
  4. package/colijnit-corecomponents_v12.metadata.json +1 -1
  5. package/esm2015/colijnit-corecomponents_v12.js +14 -10
  6. package/esm2015/lib/components/base/base-input.component.js +4 -2
  7. package/esm2015/lib/components/button/button.component.js +1 -1
  8. package/esm2015/lib/components/carousel-3d/carousel-3d.component.js +2 -6
  9. package/esm2015/lib/components/co-dialog-wizard/co-dialog-wizard.component.js +51 -0
  10. package/esm2015/lib/components/co-dialog-wizard/co-dialog-wizard.module.js +17 -0
  11. package/esm2015/lib/components/drop-down-list/drop-down-list.component.js +4 -1
  12. package/esm2015/lib/components/form/form.component.js +8 -3
  13. package/esm2015/lib/components/grid/base/base-grid.component.js +7 -3
  14. package/esm2015/lib/components/grid/base/base-inline-edit-grid.component.js +48 -3
  15. package/esm2015/lib/components/grid/base/base-selection-grid.component.js +12 -2
  16. package/esm2015/lib/components/grid/co-grid.component.js +36 -32
  17. package/esm2015/lib/components/grid/co-grid.module.js +4 -2
  18. package/esm2015/lib/components/grid-toolbar/grid-toolbar.component.js +41 -0
  19. package/esm2015/lib/components/grid-toolbar/grid-toolbar.module.js +23 -0
  20. package/esm2015/lib/components/input-checkbox/input-checkbox.component.js +4 -1
  21. package/esm2015/lib/components/input-checkbox-multi-select/input-checkbox-multi-select.component.js +4 -1
  22. package/esm2015/lib/components/input-combo-box/input-combo-box.component.js +5 -4
  23. package/esm2015/lib/components/input-date-picker/input-date-picker.component.js +4 -1
  24. package/esm2015/lib/components/input-listbox/input-listbox.component.js +4 -1
  25. package/esm2015/lib/components/input-number-picker/input-number-picker.component.js +4 -1
  26. package/esm2015/lib/components/input-radio-button/input-radio-button.component.js +4 -1
  27. package/esm2015/lib/components/input-text/input-text.component.js +4 -1
  28. package/esm2015/lib/components/input-textarea/input-textarea.component.js +4 -1
  29. package/esm2015/lib/components/multi-select-list/multi-select-list.component.js +4 -1
  30. package/esm2015/lib/components/simple-grid/base-simple-grid.component.js +78 -0
  31. package/esm2015/lib/components/simple-grid/simple-grid-cell.component.js +162 -0
  32. package/esm2015/lib/components/simple-grid/simple-grid-column.directive.js +29 -4
  33. package/esm2015/lib/components/simple-grid/simple-grid.component.js +252 -59
  34. package/esm2015/lib/components/simple-grid/simple-grid.module.js +11 -2
  35. package/esm2015/public-api.js +3 -1
  36. package/fesm2015/colijnit-corecomponents_v12.js +744 -74
  37. package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
  38. package/lib/components/base/base-input.component.d.ts +1 -1
  39. package/lib/components/co-dialog/style/_layout.scss +3 -0
  40. package/lib/components/co-dialog-wizard/co-dialog-wizard.component.d.ts +9 -0
  41. package/lib/components/co-dialog-wizard/co-dialog-wizard.module.d.ts +2 -0
  42. package/lib/components/co-dialog-wizard/style/_layout.scss +51 -0
  43. package/lib/components/co-dialog-wizard/style/_material-definition.scss +25 -0
  44. package/lib/components/co-dialog-wizard/style/_theme.scss +16 -0
  45. package/lib/components/co-dialog-wizard/style/material.scss +5 -0
  46. package/lib/components/collapsible/style/_layout.scss +1 -1
  47. package/lib/components/collapsible/style/_material-definition.scss +1 -0
  48. package/lib/components/form/form.component.d.ts +1 -0
  49. package/lib/components/grid/base/base-grid.component.d.ts +3 -0
  50. package/lib/components/grid/base/base-inline-edit-grid.component.d.ts +11 -2
  51. package/lib/components/grid/base/base-selection-grid.component.d.ts +4 -0
  52. package/lib/components/grid-toolbar/grid-toolbar.component.d.ts +13 -0
  53. package/lib/components/grid-toolbar/grid-toolbar.module.d.ts +2 -0
  54. package/lib/components/grid-toolbar/style/_layout.scss +10 -0
  55. package/lib/components/grid-toolbar/style/_material-definition.scss +0 -0
  56. package/lib/components/grid-toolbar/style/_theme.scss +5 -0
  57. package/lib/components/grid-toolbar/style/material.scss +5 -0
  58. package/lib/components/input-combo-box/input-combo-box.component.d.ts +0 -1
  59. package/lib/components/input-radio-button/style/_material-definition.scss +1 -1
  60. package/lib/components/input-text/style/_layout.scss +10 -3
  61. package/lib/components/input-text/style/_material-definition.scss +1 -0
  62. package/lib/components/simple-grid/base-simple-grid.component.d.ts +29 -0
  63. package/lib/components/simple-grid/simple-grid-cell.component.d.ts +28 -0
  64. package/lib/components/simple-grid/simple-grid-column.directive.d.ts +9 -0
  65. package/lib/components/simple-grid/simple-grid.component.d.ts +37 -22
  66. package/lib/components/simple-grid/style/_layout.scss +23 -0
  67. package/lib/components/simple-grid/style/_material-definition.scss +13 -4
  68. package/lib/components/simple-grid/style/_theme.scss +17 -0
  69. package/lib/components/simple-grid/style/material.scss +1 -0
  70. package/lib/style/_input.mixins.scss +1 -1
  71. package/lib/style/_variables.scss +5 -1
  72. package/package.json +1 -1
  73. package/public-api.d.ts +2 -0
@@ -1,8 +1,8 @@
1
- import { Injectable, Component, Input, HostBinding, NgModule, Optional, SkipSelf, InjectionToken, Directive, ElementRef, NgZone, Inject, EventEmitter, ChangeDetectionStrategy, ViewEncapsulation, Output, HostListener, Pipe, ViewChild, ChangeDetectorRef, ComponentFactoryResolver, ViewContainerRef, forwardRef, NO_ERRORS_SCHEMA, Injector, ApplicationRef, ContentChild, TemplateRef, ContentChildren } from '@angular/core';
1
+ import { Injectable, Component, Input, HostBinding, NgModule, Optional, SkipSelf, InjectionToken, Directive, ElementRef, NgZone, Inject, EventEmitter, ChangeDetectionStrategy, ViewEncapsulation, Output, HostListener, Pipe, ViewChild, ChangeDetectorRef, ComponentFactoryResolver, ViewContainerRef, forwardRef, NO_ERRORS_SCHEMA, Injector, ApplicationRef, ContentChild, ContentChildren } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { HttpClientModule } from '@angular/common/http';
4
4
  import { DomSanitizer } from '@angular/platform-browser';
5
- import { Subject, merge, fromEvent } from 'rxjs';
5
+ import { Subject, merge, fromEvent, Observable, Subscription } from 'rxjs';
6
6
  import { auditTime } from 'rxjs/operators';
7
7
  import { __decorate, __awaiter } from 'tslib';
8
8
  import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
@@ -15,6 +15,7 @@ import { SwitchModule, CheckBoxModule, RadioButtonModule } from '@syncfusion/ej2
15
15
  import { FormsModule, NgModel, FormGroup } from '@angular/forms';
16
16
  import { CheckBoxSelectionService, DropDownListModule, MultiSelectModule, MultiSelectAllModule, ComboBoxAllModule, ListBoxComponent, CheckBoxSelection, ListBoxModule } from '@syncfusion/ej2-angular-dropdowns';
17
17
  import { RowDDService, GridModule, PageService, SortService, FilterService, GroupService, ReorderService, ResizeService, ExcelExportService, PdfExportService, EditService, ToolbarService, ColumnChooserService, ColumnMenuService, ContextMenuService } from '@syncfusion/ej2-angular-grids';
18
+ import { fromEvent as fromEvent$1 } from 'rxjs/internal/observable/fromEvent';
18
19
  import { enableRipple } from '@syncfusion/ej2-base';
19
20
  import { DatePickerModule } from '@syncfusion/ej2-angular-calendars';
20
21
  import { TextBoxAllModule, NumericTextBoxModule } from '@syncfusion/ej2-angular-inputs';
@@ -2313,6 +2314,67 @@ CoDialogPromptModule.decorators = [
2313
2314
  },] }
2314
2315
  ];
2315
2316
 
2317
+ class CoDialogWizardComponent {
2318
+ constructor() {
2319
+ this.icons = CoreComponentsIcon;
2320
+ this.showCloseIcon = true;
2321
+ this.animation = true;
2322
+ this.closeClick = new EventEmitter();
2323
+ }
2324
+ showClass() {
2325
+ return true;
2326
+ }
2327
+ }
2328
+ CoDialogWizardComponent.decorators = [
2329
+ { type: Component, args: [{
2330
+ selector: 'co-dialog-wizard',
2331
+ template: `
2332
+ <div class="co-dialog-wizard-wrapper" [@showHideDialog]="animation">
2333
+ <div class="dialog-header">
2334
+ <ng-content select="[header]"></ng-content>
2335
+ <div class="dialog-close-button" *ngIf="showCloseIcon" (click)="closeClick.emit($event)">
2336
+ <co-icon [icon]="icons.Cancel"></co-icon>
2337
+ </div>
2338
+ </div>
2339
+
2340
+ <hr class="co-dialog-wizard-divider">
2341
+
2342
+ <div class="dialog-content">
2343
+ <ng-content></ng-content>
2344
+ </div>
2345
+ </div>
2346
+ `,
2347
+ animations: [
2348
+ trigger('showHideDialog', [
2349
+ state('*', style({ opacity: 1 })),
2350
+ state('void', style({ opacity: 0 })),
2351
+ transition('void => *', animate('200ms 200ms')),
2352
+ transition('* => void', animate(200))
2353
+ ])
2354
+ ],
2355
+ encapsulation: ViewEncapsulation.None
2356
+ },] }
2357
+ ];
2358
+ CoDialogWizardComponent.propDecorators = {
2359
+ showCloseIcon: [{ type: Input }],
2360
+ animation: [{ type: Input }],
2361
+ closeClick: [{ type: Output }],
2362
+ showClass: [{ type: HostBinding, args: ["class.co-dialog-wizard",] }]
2363
+ };
2364
+
2365
+ class CoDialogWizardModule {
2366
+ }
2367
+ CoDialogWizardModule.decorators = [
2368
+ { type: NgModule, args: [{
2369
+ imports: [
2370
+ CommonModule,
2371
+ IconModule
2372
+ ],
2373
+ declarations: [CoDialogWizardComponent],
2374
+ exports: [CoDialogWizardComponent]
2375
+ },] }
2376
+ ];
2377
+
2316
2378
  class CoKanbanComponent {
2317
2379
  constructor() {
2318
2380
  this.allowDragAndDrop = true;
@@ -3169,7 +3231,9 @@ class BaseInputComponent {
3169
3231
  return false;
3170
3232
  }
3171
3233
  this.focused = false;
3172
- this.input.blur();
3234
+ if (this.input) {
3235
+ this.input.blur();
3236
+ }
3173
3237
  this.blur.next();
3174
3238
  }, 200);
3175
3239
  }
@@ -3648,6 +3712,7 @@ class FormComponent {
3648
3712
  constructor(_formMaster) {
3649
3713
  this._formMaster = _formMaster;
3650
3714
  this.onChange = new EventEmitter();
3715
+ this.showClass = true;
3651
3716
  this.submitted = false;
3652
3717
  // Emits true after every valid submit.
3653
3718
  this.validSubmit = new EventEmitter();
@@ -3794,7 +3859,10 @@ class FormComponent {
3794
3859
  FormComponent.decorators = [
3795
3860
  { type: Component, args: [{
3796
3861
  selector: "co-form",
3797
- template: `<ng-content></ng-content>`
3862
+ template: `
3863
+ <ng-content></ng-content>
3864
+ `,
3865
+ encapsulation: ViewEncapsulation.None
3798
3866
  },] }
3799
3867
  ];
3800
3868
  FormComponent.ctorParameters = () => [
@@ -3804,6 +3872,7 @@ FormComponent.propDecorators = {
3804
3872
  readonly: [{ type: Input }],
3805
3873
  keepInView: [{ type: Input }],
3806
3874
  onChange: [{ type: Output }],
3875
+ showClass: [{ type: HostBinding, args: ["class.co-form",] }],
3807
3876
  submitted: [{ type: HostBinding, args: ["class.submitted",] }],
3808
3877
  validSubmit: [{ type: Output }],
3809
3878
  anySubmit: [{ type: Output }],
@@ -3865,6 +3934,9 @@ DropDownListComponent.decorators = [
3865
3934
  {
3866
3935
  provide: COMPONENT_INTERFACE_NAME,
3867
3936
  useExisting: forwardRef(() => DropDownListComponent)
3937
+ }, {
3938
+ provide: BaseInputComponent,
3939
+ useExisting: DropDownListComponent
3868
3940
  }
3869
3941
  ],
3870
3942
  encapsulation: ViewEncapsulation.None
@@ -3933,7 +4005,8 @@ var GridLines;
3933
4005
  })(GridLines || (GridLines = {}));
3934
4006
 
3935
4007
  class BaseGridComponent {
3936
- constructor() {
4008
+ constructor(element) {
4009
+ this.element = element;
3937
4010
  this.gridLines = GridLines.None;
3938
4011
  this.contextMenuItems = [];
3939
4012
  this.sortingEnabled = false;
@@ -3961,6 +4034,9 @@ class BaseGridComponent {
3961
4034
  BaseGridComponent.decorators = [
3962
4035
  { type: Directive }
3963
4036
  ];
4037
+ BaseGridComponent.ctorParameters = () => [
4038
+ { type: ElementRef }
4039
+ ];
3964
4040
  BaseGridComponent.propDecorators = {
3965
4041
  grid: [{ type: ViewChild, args: ['grid', { static: false },] }],
3966
4042
  data: [{ type: Input }],
@@ -4083,6 +4159,10 @@ class BaseInlineEditGridComponent extends BaseToolbarGridComponent {
4083
4159
  constructor() {
4084
4160
  super(...arguments);
4085
4161
  this.rowSaved = new EventEmitter();
4162
+ this.beforeRowDelete = new EventEmitter(false);
4163
+ this.rowDeleted = new EventEmitter();
4164
+ this.actionBeginObservable$ = new Observable();
4165
+ this.actionBeginObservableSub = new Subscription();
4086
4166
  }
4087
4167
  set inlineEdit(value) {
4088
4168
  if (value) {
@@ -4097,20 +4177,59 @@ class BaseInlineEditGridComponent extends BaseToolbarGridComponent {
4097
4177
  this.updateToolbar("Update", value);
4098
4178
  this.updateToolbar("Cancel", value);
4099
4179
  }
4180
+ ngAfterViewInit() {
4181
+ if (this.grid) {
4182
+ this.actionBeginObservable$ = fromEvent$1(this.grid, 'actionBegin');
4183
+ this.actionBeginObservableSub = this.actionBeginObservable$.subscribe((action) => {
4184
+ this.handleActionBegin(action);
4185
+ });
4186
+ }
4187
+ }
4188
+ ngOnDestroy() {
4189
+ this.actionBeginObservableSub.unsubscribe();
4190
+ }
4191
+ handleActionBegin(action) {
4192
+ return __awaiter(this, void 0, void 0, function* () {
4193
+ if (action) {
4194
+ if (action.requestType === "delete") {
4195
+ yield this.waitForBeforeDelete(action);
4196
+ }
4197
+ if (action.requestType === "save") {
4198
+ this.rowSaved.next(action.data);
4199
+ }
4200
+ }
4201
+ });
4202
+ }
4100
4203
  handleActionComplete(action) {
4101
4204
  if (action) {
4205
+ if (action.requestType === "delete") {
4206
+ this.rowDeleted.next(action.data);
4207
+ }
4102
4208
  if (action.requestType === "save") {
4103
4209
  this.rowSaved.next(action.data);
4104
4210
  }
4105
4211
  }
4106
4212
  }
4213
+ waitForBeforeDelete(action) {
4214
+ // @ts-ignore
4215
+ const beforeRowDelete$ = fromEvent$1(this.element, 'beforeRowDelete');
4216
+ return new Promise((resolve) => {
4217
+ beforeRowDelete$.subscribe((result) => {
4218
+ action = result;
4219
+ return resolve(action);
4220
+ }).unsubscribe();
4221
+ this.beforeRowDelete.next(action);
4222
+ });
4223
+ }
4107
4224
  }
4108
4225
  BaseInlineEditGridComponent.decorators = [
4109
4226
  { type: Directive }
4110
4227
  ];
4111
4228
  BaseInlineEditGridComponent.propDecorators = {
4112
4229
  inlineEdit: [{ type: Input }],
4113
- rowSaved: [{ type: Output }]
4230
+ rowSaved: [{ type: Output }],
4231
+ beforeRowDelete: [{ type: Output }],
4232
+ rowDeleted: [{ type: Output }]
4114
4233
  };
4115
4234
  __decorate([
4116
4235
  InputBoolean()
@@ -4127,6 +4246,8 @@ class BaseSelectionGridComponent extends BaseInlineEditGridComponent {
4127
4246
  this.contextMenuItemClick = new EventEmitter();
4128
4247
  this.rowDragStartEvent = new EventEmitter();
4129
4248
  this.rowDropEvent = new EventEmitter();
4249
+ this.beforeRowsDelete = new EventEmitter();
4250
+ this.rowsDeleted = new EventEmitter();
4130
4251
  this.selectionOptions = { type: "Single" };
4131
4252
  }
4132
4253
  set multipleSelect(value) {
@@ -4173,6 +4294,12 @@ class BaseSelectionGridComponent extends BaseInlineEditGridComponent {
4173
4294
  rowDropClick(args) {
4174
4295
  this.rowDropEvent.next(args);
4175
4296
  }
4297
+ handleBeforeBatchDelete(args) {
4298
+ this.beforeRowsDelete.next(args);
4299
+ }
4300
+ handleBatchDelete(rows) {
4301
+ this.rowsDeleted.next(rows);
4302
+ }
4176
4303
  }
4177
4304
  BaseSelectionGridComponent.decorators = [
4178
4305
  { type: Directive }
@@ -4186,7 +4313,9 @@ BaseSelectionGridComponent.propDecorators = {
4186
4313
  detailColumnClick: [{ type: Output }],
4187
4314
  contextMenuItemClick: [{ type: Output }],
4188
4315
  rowDragStartEvent: [{ type: Output }],
4189
- rowDropEvent: [{ type: Output }]
4316
+ rowDropEvent: [{ type: Output }],
4317
+ beforeRowsDelete: [{ type: Output }],
4318
+ rowsDeleted: [{ type: Output }]
4190
4319
  };
4191
4320
  __decorate([
4192
4321
  InputBoolean()
@@ -4207,37 +4336,41 @@ CoGridComponent.decorators = [
4207
4336
  { type: Component, args: [{
4208
4337
  selector: 'co-grid',
4209
4338
  template: `
4210
- <ejs-grid #grid id="grid"
4211
- [dataSource]="data"
4212
- [columns]="columns"
4213
- [contextMenuItems]="contextMenuItems"
4214
- [pageSettings]="pageSettings"
4215
- [toolbar]="toolbarOptions"
4216
- [gridLines]="gridLines"
4217
- [frozenColumns]="frozenColumns"
4218
- [frozenRows]="frozenRows"
4219
- [selectionSettings]="selectionOptions"
4220
- [editSettings]="editSettings"
4221
- [allowPaging]="pagingEnabled"
4222
- [allowSorting]="sortingEnabled"
4223
- [allowFiltering]="filteringEnabled"
4224
- [allowGrouping]="groupingEnabled"
4225
- [allowReordering]="reorderingEnabled"
4226
- [allowResizing]="resizingEnabled"
4227
- [allowRowDragAndDrop]="rowDragAndDropEnabled"
4228
- [showColumnMenu]="showColumnMenu"
4229
- [showColumnChooser]="showColumnChooser"
4230
- [allowExcelExport]="exportExcelEnabled"
4231
- [allowPdfExport]="exportPdfEnabled"
4232
- (toolbarClick)="toolbarClick($event)"
4233
- (rowSelected)="handleRowSelected($event)"
4234
- (recordDoubleClick)="handleDoubleClick($event)"
4235
- (recordClick)="handleRecordClick($event)"
4236
- (actionComplete)="handleActionComplete($event)"
4237
- (contextMenuClick)="contextMenuClick($event)"
4238
- (rowDragStart)="rowDragStartClick($event)"
4239
- (rowDrop)="rowDropClick($event)">
4240
- </ejs-grid>
4339
+ <co-grid-toolbar></co-grid-toolbar>
4340
+ <ejs-grid #grid id="grid"
4341
+ [dataSource]="data"
4342
+ [columns]="columns"
4343
+ [contextMenuItems]="contextMenuItems"
4344
+ [pageSettings]="pageSettings"
4345
+ [toolbar]="toolbarOptions"
4346
+ [gridLines]="gridLines"
4347
+ [frozenColumns]="frozenColumns"
4348
+ [frozenRows]="frozenRows"
4349
+ [selectionSettings]="selectionOptions"
4350
+ [editSettings]="editSettings"
4351
+ [allowPaging]="pagingEnabled"
4352
+ [allowSorting]="sortingEnabled"
4353
+ [allowFiltering]="filteringEnabled"
4354
+ [allowGrouping]="groupingEnabled"
4355
+ [allowReordering]="reorderingEnabled"
4356
+ [allowResizing]="resizingEnabled"
4357
+ [allowRowDragAndDrop]="rowDragAndDropEnabled"
4358
+ [showColumnMenu]="showColumnMenu"
4359
+ [showColumnChooser]="showColumnChooser"
4360
+ [allowExcelExport]="exportExcelEnabled"
4361
+ [allowPdfExport]="exportPdfEnabled"
4362
+ (toolbarClick)="toolbarClick($event)"
4363
+ (rowSelected)="handleRowSelected($event)"
4364
+ (recordDoubleClick)="handleDoubleClick($event)"
4365
+ (recordClick)="handleRecordClick($event)"
4366
+ (actionComplete)="handleActionComplete($event)"
4367
+ (contextMenuClick)="contextMenuClick($event)"
4368
+ (rowDragStart)="rowDragStartClick($event)"
4369
+ (rowDrop)="rowDropClick($event)"
4370
+ (beforeBatchDelete)="handleBeforeBatchDelete($event)"
4371
+ (batchDelete)="handleBatchDelete($event)"
4372
+ >
4373
+ </ejs-grid>
4241
4374
  `,
4242
4375
  providers: [
4243
4376
  RowDDService
@@ -4249,6 +4382,62 @@ CoGridComponent.propDecorators = {
4249
4382
  showClass: [{ type: HostBinding, args: ['class.co-grid',] }]
4250
4383
  };
4251
4384
 
4385
+ class GridToolbarComponent {
4386
+ constructor(iconsService) {
4387
+ this.iconsService = iconsService;
4388
+ this.icons = CoreComponentsIcon;
4389
+ this.editClick = new EventEmitter();
4390
+ this.cancelClick = new EventEmitter();
4391
+ this.saveClick = new EventEmitter();
4392
+ this.addClick = new EventEmitter();
4393
+ }
4394
+ showClass() {
4395
+ return true;
4396
+ }
4397
+ }
4398
+ GridToolbarComponent.decorators = [
4399
+ { type: Component, args: [{
4400
+ selector: "co-grid-toolbar",
4401
+ template: `
4402
+ <div class="grid-toolbar-wrapper">
4403
+ <co-button [iconData]="iconsService.getIcon(icons.AddToCartDrop)" [label]="'edit'" (click)="editClick.emit($event)"></co-button>
4404
+ <co-button [iconData]="iconsService.getIcon(icons.AddToCartDrop)" [label]="'cancel'" (click)="cancelClick.emit()"></co-button>
4405
+ <co-button [iconData]="iconsService.getIcon(icons.AddToCartDrop)" [label]="'save'" (click)="saveClick.emit()"></co-button>
4406
+ <co-button [iconData]="iconsService.getIcon(icons.AddToCartDrop)" [label]="'add'" (click)="addClick.emit()"></co-button>
4407
+ </div>
4408
+ `,
4409
+ encapsulation: ViewEncapsulation.None
4410
+ },] }
4411
+ ];
4412
+ GridToolbarComponent.ctorParameters = () => [
4413
+ { type: IconCacheService }
4414
+ ];
4415
+ GridToolbarComponent.propDecorators = {
4416
+ editClick: [{ type: Output }],
4417
+ cancelClick: [{ type: Output }],
4418
+ saveClick: [{ type: Output }],
4419
+ addClick: [{ type: Output }],
4420
+ showClass: [{ type: HostBinding, args: ["class.co-grid-toolbar",] }]
4421
+ };
4422
+
4423
+ enableRipple(true);
4424
+ class GridToolbarModule {
4425
+ }
4426
+ GridToolbarModule.decorators = [
4427
+ { type: NgModule, args: [{
4428
+ imports: [
4429
+ IconModule,
4430
+ ButtonModule
4431
+ ],
4432
+ declarations: [
4433
+ GridToolbarComponent
4434
+ ],
4435
+ exports: [
4436
+ GridToolbarComponent
4437
+ ]
4438
+ },] }
4439
+ ];
4440
+
4252
4441
  class CoGridModule {
4253
4442
  }
4254
4443
  CoGridModule.decorators = [
@@ -4256,7 +4445,8 @@ CoGridModule.decorators = [
4256
4445
  imports: [
4257
4446
  CommonModule,
4258
4447
  FormsModule,
4259
- GridModule
4448
+ GridModule,
4449
+ GridToolbarModule
4260
4450
  ],
4261
4451
  declarations: [CoGridComponent],
4262
4452
  exports: [CoGridComponent],
@@ -4318,6 +4508,9 @@ InputCheckboxComponent.decorators = [
4318
4508
  providers: [{
4319
4509
  provide: COMPONENT_INTERFACE_NAME,
4320
4510
  useExisting: forwardRef(() => InputCheckboxComponent)
4511
+ }, {
4512
+ provide: BaseInputComponent,
4513
+ useExisting: InputCheckboxComponent
4321
4514
  }],
4322
4515
  changeDetection: ChangeDetectionStrategy.OnPush,
4323
4516
  encapsulation: ViewEncapsulation.None
@@ -4417,6 +4610,9 @@ InputCheckboxMultiSelectComponent.decorators = [
4417
4610
  providers: [{
4418
4611
  provide: COMPONENT_INTERFACE_NAME,
4419
4612
  useExisting: forwardRef(() => InputCheckboxMultiSelectComponent)
4613
+ }, {
4614
+ provide: BaseInputComponent,
4615
+ useExisting: InputCheckboxMultiSelectComponent
4420
4616
  }],
4421
4617
  changeDetection: ChangeDetectionStrategy.OnPush,
4422
4618
  encapsulation: ViewEncapsulation.None
@@ -4466,7 +4662,6 @@ class InputComboBoxComponent extends BaseInputComponent {
4466
4662
  this.ngZoneWrapper = ngZoneWrapper;
4467
4663
  this.elementRef = elementRef;
4468
4664
  this.shopPopup = true;
4469
- this.customHeight = true;
4470
4665
  super._markAsOnPush();
4471
4666
  }
4472
4667
  showClass() {
@@ -4499,6 +4694,9 @@ InputComboBoxComponent.decorators = [
4499
4694
  providers: [{
4500
4695
  provide: COMPONENT_INTERFACE_NAME,
4501
4696
  useExisting: forwardRef(() => InputComboBoxComponent)
4697
+ }, {
4698
+ provide: BaseInputComponent,
4699
+ useExisting: InputComboBoxComponent
4502
4700
  }],
4503
4701
  encapsulation: ViewEncapsulation.None
4504
4702
  },] }
@@ -4518,8 +4716,7 @@ InputComboBoxComponent.propDecorators = {
4518
4716
  selected: [{ type: Input }],
4519
4717
  placeholder: [{ type: Input }],
4520
4718
  shopPopup: [{ type: Input }],
4521
- showClass: [{ type: HostBinding, args: ["class.co-input-combo-box",] }],
4522
- customHeight: [{ type: HostBinding, args: ["class.custom-height",] }]
4719
+ showClass: [{ type: HostBinding, args: ["class.co-input-combo-box",] }]
4523
4720
  };
4524
4721
 
4525
4722
  class InputComboBoxModule {
@@ -4605,6 +4802,9 @@ InputDatePickerComponent.decorators = [
4605
4802
  `,
4606
4803
  providers: [{
4607
4804
  provide: COMPONENT_INTERFACE_NAME, useExisting: forwardRef(() => InputDatePickerComponent)
4805
+ }, {
4806
+ provide: BaseInputComponent,
4807
+ useExisting: InputDatePickerComponent
4608
4808
  }],
4609
4809
  encapsulation: ViewEncapsulation.None
4610
4810
  },] }
@@ -4979,6 +5179,9 @@ InputTextComponent.decorators = [
4979
5179
  providers: [{
4980
5180
  provide: COMPONENT_INTERFACE_NAME,
4981
5181
  useExisting: forwardRef(() => InputTextComponent)
5182
+ }, {
5183
+ provide: BaseInputComponent,
5184
+ useExisting: InputTextComponent
4982
5185
  }],
4983
5186
  animations: [
4984
5187
  trigger('showHideSaveCancel', [
@@ -5252,6 +5455,9 @@ InputNumberPickerComponent.decorators = [
5252
5455
  `,
5253
5456
  providers: [{
5254
5457
  provide: COMPONENT_INTERFACE_NAME, useExisting: forwardRef(() => InputNumberPickerComponent)
5458
+ }, {
5459
+ provide: BaseInputComponent,
5460
+ useExisting: InputNumberPickerComponent
5255
5461
  }],
5256
5462
  changeDetection: ChangeDetectionStrategy.OnPush,
5257
5463
  encapsulation: ViewEncapsulation.None
@@ -5374,6 +5580,9 @@ InputRadioButtonComponent.decorators = [
5374
5580
  `,
5375
5581
  providers: [{
5376
5582
  provide: COMPONENT_INTERFACE_NAME, useExisting: forwardRef(() => InputRadioButtonComponent)
5583
+ }, {
5584
+ provide: BaseInputComponent,
5585
+ useExisting: InputRadioButtonComponent
5377
5586
  }],
5378
5587
  changeDetection: ChangeDetectionStrategy.OnPush,
5379
5588
  encapsulation: ViewEncapsulation.None
@@ -5448,6 +5657,9 @@ InputTextareaComponent.decorators = [
5448
5657
  providers: [{
5449
5658
  provide: COMPONENT_INTERFACE_NAME,
5450
5659
  useExisting: forwardRef(() => InputTextareaComponent)
5660
+ }, {
5661
+ provide: BaseInputComponent,
5662
+ useExisting: InputTextareaComponent
5451
5663
  }],
5452
5664
  encapsulation: ViewEncapsulation.None
5453
5665
  },] }
@@ -5549,6 +5761,9 @@ MultiSelectListComponent.decorators = [
5549
5761
  {
5550
5762
  provide: COMPONENT_INTERFACE_NAME,
5551
5763
  useExisting: forwardRef(() => MultiSelectListComponent)
5764
+ }, {
5765
+ provide: BaseInputComponent,
5766
+ useExisting: MultiSelectListComponent
5552
5767
  }
5553
5768
  ],
5554
5769
  encapsulation: ViewEncapsulation.None
@@ -7057,6 +7272,9 @@ InputListboxComponent.decorators = [
7057
7272
  `,
7058
7273
  providers: [{
7059
7274
  provide: COMPONENT_INTERFACE_NAME, useExisting: forwardRef(() => InputListboxComponent)
7275
+ }, {
7276
+ provide: BaseInputComponent,
7277
+ useExisting: InputListboxComponent
7060
7278
  }],
7061
7279
  encapsulation: ViewEncapsulation.None
7062
7280
  },] }
@@ -7109,6 +7327,8 @@ var ColumnAlign;
7109
7327
  class SimpleGridColumnDirective {
7110
7328
  constructor() {
7111
7329
  this.resizable = true;
7330
+ this.required = false;
7331
+ this.readonly = false;
7112
7332
  }
7113
7333
  set template(template) {
7114
7334
  if (template) {
@@ -7118,6 +7338,23 @@ class SimpleGridColumnDirective {
7118
7338
  get template() {
7119
7339
  return this._template;
7120
7340
  }
7341
+ set editTemplate(template) {
7342
+ if (template) {
7343
+ this._editTemplate = template;
7344
+ }
7345
+ }
7346
+ get editTemplate() {
7347
+ return this._editTemplate;
7348
+ }
7349
+ getFieldValue(value) {
7350
+ if (this.collection && this.displayField) {
7351
+ const result = this.collection.find(c => c[this.codeField] === value);
7352
+ if (result) {
7353
+ return result[this.displayField];
7354
+ }
7355
+ }
7356
+ return value;
7357
+ }
7121
7358
  }
7122
7359
  SimpleGridColumnDirective._MinManualResizeWidthPx = 50;
7123
7360
  SimpleGridColumnDirective.decorators = [
@@ -7126,34 +7363,41 @@ SimpleGridColumnDirective.decorators = [
7126
7363
  },] }
7127
7364
  ];
7128
7365
  SimpleGridColumnDirective.propDecorators = {
7129
- template: [{ type: ContentChild, args: [TemplateRef,] }],
7366
+ template: [{ type: ContentChild, args: ['template',] }],
7367
+ editTemplate: [{ type: ContentChild, args: ['editTemplate',] }],
7130
7368
  headerText: [{ type: Input }],
7131
7369
  field: [{ type: Input }],
7370
+ codeField: [{ type: Input }],
7371
+ displayField: [{ type: Input }],
7132
7372
  textAlign: [{ type: Input }],
7133
7373
  format: [{ type: Input }],
7134
7374
  resizable: [{ type: Input }],
7135
- width: [{ type: Input }]
7375
+ required: [{ type: Input }],
7376
+ width: [{ type: Input }],
7377
+ readonly: [{ type: Input }],
7378
+ collection: [{ type: Input }]
7136
7379
  };
7137
7380
 
7138
- class SimpleGridComponent {
7381
+ class BaseSimpleGridComponent {
7139
7382
  constructor() {
7140
- this.defaultTextAlign = ColumnAlign.Left;
7141
7383
  this.data = [];
7142
7384
  this.dragDropEnabled = false;
7385
+ this.inlineEdit = false;
7386
+ this.showToolbar = false;
7143
7387
  /**
7144
7388
  * Should component emit drag and drop actions instead of handle
7145
7389
  * (update collection) by itself
7146
7390
  */
7147
7391
  this.emitDragDrop = false;
7148
7392
  this.onDrop = new EventEmitter();
7393
+ this.selectRow = new EventEmitter();
7394
+ this.dblClickRow = new EventEmitter();
7395
+ this.saveRow = new EventEmitter();
7149
7396
  this.columns = [];
7150
7397
  }
7151
7398
  set content(columnComponents) {
7152
7399
  this.columns = columnComponents.toArray();
7153
7400
  }
7154
- showClass() {
7155
- return true;
7156
- }
7157
7401
  handleMouseMove(event) {
7158
7402
  if (event.buttons === 1 && this._columnForResize) {
7159
7403
  if (!this._columnForResize.width) {
@@ -7191,10 +7435,271 @@ class SimpleGridComponent {
7191
7435
  }
7192
7436
  }
7193
7437
  }
7438
+ BaseSimpleGridComponent.decorators = [
7439
+ { type: Directive }
7440
+ ];
7441
+ BaseSimpleGridComponent.propDecorators = {
7442
+ content: [{ type: ContentChildren, args: [SimpleGridColumnDirective,] }],
7443
+ data: [{ type: Input }],
7444
+ dragDropEnabled: [{ type: Input }],
7445
+ inlineEdit: [{ type: Input }],
7446
+ showToolbar: [{ type: Input }],
7447
+ emitDragDrop: [{ type: Input }],
7448
+ onDrop: [{ type: Output }],
7449
+ selectRow: [{ type: Output }],
7450
+ dblClickRow: [{ type: Output }],
7451
+ saveRow: [{ type: Output }],
7452
+ handleMouseMove: [{ type: HostListener, args: ['document:mousemove', ['$event'],] }],
7453
+ handleMouseUp: [{ type: HostListener, args: ['document:mouseup', ['$event'],] }]
7454
+ };
7455
+
7456
+ class SimpleGridComponent extends BaseSimpleGridComponent {
7457
+ constructor(_changeDetection, _formMaster) {
7458
+ super();
7459
+ this._changeDetection = _changeDetection;
7460
+ this._formMaster = _formMaster;
7461
+ this.defaultTextAlign = ColumnAlign.Left;
7462
+ this.editting = false;
7463
+ this.editRowIndex = -1;
7464
+ this.editCellIndex = -1;
7465
+ this.selectedRowIndex = -1;
7466
+ this._doubleClicked = false;
7467
+ this._newRow = false;
7468
+ }
7469
+ showClass() {
7470
+ return true;
7471
+ }
7472
+ handleKeyDown(event) {
7473
+ if (!this.inlineEdit) {
7474
+ return;
7475
+ }
7476
+ if (event.code === 'Tab') {
7477
+ event.preventDefault();
7478
+ this._nextAvailableCellToEdit(!event.shiftKey, this.editCellIndex)
7479
+ .then((index) => {
7480
+ this.editCellIndex = index;
7481
+ });
7482
+ this._detectChanges();
7483
+ }
7484
+ if (event.code === 'Escape') {
7485
+ this.cancelEditRow();
7486
+ }
7487
+ if (event.code === 'Enter') {
7488
+ this.validateAndSave();
7489
+ }
7490
+ }
7491
+ addRow() {
7492
+ const valid = this.validateAndSave();
7493
+ this._detectChanges();
7494
+ if (valid) {
7495
+ this.data.unshift({});
7496
+ this._newRow = true;
7497
+ this.editRowIndex = 0;
7498
+ this._nextAvailableCellToEdit(true).then((index) => {
7499
+ this.editCellIndex = index;
7500
+ });
7501
+ this.editting = true;
7502
+ this.rowToEdit = this.data[0];
7503
+ this._detectChanges();
7504
+ }
7505
+ }
7506
+ validateAndSave(stopEditting = true) {
7507
+ if (!this.editting) {
7508
+ return true;
7509
+ }
7510
+ const valid = this._formMaster.submitSlaves();
7511
+ this._detectChanges();
7512
+ if (valid) {
7513
+ this._saveRow(stopEditting);
7514
+ return true;
7515
+ }
7516
+ }
7517
+ cancelEditRow() {
7518
+ if (!this.editting) {
7519
+ return;
7520
+ }
7521
+ if (this._newRow) {
7522
+ this.data.shift();
7523
+ }
7524
+ else {
7525
+ this.data[this.editRowIndex] = this.rowToEdit;
7526
+ }
7527
+ this._newRow = false;
7528
+ this.editting = false;
7529
+ this._detectChanges();
7530
+ }
7531
+ handleClickRow(event, index) {
7532
+ setTimeout(() => {
7533
+ if (this._doubleClicked) {
7534
+ return;
7535
+ }
7536
+ this.selectTheRow(index);
7537
+ }, 200);
7538
+ }
7539
+ selectTheRow(index, emit = true) {
7540
+ if (this.selectedRowIndex !== index && ((this.editting && this.validateAndSave()) || !this.editting)) {
7541
+ this.selectedRowIndex = index;
7542
+ if (emit) {
7543
+ this.selectRow.next(this.data[this.selectedRowIndex]);
7544
+ }
7545
+ }
7546
+ this._detectChanges();
7547
+ }
7548
+ handleDblClickRow(event, index) {
7549
+ this._doubleClicked = true;
7550
+ this.dblClickRow.next(this.data[index]);
7551
+ this.selectTheRow(index, false);
7552
+ if (this.inlineEdit) {
7553
+ this.editRow(event);
7554
+ }
7555
+ this._resetDblClick();
7556
+ }
7557
+ editRow(event) {
7558
+ this.editRowIndex = this.selectedRowIndex;
7559
+ this.rowToEdit = this.data[this.editRowIndex];
7560
+ this.editting = true;
7561
+ this._nextAvailableCellToEdit(true).then((index) => {
7562
+ this.editCellIndex = index;
7563
+ });
7564
+ this._detectChanges();
7565
+ }
7566
+ handleCellClick(index) {
7567
+ this.editCellIndex = index;
7568
+ this._detectChanges();
7569
+ }
7570
+ _resetDblClick() {
7571
+ setTimeout(() => {
7572
+ this._doubleClicked = false;
7573
+ }, 500);
7574
+ }
7575
+ /**
7576
+ *
7577
+ * @param next; Move to next or previous cell
7578
+ * @param start; Start from cellindex
7579
+ * @private
7580
+ */
7581
+ _nextAvailableCellToEdit(next, start = -1) {
7582
+ return new Promise((resolve, reject) => {
7583
+ const numEditableColumns = this.columns.filter(c => !c.readonly).length;
7584
+ const wantedIndex = start + (next ? 1 : -1);
7585
+ if (wantedIndex >= numEditableColumns) {
7586
+ this._getNextEditRowIndex()
7587
+ .then((index) => {
7588
+ this.editRowIndex = index;
7589
+ resolve(this._getNextEditCellIndex(0));
7590
+ })
7591
+ .catch((e) => {
7592
+ reject();
7593
+ });
7594
+ }
7595
+ else if (wantedIndex < 0) {
7596
+ this._getPreviousEditRowIndex()
7597
+ .then((index) => {
7598
+ this.editRowIndex = index;
7599
+ resolve(this._getPreviousEditCellIndex(this.columns.length - 1));
7600
+ })
7601
+ .catch((e) => {
7602
+ reject();
7603
+ });
7604
+ }
7605
+ else {
7606
+ resolve(next ? this._getNextEditCellIndex(start + 1) : this._getPreviousEditCellIndex(start - 1));
7607
+ }
7608
+ });
7609
+ }
7610
+ _getNextEditCellIndex(start) {
7611
+ for (let i = start; i < this.columns.length; i++) {
7612
+ if (!this.columns[i].readonly) {
7613
+ return i;
7614
+ }
7615
+ }
7616
+ }
7617
+ _getPreviousEditCellIndex(start) {
7618
+ for (let i = start; i >= 0; i--) {
7619
+ if (!this.columns[i].readonly) {
7620
+ return i;
7621
+ }
7622
+ }
7623
+ }
7624
+ _getNextEditRowIndex() {
7625
+ return new Promise((resolve, reject) => {
7626
+ let newRowIndex = 0;
7627
+ if (this.editRowIndex + 1 >= this.data.length) {
7628
+ newRowIndex = 0;
7629
+ }
7630
+ else {
7631
+ newRowIndex = this.editRowIndex + 1;
7632
+ }
7633
+ if (newRowIndex !== this.editRowIndex) { // go to different row validate current one first
7634
+ if (this.validateAndSave(false)) {
7635
+ this.rowToEdit = this.data[newRowIndex];
7636
+ resolve(newRowIndex);
7637
+ }
7638
+ else {
7639
+ reject();
7640
+ }
7641
+ }
7642
+ else {
7643
+ resolve(newRowIndex);
7644
+ }
7645
+ });
7646
+ }
7647
+ _getPreviousEditRowIndex() {
7648
+ return new Promise((resolve, reject) => {
7649
+ let newRowIndex = 0;
7650
+ if (this.editRowIndex - 1 < 0) {
7651
+ newRowIndex = this.data.length - 1;
7652
+ }
7653
+ else {
7654
+ newRowIndex = this.editRowIndex - 1;
7655
+ }
7656
+ if (newRowIndex !== this.editRowIndex) { // go to different row validate current one first
7657
+ if (this.validateAndSave(false)) {
7658
+ this.rowToEdit = this.data[newRowIndex];
7659
+ resolve(newRowIndex);
7660
+ }
7661
+ else {
7662
+ reject();
7663
+ }
7664
+ }
7665
+ else {
7666
+ resolve(newRowIndex);
7667
+ }
7668
+ });
7669
+ }
7670
+ _saveRow(stopEditting = true) {
7671
+ // emit saveEvent
7672
+ if (this.rowToEdit) {
7673
+ this.saveRow.next(this.rowToEdit);
7674
+ }
7675
+ this._newRow = false;
7676
+ if (stopEditting) {
7677
+ this.editRowIndex = -1;
7678
+ this.editCellIndex = -1;
7679
+ this.editting = false;
7680
+ this.rowToEdit = undefined;
7681
+ }
7682
+ this._detectChanges();
7683
+ }
7684
+ _detectChanges() {
7685
+ // setTimeout(() => {
7686
+ // this._changeDetection.markForCheck();
7687
+ // this._changeDetection.reattach();
7688
+ this._changeDetection.detectChanges();
7689
+ // this._changeDetection.detach();
7690
+ // });
7691
+ }
7692
+ }
7194
7693
  SimpleGridComponent.decorators = [
7195
7694
  { type: Component, args: [{
7196
7695
  selector: "co-simple-grid",
7197
7696
  template: `
7697
+ <co-grid-toolbar *ngIf="inlineEdit && showToolbar"
7698
+ (addClick)="addRow()"
7699
+ (editClick)="editRow($event)"
7700
+ (saveClick)="validateAndSave()"
7701
+ (cancelClick)="cancelEditRow()"
7702
+ ></co-grid-toolbar>
7198
7703
  <div class="simple-grid-column-header-wrapper">
7199
7704
  <div class="simple-grid-column-header" *ngFor="let column of columns; let index = index"
7200
7705
  [style.min-width.px]="column.width" [style.max-width.px]="column.width">
@@ -7214,34 +7719,198 @@ SimpleGridComponent.decorators = [
7214
7719
  [cdkDropListEnterPredicate]="handleCanDragDrop"
7215
7720
  (cdkDropListDropped)="handleDrop($event)"
7216
7721
  >
7217
- <div class="simple-grid-row" *ngFor="let row of data" cdkDrag>
7218
- <div class="simple-grid-column-cell" *ngFor="let column of columns"
7219
- [style.min-width.px]="column.width" [style.max-width.px]="column.width">
7220
- <div class="simple-grid-column-cell-value" [ngClass]="column.textAlign ? column.textAlign : defaultTextAlign">
7221
- <ng-container *ngIf="column.template">
7222
- <ng-container [ngTemplateOutlet]="column.template" [ngTemplateOutletContext]="{value: row[column.field], row: row}"></ng-container>
7223
- </ng-container>
7224
- <div *ngIf="!column.template" [textContent]="row[column.field]"></div>
7722
+ <div class="simple-grid-row" [class.selected]="rowIndex === selectedRowIndex" [class.editting]="rowIndex === editRowIndex" *ngFor="let row of data; let rowIndex = index" cdkDrag
7723
+ (click)="handleClickRow($event, rowIndex)" (dblclick)="handleDblClickRow($event, rowIndex)">
7724
+ <co-form class="simple-grid-row-form">
7725
+ <div class="simple-grid-column-cell" *ngFor="let column of columns; let columnIndex = index"
7726
+ [style.min-width.px]="column.width" [style.max-width.px]="column.width">
7727
+ <co-simple-grid-cell
7728
+ [column]="column"
7729
+ [row]="row"
7730
+ [editMode]="inlineEdit && editting && rowIndex === editRowIndex"
7731
+ [fieldEditMode]="editCellIndex === columnIndex"
7732
+ (cellClick)="handleCellClick(columnIndex)"
7733
+ ></co-simple-grid-cell>
7734
+ <div *ngIf="column.resizable" class="simple-grid-column-sizer-placeholder"></div>
7225
7735
  </div>
7226
- <div *ngIf="column.resizable" class="simple-grid-column-sizer-placeholder"></div>
7227
- </div>
7736
+ </co-form>
7228
7737
  </div>
7229
7738
  </div>
7230
7739
  </div>
7231
7740
  `,
7232
- changeDetection: ChangeDetectionStrategy.OnPush,
7741
+ providers: [
7742
+ FormMasterService
7743
+ ],
7744
+ // changeDetection: ChangeDetectionStrategy.OnPush,
7233
7745
  encapsulation: ViewEncapsulation.None
7234
7746
  },] }
7235
7747
  ];
7748
+ SimpleGridComponent.ctorParameters = () => [
7749
+ { type: ChangeDetectorRef },
7750
+ { type: FormMasterService }
7751
+ ];
7236
7752
  SimpleGridComponent.propDecorators = {
7237
- content: [{ type: ContentChildren, args: [SimpleGridColumnDirective,] }],
7238
- data: [{ type: Input }],
7239
- dragDropEnabled: [{ type: Input }],
7240
- emitDragDrop: [{ type: Input }],
7241
- onDrop: [{ type: Output }],
7242
7753
  showClass: [{ type: HostBinding, args: ["class.co-simple-grid",] }],
7243
- handleMouseMove: [{ type: HostListener, args: ['document:mousemove', ['$event'],] }],
7244
- handleMouseUp: [{ type: HostListener, args: ['document:mouseup', ['$event'],] }]
7754
+ handleKeyDown: [{ type: HostListener, args: ['keydown', ['$event'],] }]
7755
+ };
7756
+
7757
+ class SimpleGridCellComponent {
7758
+ constructor(_changeDetector) {
7759
+ this._changeDetector = _changeDetector;
7760
+ this.defaultTextAlign = ColumnAlign.Left;
7761
+ this.editMode = false;
7762
+ this.cellClick = new EventEmitter();
7763
+ this._fieldEditMode = false;
7764
+ this._focused = false;
7765
+ }
7766
+ set editTemplateContent(template) {
7767
+ if (template) {
7768
+ this._editTemplate = template;
7769
+ this._setFocusComponent();
7770
+ }
7771
+ }
7772
+ set noEditTemplateContent(template) {
7773
+ if (template) {
7774
+ this._template = template;
7775
+ this._setFocusComponent();
7776
+ }
7777
+ }
7778
+ set noTemplateContent(template) {
7779
+ if (template) {
7780
+ this._inputTemplate = template;
7781
+ this._setFocusComponent();
7782
+ }
7783
+ }
7784
+ set fieldEditMode(value) {
7785
+ this._fieldEditMode = value;
7786
+ this._setFocusComponent();
7787
+ }
7788
+ get fieldEditMode() {
7789
+ return this._fieldEditMode;
7790
+ }
7791
+ showClass() {
7792
+ return true;
7793
+ }
7794
+ handleClick(event) {
7795
+ if (this.column && !this.column.readonly) {
7796
+ this.cellClick.next();
7797
+ }
7798
+ }
7799
+ _setFocusComponent() {
7800
+ if (this.editMode && this.fieldEditMode) {
7801
+ const element = this._getElement();
7802
+ if (element) {
7803
+ const focusEvent = this._createNewEvent(element, 'focus');
7804
+ element.focus();
7805
+ element.dispatchEvent(focusEvent);
7806
+ this._focused = true;
7807
+ }
7808
+ }
7809
+ else {
7810
+ if (this._focused) {
7811
+ const element = this._getElement();
7812
+ if (element) {
7813
+ const blurEvent = this._createNewEvent(element, 'blur');
7814
+ element.blur();
7815
+ element.dispatchEvent(blurEvent);
7816
+ }
7817
+ this._focused = false;
7818
+ }
7819
+ }
7820
+ this._detectChanges();
7821
+ }
7822
+ _getFirstFormInput(parent) {
7823
+ if (parent) {
7824
+ const collection = Array.from(parent.getElementsByTagName('input'));
7825
+ const otherCollection = Array.from(parent.getElementsByTagName('textarea'));
7826
+ otherCollection.map(o => collection.push(o));
7827
+ if (collection.length > 0) {
7828
+ return collection[0];
7829
+ }
7830
+ }
7831
+ }
7832
+ _createNewEvent(element, eventType) {
7833
+ let event;
7834
+ if ("createEvent" in document) {
7835
+ event = document.createEvent("Event");
7836
+ event.initEvent(eventType, true, true);
7837
+ }
7838
+ else if ("Event" in window) {
7839
+ event = new Event(eventType, { bubbles: true, cancelable: true });
7840
+ }
7841
+ return event;
7842
+ }
7843
+ _getElement() {
7844
+ let templ;
7845
+ if (this._editTemplate) {
7846
+ templ = this._editTemplate;
7847
+ }
7848
+ else if (this._template) {
7849
+ templ = this._template;
7850
+ }
7851
+ else {
7852
+ templ = this._inputTemplate;
7853
+ }
7854
+ if (templ) {
7855
+ if (templ && templ.elementRef) {
7856
+ const inputElement = this._getFirstFormInput(templ.elementRef.nativeElement.parentElement);
7857
+ if (inputElement) {
7858
+ return inputElement;
7859
+ }
7860
+ }
7861
+ }
7862
+ }
7863
+ _detectChanges() {
7864
+ // setTimeout(() => {
7865
+ this._changeDetector.markForCheck();
7866
+ // this._changeDetector.detectChanges();
7867
+ // });
7868
+ }
7869
+ }
7870
+ SimpleGridCellComponent.decorators = [
7871
+ { type: Component, args: [{
7872
+ selector: "co-simple-grid-cell",
7873
+ template: `
7874
+ <div class="simple-grid-column-cell-value" [ngClass]="column.textAlign ? column.textAlign : defaultTextAlign">
7875
+ <ng-container *ngIf="editMode; else noInlineEdit">
7876
+ <ng-container #editTemplate *ngIf="column.editTemplate; else noEditTemplate" [ngTemplateOutlet]="column.editTemplate" [ngTemplateOutletContext]="{value: row[column.field], row: row}"></ng-container>
7877
+ <ng-template #noEditTemplate>
7878
+ <ng-container *ngIf="column.template; else noTemplate">
7879
+ <ng-container [ngTemplateOutlet]="column.template" [ngTemplateOutletContext]="{value: row[column.field], row: row}"></ng-container>
7880
+ </ng-container>
7881
+ <ng-template #noTemplate>
7882
+ <co-input-text [(model)]="row[column.field]" [required]="column.required"></co-input-text>
7883
+ </ng-template>
7884
+ </ng-template>
7885
+ </ng-container>
7886
+ <ng-template #noInlineEdit>
7887
+ <ng-container *ngIf="column.template; else noTemplate">
7888
+ <ng-container [ngTemplateOutlet]="column.template" [ngTemplateOutletContext]="{value: row[column.field], row: row}"></ng-container>
7889
+ </ng-container>
7890
+ <ng-template #noTemplate>
7891
+ <div [textContent]="column.getFieldValue(row[column.field])"></div>
7892
+ </ng-template>
7893
+ </ng-template>
7894
+ </div>
7895
+ `,
7896
+ encapsulation: ViewEncapsulation.None //,
7897
+ // changeDetection: ChangeDetectionStrategy.OnPush
7898
+ },] }
7899
+ ];
7900
+ SimpleGridCellComponent.ctorParameters = () => [
7901
+ { type: ChangeDetectorRef }
7902
+ ];
7903
+ SimpleGridCellComponent.propDecorators = {
7904
+ editTemplateContent: [{ type: ViewChild, args: ["editTemplate", { read: BaseInputComponent },] }],
7905
+ noEditTemplateContent: [{ type: ViewChild, args: ["noEditTemplate",] }],
7906
+ noTemplateContent: [{ type: ViewChild, args: ["noTemplate",] }],
7907
+ column: [{ type: Input }],
7908
+ row: [{ type: Input }],
7909
+ editMode: [{ type: Input }],
7910
+ fieldEditMode: [{ type: Input }],
7911
+ cellClick: [{ type: Output }],
7912
+ showClass: [{ type: HostBinding, args: ["class.co-simple-grid-cell",] }],
7913
+ handleClick: [{ type: HostListener, args: ['click', ['$event'],] }]
7245
7914
  };
7246
7915
 
7247
7916
  class SimpleGridModule {
@@ -7250,14 +7919,19 @@ SimpleGridModule.decorators = [
7250
7919
  { type: NgModule, args: [{
7251
7920
  imports: [
7252
7921
  CommonModule,
7253
- DragDropModule
7922
+ DragDropModule,
7923
+ GridToolbarModule,
7924
+ InputTextModule,
7925
+ FormModule
7254
7926
  ],
7255
7927
  declarations: [
7256
7928
  SimpleGridComponent,
7929
+ SimpleGridCellComponent,
7257
7930
  SimpleGridColumnDirective
7258
7931
  ],
7259
7932
  exports: [
7260
7933
  SimpleGridComponent,
7934
+ SimpleGridCellComponent,
7261
7935
  SimpleGridColumnDirective
7262
7936
  ]
7263
7937
  },] }
@@ -7511,11 +8185,7 @@ class Carousel3dComponent {
7511
8185
  boundingBox.getSize(size);
7512
8186
  // get the max side of the bounding box (fits to width OR height as needed )
7513
8187
  const maxDim = Math.max(size.x, size.y, size.z);
7514
- const fov = this._camera.fov * (Math.PI / 180);
7515
- // let cameraZ = Math.abs(maxDim / 4 * Math.tan(fov * 200));
7516
- let cameraZ = Math.abs((maxDim / 2) / Math.tan(fov / 2));
7517
- // cameraZ *= offset; // zoom out a little so that objects don't fill the screen
7518
- this._camera.position.z = cameraZ;
8188
+ this._camera.position.z = Math.abs((maxDim / 2) * Math.atan(this._camera.fov / 2));
7519
8189
  this._camera.lookAt(center);
7520
8190
  }
7521
8191
  _checkNavigationButtons() {
@@ -7653,5 +8323,5 @@ Carousel3dModule.decorators = [
7653
8323
  * Generated bundle index. Do not edit.
7654
8324
  */
7655
8325
 
7656
- export { ArticleTileComponent, ArticleTileModule, ButtonComponent, ButtonDropDownComponent, ButtonDropDownModule, ButtonModule, COMPONENT_INTERFACE_NAME, Carousel3dComponent, Carousel3dModule, CoDialogComponent, CoDialogModule, CoDialogPromptComponent, CoDialogPromptModule, CoGridComponent, CoGridModule, CoKanbanComponent, CoKanbanModule, CoPivotComponent, CoPivotModule, CoRichTextEditorComponent, CoRichTextEditorModule, CoScheduleComponent, CoScheduleModule, CoSidebarComponent, CoSidebarModule, CoToggleComponent, CoToggleModule, CollapsibleComponent, CollapsibleModule, ColumnAlign, CoreComponentsIcon, DropDownListComponent, DropDownModule, FormComponent, FormMasterService, FormModule, IconCacheService, IconComponent, IconModule, ImageComponent, ImageModule, InputCheckboxComponent, InputCheckboxModule, InputCheckboxMultiSelectComponent, InputCheckboxMultiSelectModule, InputComboBoxComponent, InputComboBoxModule, InputDatePickerComponent, InputDatePickerModule, InputListboxComponent, InputListboxModule, InputNumberPickerComponent, InputNumberPickerModule, InputRadioButtonComponent, InputRadioButtonModule, InputTextComponent, InputTextModule, InputTextareaComponent, InputTextareaModule, LevelIndicatorComponent, LevelIndicatorModule, MultiSelectListComponent, MultiSelectListModule, PopupButtonsComponent, PopupMessageDisplayComponent, PopupModule, PopupWindowShellComponent, PriceDisplayPipe, PriceDisplayPipeModule, PromptService, SimpleGridColumnDirective, SimpleGridComponent, SimpleGridModule, TextInputPopupComponent, TileComponent, TileModule, RippleModule as ɵa, MD_RIPPLE_GLOBAL_OPTIONS as ɵb, CoRippleDirective as ɵc, CoViewportRulerService as ɵd, CoScrollDispatcherService as ɵe, CoScrollableDirective as ɵf, StopClickModule as ɵg, StopClickDirective as ɵh, InputBoolean as ɵi, BaseModule as ɵj, FormInputUserModelChangeListenerService as ɵk, NgZoneWrapperService as ɵl, BaseInputComponent as ɵm, BaseSelectionGridComponent as ɵn, BaseInlineEditGridComponent as ɵo, BaseToolbarGridComponent as ɵp, BaseGridComponent as ɵq, AppendPipeModule as ɵr, AppendPipe as ɵs, ValidationErrorModule as ɵt, ValidationErrorComponent as ɵu, PopupShowerService as ɵv };
8326
+ export { ArticleTileComponent, ArticleTileModule, ButtonComponent, ButtonDropDownComponent, ButtonDropDownModule, ButtonModule, COMPONENT_INTERFACE_NAME, Carousel3dComponent, Carousel3dModule, CoDialogComponent, CoDialogModule, CoDialogPromptComponent, CoDialogPromptModule, CoDialogWizardComponent, CoDialogWizardModule, CoGridComponent, CoGridModule, CoKanbanComponent, CoKanbanModule, CoPivotComponent, CoPivotModule, CoRichTextEditorComponent, CoRichTextEditorModule, CoScheduleComponent, CoScheduleModule, CoSidebarComponent, CoSidebarModule, CoToggleComponent, CoToggleModule, CollapsibleComponent, CollapsibleModule, ColumnAlign, CoreComponentsIcon, DropDownListComponent, DropDownModule, FormComponent, FormMasterService, FormModule, IconCacheService, IconComponent, IconModule, ImageComponent, ImageModule, InputCheckboxComponent, InputCheckboxModule, InputCheckboxMultiSelectComponent, InputCheckboxMultiSelectModule, InputComboBoxComponent, InputComboBoxModule, InputDatePickerComponent, InputDatePickerModule, InputListboxComponent, InputListboxModule, InputNumberPickerComponent, InputNumberPickerModule, InputRadioButtonComponent, InputRadioButtonModule, InputTextComponent, InputTextModule, InputTextareaComponent, InputTextareaModule, LevelIndicatorComponent, LevelIndicatorModule, MultiSelectListComponent, MultiSelectListModule, PopupButtonsComponent, PopupMessageDisplayComponent, PopupModule, PopupWindowShellComponent, PriceDisplayPipe, PriceDisplayPipeModule, PromptService, SimpleGridColumnDirective, SimpleGridComponent, SimpleGridModule, TextInputPopupComponent, TileComponent, TileModule, RippleModule as ɵa, MD_RIPPLE_GLOBAL_OPTIONS as ɵb, CoRippleDirective as ɵc, CoViewportRulerService as ɵd, CoScrollDispatcherService as ɵe, CoScrollableDirective as ɵf, StopClickModule as ɵg, StopClickDirective as ɵh, InputBoolean as ɵi, BaseModule as ɵj, FormInputUserModelChangeListenerService as ɵk, NgZoneWrapperService as ɵl, BaseInputComponent as ɵm, GridToolbarModule as ɵn, GridToolbarComponent as ɵo, BaseSelectionGridComponent as ɵp, BaseInlineEditGridComponent as ɵq, BaseToolbarGridComponent as ɵr, BaseGridComponent as ɵs, AppendPipeModule as ɵt, AppendPipe as ɵu, ValidationErrorModule as ɵv, ValidationErrorComponent as ɵw, PopupShowerService as ɵx, BaseSimpleGridComponent as ɵy, SimpleGridCellComponent as ɵz };
7657
8327
  //# sourceMappingURL=colijnit-corecomponents_v12.js.map