@cdmx/wappler_ag_grid 1.9.11 → 1.9.13
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/app_connect/components.hjson +42 -0
- package/dmx-ag-grid.js +24 -9
- package/package.json +1 -1
|
@@ -1566,6 +1566,7 @@
|
|
|
1566
1566
|
"show": [
|
|
1567
1567
|
"columnsToCount",
|
|
1568
1568
|
"columnsToSum",
|
|
1569
|
+
"footerSumPrecision",
|
|
1569
1570
|
"enableFixedFooter",
|
|
1570
1571
|
"fixedFooterBottomPadding",
|
|
1571
1572
|
"columnsToCountNonUnique"
|
|
@@ -1604,6 +1605,13 @@
|
|
|
1604
1605
|
"unique_values": ""
|
|
1605
1606
|
}
|
|
1606
1607
|
},
|
|
1608
|
+
{
|
|
1609
|
+
"name": "footerSumPrecision",
|
|
1610
|
+
"attribute": "footer_sum_precision",
|
|
1611
|
+
"title": "Sum Precision",
|
|
1612
|
+
"type": "number",
|
|
1613
|
+
"help": "Sets the number of decimal places to display in the footer for sum totals."
|
|
1614
|
+
},
|
|
1607
1615
|
{
|
|
1608
1616
|
"name": "columnsToCountNonUnique",
|
|
1609
1617
|
"attribute": "dmx-bind:columns_to_count_nonunique",
|
|
@@ -3368,6 +3376,40 @@
|
|
|
3368
3376
|
}
|
|
3369
3377
|
],
|
|
3370
3378
|
"attributes": [
|
|
3379
|
+
{
|
|
3380
|
+
name: "dmx_ag_grid_column_state_key",
|
|
3381
|
+
attributeStartsWith: "dmx-bind",
|
|
3382
|
+
attribute: "column_state_storage_key",
|
|
3383
|
+
title: "Column State Storage Key",
|
|
3384
|
+
type: "boolean",
|
|
3385
|
+
display: "fieldset",
|
|
3386
|
+
icon: "fa fa-lg fa-chevron-right",
|
|
3387
|
+
groupTitle: "Grid Config",
|
|
3388
|
+
groupIcon: "fa fa-lg fa-cubes",
|
|
3389
|
+
defaultValue: false,
|
|
3390
|
+
show: [
|
|
3391
|
+
"columnStateStorageKey"
|
|
3392
|
+
],
|
|
3393
|
+
noChangeOnHide: true,
|
|
3394
|
+
groupEnabler: true,
|
|
3395
|
+
children: [
|
|
3396
|
+
{
|
|
3397
|
+
name: "columnStateStorageKey",
|
|
3398
|
+
attributeStartsWith: "dmx-bind",
|
|
3399
|
+
attribute: "column_state_storage",
|
|
3400
|
+
isValue: true,
|
|
3401
|
+
dataBindings: true,
|
|
3402
|
+
title: "Key Name",
|
|
3403
|
+
type: "text",
|
|
3404
|
+
help: "Optional: Provide a custom key to store and retrieve column state from Local Storage.",
|
|
3405
|
+
defaultValue: "",
|
|
3406
|
+
initDisplay: "none"
|
|
3407
|
+
}
|
|
3408
|
+
],
|
|
3409
|
+
allowedOn: {
|
|
3410
|
+
dmx-ag-grid: true
|
|
3411
|
+
}
|
|
3412
|
+
},
|
|
3371
3413
|
{
|
|
3372
3414
|
"name": "dmx-ag-grid-value",
|
|
3373
3415
|
"attributeStartsWith": "dmx-bind",
|
package/dmx-ag-grid.js
CHANGED
|
@@ -259,7 +259,9 @@ dmx.Component('ag-grid', {
|
|
|
259
259
|
group_config: { type: Array, default: [] },
|
|
260
260
|
columns_to_count: { type: Array, default: [] },
|
|
261
261
|
columns_to_sum: { type: String, default: null },
|
|
262
|
-
|
|
262
|
+
footer_sum_precision: { type: Number, default: null },
|
|
263
|
+
columns_to_count_nonunique: { type: Boolean, default: false },
|
|
264
|
+
column_state_storage_key: { type: String, default: null }
|
|
263
265
|
},
|
|
264
266
|
|
|
265
267
|
methods: {
|
|
@@ -1648,17 +1650,26 @@ dmx.Component('ag-grid', {
|
|
|
1648
1650
|
saveColumnStateToStorage = () => {
|
|
1649
1651
|
const columnState = columnApi.getColumnState();
|
|
1650
1652
|
const pageId = getPageId();
|
|
1651
|
-
|
|
1653
|
+
const storageKey = options.column_state_storage_key || pageId;
|
|
1654
|
+
localStorage.setItem(`columnState_${storageKey}`, JSON.stringify(columnState));
|
|
1652
1655
|
}
|
|
1656
|
+
|
|
1653
1657
|
function restoreColumnState() {
|
|
1654
1658
|
const pageId = getPageId();
|
|
1655
|
-
const
|
|
1659
|
+
const storageKey = options.column_state_storage_key || pageId;
|
|
1660
|
+
const savedColumnState = localStorage.getItem(`columnState_${storageKey}`);
|
|
1661
|
+
|
|
1656
1662
|
if (savedColumnState) {
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1663
|
+
try {
|
|
1664
|
+
const parsedState = JSON.parse(savedColumnState);
|
|
1665
|
+
columnApi.applyColumnState({
|
|
1666
|
+
state: parsedState,
|
|
1667
|
+
applyOrder: true,
|
|
1668
|
+
applyVisibility: true,
|
|
1669
|
+
});
|
|
1670
|
+
} catch (err) {
|
|
1671
|
+
console.warn(`Failed to parse column state for key: columnState_${storageKey}`, err);
|
|
1672
|
+
}
|
|
1662
1673
|
}
|
|
1663
1674
|
}
|
|
1664
1675
|
restoreColumnState();
|
|
@@ -1731,6 +1742,10 @@ dmx.Component('ag-grid', {
|
|
|
1731
1742
|
result[0][col] += parseFloat(line.data[col]) || line.data[col];
|
|
1732
1743
|
}
|
|
1733
1744
|
});
|
|
1745
|
+
// Apply footer sum precision if specified
|
|
1746
|
+
if (options.footer_sum_precision) {
|
|
1747
|
+
result[0][col] = parseFloat(result[0][col].toFixed(options.footer_sum_precision) );
|
|
1748
|
+
}
|
|
1734
1749
|
});
|
|
1735
1750
|
}
|
|
1736
1751
|
if (columnsToCount) {
|
|
@@ -1777,7 +1792,7 @@ dmx.Component('ag-grid', {
|
|
|
1777
1792
|
gridInstance = null;
|
|
1778
1793
|
}
|
|
1779
1794
|
const getPageId = () => {
|
|
1780
|
-
const currentPageUrl = window.location.
|
|
1795
|
+
const currentPageUrl = window.location.pathname;
|
|
1781
1796
|
const optionsId = options.id+'-grid';
|
|
1782
1797
|
const uniqueId = `${currentPageUrl}_${optionsId}`;
|
|
1783
1798
|
return uniqueId;
|