@cdmx/wappler_ag_grid 0.0.6 → 0.0.8

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.
@@ -14,21 +14,13 @@
14
14
  "help": "AG Grid component for data display",
15
15
  "dataScheme": [
16
16
  {
17
- "name": "data",
18
- "title": "Data",
19
- "type": "object"
17
+ "name": "id",
18
+ "title": "Id",
19
+ "type": "number"
20
20
  }
21
21
  ],
22
22
  "outputType": "object",
23
23
  "dataPick": true,
24
- "outputType": "object",
25
- "dataScheme": [
26
- {
27
- "name": "data",
28
- "title": "Data",
29
- "type": "object"
30
- }
31
- ],
32
24
  "properties": [
33
25
  {
34
26
  "group": "AG Grid Properties",
@@ -50,6 +42,20 @@
50
42
  "defaultValue": [],
51
43
  "required": true,
52
44
  "help": "Enter Data Source"
45
+ },
46
+ {
47
+ "name": "grid_theme",
48
+ "attribute": "grid_theme",
49
+ "title": "Theme",
50
+ "type": "droplist",
51
+ "defaultValue": 'ag-theme-alpine',
52
+ "values": [
53
+ {title: 'Alpine', value: 'ag-theme-alpine'},
54
+ {title: 'Balham', value: 'ag-theme-balham'},
55
+ {title: 'Material', value: 'ag-theme-material'},
56
+ {title: 'Base', value: 'ag-grid'}
57
+ ],
58
+ "help": "Select a theme for the grid"
53
59
  }
54
60
  ]
55
61
  },
@@ -194,7 +200,7 @@
194
200
  },
195
201
  {
196
202
  "name": "fixedHeader",
197
- "attribute": "fixedHeader",
203
+ "attribute": "dmx-bind:fixedHeader",
198
204
  "title": "Sticky Header",
199
205
  "type": "boolean",
200
206
  "display": "fieldset",
@@ -254,7 +260,7 @@
254
260
  },
255
261
  {
256
262
  "name": "suppressRowClickSelection",
257
- "attribute": "suppressRowClickSelection",
263
+ "attribute": "dmx-bind:suppressRowClickSelection",
258
264
  "title": "Suppress Row Click Selection",
259
265
  "type": "boolean",
260
266
  "defaultValue": false,
@@ -262,7 +268,7 @@
262
268
  },
263
269
  {
264
270
  "name": "suppressMenuHide",
265
- "attribute": "suppressMenuHide",
271
+ "attribute": "dmx-bind:suppressMenuHide",
266
272
  "title": "Suppress Menu Hide",
267
273
  "type": "boolean",
268
274
  "defaultValue": false,
@@ -270,7 +276,7 @@
270
276
  },
271
277
  {
272
278
  "name": "suppressMovableColumns",
273
- "attribute": "suppressMovableColumns",
279
+ "attribute": "dmx-bind:suppressMovableColumns",
274
280
  "title": "Suppress Movable Columns",
275
281
  "type": "boolean",
276
282
  "defaultValue": false,
@@ -278,7 +284,7 @@
278
284
  },
279
285
  {
280
286
  "name": "enableCellExpressions",
281
- "attribute": "enableCellExpressions",
287
+ "attribute": "dmx-bind:enableCellExpressions",
282
288
  "title": "Enable Cell Expressions",
283
289
  "type": "boolean",
284
290
  "defaultValue": false,
@@ -286,7 +292,7 @@
286
292
  },
287
293
  {
288
294
  "name": "animateRows",
289
- "attribute": "animateRows",
295
+ "attribute": "dmx-bind:animateRows",
290
296
  "title": "Animate Rows",
291
297
  "type": "boolean",
292
298
  "defaultValue": false,
@@ -294,7 +300,7 @@
294
300
  },
295
301
  {
296
302
  "name": "suppressAggFuncInHeader",
297
- "attribute": "suppressAggFuncInHeader",
303
+ "attribute": "dmx-bind:suppressAggFuncInHeader",
298
304
  "title": "Suppress Aggregation Function in Header",
299
305
  "type": "boolean",
300
306
  "defaultValue": false,
@@ -302,7 +308,7 @@
302
308
  },
