@lowdefy/blocks-aggrid 4.7.3 → 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.
Files changed (70) hide show
  1. package/dist/AgGrid.js +12 -12
  2. package/dist/AgGridInput.js +11 -11
  3. package/dist/LoadingOverlay.js +42 -0
  4. package/dist/ag-grid-antd.module.css +107 -0
  5. package/dist/blocks/AgGridAlpine/AgGridAlpine.js +12 -14
  6. package/dist/blocks/AgGridAlpine/meta.js +407 -0
  7. package/dist/blocks/AgGridBalham/AgGridBalham.js +12 -14
  8. package/dist/blocks/AgGridBalham/meta.js +407 -0
  9. package/dist/blocks/AgGridInputAlpine/AgGridInputAlpine.js +12 -15
  10. package/dist/blocks/AgGridInputAlpine/meta.js +441 -0
  11. package/dist/blocks/AgGridInputBalham/AgGridInputBalham.js +12 -15
  12. package/dist/blocks/AgGridInputBalham/meta.js +441 -0
  13. package/dist/blocks/AgGridInputMaterial/AgGridInputMaterial.js +12 -15
  14. package/dist/blocks/AgGridInputMaterial/meta.js +441 -0
  15. package/dist/blocks/AgGridMaterial/AgGridMaterial.js +12 -14
  16. package/dist/blocks/AgGridMaterial/meta.js +407 -0
  17. package/dist/blocks.js +0 -4
  18. package/dist/cellRenderers/AvatarCell.js +115 -0
  19. package/dist/cellRenderers/BooleanCell.js +31 -0
  20. package/dist/cellRenderers/DateCell.js +36 -0
  21. package/dist/cellRenderers/EllipsisCell.js +37 -0
  22. package/dist/cellRenderers/LinkCell.js +68 -0
  23. package/dist/{blocks/AgGridAlpineDark/e2e.js → cellRenderers/NullCell.js} +10 -2
  24. package/dist/cellRenderers/NumberCell.js +76 -0
  25. package/dist/cellRenderers/ProgressCell.js +68 -0
  26. package/dist/cellRenderers/TagCell.js +67 -0
  27. package/dist/cellRenderers/index.js +34 -0
  28. package/dist/cellRenderers/resolveFieldRefs.js +40 -0
  29. package/dist/e2e.js +0 -4
  30. package/dist/{schemas.js → metas.js} +6 -10
  31. package/dist/processColDefs.js +80 -3
  32. package/dist/types.js +4 -16
  33. package/package.json +16 -11
  34. package/dist/blocks/AgGridAlpine/schema.js +0 -125
  35. package/dist/blocks/AgGridAlpine/schema.json +0 -105
  36. package/dist/blocks/AgGridAlpine/style.less +0 -18
  37. package/dist/blocks/AgGridAlpineDark/AgGridAlpineDark.js +0 -39
  38. package/dist/blocks/AgGridAlpineDark/schema.js +0 -125
  39. package/dist/blocks/AgGridAlpineDark/schema.json +0 -105
  40. package/dist/blocks/AgGridAlpineDark/style.less +0 -18
  41. package/dist/blocks/AgGridBalham/schema.js +0 -125
  42. package/dist/blocks/AgGridBalham/schema.json +0 -105
  43. package/dist/blocks/AgGridBalham/style.less +0 -18
  44. package/dist/blocks/AgGridBalhamDark/AgGridBalhamDark.js +0 -39
  45. package/dist/blocks/AgGridBalhamDark/e2e.js +0 -16
  46. package/dist/blocks/AgGridBalhamDark/schema.js +0 -125
  47. package/dist/blocks/AgGridBalhamDark/schema.json +0 -105
  48. package/dist/blocks/AgGridBalhamDark/style.less +0 -18
  49. package/dist/blocks/AgGridInputAlpine/schema.js +0 -146
  50. package/dist/blocks/AgGridInputAlpine/schema.json +0 -123
  51. package/dist/blocks/AgGridInputAlpine/style.less +0 -18
  52. package/dist/blocks/AgGridInputAlpineDark/AgGridInputAlpineDark.js +0 -44
  53. package/dist/blocks/AgGridInputAlpineDark/e2e.js +0 -16
  54. package/dist/blocks/AgGridInputAlpineDark/schema.js +0 -146
  55. package/dist/blocks/AgGridInputAlpineDark/schema.json +0 -123
  56. package/dist/blocks/AgGridInputAlpineDark/style.less +0 -18
  57. package/dist/blocks/AgGridInputBalham/schema.js +0 -146
  58. package/dist/blocks/AgGridInputBalham/schema.json +0 -123
  59. package/dist/blocks/AgGridInputBalham/style.less +0 -18
  60. package/dist/blocks/AgGridInputBalhamDark/AgGridInputBalhamDark.js +0 -44
  61. package/dist/blocks/AgGridInputBalhamDark/e2e.js +0 -16
  62. package/dist/blocks/AgGridInputBalhamDark/schema.js +0 -146
  63. package/dist/blocks/AgGridInputBalhamDark/schema.json +0 -123
  64. package/dist/blocks/AgGridInputBalhamDark/style.less +0 -18
  65. package/dist/blocks/AgGridInputMaterial/schema.js +0 -146
  66. package/dist/blocks/AgGridInputMaterial/schema.json +0 -123
  67. package/dist/blocks/AgGridInputMaterial/style.less +0 -18
  68. package/dist/blocks/AgGridMaterial/schema.js +0 -125
  69. package/dist/blocks/AgGridMaterial/schema.json +0 -105
  70. package/dist/blocks/AgGridMaterial/style.less +0 -18
