@cdmx/wappler_ag_grid 0.0.7 → 0.0.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 +2 -0
- package/ag-grid-community.min.js +3 -3
- package/ag-grid.css +7141 -0
- package/ag-theme-alpine.css +369 -6
- package/ag-theme-balham.css +217 -0
- package/ag-theme-material.css +261 -0
- package/app_connect/components.hjson +75 -40
- package/dmx-ag-grid.js +50 -5
- package/package.json +1 -1
|
@@ -14,21 +14,18 @@
|
|
|
14
14
|
"help": "AG Grid component for data display",
|
|
15
15
|
"dataScheme": [
|
|
16
16
|
{
|
|
17
|
-
"name": "
|
|
18
|
-
"title": "
|
|
17
|
+
"name": "id",
|
|
18
|
+
"title": "Id",
|
|
19
|
+
"type": "number"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "fields",
|
|
23
|
+
"title": "Fields",
|
|
19
24
|
"type": "object"
|
|
20
25
|
}
|
|
21
26
|
],
|
|
22
27
|
"outputType": "object",
|
|
23
28
|
"dataPick": true,
|
|
24
|
-
"outputType": "object",
|
|
25
|
-
"dataScheme": [
|
|
26
|
-
{
|
|
27
|
-
"name": "data",
|
|
28
|
-
"title": "Data",
|
|
29
|
-
"type": "object"
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
29
|
"properties": [
|
|
33
30
|
{
|
|
34
31
|
"group": "AG Grid Properties",
|
|
@@ -50,6 +47,20 @@
|
|
|
50
47
|
"defaultValue": [],
|
|
51
48
|
"required": true,
|
|
52
49
|
"help": "Enter Data Source"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "grid_theme",
|
|
53
|
+
"attribute": "grid_theme",
|
|
54
|
+
"title": "Theme",
|
|
55
|
+
"type": "droplist",
|
|
56
|
+
"defaultValue": 'ag-theme-alpine',
|
|
57
|
+
"values": [
|
|
58
|
+
{title: 'Alpine', value: 'ag-theme-alpine'},
|
|
59
|
+
{title: 'Balham', value: 'ag-theme-balham'},
|
|
60
|
+
{title: 'Material', value: 'ag-theme-material'},
|
|
61
|
+
{title: 'Base', value: 'ag-grid'}
|
|
62
|
+
],
|
|
63
|
+
"help": "Select a theme for the grid"
|
|
53
64
|
}
|
|
54
65
|
]
|
|
55
66
|
},
|
|
@@ -194,7 +205,7 @@
|
|
|
194
205
|
},
|
|
195
206
|
{
|
|
196
207
|
"name": "fixedHeader",
|
|
197
|
-
"attribute": "fixedHeader",
|
|
208
|
+
"attribute": "dmx-bind:fixedHeader",
|
|
198
209
|
"title": "Sticky Header",
|
|
199
210
|
"type": "boolean",
|
|
200
211
|
"display": "fieldset",
|
|
@@ -254,7 +265,7 @@
|
|
|
254
265
|
},
|
|
255
266
|
{
|
|
256
267
|
"name": "suppressRowClickSelection",
|
|
257
|
-
"attribute": "suppressRowClickSelection",
|
|
268
|
+
"attribute": "dmx-bind:suppressRowClickSelection",
|
|
258
269
|
"title": "Suppress Row Click Selection",
|
|
259
270
|
"type": "boolean",
|
|
260
271
|
"defaultValue": false,
|
|
@@ -262,7 +273,7 @@
|
|
|
262
273
|
},
|
|
263
274
|
{
|
|
264
275
|
"name": "suppressMenuHide",
|
|
265
|
-
"attribute": "suppressMenuHide",
|
|
276
|
+
"attribute": "dmx-bind:suppressMenuHide",
|
|
266
277
|
"title": "Suppress Menu Hide",
|
|
267
278
|
"type": "boolean",
|
|
268
279
|
"defaultValue": false,
|
|
@@ -270,7 +281,7 @@
|
|
|
270
281
|
},
|
|
271
282
|
{
|
|
272
283
|
"name": "suppressMovableColumns",
|
|
273
|
-
"attribute": "suppressMovableColumns",
|
|
284
|
+
"attribute": "dmx-bind:suppressMovableColumns",
|
|
274
285
|
"title": "Suppress Movable Columns",
|
|
275
286
|
"type": "boolean",
|
|
276
287
|
"defaultValue": false,
|
|
@@ -278,7 +289,7 @@
|
|
|
278
289
|
},
|
|
279
290
|
{
|
|
280
291
|
"name": "enableCellExpressions",
|
|
281
|
-
"attribute": "enableCellExpressions",
|
|
292
|
+
"attribute": "dmx-bind:enableCellExpressions",
|
|
282
293
|
"title": "Enable Cell Expressions",
|
|
283
294
|
"type": "boolean",
|
|
284
295
|
"defaultValue": false,
|
|
@@ -286,7 +297,7 @@
|
|
|
286
297
|
},
|
|
287
298
|
{
|
|
288
299
|
"name": "animateRows",
|
|
289
|
-
"attribute": "animateRows",
|
|
300
|
+
"attribute": "dmx-bind:animateRows",
|
|
290
301
|
"title": "Animate Rows",
|
|
291
302
|
"type": "boolean",
|
|
292
303
|
"defaultValue": false,
|
|
@@ -294,7 +305,7 @@
|
|
|
294
305
|
},
|
|
295
306
|
{
|
|
296
307
|
"name": "suppressAggFuncInHeader",
|
|
297
|
-
"attribute": "suppressAggFuncInHeader",
|
|
308
|
+
"attribute": "dmx-bind:suppressAggFuncInHeader",
|
|
298
309
|
"title": "Suppress Aggregation Function in Header",
|
|
299
310
|
"type": "boolean",
|
|
300
311
|
"defaultValue": false,
|
|
@@ -302,7 +313,7 @@
|
|
|
302
313
|
},
|
|
303
314
|
{
|
|
304
315
|
"name": "suppressAggAtRootLevel",
|
|
305
|
-
"attribute": "suppressAggAtRootLevel",
|
|
316
|
+
"attribute": "dmx-bind:suppressAggAtRootLevel",
|
|
306
317
|
"title": "Suppress Aggregation at Root Level",
|
|
307
318
|
"type": "boolean",
|
|
308
319
|
"defaultValue": false,
|
|
@@ -310,7 +321,7 @@
|
|
|
310
321
|
},
|
|
311
322
|
{
|
|
312
323
|
"name": "suppressClipboardPaste",
|
|
313
|
-
"attribute": "suppressClipboardPaste",
|
|
324
|
+
"attribute": "dmx-bind:suppressClipboardPaste",
|
|
314
325
|
"title": "Suppress Clipboard Paste",
|
|
315
326
|
"type": "boolean",
|
|
316
327
|
"defaultValue": false,
|
|
@@ -318,7 +329,7 @@
|
|
|
318
329
|
},
|
|
319
330
|
{
|
|
320
331
|
"name": "suppressScrollOnNewData",
|
|
321
|
-
"attribute": "suppressScrollOnNewData",
|
|
332
|
+
"attribute": "dmx-bind:suppressScrollOnNewData",
|
|
322
333
|
"title": "Suppress Scroll on New Data",
|
|
323
334
|
"type": "boolean",
|
|
324
335
|
"defaultValue": false,
|
|
@@ -326,7 +337,7 @@
|
|
|
326
337
|
},
|
|
327
338
|
{
|
|
328
339
|
"name": "suppressPropertyNamesCheck",
|
|
329
|
-
"attribute": "suppressPropertyNamesCheck",
|
|
340
|
+
"attribute": "dmx-bind:suppressPropertyNamesCheck",
|
|
330
341
|
"title": "Suppress Property Names Check",
|
|
331
342
|
"type": "boolean",
|
|
332
343
|
"defaultValue": false,
|
|
@@ -339,6 +350,14 @@
|
|
|
339
350
|
"type": "object",
|
|
340
351
|
"defaultValue": {},
|
|
341
352
|
"help": "Localization strings for the grid"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"name": "rowClickEvent",
|
|
356
|
+
"attribute": "dmx-bind:row_click_event",
|
|
357
|
+
"title": "Row Click Events",
|
|
358
|
+
"type": "boolean",
|
|
359
|
+
"defaultValue": false,
|
|
360
|
+
"help": "This enabled row click en=vents whcihc can then be used in Dynamic events => Grid Events => Row Clicked"
|
|
342
361
|
}
|
|
343
362
|
]
|
|
344
363
|
},
|
|
@@ -621,7 +640,17 @@
|
|
|
621
640
|
}
|
|
622
641
|
|
|
623
642
|
],
|
|
624
|
-
|
|
643
|
+
actionsScheme: [
|
|
644
|
+
{
|
|
645
|
+
addTitle: 'Reload Grid',
|
|
646
|
+
title : 'Reload Grid',
|
|
647
|
+
name : 'reloadGrid',
|
|
648
|
+
icon : 'fa fa-lg fa-play',
|
|
649
|
+
state : 'opened',
|
|
650
|
+
help: 'Reload the AG Grid',
|
|
651
|
+
properties : []
|
|
652
|
+
},
|
|
653
|
+
],
|
|
625
654
|
"children": [],
|
|
626
655
|
"allowed_children": {},
|
|
627
656
|
"copyFiles": [
|
|
@@ -633,6 +662,14 @@
|
|
|
633
662
|
"src": "ag-theme-alpine.css",
|
|
634
663
|
"dst": "css/ag-theme-alpine.css"
|
|
635
664
|
},
|
|
665
|
+
{
|
|
666
|
+
"src": "ag-theme-balham.css",
|
|
667
|
+
"dst": "css/ag-theme-balham.css"
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
"src": "ag-theme-material.css",
|
|
671
|
+
"dst": "css/ag-theme-material.css"
|
|
672
|
+
},
|
|
636
673
|
{
|
|
637
674
|
"src": "dmx-ag-grid.js",
|
|
638
675
|
"dst": "js/dmx-ag-grid.js"
|
|
@@ -652,6 +689,14 @@
|
|
|
652
689
|
{
|
|
653
690
|
"src": "css/ag-theme-alpine.css",
|
|
654
691
|
"type": "css"
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
"src": "css/ag-theme-balham.css",
|
|
695
|
+
"type": "css"
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
"src": "css/ag-theme-material.css",
|
|
699
|
+
"type": "css"
|
|
655
700
|
}
|
|
656
701
|
],
|
|
657
702
|
"cssOrder": [],
|
|
@@ -696,44 +741,34 @@
|
|
|
696
741
|
],
|
|
697
742
|
"events": [
|
|
698
743
|
{
|
|
699
|
-
"name": "dmx-ag-grid-row-
|
|
744
|
+
"name": "dmx-ag-grid-row-clicked",
|
|
700
745
|
"attributeStartsWith": "dmx-on",
|
|
746
|
+
"attribute": "row_clicked",
|
|
701
747
|
"display": "fieldset",
|
|
702
|
-
"title": "
|
|
748
|
+
"title": "Row Clicked",
|
|
703
749
|
"icon": "fa fa-lg fa-chevron-right",
|
|
704
750
|
"groupTitle": "Grid Events",
|
|
705
751
|
"groupIcon": "fa fa-lg fa-cubes",
|
|
706
752
|
"defaultValue": false,
|
|
707
753
|
"show": [
|
|
708
|
-
"
|
|
709
|
-
"
|
|
754
|
+
"rowClicked",
|
|
755
|
+
"rowMods"
|
|
710
756
|
],
|
|
711
757
|
"noChangeOnHide": true,
|
|
712
758
|
"type": "boolean",
|
|
713
759
|
"groupEnabler": true,
|
|
714
760
|
"children": [
|
|
715
761
|
{
|
|
716
|
-
"name": "
|
|
762
|
+
"name": "rowClicked",
|
|
717
763
|
"attributeStartsWith": "dmx-on",
|
|
718
|
-
"attribute": "
|
|
764
|
+
"attribute": "row_clicked",
|
|
719
765
|
"isValue": true,
|
|
720
766
|
"actionsPicker": true,
|
|
721
767
|
"title": "Action:",
|
|
722
768
|
"type": "text",
|
|
723
769
|
"help": "Choose the action to execute.",
|
|
724
770
|
"defaultValue": "",
|
|
725
|
-
"initDisplay": "none"
|
|
726
|
-
},
|
|
727
|
-
{
|
|
728
|
-
"name": "updatedMods",
|
|
729
|
-
"attributeStartsWith": "dmx-on",
|
|
730
|
-
"attribute": "updated",
|
|
731
|
-
"isModifiers": true,
|
|
732
|
-
"title": "Modifiers:",
|
|
733
|
-
"type": "enum",
|
|
734
|
-
"defaultValue": "",
|
|
735
|
-
"initDisplay": "none",
|
|
736
|
-
"valuesType": "event_modifiers" //values: EVENT_MODIFIERS
|
|
771
|
+
"initDisplay": "none"
|
|
737
772
|
}
|
|
738
773
|
],
|
|
739
774
|
"allowedOn": {
|
package/dmx-ag-grid.js
CHANGED
|
@@ -39,12 +39,14 @@ dmx.Component('ag-grid', {
|
|
|
39
39
|
fixedHeaderOffset: 100,
|
|
40
40
|
fixedTopOffset: 80,
|
|
41
41
|
fixedHorizonatalScroll: false,
|
|
42
|
-
timezone: null
|
|
42
|
+
timezone: null,
|
|
43
|
+
fields: {}
|
|
43
44
|
},
|
|
44
45
|
|
|
45
46
|
attributes: {
|
|
46
47
|
id: { default: null },
|
|
47
48
|
rowData: { type: Array, default: [] },
|
|
49
|
+
grid_theme: { type: String, default: 'ag-theme-alpine' },
|
|
48
50
|
column_defs: { type: Array, default: [] },
|
|
49
51
|
cstyles: { type: Object, default: {} },
|
|
50
52
|
cnames: { type: Object, default: {} },
|
|
@@ -82,7 +84,8 @@ dmx.Component('ag-grid', {
|
|
|
82
84
|
fixedHeaderOffset: { type: Number, default: 100 },
|
|
83
85
|
fixedTopOffset: { type: Number, default: 80 },
|
|
84
86
|
fixedHorizonatalScroll: { type: Boolean, default: false },
|
|
85
|
-
timezone: {type: Text, default: '' }
|
|
87
|
+
timezone: {type: Text, default: '' },
|
|
88
|
+
row_click_event: {type: Boolean, default: false }
|
|
86
89
|
},
|
|
87
90
|
|
|
88
91
|
methods: {
|
|
@@ -102,15 +105,46 @@ dmx.Component('ag-grid', {
|
|
|
102
105
|
const fixedTopOffset = this.props.fixedTopOffset;
|
|
103
106
|
const timezone = this.props.timezone || false;
|
|
104
107
|
const dataChanges = this.props.data_changes;
|
|
108
|
+
const grid_theme = this.props.grid_theme;
|
|
105
109
|
let columnDefs = [];
|
|
106
110
|
let exportToCSV = this.props.exportToCSV;
|
|
107
111
|
|
|
108
112
|
|
|
109
|
-
this.$node.innerHTML = `<div id=${gridId}-grid class="
|
|
113
|
+
this.$node.innerHTML = `<div id=${gridId}-grid class="${grid_theme}"></div>`;
|
|
110
114
|
if (!rowData || rowData.length === 0) {
|
|
111
115
|
console.error('No row data provided.');
|
|
112
116
|
return;
|
|
113
117
|
}
|
|
118
|
+
function formatValue(value, key, dataType, timezone) {
|
|
119
|
+
params = {"value":value}
|
|
120
|
+
if (dataType === 'number') {
|
|
121
|
+
if (/(amount|amt)$/.test(key)) {
|
|
122
|
+
return Number(value).toLocaleString("en-US", {
|
|
123
|
+
minimumFractionDigits: 2,
|
|
124
|
+
maximumFractionDigits: 2,
|
|
125
|
+
});
|
|
126
|
+
} else {
|
|
127
|
+
return blankOrNullValueFormatter(params);
|
|
128
|
+
}
|
|
129
|
+
} else if (dataType === 'date') {
|
|
130
|
+
return formatTime(params, timezone);
|
|
131
|
+
} else {
|
|
132
|
+
return blankOrNullValueFormatter(params);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
window.clickEvent = (columnName, value, idValue) => {
|
|
136
|
+
this.set('fields', {"field": columnName, "data": value});
|
|
137
|
+
this.set('id', idValue);
|
|
138
|
+
this.dispatchEvent('row_clicked')
|
|
139
|
+
};
|
|
140
|
+
function clickCellRenderer(params) {
|
|
141
|
+
const idValue = params.data.id;
|
|
142
|
+
const columnName = params.colDef.field;
|
|
143
|
+
const dataType = detectDataType([params.value]);
|
|
144
|
+
const value = formatValue(params.value, columnName, dataType, timezone);
|
|
145
|
+
return `<div onclick="clickEvent('${columnName}', '${value}', '${idValue}')" style="cursor: pointer;">${value}</div>`;
|
|
146
|
+
}
|
|
147
|
+
|
|
114
148
|
|
|
115
149
|
function humanize(str) {
|
|
116
150
|
if (str == null) return str;
|
|
@@ -301,6 +335,7 @@ const cstyles = this.props.cstyles
|
|
|
301
335
|
}
|
|
302
336
|
cnames = this.props.cnames
|
|
303
337
|
cwidths = this.props.cwidths
|
|
338
|
+
enableClickEvent = this.props.row_click_event;
|
|
304
339
|
if (cnames.hasOwnProperty(key)) {
|
|
305
340
|
console.log(key)
|
|
306
341
|
const cname = cnames[key]
|
|
@@ -321,6 +356,7 @@ const cstyles = this.props.cstyles
|
|
|
321
356
|
minWidth: parseInt(cwidths[key].min_width),
|
|
322
357
|
maxWidth: parseInt(cwidths[key].max_width),
|
|
323
358
|
}),
|
|
359
|
+
cellRenderer: enableClickEvent ? 'clickCellRenderer' : undefined
|
|
324
360
|
};
|
|
325
361
|
});
|
|
326
362
|
}
|
|
@@ -352,7 +388,10 @@ const cstyles = this.props.cstyles
|
|
|
352
388
|
suppressClipboardPaste: this.props.suppressClipboardPaste,
|
|
353
389
|
suppressScrollOnNewData: this.props.suppressScrollOnNewData,
|
|
354
390
|
suppressPropertyNamesCheck: this.props.suppressPropertyNamesCheck,
|
|
355
|
-
localeText: this.props.localeText
|
|
391
|
+
localeText: this.props.localeText,
|
|
392
|
+
components: {
|
|
393
|
+
clickCellRenderer: clickCellRenderer
|
|
394
|
+
}
|
|
356
395
|
};
|
|
357
396
|
|
|
358
397
|
const gridDiv = document.getElementById(gridId+'-grid');
|
|
@@ -429,17 +468,23 @@ const cstyles = this.props.cstyles
|
|
|
429
468
|
},
|
|
430
469
|
|
|
431
470
|
events: {
|
|
432
|
-
|
|
471
|
+
row_clicked: Event
|
|
433
472
|
},
|
|
434
473
|
|
|
435
474
|
render: function(node) {
|
|
436
475
|
if (this.$node) {
|
|
476
|
+
|
|
437
477
|
this.$parse();
|
|
438
478
|
}
|
|
439
479
|
},
|
|
440
480
|
|
|
441
481
|
update: function (props) {
|
|
442
482
|
if (!dmx.equal(this.props.data, props.data)) {
|
|
483
|
+
this.set("id", {
|
|
484
|
+
status: 0,
|
|
485
|
+
message: 'tedt',
|
|
486
|
+
response: null
|
|
487
|
+
})
|
|
443
488
|
this.refreshGrid();
|
|
444
489
|
}
|
|
445
490
|
},
|