@lowdefy/blocks-aggrid 5.0.0 → 5.1.0

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/dist/AgGrid.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2021 Lowdefy, Inc
2
+ Copyright 2020-2026 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-mod
18
18
  import { CsvExportModule } from '@ag-grid-community/csv-export';
19
19
  import processColDefs from './processColDefs.js';
20
20
  import assignRowId from './assignRowId.js';
21
+ import LoadingOverlay from './LoadingOverlay.js';
21
22
  const AgGrid = ({ properties, methods, loading, events })=>{
22
23
  const { quickFilterValue, columnDefs, defaultColDef, rowData: newRowData, ...someProperties } = properties;
23
24
  const [rowData, setRowData] = useState(newRowData ?? []);
@@ -118,14 +119,6 @@ const AgGrid = ({ properties, methods, loading, events })=>{
118
119
  }
119
120
  gridRef.current.columnApi.autoSizeColumns(allColumnIds, skipHeader);
120
121
  });
121
- if (gridRef.current.api) {
122
- if (loading) {
123
- gridRef.current.api.showLoadingOverlay();
124
- }
125
- if (!loading) {
126
- gridRef.current.api.hideOverlay();
127
- }
128
- }
129
122
  }, []);
130
123
  useEffect(()=>{
131
124
  if (JSON.stringify(rowData) !== JSON.stringify(newRowData)) {
@@ -137,7 +130,13 @@ const AgGrid = ({ properties, methods, loading, events })=>{
137
130
  if (quickFilterValue && quickFilterValue === '') {
138
131
  gridRef.current.api.setQuickFilter(quickFilterValue); // check if empty string matches all
139
132
  }
140
- return /*#__PURE__*/ React.createElement(AgGridReact, {
133
+ return /*#__PURE__*/ React.createElement("div", {
134
+ style: {
135
+ position: 'relative',
136
+ width: '100%',
137
+ height: '100%'
138
+ }
139
+ }, /*#__PURE__*/ React.createElement(AgGridReact, {
141
140
  ...someProperties,
142
141
  rowData: rowData,
143
142
  defaultColDef: memoDefaultColDef,
@@ -153,7 +152,8 @@ const AgGrid = ({ properties, methods, loading, events })=>{
153
152
  ],
154
153
  columnDefs: processColDefs(columnDefs, methods),
155
154
  ref: gridRef,
156
- getRowId: getRowId
157
- });
155
+ getRowId: getRowId,
156
+ suppressLoadingOverlay: true
157
+ }), loading && /*#__PURE__*/ React.createElement(LoadingOverlay, null));
158
158
  };
159
159
  export default AgGrid;
@@ -18,6 +18,7 @@ import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-mod
18
18
  import { CsvExportModule } from '@ag-grid-community/csv-export';
19
19
  import processColDefs from './processColDefs.js';
20
20
  import assignRowId from './assignRowId.js';
21
+ import LoadingOverlay from './LoadingOverlay.js';
21
22
  const AgGridInput = ({ properties, methods, loading, events, value })=>{
22
23
  const { quickFilterValue, columnDefs, defaultColDef, ...someProperties } = properties;
23
24
  const [rowData, setRowData] = useState(value ?? []);
@@ -167,14 +168,6 @@ const AgGridInput = ({ properties, methods, loading, events, value })=>{
167
168
  }
168
169
  gridRef.current.columnApi.autoSizeColumns(allColumnIds, skipHeader);
169
170
  });
170
- if (gridRef.current.api) {
171
- if (loading) {
172
- gridRef.current.api.showLoadingOverlay();
173
- }
174
- if (!loading) {
175
- gridRef.current.api.hideOverlay();
176
- }
177
- }
178
171
  }, []);
