@cdmx/wappler_ag_grid 0.3.3 → 0.3.5
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 +19 -19
- package/dmx-ag-grid.js +85 -47
- package/package.json +1 -1
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"variables": [
|
|
92
92
|
{
|
|
93
93
|
"name": "minWidth",
|
|
94
|
-
"attribute": "
|
|
94
|
+
"attribute": "min_width",
|
|
95
95
|
"title": "Minimum Width",
|
|
96
96
|
"type": "number",
|
|
97
97
|
"defaultValue": 150,
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"name": "floatingFilter",
|
|
126
|
-
"attribute": "dmx-bind:
|
|
126
|
+
"attribute": "dmx-bind:floating_filter",
|
|
127
127
|
"title": "Floating Filter",
|
|
128
128
|
"type": "boolean",
|
|
129
129
|
"defaultValue": true,
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
133
|
"name": "exportToCSV",
|
|
134
|
-
"attribute": "dmx-bind:
|
|
134
|
+
"attribute": "dmx-bind:export_to_csv",
|
|
135
135
|
"title": "CSV Export",
|
|
136
136
|
"type": "boolean",
|
|
137
137
|
"defaultValue": true,
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
149
|
"name": "columnHoverHighlight",
|
|
150
|
-
"attribute": "dmx-bind:
|
|
150
|
+
"attribute": "dmx-bind:column_hover_highlight",
|
|
151
151
|
"title": "Column Hover Highlight",
|
|
152
152
|
"type": "boolean",
|
|
153
153
|
"defaultValue": true,
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
},
|
|
156
156
|
{
|
|
157
157
|
"name": "suppressRowDeselection",
|
|
158
|
-
"attribute": "dmx-bind:
|
|
158
|
+
"attribute": "dmx-bind:suppress_row_deselection",
|
|
159
159
|
"title": "Supress Row Deselection",
|
|
160
160
|
"type": "boolean",
|
|
161
161
|
"defaultValue": false,
|
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
},
|
|
248
248
|
{
|
|
249
249
|
"name": "fixedHeader",
|
|
250
|
-
"attribute": "dmx-bind:
|
|
250
|
+
"attribute": "dmx-bind:fixed_header",
|
|
251
251
|
"title": "Sticky Header",
|
|
252
252
|
"type": "boolean",
|
|
253
253
|
"display": "fieldset",
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
"children": [
|
|
263
263
|
{
|
|
264
264
|
"name": "fixedHeaderOffset",
|
|
265
|
-
"attribute": "
|
|
265
|
+
"attribute": "fixed_header_offset",
|
|
266
266
|
"title": "Header Offset",
|
|
267
267
|
"type": "number",
|
|
268
268
|
"initDisplay": "none",
|
|
@@ -271,7 +271,7 @@
|
|
|
271
271
|
},
|
|
272
272
|
{
|
|
273
273
|
"name": "topbarClass",
|
|
274
|
-
"attribute": "
|
|
274
|
+
"attribute": "topbar_class",
|
|
275
275
|
"title": "Topbar Class",
|
|
276
276
|
"type": "text",
|
|
277
277
|
"initDisplay": "none",
|
|
@@ -280,7 +280,7 @@
|
|
|
280
280
|
},
|
|
281
281
|
{
|
|
282
282
|
"name": "fixedTopOffset",
|
|
283
|
-
"attribute": "
|
|
283
|
+
"attribute": "fixed_top_offset",
|
|
284
284
|
"title": "Topbar Offset",
|
|
285
285
|
"type": "number",
|
|
286
286
|
"initDisplay": "none",
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
},
|
|
308
308
|
{
|
|
309
309
|
"name": "suppressRowClickSelection",
|
|
310
|
-
"attribute": "dmx-bind:
|
|
310
|
+
"attribute": "dmx-bind:suppress_row_click_selection",
|
|
311
311
|
"title": "Suppress Row Click Selection",
|
|
312
312
|
"type": "boolean",
|
|
313
313
|
"defaultValue": false,
|
|
@@ -315,7 +315,7 @@
|
|
|
315
315
|
},
|
|
316
316
|
{
|
|
317
317
|
"name": "suppressMenuHide",
|
|
318
|
-
"attribute": "dmx-bind:
|
|
318
|
+
"attribute": "dmx-bind:suppress_menu_hide",
|
|
319
319
|
"title": "Suppress Menu Hide",
|
|
320
320
|
"type": "boolean",
|
|
321
321
|
"defaultValue": false,
|
|
@@ -323,7 +323,7 @@
|
|
|
323
323
|
},
|
|
324
324
|
{
|
|
325
325
|
"name": "suppressMovableColumns",
|
|
326
|
-
"attribute": "dmx-bind:
|
|
326
|
+
"attribute": "dmx-bind:suppress_movable_columns",
|
|
327
327
|
"title": "Suppress Movable Columns",
|
|
328
328
|
"type": "boolean",
|
|
329
329
|
"defaultValue": false,
|
|
@@ -331,7 +331,7 @@
|
|
|
331
331
|
},
|
|
332
332
|
{
|
|
333
333
|
"name": "enableCellExpressions",
|
|
334
|
-
"attribute": "dmx-bind:
|
|
334
|
+
"attribute": "dmx-bind:enable_cell_expressions",
|
|
335
335
|
"title": "Enable Cell Expressions",
|
|
336
336
|
"type": "boolean",
|
|
337
337
|
"defaultValue": false,
|
|
@@ -339,7 +339,7 @@
|
|
|
339
339
|
},
|
|
340
340
|
{
|
|
341
341
|
"name": "animateRows",
|
|
342
|
-
"attribute": "dmx-bind:
|
|
342
|
+
"attribute": "dmx-bind:animate_rows",
|
|
343
343
|
"title": "Animate Rows",
|
|
344
344
|
"type": "boolean",
|
|
345
345
|
"defaultValue": false,
|
|
@@ -347,7 +347,7 @@
|
|
|
347
347
|
},
|
|
348
348
|
{
|
|
349
349
|
"name": "suppressAggFuncInHeader",
|
|
350
|
-
"attribute": "dmx-bind:
|
|
350
|
+
"attribute": "dmx-bind:suppress_agg_func_in_header",
|
|
351
351
|
"title": "Suppress Aggregation Function in Header",
|
|
352
352
|
"type": "boolean",
|
|
353
353
|
"defaultValue": false,
|
|
@@ -355,7 +355,7 @@
|
|
|
355
355
|
},
|
|
356
356
|
{
|
|
357
357
|
"name": "suppressAggAtRootLevel",
|
|
358
|
-
"attribute": "dmx-bind:
|
|
358
|
+
"attribute": "dmx-bind:suppress_agg_at_root_level",
|
|
359
359
|
"title": "Suppress Aggregation at Root Level",
|
|
360
360
|
"type": "boolean",
|
|
361
361
|
"defaultValue": false,
|
|
@@ -363,7 +363,7 @@
|
|
|
363
363
|
},
|
|
364
364
|
{
|
|
365
365
|
"name": "suppressClipboardPaste",
|
|
366
|
-
"attribute": "dmx-bind:
|
|
366
|
+
"attribute": "dmx-bind:suppress_clipboard_paste",
|
|
367
367
|
"title": "Suppress Clipboard Paste",
|
|
368
368
|
"type": "boolean",
|
|
369
369
|
"defaultValue": false,
|
|
@@ -371,7 +371,7 @@
|
|
|
371
371
|
},
|
|
372
372
|
{
|
|
373
373
|
"name": "suppressScrollOnNewData",
|
|
374
|
-
"attribute": "dmx-bind:
|
|
374
|
+
"attribute": "dmx-bind:suppress_scroll_on_new_data",
|
|
375
375
|
"title": "Suppress Scroll on New Data",
|
|
376
376
|
"type": "boolean",
|
|
377
377
|
"defaultValue": false,
|
|
@@ -379,7 +379,7 @@
|
|
|
379
379
|
},
|
|
380
380
|
{
|
|
381
381
|
"name": "suppressPropertyNamesCheck",
|
|
382
|
-
"attribute": "dmx-bind:
|
|
382
|
+
"attribute": "dmx-bind:suppress_property_names_check",
|
|
383
383
|
"title": "Suppress Property Names Check",
|
|
384
384
|
"type": "boolean",
|
|
385
385
|
"defaultValue": false,
|
package/dmx-ag-grid.js
CHANGED
|
@@ -8,7 +8,6 @@ dmx.Component('ag-grid', {
|
|
|
8
8
|
|
|
9
9
|
attributes: {
|
|
10
10
|
id: { default: null },
|
|
11
|
-
rowData: { type: Array, default: [] },
|
|
12
11
|
grid_theme: { type: String, default: 'ag-theme-alpine' },
|
|
13
12
|
column_defs: { type: Array, default: [] },
|
|
14
13
|
cstyles: { type: Array, default: [] },
|
|
@@ -16,39 +15,39 @@ dmx.Component('ag-grid', {
|
|
|
16
15
|
cwidths: { type: Object, default: {} },
|
|
17
16
|
data_changes: { type: Array, default: [] },
|
|
18
17
|
data: { type: Array, default: [] },
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
dom_layout: { type: String, default: 'autoHeight' },
|
|
19
|
+
enable_cell_text_selection: { type: Boolean, default: true },
|
|
20
|
+
row_selection: { type: String, default: 'single' },
|
|
21
|
+
suppress_row_deselection: { type: Boolean, default: false },
|
|
23
22
|
pagination: { type: Boolean, default: true },
|
|
24
23
|
pagination_page_size: { type: Number, default: 20 },
|
|
25
24
|
row_height: { type: Number, default: null },
|
|
26
25
|
header_height: { type: Number, default: null },
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
suppress_row_click_selection: { type: Boolean, default: false },
|
|
27
|
+
suppress_menu_hide: { type: Boolean, default: false },
|
|
28
|
+
suppress_movable_columns: { type: Boolean, default: false },
|
|
29
|
+
enable_cell_expressions: { type: Boolean, default: false },
|
|
30
|
+
animate_rows: { type: Boolean, default: false },
|
|
31
|
+
suppress_agg_func_in_header: { type: Boolean, default: false },
|
|
32
|
+
suppress_agg_at_root_level: { type: Boolean, default: false },
|
|
33
|
+
suppress_clipboard_paste: { type: Boolean, default: false },
|
|
34
|
+
suppress_scroll_on_new_data: { type: Boolean, default: false },
|
|
35
|
+
suppress_property_names_check: { type: Boolean, default: false },
|
|
37
36
|
hide_id_field: { type: Boolean, default: false },
|
|
38
37
|
enable_rtl: { type: Boolean, default: false },
|
|
39
38
|
locale_text: { type: Text, default: null },
|
|
40
|
-
|
|
39
|
+
min_width: { type: Number, default: 150 },
|
|
41
40
|
sortable: { type: Boolean, default: true },
|
|
42
41
|
resizable: { type: Boolean, default: true },
|
|
43
42
|
filter: { type: Boolean, default: true },
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
floating_filter: { type: Boolean, default: true },
|
|
44
|
+
column_hover_highlight: { type: Boolean, default: true },
|
|
45
|
+
export_to_csv: { type: Boolean, default: true },
|
|
46
|
+
fixed_header: { type: Boolean, default: false },
|
|
47
|
+
topbar_class: { type: Text, default: 'topbar' },
|
|
48
|
+
fixed_header_offset: { type: Number, default: 100 },
|
|
49
|
+
fixed_top_offset: { type: Number, default: 80 },
|
|
50
|
+
fixed_horizonatal_scroll: { type: Boolean, default: false },
|
|
52
51
|
timezone: {type: Text, default: '' },
|
|
53
52
|
cell_click_event: {type: Boolean, default: false },
|
|
54
53
|
row_click_event: {type: Boolean, default: false },
|
|
@@ -67,7 +66,6 @@ dmx.Component('ag-grid', {
|
|
|
67
66
|
view_action_icon_class: {type: String, default: 'fas fa-eye' },
|
|
68
67
|
view_action_btn_class: {type: String, default: 'btn-info btn-xs' },
|
|
69
68
|
data_binded_changes: {type: Array, default: [] }
|
|
70
|
-
|
|
71
69
|
},
|
|
72
70
|
|
|
73
71
|
methods: {
|
|
@@ -77,8 +75,9 @@ dmx.Component('ag-grid', {
|
|
|
77
75
|
this.refreshGrid();
|
|
78
76
|
},
|
|
79
77
|
reloadGrid: function () {
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
dmx.nextTick(function() {
|
|
79
|
+
this.refreshGrid();
|
|
80
|
+
}, this);
|
|
82
81
|
}
|
|
83
82
|
},
|
|
84
83
|
|
|
@@ -92,7 +91,7 @@ dmx.Component('ag-grid', {
|
|
|
92
91
|
const enableCellClickEvent = this.props.cell_click_event;
|
|
93
92
|
let localeText;
|
|
94
93
|
let columnDefs = [];
|
|
95
|
-
let exportToCSV = this.props.
|
|
94
|
+
let exportToCSV = this.props.export_to_csv;
|
|
96
95
|
this.$node.innerHTML = `<div id=${options.id}-grid class="${options.grid_theme}"></div>`;
|
|
97
96
|
if (!rowData || rowData.length === 0) {
|
|
98
97
|
console.error('No row data provided.');
|
|
@@ -329,6 +328,44 @@ dmx.Component('ag-grid', {
|
|
|
329
328
|
return value;
|
|
330
329
|
};
|
|
331
330
|
}
|
|
331
|
+
createCombinedFilterValueGetter = (key, dataChanges, dataBindedChanges) => {
|
|
332
|
+
const keyLookup = {};
|
|
333
|
+
|
|
334
|
+
dataBindedChanges.forEach(change => {
|
|
335
|
+
if (!keyLookup[change.field]) {
|
|
336
|
+
const data_source = change.data_source;
|
|
337
|
+
const property = change.property;
|
|
338
|
+
const output = change.output;
|
|
339
|
+
let dataArray;
|
|
340
|
+
this.$addBinding(data_source, (function (e) {
|
|
341
|
+
dataArray = e;
|
|
342
|
+
}));
|
|
343
|
+
keyLookup[change.field] = { dataArray, property, output };
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
return function (params) {
|
|
348
|
+
const value = params.data[key];
|
|
349
|
+
|
|
350
|
+
// Check if there's a matching change in dataChanges
|
|
351
|
+
const matchingChange = dataChanges.find(change => change.field === key && change.value === String(value));
|
|
352
|
+
if (matchingChange) {
|
|
353
|
+
return matchingChange.new_value;
|
|
354
|
+
}
|
|
355
|
+
// Check if there's a matching change in dataBindedChanges
|
|
356
|
+
const matchingKeyData = keyLookup[key];
|
|
357
|
+
if (matchingKeyData) {
|
|
358
|
+
const { dataArray, property, output } = matchingKeyData;
|
|
359
|
+
const matchingItem = dataArray.find(item => item[property] === value);
|
|
360
|
+
|
|
361
|
+
if (matchingItem) {
|
|
362
|
+
return matchingItem[output];
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
// Return the original value if no matching changes were found
|
|
366
|
+
return value;
|
|
367
|
+
};
|
|
368
|
+
};
|
|
332
369
|
if (Array.isArray(this.props.column_defs) && this.props.column_defs.length > 0) {
|
|
333
370
|
columnDefs = this.props.column_defs;
|
|
334
371
|
} else {
|
|
@@ -386,6 +423,7 @@ dmx.Component('ag-grid', {
|
|
|
386
423
|
else {
|
|
387
424
|
// valueGetter = getValueGetter(key, dataChanges);
|
|
388
425
|
valueGetter = createCombinedValueGetter(key, options.data_changes, options.data_binded_changes);
|
|
426
|
+
filterValueGetter = createCombinedFilterValueGetter(key, options.data_changes, options.data_binded_changes);
|
|
389
427
|
}
|
|
390
428
|
function extractConditionParts(condition) {
|
|
391
429
|
const parts = condition.match(/(.+?)(===|==|!=|>|<|>=|<=)(.+)/);
|
|
@@ -554,32 +592,32 @@ dmx.Component('ag-grid', {
|
|
|
554
592
|
rowStyle: enableRowClickEvent ? { cursor: 'pointer' } : undefined,
|
|
555
593
|
defaultColDef: {
|
|
556
594
|
flex: 1,
|
|
557
|
-
minWidth: this.props.
|
|
595
|
+
minWidth: this.props.min_width,
|
|
558
596
|
resizable: this.props.resizable,
|
|
559
597
|
filter: this.props.filter,
|
|
560
598
|
sortable: this.props.sortable,
|
|
561
|
-
floatingFilter: this.props.
|
|
599
|
+
floatingFilter: this.props.floating_filter
|
|
562
600
|
},
|
|
563
|
-
domLayout:
|
|
601
|
+
domLayout: this.props.dom_layout,
|
|
564
602
|
enableCellTextSelection: true,
|
|
565
|
-
rowSelection: this.props.
|
|
566
|
-
suppressRowDeselection: this.props.
|
|
603
|
+
rowSelection: this.props.row_selection,
|
|
604
|
+
suppressRowDeselection: this.props.suppress_row_deselection,
|
|
567
605
|
pagination: this.props.pagination,
|
|
568
606
|
paginationPageSize: this.props.pagination_page_size,
|
|
569
607
|
rowHeight: this.props.row_height,
|
|
570
608
|
headerHeight: this.props.header_height,
|
|
571
|
-
suppressRowClickSelection: this.props.
|
|
572
|
-
suppressMenuHide: this.props.
|
|
573
|
-
suppressMovableColumns: this.props.
|
|
574
|
-
enableCellExpressions: this.props.
|
|
575
|
-
animateRows: this.props.
|
|
576
|
-
suppressAggFuncInHeader: this.props.
|
|
577
|
-
suppressAggAtRootLevel: this.props.
|
|
578
|
-
suppressClipboardPaste: this.props.
|
|
579
|
-
suppressScrollOnNewData: this.props.
|
|
580
|
-
suppressPropertyNamesCheck: this.props.
|
|
581
|
-
suppressRowDeselection: this.props.
|
|
582
|
-
columnHoverHighlight: this.props.
|
|
609
|
+
suppressRowClickSelection: this.props.suppress_row_click_selection,
|
|
610
|
+
suppressMenuHide: this.props.suppress_menu_hide,
|
|
611
|
+
suppressMovableColumns: this.props.suppress_movable_columns,
|
|
612
|
+
enableCellExpressions: this.props.enable_cell_expressions,
|
|
613
|
+
animateRows: this.props.animate_rows,
|
|
614
|
+
suppressAggFuncInHeader: this.props.suppress_agg_func_in_header,
|
|
615
|
+
suppressAggAtRootLevel: this.props.suppress_agg_at_root_level,
|
|
616
|
+
suppressClipboardPaste: this.props.suppress_clipboard_paste,
|
|
617
|
+
suppressScrollOnNewData: this.props.suppress_scroll_on_new_data,
|
|
618
|
+
suppressPropertyNamesCheck: this.props.suppress_property_names_check,
|
|
619
|
+
suppressRowDeselection: this.props.suppress_row_deselection,
|
|
620
|
+
columnHoverHighlight: this.props.column_hover_highlight,
|
|
583
621
|
components: {
|
|
584
622
|
clickCellRenderer: clickCellRenderer,
|
|
585
623
|
checkboxCellRenderer: checkboxCellRenderer,
|
|
@@ -627,10 +665,10 @@ dmx.Component('ag-grid', {
|
|
|
627
665
|
console.error('Grid container not found.');
|
|
628
666
|
return;
|
|
629
667
|
}
|
|
630
|
-
if (options.
|
|
668
|
+
if (options.fixed_header) {
|
|
631
669
|
window.addEventListener('scroll', function () {
|
|
632
670
|
const header = document.querySelector('.ag-header');
|
|
633
|
-
const topbar = document.querySelector('.' + options.
|
|
671
|
+
const topbar = document.querySelector('.' + options.topbar_class);
|
|
634
672
|
const topbarHeight = (topbar ? topbar.getBoundingClientRect().height : 0) + options.fixedTopOffset;
|
|
635
673
|
const headerPos = (topbar ? topbar.getBoundingClientRect().bottom : 0) + options.fixedHeaderOffset;
|
|
636
674
|
|