@@ -0,0 +1,68 @@
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
+ import { type } from '@lowdefy/helpers';
17
+ import NullCell from './NullCell.js';
18
+ import { resolveLink, resolveUrlQuery } from './resolveFieldRefs.js';
19
+ function buildHref(link) {
20
+ if (!type.isObject(link)) return undefined;
21
+ if (type.isString(link.href)) return link.href;
22
+ if (!type.isString(link.pageId)) return undefined;
23
+ const query = type.isObject(link.urlQuery) ? Object.entries(link.urlQuery).filter(([, v])=>!type.isNone(v)).map(([k, v])=>`${encodeURIComponent(k)}=${encodeURIComponent(String(v))}`).join('&') : '';
24
+ return `/${link.pageId}${query ? `?${query}` : ''}`;
25
+ }
26
+ const linkStyle = {
27
+ color: 'var(--ant-color-link)',
28
+ cursor: 'pointer',
29
+ textDecoration: 'none'
30
+ };
31
+ function LinkCell(params) {
32
+ const { value, data, cellConfig, methods } = params;
33
+ if (type.isNone(value) || value === '') {
34
+ return /*#__PURE__*/ React.createElement(NullCell, null);
35
+ }
36
+ const label = type.isString(cellConfig?.labelField) ? String(data?.[cellConfig.labelField] ?? value) : String(value);
37
+ const link = resolveLink({
38
+ pageId: cellConfig?.pageId,
39
+ href: cellConfig?.href,
40
+ back: cellConfig?.back,
41
+ home: cellConfig?.home,
42
+ newTab: cellConfig?.newTab,
43
+ urlQuery: cellConfig?.urlQuery
44
+ }, data);
45
+ const href = buildHref(link);
46
+ function onClick(event) {
47
+ if (event.metaKey || event.ctrlKey || event.shiftKey || event.button === 1) return;
48
+ if (cellConfig?.newTab) return;
49
+ event.preventDefault();
50
+ methods?.triggerEvent?.({
51
+ name: 'onCellLink',
52
+ event: {
53
+ link,
54
+ row: data,
55
+ value
56
+ }
57
+ });
58
+ }
59
+ return /*#__PURE__*/ React.createElement("a", {
60
+ href: href ?? '#',
61
+ style: linkStyle,
62
+ onClick: onClick,
63
+ target: cellConfig?.newTab ? '_blank' : undefined,
64
+ rel: cellConfig?.newTab ? 'noopener noreferrer' : undefined
65
+ }, label);
66
+ }
67
+ export { buildHref, resolveUrlQuery };
68
+ export default LinkCell;
@@ -12,5 +12,13 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import createAgGridDisplayHelper from '../../createAgGridDisplayHelper.js';
16
- export default createAgGridDisplayHelper('alpine-dark');
15
+ */ import React from 'react';
16
+ const style = {
17
+ color: 'var(--ant-color-text-quaternary)'
18
+ };
19
+ function NullCell({ placeholder = '\u2014' }) {
20
+ return /*#__PURE__*/ React.createElement("span", {
21
+ style: style
22
+ }, placeholder);
23
+ }
24
+ export default NullCell;
@@ -0,0 +1,76 @@
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
+ import { type } from '@lowdefy/helpers';
17
+ import NullCell from './NullCell.js';
18
+ function buildOptions(cellConfig = {}) {
19
+ const { format = 'number', decimals, minDecimals, maxDecimals, currency = 'USD', currencyDisplay = 'symbol', notation, useGrouping = true } = cellConfig;
20
+ const opts = {
21
+ useGrouping
22
+ };
23
+ if (format === 'currency') {
24
+ opts.style = 'currency';
25
+ opts.currency = currency;
26
+ opts.currencyDisplay = currencyDisplay;
27
+ } else if (format === 'percent') {
28
+ opts.style = 'percent';
29
+ } else if (format === 'compact') {
30
+ opts.notation = 'compact';
31
+ opts.compactDisplay = 'short';
32
+ } else {
33
+ opts.style = 'decimal';
34
+ }
35
+ if (notation && !opts.notation) opts.notation = notation;
36
+ if (type.isInt(decimals)) {
37
+ opts.minimumFractionDigits = decimals;
38
+ opts.maximumFractionDigits = decimals;
39
+ } else {
40
+ if (type.isInt(minDecimals)) opts.minimumFractionDigits = minDecimals;
41
+ if (type.isInt(maxDecimals)) opts.maximumFractionDigits = maxDecimals;
42
+ }
43
+ return opts;
44
+ }
45
+ function signColor(num, cellConfig) {
46
+ if (!cellConfig?.signColor) return cellConfig?.color;
47
+ if (num > 0) return cellConfig?.positiveColor ?? 'var(--ant-color-success)';
48
+ if (num < 0) return cellConfig?.negativeColor ?? 'var(--ant-color-error)';
49
+ return cellConfig?.zeroColor ?? cellConfig?.color;
50
+ }
51
+ function NumberCell(params) {
52
+ const { value, cellConfig } = params;
53
+ if (type.isNone(value) || value === '') return /*#__PURE__*/ React.createElement(NullCell, null);
54
+ const num = Number(value);
55
+ if (Number.isNaN(num)) return /*#__PURE__*/ React.createElement(NullCell, null);
56
+ const locale = cellConfig?.locale;
57
+ const opts = buildOptions(cellConfig);
58
+ const absText = new Intl.NumberFormat(locale, opts).format(Math.abs(num));
59
+ let text;
60
+ if (num < 0) {
61
+ text = cellConfig?.negative === 'parentheses' ? `(${absText})` : `-${absText}`;
62
+ } else {
63
+ text = absText;
64
+ }
65
+ const prefix = cellConfig?.prefix ?? '';
66
+ const suffix = cellConfig?.suffix ?? '';
67
+ const display = `${prefix}${text}${suffix}`;
68
+ const color = signColor(num, cellConfig);
69
+ const style = color ? {
70
+ color
71
+ } : undefined;
72
+ return /*#__PURE__*/ React.createElement("span", {
73
+ style: style
74
+ }, display);
75
+ }
76
+ export default NumberCell;
@@ -0,0 +1,68 @@
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
+ import { type } from '@lowdefy/helpers';
17
+ import NullCell from './NullCell.js';
18
+ const DEFAULT_THRESHOLDS = [
19
+ 20,
20
+ 40,
21
+ 60,
22
+ 80
23
+ ];
24
+ const DEFAULT_COLORS = [
25
+ 'var(--ant-color-error)',
26
+ 'var(--ant-color-warning)',
27
+ 'var(--ant-color-gold, var(--ant-color-warning))',
28
+ 'var(--ant-color-info)',
29
+ 'var(--ant-color-success)'
30
+ ];
31
+ function pickColor(value, thresholds, colors) {
32
+ for(let i = 0; i < thresholds.length; i += 1){
33
+ if (value < thresholds[i]) return colors[i];
34
+ }
35
+ return colors[colors.length - 1];
36
+ }
37
+ function ProgressCell(params) {
38
+ const { value, cellConfig } = params;
39
+ if (type.isNone(value) || value === '') {
40
+ return /*#__PURE__*/ React.createElement(NullCell, {
41
+ placeholder: cellConfig?.nullLabel ?? 'None'
42
+ });
43
+ }
44
+ const num = Number(value);
45
+ if (Number.isNaN(num)) {
46
+ return /*#__PURE__*/ React.createElement(NullCell, null);
47
+ }
48
+ const thresholds = type.isArray(cellConfig?.thresholds) ? cellConfig.thresholds : DEFAULT_THRESHOLDS;
49
+ const colors = type.isArray(cellConfig?.colors) ? cellConfig.colors : DEFAULT_COLORS;
50
+ const color = pickColor(num, thresholds, colors);
51
+ const suffix = cellConfig?.suffix ?? '%';
52
+ const style = {
53
+ display: 'inline-flex',
54
+ alignItems: 'center',
55
+ padding: 'var(--ant-padding-xxs, 4px) var(--ant-padding-xs, 8px)',
56
+ borderRadius: 'var(--ant-border-radius-sm, 4px)',
57
+ fontSize: 'var(--ant-font-size-sm, 12px)',
58
+ fontWeight: 600,
59
+ lineHeight: 1,
60
+ color,
61
+ background: `color-mix(in srgb, ${color} 12%, transparent)`,
62
+ border: `1px solid color-mix(in srgb, ${color} 30%, transparent)`
63
+ };
64
+ return /*#__PURE__*/ React.createElement("span", {
65
+ style: style
66
+ }, num, suffix);
67
+ }
68
+ export default ProgressCell;
@@ -0,0 +1,67 @@
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
+ import { type } from '@lowdefy/helpers';
17
+ import NullCell from './NullCell.js';
18
+ import { resolvePath } from './resolveFieldRefs.js';
19
+ const ANTD_TAG_COLOR_TOKENS = {
20
+ red: 'var(--ant-color-error)',
21
+ volcano: 'var(--ant-color-volcano, var(--ant-color-error))',
22
+ orange: 'var(--ant-color-warning)',
23
+ gold: 'var(--ant-color-gold, var(--ant-color-warning))',
24
+ yellow: 'var(--ant-color-warning)',
25
+ lime: 'var(--ant-color-lime, var(--ant-color-success))',
26
+ green: 'var(--ant-color-success)',
27
+ cyan: 'var(--ant-color-cyan, var(--ant-color-info))',
28
+ blue: 'var(--ant-color-info)',
29
+ geekblue: 'var(--ant-color-geekblue, var(--ant-color-info))',
30
+ purple: 'var(--ant-color-purple, var(--ant-color-info))',
31
+ magenta: 'var(--ant-color-magenta, var(--ant-color-error))',
32
+ default: 'var(--ant-color-text-secondary)'
33
+ };
34
+ function resolveColor(value) {
35
+ if (type.isNone(value)) return ANTD_TAG_COLOR_TOKENS.default;
36
+ return ANTD_TAG_COLOR_TOKENS[value] ?? value;
37
+ }
38
+ function TagCell(params) {
39
+ const { value, data, cellConfig } = params;
40
+ if (type.isNone(value) || value === '') {
41
+ return /*#__PURE__*/ React.createElement(NullCell, null);
42
+ }
43
+ const { colorMap, colorFrom, default: defaultColor } = cellConfig ?? {};
44
+ let color;
45
+ if (type.isString(colorFrom)) {
46
+ color = resolvePath(colorFrom, data);
47
+ } else if (type.isObject(colorMap)) {
48
+ color = colorMap[value];
49
+ }
50
+ const resolved = resolveColor(color ?? defaultColor);
51
+ const style = {
52
+ display: 'inline-flex',
53
+ alignItems: 'center',
54
+ padding: 'var(--ant-padding-xxs, 4px) var(--ant-padding-xs, 8px)',
55
+ borderRadius: 'var(--ant-border-radius-sm, 4px)',
56
+ fontSize: 'var(--ant-font-size-sm, 12px)',
57
+ fontWeight: 600,
58
+ lineHeight: 1,
59
+ color: resolved,
60
+ background: `color-mix(in srgb, ${resolved} 12%, transparent)`,
61
+ border: `1px solid color-mix(in srgb, ${resolved} 30%, transparent)`
62
+ };
63
+ return /*#__PURE__*/ React.createElement("span", {
64
+ style: style
65
+ }, String(value));
66
+ }
67
+ export default TagCell;
@@ -0,0 +1,34 @@
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 TagCell from './TagCell.js';
16
+ import AvatarCell from './AvatarCell.js';
17
+ import LinkCell from './LinkCell.js';
18
+ import DateCell from './DateCell.js';
19
+ import BooleanCell from './BooleanCell.js';
20
+ import ProgressCell from './ProgressCell.js';
21
+ import NumberCell from './NumberCell.js';
22
+ const CELL_RENDERERS = {
23
+ tag: TagCell,
24
+ avatar: AvatarCell,
25
+ link: LinkCell,
26
+ date: DateCell,
27
+ boolean: BooleanCell,
28
+ progress: ProgressCell,
29
+ number: NumberCell
30
+ };
31
+ function getCellRenderer(type) {
32
+ return CELL_RENDERERS[type];
33
+ }
34
+ export { CELL_RENDERERS, getCellRenderer };
@@ -0,0 +1,40 @@
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 { get, type } from '@lowdefy/helpers';
16
+ function resolvePath(path, data) {
17
+ if (type.isNone(path)) return undefined;
18
+ if (!type.isString(path)) return path;
19
+ return get(data, path);
20
+ }
21
+ function resolveUrlQuery(urlQuery, data) {
22
+ if (!type.isObject(urlQuery)) return undefined;
23
+ const resolved = {};
24
+ Object.keys(urlQuery).forEach((key)=>{
25
+ resolved[key] = resolvePath(urlQuery[key], data);
26
+ });
27
+ return resolved;
28
+ }
29
+ function resolveLink(link, data) {
30
+ if (!type.isObject(link)) return undefined;
31
+ return {
32
+ pageId: link.pageId,
33
+ href: link.href,
34
+ back: link.back,
35
+ home: link.home,
36
+ newTab: link.newTab,
37
+ urlQuery: resolveUrlQuery(link.urlQuery, data)
38
+ };
39
+ }
40
+ export { resolvePath, resolveUrlQuery, resolveLink };
package/dist/e2e.js CHANGED
@@ -13,12 +13,8 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ export { default as AgGridAlpine } from './blocks/AgGridAlpine/e2e.js';
16
- export { default as AgGridAlpineDark } from './blocks/AgGridAlpineDark/e2e.js';
17
16
  export { default as AgGridBalham } from './blocks/AgGridBalham/e2e.js';
