@genesislcap/rapid-grid-pro 15.8.0 → 15.8.1
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/custom-elements.json +67 -25
- package/dist/dts/grid-pro-beta.d.ts +25 -1
- package/dist/dts/grid-pro-beta.d.ts.map +1 -1
- package/dist/esm/grid-pro-beta.js +84 -21
- package/package.json +11 -11
|
@@ -48,17 +48,78 @@
|
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
"kind": "field",
|
|
51
|
-
"name": "
|
|
52
|
-
"type": {
|
|
53
|
-
"text": "ReturnType<typeof themeBalham.withParams> | undefined"
|
|
54
|
-
},
|
|
51
|
+
"name": "cachedThemes",
|
|
55
52
|
"privacy": "private",
|
|
56
|
-
"static": true
|
|
53
|
+
"static": true,
|
|
54
|
+
"default": "new Map<number | 'default', RapidGridTheme>()",
|
|
55
|
+
"description": "AG derives a cell's line-height from `min(--ag-row-height, --ag-line-height)`, and only\n`--ag-line-height` tracks the configured `rowHeight` — `--ag-row-height` comes from the theme's\nown default (~29px). So a grid with a taller `rowHeight` keeps the ~29px line-height and, since\n`.ag-cell` is a block box rather than a flex one, renders its content pinned to the top of the\nrow instead of vertically centred. Feeding the configured height back in as the theme's\n`rowHeight` param keeps both variables in agreement.\n\nThat makes row height the one param that can't be shared, so themes are keyed by distinct\nheight, with `'default'` covering grids that don't configure one."
|
|
57
56
|
},
|
|
58
57
|
{
|
|
59
58
|
"kind": "method",
|
|
60
59
|
"name": "getCachedTheme",
|
|
61
|
-
"privacy": "private"
|
|
60
|
+
"privacy": "private",
|
|
61
|
+
"return": {
|
|
62
|
+
"type": {
|
|
63
|
+
"text": "RapidGridTheme"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"parameters": [
|
|
67
|
+
{
|
|
68
|
+
"name": "rowHeight",
|
|
69
|
+
"optional": true,
|
|
70
|
+
"type": {
|
|
71
|
+
"text": "number"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"kind": "method",
|
|
78
|
+
"name": "resolveRowHeight",
|
|
79
|
+
"privacy": "private",
|
|
80
|
+
"return": {
|
|
81
|
+
"type": {
|
|
82
|
+
"text": "number | undefined"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"parameters": [
|
|
86
|
+
{
|
|
87
|
+
"name": "options",
|
|
88
|
+
"type": {
|
|
89
|
+
"text": "GridOptions"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
"description": "The height AG will end up using, resolved the same way `GridProBeta` resolves it: attributes are\ncopied over the derived options last, so they win over anything on the options object."
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"kind": "method",
|
|
97
|
+
"name": "agAttributeChangedCallback",
|
|
98
|
+
"parameters": [
|
|
99
|
+
{
|
|
100
|
+
"name": "attName",
|
|
101
|
+
"type": {
|
|
102
|
+
"text": "string"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "oldValue",
|
|
107
|
+
"type": {
|
|
108
|
+
"text": "unknown"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "newValue",
|
|
113
|
+
"type": {
|
|
114
|
+
"text": "unknown"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"description": "Keeps the theme's row height in step with a row height changed after the grid was built.",
|
|
119
|
+
"inheritedFrom": {
|
|
120
|
+
"name": "GridProBeta",
|
|
121
|
+
"module": "src/grid-pro-beta.ts"
|
|
122
|
+
}
|
|
62
123
|
},
|
|
63
124
|
{
|
|
64
125
|
"kind": "field",
|
|
@@ -1327,25 +1388,6 @@
|
|
|
1327
1388
|
"module": "src/grid-pro-beta.ts"
|
|
1328
1389
|
}
|
|
1329
1390
|
},
|
|
1330
|
-
{
|
|
1331
|
-
"kind": "method",
|
|
1332
|
-
"name": "agAttributeChangedCallback",
|
|
1333
|
-
"parameters": [
|
|
1334
|
-
{
|
|
1335
|
-
"name": "attName"
|
|
1336
|
-
},
|
|
1337
|
-
{
|
|
1338
|
-
"name": "oldValue"
|
|
1339
|
-
},
|
|
1340
|
-
{
|
|
1341
|
-
"name": "newValue"
|
|
1342
|
-
}
|
|
1343
|
-
],
|
|
1344
|
-
"inheritedFrom": {
|
|
1345
|
-
"name": "GridProBeta",
|
|
1346
|
-
"module": "src/grid-pro-beta.ts"
|
|
1347
|
-
}
|
|
1348
|
-
},
|
|
1349
1391
|
{
|
|
1350
1392
|
"kind": "method",
|
|
1351
1393
|
"name": "globalEventListener",
|
|
@@ -5,8 +5,32 @@ import { GridOptions } from 'ag-grid-community';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class RapidGridProBeta extends GridProBeta {
|
|
7
7
|
provider: any;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* AG derives a cell's line-height from `min(--ag-row-height, --ag-line-height)`, and only
|
|
10
|
+
* `--ag-line-height` tracks the configured `rowHeight` — `--ag-row-height` comes from the theme's
|
|
11
|
+
* own default (~29px). So a grid with a taller `rowHeight` keeps the ~29px line-height and, since
|
|
12
|
+
* `.ag-cell` is a block box rather than a flex one, renders its content pinned to the top of the
|
|
13
|
+
* row instead of vertically centred. Feeding the configured height back in as the theme's
|
|
14
|
+
* `rowHeight` param keeps both variables in agreement.
|
|
15
|
+
*
|
|
16
|
+
* That makes row height the one param that can't be shared, so themes are keyed by distinct
|
|
17
|
+
* height, with `'default'` covering grids that don't configure one.
|
|
18
|
+
*/
|
|
19
|
+
private static cachedThemes;
|
|
9
20
|
private getCachedTheme;
|
|
21
|
+
/**
|
|
22
|
+
* The height AG will end up using, resolved the same way `GridProBeta` resolves it: attributes are
|
|
23
|
+
* copied over the derived options last, so they win over anything on the options object.
|
|
24
|
+
*/
|
|
25
|
+
private resolveRowHeight;
|
|
26
|
+
/**
|
|
27
|
+
* Keeps the theme's row height in step with a row height changed after the grid was built.
|
|
28
|
+
* @remarks AG resizes the rows and refreshes `--ag-line-height` on its own, but `--ag-row-height`
|
|
29
|
+
* belongs to the theme, so without swapping the theme too a grid grown past its original height
|
|
30
|
+
* clamps back to the old line-height and tops out its cell content again.
|
|
31
|
+
* @override
|
|
32
|
+
*/
|
|
33
|
+
agAttributeChangedCallback(attName: string, oldValue: unknown, newValue: unknown): void;
|
|
10
34
|
/**
|
|
11
35
|
* Handles extra Rapid configs
|
|
12
36
|
* @override
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-pro-beta.d.ts","sourceRoot":"","sources":["../../src/grid-pro-beta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAwB,MAAM,uBAAuB,CAAC;AAE1E,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"grid-pro-beta.d.ts","sourceRoot":"","sources":["../../src/grid-pro-beta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAwB,MAAM,uBAAuB,CAAC;AAE1E,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA6D7D;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;IACnC,QAAQ,EAAG,GAAG,CAAC;IAE3B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY,CAAiD;IAE5E,OAAO,CAAC,cAAc;IAgBtB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IASxB;;;;;;OAMG;IACH,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO;IAShF;;;OAGG;IACH,IAAI,WAAW,CAAC,OAAO,EAAE,WAAW,EAuBnC;CACF;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;2BAyB3B,CAAC"}
|
|
@@ -6,31 +6,82 @@ import { RapidNumberEditor, RapidSelectEditor, RapidMultiselectEditor, RapidDate
|
|
|
6
6
|
import { RapidEditableRenderer, RapidAgActionRenderer, RapidAgActionsMenuRenderer, RapidBooleanRenderer, RapidStatusPillRenderer, RapidIconRenderer, RapidAgSelectRenderer, } from './cell-renderers';
|
|
7
7
|
import { rapidDefaultGridProConfig, rapidGridProShadowOptions } from './grid-pro';
|
|
8
8
|
import { rapidGridProTemplate as template } from './grid-pro.template';
|
|
9
|
+
/**
|
|
10
|
+
* Every param here is a CSS custom-property reference, so they resolve per instance and per mode
|
|
11
|
+
* from one built theme. Row height is the one exception — see {@link RapidGridProBeta.cachedThemes}.
|
|
12
|
+
*/
|
|
13
|
+
const rapidGridThemeParams = {
|
|
14
|
+
backgroundColor: 'var(--neutral-layer-card-container)',
|
|
15
|
+
cellHorizontalPadding: 'calc(var(--design-unit) * 2px)',
|
|
16
|
+
foregroundColor: 'var(--neutral-foreground-rest)',
|
|
17
|
+
headerTextColor: 'var(--neutral-foreground-hint)',
|
|
18
|
+
headerBackgroundColor: 'var(--neutral-layer-3)',
|
|
19
|
+
headerColumnBorder: '1px solid var(--neutral-stroke-rest)',
|
|
20
|
+
oddRowBackgroundColor: 'var(--neutral-layer-1)',
|
|
21
|
+
rowBorder: '1px solid var(--neutral-stroke-divider-rest)',
|
|
22
|
+
borderColor: 'var(--neutral-stroke-rest)',
|
|
23
|
+
wrapperBorder: '0',
|
|
24
|
+
accentColor: 'var(--accent-foreground-rest)',
|
|
25
|
+
fontFamily: 'var(--body-font)',
|
|
26
|
+
sideBarBackgroundColor: 'var(--neutral-layer-2)',
|
|
27
|
+
dataFontSize: 'var(--type-ramp-minus-2-font-size)',
|
|
28
|
+
iconButtonColor: 'var(--accent-foreground-rest)',
|
|
29
|
+
iconButtonHoverColor: 'color-mix(in srgb, var(--accent-foreground-rest), var(--ag-foreground-color) 30%)',
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The attribute spellings `GridProBeta` maps onto `GridOptions.rowHeight`, highest precedence
|
|
33
|
+
* first, mirroring its own `agPropertiesMap`.
|
|
34
|
+
*/
|
|
35
|
+
const rowHeightAttributes = ['rowheight', 'row-height'];
|
|
36
|
+
/**
|
|
37
|
+
* A row height arrives either as a `GridOptions.rowHeight` number or as an attribute string, so
|
|
38
|
+
* normalise before using it as a theme param and cache key.
|
|
39
|
+
*/
|
|
40
|
+
function toThemeRowHeight(value) {
|
|
41
|
+
const rowHeight = Number(value);
|
|
42
|
+
return Number.isFinite(rowHeight) && rowHeight > 0 ? rowHeight : undefined;
|
|
43
|
+
}
|
|
9
44
|
/**
|
|
10
45
|
* @tagname rapid-grid-pro
|
|
11
46
|
*/
|
|
12
47
|
export class RapidGridProBeta extends GridProBeta {
|
|
13
|
-
getCachedTheme() {
|
|
48
|
+
getCachedTheme(rowHeight) {
|
|
49
|
+
const key = rowHeight !== null && rowHeight !== void 0 ? rowHeight : 'default';
|
|
50
|
+
let theme = RapidGridProBeta.cachedThemes.get(key);
|
|
51
|
+
if (!theme) {
|
|
52
|
+
theme = themeBalham.withParams(key === 'default'
|
|
53
|
+
? rapidGridThemeParams
|
|
54
|
+
: Object.assign(Object.assign({}, rapidGridThemeParams), { rowHeight: `${key}px` }));
|
|
55
|
+
RapidGridProBeta.cachedThemes.set(key, theme);
|
|
56
|
+
}
|
|
57
|
+
return theme;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The height AG will end up using, resolved the same way `GridProBeta` resolves it: attributes are
|
|
61
|
+
* copied over the derived options last, so they win over anything on the options object.
|
|
62
|
+
*/
|
|
63
|
+
resolveRowHeight(options) {
|
|
64
|
+
for (const attribute of rowHeightAttributes) {
|
|
65
|
+
const fromAttribute = toThemeRowHeight(this.getAttribute(attribute));
|
|
66
|
+
if (fromAttribute)
|
|
67
|
+
return fromAttribute;
|
|
68
|
+
}
|
|
69
|
+
return toThemeRowHeight(options.rowHeight);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Keeps the theme's row height in step with a row height changed after the grid was built.
|
|
73
|
+
* @remarks AG resizes the rows and refreshes `--ag-line-height` on its own, but `--ag-row-height`
|
|
74
|
+
* belongs to the theme, so without swapping the theme too a grid grown past its original height
|
|
75
|
+
* clamps back to the old line-height and tops out its cell content again.
|
|
76
|
+
* @override
|
|
77
|
+
*/
|
|
78
|
+
agAttributeChangedCallback(attName, oldValue, newValue) {
|
|
14
79
|
var _a;
|
|
15
|
-
(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
headerBackgroundColor: 'var(--neutral-layer-3)',
|
|
21
|
-
headerColumnBorder: '1px solid var(--neutral-stroke-rest)',
|
|
22
|
-
oddRowBackgroundColor: 'var(--neutral-layer-1)',
|
|
23
|
-
rowBorder: '1px solid var(--neutral-stroke-divider-rest)',
|
|
24
|
-
borderColor: 'var(--neutral-stroke-rest)',
|
|
25
|
-
wrapperBorder: '0',
|
|
26
|
-
accentColor: 'var(--accent-foreground-rest)',
|
|
27
|
-
fontFamily: 'var(--body-font)',
|
|
28
|
-
sideBarBackgroundColor: 'var(--neutral-layer-2)',
|
|
29
|
-
dataFontSize: 'var(--type-ramp-minus-2-font-size)',
|
|
30
|
-
iconButtonColor: 'var(--accent-foreground-rest)',
|
|
31
|
-
iconButtonHoverColor: 'color-mix(in srgb, var(--accent-foreground-rest), var(--ag-foreground-color) 30%)',
|
|
32
|
-
}));
|
|
33
|
-
return RapidGridProBeta.cachedTheme;
|
|
80
|
+
super.agAttributeChangedCallback(attName, oldValue, newValue);
|
|
81
|
+
if (this.agPropertiesMap[attName] !== 'rowHeight' || oldValue === newValue)
|
|
82
|
+
return;
|
|
83
|
+
// Before the grid exists there is nothing to update — `gridOptions` picks the theme instead.
|
|
84
|
+
(_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.setGridOption('theme', this.getCachedTheme(toThemeRowHeight(newValue)));
|
|
34
85
|
}
|
|
35
86
|
/**
|
|
36
87
|
* Handles extra Rapid configs
|
|
@@ -39,10 +90,22 @@ export class RapidGridProBeta extends GridProBeta {
|
|
|
39
90
|
set gridOptions(options) {
|
|
40
91
|
const nextOptions = Object.assign({}, options);
|
|
41
92
|
nextOptions.components = Object.assign({ [GridProRendererTypes.action]: RapidAgActionRenderer, [GridProRendererTypes.actionsMenu]: RapidAgActionsMenuRenderer, [GridProRendererTypes.boolean]: RapidBooleanRenderer, [GridProRendererTypes.editable]: RapidEditableRenderer, [GridProRendererTypes.select]: RapidAgSelectRenderer, [GridProRendererTypes.selectEditor]: RapidSelectEditor, [GridProRendererTypes.numberEditor]: RapidNumberEditor, [GridProRendererTypes.multiselectEditor]: RapidMultiselectEditor, [GridProRendererTypes.dateEditor]: RapidDateEditor, [GridProRendererTypes.stringEditor]: RapidStringEditor, [GridProRendererTypes.statusPill]: RapidStatusPillRenderer, [GridProRendererTypes.icon]: RapidIconRenderer }, nextOptions.components);
|
|
42
|
-
nextOptions.theme = this.getCachedTheme();
|
|
93
|
+
nextOptions.theme = this.getCachedTheme(this.resolveRowHeight(nextOptions));
|
|
43
94
|
super.gridOptions = nextOptions;
|
|
44
95
|
}
|
|
45
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* AG derives a cell's line-height from `min(--ag-row-height, --ag-line-height)`, and only
|
|
99
|
+
* `--ag-line-height` tracks the configured `rowHeight` — `--ag-row-height` comes from the theme's
|
|
100
|
+
* own default (~29px). So a grid with a taller `rowHeight` keeps the ~29px line-height and, since
|
|
101
|
+
* `.ag-cell` is a block box rather than a flex one, renders its content pinned to the top of the
|
|
102
|
+
* row instead of vertically centred. Feeding the configured height back in as the theme's
|
|
103
|
+
* `rowHeight` param keeps both variables in agreement.
|
|
104
|
+
*
|
|
105
|
+
* That makes row height the one param that can't be shared, so themes are keyed by distinct
|
|
106
|
+
* height, with `'default'` covering grids that don't configure one.
|
|
107
|
+
*/
|
|
108
|
+
RapidGridProBeta.cachedThemes = new Map();
|
|
46
109
|
__decorate([
|
|
47
110
|
observable
|
|
48
111
|
], RapidGridProBeta.prototype, "provider", void 0);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/rapid-grid-pro",
|
|
3
3
|
"description": "Genesis Rapid Grid Pro",
|
|
4
|
-
"version": "15.8.
|
|
4
|
+
"version": "15.8.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -37,17 +37,17 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@genesislcap/genx": "15.8.
|
|
41
|
-
"@genesislcap/rollup-builder": "15.8.
|
|
42
|
-
"@genesislcap/ts-builder": "15.8.
|
|
43
|
-
"@genesislcap/uvu-playwright-builder": "15.8.
|
|
44
|
-
"@genesislcap/vite-builder": "15.8.
|
|
45
|
-
"@genesislcap/webpack-builder": "15.8.
|
|
40
|
+
"@genesislcap/genx": "15.8.1",
|
|
41
|
+
"@genesislcap/rollup-builder": "15.8.1",
|
|
42
|
+
"@genesislcap/ts-builder": "15.8.1",
|
|
43
|
+
"@genesislcap/uvu-playwright-builder": "15.8.1",
|
|
44
|
+
"@genesislcap/vite-builder": "15.8.1",
|
|
45
|
+
"@genesislcap/webpack-builder": "15.8.1"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@genesislcap/foundation-ui": "15.8.
|
|
49
|
-
"@genesislcap/grid-pro": "15.8.
|
|
50
|
-
"@genesislcap/rapid-design-system": "15.8.
|
|
48
|
+
"@genesislcap/foundation-ui": "15.8.1",
|
|
49
|
+
"@genesislcap/grid-pro": "15.8.1",
|
|
50
|
+
"@genesislcap/rapid-design-system": "15.8.1",
|
|
51
51
|
"@microsoft/fast-colors": "5.3.1",
|
|
52
52
|
"@microsoft/fast-components": "2.30.6",
|
|
53
53
|
"@microsoft/fast-element": "1.14.0",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"require": "./dist/react.cjs"
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "e9e2b412bf2c21763346f86687698ce2d5d99a56"
|
|
84
84
|
}
|