@colijnit/corecomponents_v12 12.0.21 → 12.0.24

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 (87) hide show
  1. package/bundles/colijnit-corecomponents_v12.umd.js +988 -158
  2. package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
  3. package/colijnit-corecomponents_v12-12.0.24.tgz +0 -0
  4. package/colijnit-corecomponents_v12.d.ts +15 -9
  5. package/colijnit-corecomponents_v12.metadata.json +1 -1
  6. package/esm2015/colijnit-corecomponents_v12.js +16 -10
  7. package/esm2015/lib/components/base/base-input.component.js +43 -10
  8. package/esm2015/lib/components/base/commit-buttons/commit-buttons.component.js +92 -0
  9. package/esm2015/lib/components/base/commit-buttons/commit-buttons.module.js +19 -0
  10. package/esm2015/lib/components/button/button.component.js +1 -1
  11. package/esm2015/lib/components/carousel-3d/carousel-3d.component.js +2 -6
  12. package/esm2015/lib/components/co-dialog-wizard/co-dialog-wizard.component.js +51 -0
  13. package/esm2015/lib/components/co-dialog-wizard/co-dialog-wizard.module.js +17 -0
  14. package/esm2015/lib/components/drop-down-list/drop-down-list.component.js +4 -1
  15. package/esm2015/lib/components/form/form.component.js +8 -3
  16. package/esm2015/lib/components/grid/base/base-grid.component.js +7 -3
  17. package/esm2015/lib/components/grid/base/base-inline-edit-grid.component.js +47 -3
  18. package/esm2015/lib/components/grid/base/base-selection-grid.component.js +12 -2
  19. package/esm2015/lib/components/grid/co-grid.component.js +35 -32
  20. package/esm2015/lib/components/grid/co-grid.module.js +4 -2
  21. package/esm2015/lib/components/grid-toolbar/grid-toolbar.component.js +41 -0
  22. package/esm2015/lib/components/grid-toolbar/grid-toolbar.module.js +23 -0
  23. package/esm2015/lib/components/input-checkbox/input-checkbox.component.js +4 -1
  24. package/esm2015/lib/components/input-checkbox-multi-select/input-checkbox-multi-select.component.js +4 -1
  25. package/esm2015/lib/components/input-combo-box/input-combo-box.component.js +5 -4
  26. package/esm2015/lib/components/input-date-picker/input-date-picker.component.js +4 -1
  27. package/esm2015/lib/components/input-listbox/input-listbox.component.js +4 -1
  28. package/esm2015/lib/components/input-number-picker/input-number-picker.component.js +22 -24
  29. package/esm2015/lib/components/input-radio-button/input-radio-button.component.js +4 -1
  30. package/esm2015/lib/components/input-text/input-text.component.js +11 -13
  31. package/esm2015/lib/components/input-text/input-text.module.js +4 -2
  32. package/esm2015/lib/components/input-textarea/input-textarea.component.js +4 -1
  33. package/esm2015/lib/components/multi-select-list/multi-select-list.component.js +4 -1
  34. package/esm2015/lib/components/simple-grid/base-simple-grid.component.js +86 -0
  35. package/esm2015/lib/components/simple-grid/simple-grid-cell.component.js +163 -0
  36. package/esm2015/lib/components/simple-grid/simple-grid-column.directive.js +43 -4
  37. package/esm2015/lib/components/simple-grid/simple-grid.component.js +257 -59
  38. package/esm2015/lib/components/simple-grid/simple-grid.module.js +11 -2
  39. package/esm2015/lib/core/constant/number-inputs-key-down-white-list.js +2 -1
  40. package/esm2015/public-api.js +3 -1
  41. package/fesm2015/colijnit-corecomponents_v12.js +1032 -205
  42. package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
  43. package/lib/components/base/base-input.component.d.ts +5 -2
  44. package/lib/components/base/commit-buttons/commit-buttons.component.d.ts +19 -0
  45. package/lib/components/base/commit-buttons/commit-buttons.module.d.ts +2 -0
  46. package/lib/components/base/commit-buttons/style/_layout.scss +127 -0
  47. package/lib/components/base/commit-buttons/style/_material-definition.scss +5 -0
  48. package/lib/components/base/commit-buttons/style/_theme.scss +34 -0
  49. package/lib/components/base/commit-buttons/style/material.scss +4 -0
  50. package/lib/components/co-dialog/style/_layout.scss +3 -0
  51. package/lib/components/co-dialog-wizard/co-dialog-wizard.component.d.ts +9 -0
  52. package/lib/components/co-dialog-wizard/co-dialog-wizard.module.d.ts +2 -0
  53. package/lib/components/co-dialog-wizard/style/_layout.scss +51 -0
  54. package/lib/components/co-dialog-wizard/style/_material-definition.scss +25 -0
  55. package/lib/components/co-dialog-wizard/style/_theme.scss +16 -0
  56. package/lib/components/co-dialog-wizard/style/material.scss +5 -0
  57. package/lib/components/collapsible/style/_layout.scss +1 -1
  58. package/lib/components/collapsible/style/_material-definition.scss +1 -0
  59. package/lib/components/form/form.component.d.ts +1 -0
  60. package/lib/components/grid/base/base-grid.component.d.ts +3 -0
  61. package/lib/components/grid/base/base-inline-edit-grid.component.d.ts +11 -2
  62. package/lib/components/grid/base/base-selection-grid.component.d.ts +4 -0
  63. package/lib/components/grid-toolbar/grid-toolbar.component.d.ts +13 -0
  64. package/lib/components/grid-toolbar/grid-toolbar.module.d.ts +2 -0
  65. package/lib/components/grid-toolbar/style/_layout.scss +10 -0
  66. package/lib/components/grid-toolbar/style/_material-definition.scss +0 -0
  67. package/lib/components/grid-toolbar/style/_theme.scss +5 -0
  68. package/lib/components/grid-toolbar/style/material.scss +5 -0
  69. package/lib/components/input-combo-box/input-combo-box.component.d.ts +0 -1
  70. package/lib/components/input-number-picker/input-number-picker.component.d.ts +1 -6
  71. package/lib/components/input-radio-button/style/_material-definition.scss +1 -1
  72. package/lib/components/input-text/style/_layout.scss +0 -32
  73. package/lib/components/input-text/style/_material-definition.scss +0 -3
  74. package/lib/components/input-text/style/_theme.scss +0 -16
  75. package/lib/components/input-text/style/material.scss +1 -0
  76. package/lib/components/simple-grid/base-simple-grid.component.d.ts +31 -0
  77. package/lib/components/simple-grid/simple-grid-cell.component.d.ts +28 -0
  78. package/lib/components/simple-grid/simple-grid-column.directive.d.ts +15 -2
  79. package/lib/components/simple-grid/simple-grid.component.d.ts +39 -22
  80. package/lib/components/simple-grid/style/_layout.scss +23 -0
  81. package/lib/components/simple-grid/style/_material-definition.scss +13 -4
  82. package/lib/components/simple-grid/style/_theme.scss +17 -0
  83. package/lib/components/simple-grid/style/material.scss +1 -0
  84. package/lib/style/_input.mixins.scss +1 -1
  85. package/lib/style/_variables.scss +5 -1
  86. package/package.json +2 -2
  87. 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, Renderer2, ViewChildren, 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';
@@ -2313,6 +2313,67 @@ CoDialogPromptModule.decorators = [
2313
2313
  },] }
2314
2314
  ];
2315
2315
 
