@cdmx/wappler_ag_grid 1.1.7 → 1.1.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 +16 -2
- package/app_connect/components.hjson +93 -2
- package/dmx-ag-grid.js +73 -43
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -253,6 +253,7 @@ This will set the minimum width (px) for the Actions Column.(Default: 80)
|
|
|
253
253
|
**Actions Column Max Width**
|
|
254
254
|
This will set the maximum width (px) for the Actions Column.(Default: null)
|
|
255
255
|
|
|
256
|
+
|
|
256
257
|
**Edit Action Button**
|
|
257
258
|
This will display the "Edit Action Button" options.
|
|
258
259
|
|
|
@@ -265,9 +266,12 @@ Specify the tooltip text for the Edit Action button.
|
|
|
265
266
|
**Edit Action Button Class**
|
|
266
267
|
Specify the CSS class for styling the Edit Action button.
|
|
267
268
|
|
|
268
|
-
**Edit Action Icon Class**
|
|
269
|
+
**Edit Action Button Icon Class**
|
|
269
270
|
Specify the CSS class for styling the icon of the Edit Action button.
|
|
270
271
|
|
|
272
|
+
**Edit Action Button Condition**
|
|
273
|
+
Specify the condition to Show the Edit Action button, eg: code==TEST, or status==COMPLETED
|
|
274
|
+
|
|
271
275
|
**View Action Button**
|
|
272
276
|
This will display the "View Action Button" options.
|
|
273
277
|
|
|
@@ -280,10 +284,15 @@ Specify the tooltip text for the View Action button.
|
|
|
280
284
|
**View Action Button Class**
|
|
281
285
|
Specify the CSS class for styling the View Action button.
|
|
282
286
|
|
|
283
|
-
**View Action Icon Class**
|
|
287
|
+
**View Action Button Icon Class**
|
|
284
288
|
Specify the CSS class for styling the icon of the View Action button.
|
|
285
289
|
|
|
290
|
+
**View Action Button Condition**
|
|
291
|
+
Specify the condition to Show the View Action button, eg: code==TEST, or status==COMPLETED
|
|
292
|
+
|
|
286
293
|
**Delete Action Button**
|
|
294
|
+
This will display the "Delete Action Button" options.
|
|
295
|
+
|
|
287
296
|
**Delete Action Button Title**
|
|
288
297
|
Specify the title for the Delete Action button.
|
|
289
298
|
|
|
@@ -292,8 +301,13 @@ Specify the tooltip text for the Delete Action button.
|
|
|
292
301
|
|
|
293
302
|
**Delete Action Button Class**
|
|
294
303
|
Specify the CSS class for styling the Delete Action button.
|
|
304
|
+
|
|
305
|
+
**Delete Action Button Icon Class**
|
|
295
306
|
Specify the CSS class for styling the icon of the Delete Action button.
|
|
296
307
|
|
|
308
|
+
**Delete Action Button Condition**
|
|
309
|
+
Specify the condition to Show the Delete Action button, eg: code==TEST, or status==COMPLETED
|
|
310
|
+
|
|
297
311
|
# Custom Action Buttons
|
|
298
312
|
|
|
299
313
|
**Button1 Class**
|
|
@@ -1397,16 +1397,19 @@
|
|
|
1397
1397
|
"editActionTooltip",
|
|
1398
1398
|
"editActionBtnClass",
|
|
1399
1399
|
"editActionIconClass",
|
|
1400
|
+
"editActionBtnCondition",
|
|
1400
1401
|
"viewActionBtn",
|
|
1401
1402
|
"viewActionTitle",
|
|
1402
1403
|
"viewActionTooltip",
|
|
1403
1404
|
"viewActionBtnClass",
|
|
1404
1405
|
"viewActionIconClass",
|
|
1406
|
+
"viewActionBtnCondition",
|
|
1405
1407
|
"deleteActionBtn",
|
|
1406
1408
|
"deleteActionTitle",
|
|
1407
1409
|
"deleteActionTooltip",
|
|
1408
1410
|
"deleteActionBtnClass",
|
|
1409
|
-
"deleteActionIconClass"
|
|
1411
|
+
"deleteActionIconClass",
|
|
1412
|
+
"deleteActionBtnCondition"
|
|
1410
1413
|
],
|
|
1411
1414
|
"noChangeOnHide": true,
|
|
1412
1415
|
"groupEnabler": true,
|
|
@@ -1489,6 +1492,12 @@
|
|
|
1489
1492
|
"type": "text",
|
|
1490
1493
|
"defaultValue": 'fas fa-pencil-alt'
|
|
1491
1494
|
},
|
|
1495
|
+
{
|
|
1496
|
+
"name": "editActionBtnCondition",
|
|
1497
|
+
"attribute": "edit_action_btn_condition",
|
|
1498
|
+
"title": "Edit Action Button Conditon",
|
|
1499
|
+
"type": "text"
|
|
1500
|
+
},
|
|
1492
1501
|
{
|
|
1493
1502
|
"name": "viewActionBtn",
|
|
1494
1503
|
"attribute": "dmx-bind:view_action_btn",
|
|
@@ -1524,6 +1533,12 @@
|
|
|
1524
1533
|
"type": "text",
|
|
1525
1534
|
"defaultValue": 'fas fa-eye'
|
|
1526
1535
|
},
|
|
1536
|
+
{
|
|
1537
|
+
"name": "viewActionBtnCondition",
|
|
1538
|
+
"attribute": "view_action_btn_condition",
|
|
1539
|
+
"title": "View Action Button Conditon",
|
|
1540
|
+
"type": "text"
|
|
1541
|
+
},
|
|
1527
1542
|
{
|
|
1528
1543
|
"name": "deleteActionBtn",
|
|
1529
1544
|
"attribute": "dmx-bind:delete_action_btn",
|
|
@@ -1558,6 +1573,12 @@
|
|
|
1558
1573
|
"title": "Delete Action Icon Class",
|
|
1559
1574
|
"type": "text",
|
|
1560
1575
|
"defaultValue": 'fas fa-trash'
|
|
1576
|
+
},
|
|
1577
|
+
{
|
|
1578
|
+
"name": "deleteActionBtnCondition",
|
|
1579
|
+
"attribute": "delete_action_btn_condition",
|
|
1580
|
+
"title": "Delete Action Button Conditon",
|
|
1581
|
+
"type": "text"
|
|
1561
1582
|
}
|
|
1562
1583
|
]
|
|
1563
1584
|
},
|
|
@@ -1575,51 +1596,61 @@
|
|
|
1575
1596
|
"button1ActionTooltip",
|
|
1576
1597
|
"button1ActionBtnClass",
|
|
1577
1598
|
"button1ActionIconClass",
|
|
1599
|
+
"button1ActionBtnCondition",
|
|
1578
1600
|
"button2ActionBtn",
|
|
1579
1601
|
"button2ActionTitle",
|
|
1580
1602
|
"button2ActionTooltip",
|
|
1581
1603
|
"button2ActionBtnClass",
|
|
1582
1604
|
"button2ActionIconClass",
|
|
1605
|
+
"button2ActionBtnCondition",
|
|
1583
1606
|
"button3ActionBtn",
|
|
1584
1607
|
"button3ActionTitle",
|
|
1585
1608
|
"button3ActionTooltip",
|
|
1586
1609
|
"button3ActionBtnClass",
|
|
1587
1610
|
"button3ActionIconClass",
|
|
1611
|
+
"button3ActionBtnCondition",
|
|
1588
1612
|
"button4ActionBtn",
|
|
1589
1613
|
"button4ActionTitle",
|
|
1590
1614
|
"button4ActionTooltip",
|
|
1591
1615
|
"button4ActionBtnClass",
|
|
1592
1616
|
"button4ActionIconClass",
|
|
1617
|
+
"button4ActionBtnCondition",
|
|
1593
1618
|
"button5ActionBtn",
|
|
1594
1619
|
"button5ActionTitle",
|
|
1595
1620
|
"button5ActionTooltip",
|
|
1596
1621
|
"button5ActionBtnClass",
|
|
1597
1622
|
"button5ActionIconClass",
|
|
1623
|
+
"button5ActionBtnCondition",
|
|
1598
1624
|
"button6ActionBtn",
|
|
1599
1625
|
"button6ActionTitle",
|
|
1600
1626
|
"button6ActionTooltip",
|
|
1601
1627
|
"button6ActionBtnClass",
|
|
1602
1628
|
"button6ActionIconClass",
|
|
1629
|
+
"button6ActionBtnCondition",
|
|
1603
1630
|
"button7ActionBtn",
|
|
1604
1631
|
"button7ActionTitle",
|
|
1605
1632
|
"button7ActionTooltip",
|
|
1606
1633
|
"button7ActionBtnClass",
|
|
1607
1634
|
"button7ActionIconClass",
|
|
1635
|
+
"button7ActionBtnCondition",
|
|
1608
1636
|
"button8ActionBtn",
|
|
1609
1637
|
"button8ActionTitle",
|
|
1610
1638
|
"button8ActionTooltip",
|
|
1611
1639
|
"button8ActionBtnClass",
|
|
1612
1640
|
"button8ActionIconClass",
|
|
1641
|
+
"button8ActionBtnCondition",
|
|
1613
1642
|
"button9ActionBtn",
|
|
1614
1643
|
"button9ActionTitle",
|
|
1615
1644
|
"button9ActionTooltip",
|
|
1616
1645
|
"button9ActionBtnClass",
|
|
1617
1646
|
"button9ActionIconClass",
|
|
1647
|
+
"button9ActionBtnCondition",
|
|
1618
1648
|
"button10ActionBtn",
|
|
1619
1649
|
"button10ActionTitle",
|
|
1620
1650
|
"button10ActionTooltip",
|
|
1621
1651
|
"button10ActionBtnClass",
|
|
1622
|
-
"button10ActionIconClass"
|
|
1652
|
+
"button10ActionIconClass",
|
|
1653
|
+
"button10ActionBtnCondition"
|
|
1623
1654
|
],
|
|
1624
1655
|
"noChangeOnHide": true,
|
|
1625
1656
|
"groupEnabler": true,
|
|
@@ -1668,6 +1699,12 @@
|
|
|
1668
1699
|
"type": "text",
|
|
1669
1700
|
"defaultValue": "fas fa-wrench"
|
|
1670
1701
|
},
|
|
1702
|
+
{
|
|
1703
|
+
"name": "button1ActionBtnCondition",
|
|
1704
|
+
"attribute": "button1_action_btn_condition",
|
|
1705
|
+
"title": "Button1 Conditon",
|
|
1706
|
+
"type": "text"
|
|
1707
|
+
},
|
|
1671
1708
|
{
|
|
1672
1709
|
"name": "button2ActionBtn",
|
|
1673
1710
|
"attribute": "dmx-bind:button2_action_btn",
|
|
@@ -1703,6 +1740,12 @@
|
|
|
1703
1740
|
"type": "text",
|
|
1704
1741
|
"defaultValue": "fas fa-search-plus"
|
|
1705
1742
|
},
|
|
1743
|
+
{
|
|
1744
|
+
"name": "button2ActionBtnCondition",
|
|
1745
|
+
"attribute": "button2_action_btn_condition",
|
|
1746
|
+
"title": "Button2 Conditon",
|
|
1747
|
+
"type": "text"
|
|
1748
|
+
},
|
|
1706
1749
|
{
|
|
1707
1750
|
"name": "button3ActionBtn",
|
|
1708
1751
|
"attribute": "dmx-bind:button3_action_btn",
|
|
@@ -1738,6 +1781,12 @@
|
|
|
1738
1781
|
"type": "text",
|
|
1739
1782
|
"defaultValue": "fas fa-check-circle"
|
|
1740
1783
|
},
|
|
1784
|
+
{
|
|
1785
|
+
"name": "button3ActionBtnCondition",
|
|
1786
|
+
"attribute": "button3_action_btn_condition",
|
|
1787
|
+
"title": "Button3 Conditon",
|
|
1788
|
+
"type": "text"
|
|
1789
|
+
},
|
|
1741
1790
|
{
|
|
1742
1791
|
"name": "button4ActionBtn",
|
|
1743
1792
|
"attribute": "dmx-bind:button4_action_btn",
|
|
@@ -1773,6 +1822,12 @@
|
|
|
1773
1822
|
"type": "text",
|
|
1774
1823
|
"defaultValue": "fas fa-exclamation-triangle"
|
|
1775
1824
|
},
|
|
1825
|
+
{
|
|
1826
|
+
"name": "button4ActionBtnCondition",
|
|
1827
|
+
"attribute": "button4_action_btn_condition",
|
|
1828
|
+
"title": "Button4 Conditon",
|
|
1829
|
+
"type": "text"
|
|
1830
|
+
},
|
|
1776
1831
|
{
|
|
1777
1832
|
"name": "button5ActionBtn",
|
|
1778
1833
|
"attribute": "dmx-bind:button5_action_btn",
|
|
@@ -1808,6 +1863,12 @@
|
|
|
1808
1863
|
"type": "text",
|
|
1809
1864
|
"defaultValue": "fas fa-times-circle"
|
|
1810
1865
|
},
|
|
1866
|
+
{
|
|
1867
|
+
"name": "button5ActionBtnCondition",
|
|
1868
|
+
"attribute": "button5_action_btn_condition",
|
|
1869
|
+
"title": "Button5 Conditon",
|
|
1870
|
+
"type": "text"
|
|
1871
|
+
},
|
|
1811
1872
|
{
|
|
1812
1873
|
"name": "button6ActionBtn",
|
|
1813
1874
|
"attribute": "dmx-bind:button6_action_btn",
|
|
@@ -1843,6 +1904,12 @@
|
|
|
1843
1904
|
"type": "text",
|
|
1844
1905
|
"defaultValue": "fas fa-link"
|
|
1845
1906
|
},
|
|
1907
|
+
{
|
|
1908
|
+
"name": "button6ActionBtnCondition",
|
|
1909
|
+
"attribute": "button6_action_btn_condition",
|
|
1910
|
+
"title": "Button6 Conditon",
|
|
1911
|
+
"type": "text"
|
|
1912
|
+
},
|
|
1846
1913
|
{
|
|
1847
1914
|
"name": "button7ActionBtn",
|
|
1848
1915
|
"attribute": "dmx-bind:button7_action_btn",
|
|
@@ -1878,6 +1945,12 @@
|
|
|
1878
1945
|
"type": "text",
|
|
1879
1946
|
"defaultValue": "fas fa-download"
|
|
1880
1947
|
},
|
|
1948
|
+
{
|
|
1949
|
+
"name": "button7ActionBtnCondition",
|
|
1950
|
+
"attribute": "button7_action_btn_condition",
|
|
1951
|
+
"title": "Button7 Conditon",
|
|
1952
|
+
"type": "text"
|
|
1953
|
+
},
|
|
1881
1954
|
{
|
|
1882
1955
|
"name": "button8ActionBtn",
|
|
1883
1956
|
"attribute": "dmx-bind:button8_action_btn",
|
|
@@ -1913,6 +1986,12 @@
|
|
|
1913
1986
|
"type": "text",
|
|
1914
1987
|
"defaultValue": "fas fa-file-pdf"
|
|
1915
1988
|
},
|
|
1989
|
+
{
|
|
1990
|
+
"name": "button8ActionBtnCondition",
|
|
1991
|
+
"attribute": "button8_action_btn_condition",
|
|
1992
|
+
"title": "Button8 Conditon",
|
|
1993
|
+
"type": "text"
|
|
1994
|
+
},
|
|
1916
1995
|
{
|
|
1917
1996
|
"name": "button9ActionBtn",
|
|
1918
1997
|
"attribute": "dmx-bind:button9_action_btn",
|
|
@@ -1948,6 +2027,12 @@
|
|
|
1948
2027
|
"type": "text",
|
|
1949
2028
|
"defaultValue": "fas fa-star"
|
|
1950
2029
|
},
|
|
2030
|
+
{
|
|
2031
|
+
"name": "button9ActionBtnCondition",
|
|
2032
|
+
"attribute": "button9_action_btn_condition",
|
|
2033
|
+
"title": "Button9 Conditon",
|
|
2034
|
+
"type": "text"
|
|
2035
|
+
},
|
|
1951
2036
|
{
|
|
1952
2037
|
"name": "button10ActionBtn",
|
|
1953
2038
|
"attribute": "dmx-bind:button10_action_btn",
|
|
@@ -1982,6 +2067,12 @@
|
|
|
1982
2067
|
"title": "Button10 Icon Class",
|
|
1983
2068
|
"type": "text",
|
|
1984
2069
|
"defaultValue": "fas fa-trash-alt"
|
|
2070
|
+
},
|
|
2071
|
+
{
|
|
2072
|
+
"name": "button10ActionBtnCondition",
|
|
2073
|
+
"attribute": "button10_action_btn_condition",
|
|
2074
|
+
"title": "Button10 Conditon",
|
|
2075
|
+
"type": "text"
|
|
1985
2076
|
}
|
|
1986
2077
|
|
|
1987
2078
|
]
|
package/dmx-ag-grid.js
CHANGED
|
@@ -83,67 +83,80 @@ dmx.Component('ag-grid', {
|
|
|
83
83
|
edit_action_tooltip: {type: String, default: 'Edit' },
|
|
84
84
|
edit_action_icon_class: {type: String, default: 'fas fa-pencil-alt' },
|
|
85
85
|
edit_action_btn_class: {type: String, default: 'btn-primary btn-xs m-1' },
|
|
86
|
+
edit_action_btn_condition: {type: String, default: null },
|
|
86
87
|
view_action_btn: { type: Boolean, default: false },
|
|
87
88
|
view_action_title: {type: String, default: '' },
|
|
88
89
|
view_action_tooltip: {type: String, default: 'View' },
|
|
89
90
|
view_action_icon_class: {type: String, default: 'fas fa-eye' },
|
|
90
91
|
view_action_btn_class: {type: String, default: 'btn-info btn-xs m-1' },
|
|
92
|
+
view_action_btn_condition: {type: String, default: null },
|
|
91
93
|
delete_action_btn: { type: Boolean, default: false },
|
|
92
94
|
delete_action_title: {type: String, default: '' },
|
|
93
95
|
delete_action_tooltip: {type: String, default: 'Delete' },
|
|
94
96
|
delete_action_icon_class: {type: String, default: 'fas fa-trash' },
|
|
95
97
|
delete_action_btn_class: {type: String, default: 'btn-danger btn-xs m-1' },
|
|
98
|
+
delete_action_btn_condition: {type: String, default: null },
|
|
96
99
|
enable_custom_action_btns: { type: Boolean, default: false },
|
|
97
100
|
button1_action_btn: { type: "Boolean", default: false },
|
|
98
101
|
button1_action_title: { type: "String", default: "" },
|
|
99
102
|
button1_action_tooltip: { type: "String", default: "" },
|
|
100
103
|
button1_action_icon_class: { type: "String", default: "fas fa-wrench" },
|
|
101
104
|
button1_action_btn_class: { type: "String", default: "btn-primary btn-xs m-1" },
|
|
105
|
+
button1_action_btn_condition: {type: String, default: null },
|
|
102
106
|
button2_action_btn: { type: "Boolean", default: false },
|
|
103
107
|
button2_action_title: { type: "String", default: "" },
|
|
104
108
|
button2_action_tooltip: { type: "String", default: "" },
|
|
105
109
|
button2_action_icon_class: { type: "String", default: "fas fa-search-plus" },
|
|
106
110
|
button2_action_btn_class: { type: "String", default: "btn-info btn-xs m-1" },
|
|
111
|
+
button2_action_btn_condition: {type: String, default: null },
|
|
107
112
|
button3_action_btn: { type: "Boolean", default: false },
|
|
108
113
|
button3_action_title: { type: "String", default: "" },
|
|
109
114
|
button3_action_tooltip: { type: "String", default: "" },
|
|
110
115
|
button3_action_icon_class: { type: "String", default: "fas fa-check-circle" },
|
|
111
116
|
button3_action_btn_class: { type: "String", default: "btn-success btn-xs m-1" },
|
|
117
|
+
button3_action_btn_condition: {type: String, default: null },
|
|
112
118
|
button4_action_btn: { type: "Boolean", default: false },
|
|
113
119
|
button4_action_title: { type: "String", default: "" },
|
|
114
120
|
button4_action_tooltip: { type: "String", default: "" },
|
|
115
121
|
button4_action_icon_class: { type: "String", default: "fas fa-exclamation-triangle" },
|
|
116
122
|
button4_action_btn_class: { type: "String", default: "btn-warning btn-xs m-1" },
|
|
123
|
+
button4_action_btn_condition: {type: String, default: null },
|
|
117
124
|
button5_action_btn: { type: "Boolean", default: false },
|
|
118
125
|
button5_action_title: { type: "String", default: "" },
|
|
119
126
|
button5_action_tooltip: { type: "String", default: "Edit" },
|
|
120
127
|
button5_action_icon_class: { type: "String", default: "fas fa-times-circle" },
|
|
121
128
|
button5_action_btn_class: { type: "String", default: "btn-danger btn-xs m-1" },
|
|
129
|
+
button5_action_btn_condition: {type: String, default: null },
|
|
122
130
|
button6_action_btn: { type: "Boolean", default: false },
|
|
123
131
|
button6_action_title: { type: "String", default: "" },
|
|
124
132
|
button6_action_tooltip: { type: "String", default: "" },
|
|
125
133
|
button6_action_icon_class: { type: "String", default: "fas fa-link" },
|
|
126
134
|
button6_action_btn_class: { type: "String", default: "btn-secondary btn-xs m-1" },
|
|
135
|
+
button6_action_btn_condition: {type: String, default: null },
|
|
127
136
|
button7_action_btn: { type: "Boolean", default: false },
|
|
128
137
|
button7_action_title: { type: "String", default: "" },
|
|
129
138
|
button7_action_tooltip: { type: "String", default: "" },
|
|
130
139
|
button7_action_icon_class: { type: "String", default: "fas fa-download" },
|
|
131
140
|
button7_action_btn_class: { type: "String", default: "btn-primary btn-xm" },
|
|
141
|
+
button7_action_btn_condition: {type: String, default: null },
|
|
132
142
|
button8_action_btn: { type: "Boolean", default: false },
|
|
133
143
|
button8_action_title: { type: "String", default: "" },
|
|
134
144
|
button8_action_tooltip: { type: "String", default: "" },
|
|
135
145
|
button8_action_icon_class: { type: "String", default: "fas fa-file-pdf" },
|
|
136
146
|
button8_action_btn_class: { type: "String", default: "btn-info btn-xs m-1" },
|
|
147
|
+
button8_action_btn_condition: {type: String, default: null },
|
|
137
148
|
button9_action_btn: { type: "Boolean", default: false },
|
|
138
149
|
button9_action_title: { type: "String", default: "" },
|
|
139
150
|
button9_action_tooltip: { type: "String", default: "" },
|
|
140
151
|
button9_action_icon_class: { type: "String", default: "fas fa-star" },
|
|
141
152
|
button9_action_btn_class: { type: "String", default: "btn-success btn-xs m-1" },
|
|
153
|
+
button9_action_btn_condition: {type: String, default: null },
|
|
142
154
|
button10_action_btn: { type: "Boolean", default: false },
|
|
143
155
|
button10_action_title: { type: "String", default: "" },
|
|
144
156
|
button10_action_tooltip: { type: "String", default: "" },
|
|
145
157
|
button10_action_icon_class: { type: "String", default: "fas fa-trash-alt" },
|
|
146
158
|
button10_action_btn_class: { type: "String", default: "btn-danger btn-xs m-1" },
|
|
159
|
+
button10_action_btn_condition: {type: String, default: null },
|
|
147
160
|
data_binded_changes: {type: Array, default: [] },
|
|
148
161
|
hide_fields: {type: String, default: null },
|
|
149
162
|
hide_filters: {type: String, default: null },
|
|
@@ -445,6 +458,15 @@ dmx.Component('ag-grid', {
|
|
|
445
458
|
button.setAttribute('title', buttonConfig.tooltip);
|
|
446
459
|
button.innerHTML = `<i class="${buttonConfig.icon}"></i> ${buttonConfig.action}`;
|
|
447
460
|
container.appendChild(button);
|
|
461
|
+
// Check if the button should be hidden based on the condition string and row data
|
|
462
|
+
if (buttonConfig.condition) {
|
|
463
|
+
const [left, operator, right] = extractConditionParts(buttonConfig.condition);
|
|
464
|
+
|
|
465
|
+
const isConditionMet = params.data.hasOwnProperty(left) && evaluateCondition(params.data[left], operator, right);
|
|
466
|
+
if (!isConditionMet) {
|
|
467
|
+
button.style.setProperty('display', 'none', 'important');
|
|
468
|
+
}
|
|
469
|
+
}
|
|
448
470
|
button.addEventListener('click', function () {
|
|
449
471
|
if (typeof buttonConfig.onClick === 'function') {
|
|
450
472
|
buttonConfig.onClick(params.data);
|
|
@@ -493,6 +515,52 @@ dmx.Component('ag-grid', {
|
|
|
493
515
|
}
|
|
494
516
|
return params.value;
|
|
495
517
|
}
|
|
518
|
+
|
|
519
|
+
function extractConditionParts(condition) {
|
|
520
|
+
|
|
521
|
+
const operators = ['===', '==', '!=', '>', '<', '>=', '<='];
|
|
522
|
+
let operator;
|
|
523
|
+
let left;
|
|
524
|
+
let right;
|
|
525
|
+
|
|
526
|
+
for (const op of operators) {
|
|
527
|
+
if (condition.includes(op)) {
|
|
528
|
+
operator = op;
|
|
529
|
+
const parts = condition.split(op).map(part => part.trim());
|
|
530
|
+
left = parts[0];
|
|
531
|
+
right = parts.slice(1).join(op).trim();
|
|
532
|
+
break;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
if (!operator) {
|
|
537
|
+
throw new Error('Invalid operator in the condition.');
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
return [left, operator, right];
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function evaluateCondition(left, operator, right) {
|
|
544
|
+
switch (operator) {
|
|
545
|
+
case '===':
|
|
546
|
+
return left.toString() === right.toString();
|
|
547
|
+
case '==':
|
|
548
|
+
return left.toString() == right.toString();
|
|
549
|
+
case '!=':
|
|
550
|
+
return left.toString() != right.toString();
|
|
551
|
+
case '>':
|
|
552
|
+
return left.toString() > parseFloat(right);
|
|
553
|
+
case '<':
|
|
554
|
+
return left.toString() < parseFloat(right);
|
|
555
|
+
case '>=':
|
|
556
|
+
return left.toString() >= parseFloat(right);
|
|
557
|
+
case '<=':
|
|
558
|
+
return left.toString() <= parseFloat(right);
|
|
559
|
+
default:
|
|
560
|
+
return false;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
496
564
|
function formatDate(timestamp) {
|
|
497
565
|
const format = options.date_format
|
|
498
566
|
const localDate = new Date(timestamp);
|
|
@@ -849,50 +917,7 @@ dmx.Component('ag-grid', {
|
|
|
849
917
|
tooltipValueGetter = createCombinedTooltipValueGetter(key, options.data_changes, options.data_binded_changes);
|
|
850
918
|
|
|
851
919
|
}
|
|
852
|
-
function extractConditionParts(condition) {
|
|
853
|
-
|
|
854
|
-
const operators = ['===', '==', '!=', '>', '<', '>=', '<='];
|
|
855
|
-
let operator;
|
|
856
|
-
let left;
|
|
857
|
-
let right;
|
|
858
|
-
|
|
859
|
-
for (const op of operators) {
|
|
860
|
-
if (condition.includes(op)) {
|
|
861
|
-
operator = op;
|
|
862
|
-
const parts = condition.split(op).map(part => part.trim());
|
|
863
|
-
left = parts[0];
|
|
864
|
-
right = parts.slice(1).join(op).trim();
|
|
865
|
-
break;
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
920
|
|
|
869
|
-
if (!operator) {
|
|
870
|
-
throw new Error('Invalid operator in the condition.');
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
return [left, operator, right];
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
function evaluateCondition(left, operator, right) {
|
|
877
|
-
switch (operator) {
|
|
878
|
-
case '===':
|
|
879
|
-
return left.toString() === right.toString();
|
|
880
|
-
case '==':
|
|
881
|
-
return left.toString() == right.toString();
|
|
882
|
-
case '!=':
|
|
883
|
-
return left.toString() != right.toString();
|
|
884
|
-
case '>':
|
|
885
|
-
return left.toString() > parseFloat(right);
|
|
886
|
-
case '<':
|
|
887
|
-
return left.toString() < parseFloat(right);
|
|
888
|
-
case '>=':
|
|
889
|
-
return left.toString() >= parseFloat(right);
|
|
890
|
-
case '<=':
|
|
891
|
-
return left.toString() <= parseFloat(right);
|
|
892
|
-
default:
|
|
893
|
-
return false;
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
921
|
const cstyles = this.props.cstyles
|
|
897
922
|
// Check if custom color exists for the current field and condition
|
|
898
923
|
function applyCellStyle(params) {
|
|
@@ -1059,6 +1084,7 @@ dmx.Component('ag-grid', {
|
|
|
1059
1084
|
this.set('id', rowData.id);
|
|
1060
1085
|
this.dispatchEvent('row_action_edit');
|
|
1061
1086
|
},
|
|
1087
|
+
condition: options.edit_action_btn_condition
|
|
1062
1088
|
});
|
|
1063
1089
|
}
|
|
1064
1090
|
|
|
@@ -1073,6 +1099,7 @@ dmx.Component('ag-grid', {
|
|
|
1073
1099
|
this.set('id', rowData.id);
|
|
1074
1100
|
this.dispatchEvent('row_action_view');
|
|
1075
1101
|
},
|
|
1102
|
+
condition: options.view_action_btn_condition
|
|
1076
1103
|
});
|
|
1077
1104
|
}
|
|
1078
1105
|
|
|
@@ -1087,6 +1114,7 @@ dmx.Component('ag-grid', {
|
|
|
1087
1114
|
this.set('id', rowData.id);
|
|
1088
1115
|
this.dispatchEvent('row_action_delete');
|
|
1089
1116
|
},
|
|
1117
|
+
condition: options.delete_action_btn_condition
|
|
1090
1118
|
});
|
|
1091
1119
|
}
|
|
1092
1120
|
|
|
@@ -1097,6 +1125,7 @@ dmx.Component('ag-grid', {
|
|
|
1097
1125
|
const buttonClassKey = `button${i}_action_btn_class`;
|
|
1098
1126
|
const buttonTooltipKey = `button${i}_action_tooltip`;
|
|
1099
1127
|
const buttonIconClassKey = `button${i}_action_icon_class`;
|
|
1128
|
+
const buttonConditionKey = `button${i}_action_btn_condition`;
|
|
1100
1129
|
|
|
1101
1130
|
if (options[buttonActionKey]) {
|
|
1102
1131
|
actionsColumn.cellRendererParams.buttons.push({
|
|
@@ -1109,6 +1138,7 @@ dmx.Component('ag-grid', {
|
|
|
1109
1138
|
this.set('id', rowData.id);
|
|
1110
1139
|
this.dispatchEvent(`row_action_button${i}`);
|
|
1111
1140
|
},
|
|
1141
|
+
condition: options[buttonConditionKey]
|
|
1112
1142
|
});
|
|
1113
1143
|
}
|
|
1114
1144
|
}
|