303
309
  {
304
310
  "name": "suppressAggAtRootLevel",
305
- "attribute": "suppressAggAtRootLevel",
311
+ "attribute": "dmx-bind:suppressAggAtRootLevel",
306
312
  "title": "Suppress Aggregation at Root Level",
307
313
  "type": "boolean",
308
314
  "defaultValue": false,
@@ -310,7 +316,7 @@
310
316
  },
311
317
  {
312
318
  "name": "suppressClipboardPaste",
313
- "attribute": "suppressClipboardPaste",
319
+ "attribute": "dmx-bind:suppressClipboardPaste",
314
320
  "title": "Suppress Clipboard Paste",
315
321
  "type": "boolean",
316
322
  "defaultValue": false,
@@ -318,7 +324,7 @@
318
324
  },
319
325
  {
320
326
  "name": "suppressScrollOnNewData",
321
- "attribute": "suppressScrollOnNewData",
327
+ "attribute": "dmx-bind:suppressScrollOnNewData",
322
328
  "title": "Suppress Scroll on New Data",
323
329
  "type": "boolean",
324
330
  "defaultValue": false,
@@ -326,7 +332,7 @@
326
332
  },
327
333
  {
328
334
  "name": "suppressPropertyNamesCheck",
329
- "attribute": "suppressPropertyNamesCheck",
335
+ "attribute": "dmx-bind:suppressPropertyNamesCheck",
330
336
  "title": "Suppress Property Names Check",
331
337
  "type": "boolean",
332
338
  "defaultValue": false,
@@ -339,6 +345,14 @@
339
345
  "type": "object",
340
346
  "defaultValue": {},
341
347
  "help": "Localization strings for the grid"
348
+ },
349
+ {
350
+ "name": "rowClickEvent",
351
+ "attribute": "dmx-bind:row_click_event",
352
+ "title": "Row Click Events",
353
+ "type": "boolean",
354
+ "defaultValue": false,
355
+ "help": "This enabled row click en=vents whcihc can then be used in Dynamic events => Grid Events => Row Clicked"
342
356
  }
343
357
  ]
344
358
  },
@@ -621,7 +635,17 @@
621
635
  }
622
636
 
623
637
  ],
624
- "actionsScheme": [],
638
+ actionsScheme: [
639
+ {
640
+ addTitle: 'Reload Grid',
641
+ title : 'Reload Grid',
642
+ name : 'reloadGrid',
643
+ icon : 'fa fa-lg fa-play',
644
+ state : 'opened',
645
+ help: 'Reload the AG Grid',
646
+ properties : []
647
+ },
648
+ ],
625
649
  "children": [],
626
650
  "allowed_children": {},
627
651
  "copyFiles": [
@@ -633,6 +657,14 @@
633
657
  "src": "ag-theme-alpine.css",
634
658
  "dst": "css/ag-theme-alpine.css"
635
659
  },
660
+ {
661
+ "src": "ag-theme-balham.css",
662
+ "dst": "css/ag-theme-balham.css"
663
+ },
664
+ {
665
+ "src": "ag-theme-material.css",
666
+ "dst": "css/ag-theme-material.css"
667
+ },
636
668
  {
637
669
  "src": "dmx-ag-grid.js",
638
670
  "dst": "js/dmx-ag-grid.js"
@@ -652,6 +684,14 @@
652
684
  {
653
685
  "src": "css/ag-theme-alpine.css",
654
686
  "type": "css"
687
+ },
688
+ {
689
+ "src": "css/ag-theme-balham.css",
690
+ "type": "css"
691
+ },
692
+ {
693
+ "src": "css/ag-theme-material.css",
694
+ "type": "css"
655
695
  }
656
696
  ],
657
697
  "cssOrder": [],
@@ -696,44 +736,33 @@
696
736
  ],