179
172
  useEffect(()=>{
180
173
  if (JSON.stringify(rowData) !== JSON.stringify(value)) {
@@ -186,7 +179,13 @@ const AgGridInput = ({ properties, methods, loading, events, value })=>{
186
179
  if (quickFilterValue && quickFilterValue === '') {
187
180
  gridRef.current.api.setQuickFilter(quickFilterValue); // check if empty string matches all
188
181
  }
189
- return /*#__PURE__*/ React.createElement(AgGridReact, {
182
+ return /*#__PURE__*/ React.createElement("div", {
183
+ style: {
184
+ position: 'relative',
185
+ width: '100%',
186
+ height: '100%'
187
+ }
188
+ }, /*#__PURE__*/ React.createElement(AgGridReact, {
190
189
  ...someProperties,
191
190
  rowData: rowData,
192
191
  onCellClicked: onCellClicked,
@@ -204,7 +203,8 @@ const AgGridInput = ({ properties, methods, loading, events, value })=>{
204
203
  ],
205
204
  columnDefs: processColDefs(columnDefs, methods),
206
205
  ref: gridRef,
207
- getRowId: getRowId
208
- });
206
+ getRowId: getRowId,
207
+ suppressLoadingOverlay: true
208
+ }), loading && /*#__PURE__*/ React.createElement(LoadingOverlay, null));
209
209
  };
210
210
  export default AgGridInput;
@@ -0,0 +1,42 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import React from 'react';
16
+ const wrapperStyle = {
17
+ position: 'absolute',
18
+ inset: 0,
19
+ display: 'flex',
20
+ alignItems: 'center',
21
+ justifyContent: 'center',
22
+ backgroundColor: 'color-mix(in srgb, var(--ant-color-bg-container) 70%, transparent)',
23
+ zIndex: 2,
24
+ pointerEvents: 'all'
25
+ };
26
+ const boxStyle = {
27
+ padding: '8px 16px',
28
+ borderRadius: 'var(--ant-border-radius)',
29
+ boxShadow: 'var(--ant-box-shadow-secondary)',
30
+ backgroundColor: 'var(--ant-color-bg-container)',
31
+ color: 'var(--ant-color-text)',
32
+ border: '1px solid var(--ant-color-border)',
33
+ fontSize: 'var(--ant-font-size)'
34
+ };
35
+ function LoadingOverlay() {
36
+ return /*#__PURE__*/ React.createElement("div", {
37
+ style: wrapperStyle
38
+ }, /*#__PURE__*/ React.createElement("div", {
39
+ style: boxStyle
40
+ }, "Loading..."));
41
+ }
42
+ export default LoadingOverlay;
@@ -1,22 +1,107 @@
1
1
  .antdTheme.antdTheme {
2
2
  --ag-background-color: var(--ant-color-bg-container);
3
3
  --ag-foreground-color: var(--ant-color-text);
4
+ --ag-secondary-foreground-color: var(--ant-color-text-secondary);
4
5
  --ag-border-color: var(--ant-color-border);
5
6
  --ag-secondary-border-color: var(--ant-color-border-secondary);
6
7
  --ag-header-background-color: var(--ant-color-fill-quaternary);
7
8
  --ag-header-foreground-color: var(--ant-color-text);
9
+ --ag-header-cell-hover-background-color: var(--ant-color-fill-tertiary);
10
+ --ag-header-cell-moving-background-color: var(--ant-color-fill-secondary);
8
11
  --ag-tooltip-background-color: var(--ant-color-bg-spotlight);
9
12
  --ag-odd-row-background-color: var(--ant-color-fill-quaternary);
10
13
  --ag-control-panel-background-color: var(--ant-color-bg-elevated);
11
14
  --ag-subheader-background-color: var(--ant-color-bg-layout);
15
+ --ag-subheader-toolbar-background-color: var(--ant-color-bg-layout);
12
16
  --ag-selected-row-background-color: var(--ant-color-primary-bg);
13
17
  --ag-row-hover-color: var(--ant-color-primary-bg-hover);
14
18
  --ag-column-hover-color: var(--ant-color-primary-bg-hover);
19
+ --ag-range-selection-highlight-color: var(--ant-color-primary-bg-hover);
15
20
  --ag-modal-overlay-background-color: var(--ant-color-bg-mask);
16
21
  --ag-input-disabled-background-color: var(--ant-color-bg-container-disabled);
17
22
  --ag-input-disabled-border-color: var(--ant-color-border);
18
23
  --ag-disabled-foreground-color: var(--ant-color-text-disabled);
19
24
  --ag-chip-background-color: var(--ant-color-fill-secondary);
20
25
  --ag-input-focus-box-shadow: 0 0 0 2px var(--ant-color-primary-bg);
26
+ --ag-input-focus-border-color: var(--ant-color-primary);
27
+ --ag-range-selection-border-color: var(--ant-color-primary);
28
+ --ag-range-selection-background-color: var(--ant-color-primary-bg);
29
+ --ag-checkbox-checked-color: var(--ant-color-primary);
30
+ --ag-checkbox-unchecked-color: var(--ant-color-text-quaternary);
31
+ --ag-checkbox-background-color: var(--ant-color-bg-container);
21
32
  --ag-card-shadow: var(--ant-box-shadow-secondary);
33
+ --ag-popup-shadow: var(--ant-box-shadow);
34
+ --ag-font-family: var(--ant-font-family);
35
+ --ag-font-size: var(--ant-font-size);
36
+ }
37
+
38
+ .antdTheme :global(.ag-root-wrapper) {
39
+ border-radius: var(--ant-border-radius);
40
+ overflow: hidden;
41
+ }
42
+
43
+ /* Avatar sizing per ag-grid theme — reads row-height via the wrapper class. */
44
+ .antdTheme:global(.ag-theme-balham),
45
+ .antdTheme:global(.ag-theme-balham-dark) {
46
+ --lf-avatar-size: 20px;
47
+ --lf-avatar-font-size: 10px;
48
+ }
49
+ .antdTheme:global(.ag-theme-alpine),
50
+ .antdTheme:global(.ag-theme-alpine-dark) {
51
+ --lf-avatar-size: var(--ant-control-height-sm, 24px);
52
+ --lf-avatar-font-size: var(--ant-font-size-sm, 12px);
53
+ }
54
+ .antdTheme:global(.ag-theme-material) {
55
+ --lf-avatar-size: 26px;
56
+ --lf-avatar-font-size: var(--ant-font-size-sm, 12px);
57
+ }
58
+
59
+ .antdTheme :global(.ag-overlay-loading-wrapper) {
60
+ background-color: color-mix(in srgb, var(--ant-color-bg-container) 70%, transparent);
61
+ }
62
+
63
+ .antdTheme :global(.ag-overlay-loading-center) {
64
+ border-radius: var(--ant-border-radius);
65
+ box-shadow: var(--ant-box-shadow-secondary);
66
+ }
67
+
68
+ .antdTheme :global(.ag-overlay-no-rows-wrapper) {
69
+ color: var(--ant-color-text-secondary);
70
+ }
71
+
72
+ .antdTheme :global(.ag-cell) {
73
+ display: flex;
74
+ align-items: center;
75
+ line-height: var(--ant-line-height, 1.5);
76
+ }
77
+
78
+ .antdTheme :global(.lf-ellipsis-1),
79
+ .antdTheme :global(.lf-ellipsis-2),
80
+ .antdTheme :global(.lf-ellipsis-3),
81
+ .antdTheme :global(.lf-ellipsis-4),
82
+ .antdTheme :global(.lf-ellipsis-5),
83
+ .antdTheme :global(.lf-ellipsis-6) {
84
+ display: -webkit-box;
85
+ -webkit-box-orient: vertical;
86
+ overflow: hidden;
87
+ white-space: normal;
88
+ word-break: break-word;
89
+ }
90
+ .antdTheme :global(.lf-ellipsis-1) {
91
+ -webkit-line-clamp: 1;
92
+ }
93
+ .antdTheme :global(.lf-ellipsis-2) {
94
+ -webkit-line-clamp: 2;
95
+ }
96
+ .antdTheme :global(.lf-ellipsis-3) {
97
+ -webkit-line-clamp: 3;
98
+ }
99
+ .antdTheme :global(.lf-ellipsis-4) {
100
+ -webkit-line-clamp: 4;
101
+ }
102
+ .antdTheme :global(.lf-ellipsis-5) {
103
+ -webkit-line-clamp: 5;
104
+ }
105
+ .antdTheme :global(.lf-ellipsis-6) {
106
+ -webkit-line-clamp: 6;
22
107
  }
@@ -65,6 +65,14 @@
65
65
  rows: 'The displayed rows after sorting.',
66
66
  sort: 'The sort column state.'
67
67
  }
68
+ },
69
+ onCellLink: {
70
+ description: 'Triggered when a built-in `cell.type: link` (or avatar with `link`) cell is clicked. Wire to a `Link` action with `params: { _event: link }` to navigate.',
71
+ event: {
72
+ link: 'The resolved link config (pageId/href/urlQuery/back/home/newTab).',
73
+ row: 'The row data.',
74
+ value: 'The cell value.'
75
+ }
68
76
  }
69
77
  },
