@cdmx/wappler_ag_grid 1.9.7 → 1.9.9
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/README.md +8 -1
- package/app_connect/components.hjson +98 -34
- package/dmx-ag-grid.js +30 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -423,7 +423,14 @@ Specify the condition to Show the Button[i] Action button, eg: code==TEST, or st
|
|
|
423
423
|
|
|
424
424
|
# Button Class Toggles
|
|
425
425
|
The Button Class Toggles feature provides a way to define and manage classes for action buttons within a grid, based on certain data conditions. This can be useful for dynamically updating button styles based on the state of the row data.
|
|
426
|
-
Specify the condition to apply the defined class on the Action button,
|
|
426
|
+
Specify the condition to apply the defined class on the Action button,
|
|
427
|
+
eg: code==TEST, or status==COMPLETED||status==FINISHED or status==COMPLETED&&user_status==true
|
|
428
|
+
You can also specify left-only conditions, where only the field name is provided. The field is then evaluated for its truthiness ie if value present/true(bool) eg: status
|
|
429
|
+
|
|
430
|
+
# Button Icon Class Toggles
|
|
431
|
+
The Icon Class Toggles feature works similarly to Button Class Toggles but is used to apply classes to icons in the action buttons based on conditions in the row data. This allows you to dynamically update the icons
|
|
432
|
+
eg: code==TEST, or status==COMPLETED||status==FINISHED or status==COMPLETED&&user_status==true
|
|
433
|
+
You can also specify left-only conditions, where only the field name is provided. The field is then evaluated for its truthiness ie if value present/true(bool) eg: status
|
|
427
434
|
|
|
428
435
|
# Action Attributes
|
|
429
436
|
|
|
@@ -1673,12 +1673,12 @@
|
|
|
1673
1673
|
"editable": {
|
|
1674
1674
|
"type": "list",
|
|
1675
1675
|
"items": [
|
|
1676
|
-
{"id": "startsWith", "text": "
|
|
1677
|
-
{"id": "lessThan", "text": "
|
|
1678
|
-
{"id": "dateFrom", "text": "
|
|
1679
|
-
{"id": "greaterThan", "text": "
|
|
1680
|
-
{"id": "equals", "text": "
|
|
1681
|
-
{"id": "contains", "text": "
|
|
1676
|
+
{"id": "startsWith", "text": "startsWith"},
|
|
1677
|
+
{"id": "lessThan", "text": "lessThan"},
|
|
1678
|
+
{"id": "dateFrom", "text": "dateFrom"},
|
|
1679
|
+
{"id": "greaterThan", "text": "greaterThan"},
|
|
1680
|
+
{"id": "equals", "text": "equals"},
|
|
1681
|
+
{"id": "contains", "text": "contains"}
|
|
1682
1682
|
]
|
|
1683
1683
|
}
|
|
1684
1684
|
"help": "Filter type: startsWith, lessThan, dateFrom, etc."
|
|
@@ -1737,8 +1737,8 @@
|
|
|
1737
1737
|
"editable": {
|
|
1738
1738
|
"type": "list",
|
|
1739
1739
|
"items": [
|
|
1740
|
-
{"id": "asc", "text": "
|
|
1741
|
-
{"id": "desc", "text": "
|
|
1740
|
+
{"id": "asc", "text": "asc"},
|
|
1741
|
+
{"id": "desc", "text": "desc"}
|
|
1742
1742
|
]
|
|
1743
1743
|
}
|
|
1744
1744
|
"help": "Sort Order for the fields."
|
|
@@ -2930,7 +2930,7 @@
|
|
|
2930
2930
|
"type": "boolean",
|
|
2931
2931
|
"defaultValue": false,
|
|
2932
2932
|
"display": "fieldset",
|
|
2933
|
-
"show": ["actionBtnsClassToggles"],
|
|
2933
|
+
"show": ["actionBtnsClassToggles","actionBtnsIconClassToggles"],
|
|
2934
2934
|
"noChangeOnHide": true,
|
|
2935
2935
|
"groupEnabler": true,
|
|
2936
2936
|
"children": [
|
|
@@ -2951,29 +2951,93 @@
|
|
|
2951
2951
|
"editable": {
|
|
2952
2952
|
"type": "list",
|
|
2953
2953
|
"items": [
|
|
2954
|
-
{"id": "edit", "text": "
|
|
2955
|
-
{"id": "view", "text": "
|
|
2956
|
-
{"id": "delete", "text": "
|
|
2957
|
-
{"id": "button1", "text": "
|
|
2958
|
-
{"id": "button2", "text": "
|
|
2959
|
-
{"id": "button3", "text": "
|
|
2960
|
-
{"id": "button4", "text": "
|
|
2961
|
-
{"id": "button5", "text": "
|
|
2962
|
-
{"id": "button6", "text": "
|
|
2963
|
-
{"id": "button7", "text": "
|
|
2964
|
-
{"id": "button8", "text": "
|
|
2965
|
-
{"id": "button9", "text": "
|
|
2966
|
-
{"id": "button10", "text": "
|
|
2967
|
-
{"id": "button11", "text": "
|
|
2968
|
-
{"id": "button12", "text": "
|
|
2969
|
-
{"id": "button13", "text": "
|
|
2970
|
-
{"id": "button14", "text": "
|
|
2971
|
-
{"id": "button15", "text": "
|
|
2972
|
-
{"id": "button16", "text": "
|
|
2973
|
-
{"id": "button17", "text": "
|
|
2974
|
-
{"id": "button18", "text": "
|
|
2975
|
-
{"id": "button19", "text": "
|
|
2976
|
-
{"id": "button20", "text": "
|
|
2954
|
+
{"id": "edit", "text": "edit"},
|
|
2955
|
+
{"id": "view", "text": "view"},
|
|
2956
|
+
{"id": "delete", "text": "delete"},
|
|
2957
|
+
{"id": "button1", "text": "button1"},
|
|
2958
|
+
{"id": "button2", "text": "button2"},
|
|
2959
|
+
{"id": "button3", "text": "button3"},
|
|
2960
|
+
{"id": "button4", "text": "button4"},
|
|
2961
|
+
{"id": "button5", "text": "button5"},
|
|
2962
|
+
{"id": "button6", "text": "button6"},
|
|
2963
|
+
{"id": "button7", "text": "button7"},
|
|
2964
|
+
{"id": "button8", "text": "button8"},
|
|
2965
|
+
{"id": "button9", "text": "button9"},
|
|
2966
|
+
{"id": "button10", "text": "button10"},
|
|
2967
|
+
{"id": "button11", "text": "button11"},
|
|
2968
|
+
{"id": "button12", "text": "button12"},
|
|
2969
|
+
{"id": "button13", "text": "button13"},
|
|
2970
|
+
{"id": "button14", "text": "button14"},
|
|
2971
|
+
{"id": "button15", "text": "button15"},
|
|
2972
|
+
{"id": "button16", "text": "button16"},
|
|
2973
|
+
{"id": "button17", "text": "button17"},
|
|
2974
|
+
{"id": "button18", "text": "button18"},
|
|
2975
|
+
{"id": "button19", "text": "button19"},
|
|
2976
|
+
{"id": "button20", "text": "button20"}
|
|
2977
|
+
]
|
|
2978
|
+
}
|
|
2979
|
+
},
|
|
2980
|
+
{
|
|
2981
|
+
"field": "class",
|
|
2982
|
+
"caption": "Class",
|
|
2983
|
+
"editable": {
|
|
2984
|
+
"type": "text"
|
|
2985
|
+
}
|
|
2986
|
+
},
|
|
2987
|
+
{
|
|
2988
|
+
"field": "condition",
|
|
2989
|
+
"caption": "Condition",
|
|
2990
|
+
"editable": {
|
|
2991
|
+
"type": "text"
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
],
|
|
2995
|
+
"newRecord": {
|
|
2996
|
+
"btn_id": "",
|
|
2997
|
+
"class": "",
|
|
2998
|
+
"condition": ""
|
|
2999
|
+
}
|
|
3000
|
+
},
|
|
3001
|
+
{
|
|
3002
|
+
"name": "actionBtnsIconClassToggles",
|
|
3003
|
+
"attribute": "dmx-bind:action_button_icon_class_toggles",
|
|
3004
|
+
"title": "Buttons Icon Classes",
|
|
3005
|
+
"type": "grid",
|
|
3006
|
+
"jsonFormat": true,
|
|
3007
|
+
"dataBindings": true,
|
|
3008
|
+
"encloseBT": true,
|
|
3009
|
+
"jsonBT": true,
|
|
3010
|
+
"initDisplay": "none",
|
|
3011
|
+
"columns": [
|
|
3012
|
+
{
|
|
3013
|
+
"field": "btn_id",
|
|
3014
|
+
"caption": "Button",
|
|
3015
|
+
"editable": {
|
|
3016
|
+
"type": "list",
|
|
3017
|
+
"items": [
|
|
3018
|
+
{"id": "edit", "text": "edit"},
|
|
3019
|
+
{"id": "view", "text": "view"},
|
|
3020
|
+
{"id": "delete", "text": "delete"},
|
|
3021
|
+
{"id": "button1", "text": "button1"},
|
|
3022
|
+
{"id": "button2", "text": "button2"},
|
|
3023
|
+
{"id": "button3", "text": "button3"},
|
|
3024
|
+
{"id": "button4", "text": "button4"},
|
|
3025
|
+
{"id": "button5", "text": "button5"},
|
|
3026
|
+
{"id": "button6", "text": "button6"},
|
|
3027
|
+
{"id": "button7", "text": "button7"},
|
|
3028
|
+
{"id": "button8", "text": "button8"},
|
|
3029
|
+
{"id": "button9", "text": "button9"},
|
|
3030
|
+
{"id": "button10", "text": "button10"},
|
|
3031
|
+
{"id": "button11", "text": "button11"},
|
|
3032
|
+
{"id": "button12", "text": "button12"},
|
|
3033
|
+
{"id": "button13", "text": "button13"},
|
|
3034
|
+
{"id": "button14", "text": "button14"},
|
|
3035
|
+
{"id": "button15", "text": "button15"},
|
|
3036
|
+
{"id": "button16", "text": "button16"},
|
|
3037
|
+
{"id": "button17", "text": "button17"},
|
|
3038
|
+
{"id": "button18", "text": "button18"},
|
|
3039
|
+
{"id": "button19", "text": "button19"},
|
|
3040
|
+
{"id": "button20", "text": "button20"}
|
|
2977
3041
|
]
|
|
2978
3042
|
}
|
|
2979
3043
|
},
|
|
@@ -3000,8 +3064,8 @@
|
|
|
3000
3064
|
}
|
|
3001
3065
|
]
|
|
3002
3066
|
}
|
|
3003
|
-
|
|
3004
|
-
|
|
3067
|
+
]
|
|
3068
|
+
}
|
|
3005
3069
|
|
|
3006
3070
|
],
|
|
3007
3071
|
actionsScheme: [
|
package/dmx-ag-grid.js
CHANGED
|
@@ -62,7 +62,6 @@ dmx.Component('ag-grid', {
|
|
|
62
62
|
suppress_agg_at_root_level: { type: Boolean, default: false },
|
|
63
63
|
suppress_clipboard_paste: { type: Boolean, default: false },
|
|
64
64
|
suppress_scroll_on_new_data: { type: Boolean, default: false },
|
|
65
|
-
suppress_property_names_check: { type: Boolean, default: false },
|
|
66
65
|
hide_id_field: { type: Boolean, default: false },
|
|
67
66
|
numeric_column_align: { type: Boolean, default: false },
|
|
68
67
|
enable_rtl: { type: Boolean, default: false },
|
|
@@ -128,6 +127,7 @@ dmx.Component('ag-grid', {
|
|
|
128
127
|
delete_action_btn_condition: {type: String, default: null },
|
|
129
128
|
enable_custom_action_btns: { type: Boolean, default: false },
|
|
130
129
|
action_button_class_toggles: { type: Array, default: [] },
|
|
130
|
+
action_button_icon_class_toggles: { type: Array, default: [] },
|
|
131
131
|
button1_action_btn: { type: "Boolean", default: false },
|
|
132
132
|
button1_action_title: { type: "String", default: "" },
|
|
133
133
|
button1_action_tooltip: { type: "String", default: "" },
|
|
@@ -474,6 +474,7 @@ dmx.Component('ag-grid', {
|
|
|
474
474
|
const enableCellClickEvent = this.props.row_click_event && (this.props.enable_actions || this.props.row_checkbox_event);
|
|
475
475
|
const enableCellDoubleClickEvent = this.props.row_double_click_event && (this.props.enable_actions || this.props.row_checkbox_event);
|
|
476
476
|
const actionButtonClassToggles = options.action_button_class_toggles
|
|
477
|
+
const actionButtonIconClassToggles = options.action_button_icon_class_toggles
|
|
477
478
|
let localeText;
|
|
478
479
|
let columnDefs = [];
|
|
479
480
|
let groupedColumnDefs = [];
|
|
@@ -621,10 +622,19 @@ dmx.Component('ag-grid', {
|
|
|
621
622
|
button.innerHTML = `<i class="${buttonConfig.icon}"></i> ${buttonConfig.action}`;
|
|
622
623
|
container.appendChild(button);
|
|
623
624
|
// Handle dynamic classes based on conditions and buttonConfig.id
|
|
625
|
+
|
|
624
626
|
actionButtonClassToggles.forEach((toggle) => {
|
|
625
|
-
if (toggle.btn_id === buttonConfig.id && evaluateConditions([toggle.condition], params)) {
|
|
627
|
+
if (toggle.btn_id.toLowerCase() === buttonConfig.id && evaluateConditions([toggle.condition], params)) {
|
|
626
628
|
button.classList.add(...toggle.class.split(' '));
|
|
627
629
|
}
|
|
630
|
+
});
|
|
631
|
+
actionButtonIconClassToggles.forEach((iconToggle) => {
|
|
632
|
+
if (iconToggle.btn_id.toLowerCase() === buttonConfig.id && evaluateConditions([iconToggle.condition], params)) {
|
|
633
|
+
const iconElement = button.querySelector('i');
|
|
634
|
+
if (iconElement) {
|
|
635
|
+
iconElement.classList.add(...iconToggle.class.split(' '));
|
|
636
|
+
}
|
|
637
|
+
}
|
|
628
638
|
});
|
|
629
639
|
// Check if the button should be hidden based on the condition string and row data
|
|
630
640
|
if (buttonConfig.condition) {
|
|
@@ -714,22 +724,29 @@ dmx.Component('ag-grid', {
|
|
|
714
724
|
if (part === '||' || part === '&&') {
|
|
715
725
|
operators.push(part);
|
|
716
726
|
} else {
|
|
717
|
-
const
|
|
718
|
-
|
|
719
|
-
|
|
727
|
+
const hasOperator = /(==|!=|<=|>=|<|>)/.test(part);
|
|
728
|
+
if (!hasOperator) {
|
|
729
|
+
const left = part;
|
|
730
|
+
const result = params.data[left] !== null && params.data[left] !== undefined && params.data[left] !== "";
|
|
731
|
+
results.push(result);
|
|
732
|
+
} else {
|
|
733
|
+
const [left, operator, right] = extractConditionParts(part);
|
|
734
|
+
const result = params.data[left] !== null ? evaluateCondition(params.data[left], operator, right) : false;
|
|
735
|
+
results.push(result);
|
|
736
|
+
}
|
|
720
737
|
}
|
|
721
738
|
}
|
|
722
739
|
let finalResult = results[0];
|
|
723
|
-
|
|
740
|
+
|
|
724
741
|
for (let i = 0; i < operators.length; i++) {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
742
|
+
if (operators[i] === '||') {
|
|
743
|
+
finalResult = finalResult || results[i + 1];
|
|
744
|
+
} else if (operators[i] === '&&') {
|
|
745
|
+
finalResult = finalResult && results[i + 1];
|
|
746
|
+
}
|
|
747
|
+
}
|
|
731
748
|
return finalResult;
|
|
732
|
-
|
|
749
|
+
}
|
|
733
750
|
|
|
734
751
|
function evaluateCondition(left, operator, right) {
|
|
735
752
|
switch (operator) {
|
|
@@ -1585,7 +1602,6 @@ dmx.Component('ag-grid', {
|
|
|
1585
1602
|
suppressAggFuncInHeader: this.props.suppress_agg_func_in_header,
|
|
1586
1603
|
suppressClipboardPaste: this.props.suppress_clipboard_paste,
|
|
1587
1604
|
suppressScrollOnNewData: this.props.suppress_scroll_on_new_data,
|
|
1588
|
-
suppressPropertyNamesCheck: this.props.suppress_property_names_check,
|
|
1589
1605
|
columnHoverHighlight: this.props.column_hover_highlight,
|
|
1590
1606
|
onFilterModified: function (params) {
|
|
1591
1607
|
const columnApi = params.api;
|