2316
+ class CoDialogWizardComponent {
2317
+ constructor() {
2318
+ this.icons = CoreComponentsIcon;
2319
+ this.showCloseIcon = true;
2320
+ this.animation = true;
2321
+ this.closeClick = new EventEmitter();
2322
+ }
2323
+ showClass() {
2324
+ return true;
2325
+ }
2326
+ }
2327
+ CoDialogWizardComponent.decorators = [
2328
+ { type: Component, args: [{
2329
+ selector: 'co-dialog-wizard',
2330
+ template: `
2331
+ <div class="co-dialog-wizard-wrapper" [@showHideDialog]="animation">
2332
+ <div class="dialog-header">
2333
+ <ng-content select="[header]"></ng-content>
2334
+ <div class="dialog-close-button" *ngIf="showCloseIcon" (click)="closeClick.emit($event)">
2335
+ <co-icon [icon]="icons.Cancel"></co-icon>
2336
+ </div>
2337
+ </div>
2338
+
2339
+ <hr class="co-dialog-wizard-divider">
2340
+
2341
+ <div class="dialog-content">
2342
+ <ng-content></ng-content>
2343
+ </div>
2344
+ </div>
2345
+ `,
2346
+ animations: [
2347
+ trigger('showHideDialog', [
2348
+ state('*', style({ opacity: 1 })),
2349
+ state('void', style({ opacity: 0 })),
2350
+ transition('void => *', animate('200ms 200ms')),
2351
+ transition('* => void', animate(200))
2352
+ ])
2353
+ ],
2354
+ encapsulation: ViewEncapsulation.None
2355
+ },] }
2356
+ ];
2357
+ CoDialogWizardComponent.propDecorators = {
2358
+ showCloseIcon: [{ type: Input }],
2359
+ animation: [{ type: Input }],
2360
+ closeClick: [{ type: Output }],
2361
+ showClass: [{ type: HostBinding, args: ["class.co-dialog-wizard",] }]
2362
+ };
2363
+
2364
+ class CoDialogWizardModule {
2365
+ }
2366
+ CoDialogWizardModule.decorators = [
2367
+ { type: NgModule, args: [{
2368
+ imports: [
2369
+ CommonModule,
2370
+ IconModule
2371
+ ],
2372
+ declarations: [CoDialogWizardComponent],
2373
+ exports: [CoDialogWizardComponent]
2374
+ },] }
2375
+ ];
2376
+
2316
2377
  class CoKanbanComponent {
2317
2378
  constructor() {
2318
2379
  this.allowDragAndDrop = true;
@@ -2845,6 +2906,8 @@ class BaseInputComponent {
2845
2906
  this.noFormGroupControl = false;
2846
2907
  this.keepFocus = false;
2847
2908
  this.canSaveOrCancel = false;
2909
+ this.committing = false;
2910
+ this.commitFinished = true;
2848
2911
  this._markedAsUserTouched = false;
2849
2912
  this._destroyed = false;
2850
2913
  this._hasOnPushCdStrategy = false;
@@ -3107,9 +3170,15 @@ class BaseInputComponent {
3107
3170
  commitClick(event) {
3108
3171
  return __awaiter(this, void 0, void 0, function* () {
3109
3172
  this.keepFocus = true;
3110
- yield this.commit(this.model);
3173
+ this.commitFinished = false;
3174
+ this.committing = true;
3175
+ const success = yield this.commit(this.model);
3111
3176
  this.keepFocus = false;
3112
- this.doBlur(event);
3177
+ yield this._commitFinished();
3178
+ if (success) {
3179
+ this.doBlur(event);
3180
+ }
3181
+ return success;
3113
3182
  });
3114
3183
  }
3115
3184
  cancelClick(event) {
@@ -3127,6 +3196,9 @@ class BaseInputComponent {
3127
3196
  const componentFactory = this.componentFactoryResolver.resolveComponentFactory(ValidationErrorComponent);
3128
3197
  this._errorValidationComponent = this.validationErrorContainer.createComponent(componentFactory);
3129
3198
  this._errorValidationComponent.instance.error = error;
3199
+ if (this._hasOnPushCdStrategy) {
3200
+ this.changeDetector.markForCheck();
3201
+ }
3130
3202
  this._positionValidationError();
3131
3203
  }
3132
3204
  }
@@ -3149,6 +3221,9 @@ class BaseInputComponent {
3149
3221
  if (this.canChange && this.input) {
3150
3222
  this.input.focus();
3151
3223
  this.focused = true;
3224
+ if (this._hasOnPushCdStrategy) {
3225
+ this.markForCheck();
3226
+ }
3152
3227
  }
3153
3228
  }
3154
3229
  doFocus(event) {
@@ -3158,6 +3233,9 @@ class BaseInputComponent {
3158
3233
  this._initialModelSet = false;
3159
3234
  this.focused = true;
3160
3235
  this.canSaveOrCancel = false;
3236
+ if (this._hasOnPushCdStrategy) {
3237
+ this.markForCheck();
3238
+ }
3161
3239
  this.focus.next();
3162
3240
  }
3163
3241
  doBlur(event) {
@@ -3169,7 +3247,12 @@ class BaseInputComponent {
3169
3247
  return false;
3170
3248
  }
3171
3249
  this.focused = false;
3172
- this.input.blur();
3250
+ if (this._hasOnPushCdStrategy) {
3251
+ this.markForCheck();
3252
+ }
3253
+ if (this.input) {
3254
+ this.input.blur();
3255
+ }
3173
3256
  this.blur.next();
3174
3257
  }, 200);
3175
3258
  }
@@ -3280,6 +3363,15 @@ class BaseInputComponent {
3280
3363
  this.control.updateValueAndValidity();
3281
3364
  }
3282
3365
  }
3366
+ _commitFinished() {
3367
+ return new Promise((resolve) => {
3368
+ this.commitFinished = true;
3369
+ setTimeout(() => {
3370
+ this.committing = false;
3371
+ resolve();
3372
+ }, 800);
3373
+ });
3374
+ }
3283
3375
  _clearErrorComponent() {
3284
3376
  if (this.validationErrorContainer) {
3285
3377
  this.validationErrorContainer.clear();
@@ -3386,12 +3478,14 @@ class BaseInputComponent {
3386
3478
  case 'Tab':
3387
3479
  const nextSiblingToFocus = event.shiftKey ? event.currentTarget.previousSibling : event.currentTarget.nextSibling;
3388
3480
  event.preventDefault();
3389
- yield this.commitClick();
3390
- if (nextSiblingToFocus) {
3391
- try {
3392
- this._setFocusOnNextPossibleInput(nextSiblingToFocus, event.shiftKey);
3393
- }
3394
- catch (e) {
3481
+ const success = yield this.commitClick();
3482
+ if (success) {
3483
+ if (nextSiblingToFocus) {
3484
+ try {
3485
+ this._setFocusOnNextPossibleInput(nextSiblingToFocus, event.shiftKey);
3486
+ }
3487
+ catch (e) {
3488
+ }
3395
3489
  }
3396
3490
  }
3397
3491
  return false;
@@ -3648,6 +3742,7 @@ class FormComponent {
3648
3742
  constructor(_formMaster) {
3649
3743
  this._formMaster = _formMaster;
3650
3744
  this.onChange = new EventEmitter();
3745
+ this.showClass = true;
3651
3746
  this.submitted = false;
3652
3747
  // Emits true after every valid submit.
3653
3748
  this.validSubmit = new EventEmitter();
@@ -3794,7 +3889,10 @@ class FormComponent {
3794
3889
  FormComponent.decorators = [
3795
3890
  { type: Component, args: [{
3796
3891
  selector: "co-form",
3797
- template: `<ng-content></ng-content>`
3892
+ template: `
3893
+ <ng-content></ng-content>
3894
+ `,
3895
+ encapsulation: ViewEncapsulation.None
3798
3896
  },] }
3799
3897
  ];
3800
3898
  FormComponent.ctorParameters = () => [
@@ -3804,6 +3902,7 @@ FormComponent.propDecorators = {
3804
3902
  readonly: [{ type: Input }],
3805
3903
  keepInView: [{ type: Input }],
3806
3904
  onChange: [{ type: Output }],
3905
+ showClass: [{ type: HostBinding, args: ["class.co-form",] }],
3807
3906
  submitted: [{ type: HostBinding, args: ["class.submitted",] }],
3808
3907
  validSubmit: [{ type: Output }],
3809
3908
  anySubmit: [{ type: Output }],
@@ -3865,6 +3964,9 @@ DropDownListComponent.decorators = [
3865
3964
  {
3866
3965
  provide: COMPONENT_INTERFACE_NAME,
3867
3966
  useExisting: forwardRef(() => DropDownListComponent)
3967
+ }, {
3968
+ provide: BaseInputComponent,
3969
+ useExisting: DropDownListComponent
3868
3970
  }
3869
3971
  ],
3870
3972
  encapsulation: ViewEncapsulation.None
@@ -3933,7 +4035,8 @@ var GridLines;
3933
4035
  })(GridLines || (GridLines = {}));
3934
4036
 
3935
4037
  class BaseGridComponent {
3936
- constructor() {
4038
+ constructor(element) {
4039
+ this.element = element;
3937
4040
  this.gridLines = GridLines.None;
3938
4041
  this.contextMenuItems = [];
3939
4042
  this.sortingEnabled = false;
@@ -3961,6 +4064,9 @@ class BaseGridComponent {
3961
4064
  BaseGridComponent.decorators = [
3962
4065
  { type: Directive }
3963
4066
  ];
4067
+ BaseGridComponent.ctorParameters = () => [
4068
+ { type: ElementRef }
4069
+ ];
3964
4070
  BaseGridComponent.propDecorators = {
3965
4071
  grid: [{ type: ViewChild, args: ['grid', { static: false },] }],
3966
4072
  data: [{ type: Input }],
@@ -4083,6 +4189,10 @@ class BaseInlineEditGridComponent extends BaseToolbarGridComponent {
4083
4189
  constructor() {
4084
4190
  super(...arguments);
4085
4191
  this.rowSaved = new EventEmitter();
4192
+ this.beforeRowDelete = new EventEmitter(false);
4193
+ this.rowDeleted = new EventEmitter();
4194
+ this.actionBeginObservable$ = new Observable();
4195
+ this.actionBeginObservableSub = new Subscription();
4086
4196
  }
4087
4197
  set inlineEdit(value) {
4088
4198
  if (value) {
@@ -4097,20 +4207,59 @@ class BaseInlineEditGridComponent extends BaseToolbarGridComponent {
4097
4207
  this.updateToolbar("Update", value);
4098
4208
  this.updateToolbar("Cancel", value);
4099
4209
  }
4210
+ ngAfterViewInit() {
4211
+ if (this.grid) {
4212
+ this.actionBeginObservable$ = fromEvent(this.grid, 'actionBegin');
4213
+ this.actionBeginObservableSub = this.actionBeginObservable$.subscribe((action) => {
4214
+ this.handleActionBegin(action);
4215
+ });
4216
+ }
4217
+ }
4218
+ ngOnDestroy() {
4219
+ this.actionBeginObservableSub.unsubscribe();
4220
+ }
4221
+ handleActionBegin(action) {
4222
+ return __awaiter(this, void 0, void 0, function* () {
4223
+ if (action) {
4224
+ if (action.requestType === "delete") {
4225
+ yield this.waitForBeforeDelete(action);
4226
+ }
4227
+ if (action.requestType === "save") {
4228
+ this.rowSaved.next(action.data);
4229
+ }
4230
+ }
4231
+ });
4232
+ }
4100
4233
  handleActionComplete(action) {
4101
4234
  if (action) {
4235
+ if (action.requestType === "delete") {
4236
+ this.rowDeleted.next(action.data);
4237
+ }
4102
4238
  if (action.requestType === "save") {
4103
4239
  this.rowSaved.next(action.data);
4104
4240
  }
4105
4241
  }
4106
4242
  }
4243
+ waitForBeforeDelete(action) {
4244
+ // @ts-ignore
4245
+ const beforeRowDelete$ = fromEvent(this.element, 'beforeRowDelete');
4246
+ return new Promise((resolve) => {
4247
+ beforeRowDelete$.subscribe((result) => {
4248
+ action = result;
4249
+ return resolve(action);
4250
+ }).unsubscribe();
4251
+ this.beforeRowDelete.next(action);
4252
+ });
4253
+ }
4107
4254
  }
4108
4255
  BaseInlineEditGridComponent.decorators = [
4109
4256
  { type: Directive }
4110
4257
  ];
4111
4258
  BaseInlineEditGridComponent.propDecorators = {
4112
4259
  inlineEdit: [{ type: Input }],
4113
- rowSaved: [{ type: Output }]
4260
+ rowSaved: [{ type: Output }],
4261
+ beforeRowDelete: [{ type: Output }],
4262
+ rowDeleted: [{ type: Output }]
4114
4263
  };
4115
4264
  __decorate([
4116
4265
  InputBoolean()
@@ -4127,6 +4276,8 @@ class BaseSelectionGridComponent extends BaseInlineEditGridComponent {
4127
4276
  this.contextMenuItemClick = new EventEmitter();
4128
4277
  this.rowDragStartEvent = new EventEmitter();
4129
4278
  this.rowDropEvent = new EventEmitter();
4279
+ this.beforeRowsDelete = new EventEmitter();
4280
+ this.rowsDeleted = new EventEmitter();
4130
4281
  this.selectionOptions = { type: "Single" };
4131
4282
  }
4132
4283
  set multipleSelect(value) {
@@ -4173,6 +4324,12 @@ class BaseSelectionGridComponent extends BaseInlineEditGridComponent {
4173
4324
  rowDropClick(args) {
4174
4325
  this.rowDropEvent.next(args);
4175
4326
  }
4327
+ handleBeforeBatchDelete(args) {
4328
+ this.beforeRowsDelete.next(args);
4329
+ }
4330
+ handleBatchDelete(rows) {
4331
+ this.rowsDeleted.next(rows);
4332
+ }
4176
4333
  }
4177
4334
  BaseSelectionGridComponent.decorators = [
4178
4335
  { type: Directive }
@@ -4186,7 +4343,9 @@ BaseSelectionGridComponent.propDecorators = {
4186
4343
  detailColumnClick: [{ type: Output }],
4187
4344
  contextMenuItemClick: [{ type: Output }],
4188
4345
  rowDragStartEvent: [{ type: Output }],
4189
- rowDropEvent: [{ type: Output }]
4346
+ rowDropEvent: [{ type: Output }],
4347
+ beforeRowsDelete: [{ type: Output }],
4348
+ rowsDeleted: [{ type: Output }]
4190
4349
  };
4191
4350
  __decorate([
4192
4351
  InputBoolean()
@@ -4207,37 +4366,40 @@ CoGridComponent.decorators = [
4207
4366
  { type: Component, args: [{
4208
4367
  selector: 'co-grid',
4209
4368
  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>
4369
+ <ejs-grid #grid id="grid"
4370
+ [dataSource]="data"
4371
+ [columns]="columns"
4372
+ [contextMenuItems]="contextMenuItems"
4373
+ [pageSettings]="pageSettings"
4374
+ [toolbar]="toolbarOptions"
4375
+ [gridLines]="gridLines"
4376
+ [frozenColumns]="frozenColumns"
4377
+ [frozenRows]="frozenRows"
4378
+ [selectionSettings]="selectionOptions"
4379
+ [editSettings]="editSettings"
4380
+ [allowPaging]="pagingEnabled"
4381
+ [allowSorting]="sortingEnabled"
4382
+ [allowFiltering]="filteringEnabled"
4383
+ [allowGrouping]="groupingEnabled"
4384
+ [allowReordering]="reorderingEnabled"
4385
+ [allowResizing]="resizingEnabled"
4386
+ [allowRowDragAndDrop]="rowDragAndDropEnabled"
4387
+ [showColumnMenu]="showColumnMenu"
4388
+ [showColumnChooser]="showColumnChooser"
4389
+ [allowExcelExport]="exportExcelEnabled"
4390
+ [allowPdfExport]="exportPdfEnabled"
4391
+ (toolbarClick)="toolbarClick($event)"
4392
+ (rowSelected)="handleRowSelected($event)"
4393
+ (recordDoubleClick)="handleDoubleClick($event)"
4394
+ (recordClick)="handleRecordClick($event)"
4395
+ (actionComplete)="handleActionComplete($event)"
4396
+ (contextMenuClick)="contextMenuClick($event)"
4397
+ (rowDragStart)="rowDragStartClick($event)"
4398
+ (rowDrop)="rowDropClick($event)"
4399
+ (beforeBatchDelete)="handleBeforeBatchDelete($event)"
4400
+ (batchDelete)="handleBatchDelete($event)"
4401
+ >
4402
+ </ejs-grid>
4241
4403
  `,
4242
4404
  providers: [
4243
4405
  RowDDService
@@ -4249,6 +4411,62 @@ CoGridComponent.propDecorators = {
4249
4411
  showClass: [{ type: HostBinding, args: ['class.co-grid',] }]
4250
4412
  };
4251
4413
 
4414
+ class GridToolbarComponent {
4415
+ constructor(iconsService) {
4416
+ this.iconsService = iconsService;
4417
+ this.icons = CoreComponentsIcon;
4418
+ this.editClick = new EventEmitter();
4419
+ this.cancelClick = new EventEmitter();
4420
+ this.saveClick = new EventEmitter();
4421
+ this.addClick = new EventEmitter();
4422
+ }
4423
+ showClass() {
4424
+ return true;
4425
+ }
4426
+ }
4427
+ GridToolbarComponent.decorators = [
4428
+ { type: Component, args: [{
4429
+ selector: "co-grid-toolbar",
4430
+ template: `
4431
+ <div class="grid-toolbar-wrapper">
4432
+ <co-button [iconData]="iconsService.getIcon(icons.AddToCartDrop)" [label]="'edit'" (click)="editClick.emit($event)"></co-button>
4433
+ <co-button [iconData]="iconsService.getIcon(icons.AddToCartDrop)" [label]="'cancel'" (click)="cancelClick.emit()"></co-button>
4434
+ <co-button [iconData]="iconsService.getIcon(icons.AddToCartDrop)" [label]="'save'" (click)="saveClick.emit()"></co-button>
4435
+ <co-button [iconData]="iconsService.getIcon(icons.AddToCartDrop)" [label]="'add'" (click)="addClick.emit()"></co-button>
4436
+ </div>
4437
+ `,
4438
+ encapsulation: ViewEncapsulation.None
4439
+ },] }
4440
+ ];
4441
+ GridToolbarComponent.ctorParameters = () => [
4442
+ { type: IconCacheService }
4443
+ ];
4444
+ GridToolbarComponent.propDecorators = {
4445
+ editClick: [{ type: Output }],
4446
+ cancelClick: [{ type: Output }],
4447
+ saveClick: [{ type: Output }],
4448
+ addClick: [{ type: Output }],
4449
+ showClass: [{ type: HostBinding, args: ["class.co-grid-toolbar",] }]
4450
+ };
4451
+
4452
+ enableRipple(true);
4453
+ class GridToolbarModule {
4454
+ }
4455
+ GridToolbarModule.decorators = [
4456
+ { type: NgModule, args: [{
4457
+ imports: [
4458
+ IconModule,
4459
+ ButtonModule
4460
+ ],
4461
+ declarations: [
4462
+ GridToolbarComponent
4463
+ ],
4464
+ exports: [
4465
+ GridToolbarComponent
4466
+ ]
4467
+ },] }
4468
+ ];
4469
+
4252
4470
  class CoGridModule {
4253
4471
  }
4254
4472
  CoGridModule.decorators = [
@@ -4256,7 +4474,8 @@ CoGridModule.decorators = [
4256
4474
  imports: [
4257
4475
  CommonModule,
4258
4476
  FormsModule,
4259
- GridModule
4477
+ GridModule,
4478
+ GridToolbarModule
4260
4479
  ],
4261
4480
  declarations: [CoGridComponent],
4262
4481
  exports: [CoGridComponent],
@@ -4318,6 +4537,9 @@ InputCheckboxComponent.decorators = [
4318
4537
  providers: [{
4319
4538
  provide: COMPONENT_INTERFACE_NAME,
4320
4539
  useExisting: forwardRef(() => InputCheckboxComponent)
4540
+ }, {
4541
+ provide: BaseInputComponent,
4542
+ useExisting: InputCheckboxComponent
4321
4543
  }],
4322
4544
  changeDetection: ChangeDetectionStrategy.OnPush,
4323
4545
  encapsulation: ViewEncapsulation.None
@@ -4417,6 +4639,9 @@ InputCheckboxMultiSelectComponent.decorators = [
4417
4639
  providers: [{
4418
4640
  provide: COMPONENT_INTERFACE_NAME,
4419
4641
  useExisting: forwardRef(() => InputCheckboxMultiSelectComponent)
4642
+ }, {
4643
+ provide: BaseInputComponent,
4644
+ useExisting: InputCheckboxMultiSelectComponent
4420
4645
  }],
4421
4646
  changeDetection: ChangeDetectionStrategy.OnPush,
4422
4647
  encapsulation: ViewEncapsulation.None
@@ -4466,7 +4691,6 @@ class InputComboBoxComponent extends BaseInputComponent {
4466
4691
  this.ngZoneWrapper = ngZoneWrapper;
4467
4692
  this.elementRef = elementRef;
4468
4693
  this.shopPopup = true;
4469
- this.customHeight = true;
4470
4694
  super._markAsOnPush();
4471
4695
  }
4472
4696
  showClass() {
@@ -4499,6 +4723,9 @@ InputComboBoxComponent.decorators = [
4499
4723
  providers: [{
4500
4724
  provide: COMPONENT_INTERFACE_NAME,
4501
4725
  useExisting: forwardRef(() => InputComboBoxComponent)
4726
+ }, {
4727
+ provide: BaseInputComponent,
4728
+ useExisting: InputComboBoxComponent
4502
4729
  }],
4503
4730
  encapsulation: ViewEncapsulation.None
4504
4731
  },] }
@@ -4518,8 +4745,7 @@ InputComboBoxComponent.propDecorators = {
4518
4745
  selected: [{ type: Input }],
4519
4746
  placeholder: [{ type: Input }],
4520
4747
  shopPopup: [{ type: Input }],
4521
- showClass: [{ type: HostBinding, args: ["class.co-input-combo-box",] }],
4522
- customHeight: [{ type: HostBinding, args: ["class.custom-height",] }]
4748
+ showClass: [{ type: HostBinding, args: ["class.co-input-combo-box",] }]
4523
4749
  };
4524
4750
 
4525
4751
  class InputComboBoxModule {
@@ -4605,6 +4831,9 @@ InputDatePickerComponent.decorators = [
4605
4831
  `,
4606
4832
  providers: [{
4607
4833
  provide: COMPONENT_INTERFACE_NAME, useExisting: forwardRef(() => InputDatePickerComponent)
4834
+ }, {
4835
+ provide: BaseInputComponent,
4836
+ useExisting: InputDatePickerComponent
4608
4837
  }],
4609
4838
  encapsulation: ViewEncapsulation.None
4610
4839
  },] }
@@ -4902,6 +5131,7 @@ const NUMBER_INPUTS_KEY_DOWN_WHITE_LIST = [
4902
5131
  KeyboardCode.Down,
4903
5132
  KeyboardCode.Up,
4904
5133
  KeyboardCode.Tab,
5134
+ KeyboardCode.Enter,
4905
5135
  KeyboardCode.Home,
4906
5136
  KeyboardCode.End,
4907
5137
  KeyboardCode.Delete,
@@ -4937,76 +5167,6 @@ const NUMBER_INPUTS_KEY_DOWN_WHITE_LIST = [
4937
5167
  KeyboardCode.NumpadNine
4938
5168
  ];
4939
5169
 
4940
- class InputTextComponent extends BaseInputComponent {
4941
- constructor(formComponent, changeDetector, componentFactoryResolver, formUserChangeListener, ngZoneWrapper, elementRef) {
4942
- super(changeDetector, componentFactoryResolver, formUserChangeListener, ngZoneWrapper, elementRef);
4943
- this.formComponent = formComponent;
4944
- this.changeDetector = changeDetector;
4945
- this.componentFactoryResolver = componentFactoryResolver;
4946
- this.formUserChangeListener = formUserChangeListener;
4947
- this.ngZoneWrapper = ngZoneWrapper;
4948
- this.elementRef = elementRef;
4949
- this.Icons = CoreComponentsIcon;
4950
- this.placeholder = "";
4951
- this.type = "text";
4952
- this.showClearButton = undefined;
4953
- this.hasOwnLabel = true;
4954
- super._markAsOnPush();
4955
- }
4956
- showClass() {
4957
- return true;
4958
- }
4959
- }
4960
- InputTextComponent.decorators = [
4961
- { type: Component, args: [{
4962
- selector: "co-input-text",
4963
- template: `
4964
- <label [textContent]="placeholder"></label>
4965
- <input #input
4966
- [type]="type"
4967
- [ngModel]="model"
4968
- [readonly]="readonly"
4969
- [required]="required"
4970
- (ngModelChange)="modelChange.emit($event)"
4971
- >
4972
- <div *ngIf="showSaveCancel && focused && canSaveOrCancel" class="input-save-cancel-button-wrapper" @showHideSaveCancel>
4973
- <div class="input-save-cancel-button save" (click)="commitClick($event)"></div>
4974
- <div class="input-save-cancel-button cancel" (click)="cancelClick($event)"></div>
4975
- </div>
4976
- <div class="required-indicator"></div>
4977
- <ng-template #validationError></ng-template>
4978
- `,
4979
- providers: [{
4980
- provide: COMPONENT_INTERFACE_NAME,
4981
- useExisting: forwardRef(() => InputTextComponent)
4982
- }],
4983
- animations: [
4984
- trigger('showHideSaveCancel', [
4985
- state('*', style({ transform: 'scaleY(1)', opacity: 1 })),
4986
- state('void', style({ transform: 'scaleY(0)', opacity: 0 })),
4987
- transition('void <=> *', animate(200))
4988
- ]),
4989
- ],
4990
- encapsulation: ViewEncapsulation.None
4991
- },] }
4992
- ];
4993
- InputTextComponent.ctorParameters = () => [
4994
- { type: FormComponent, decorators: [{ type: Optional }] },
4995
- { type: ChangeDetectorRef },
4996
- { type: ComponentFactoryResolver },
4997
- { type: FormInputUserModelChangeListenerService },
4998
- { type: NgZoneWrapperService },
4999
- { type: ElementRef }
5000
- ];
5001
- InputTextComponent.propDecorators = {
5002
- placeholder: [{ type: Input }],
5003
- type: [{ type: Input }],
5004
- showClearButton: [{ type: Input }],
5005
- keyDownWhiteList: [{ type: Input }],
5006
- showClass: [{ type: HostBinding, args: ["class.co-input-text",] }],
5007
- hasOwnLabel: [{ type: HostBinding, args: ["class.has-own-label",] }]
5008
- };
5009
-
5010
5170
  // Input values for 'buttonShowMode' of NumberPickerComponent.
5011
5171
  var InputNumberPickerButtonShowMode;
5012
5172
  (function (InputNumberPickerButtonShowMode) {
@@ -5047,8 +5207,8 @@ class InputNumberPickerComponent extends BaseInputComponent {
5047
5207
  this._stepFactor = this._stepFactors[0];
5048
5208
  this._mayAutoCount = false;
5049
5209
  this._numberLogicValueChangeSub = this.numberLogic.valueChange.subscribe((value) => {
5050
- this.inputTextComp.model = "" + value; // faster than this.detectChanges() just for that input
5051
5210
  if (!this._mayAutoCount) {
5211
+ this.model = value;
5052
5212
  this.modelChange.emit(value);
5053
5213
  // custom form user chagne listener .next because we don't user super.updateModel() which normally does that for us
5054
5214
  if (this._markedAsUserTouched) {
@@ -5059,12 +5219,15 @@ class InputNumberPickerComponent extends BaseInputComponent {
5059
5219
  });
5060
5220
  }
5061
5221
  // @override
5062
- set model(model) {
5063
- this.numberLogic.value = model;
5064
- }
5065
- get model() {
5066
- return this.numberLogic.value;
5067
- }
5222
+ // @Input()
5223
+ // public set model(model: number) {
5224
+ // super.model = model;
5225
+ // this.numberLogic.value = model;
5226
+ // }
5227
+ //
5228
+ // public get model(): number {
5229
+ // return this.numberLogic.value;
5230
+ // }
5068
5231
  set min(min) {
5069
5232
  this.numberLogic.min = min;
5070
5233
  }
@@ -5114,6 +5277,11 @@ class InputNumberPickerComponent extends BaseInputComponent {
5114
5277
  if (this.myKeyDownWhiteList.find((k) => k === event.keyCode) === undefined) {
5115
5278
  return false;
5116
5279
  }
5280
+ super.handleKeyDown(event);
5281
+ }
5282
+ handleChangeModel(value) {
5283
+ console.log(value);
5284
+ this.numberLogic.setValue(value);
5117
5285
  }
5118
5286
  // Note: recursive through setTimeout().
5119
5287
  doDecrementAuto() {
@@ -5182,17 +5350,6 @@ class InputNumberPickerComponent extends BaseInputComponent {
5182
5350
  }
5183
5351
  }, this._delayBeforeStartAutoCountMs);
5184
5352
  }
5185
- // Possibly show buttons.
5186
- onNumberInputFocus() {
5187
- this._numberInputHasFocus = true;
5188
- this._updateButtonsShowState();
5189
- }
5190
- // Value correction point.
5191
- onNumberInputBlur() {
5192
- this._numberInputHasFocus = false;
5193
- this.numberLogic.setValueByUserInputText(this.inputTextComp.model);
5194
- this._updateButtonsShowState();
5195
- }
5196
5353
  // Note: recursive.
5197
5354
  _doIncreaseStepFactor() {
5198
5355
  this._stepIncrementTimeout = window.setTimeout(() => {
@@ -5237,10 +5394,11 @@ InputNumberPickerComponent.decorators = [
5237
5394
  (mouseup)="stopAutoCounting()" (mouseleave)="stopAutoCounting()"></co-button>
5238
5395
  </div>
5239
5396
  <input type="text"
5240
- [ngModel]="numberLogic.valueAsSting"
5397
+ [ngModel]="model"
5241
5398
  [readonly]="readonly"
5242
5399
  [disabled]="disabled"
5243
5400
  [required]="required"
5401
+ (ngModelChange)="handleChangeModel($event)"
5244
5402
  (keydown)="handleKeyDown($event)"/>
5245
5403
  <div class="button-wrapper">
5246
5404
  <co-button *ngIf="showButtons" class="plus-operator circle" [class.select]="plusSelected"
@@ -5252,6 +5410,9 @@ InputNumberPickerComponent.decorators = [
5252
5410
  `,
5253
5411
  providers: [{
5254
5412
  provide: COMPONENT_INTERFACE_NAME, useExisting: forwardRef(() => InputNumberPickerComponent)
5413
+ }, {
5414
+ provide: BaseInputComponent,
5415
+ useExisting: InputNumberPickerComponent
5255
5416
  }],
5256
5417
  changeDetection: ChangeDetectionStrategy.OnPush,
5257
5418
  encapsulation: ViewEncapsulation.None
@@ -5266,7 +5427,6 @@ InputNumberPickerComponent.ctorParameters = () => [
5266
5427
  { type: FormInputUserModelChangeListenerService }
5267
5428
  ];
5268
5429
  InputNumberPickerComponent.propDecorators = {
5269
- model: [{ type: Input }],
5270
5430
  min: [{ type: Input }],
5271
5431
  step: [{ type: Input }],
5272
5432
  max: [{ type: Input }],
@@ -5277,7 +5437,6 @@ InputNumberPickerComponent.propDecorators = {
5277
5437
  noValidation: [{ type: Input }],
5278
5438
  decimals: [{ type: Input }],
5279
5439
  modelChange: [{ type: Output }],
5280
- inputTextComp: [{ type: ViewChild, args: [InputTextComponent, { static: true },] }],
5281
5440
  showButtonsOnFocusOnly: [{ type: HostBinding, args: ["class.show-buttons-on-focus-only",] }],
5282
5441
  hasLabel: [{ type: HostBinding, args: ["class.has-label",] }],
5283
5442
  showClass: [{ type: HostBinding, args: ['class.co-input-number-picker',] }]
@@ -5286,39 +5445,215 @@ __decorate([
5286
5445
  InputBoolean()
5287
5446
  ], InputNumberPickerComponent.prototype, "noValidation", void 0);
5288
5447
 
5289
- class ValidationErrorModule {
5290
- }
5291
- ValidationErrorModule.decorators = [
5292
- { type: NgModule, args: [{
5293
- imports: [
5294
- CommonModule,
5295
- IconModule
5296
- ],
5297
- declarations: [
5298
- ValidationErrorComponent
5299
- ],
5300
- exports: [
5301
- ValidationErrorComponent
5302
- ]
5303
- },] }
5304
- ];
5305
-
5306
- class InputTextModule {
5448
+ class InputTextComponent extends BaseInputComponent {
5449
+ constructor(formComponent, changeDetector, componentFactoryResolver, formUserChangeListener, ngZoneWrapper, elementRef) {
5450
+ super(changeDetector, componentFactoryResolver, formUserChangeListener, ngZoneWrapper, elementRef);
5451
+ this.formComponent = formComponent;
5452
+ this.changeDetector = changeDetector;
5453
+ this.componentFactoryResolver = componentFactoryResolver;
5454
+ this.formUserChangeListener = formUserChangeListener;
5455
+ this.ngZoneWrapper = ngZoneWrapper;
5456
+ this.elementRef = elementRef;
5457
+ this.Icons = CoreComponentsIcon;
5458
+ this.placeholder = "";
5459
+ this.type = "text";
5460
+ this.showClearButton = undefined;
5461
+ this.hasOwnLabel = true;
5462
+ super._markAsOnPush();
5463
+ }
5464
+ showClass() {
5465
+ return true;
5466
+ }
5307
5467
  }
5308
- InputTextModule.decorators = [
5309
- { type: NgModule, args: [{
5310
- imports: [
5311
- BaseModule,
5312
- CommonModule,
5313
- FormsModule,
5314
- IconModule,
5315
- AppendPipeModule,
5316
- TextBoxAllModule,
5317
- NumericTextBoxModule,
5318
- ValidationErrorModule
5319
- ],
5320
- declarations: [
5321
- InputTextComponent
5468
+ InputTextComponent.decorators = [
5469
+ { type: Component, args: [{
5470
+ selector: "co-input-text",
5471
+ template: `
5472
+ <label [textContent]="placeholder"></label>
5473
+ <input #input
5474
+ [type]="type"
5475
+ [ngModel]="model"
5476
+ [readonly]="readonly"
5477
+ [required]="required"
5478
+ (ngModelChange)="modelChange.emit($event)"
5479
+ >
5480
+ <co-commit-buttons *ngIf="showSaveCancel && focused && canSaveOrCancel"
5481
+ [committing]="committing"
5482
+ [commitFinished]="commitFinished"
5483
+ (commitClick)="commitClick($event)"
5484
+ (cancelClick)="cancelClick($event)"
5485
+ >
5486
+ </co-commit-buttons>
5487
+ <div class="required-indicator"></div>
5488
+ <ng-template #validationError></ng-template>
5489
+ `,
5490
+ providers: [{
5491
+ provide: COMPONENT_INTERFACE_NAME,
5492
+ useExisting: forwardRef(() => InputTextComponent)
5493
+ }, {
5494
+ provide: BaseInputComponent,
5495
+ useExisting: InputTextComponent
5496
+ }],
5497
+ encapsulation: ViewEncapsulation.None
5498
+ },] }
5499
+ ];
5500
+ InputTextComponent.ctorParameters = () => [
5501
+ { type: FormComponent, decorators: [{ type: Optional }] },
5502
+ { type: ChangeDetectorRef },
5503
+ { type: ComponentFactoryResolver },
5504
+ { type: FormInputUserModelChangeListenerService },
5505
+ { type: NgZoneWrapperService },
5506
+ { type: ElementRef }
5507
+ ];
5508
+ InputTextComponent.propDecorators = {
5509
+ placeholder: [{ type: Input }],
5510
+ type: [{ type: Input }],
5511
+ showClearButton: [{ type: Input }],
5512
+ keyDownWhiteList: [{ type: Input }],
5513
+ showClass: [{ type: HostBinding, args: ["class.co-input-text",] }],
5514
+ hasOwnLabel: [{ type: HostBinding, args: ["class.has-own-label",] }]
5515
+ };
5516
+
5517
+ class ValidationErrorModule {
5518
+ }
5519
+ ValidationErrorModule.decorators = [
5520
+ { type: NgModule, args: [{
5521
+ imports: [
5522
+ CommonModule,
5523
+ IconModule
5524
+ ],
5525
+ declarations: [
5526
+ ValidationErrorComponent
5527
+ ],
5528
+ exports: [
5529
+ ValidationErrorComponent
5530
+ ]
5531
+ },] }
5532
+ ];
5533
+
5534
+ class CommitButtonsComponent {
5535
+ constructor(_renderer) {
5536
+ this._renderer = _renderer;
5537
+ this.cancelClick = new EventEmitter();
5538
+ this.commitClick = new EventEmitter();
5539
+ this._committing = false;
5540
+ this._commitFinished = false;
5541
+ this._handleAnimationIteration = (event) => {
5542
+ this._renderer.removeClass(event.currentTarget, 'animate');
5543
+ event.currentTarget.removeEventListener('animationiteration', this._handleAnimationIteration);
5544
+ // elem.removeEventListener('webkitAnimationIteration', () => this._handleAnimationIteration(elem));
5545
+ };
5546
+ }
5547
+ set content(children) {
5548
+ this.animateDivs = children.toArray();
5549
+ this._checkAnimation();
5550
+ }
5551
+ set committing(value) {
5552
+ this._committing = value;
5553
+ this._checkAnimation();
5554
+ }
5555
+ get committing() {
5556
+ return this._committing;
5557
+ }
5558
+ set commitFinished(value) {
5559
+ this._commitFinished = value;
5560
+ this._checkAnimationFinished();
5561
+ }
5562
+ get commitFinished() {
5563
+ return this._commitFinished;
5564
+ }
5565
+ showClass() {
5566
+ return true;
5567
+ }
5568
+ _checkAnimation() {
5569
+ if (this.committing && this.animateDivs) {
5570
+ this.animateDivs.forEach(a => this._renderer.addClass(a.nativeElement, 'animate'));
5571
+ }
5572
+ }
5573
+ _checkAnimationFinished() {
5574
+ if (this.commitFinished && this.animateDivs) {
5575
+ this.animateDivs.forEach(a => {
5576
+ a.nativeElement.addEventListener('animationiteration', this._handleAnimationIteration);
5577
+ // a.nativeElement.addEventListener('webkitAnimationIteration', (event) => this._handleAnimationIteration(event));
5578
+ });
5579
+ }
5580
+ }
5581
+ }
5582
+ CommitButtonsComponent.decorators = [
5583
+ { type: Component, args: [{
5584
+ selector: "co-commit-buttons",
5585
+ template: `
5586
+ <div class="commit-buttons-wrapper" @showHideSaveCancel>
5587
+ <div class="commit-buttons-button save" [class.finished]="commitFinished"
5588
+ (click)="commitClick.emit($event)">
5589
+ <div class="save-button-spinner" *ngIf="committing || commitFinished">
5590
+ <div #animatediv></div>
5591
+ <div #animatediv></div>
5592
+ <div #animatediv></div>
5593
+ <div #animatediv></div>
5594
+ </div>
5595
+ <div class="spinner-checkmark" *ngIf="!committing || commitFinished"></div>
5596
+ </div>
5597
+ <div class="commit-buttons-button cancel" (click)="cancelClick.emit($event)">
5598
+ <div class="cancel-button"></div>
5599
+ </div>
5600
+ </div>
5601
+ `,
5602
+ animations: [
5603
+ trigger('showHideSaveCancel', [
5604
+ state('*', style({ transform: 'scaleY(1)', opacity: 1 })),
5605
+ state('void', style({ transform: 'scaleY(0)', opacity: 0 })),
5606
+ transition('void <=> *', animate(200))
5607
+ ]),
5608
+ ],
5609
+ encapsulation: ViewEncapsulation.None
5610
+ },] }
5611
+ ];
5612
+ CommitButtonsComponent.ctorParameters = () => [
5613
+ { type: Renderer2 }
5614
+ ];
5615
+ CommitButtonsComponent.propDecorators = {
5616
+ content: [{ type: ViewChildren, args: ['animatediv', { read: ElementRef },] }],
5617
+ committing: [{ type: Input }],
5618
+ commitFinished: [{ type: Input }],
5619
+ cancelClick: [{ type: Output }],
5620
+ commitClick: [{ type: Output }],
5621
+ showClass: [{ type: HostBinding, args: ["class.co-commit-buttons",] }]
5622
+ };
5623
+
5624
+ class CommitButtonsModule {
5625
+ }
5626
+ CommitButtonsModule.decorators = [
5627
+ { type: NgModule, args: [{
5628
+ imports: [
5629
+ CommonModule
5630
+ ],
5631
+ declarations: [
5632
+ CommitButtonsComponent
5633
+ ],
5634
+ exports: [
5635
+ CommitButtonsComponent
5636
+ ]
5637
+ },] }
5638
+ ];
5639
+
5640
+ class InputTextModule {
5641
+ }
5642
+ InputTextModule.decorators = [
5643
+ { type: NgModule, args: [{
5644
+ imports: [
5645
+ BaseModule,
5646
+ CommonModule,
5647
+ FormsModule,
5648
+ IconModule,
5649
+ AppendPipeModule,
5650
+ TextBoxAllModule,
5651
+ NumericTextBoxModule,
5652
+ ValidationErrorModule,
5653
+ CommitButtonsModule
5654
+ ],
5655
+ declarations: [
5656
+ InputTextComponent
5322
5657
  ],
5323
5658
  exports: [
5324
5659
  InputTextComponent
@@ -5374,6 +5709,9 @@ InputRadioButtonComponent.decorators = [
5374
5709
  `,
5375
5710
  providers: [{
5376
5711
  provide: COMPONENT_INTERFACE_NAME, useExisting: forwardRef(() => InputRadioButtonComponent)
5712
+ }, {
5713
+ provide: BaseInputComponent,
5714
+ useExisting: InputRadioButtonComponent
5377
5715
  }],
5378
5716
  changeDetection: ChangeDetectionStrategy.OnPush,
5379
5717
  encapsulation: ViewEncapsulation.None
@@ -5448,6 +5786,9 @@ InputTextareaComponent.decorators = [
5448
5786
  providers: [{
5449
5787
  provide: COMPONENT_INTERFACE_NAME,
5450
5788
  useExisting: forwardRef(() => InputTextareaComponent)
5789
+ }, {
5790
+ provide: BaseInputComponent,
5791
+ useExisting: InputTextareaComponent
5451
5792
  }],
5452
5793
  encapsulation: ViewEncapsulation.None
5453
5794
  },] }
@@ -5549,6 +5890,9 @@ MultiSelectListComponent.decorators = [
5549
5890
  {
5550
5891
  provide: COMPONENT_INTERFACE_NAME,
5551
5892
  useExisting: forwardRef(() => MultiSelectListComponent)
5893
+ }, {
5894
+ provide: BaseInputComponent,
5895
+ useExisting: MultiSelectListComponent
5552
5896
  }
5553
5897
  ],
5554
5898
  encapsulation: ViewEncapsulation.None
@@ -7057,6 +7401,9 @@ InputListboxComponent.decorators = [
7057
7401
  `,
7058
7402
  providers: [{
7059
7403
  provide: COMPONENT_INTERFACE_NAME, useExisting: forwardRef(() => InputListboxComponent)
7404
+ }, {
7405
+ provide: BaseInputComponent,
7406
+ useExisting: InputListboxComponent
7060
7407
  }],
7061
7408
  encapsulation: ViewEncapsulation.None
7062
7409
  },] }
@@ -7109,6 +7456,10 @@ var ColumnAlign;
7109
7456
  class SimpleGridColumnDirective {
7110
7457
  constructor() {
7111
7458
  this.resizable = true;
7459
+ this.required = false;
7460
+ this.readonly = false;
7461
+ this.order = 0;
7462
+ this.singleColumn = false;
7112
7463
  }
7113
7464
  set template(template) {
7114
7465
  if (template) {
@@ -7118,6 +7469,33 @@ class SimpleGridColumnDirective {
7118
7469
  get template() {
7119
7470
  return this._template;
7120
7471
  }
7472
+ set editTemplate(template) {
7473
+ if (template) {
7474
+ this._editTemplate = template;
7475
+ }
7476
+ }
7477
+ get editTemplate() {
7478
+ return this._editTemplate;
7479
+ }
7480
+ ngOnInit() {
7481
+ this._setSingleColumnProps();
7482
+ }
7483
+ getFieldValue(value) {
7484
+ if (this.collection && this.displayField) {
7485
+ const result = this.collection.find(c => c[this.codeField] === value);
7486
+ if (result) {
7487
+ return result[this.displayField];
7488
+ }
7489
+ }
7490
+ return value;
7491
+ }
7492
+ _setSingleColumnProps() {
7493
+ if (this.singleColumn) {
7494
+ this.resizable = false;
7495
+ this.readonly = true;
7496
+ this.width = 0;
7497
+ }
7498
+ }
7121
7499
  }
7122
7500
  SimpleGridColumnDirective._MinManualResizeWidthPx = 50;
7123
7501
  SimpleGridColumnDirective.decorators = [
@@ -7126,33 +7504,45 @@ SimpleGridColumnDirective.decorators = [
7126
7504
  },] }
7127
7505
  ];
7128
7506
  SimpleGridColumnDirective.propDecorators = {
7129
- template: [{ type: ContentChild, args: [TemplateRef,] }],
7507
+ template: [{ type: ContentChild, args: ['template',] }],
7508
+ editTemplate: [{ type: ContentChild, args: ['editTemplate',] }],
7130
7509
  headerText: [{ type: Input }],
7131
7510
  field: [{ type: Input }],
7511
+ codeField: [{ type: Input }],
7512
+ displayField: [{ type: Input }],
7132
7513
  textAlign: [{ type: Input }],
7133
7514
  format: [{ type: Input }],
7134
7515
  resizable: [{ type: Input }],
7135
- width: [{ type: Input }]
7516
+ required: [{ type: Input }],
7517
+ width: [{ type: Input }],
7518
+ readonly: [{ type: Input }],
7519
+ collection: [{ type: Input }],
7520
+ order: [{ type: Input }],
7521
+ singleColumn: [{ type: Input }]
7136
7522
  };
7137
7523
 
7138
- class SimpleGridComponent {
7524
+ class BaseSimpleGridComponent {
7139
7525
  constructor() {
7140
- this.defaultTextAlign = ColumnAlign.Left;
7141
7526
  this.data = [];
7142
7527
  this.dragDropEnabled = false;
7528
+ this.inlineEdit = false;
7529
+ this.showToolbar = false;
7143
7530
  /**
7144
7531
  * Should component emit drag and drop actions instead of handle
7145
7532
  * (update collection) by itself
7146
7533
  */
7147
7534
  this.emitDragDrop = false;
7148
7535
  this.onDrop = new EventEmitter();
7536
+ this.selectRow = new EventEmitter();
7537
+ this.dblClickRow = new EventEmitter();
7538
+ this.saveRow = new EventEmitter();
7149
7539
  this.columns = [];
7150
7540
  }
7151
7541
  set content(columnComponents) {
7152
- this.columns = columnComponents.toArray();
7542
+ this._setColumns(columnComponents.toArray());
7153
7543
  }
7154
- showClass() {
7155
- return true;
7544
+ set extraColumns(value) {
7545
+ this._setColumns(value);
7156
7546
  }
7157
7547
  handleMouseMove(event) {
7158
7548
  if (event.buttons === 1 && this._columnForResize) {
@@ -7190,14 +7580,283 @@ class SimpleGridComponent {
7190
7580
  console.error(e);
7191
7581
  }
7192
7582
  }
7583
+ _setColumns(columns) {
7584
+ this.columns.push(...columns);
7585
+ this.columns.sort((a, b) => a.order < b.order ? -1 : 1);
7586
+ }
7587
+ }
7588
+ BaseSimpleGridComponent.decorators = [
7589
+ { type: Directive }
7590
+ ];
7591
+ BaseSimpleGridComponent.propDecorators = {
7592
+ content: [{ type: ContentChildren, args: [SimpleGridColumnDirective,] }],
7593
+ data: [{ type: Input }],
7594
+ dragDropEnabled: [{ type: Input }],
7595
+ inlineEdit: [{ type: Input }],
7596
+ showToolbar: [{ type: Input }],
7597
+ emitDragDrop: [{ type: Input }],
7598
+ extraColumns: [{ type: Input }],
7599
+ onDrop: [{ type: Output }],
7600
+ selectRow: [{ type: Output }],
7601
+ dblClickRow: [{ type: Output }],
7602
+ saveRow: [{ type: Output }],
7603
+ handleMouseMove: [{ type: HostListener, args: ['document:mousemove', ['$event'],] }],
7604
+ handleMouseUp: [{ type: HostListener, args: ['document:mouseup', ['$event'],] }]
7605
+ };
7606
+
7607
+ class SimpleGridComponent extends BaseSimpleGridComponent {
7608
+ constructor(_changeDetection, _formMaster) {
7609
+ super();
7610
+ this._changeDetection = _changeDetection;
7611
+ this._formMaster = _formMaster;
7612
+ this.defaultTextAlign = ColumnAlign.Left;
7613
+ this.editting = false;
7614
+ this.editRowIndex = -1;
7615
+ this.editCellIndex = -1;
7616
+ this.selectedRowIndex = -1;
7617
+ this._doubleClicked = false;
7618
+ this._newRow = false;
7619
+ }
7620
+ showClass() {
7621
+ return true;
7622
+ }
7623
+ handleKeyDown(event) {
7624
+ if (!this.inlineEdit) {
7625
+ return;
7626
+ }
7627
+ if (event.code === 'Tab') {
7628
+ event.preventDefault();
7629
+ this._nextAvailableCellToEdit(!event.shiftKey, this.editCellIndex)
7630
+ .then((index) => {
7631
+ this.editCellIndex = index;
7632
+ this._changeDetection.markForCheck();
7633
+ });
7634
+ this._detectChanges();
7635
+ }
7636
+ if (event.code === 'Escape') {
7637
+ this.cancelEditRow();
7638
+ }
7639
+ if (event.code === 'Enter') {
7640
+ this.validateAndSave();
7641
+ }
7642
+ }
7643
+ isSingleColumn(column) {
7644
+ return column.singleColumn;
7645
+ }
7646
+ rowContainsSingleColumn(row, columns) {
7647
+ const singleColumn = columns.find(column => this.isSingleColumn(column) && !!row[column.field]);
7648
+ return !!singleColumn;
7649
+ }
7650
+ addRow() {
7651
+ const valid = this.validateAndSave();
7652
+ this._detectChanges();
7653
+ if (valid) {
7654
+ this.data.unshift({});
7655
+ this._newRow = true;
7656
+ this.editRowIndex = 0;
7657
+ this._nextAvailableCellToEdit(true).then((index) => {
7658
+ this.editCellIndex = index;
7659
+ });
7660
+ this.editting = true;
7661
+ this.rowToEdit = this.data[0];
7662
+ this._detectChanges();
7663
+ }
7664
+ }
7665
+ validateAndSave(stopEditting = true) {
7666
+ if (!this.editting) {
7667
+ return true;
7668
+ }
7669
+ const valid = this._formMaster.submitSlaves();
7670
+ this._detectChanges();
7671
+ if (valid) {
7672
+ this._saveRow(stopEditting);
7673
+ return true;
7674
+ }
7675
+ }
7676
+ cancelEditRow() {
7677
+ if (!this.editting) {
7678
+ return;
7679
+ }
7680
+ if (this._newRow) {
7681
+ this.data.shift();
7682
+ }
7683
+ else {
7684
+ this.data[this.editRowIndex] = this.rowToEdit;
7685
+ }
7686
+ this._newRow = false;
7687
+ this.editting = false;
7688
+ this._detectChanges();
7689
+ }
7690
+ handleClickRow(event, index) {
7691
+ setTimeout(() => {
7692
+ if (this._doubleClicked) {
7693
+ return;
7694
+ }
7695
+ this.selectTheRow(index);
7696
+ }, 200);
7697
+ }
7698
+ selectTheRow(index, emit = true) {
7699
+ if (this.selectedRowIndex !== index && ((this.editting && this.validateAndSave()) || !this.editting)) {
7700
+ this.selectedRowIndex = index;
7701
+ if (emit) {
7702
+ this.selectRow.next(this.data[this.selectedRowIndex]);
7703
+ }
7704
+ }
7705
+ this._detectChanges();
7706
+ }
7707
+ handleDblClickRow(event, index) {
7708
+ this._doubleClicked = true;
7709
+ this.dblClickRow.next(this.data[index]);
7710
+ this.selectTheRow(index, false);
7711
+ if (this.inlineEdit) {
7712
+ this.editRow(event);
7713
+ }
7714
+ this._resetDblClick();
7715
+ }
7716
+ editRow(event) {
7717
+ this.editRowIndex = this.selectedRowIndex;
7718
+ this.rowToEdit = this.data[this.editRowIndex];
7719
+ this.editting = true;
7720
+ this._nextAvailableCellToEdit(true).then((index) => {
7721
+ this.editCellIndex = index;
7722
+ });
7723
+ this._detectChanges();
7724
+ }
7725
+ handleCellClick(index) {
7726
+ this.editCellIndex = index;
7727
+ this._detectChanges();
7728
+ }
7729
+ _resetDblClick() {
7730
+ setTimeout(() => {
7731
+ this._doubleClicked = false;
7732
+ }, 500);
7733
+ }
7734
+ /**
7735
+ *
7736
+ * @param next; Move to next or previous cell
7737
+ * @param start; Start from cellindex
7738
+ * @private
7739
+ */
7740
+ _nextAvailableCellToEdit(next, start = -1) {
7741
+ return new Promise((resolve, reject) => {
7742
+ const numEditableColumns = this.columns.filter(c => !c.readonly).length;
7743
+ const wantedIndex = start + (next ? 1 : -1);
7744
+ if (wantedIndex >= numEditableColumns) {
7745
+ this._getNextEditRowIndex()
7746
+ .then((index) => {
7747
+ this.editRowIndex = index;
7748
+ resolve(this._getNextEditCellIndex(0));
7749
+ })
7750
+ .catch((e) => {
7751
+ reject();
7752
+ });
7753
+ }
7754
+ else if (wantedIndex < 0) {
7755
+ this._getPreviousEditRowIndex()
7756
+ .then((index) => {
7757
+ this.editRowIndex = index;
7758
+ resolve(this._getPreviousEditCellIndex(this.columns.length - 1));
7759
+ })
7760
+ .catch((e) => {
7761
+ reject();
7762
+ });
7763
+ }
7764
+ else {
7765
+ resolve(next ? this._getNextEditCellIndex(start + 1) : this._getPreviousEditCellIndex(start - 1));
7766
+ }
7767
+ });
7768
+ }
7769
+ _getNextEditCellIndex(start) {
7770
+ for (let i = start; i < this.columns.length; i++) {
7771
+ if (!this.columns[i].readonly) {
7772
+ return i;
7773
+ }
7774
+ }
7775
+ }
7776
+ _getPreviousEditCellIndex(start) {
7777
+ for (let i = start; i >= 0; i--) {
7778
+ if (!this.columns[i].readonly) {
7779
+ return i;
7780
+ }
7781
+ }
7782
+ }
7783
+ _getNextEditRowIndex() {
7784
+ return new Promise((resolve, reject) => {
7785
+ let newRowIndex = 0;
7786
+ if (this.editRowIndex + 1 >= this.data.length) {
7787
+ newRowIndex = 0;
7788
+ }
7789
+ else {
7790
+ newRowIndex = this.editRowIndex + 1;
7791
+ }
7792
+ if (newRowIndex !== this.editRowIndex) { // go to different row validate current one first
7793
+ if (this.validateAndSave(false)) {
7794
+ this.rowToEdit = this.data[newRowIndex];
7795
+ resolve(newRowIndex);
7796
+ }
7797
+ else {
7798
+ reject();
7799
+ }
7800
+ }
7801
+ else {
7802
+ resolve(newRowIndex);
7803
+ }
7804
+ });
7805
+ }
7806
+ _getPreviousEditRowIndex() {
7807
+ return new Promise((resolve, reject) => {
7808
+ let newRowIndex = 0;
7809
+ if (this.editRowIndex - 1 < 0) {
7810
+ newRowIndex = this.data.length - 1;
7811
+ }
7812
+ else {
7813
+ newRowIndex = this.editRowIndex - 1;
7814
+ }
7815
+ if (newRowIndex !== this.editRowIndex) { // go to different row validate current one first
7816
+ if (this.validateAndSave(false)) {
7817
+ this.rowToEdit = this.data[newRowIndex];
7818
+ resolve(newRowIndex);
7819
+ }
7820
+ else {
7821
+ reject();
7822
+ }
7823
+ }
7824
+ else {
7825
+ resolve(newRowIndex);
7826
+ }
7827
+ });
7828
+ }
7829
+ _saveRow(stopEditting = true) {
7830
+ // emit saveEvent
7831
+ if (this.rowToEdit) {
7832
+ this.saveRow.next(this.rowToEdit);
7833
+ }
7834
+ this._newRow = false;
7835
+ if (stopEditting) {
7836
+ this.editRowIndex = -1;
7837
+ this.editCellIndex = -1;
7838
+ this.editting = false;
7839
+ this.rowToEdit = undefined;
7840
+ }
7841
+ this._detectChanges();
7842
+ }
7843
+ _detectChanges() {
7844
+ this._changeDetection.detectChanges();
7845
+ }
7193
7846
  }
7194
7847
  SimpleGridComponent.decorators = [
7195
7848
  { type: Component, args: [{
7196
7849
  selector: "co-simple-grid",
7197
7850
  template: `
7851
+ <co-grid-toolbar *ngIf="inlineEdit && showToolbar"
7852
+ (addClick)="addRow()"
7853
+ (editClick)="editRow($event)"
7854
+ (saveClick)="validateAndSave()"
7855
+ (cancelClick)="cancelEditRow()"
7856
+ ></co-grid-toolbar>
7198
7857
  <div class="simple-grid-column-header-wrapper">
7199
7858
  <div class="simple-grid-column-header" *ngFor="let column of columns; let index = index"
7200
- [style.min-width.px]="column.width" [style.max-width.px]="column.width">
7859
+ [style.min-width.px]="column.width" [style.max-width.px]="column.width" [style.padding-right.px]="isSingleColumn(column) ? 0 : 5">
7201
7860
  <div class="simple-grid-column-header-label" [ngClass]="column.textAlign ? column.textAlign : defaultTextAlign"
7202
7861
  [textContent]="column.headerText"
7203
7862
  ></div>
@@ -7214,34 +7873,201 @@ SimpleGridComponent.decorators = [
7214
7873
  [cdkDropListEnterPredicate]="handleCanDragDrop"
7215
7874
  (cdkDropListDropped)="handleDrop($event)"
7216
7875
  >
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>
7876
+ <div class="simple-grid-row" [class.selected]="rowIndex === selectedRowIndex"
7877
+ [class.editting]="rowIndex === editRowIndex" *ngFor="let row of data; let rowIndex = index" cdkDrag
7878
+ (click)="handleClickRow($event, rowIndex)" (dblclick)="handleDblClickRow($event, rowIndex)">
7879
+ <co-form class="simple-grid-row-form">
7880
+ <div class="simple-grid-column-cell" *ngFor="let column of columns; let columnIndex = index"
7881
+ [style.min-width]="isSingleColumn(column) ? 'fit-content' : column.width" [style.max-width.px]="column.width"
7882
+ [style.padding-right.px]="isSingleColumn(column) ? 0 : 5" >
7883
+ <co-simple-grid-cell
7884
+ [column]="column"
7885
+ [row]="row"
7886
+ [editMode]="inlineEdit && editting && rowIndex === editRowIndex && !isSingleColumn(column) && !rowContainsSingleColumn(row, columns)"
7887
+ [fieldEditMode]="editCellIndex === columnIndex"
7888
+ (cellClick)="handleCellClick(columnIndex)"
7889
+ ></co-simple-grid-cell>
7890
+ <div *ngIf="column.resizable" class="simple-grid-column-sizer-placeholder"></div>
7225
7891
  </div>
7226
- <div *ngIf="column.resizable" class="simple-grid-column-sizer-placeholder"></div>
7227
- </div>
7892
+ </co-form>
7228
7893
  </div>
7229
7894
  </div>
7230
7895
  </div>
7231
7896
  `,
7897
+ providers: [
7898
+ FormMasterService
7899
+ ],
7232
7900
  changeDetection: ChangeDetectionStrategy.OnPush,
7233
7901
  encapsulation: ViewEncapsulation.None
7234
7902
  },] }
7235
7903
  ];
7904
+ SimpleGridComponent.ctorParameters = () => [
7905
+ { type: ChangeDetectorRef },
7906
+ { type: FormMasterService }
7907
+ ];
7236
7908
  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
7909
  showClass: [{ type: HostBinding, args: ["class.co-simple-grid",] }],
7243
- handleMouseMove: [{ type: HostListener, args: ['document:mousemove', ['$event'],] }],
7244
- handleMouseUp: [{ type: HostListener, args: ['document:mouseup', ['$event'],] }]
7910
+ handleKeyDown: [{ type: HostListener, args: ['keydown', ['$event'],] }]
7911
+ };
7912
+
7913
+ class SimpleGridCellComponent {
7914
+ constructor(_changeDetector) {
7915
+ this._changeDetector = _changeDetector;
7916
+ this.defaultTextAlign = ColumnAlign.Left;
7917
+ this.editMode = false;
7918
+ this.cellClick = new EventEmitter();
7919
+ this._fieldEditMode = false;
7920
+ this._focused = false;
7921
+ }
7922
+ set editTemplateContent(template) {
7923
+ if (template) {
7924
+ this._editTemplate = template;
7925
+ this._setFocusComponent();
7926
+ }
7927
+ }
7928
+ set noEditTemplateContent(template) {
7929
+ if (template) {
7930
+ this._template = template;
7931
+ this._setFocusComponent();
7932
+ }
7933
+ }
7934
+ set noTemplateContent(template) {
7935
+ if (template) {
7936
+ this._inputTemplate = template;
7937
+ this._setFocusComponent();
7938
+ }
7939
+ }
7940
+ set fieldEditMode(value) {
7941
+ this._fieldEditMode = value;
7942
+ this._setFocusComponent();
7943
+ }
7944
+ get fieldEditMode() {
7945
+ return this._fieldEditMode;
7946
+ }
7947
+ showClass() {
7948
+ return true;
7949
+ }
7950
+ handleClick(event) {
7951
+ if (this.column && !this.column.readonly) {
7952
+ this.cellClick.next();
7953
+ }
7954
+ }
7955
+ _setFocusComponent() {
7956
+ if (this.editMode && this.fieldEditMode) {
7957
+ const element = this._getElement();
7958
+ if (element) {
7959
+ const focusEvent = this._createNewEvent(element, 'focus');
7960
+ element.focus();
7961
+ element.dispatchEvent(focusEvent);
7962
+ this._focused = true;
7963
+ }
7964
+ }
7965
+ else {
7966
+ if (this._focused) {
7967
+ const element = this._getElement();
7968
+ if (element) {
7969
+ const blurEvent = this._createNewEvent(element, 'blur');
7970
+ element.blur();
7971
+ element.dispatchEvent(blurEvent);
7972
+ }
7973
+ this._focused = false;
7974
+ }
7975
+ }
7976
+ this._detectChanges();
7977
+ }
7978
+ _getFirstFormInput(parent) {
7979
+ if (parent) {
7980
+ const collection = Array.from(parent.getElementsByTagName('input'));
7981
+ const otherCollection = Array.from(parent.getElementsByTagName('textarea'));
7982
+ otherCollection.map(o => collection.push(o));
7983
+ if (collection.length > 0) {
7984
+ return collection[0];
7985
+ }
7986
+ }
7987
+ }
7988
+ _createNewEvent(element, eventType) {
7989
+ let event;
7990
+ if ("createEvent" in document) {
7991
+ event = document.createEvent("Event");
7992
+ event.initEvent(eventType, true, true);
7993
+ }
7994
+ else if ("Event" in window) {
7995
+ event = new Event(eventType, { bubbles: true, cancelable: true });
7996
+ }
7997
+ return event;
7998
+ }
7999
+ _getElement() {
8000
+ let templ;
8001
+ if (this._editTemplate) {
8002
+ templ = this._editTemplate;
8003
+ }
8004
+ else if (this._template) {
8005
+ templ = this._template;
8006
+ }
8007
+ else {
8008
+ templ = this._inputTemplate;
8009
+ }
8010
+ if (templ) {
8011
+ if (templ && templ.elementRef) {
8012
+ const inputElement = this._getFirstFormInput(templ.elementRef.nativeElement.parentElement);
8013
+ if (inputElement) {
8014
+ return inputElement;
8015
+ }
8016
+ }
8017
+ }
8018
+ }
8019
+ _detectChanges() {
8020
+ this._changeDetector.detectChanges();
8021
+ }
8022
+ }
8023
+ SimpleGridCellComponent.decorators = [
8024
+ { type: Component, args: [{
8025
+ selector: "co-simple-grid-cell",
8026
+ template: `
8027
+ <div class="simple-grid-column-cell-value" [ngClass]="column.textAlign ? column.textAlign : defaultTextAlign">
8028
+ <ng-container *ngIf="editMode; else noInlineEdit">
8029
+ <ng-container #editTemplate *ngIf="column.editTemplate; else noEditTemplate"
8030
+ [ngTemplateOutlet]="column.editTemplate"
8031
+ [ngTemplateOutletContext]="{value: row[column.field], row: row}"></ng-container>
8032
+ <ng-template #noEditTemplate>
8033
+ <ng-container *ngIf="column.template; else noTemplate">
8034
+ <ng-container [ngTemplateOutlet]="column.template"
8035
+ [ngTemplateOutletContext]="{value: row[column.field], row: row}"></ng-container>
8036
+ </ng-container>
8037
+ <ng-template #noTemplate>
8038
+ <co-input-text [(model)]="row[column.field]" [required]="column.required"></co-input-text>
8039
+ </ng-template>
8040
+ </ng-template>
8041
+ </ng-container>
8042
+ <ng-template #noInlineEdit>
8043
+ <ng-container *ngIf="column.template; else noTemplate">
8044
+ <ng-container [ngTemplateOutlet]="column.template"
8045
+ [ngTemplateOutletContext]="{value: row[column.field], row: row}"></ng-container>
8046
+ </ng-container>
8047
+ <ng-template #noTemplate>
8048
+ <div [textContent]="column.getFieldValue(row[column.field])"></div>
8049
+ </ng-template>
8050
+ </ng-template>
8051
+ </div>
8052
+ `,
8053
+ encapsulation: ViewEncapsulation.None,
8054
+ changeDetection: ChangeDetectionStrategy.OnPush
8055
+ },] }
8056
+ ];
8057
+ SimpleGridCellComponent.ctorParameters = () => [
8058
+ { type: ChangeDetectorRef }
8059
+ ];
8060
+ SimpleGridCellComponent.propDecorators = {
8061
+ editTemplateContent: [{ type: ViewChild, args: ["editTemplate", { read: BaseInputComponent },] }],
8062
+ noEditTemplateContent: [{ type: ViewChild, args: ["noEditTemplate",] }],
8063
+ noTemplateContent: [{ type: ViewChild, args: ["noTemplate",] }],
8064
+ column: [{ type: Input }],
8065
+ row: [{ type: Input }],
8066
+ editMode: [{ type: Input }],
8067
+ fieldEditMode: [{ type: Input }],
8068
+ cellClick: [{ type: Output }],
8069
+ showClass: [{ type: HostBinding, args: ["class.co-simple-grid-cell",] }],
8070
+ handleClick: [{ type: HostListener, args: ['click', ['$event'],] }]
7245
8071
  };
7246
8072
 
7247
8073
  class SimpleGridModule {
@@ -7250,14 +8076,19 @@ SimpleGridModule.decorators = [
7250
8076
  { type: NgModule, args: [{
7251
8077
  imports: [
7252
8078
  CommonModule,
7253
- DragDropModule
8079
+ DragDropModule,
8080
+ GridToolbarModule,
8081
+ InputTextModule,
8082
+ FormModule
7254
8083
  ],
7255
8084
  declarations: [
7256
8085
  SimpleGridComponent,
8086
+ SimpleGridCellComponent,
7257
8087
  SimpleGridColumnDirective
7258
8088
  ],
7259
8089
  exports: [
7260
8090
  SimpleGridComponent,
8091
+ SimpleGridCellComponent,
7261
8092
  SimpleGridColumnDirective
7262
8093
  ]
7263
8094
  },] }
@@ -7511,11 +8342,7 @@ class Carousel3dComponent {
7511
8342
  boundingBox.getSize(size);
7512
8343
  // get the max side of the bounding box (fits to width OR height as needed )
7513
8344
  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;
8345
+ this._camera.position.z = Math.abs((maxDim / 2) * Math.atan(this._camera.fov / 2));
7519
8346
  this._camera.lookAt(center);
7520
8347
  }
7521
8348
  _checkNavigationButtons() {
@@ -7653,5 +8480,5 @@ Carousel3dModule.decorators = [
7653
8480
  * Generated bundle index. Do not edit.
7654
8481
  */
7655
8482
 
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 };
8483
+ 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, BaseSimpleGridComponent as ɵba, SimpleGridCellComponent as ɵbb, 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, CommitButtonsModule as ɵx, CommitButtonsComponent as ɵy, PopupShowerService as ɵz };
7657
8484
  //# sourceMappingURL=colijnit-corecomponents_v12.js.map