@cdmx/wappler_ag_grid 0.1.1 → 0.1.3
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 +11 -14
- package/dmx-ag-grid.js +48 -26
- package/package.json +1 -1
|
@@ -357,23 +357,23 @@
|
|
|
357
357
|
"title": "Row Click Events",
|
|
358
358
|
"type": "boolean",
|
|
359
359
|
"defaultValue": false,
|
|
360
|
-
"help": "This
|
|
360
|
+
"help": "This enables row click events which can then be used in Dynamic events => Grid Events => Row Clicked"
|
|
361
361
|
},
|
|
362
362
|
{
|
|
363
363
|
"name": "rowCheckboxEvent",
|
|
364
364
|
"attribute": "dmx-bind:row_checkbox_event",
|
|
365
|
-
"title": "Row
|
|
365
|
+
"title": "Enable Row Selection",
|
|
366
366
|
"type": "boolean",
|
|
367
367
|
"defaultValue": false,
|
|
368
|
-
"help": "This
|
|
368
|
+
"help": "This enables row selection which can then be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked"
|
|
369
369
|
},
|
|
370
370
|
{
|
|
371
371
|
"name": "rowStatusEvent",
|
|
372
372
|
"attribute": "dmx-bind:row_status_event",
|
|
373
|
-
"title": "Row Status
|
|
373
|
+
"title": "Enable Row Status Toggle",
|
|
374
374
|
"type": "boolean",
|
|
375
375
|
"defaultValue": false,
|
|
376
|
-
"help": "This
|
|
376
|
+
"help": "This enables row status events which can then be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked"
|
|
377
377
|
}
|
|
378
378
|
]
|
|
379
379
|
},
|
|
@@ -486,7 +486,6 @@
|
|
|
486
486
|
{
|
|
487
487
|
"field": "field",
|
|
488
488
|
"caption": "Field",
|
|
489
|
-
"size": "10%",
|
|
490
489
|
"editable": {
|
|
491
490
|
"type": "text"
|
|
492
491
|
}
|
|
@@ -494,7 +493,6 @@
|
|
|
494
493
|
{
|
|
495
494
|
"field": "value",
|
|
496
495
|
"caption": "Value",
|
|
497
|
-
"size": "10%",
|
|
498
496
|
"editable": {
|
|
499
497
|
"type": "text"
|
|
500
498
|
}
|
|
@@ -502,7 +500,6 @@
|
|
|
502
500
|
{
|
|
503
501
|
field: "new_value",
|
|
504
502
|
caption: "New Value",
|
|
505
|
-
size: "10%",
|
|
506
503
|
editable: {
|
|
507
504
|
type: "text"
|
|
508
505
|
}
|
|
@@ -870,9 +867,9 @@
|
|
|
870
867
|
{
|
|
871
868
|
"name": "dmx-ag-grid-status-checked",
|
|
872
869
|
"attributeStartsWith": "dmx-on",
|
|
873
|
-
"attribute": "
|
|
870
|
+
"attribute": "row_status_enabled",
|
|
874
871
|
"display": "fieldset",
|
|
875
|
-
"title": "Status
|
|
872
|
+
"title": "Status Enabled",
|
|
876
873
|
"icon": "fa fa-lg fa-chevron-right",
|
|
877
874
|
"groupTitle": "Grid Events",
|
|
878
875
|
"groupIcon": "fa fa-lg fa-cubes",
|
|
@@ -887,7 +884,7 @@
|
|
|
887
884
|
{
|
|
888
885
|
"name": "rowStatusChecked",
|
|
889
886
|
"attributeStartsWith": "dmx-on",
|
|
890
|
-
"attribute": "
|
|
887
|
+
"attribute": "row_status_enabled",
|
|
891
888
|
"isValue": true,
|
|
892
889
|
"actionsPicker": true,
|
|
893
890
|
"title": "Action:",
|
|
@@ -904,9 +901,9 @@
|
|
|
904
901
|
{
|
|
905
902
|
"name": "dmx-ag-grid-status-unchecked",
|
|
906
903
|
"attributeStartsWith": "dmx-on",
|
|
907
|
-
"attribute": "
|
|
904
|
+
"attribute": "row_status_disabled",
|
|
908
905
|
"display": "fieldset",
|
|
909
|
-
"title": "Status
|
|
906
|
+
"title": "Status Disabled",
|
|
910
907
|
"icon": "fa fa-lg fa-chevron-right",
|
|
911
908
|
"groupTitle": "Grid Events",
|
|
912
909
|
"groupIcon": "fa fa-lg fa-cubes",
|
|
@@ -921,7 +918,7 @@
|
|
|
921
918
|
{
|
|
922
919
|
"name": "rowStatusUnchecked",
|
|
923
920
|
"attributeStartsWith": "dmx-on",
|
|
924
|
-
"attribute": "
|
|
921
|
+
"attribute": "row_status_disabled",
|
|
925
922
|
"isValue": true,
|
|
926
923
|
"actionsPicker": true,
|
|
927
924
|
"title": "Action:",
|
package/dmx-ag-grid.js
CHANGED
|
@@ -163,12 +163,12 @@ dmx.Component('ag-grid', {
|
|
|
163
163
|
// Code for when the checkbox is checked
|
|
164
164
|
this.set('id', idValue);
|
|
165
165
|
this.set('fields', {"field": columnName, "data": value});
|
|
166
|
-
this.dispatchEvent('
|
|
166
|
+
this.dispatchEvent('row_status_enabled')
|
|
167
167
|
} else {
|
|
168
168
|
// Code for when the checkbox is unchecked
|
|
169
169
|
this.set('id', idValue);
|
|
170
170
|
this.set('fields', {"field": columnName, "data": value});
|
|
171
|
-
this.dispatchEvent('
|
|
171
|
+
this.dispatchEvent('row_status_disabled')
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
174
|
function clickCellRenderer(params) {
|
|
@@ -178,20 +178,26 @@ dmx.Component('ag-grid', {
|
|
|
178
178
|
const value = formatValue(params.value, columnName, dataType, timezone);
|
|
179
179
|
return `<div onclick="clickEvent('${columnName}', '${value}', '${idValue}')" style="cursor: pointer;">${value}</div>`;
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function idCheckboxCellRenderer(params) {
|
|
182
182
|
const idValue = params.data.id;
|
|
183
183
|
const columnName = params.colDef.field;
|
|
184
184
|
const dataType = detectDataType([params.value]);
|
|
185
185
|
const value = formatValue(params.value, columnName, dataType, timezone);
|
|
186
|
-
|
|
187
|
-
if (columnName === "id") {
|
|
188
|
-
return `
|
|
186
|
+
return `
|
|
189
187
|
<input
|
|
190
188
|
type="checkbox"
|
|
191
189
|
onclick="handleCheckboxClick(event, '${columnName}', '${value}', '${idValue}')"
|
|
192
190
|
/>
|
|
193
191
|
`;
|
|
194
|
-
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function checkboxCellRenderer(params) {
|
|
195
|
+
const idValue = params.data.id;
|
|
196
|
+
const columnName = params.colDef.field;
|
|
197
|
+
const dataType = detectDataType([params.value]);
|
|
198
|
+
const value = formatValue(params.value, columnName, dataType, timezone);
|
|
199
|
+
|
|
200
|
+
if (columnName == "status" && enableStatusToggle) {
|
|
195
201
|
// Assuming `value` is a boolean representing the status
|
|
196
202
|
const checked = value==true ? "checked" : "";
|
|
197
203
|
return `
|
|
@@ -389,21 +395,20 @@ dmx.Component('ag-grid', {
|
|
|
389
395
|
return false;
|
|
390
396
|
}
|
|
391
397
|
}
|
|
392
|
-
const cstyles = this.props.cstyles
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
}
|
|
398
|
+
const cstyles = this.props.cstyles
|
|
399
|
+
// Check if custom color exists for the current field and condition
|
|
400
|
+
function applyCellStyle(params) {
|
|
401
|
+
const field = params.colDef.field.toString();
|
|
402
|
+
if (cstyles.hasOwnProperty(field)) {
|
|
403
|
+
const condition = cstyles[field].condition;
|
|
404
|
+
const customColor = cstyles[field].customColor;
|
|
405
|
+
const [left, operator, right] = extractConditionParts(condition);
|
|
406
|
+
if (params.data.hasOwnProperty(field) && evaluateCondition(params.data[left], operator, right)) {
|
|
407
|
+
return { color: customColor };
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
407
412
|
cnames = this.props.cnames
|
|
408
413
|
cwidths = this.props.cwidths
|
|
409
414
|
enableClickEvent = this.props.row_click_event;
|
|
@@ -427,10 +432,26 @@ const cstyles = this.props.cstyles
|
|
|
427
432
|
minWidth: parseInt(cwidths[key].min_width),
|
|
428
433
|
maxWidth: parseInt(cwidths[key].max_width),
|
|
429
434
|
}),
|
|
430
|
-
cellRenderer: enableClickEvent ? 'clickCellRenderer' : (
|
|
435
|
+
cellRenderer: enableClickEvent ? 'clickCellRenderer' : (enableStatusToggle ? 'checkboxCellRenderer' : undefined)
|
|
431
436
|
};
|
|
432
437
|
});
|
|
433
438
|
}
|
|
439
|
+
let checkboxColumn;
|
|
440
|
+
if (enableCheckboxEvent) {
|
|
441
|
+
// Duplicate the column for 'id'
|
|
442
|
+
checkboxColumn = {
|
|
443
|
+
headerName: '',
|
|
444
|
+
field: 'id',
|
|
445
|
+
filter: '',
|
|
446
|
+
cellRenderer: 'idCheckboxCellRenderer',
|
|
447
|
+
resizable: false,
|
|
448
|
+
width: 50,
|
|
449
|
+
maxWidth: 50,
|
|
450
|
+
suppressMenu: true,
|
|
451
|
+
};
|
|
452
|
+
columnDefs.unshift(checkboxColumn);
|
|
453
|
+
}
|
|
454
|
+
|
|
434
455
|
const gridOptions = {
|
|
435
456
|
columnDefs: columnDefs,
|
|
436
457
|
defaultColDef: {
|
|
@@ -462,7 +483,8 @@ const cstyles = this.props.cstyles
|
|
|
462
483
|
localeText: this.props.localeText,
|
|
463
484
|
components: {
|
|
464
485
|
clickCellRenderer: clickCellRenderer,
|
|
465
|
-
checkboxCellRenderer: checkboxCellRenderer
|
|
486
|
+
checkboxCellRenderer: checkboxCellRenderer,
|
|
487
|
+
idCheckboxCellRenderer: idCheckboxCellRenderer
|
|
466
488
|
}
|
|
467
489
|
};
|
|
468
490
|
|
|
@@ -543,8 +565,8 @@ const cstyles = this.props.cstyles
|
|
|
543
565
|
row_clicked: Event,
|
|
544
566
|
row_checkbox_checked: Event,
|
|
545
567
|
row_checkbox_unchecked: Event,
|
|
546
|
-
|
|
547
|
-
|
|
568
|
+
row_status_enabled: Event,
|
|
569
|
+
row_status_disabled: Event
|
|
548
570
|
},
|
|
549
571
|
|
|
550
572
|
render: function(node) {
|