basesite-shared-grid-lib 15.10.310 → 15.10.313
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.
- package/basesite-shared-grid-lib-15.10.313.tgz +0 -0
- package/fesm2022/basesite-shared-grid-lib.mjs +94 -17
- package/fesm2022/basesite-shared-grid-lib.mjs.map +1 -1
- package/lib/formatters/column-value-formatter.d.ts +1 -0
- package/lib/renderer/button-renderer/button-renderer.component.d.ts +1 -0
- package/lib/renderer/dropdown-renderer/drop-down-renderer.d.ts +2 -1
- package/package.json +1 -1
- package/basesite-shared-grid-lib-15.10.310.tgz +0 -0
|
Binary file
|
|
@@ -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,21 +1011,41 @@ 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
|
}
|
|
1017
|
+
getUrl(index) {
|
|
1018
|
+
const toolId = this.params?.node?.data?.toolId;
|
|
1019
|
+
const urls = [
|
|
1020
|
+
`/home/tool/details/${toolId}/tracker`,
|
|
1021
|
+
`/home/details/${toolId}`,
|
|
1022
|
+
`/home/lss/details/${toolId}`,
|
|
1023
|
+
`/home/tool/details/${toolId}/dac`
|
|
1024
|
+
];
|
|
1025
|
+
return urls[index] || '#';
|
|
1026
|
+
}
|
|
1001
1027
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DropdownRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1002
1028
|
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
1029
|
<div class="dropdown">
|
|
1004
1030
|
<button type="button" class="btn btn-white" data-toggle="dropdown">
|
|
1005
|
-
|
|
1031
|
+
<i class="fa fa-ellipsis-v"></i>
|
|
1006
1032
|
</button>
|
|
1007
1033
|
<div class="dropdown-menu">
|
|
1008
|
-
<
|
|
1034
|
+
<ng-container *ngFor="let data of dropDownData; let i = index">
|
|
1035
|
+
<a *ngIf="i !== 4"
|
|
1036
|
+
class="dropdown-item"
|
|
1037
|
+
[href]="getUrl(i)"
|
|
1038
|
+
(click)="onClick($event, i)"
|
|
1039
|
+
[innerHTML]="data"
|
|
1040
|
+
target="_self"></a>
|
|
1041
|
+
<span *ngIf="i == 4"
|
|
1042
|
+
class="dropdown-item"
|
|
1043
|
+
(click)="onClick($event, i)"
|
|
1044
|
+
[innerHTML]="data"></span>
|
|
1045
|
+
</ng-container>
|
|
1009
1046
|
</div>
|
|
1010
1047
|
</div>
|
|
1011
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
|
|
1048
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
1012
1049
|
}
|
|
1013
1050
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DropdownRenderer, decorators: [{
|
|
1014
1051
|
type: Component,
|
|
@@ -1017,10 +1054,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
1017
1054
|
template: `
|
|
1018
1055
|
<div class="dropdown">
|
|
1019
1056
|
<button type="button" class="btn btn-white" data-toggle="dropdown">
|
|
1020
|
-
|
|
1057
|
+
<i class="fa fa-ellipsis-v"></i>
|
|
1021
1058
|
</button>
|
|
1022
1059
|
<div class="dropdown-menu">
|
|
1023
|
-
<
|
|
1060
|
+
<ng-container *ngFor="let data of dropDownData; let i = index">
|
|
1061
|
+
<a *ngIf="i !== 4"
|
|
1062
|
+
class="dropdown-item"
|
|
1063
|
+
[href]="getUrl(i)"
|
|
1064
|
+
(click)="onClick($event, i)"
|
|
1065
|
+
[innerHTML]="data"
|
|
1066
|
+
target="_self"></a>
|
|
1067
|
+
<span *ngIf="i == 4"
|
|
1068
|
+
class="dropdown-item"
|
|
1069
|
+
(click)="onClick($event, i)"
|
|
1070
|
+
[innerHTML]="data"></span>
|
|
1071
|
+
</ng-container>
|
|
1024
1072
|
</div>
|
|
1025
1073
|
</div>
|
|
1026
1074
|
`,
|
|
@@ -1895,12 +1943,33 @@ class ColumnValueFormatter {
|
|
|
1895
1943
|
constructor(datePipe) {
|
|
1896
1944
|
this.datePipe = datePipe;
|
|
1897
1945
|
}
|
|
1946
|
+
toLocal(dateString, format) {
|
|
1947
|
+
if (!dateString)
|
|
1948
|
+
return '';
|
|
1949
|
+
let hasTime = false;
|
|
1950
|
+
if (typeof dateString === 'string') {
|
|
1951
|
+
// excludes time when there is none or it's 00:00:00
|
|
1952
|
+
const match = /T(\d{2}):(\d{2}):(\d{2})/.exec(dateString);
|
|
1953
|
+
hasTime = !!(match && (match[1] !== '00' || match[2] !== '00' || match[3] !== '00'));
|
|
1954
|
+
}
|
|
1955
|
+
else if (dateString instanceof Date) {
|
|
1956
|
+
hasTime = true;
|
|
1957
|
+
}
|
|
1958
|
+
const date = moment.utc(dateString).toDate();
|
|
1959
|
+
if (format) {
|
|
1960
|
+
return moment(date).format(format);
|
|
1961
|
+
}
|
|
1962
|
+
if (!hasTime) {
|
|
1963
|
+
return date.toLocaleDateString();
|
|
1964
|
+
}
|
|
1965
|
+
return date.toLocaleString();
|
|
1966
|
+
}
|
|
1898
1967
|
colValueFormatter(params, colType) {
|
|
1899
1968
|
if (isNaN(+params.value)) {
|
|
1900
1969
|
var dateWrapper = new Date(params.value);
|
|
1901
1970
|
let isValidDate = !isNaN(dateWrapper.getDate());
|
|
1902
1971
|
if (isValidDate && colType == 'date') {
|
|
1903
|
-
return this.
|
|
1972
|
+
return this.toLocal(params.value);
|
|
1904
1973
|
}
|
|
1905
1974
|
else {
|
|
1906
1975
|
return params.value;
|
|
@@ -2303,16 +2372,24 @@ class GridLibraryComponent {
|
|
|
2303
2372
|
};
|
|
2304
2373
|
if (res.field === 'entityCodeLife') {
|
|
2305
2374
|
colDef.cellRenderer = (params) => {
|
|
2306
|
-
const
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2375
|
+
const toolId = params.data?.toolId;
|
|
2376
|
+
const url = toolId ? `/home/tool/details/${toolId}/tracker` : '#';
|
|
2377
|
+
// Creating an a tag so we get the browser right-click context menu
|
|
2378
|
+
const a = document.createElement('a');
|
|
2379
|
+
a.textContent = params.value;
|
|
2380
|
+
a.href = url;
|
|
2381
|
+
a.target = '_self';
|
|
2382
|
+
a.style.cursor = 'pointer';
|
|
2383
|
+
a.addEventListener('click', (event) => {
|
|
2311
2384
|
if (toolId) {
|
|
2312
|
-
|
|
2385
|
+
// Only intercept if not ctrl/cmd/right click
|
|
2386
|
+
if (!(event.ctrlKey || event.metaKey || event.button === 2)) {
|
|
2387
|
+
event.preventDefault();
|
|
2388
|
+
this.router.navigate([url]);
|
|
2389
|
+
}
|
|
2313
2390
|
}
|
|
2314
2391
|
});
|
|
2315
|
-
return
|
|
2392
|
+
return a;
|
|
2316
2393
|
};
|
|
2317
2394
|
}
|
|
2318
2395
|
return colDef;
|