basesite-shared-grid-lib 15.10.310 → 15.10.312

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.
@@ -11,6 +11,7 @@ import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
11
11
  import * as i2 from 'primeng/datepicker';
12
12
  import { DatePickerModule } from 'primeng/datepicker';
13
13
  import * as i3 from 'primeng/api';
14
+ import moment from 'moment';
14
15
  import * as i4$1 from '@angular/router';
15
16
  import * as i5 from 'ag-grid-angular';
16
17
  import { AgGridModule } from 'ag-grid-angular';
@@ -913,6 +914,7 @@ class ButtonRendererComponent {
913
914
  return false;
914
915
  }
915
916
  onClick($event) {
917
+ $event.stopPropagation();
916
918
  if (this.params.onClick instanceof Function) {
917
919
  // put anything into params u want pass into parents component
918
920
  const params = {
@@ -926,9 +928,12 @@ class ButtonRendererComponent {
926
928
  this.params.onClick(params);
927
929
  }
928
930
  }
931
+ onMouseDown($event) {
932
+ $event.stopPropagation();
933
+ }
929
934
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ButtonRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
930
935
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: ButtonRendererComponent, isStandalone: false, selector: "lib-button-renderer", ngImport: i0, template: `
931
- <button class="btn-actions" type="button" (click)="onClick($event)" [attr.data-title]="params.tooltip">
936
+ <button class="btn-actions" type="button" (click)="onClick($event)" (mousedown)="onMouseDown($event)" [attr.data-title]="params.tooltip">
932
937
  <span *ngIf="icon && !label"> <i class="{{ icon }}"></i> </span>
933
938
  <span *ngIf="!icon && label">{{ label }}</span>
934
939
  <span *ngIf="icon && label"><i class="{{ icon }}"></i> {{ label }}</span>
@@ -940,7 +945,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
940
945
  args: [{
941
946
  selector: 'lib-button-renderer',
942
947
  template: `
943
- <button class="btn-actions" type="button" (click)="onClick($event)" [attr.data-title]="params.tooltip">
948
+ <button class="btn-actions" type="button" (click)="onClick($event)" (mousedown)="onMouseDown($event)" [attr.data-title]="params.tooltip">
944
949
  <span *ngIf="icon && !label"> <i class="{{ icon }}"></i> </span>
945
950
  <span *ngIf="!icon && label">{{ label }}</span>
946
951
  <span *ngIf="icon && label"><i class="{{ icon }}"></i> {{ label }}</span>
@@ -986,7 +991,19 @@ class DropdownRenderer {
986
991
  refresh(params) {
987
992
  return false;
988
993
  }
989
- onClick($event) {
994
+ onClick($event, index) {
995
+ const toolId = this.params.node.data.toolId;
996
+ const urls = [
997
+ `/home/tool/details/${toolId}/tracker`,
998
+ `/home/details/${toolId}`,
999
+ `/home/lss/details/${toolId}`,
1000
+ `/home/tool/details/${toolId}/dac`
1001
+ ];
1002
+ if (($event.ctrlKey || $event.metaKey) && urls[index] && index != 4) {
1003
+ window.open(urls[index], '_blank');
1004
+ $event.stopPropagation();
1005
+ return;
1006
+ }
990
1007
  if (this.params.onClick instanceof Function) {
991
1008
  const params = {
992
1009
  event: $event,
@@ -994,7 +1011,6 @@ class DropdownRenderer {
994
1011
  buttonName: $event.target.innerText,
995
1012
  }),
996
1013
  };
997
- console.log('Hit', params);
998
1014
  this.params.onClick(params);
999
1015
  }
1000
1016
  }
@@ -1002,10 +1018,13 @@ class DropdownRenderer {
1002
1018
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: DropdownRenderer, isStandalone: false, selector: "lib-dropdown-renderer", ngImport: i0, template: `
1003
1019
  <div class="dropdown">
1004
1020
  <button type="button" class="btn btn-white" data-toggle="dropdown">
1005
- <i class="fa fa-ellipsis-v"></i>
1021
+ <i class="fa fa-ellipsis-v"></i>
1006
1022
  </button>
1007
1023
  <div class="dropdown-menu">
1008
- <span *ngFor='let data of dropDownData' class="dropdown-item" (click)="onClick($event)" [innerHTML]="data"></span>
1024
+ <span *ngFor='let data of dropDownData; let i = index'
1025
+ class="dropdown-item"
1026
+ (click)="onClick($event, i)"
1027
+ [innerHTML]="data"></span>
1009
1028
  </div>
1010
1029
  </div>
1011
1030
  `, isInline: true, dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
@@ -1017,10 +1036,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
1017
1036
  template: `
1018
1037
  <div class="dropdown">
1019
1038
  <button type="button" class="btn btn-white" data-toggle="dropdown">
1020
- <i class="fa fa-ellipsis-v"></i>
1039
+ <i class="fa fa-ellipsis-v"></i>
1021
1040
  </button>
1022
1041
  <div class="dropdown-menu">
1023
- <span *ngFor='let data of dropDownData' class="dropdown-item" (click)="onClick($event)" [innerHTML]="data"></span>
1042
+ <span *ngFor='let data of dropDownData; let i = index'
1043
+ class="dropdown-item"
1044
+ (click)="onClick($event, i)"
1045
+ [innerHTML]="data"></span>
1024
1046
  </div>
1025
1047
  </div>
1026
1048
  `,
@@ -1895,12 +1917,33 @@ class ColumnValueFormatter {
1895
1917
  constructor(datePipe) {
1896
1918
  this.datePipe = datePipe;
1897
1919
  }
1920
+ toLocal(dateString, format) {
1921
+ if (!dateString)
1922
+ return '';
1923
+ let hasTime = false;
1924
+ if (typeof dateString === 'string') {
1925
+ // excludes time when there is none or it's 00:00:00
1926
+ const match = /T(\d{2}):(\d{2}):(\d{2})/.exec(dateString);
1927
+ hasTime = !!(match && (match[1] !== '00' || match[2] !== '00' || match[3] !== '00'));
1928
+ }
1929
+ else if (dateString instanceof Date) {
1930
+ hasTime = true;
1931
+ }
1932
+ const date = moment.utc(dateString).toDate();
1933
+ if (format) {
1934
+ return moment(date).format(format);
1935
+ }
1936
+ if (!hasTime) {
1937
+ return date.toLocaleDateString();
1938
+ }
1939
+ return date.toLocaleString();
1940
+ }
1898
1941
  colValueFormatter(params, colType) {
1899
1942
  if (isNaN(+params.value)) {
1900
1943
  var dateWrapper = new Date(params.value);
1901
1944
  let isValidDate = !isNaN(dateWrapper.getDate());
1902
1945
  if (isValidDate && colType == 'date') {
1903
- return this.datePipe.transform(params.value, 'yyyy-MM-dd');
1946
+ return this.toLocal(params.value);
1904
1947
  }
1905
1948
  else {
1906
1949
  return params.value;