@cdmx/wappler_ag_grid 0.5.1 → 0.5.3

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.
@@ -263,19 +263,30 @@
263
263
  },
264
264
  {
265
265
  "name": "fixedHeader",
266
- "attribute": "dmx-bind:fixed_header",
267
- "title": "Sticky Header",
266
+ "title": "Sticky Header and Horizonal Scrollbar",
268
267
  "type": "boolean",
269
268
  "display": "fieldset",
270
269
  "noChangeOnHide": true,
271
270
  "groupEnabler": true,
272
271
  "defaultValue": false,
273
272
  "show": [
273
+ "enableFixedHeader",
274
274
  "fixedHeaderOffset",
275
275
  "topbarClass",
276
- "fixedTopOffset"
276
+ "fixedTopOffset",
277
+ "fixedHorizonalScroll",
278
+ "fixedHorizonalScrollWidth"
277
279
  ],
278
280
  "children": [
281
+ {
282
+ "name": "enableFixedHeader",
283
+ "attribute": "dmx-bind:fixed_header",
284
+ "title": "Fixed Header",
285
+ "type": "boolean",
286
+ "initDisplay": "none",
287
+ "defaultValue": false,
288
+ "help": "Enables Sticky header"
289
+ },
279
290
  {
280
291
  "name": "fixedHeaderOffset",
281
292
  "attribute": "fixed_header_offset",
@@ -302,6 +313,24 @@
302
313
  "initDisplay": "none",
303
314
  "defaultValue": 80,
304
315
  "help": "Specify topbar offset, Default: 80"
316
+ },
317
+ {
318
+ "name": "fixedHorizonalScroll",
319
+ "attribute": "dmx-bind:fixed_horizonatal_scroll",
320
+ "title": "Fixed Horizonal Scroll",
321
+ "type": "boolean",
322
+ "initDisplay": "none",
323
+ "defaultValue": false,
324
+ "help": "Enables bottom fixed horizontal scroll"
325
+ },
326
+ {
327
+ "name": "fixedHorizonalScrollWidth",
328
+ "attribute": "dmx-bind:fixed_horizonatal_scroll_width",
329
+ "title": "Fixed Horizonal Scroll Width",
330
+ "type": "number",
331
+ "initDisplay": "none",
332
+ "defaultValue": 80,
333
+ "help": "Fixed horizontal scroll width percentage (Default: 80%)"
305
334
  }
306
335
  ]
307
336
  },
package/dmx-ag-grid.js CHANGED
@@ -54,6 +54,7 @@ dmx.Component('ag-grid', {
54
54
  fixed_header_offset: { type: Number, default: 100 },
55
55
  fixed_top_offset: { type: Number, default: 80 },
56
56
  fixed_horizonatal_scroll: { type: Boolean, default: false },
57
+ fixed_horizonatal_scroll_width: { type: Number, default: 80 },
57
58
  timezone: {type: Text, default: '' },
58
59
  cell_click_event: {type: Boolean, default: false },
59
60
  row_click_event: {type: Boolean, default: false },
@@ -107,8 +108,8 @@ dmx.Component('ag-grid', {
107
108
  const cnames = this.props.cnames
108
109
  const cwidths = this.props.cwidths
109
110
  const ctypes = this.props.ctypes
110
- const enableRowClickEvent = this.props.row_click_event && !this.props.row_action_edit && !this.props.row_action_view && !this.props.row_checkbox_event;
111
- const enableCellClickEvent = this.props.row_click_event && (this.props.row_action_edit || this.props.row_action_view || this.props.row_checkbox_event);
111
+ const enableRowClickEvent = this.props.row_click_event && !this.props.enable_actions && !this.props.row_checkbox_event;
112
+ const enableCellClickEvent = this.props.row_click_event && (this.props.enable_actions || this.props.row_checkbox_event);
112
113
  let localeText;
113
114
  let columnDefs = [];
114
115
  let exportToCSV = this.props.export_to_csv;
@@ -871,9 +872,8 @@ dmx.Component('ag-grid', {
871
872
  window.addEventListener('scroll', function () {
872
873
  const header = document.querySelector('.ag-header');
873
874
  const topbar = document.querySelector('.' + options.topbar_class);
874
- const topbarHeight = (topbar ? topbar.getBoundingClientRect().height : 0) + options.fixedTopOffset;
875
- const headerPos = (topbar ? topbar.getBoundingClientRect().bottom : 0) + options.fixedHeaderOffset;
876
-
875
+ const topbarHeight = (topbar ? topbar.getBoundingClientRect().height : 0) + options.fixed_top_offset;
876
+ const headerPos = (topbar ? topbar.getBoundingClientRect().bottom : 0) + options.fixed_header_offset;
877
877
  if (window.pageYOffset > headerPos) {
878
878
  header.style.position = 'fixed';
879
879
  header.style.top = `${topbarHeight}px`;
@@ -885,6 +885,36 @@ dmx.Component('ag-grid', {
885
885
  }
886
886
  });
887
887
  }
888
+ const gridId = `${options.id}-grid`;
889
+ const agGridElement = document.getElementById(gridId);
890
+ function updateHoveringBarStyles() {
891
+ const existingStyle = document.getElementById('hovering-bar-style');
892
+ if (options.fixed_horizonatal_scroll) {
893
+ // Create a new style element
894
+ const styleElement = document.createElement('style');
895
+ styleElement.id = 'hovering-bar-style';
896
+ const barWidthPercentage = options.fixed_horizonatal_scroll_width;
897
+ const barWidth = `calc(${barWidthPercentage}vw - 10px)`;
898
+ // Add the styles for the hovering horizontal bottom bar
899
+ styleElement.innerHTML = `
900
+ .ag-body-horizontal-scroll {
901
+ width: ${barWidth};
902
+ position: fixed;
903
+ bottom: 0;
904
+ }
905
+ `;
906
+ if (existingStyle) {
907
+ existingStyle.parentNode.replaceChild(styleElement, existingStyle);
908
+ } else {
909
+ document.head.appendChild(styleElement);
910
+ }
911
+ } else if (existingStyle) {
912
+ // Remove the style element if it exists
913
+ existingStyle.parentNode.removeChild(existingStyle);
914
+ }
915
+ }
916
+ updateHoveringBarStyles();
917
+ window.addEventListener('resize', updateHoveringBarStyles);
888
918
 
889
919
  // Create the export button
890
920
  if (exportToCSV) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation",
6
6
  "license": "MIT",