70
78
  properties: {
@@ -87,6 +95,21 @@
87
95
  type: 'string',
88
96
  description: 'The data field to use in `getRowId` which results in Row Selection being maintained across Row Data changes (assuming the Row exists in both sets). See Ag Grid docs for more details (https://www.ag-grid.com/react-data-grid/data-update-row-data/).'
89
97
  },
98
+ enableBrowserTooltips: {
99
+ type: 'boolean',
100
+ default: false,
101
+ description: "Set to `true` to use the browser native `title` attribute tooltips instead of AG Grid's styled tooltip component."
102
+ },
103
+ tooltipShowDelay: {
104
+ type: 'number',
105
+ default: 2000,
106
+ description: 'The delay in milliseconds before a tooltip is shown. Not applied when `enableBrowserTooltips` is `true`.'
107
+ },
108
+ tooltipHideDelay: {
109
+ type: 'number',
110
+ default: 10000,
111
+ description: 'The delay in milliseconds before a tooltip is hidden. Not applied when `enableBrowserTooltips` is `true`.'
112
+ },
90
113
  defaultColDef: {
91
114
  type: 'object',
92
115
  description: 'Column properties which get applied to all columns. See all (https://www.ag-grid.com/javascript-data-grid/column-properties/).'
@@ -138,6 +161,243 @@
138
161
  'string'
139
162
  ],