18
- export { default as AgGridBalhamDark } from './blocks/AgGridBalhamDark/e2e.js';
19
17
  export { default as AgGridInputAlpine } from './blocks/AgGridInputAlpine/e2e.js';
20
- export { default as AgGridInputAlpineDark } from './blocks/AgGridInputAlpineDark/e2e.js';
21
18
  export { default as AgGridInputBalham } from './blocks/AgGridInputBalham/e2e.js';
22
- export { default as AgGridInputBalhamDark } from './blocks/AgGridInputBalhamDark/e2e.js';
23
19
  export { default as AgGridInputMaterial } from './blocks/AgGridInputMaterial/e2e.js';
24
20
  export { default as AgGridMaterial } from './blocks/AgGridMaterial/e2e.js';
@@ -12,13 +12,9 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ export { default as AgGridAlpine } from './blocks/AgGridAlpine/schema.js';
16
- export { default as AgGridAlpineDark } from './blocks/AgGridAlpineDark/schema.js';
17
- export { default as AgGridBalham } from './blocks/AgGridBalham/schema.js';
18
- export { default as AgGridBalhamDark } from './blocks/AgGridBalhamDark/schema.js';
19
- export { default as AgGridInputAlpine } from './blocks/AgGridInputAlpine/schema.js';
20
- export { default as AgGridInputAlpineDark } from './blocks/AgGridInputAlpineDark/schema.js';
21
- export { default as AgGridInputBalham } from './blocks/AgGridInputBalham/schema.js';
22
- export { default as AgGridInputBalhamDark } from './blocks/AgGridInputBalhamDark/schema.js';
23
- export { default as AgGridInputMaterial } from './blocks/AgGridInputMaterial/schema.js';
24
- export { default as AgGridMaterial } from './blocks/AgGridMaterial/schema.js';
15
+ */ export { default as AgGridAlpine } from './blocks/AgGridAlpine/meta.js';
16
+ export { default as AgGridBalham } from './blocks/AgGridBalham/meta.js';
17
+ export { default as AgGridInputAlpine } from './blocks/AgGridInputAlpine/meta.js';
18
+ export { default as AgGridInputBalham } from './blocks/AgGridInputBalham/meta.js';
19
+ export { default as AgGridInputMaterial } from './blocks/AgGridInputMaterial/meta.js';
20
+ export { default as AgGridMaterial } from './blocks/AgGridMaterial/meta.js';
@@ -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.
@@ -14,13 +14,85 @@
14
14
  limitations under the License.
