@colijnit/corecomponents_v12 12.0.28 → 12.0.29

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 (26) hide show
  1. package/bundles/colijnit-corecomponents_v12.umd.js +117 -30
  2. package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
  3. package/colijnit-corecomponents_v12.metadata.json +1 -1
  4. package/esm2015/lib/components/base/base-input.component.js +2 -2
  5. package/esm2015/lib/components/input-search/input-search.component.js +27 -20
  6. package/esm2015/lib/components/input-search/input-search.module.js +6 -2
  7. package/esm2015/lib/components/input-text/input-text.component.js +10 -4
  8. package/esm2015/lib/components/simple-grid/base-simple-grid.component.js +61 -8
  9. package/esm2015/lib/components/simple-grid/simple-grid-column.directive.js +7 -3
  10. package/esm2015/lib/components/simple-grid/simple-grid.component.js +59 -36
  11. package/fesm2015/colijnit-corecomponents_v12.js +158 -63
  12. package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
  13. package/lib/components/input-search/input-search.component.d.ts +7 -8
  14. package/lib/components/input-search/style/_layout.scss +0 -35
  15. package/lib/components/input-search/style/_material-definition.scss +0 -6
  16. package/lib/components/input-search/style/_theme.scss +0 -2
  17. package/lib/components/input-text/input-text.component.d.ts +3 -1
  18. package/lib/components/input-text/style/_layout.scss +11 -0
  19. package/lib/components/simple-grid/base-simple-grid.component.d.ts +12 -1
  20. package/lib/components/simple-grid/simple-grid-column.directive.d.ts +4 -1
  21. package/lib/components/simple-grid/simple-grid.component.d.ts +2 -1
  22. package/lib/components/simple-grid/style/_layout.scss +26 -9
  23. package/lib/components/simple-grid/style/_material-definition.scss +1 -1
  24. package/lib/style/_variables.scss +2 -2
  25. package/package.json +1 -1
  26. package/colijnit-corecomponents_v12-12.0.28.tgz +0 -0
@@ -4408,7 +4408,7 @@
4408
4408
  return node;
4409
4409
  }
4410
4410
  else if (node.children.length > 0) {
4411
- return this._findInputNode(node.children);
4411
+ this._findInputNode(node.children);
4412
4412
  }
4413
4413
  }
4414
4414
  };
@@ -6650,10 +6650,10 @@
6650
6650
  _this.formUserChangeListener = formUserChangeListener;
6651
6651
  _this.ngZoneWrapper = ngZoneWrapper;
6652
6652
  _this.elementRef = elementRef;
6653
- _this.Icons = exports.CoreComponentsIcon;
6654
6653
  _this.placeholder = "";
6655
6654
  _this.type = "text";
6656
6655
  _this.showClearButton = undefined;
6656
+ _this.showPlaceholderOnFocus = true;
6657
6657
  _this.hasOwnLabel = true;
6658
6658
  _super.prototype._markAsOnPush.call(_this);
6659
6659
  return _this;
@@ -6661,12 +6661,19 @@
6661
6661
  InputTextComponent.prototype.showClass = function () {
6662
6662
  return true;
6663
6663
  };
6664
+ Object.defineProperty(InputTextComponent.prototype, "hasLeftIcon", {
6665
+ get: function () {
6666
+ return this.leftIcon !== undefined && this.leftIcon !== null;
6667
+ },
6668
+ enumerable: false,
6669
+ configurable: true
6670
+ });
6664
6671
  return InputTextComponent;
6665
6672
  }(BaseInputComponent));