140
163
  description: 'A function (using the `_function` operator) or expression to format a value, should return a string. Not used for CSV export or copy to clipboard, only for UI cell rendering.'
164
+ },
165
+ tooltipField: {
166
+ type: 'string',
167
+ description: "The field of the row object to read the tooltip value from. When set, hovering a cell shows a tooltip with that value using the grid's default tooltip component."
168
+ },
169
+ tooltipValueGetter: {
170
+ type: 'object',
171
+ description: 'Provide a function (using the `_function` operator) that returns the tooltip value for a cell. Overrides `tooltipField`.'
172
+ },
173
+ tooltipComponent: {
174
+ type: 'object',
175
+ description: 'Provide a custom tooltip component. See AG Grid tooltip component docs (https://www.ag-grid.com/react-data-grid/component-tooltip/).'
176
+ },
177
+ ellipsis: {
178
+ type: 'number',
179
+ description: 'Line-clamp count for long text. Automatically enables `wrapText` and `autoHeight` and applies the `.lf-ellipsis-N` class (1–6).'
180
+ },
181
+ cell: {
182
+ type: 'object',
183
+ description: 'Built-in cell renderer. Takes precedence over `cellRenderer` when `type` is set. Field-valued keys (e.g. `nameField`, `srcField`, `urlQuery.*`) are row-data paths.',
184
+ properties: {
185
+ type: {
186
+ type: 'string',
187
+ enum: [
188
+ 'tag',
189
+ 'avatar',
190
+ 'link',
191
+ 'date',
192
+ 'boolean',
193
+ 'progress',
194
+ 'number'
195
+ ],
196
+ description: 'The built-in renderer to use.'
197
+ },
198
+ colorMap: {
199
+ type: 'object',
200
+ description: 'Tag: map of cell value → color (antd tag color name or hex). Used when `cell.type: tag`.'
201
+ },
202
+ colorFrom: {
203
+ type: 'string',
204
+ description: 'Tag: row-data path to a color value. Takes precedence over `colorMap`.'
205
+ },
206
+ default: {
207
+ type: 'string',
208
+ description: 'Tag: fallback color for values not in `colorMap`.'
209
+ },
210
+ nameField: {
211
+ type: 'string',
212
+ description: 'Avatar: row-data path for the name label.'
213
+ },
214
+ srcField: {
215
+ type: 'string',
216
+ description: 'Avatar: row-data path for the image src (optional).'
217
+ },
218
+ idField: {
219
+ type: 'string',
220
+ description: 'Avatar: row-data path for an id used to seed initials colour.'
221
+ },
222
+ shape: {
223
+ type: 'string',
224
+ enum: [
225
+ 'circle',
226
+ 'square'
227
+ ],
228
+ description: 'Avatar shape. Defaults to `circle`.'
229
+ },
230
+ link: {
231
+ type: 'object',
232
+ description: 'Avatar/Link: navigation config. Emits `onCellLink` on click. `pageId`/`href`/`back`/`home`/`newTab` are literal; `urlQuery` values are row-data paths.'
233
+ },
234
+ pageId: {
235
+ type: 'string',
236
+ description: 'Link: target page id (literal).'
237
+ },
238
+ href: {
239
+ type: 'string',
240
+ description: 'Link: literal href (overrides `pageId`).'
241
+ },
242
+ back: {
243
+ type: 'boolean',
244
+ description: 'Link: navigate back.'
245
+ },
246
+ home: {
247
+ type: 'boolean',
248
+ description: 'Link: navigate home.'
249
+ },
250
+ newTab: {
251
+ type: 'boolean',
252
+ description: 'Link: open in a new tab.'
253
+ },
254
+ urlQuery: {
255
+ type: 'object',
256
+ description: 'Link: query params. Each value is a row-data path.'
257
+ },
258
+ labelField: {
259
+ type: 'string',
260
+ description: 'Link: row-data path for the visible label (falls back to cell value).'
261
+ },
262
+ format: {
263
+ type: 'string',
264
+ description: 'Date: dayjs format string. Default `YYYY-MM-DD HH:mm`.'
265
+ },
266
+ relative: {
267
+ type: 'boolean',
268
+ description: 'Date: render as relative time (e.g. "3 hours ago").'
269
+ },
270
+ trueLabel: {
271
+ type: 'string',
272
+ description: 'Boolean: label when truthy.'
273
+ },
274
+ falseLabel: {
275
+ type: 'string',
276
+ description: 'Boolean: label when falsy.'
277
+ },
278
+ trueColor: {
279
+ type: 'string',
280
+ description: 'Boolean: CSS colour when truthy.'
281
+ },
282
+ falseColor: {
283
+ type: 'string',
284
+ description: 'Boolean: CSS colour when falsy.'
285
+ },
286
+ thresholds: {
287
+ type: 'array',
288
+ description: 'Progress: threshold values (ascending). Each threshold defines where the next colour starts.',
289
+ items: {
290
+ type: 'number'
291
+ }
292
+ },
293
+ colors: {
294
+ type: 'array',
295
+ description: 'Progress: colour per bucket (length = thresholds.length + 1).',
296
+ items: {
297
+ type: 'string'
298
+ }
299
+ },
300
+ suffix: {
301
+ type: 'string',
302
+ description: 'Number/Progress: literal suffix appended after the formatted value. Default `%` for progress.'
303
+ },
304
+ nullLabel: {
305
+ type: 'string',
306
+ description: 'Progress: label when value is null. Default `None`.'
307
+ },
308
+ format: {
309
+ type: 'string',
310
+ description: 'Number: `number` (default), `currency`, `percent`, or `compact` (K/M/B). Date: dayjs format string (default `YYYY-MM-DD HH:mm`).'
311
+ },
312
+ locale: {
313
+ type: 'string',
314
+ description: 'Number: BCP 47 locale for `Intl.NumberFormat` (e.g. `en-US`, `de-DE`). Defaults to browser.'
315
+ },
316
+ currency: {
317
+ type: 'string',
318
+ description: 'Number: ISO 4217 currency code when `format: currency`. Default `USD`.'
319
+ },
320
+ currencyDisplay: {
321
+ type: 'string',
322
+ enum: [
323
+ 'symbol',
324
+ 'narrowSymbol',
325
+ 'code',
326
+ 'name'
327
+ ],
328
+ description: 'Number: currency display style when `format: currency`.'
329
+ },
330
+ decimals: {
331
+ type: 'number',
332
+ description: 'Number: fixed number of fraction digits (sets both `minimumFractionDigits` and `maximumFractionDigits`).'
333
+ },
334
+ minDecimals: {
335
+ type: 'number',
336
+ description: 'Number: `Intl.NumberFormat` `minimumFractionDigits`.'
337
+ },
338
+ maxDecimals: {
339
+ type: 'number',
340
+ description: 'Number: `Intl.NumberFormat` `maximumFractionDigits`.'
341
+ },
342
+ notation: {
343
+ type: 'string',
344
+ enum: [
345
+ 'standard',
346
+ 'scientific',
347
+ 'engineering',
348
+ 'compact'
349
+ ],
350
+ description: 'Number: `Intl.NumberFormat` notation. `compact` format sets this automatically.'
351
+ },
352
+ useGrouping: {
353
+ type: 'boolean',
354
+ default: true,
355
+ description: 'Number: include thousands separators.'
356
+ },
357
+ negative: {
358
+ type: 'string',
359
+ enum: [
360
+ 'minus',
361
+ 'parentheses'
362
+ ],
363
+ default: 'minus',
364
+ description: 'Number: how to render negative numbers — `minus` (default) or `parentheses` for accounting.'
365
+ },
366
+ signColor: {
367
+ type: 'boolean',
368
+ default: false,
369
+ description: 'Number: when true, positives use `positiveColor` (default success token), negatives use `negativeColor` (default error token).'
370
+ },
371
+ positiveColor: {
372
+ type: 'string',
373
+ description: 'Number: CSS colour when value > 0 (requires `signColor: true`).'
374
+ },
375
+ negativeColor: {
376
+ type: 'string',
377
+ description: 'Number: CSS colour when value < 0 (requires `signColor: true`).'
378
+ },
379
+ zeroColor: {
380
+ type: 'string',
381
+ description: 'Number: CSS colour when value === 0 (requires `signColor: true`).'
382
+ },
383
+ color: {
384
+ type: 'string',
385
+ description: 'Number: CSS colour applied to all values (overridden by `signColor`).'
386
+ },
387
+ prefix: {
388
+ type: 'string',
389
+ description: 'Number: literal prefix (e.g. `Δ `, `~`).'
390
+ },
391
+ align: {
392
+ type: 'string',
393
+ enum: [
394
+ 'left',
395
+ 'center',
396
+ 'right'
397
+ ],
398
+ description: 'Cell horizontal alignment. Defaults to `right` for `cell.type: number`. Sets `cellStyle.justifyContent` and `ag-*-aligned-header` on the header.'
399
+ }
400
+ }
141
401
  }
142
402
  }
143
403
  }