15
15
  */ import { renderHtml } from '@lowdefy/block-utils';
16
16
  import { type } from '@lowdefy/helpers';
17
+ import { getCellRenderer } from './cellRenderers/index.js';
18
+ import createEllipsisCell from './cellRenderers/EllipsisCell.js';
19
+ function applyEllipsis(colDef, ellipsis) {
20
+ if (!type.isInt(ellipsis) || ellipsis < 1) return colDef;
21
+ const clampClass = `lf-ellipsis-${Math.min(ellipsis, 6)}`;
22
+ const existingClass = colDef.cellClass;
23
+ const nextClass = type.isString(existingClass) ? `${existingClass} ${clampClass}` : type.isArray(existingClass) ? [
24
+ ...existingClass,
25
+ clampClass
26
+ ] : clampClass;
27
+ const next = {
28
+ ...colDef,
29
+ wrapText: colDef.wrapText ?? true,
30
+ autoHeight: colDef.autoHeight ?? true,
31
+ cellClass: nextClass
32
+ };
33
+ // Install a wrapping renderer that owns the clamp DOM — reliable against
34
+ // ag-grid's internal cell wrappers. Skip if a cellRenderer is already set
35
+ // (user or built-in cell.type takes precedence and can opt in via CSS).
36
+ if (!colDef.cellRenderer) {
37
+ next.cellRenderer = createEllipsisCell(ellipsis);
38
+ }
39
+ return next;
40
+ }
41
+ const JUSTIFY_MAP = {
42
+ left: 'flex-start',
43
+ center: 'center',
44
+ right: 'flex-end'
45
+ };
46
+ const HEADER_ALIGN_CLASS = {
47
+ left: 'ag-left-aligned-header',
48
+ center: 'ag-center-aligned-header',
49
+ right: 'ag-right-aligned-header'
50
+ };
51
+ function applyAlignment(colDef, cell) {
52
+ if (!type.isObject(cell)) return colDef;
53
+ const align = cell.align ?? (cell.type === 'number' ? 'right' : undefined);
54
+ if (!align || !JUSTIFY_MAP[align]) return colDef;
55
+ const cellStyle = {
56
+ ...type.isObject(colDef.cellStyle) ? colDef.cellStyle : {}
57
+ };
58
+ if (type.isNone(cellStyle.justifyContent)) cellStyle.justifyContent = JUSTIFY_MAP[align];
59
+ const headerClass = type.isString(colDef.headerClass) ? `${colDef.headerClass} ${HEADER_ALIGN_CLASS[align]}` : type.isArray(colDef.headerClass) ? [
60
+ ...colDef.headerClass,
61
+ HEADER_ALIGN_CLASS[align]
62
+ ] : HEADER_ALIGN_CLASS[align];
63
+ return {
64
+ ...colDef,
65
+ cellStyle,
66
+ headerClass
67
+ };
68
+ }
69
+ function buildCellRenderer({ cell, methods }) {
70
+ const Renderer = getCellRenderer(cell?.type);
71
+ if (!Renderer) return undefined;
72
+ // ag-grid calls the renderer as a React function component when returned directly.
73
+ return function CellRendererAdapter(params) {
74
+ return Renderer({
75
+ ...params,
76
+ cellConfig: cell,
77
+ methods
78
+ });
79
+ };
80
+ }
17
81
  function recProcessColDefs(columnDefs, methods) {
18
82
  return columnDefs.map((col)=>{
19
83
  const newColDef = {};
20
84
  if (type.isArray(col.children)) {
21
85
  newColDef.children = recProcessColDefs(col.children, methods);
22
86
  }
23
- if (type.isFunction(col.cellRenderer)) {
87
+ if (type.isObject(col.cell) && type.isString(col.cell.type)) {
88
+ const renderer = buildCellRenderer({
89
+ cell: col.cell,
90
+ methods
91
+ });
92
+ if (renderer) {
93
+ newColDef.cellRenderer = renderer;
94
+ }
95
+ } else if (type.isFunction(col.cellRenderer)) {
24
96
  newColDef.cellRenderer = (params)=>{
25
97
  return renderHtml({
26
98
  html: col.cellRenderer(params),
@@ -28,10 +100,15 @@ function recProcessColDefs(columnDefs, methods) {
28
100
  });
29
101
  };
30
102
  }
31
- return {
103
+ const merged = {
32
104
  ...col,
33
105
  ...newColDef
34
106
  };
107
+ // `cell` is our config object — ag-grid would ignore it, but strip to keep colDef clean.
108
+ delete merged.cell;
109
+ delete merged.ellipsis;
110
+ const aligned = applyAlignment(merged, col.cell);
111
+ return applyEllipsis(aligned, col.ellipsis);
35
112
  });
36
113
  }
37
114
  function processColDefs(columnDefs = [], methods) {
package/dist/types.js CHANGED
@@ -1,4 +1,4 @@
1
- /* eslint-disable import/namespace */ /*
1
+ /*
2
2
  Copyright 2020-2026 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,18 +12,6 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import * as blocks from './blocks.js';
16
- const icons = {};
17
- const styles = {};
18
- Object.keys(blocks).forEach((block)=>{
19
- icons[block] = blocks[block].meta.icons ?? [];
20
- styles[block] = blocks[block].meta.styles ?? [];
21
- });
22
- export default {
23
- blocks: Object.keys(blocks),
24
- icons,
25
- styles: {
26
- default: [],
27
- ...styles
28
- }
29
- };
15
+ */ import { extractBlockTypes } from '@lowdefy/block-utils';
16
+ import * as metas from './metas.js';
17
+ export default extractBlockTypes(metas);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-aggrid",
3
- "version": "4.7.3",
3
+ "version": "5.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "AgGrid Blocks for Lowdefy.",
6
6
  "homepage": "https://lowdefy.com",
@@ -36,8 +36,8 @@
36
36
  "exports": {
37
37
  "./*": "./dist/*",
38
38
  "./blocks": "./dist/blocks.js",
39
+ "./metas": "./dist/metas.js",
39
40
  "./e2e": "./dist/e2e.js",
40
- "./schemas": "./dist/schemas.js",
41
41
  "./types": "./dist/types.js"
42
42
  },
43
43
  "files": [
@@ -49,24 +49,29 @@
49
49
  "@ag-grid-community/csv-export": "30.2.0",
50
50
  "@ag-grid-community/react": "30.2.0",
51
51
  "@ag-grid-community/styles": "30.2.0",
52
- "@lowdefy/block-utils": "4.7.3",
53
- "@lowdefy/helpers": "4.7.3",
54
- "react": "18.2.0",
55
- "react-dom": "18.2.0"
52
+ "@lowdefy/block-utils": "5.1.0",
53
+ "@lowdefy/helpers": "5.1.0"
54
+ },
55
+ "peerDependencies": {
56
+ "@ant-design/icons": ">=6",
57
+ "antd": ">=6",
58
+ "dayjs": ">=1.11",
59
+ "react": ">=18",
60
+ "react-dom": ">=18"
56
61
  },
57
62
  "devDependencies": {
58
- "@lowdefy/block-dev-e2e": "4.7.3",
59
- "@lowdefy/e2e-utils": "4.7.3",
63
+ "@lowdefy/block-dev-e2e": "5.1.0",
64
+ "@lowdefy/e2e-utils": "5.1.0",
60
65
  "@playwright/test": "1.50.1",
61
- "@swc/cli": "0.1.63",
62
- "@swc/core": "1.3.99",
66
+ "@swc/cli": "0.8.0",
67
+ "@swc/core": "1.15.18",
63
68
  "copyfiles": "2.4.1"
64
69
  },
65
70
  "publishConfig": {
66
71
  "access": "public"
67
72
  },
68
73
  "scripts": {
69
- "build": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start && pnpm copyfiles",
74
+ "build": "swc src --out-dir dist --config-file ../../../../.swcrc --cli-config-file ../../../../.swc-cli.json && pnpm copyfiles",
70
75
  "clean": "rm -rf dist",
71
76
  "copyfiles": "copyfiles -u 1 \"./src/**/*\" dist -e \"./src/**/*.js\" -e \"./src/**/*.yaml\" -e \"./src/**/*.snap\"",
72
77
  "e2e": "playwright test --config e2e/playwright.config.js",