cilog-lib 1.13.16 → 1.13.17
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/fesm2022/cilog-lib.mjs +137 -44
- package/fesm2022/cilog-lib.mjs.map +1 -1
- package/package.json +1 -1
- package/types/cilog-lib.d.ts +27 -3
package/fesm2022/cilog-lib.mjs
CHANGED
|
@@ -1426,6 +1426,86 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1426
1426
|
args: [{ selector: 'cilog-grid-time-mask-editor', imports: [], template: "<input #inputElement\r\n type=\"text\"\r\n placeholder=\"HH:MM\"\r\n [value]=\"value()\"\r\n (input)=\"onInput($event)\"\r\n (blur)=\"onBlur()\"\r\n style=\"width: 100%; height: 100%; border: none; padding: 0 8px; box-sizing: border-box;\" />\r\n" }]
|
|
1427
1427
|
}], propDecorators: { inputElement: [{ type: i0.ViewChild, args: ['inputElement', { isSignal: true }] }] } });
|
|
1428
1428
|
|
|
1429
|
+
class GridSetFilterComponent {
|
|
1430
|
+
params;
|
|
1431
|
+
options = [];
|
|
1432
|
+
selectedValues = [];
|
|
1433
|
+
optionLabel = 'label';
|
|
1434
|
+
agInit(params) {
|
|
1435
|
+
this.params = params;
|
|
1436
|
+
// Récupération de la clé passée dans filterParams (ex: 'name', 'label', etc.)
|
|
1437
|
+
if (params.optionLabel) {
|
|
1438
|
+
this.optionLabel = params.optionLabel;
|
|
1439
|
+
}
|
|
1440
|
+
this.extractUniqueObjects();
|
|
1441
|
+
}
|
|
1442
|
+
refresh(params) {
|
|
1443
|
+
this.params = params;
|
|
1444
|
+
if (params.optionLabel) {
|
|
1445
|
+
this.optionLabel = params.optionLabel;
|
|
1446
|
+
}
|
|
1447
|
+
this.extractUniqueObjects();
|
|
1448
|
+
return true;
|
|
1449
|
+
}
|
|
1450
|
+
// Extrait les objets uniques présentés dans la cellule
|
|
1451
|
+
extractUniqueObjects() {
|
|
1452
|
+
const field = this.params.colDef.field;
|
|
1453
|
+
if (!field)
|
|
1454
|
+
return;
|
|
1455
|
+
const mapUniqueObjects = new Map();
|
|
1456
|
+
this.params.api.forEachNode((node) => {
|
|
1457
|
+
const objValue = this.params.getValue(node);
|
|
1458
|
+
if (objValue && typeof objValue === 'object') {
|
|
1459
|
+
const key = objValue[this.optionLabel];
|
|
1460
|
+
if (key != null && !mapUniqueObjects.has(String(key))) {
|
|
1461
|
+
mapUniqueObjects.set(String(key), objValue);
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
});
|
|
1465
|
+
// Tri des objets selon la clé d'affichage
|
|
1466
|
+
this.options = Array.from(mapUniqueObjects.values()).sort((a, b) => {
|
|
1467
|
+
const labelA = String(a[this.optionLabel] || '');
|
|
1468
|
+
const labelB = String(b[this.optionLabel] || '');
|
|
1469
|
+
return labelA.localeCompare(labelB);
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
isFilterActive() {
|
|
1473
|
+
return this.selectedValues && this.selectedValues.length > 0;
|
|
1474
|
+
}
|
|
1475
|
+
// Comparaison basée sur la propriété optionLabel des objets
|
|
1476
|
+
doesFilterPass(params) {
|
|
1477
|
+
if (!this.isFilterActive()) {
|
|
1478
|
+
return true;
|
|
1479
|
+
}
|
|
1480
|
+
const cellObject = this.params.getValue(params.node);
|
|
1481
|
+
if (!cellObject)
|
|
1482
|
+
return false;
|
|
1483
|
+
const cellLabel = cellObject[this.optionLabel];
|
|
1484
|
+
return this.selectedValues.some((selectedObj) => selectedObj[this.optionLabel] === cellLabel);
|
|
1485
|
+
}
|
|
1486
|
+
getModel() {
|
|
1487
|
+
if (!this.isFilterActive()) {
|
|
1488
|
+
return null;
|
|
1489
|
+
}
|
|
1490
|
+
return { value: this.selectedValues };
|
|
1491
|
+
}
|
|
1492
|
+
setModel(model) {
|
|
1493
|
+
this.selectedValues = model ? model.value : [];
|
|
1494
|
+
}
|
|
1495
|
+
onSelectionChange() {
|
|
1496
|
+
this.params.filterChangedCallback();
|
|
1497
|
+
}
|
|
1498
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: GridSetFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1499
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: GridSetFilterComponent, isStandalone: true, selector: "cilog-grid-set-filter", ngImport: i0, template: "<div style=\"padding: 10px; min-width: 220px;\">\r\n <p-multiselect [options]=\"options\"\r\n [(ngModel)]=\"selectedValues\"\r\n [optionLabel]=\"optionLabel\"\r\n (onChange)=\"onSelectionChange()\"\r\n placeholder=\"S\u00E9lectionner...\"\r\n selectedItemsLabel=\"{0} \u00E9l\u00E9ments s\u00E9lectionn\u00E9s\"\r\n [maxSelectedLabels]=\"1\"\r\n [virtualScroll]=\"true\"\r\n [virtualScrollItemSize]=\"30\"\r\n [style]=\"{ width: '100%' }\"\r\n [panelStyle]=\"{ minWidth: '220px' }\"\r\n [appendTo]=\"'body'\">\r\n </p-multiselect>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i10.MultiSelect, selector: "p-multiSelect, p-multiselect, p-multi-select", inputs: ["id", "ariaLabel", "styleClass", "panelStyle", "panelStyleClass", "inputId", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "dataKey", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "chipIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "showClear", "autofocus", "placeholder", "options", "filterValue", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus", "highlightOnSelect", "size", "variant", "fluid", "appendTo", "motionOptions"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
1500
|
+
}
|
|
1501
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: GridSetFilterComponent, decorators: [{
|
|
1502
|
+
type: Component,
|
|
1503
|
+
args: [{ selector: 'cilog-grid-set-filter', imports: [
|
|
1504
|
+
MultiSelectModule,
|
|
1505
|
+
FormsModule
|
|
1506
|
+
], template: "<div style=\"padding: 10px; min-width: 220px;\">\r\n <p-multiselect [options]=\"options\"\r\n [(ngModel)]=\"selectedValues\"\r\n [optionLabel]=\"optionLabel\"\r\n (onChange)=\"onSelectionChange()\"\r\n placeholder=\"S\u00E9lectionner...\"\r\n selectedItemsLabel=\"{0} \u00E9l\u00E9ments s\u00E9lectionn\u00E9s\"\r\n [maxSelectedLabels]=\"1\"\r\n [virtualScroll]=\"true\"\r\n [virtualScrollItemSize]=\"30\"\r\n [style]=\"{ width: '100%' }\"\r\n [panelStyle]=\"{ minWidth: '220px' }\"\r\n [appendTo]=\"'body'\">\r\n </p-multiselect>\r\n</div>\r\n" }]
|
|
1507
|
+
}] });
|
|
1508
|
+
|
|
1429
1509
|
const myTheme = themeQuartz
|
|
1430
1510
|
.withParams({
|
|
1431
1511
|
backgroundColor: '#ffffff',
|
|
@@ -1488,6 +1568,7 @@ class CilogGridComponent {
|
|
|
1488
1568
|
case ColType.Button:
|
|
1489
1569
|
case ColType.File:
|
|
1490
1570
|
case ColType.Image:
|
|
1571
|
+
case ColType.Dropdown:
|
|
1491
1572
|
return false;
|
|
1492
1573
|
default:
|
|
1493
1574
|
return true;
|
|
@@ -1498,8 +1579,10 @@ class CilogGridComponent {
|
|
|
1498
1579
|
autoHeaderHeight: this.options().headersAffichageEntier ? true : false,
|
|
1499
1580
|
sortable: this.options().sortable && !col.disableSort ? true : false,
|
|
1500
1581
|
filter: !col.disableFilter ? this.getTypeFiltre(col) : null,
|
|
1582
|
+
filterParams: this.getFilterParams(col),
|
|
1501
1583
|
suppressSizeToFit: col.width != null ? true : false,
|
|
1502
1584
|
headerTooltip: col.tooltipHeader ? col.libelle : null,
|
|
1585
|
+
type: col.type == ColType.Number || col.type == ColType.Date ? 'rightAligned' : null,
|
|
1503
1586
|
headerClass: (params) => {
|
|
1504
1587
|
if (col.backgroundColor != null) {
|
|
1505
1588
|
setTimeout(() => {
|
|
@@ -1512,7 +1595,6 @@ class CilogGridComponent {
|
|
|
1512
1595
|
}
|
|
1513
1596
|
return '';
|
|
1514
1597
|
},
|
|
1515
|
-
type: col.type == ColType.Number || col.type == ColType.Date ? 'rightAligned' : null,
|
|
1516
1598
|
cellEditorSelector: (params) => {
|
|
1517
1599
|
if (!params.data)
|
|
1518
1600
|
return undefined;
|
|
@@ -1576,67 +1658,66 @@ class CilogGridComponent {
|
|
|
1576
1658
|
return params.data[params.colDef.field].value;
|
|
1577
1659
|
},
|
|
1578
1660
|
valueFormatter: (params) => {
|
|
1661
|
+
let value = params.data[params.colDef.field].value;
|
|
1662
|
+
if (value == null) {
|
|
1663
|
+
return '';
|
|
1664
|
+
}
|
|
1579
1665
|
let typeSaisie = this.getTypeCellule(params.data, col);
|
|
1580
1666
|
switch (typeSaisie) {
|
|
1667
|
+
case ColType.Dropdown:
|
|
1668
|
+
let optionLabel = col.options['optionLabel'];
|
|
1669
|
+
return value[optionLabel];
|
|
1581
1670
|
case ColType.Number:
|
|
1582
|
-
const rawValue = params.data[params.colDef.field]?.value;
|
|
1583
|
-
if (rawValue == null) {
|
|
1584
|
-
return '';
|
|
1585
|
-
}
|
|
1586
1671
|
const suffix = col.options?.['suffix'];
|
|
1587
1672
|
let formattedValue = '';
|
|
1588
1673
|
if (col.options?.modeInteger) {
|
|
1589
|
-
formattedValue =
|
|
1674
|
+
formattedValue = value;
|
|
1590
1675
|
}
|
|
1591
1676
|
else {
|
|
1592
1677
|
let formatFr = new Intl.NumberFormat('fr-FR', {
|
|
1593
1678
|
minimumFractionDigits: col.options?.minDecimales != null ? col.options?.minDecimales : 2,
|
|
1594
1679
|
maximumFractionDigits: col.options?.minDecimales != null ? col.options?.minDecimales : 2
|
|
1595
1680
|
});
|
|
1596
|
-
formattedValue = formatFr.format(
|
|
1681
|
+
formattedValue = formatFr.format(value);
|
|
1597
1682
|
}
|
|
1598
1683
|
return suffix ? `${formattedValue} ${suffix}` : formattedValue;
|
|
1599
1684
|
case ColType.Date:
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
default:
|
|
1630
|
-
return new Intl.DateTimeFormat('fr-FR').format(val);
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
else {
|
|
1634
|
-
return new Intl.DateTimeFormat('fr-FR').format(val);
|
|
1685
|
+
if (col.options != null) {
|
|
1686
|
+
switch (col.options['mode']) {
|
|
1687
|
+
case 'year':
|
|
1688
|
+
return value.getFullYear().toString();
|
|
1689
|
+
case 'month':
|
|
1690
|
+
const optionMoisAnnee = {
|
|
1691
|
+
month: '2-digit',
|
|
1692
|
+
year: 'numeric'
|
|
1693
|
+
};
|
|
1694
|
+
return new Intl.DateTimeFormat('fr-FR', optionMoisAnnee).format(value);
|
|
1695
|
+
case 'hour':
|
|
1696
|
+
const optionHeureMinute = {
|
|
1697
|
+
hour: '2-digit',
|
|
1698
|
+
minute: '2-digit',
|
|
1699
|
+
hour12: false
|
|
1700
|
+
};
|
|
1701
|
+
return new Intl.DateTimeFormat('fr-FR', optionHeureMinute).format(value);
|
|
1702
|
+
case 'datehour':
|
|
1703
|
+
const optionDateHour = {
|
|
1704
|
+
year: 'numeric',
|
|
1705
|
+
month: '2-digit',
|
|
1706
|
+
day: '2-digit',
|
|
1707
|
+
hour: '2-digit',
|
|
1708
|
+
minute: '2-digit',
|
|
1709
|
+
hour12: false
|
|
1710
|
+
};
|
|
1711
|
+
return new Intl.DateTimeFormat('fr-FR', optionDateHour).format(value);
|
|
1712
|
+
default:
|
|
1713
|
+
return new Intl.DateTimeFormat('fr-FR').format(value);
|
|
1635
1714
|
}
|
|
1636
1715
|
}
|
|
1637
|
-
|
|
1716
|
+
else {
|
|
1717
|
+
return new Intl.DateTimeFormat('fr-FR').format(value);
|
|
1718
|
+
}
|
|
1638
1719
|
default:
|
|
1639
|
-
return
|
|
1720
|
+
return value;
|
|
1640
1721
|
}
|
|
1641
1722
|
},
|
|
1642
1723
|
cellStyle: (params) => {
|
|
@@ -1692,6 +1773,8 @@ class CilogGridComponent {
|
|
|
1692
1773
|
};
|
|
1693
1774
|
getTypeFiltre(col) {
|
|
1694
1775
|
switch (col.type) {
|
|
1776
|
+
case ColType.Dropdown:
|
|
1777
|
+
return GridSetFilterComponent;
|
|
1695
1778
|
case ColType.Date:
|
|
1696
1779
|
return 'agDateColumnFilter';
|
|
1697
1780
|
case ColType.Number:
|
|
@@ -1700,6 +1783,16 @@ class CilogGridComponent {
|
|
|
1700
1783
|
return 'agTextColumnFilter';
|
|
1701
1784
|
}
|
|
1702
1785
|
}
|
|
1786
|
+
getFilterParams(col) {
|
|
1787
|
+
switch (col.type) {
|
|
1788
|
+
case ColType.Dropdown:
|
|
1789
|
+
return {
|
|
1790
|
+
optionLabel: col.options['optionLabel']
|
|
1791
|
+
};
|
|
1792
|
+
default:
|
|
1793
|
+
return null;
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1703
1796
|
totalRowData = computed(() => {
|
|
1704
1797
|
let rowsTotal = [{}];
|
|
1705
1798
|
this.columns().forEach(col => {
|