@genesislcap/rapid-grid-pro 15.35.1 → 16.0.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.
@@ -1,51 +0,0 @@
1
- import { GridProBeta } from '@genesislcap/grid-pro';
2
- import { GridOptions } from 'ag-grid-community';
3
- /**
4
- * @tagname rapid-grid-pro
5
- */
6
- export declare class RapidGridProBeta extends GridProBeta {
7
- provider: any;
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;
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;
34
- /**
35
- * Handles extra Rapid configs
36
- * @override
37
- */
38
- set gridOptions(options: GridOptions);
39
- }
40
- export declare const rapidGridProBeta: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<{
41
- shadowOptions: any;
42
- baseName: string;
43
- template: import("@microsoft/fast-element").ViewTemplate<import("@genesislcap/grid-pro").GridPro, any>;
44
- styles: import("@microsoft/fast-element").ElementStyles;
45
- }>) => import("@microsoft/fast-foundation").FoundationElementRegistry<{
46
- shadowOptions: any;
47
- baseName: string;
48
- template: import("@microsoft/fast-element").ViewTemplate<import("@genesislcap/grid-pro").GridPro, any>;
49
- styles: import("@microsoft/fast-element").ElementStyles;
50
- }, typeof RapidGridProBeta>;
51
- //# sourceMappingURL=grid-pro-beta.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"grid-pro-beta.d.ts","sourceRoot":"","sources":["../../src/grid-pro-beta.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EAGZ,MAAM,uBAAuB,CAAC;AAE/B,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;;;;;;;;;;2BAgD3B,CAAC"}
@@ -1,154 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { agDragGhostShadowDomStyles, gridProColumnSelectionHostStyles, GridProBeta, GridProRendererTypes, rowMatchAlertStyles, } from '@genesislcap/grid-pro';
3
- import { css, observable } from '@microsoft/fast-element';
4
- import { themeBalham } from 'ag-grid-community';
5
- import { RapidNumberEditor, RapidSelectEditor, RapidMultiselectEditor, RapidDateEditor, RapidStringEditor, } from './cell-editors';
6
- import { RapidEditableRenderer, RapidAgActionRenderer, RapidAgActionsMenuRenderer, RapidBooleanRenderer, RapidStatusPillRenderer, RapidIconRenderer, RapidAgSelectRenderer, } from './cell-renderers';
7
- import { rapidDefaultGridProConfig, rapidGridProShadowOptions } from './grid-pro';
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
- }
44
- /**
45
- * @tagname rapid-grid-pro
46
- */
47
- export class RapidGridProBeta extends GridProBeta {
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) {
79
- var _a;
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)));
85
- }
86
- /**
87
- * Handles extra Rapid configs
88
- * @override
89
- */
90
- set gridOptions(options) {
91
- const nextOptions = Object.assign({}, options);
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);
93
- nextOptions.theme = this.getCachedTheme(this.resolveRowHeight(nextOptions));
94
- super.gridOptions = nextOptions;
95
- }
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();
109
- __decorate([
110
- observable
111
- ], RapidGridProBeta.prototype, "provider", void 0);
112
- export const rapidGridProBeta = RapidGridProBeta.compose(Object.assign({ baseName: 'grid-pro', template, styles: css `
113
- ${agDragGhostShadowDomStyles}
114
- ${gridProColumnSelectionHostStyles}
115
- ${rowMatchAlertStyles}
116
-
117
- :host {
118
- width: 100%;
119
- height: 100%;
120
- }
121
- .ag-body-vertical-scroll-viewport,
122
- .ag-body-horizontal-scroll-viewport,
123
- .ag-horizontal-right-spacer:not(.ag-scroller-corner),
124
- .ag-horizontal-left-spacer:not(.ag-scroller-corner) {
125
- scrollbar-color: var(--ag-scrollbar-handle, var(--neutral-layer-1))
126
- var(--ag-scrollbar-background, var(--neutral-layer-4));
127
- &:hover {
128
- scrollbar-color: var(--neutral-fill-rest) var(--neutral-layer-4);
129
- }
130
- }
131
- .ag-body-horizontal-scroll-end-spacer {
132
- overflow: unset;
133
- background: var(--ag-scrollbar-background, var(--neutral-layer-4));
134
- }
135
-
136
- /*
137
- * Server-side and infinite row models: reveal the inactive (unsorted) sort icon on header
138
- * hover rather than always. The datasource adds .grid-pro-server-side / .grid-pro-infinite to
139
- * the grid host while attached; unSortIcon renders the .ag-sort-none-icon on sortable columns,
140
- * and these rules keep just that icon hidden until the header is hovered. Only the none icon
141
- * is targeted - AG shows the ascending/descending icon (and hides the none icon) once a column
142
- * is sorted, so a sorted column's arrow stays fully visible at rest. Matches the client-side
143
- * model's quiet header while keeping sortability discoverable.
144
- */
145
- .grid-pro-server-side .ag-header-cell-sortable .ag-sort-none-icon,
146
- .grid-pro-infinite .ag-header-cell-sortable .ag-sort-none-icon {
147
- opacity: 0;
148
- transition: opacity 0.15s ease-in-out;
149
- }
150
- .grid-pro-server-side .ag-header-cell-sortable:hover .ag-sort-none-icon,
151
- .grid-pro-infinite .ag-header-cell-sortable:hover .ag-sort-none-icon {
152
- opacity: 1;
153
- }
154
- `, shadowOptions: rapidGridProShadowOptions }, rapidDefaultGridProConfig));