697
737
  "events": [
698
738
  {
699
- "name": "dmx-ag-grid-row-data-updated",
739
+ "name": "dmx-ag-grid-row-clicked",
700
740
  "attributeStartsWith": "dmx-on",
741
+ "attribute": "row_clicked",
701
742
  "display": "fieldset",
702
- "title": "Updated",
743
+ "title": "Row Clicked",
703
744
  "icon": "fa fa-lg fa-chevron-right",
704
745
  "groupTitle": "Grid Events",
705
746
  "groupIcon": "fa fa-lg fa-cubes",
706
747
  "defaultValue": false,
707
748
  "show": [
708
- "updatedValue",
709
- "updatedMods"
749
+ "rowClicked"
710
750
  ],
711
751
  "noChangeOnHide": true,
712
752
  "type": "boolean",
713
753
  "groupEnabler": true,
714
754
  "children": [
715
755
  {
716
- "name": "updatedValue",
756
+ "name": "rowClicked",
717
757
  "attributeStartsWith": "dmx-on",
718
- "attribute": "updated",
758
+ "attribute": "row_clicked",
719
759
  "isValue": true,
720
760
  "actionsPicker": true,
721
761
  "title": "Action:",
722
762
  "type": "text",
723
763
  "help": "Choose the action to execute.",
724
764
  "defaultValue": "",
725
- "initDisplay": "none" //, required: true
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
765
+ "initDisplay": "none"
737
766
  }
738
767
  ],
739
768
  "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,28 @@ 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'}></div>`
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
+ window.clickEvent = (columnName, value) => {
119
+ // this.set('fields', {"field": columnName, "data": value});
120
+ this.set('id', value);
121
+ this.dispatchEvent('row_clicked')
122
+ };
123
+ function clickCellRenderer(params) {
124
+ const idValue = params.data.id;
125
+ const columnName = params.colDef.field;
126
+ const value = params.value != null ? params.value.toString() : '-';
127
+ return `<div onclick="clickEvent('${columnName}', '${idValue}')" style="cursor: pointer;">${value}</div>`;
128
+ }
129
+
114
130
 
115
131
  function humanize(str) {
116
132
  if (str == null) return str;
@@ -301,6 +317,7 @@ const cstyles = this.props.cstyles
301
317
  }
302
318
  cnames = this.props.cnames
303
319
  cwidths = this.props.cwidths
320
+ enableClickEvent = this.props.row_click_event;
304
321
  if (cnames.hasOwnProperty(key)) {
305
322
  console.log(key)
306
323
  const cname = cnames[key]
@@ -321,6 +338,7 @@ const cstyles = this.props.cstyles
321
338
  minWidth: parseInt(cwidths[key].min_width),
322
339
  maxWidth: parseInt(cwidths[key].max_width),
323
340
  }),
341
+ cellRenderer: enableClickEvent ? 'clickCellRenderer' : undefined
324
342
  };
325
343
  });
326
344
  }
@@ -352,7 +370,10 @@ const cstyles = this.props.cstyles
352
370
  suppressClipboardPaste: this.props.suppressClipboardPaste,
353
371
  suppressScrollOnNewData: this.props.suppressScrollOnNewData,
354
372
  suppressPropertyNamesCheck: this.props.suppressPropertyNamesCheck,
355
- localeText: this.props.localeText
373
+ localeText: this.props.localeText,
374
+ components: {
375
+ clickCellRenderer: clickCellRenderer
376
+ }
356
377
  };
357
378
 
358
379
  const gridDiv = document.getElementById(gridId+'-grid');
@@ -429,17 +450,23 @@ const cstyles = this.props.cstyles
429
450
  },
430
451
 
431
452
  events: {
432
- 'dmx-ag-grid-row-data-updated': Event
453
+ row_clicked: Event
433
454
  },
434
455
 
435
456
  render: function(node) {
436
457
  if (this.$node) {
458
+
437
459
  this.$parse();
438
460
  }
439
461
  },
440
462
 
441
463
  update: function (props) {
442
464
  if (!dmx.equal(this.props.data, props.data)) {
465
+ this.set("id", {
466
+ status: 0,
467
+ message: 'tedt',
468
+ response: null
469
+ })
443
470
  this.refreshGrid();
444
471
  }
445
472
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation",
6
6
  "license": "MIT",