6666
6673
  InputTextComponent.decorators = [
6667
6674
  { type: core.Component, args: [{
6668
6675
  selector: "co-input-text",
6669
- template: "\n <label [textContent]=\"placeholder\"></label>\n <input #input\n [type]=\"type\"\n [ngModel]=\"model\"\n [readonly]=\"readonly\"\n [required]=\"required\"\n (ngModelChange)=\"modelChange.emit($event)\"\n >\n <co-commit-buttons *ngIf=\"showSaveCancel && focused && canSaveOrCancel\"\n [committing]=\"committing\"\n [commitFinished]=\"commitFinished\"\n (commitClick)=\"commitClick($event)\"\n (cancelClick)=\"cancelClick($event)\"\n >\n </co-commit-buttons>\n <div class=\"required-indicator\"></div>\n <ng-template #validationError></ng-template>\n ",
6676
+ template: "\n <label *ngIf=\"showPlaceholderOnFocus || (!showPlaceholderOnFocus && !hasValue && !focused)\" [textContent]=\"placeholder\"></label>\n <co-icon *ngIf=\"leftIcon\" class=\"input-text-left-icon\" [icon]=\"leftIcon\"></co-icon>\n <input #input\n [type]=\"type\"\n [ngModel]=\"model\"\n [readonly]=\"readonly\"\n [required]=\"required\"\n (ngModelChange)=\"modelChange.emit($event)\"\n >\n <co-commit-buttons *ngIf=\"showSaveCancel && focused && canSaveOrCancel\"\n [committing]=\"committing\"\n [commitFinished]=\"commitFinished\"\n (commitClick)=\"commitClick($event)\"\n (cancelClick)=\"cancelClick($event)\"\n >\n </co-commit-buttons>\n <div class=\"required-indicator\"></div>\n <ng-template #validationError></ng-template>\n ",
6670
6677
  providers: [{
6671
6678
  provide: COMPONENT_INTERFACE_NAME,
6672
6679
  useExisting: core.forwardRef(function () { return InputTextComponent; })
@@ -6690,7 +6697,10 @@
6690
6697
  type: [{ type: core.Input }],
6691
6698
  showClearButton: [{ type: core.Input }],
6692
6699
  keyDownWhiteList: [{ type: core.Input }],
6700
+ showPlaceholderOnFocus: [{ type: core.Input }],
6701
+ leftIcon: [{ type: core.Input }],
6693
6702
  showClass: [{ type: core.HostBinding, args: ["class.co-input-text",] }],
6703
+ hasLeftIcon: [{ type: core.HostBinding, args: ['class.has-left-icon',] }],
6694
6704
  hasOwnLabel: [{ type: core.HostBinding, args: ["class.has-own-label",] }]
6695
6705
  };
6696
6706
 
@@ -6939,36 +6949,39 @@
6939
6949
  },] }
6940
6950
  ];
6941
6951
 
6942
- var InputSearchComponent = /** @class */ (function () {
6943
- function InputSearchComponent(_elementRef) {
6944
- this._elementRef = _elementRef;
6945
- this.searchIcon = exports.CoreComponentsIcon.Magnifier;
6952
+ var InputSearchComponent = /** @class */ (function (_super) {
6953
+ __extends(InputSearchComponent, _super);
6954
+ function InputSearchComponent() {
6955
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
6956
+ _this.searchIcon = exports.CoreComponentsIcon.Magnifier;
6957
+ _this.search = new core.EventEmitter();
6958
+ return _this;
6946
6959
  }
6947
6960
  InputSearchComponent.prototype.showClass = function () {
6948
6961
  return true;
6949
6962
  };
6950
- InputSearchComponent.prototype.ngOnDestroy = function () {
6951
- this._elementRef = undefined;
6952
- };
6953
- InputSearchComponent.prototype.focus = function () {
6954
- this._elementRef.nativeElement.focus();
6963
+ InputSearchComponent.prototype.handleKeyDown = function (event) {
6964
+ switch (event.code) {
6965
+ case 'Enter':
6966
+ event.preventDefault();
6967
+ this.search.next(this.model);
6968
+ return;
6969
+ }
6955
6970
  };
6956
6971
  return InputSearchComponent;
6957
- }());
6972
+ }(BaseInputComponent));
6958
6973
  InputSearchComponent.decorators = [
6959
6974
  { type: core.Component, args: [{
6960
- selector: "co-input-search",
6961
- template: "\n <co-icon class=\"search-icon\" [icon]=\"searchIcon\"></co-icon>\n <input class=\"input\" [placeholder]=\"placeHolderText\">\n ",
6975
+ selector: 'co-input-search',
6976
+ template: "\n <co-input-text\n [model]=\"model\"\n [leftIcon]=\"searchIcon\"\n [placeholder]=\"placeholder\"\n [showPlaceholderOnFocus]=\"false\"\n (modelChange)=\"modelChange.emit($event)\"\n ></co-input-text>\n ",
6962
6977
  changeDetection: core.ChangeDetectionStrategy.OnPush,
6963
6978
  encapsulation: core.ViewEncapsulation.None
6964
6979
  },] }
6965
6980
  ];
6966
- InputSearchComponent.ctorParameters = function () { return [
6967
- { type: core.ElementRef }
6968
- ]; };
6969
6981
  InputSearchComponent.propDecorators = {
6970
- placeHolderText: [{ type: core.Input }],
6971
- showClass: [{ type: core.HostBinding, args: ["class.co-input-search",] }]
6982
+ placeholder: [{ type: core.Input }],
6983
+ search: [{ type: core.Output }],
6984
+ showClass: [{ type: core.HostBinding, args: ['class.co-input-search',] }]
6972
6985
  };
6973
6986
 
6974
6987
  var InputSearchModule = /** @class */ (function () {
@@ -6980,7 +6993,9 @@
6980
6993
  { type: core.NgModule, args: [{
6981
6994
  imports: [
6982
6995
  common.CommonModule,
6983
- IconModule
6996
+ IconModule,
6997
+ forms.FormsModule,
6998
+ InputTextModule
6984
6999
  ],
6985
7000
  declarations: [InputSearchComponent],
6986
7001
  exports: [InputSearchComponent]
@@ -8583,7 +8598,8 @@
8583
8598
  ColumnAlign["Right"] = "right-align";
8584
8599
  })(exports.ColumnAlign || (exports.ColumnAlign = {}));
8585
8600
  var SimpleGridColumnDirective = /** @class */ (function () {
8586
- function SimpleGridColumnDirective() {
8601
+ function SimpleGridColumnDirective(elementRef) {
8602
+ this.elementRef = elementRef;
8587
8603
  this.resizable = true;
8588
8604
  this.required = false;
8589
8605
  this.readonly = false;
@@ -8642,6 +8658,9 @@
8642
8658
  selector: "co-simple-grid-column"
8643
8659
  },] }
8644
8660
  ];
8661
+ SimpleGridColumnDirective.ctorParameters = function () { return [
8662
+ { type: core.ElementRef }
8663
+ ]; };
8645
8664
  SimpleGridColumnDirective.propDecorators = {
8646
8665
  template: [{ type: core.ContentChild, args: ['template',] }],
8647
8666
  editTemplate: [{ type: core.ContentChild, args: ['editTemplate',] }],
@@ -8662,8 +8681,9 @@
8662
8681
 
8663
8682
  var BaseSimpleGridComponent = /** @class */ (function () {
8664
8683
  function BaseSimpleGridComponent() {
8665
- this.data = [];
8684
+ this.MIN_COLUMN_WIDTH = 60;
8666
8685
  this.dragDropEnabled = false;
8686
+ this.resizable = false;
8667
8687
  this.inlineEdit = false;
8668
8688
  this.showToolbar = false;
8669
8689
  /**
@@ -8676,10 +8696,25 @@
8676
8696
  this.dblClickRow = new core.EventEmitter();
8677
8697
  this.saveRow = new core.EventEmitter();
8678
8698
  this.columns = [];
8699
+ this.headerColumns = [];
8700
+ this._data = [];
8701
+ this._prepared = false;
8679
8702
  }
8680
8703
  Object.defineProperty(BaseSimpleGridComponent.prototype, "content", {
8681
8704
  set: function (columnComponents) {
8682
8705
  this._setColumns(columnComponents.toArray());
8706
+ this._prepareData();
8707
+ },
8708
+ enumerable: false,
8709
+ configurable: true
8710
+ });
8711
+ Object.defineProperty(BaseSimpleGridComponent.prototype, "data", {
8712
+ get: function () {
8713
+ return this._data;
8714
+ },
8715
+ set: function (value) {
8716
+ this._data = value;
8717
+ this._prepareData();
8683
8718
  },
8684
8719
  enumerable: false,
8685
8720
  configurable: true
@@ -8692,19 +8727,19 @@
8692
8727
  configurable: true
8693
8728
  });
8694
8729
  BaseSimpleGridComponent.prototype.handleMouseMove = function (event) {
8695
- if (event.buttons === 1 && this._columnForResize) {
8696
- if (!this._columnForResize.width) {
8697
- var rect = event.target.parentElement.getBoundingClientRect();
8698
- this._columnForResize.width = rect.width;
8699
- }
8700
- this._columnForResize.width += event.movementX;
8730
+ if (this.resizable && event.buttons === 1 && this._columnForResize) {
8731
+ this._columnForResize.width = this._columnForResize.originalWidth - (this._startMousePositionX - event.clientX);
8701
8732
  }
8702
8733
  };
8703
8734
  BaseSimpleGridComponent.prototype.handleMouseUp = function (event) {
8735
+ this._startMousePositionX = undefined;
8704
8736
  this._columnForResize = undefined;
8705
8737
  };
8706
8738
  BaseSimpleGridComponent.prototype.handleSizerMouseDown = function (event, column) {
8739
+ this._setWidthOfAllColumns();
8740
+ this._startMousePositionX = event.clientX;
8707
8741
  this._columnForResize = column;
8742
+ this._columnForResize.originalWidth = this._columnForResize.width;
8708
8743
  };
8709
8744
  BaseSimpleGridComponent.prototype.handleCanDragDrop = function (drag, drop) {
8710
8745
  return true;
@@ -8727,11 +8762,51 @@
8727
8762
  console.error(e);
8728
8763
  }
8729
8764
  };
8765
+ BaseSimpleGridComponent.prototype.isSingleColumnRow = function (row) {
8766
+ return row.hasOwnProperty('singleColumnIndex');
8767
+ };
8768
+ BaseSimpleGridComponent.prototype.singleColumnIndex = function (row) {
8769
+ return row.singleColumnIndex;
8770
+ };
8730
8771
  BaseSimpleGridComponent.prototype._setColumns = function (columns) {
8731
8772
  var _a;
8732
8773
  (_a = this.columns).push.apply(_a, __spreadArray([], __read(columns)));
8733
8774
  this.columns.sort(function (a, b) { return a.order < b.order ? -1 : 1; });
8734
8775
  };
8776
+ BaseSimpleGridComponent.prototype._prepareData = function () {
8777
+ if (this._prepared) {
8778
+ return;
8779
+ }
8780
+ if (this.columns && this.columns.length > 0 && this.data && this.data.length > 0) {
8781
+ this.headerColumns = this.columns.filter(function (c) { return !c.singleColumn; });
8782
+ var singleColumnIndex = -1;
8783
+ for (var i = 0; i < this.columns.length; i++) {
8784
+ if (this.columns[i].singleColumn) {
8785
+ singleColumnIndex = i;
8786
+ break;
8787
+ }
8788
+ }
8789
+ // first check if there's single column data
8790
+ if (singleColumnIndex > -1) {
8791
+ var field = this.columns[singleColumnIndex].field;
8792
+ for (var i = 0; i < this.data.length; i++) { // then mark row as single column row
8793
+ if (this.data[i][field] !== undefined && this.data[i][field] !== null && this.data[i][field] !== "") {
8794
+ // bit nasty to add prop, but cool for now
8795
+ this.data[i].singleColumnIndex = singleColumnIndex;
8796
+ }
8797
+ }
8798
+ }
8799
+ this._prepared = true;
8800
+ }
8801
+ };
8802
+ BaseSimpleGridComponent.prototype._setWidthOfAllColumns = function () {
8803
+ this.columns.forEach(function (column) {
8804
+ if ((column.width === undefined || column.width === null) && column.elementRef && column.elementRef.nativeElement) {
8805
+ var rect = column.elementRef.nativeElement.getBoundingClientRect();
8806
+ column.width = rect.width;
8807
+ }
8808
+ });
8809
+ };
8735
8810
  return BaseSimpleGridComponent;
8736
8811
  }());
8737
8812
  BaseSimpleGridComponent.decorators = [
@@ -8741,6 +8816,7 @@
8741
8816
  content: [{ type: core.ContentChildren, args: [SimpleGridColumnDirective,] }],
8742
8817
  data: [{ type: core.Input }],
8743
8818
  dragDropEnabled: [{ type: core.Input }],
8819
+ resizable: [{ type: core.Input }],
8744
8820
  inlineEdit: [{ type: core.Input }],
8745
8821
  showToolbar: [{ type: core.Input }],
8746
8822
  emitDragDrop: [{ type: core.Input }],
@@ -8768,6 +8844,16 @@
8768
8844
  _this._newRow = false;
8769
8845
  return _this;
8770
8846
  }
8847
+ Object.defineProperty(SimpleGridComponent.prototype, "headerCells", {
8848
+ set: function (cells) {
8849
+ var headerElements = cells.toArray();
8850
+ for (var i = 0; i < headerElements.length; i++) {
8851
+ this.columns[i].elementRef = headerElements[i];
8852
+ }
8853
+ },
8854
+ enumerable: false,
8855
+ configurable: true
8856
+ });
8771
8857
  SimpleGridComponent.prototype.showClass = function () {
8772
8858
  return true;
8773
8859
  };
@@ -9012,7 +9098,7 @@
9012
9098
  SimpleGridComponent.decorators = [
9013
9099
  { type: core.Component, args: [{
9014
9100
  selector: "co-simple-grid",
9015
- template: "\n <co-grid-toolbar *ngIf=\"inlineEdit && showToolbar\"\n (addClick)=\"addRow()\"\n (editClick)=\"editRow($event)\"\n (saveClick)=\"validateAndSave()\"\n (cancelClick)=\"cancelEditRow()\"\n ></co-grid-toolbar>\n <div class=\"simple-grid-column-header-wrapper\">\n <div class=\"simple-grid-column-header\" *ngFor=\"let column of columns; let index = index\"\n [style.min-width.px]=\"column.width\" [style.max-width.px]=\"column.width\" [style.padding-right.px]=\"isSingleColumn(column) ? 0 : 5\">\n <div class=\"simple-grid-column-header-label\" [ngClass]=\"column.textAlign ? column.textAlign : defaultTextAlign\"\n [textContent]=\"column.headerText\"\n ></div>\n <div *ngIf=\"column.resizable\" class=\"simple-grid-column-sizer\"\n (mousedown)=\"handleSizerMouseDown($event, column)\"\n ></div>\n </div>\n </div>\n <div cdkDropListGroup class=\"drop-list-group\">\n <div #dropList cdkDropList cdkDropListOrientation=\"vertical\"\n class=\"simple-grid-drag-drop-list\"\n [cdkDropListDisabled]=\"!dragDropEnabled\"\n [cdkDropListData]=\"data\"\n [cdkDropListEnterPredicate]=\"handleCanDragDrop\"\n (cdkDropListDropped)=\"handleDrop($event)\"\n >\n <div class=\"simple-grid-row\" [class.selected]=\"rowIndex === selectedRowIndex\"\n [class.editting]=\"rowIndex === editRowIndex\" *ngFor=\"let row of data; let rowIndex = index\" cdkDrag\n (click)=\"handleClickRow($event, rowIndex)\" (dblclick)=\"handleDblClickRow($event, rowIndex)\">\n <co-form class=\"simple-grid-row-form\">\n <div class=\"simple-grid-column-cell\" *ngFor=\"let column of columns; let columnIndex = index\"\n [style.min-width]=\"isSingleColumn(column) ? 'fit-content' : column.width\" [style.max-width.px]=\"column.width\"\n [style.padding-right.px]=\"isSingleColumn(column) ? 0 : 5\" >\n <co-simple-grid-cell\n [column]=\"column\"\n [row]=\"row\"\n [editMode]=\"inlineEdit && editting && rowIndex === editRowIndex && !isSingleColumn(column) && !rowContainsSingleColumn(row, columns)\"\n [fieldEditMode]=\"editCellIndex === columnIndex\"\n (cellClick)=\"handleCellClick(columnIndex)\"\n ></co-simple-grid-cell>\n <div *ngIf=\"column.resizable\" class=\"simple-grid-column-sizer-placeholder\"></div>\n </div>\n </co-form>\n </div>\n </div>\n </div>\n ",
9101
+ template: "\n <co-grid-toolbar *ngIf=\"inlineEdit && showToolbar\"\n (addClick)=\"addRow()\"\n (editClick)=\"editRow($event)\"\n (saveClick)=\"validateAndSave()\"\n (cancelClick)=\"cancelEditRow()\"\n ></co-grid-toolbar>\n <table class=\"simple-grid-table\">\n <colgroup>\n <col *ngFor=\"let column of headerColumns; let index = index\" [attr.width]=\"column.width\">\n </colgroup>\n <thead>\n <tr>\n <th scope=\"col\" #headerCell class=\"simple-grid-column-header\" *ngFor=\"let column of headerColumns; let index = index\">\n <div class=\"simple-grid-column-header-wrapper\" [class.resizable]=\"resizable\">\n <div class=\"simple-grid-column-header-label\" [ngClass]=\"column.textAlign ? column.textAlign : defaultTextAlign\"\n [textContent]=\"column.headerText\"\n ></div>\n <div *ngIf=\"resizable && column.resizable\" class=\"simple-grid-column-sizer\"\n (mousedown)=\"handleSizerMouseDown($event, column)\"\n ></div>\n </div>\n </th>\n </tr>\n </thead>\n <tbody #dropList cdkDropList cdkDropListOrientation=\"vertical\"\n class=\"simple-grid-drag-drop-list\"\n [cdkDropListDisabled]=\"!dragDropEnabled\"\n [cdkDropListData]=\"data\"\n [cdkDropListEnterPredicate]=\"handleCanDragDrop\"\n (cdkDropListDropped)=\"handleDrop($event)\">\n <tr class=\"simple-grid-row\" [class.selected]=\"rowIndex === selectedRowIndex\"\n [class.editting]=\"rowIndex === editRowIndex\" *ngFor=\"let row of data; let rowIndex = index\" cdkDrag\n (click)=\"handleClickRow($event, rowIndex)\" (dblclick)=\"handleDblClickRow($event, rowIndex)\">\n <co-form class=\"simple-grid-row-form\">\n <ng-container *ngIf=\"isSingleColumnRow(row)\">\n <td class=\"simple-grid-single-column-cell\" [attr.colspan]=\"headerColumns.length\">\n <co-simple-grid-cell\n [column]=\"columns[singleColumnIndex(row)]\"\n [row]=\"row\"\n [editMode]=\"false\"\n ></co-simple-grid-cell>\n </td>\n </ng-container>\n <ng-container *ngIf=\"!isSingleColumnRow(row)\">\n <ng-container *ngFor=\"let column of headerColumns; let columnIndex = index\">\n <td class=\"simple-grid-column-cell\" *ngIf=\"columnIndex !== singleColumnIndex(row)\">\n <co-simple-grid-cell\n [column]=\"column\"\n [row]=\"row\"\n [editMode]=\"inlineEdit && editting && rowIndex === editRowIndex\"\n [fieldEditMode]=\"editCellIndex === columnIndex\"\n (cellClick)=\"handleCellClick(columnIndex)\"\n ></co-simple-grid-cell>\n <div *ngIf=\"column.resizable\" class=\"simple-grid-column-sizer-placeholder\"></div>\n </td>\n </ng-container>\n </ng-container>\n </co-form>\n </tr>\n </tbody>\n </table>\n ",
9016
9102
  providers: [
9017
9103
  FormMasterService
9018
9104
  ],
@@ -9025,6 +9111,7 @@
9025
9111
  { type: FormMasterService }
9026
9112
  ]; };
9027
9113
  SimpleGridComponent.propDecorators = {
9114
+ headerCells: [{ type: core.ViewChildren, args: ["headerCell",] }],
9028
9115
  showClass: [{ type: core.HostBinding, args: ["class.co-simple-grid",] }],
9029
9116
  handleKeyDown: [{ type: core.HostListener, args: ['keydown', ['$event'],] }]
9030
9117
  };