@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.
- package/dist/custom-elements.json +921 -920
- package/dist/dts/grid-pro-legacy.d.ts +41 -0
- package/dist/dts/grid-pro-legacy.d.ts.map +1 -0
- package/dist/dts/grid-pro.d.ts +25 -14
- package/dist/dts/grid-pro.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/react.d.ts +9 -9
- package/dist/esm/grid-pro-legacy.js +83 -0
- package/dist/esm/grid-pro.js +156 -58
- package/dist/esm/index.js +1 -1
- package/dist/react.cjs +4 -4
- package/dist/react.mjs +3 -3
- package/package.json +10 -10
- package/dist/dts/grid-pro-beta.d.ts +0 -51
- package/dist/dts/grid-pro-beta.d.ts.map +0 -1
- package/dist/esm/grid-pro-beta.js +0 -154
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { GridProLegacy } from '@genesislcap/grid-pro';
|
|
2
|
+
import type { GridOptionsConfig } from '@genesislcap/grid-pro';
|
|
3
|
+
/**
|
|
4
|
+
* @tagname rapid-grid-pro
|
|
5
|
+
* @deprecated Legacy AG Grid v29 wrapper. Use `RapidGridPro` (AG Grid v36) instead.
|
|
6
|
+
*/
|
|
7
|
+
export declare class RapidGridProLegacy extends GridProLegacy {
|
|
8
|
+
provider: any;
|
|
9
|
+
private luminanceSubscription?;
|
|
10
|
+
private readonly luminanceObserver;
|
|
11
|
+
private handleLuminanceChange;
|
|
12
|
+
connectedCallback(): void;
|
|
13
|
+
disconnectedCallback(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Sets default theme to Rapid
|
|
16
|
+
* @override
|
|
17
|
+
*/
|
|
18
|
+
theme: string;
|
|
19
|
+
themeChanged(oldValue: string, newValue: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Handles extra Rapid configs
|
|
22
|
+
* @override
|
|
23
|
+
*/
|
|
24
|
+
set gridOptions(options: GridOptionsConfig);
|
|
25
|
+
}
|
|
26
|
+
export declare const rapidGridProShadowOptions: ShadowRootInit;
|
|
27
|
+
export declare const rapidDefaultGridProConfig: {
|
|
28
|
+
shadowOptions: any;
|
|
29
|
+
};
|
|
30
|
+
export declare const rapidGridProLegacy: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<{
|
|
31
|
+
shadowOptions: any;
|
|
32
|
+
baseName: string;
|
|
33
|
+
template: import("@microsoft/fast-element").ViewTemplate<import("@genesislcap/grid-pro").GridPro, any>;
|
|
34
|
+
styles: import("@microsoft/fast-element").ElementStyles;
|
|
35
|
+
}>) => import("@microsoft/fast-foundation").FoundationElementRegistry<{
|
|
36
|
+
shadowOptions: any;
|
|
37
|
+
baseName: string;
|
|
38
|
+
template: import("@microsoft/fast-element").ViewTemplate<import("@genesislcap/grid-pro").GridPro, any>;
|
|
39
|
+
styles: import("@microsoft/fast-element").ElementStyles;
|
|
40
|
+
}, typeof RapidGridProLegacy>;
|
|
41
|
+
//# sourceMappingURL=grid-pro-legacy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-pro-legacy.d.ts","sourceRoot":"","sources":["../../src/grid-pro-legacy.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EAId,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AA4B/D;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;IACvC,QAAQ,EAAG,GAAG,CAAC;IAC3B,OAAO,CAAC,qBAAqB,CAAC,CAAM;IACpC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAEhC;IAEF,OAAO,CAAC,qBAAqB,CAG3B;IAEF,iBAAiB,IAAI,IAAI;IASzB,oBAAoB,IAAI,IAAI;IAU5B;;;OAGG;IACH,KAAK,SAGA;IAEL,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAK/C;;;OAGG;IACH,IAAI,WAAW,CAAC,OAAO,EAAE,iBAAiB,EAgCzC;CACF;AAGD,eAAO,MAAM,yBAAyB,EAAE,cAA+C,CAAC;AACxF,eAAO,MAAM,yBAAyB;;CAAmB,CAAC;AAE1D,eAAO,MAAM,kBAAkB;;;;;;;;;;6BAM7B,CAAC"}
|
package/dist/dts/grid-pro.d.ts
CHANGED
|
@@ -1,31 +1,42 @@
|
|
|
1
1
|
import { GridPro } from '@genesislcap/grid-pro';
|
|
2
|
-
import
|
|
2
|
+
import { GridOptions } from 'ag-grid-community';
|
|
3
3
|
/**
|
|
4
4
|
* @tagname rapid-grid-pro
|
|
5
5
|
*/
|
|
6
6
|
export declare class RapidGridPro extends GridPro {
|
|
7
7
|
provider: any;
|
|
8
|
-
private luminanceSubscription?;
|
|
9
|
-
private readonly luminanceObserver;
|
|
10
|
-
private handleLuminanceChange;
|
|
11
|
-
connectedCallback(): void;
|
|
12
|
-
disconnectedCallback(): void;
|
|
13
8
|
/**
|
|
14
|
-
*
|
|
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 `GridPro` 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.
|
|
15
31
|
* @override
|
|
16
32
|
*/
|
|
17
|
-
|
|
18
|
-
themeChanged(oldValue: string, newValue: string): void;
|
|
33
|
+
agAttributeChangedCallback(attName: string, oldValue: unknown, newValue: unknown): void;
|
|
19
34
|
/**
|
|
20
35
|
* Handles extra Rapid configs
|
|
21
36
|
* @override
|
|
22
37
|
*/
|
|
23
|
-
set gridOptions(options:
|
|
38
|
+
set gridOptions(options: GridOptions);
|
|
24
39
|
}
|
|
25
|
-
export declare const rapidGridProShadowOptions: ShadowRootInit;
|
|
26
|
-
export declare const rapidDefaultGridProConfig: {
|
|
27
|
-
shadowOptions: any;
|
|
28
|
-
};
|
|
29
40
|
export declare const rapidGridPro: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<{
|
|
30
41
|
shadowOptions: any;
|
|
31
42
|
baseName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-pro.d.ts","sourceRoot":"","sources":["../../src/grid-pro.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"grid-pro.d.ts","sourceRoot":"","sources":["../../src/grid-pro.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,OAAO,EAGR,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA6D7D;;GAEG;AACH,qBAAa,YAAa,SAAQ,OAAO;IAC3B,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,YAAY;;;;;;;;;;uBAyEvB,CAAC"}
|
package/dist/dts/index.d.ts
CHANGED
package/dist/dts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AAExB,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,uBAAuB,CAAC"}
|
package/dist/dts/react.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import type { RapidAgSelectRenderer as RapidAgSelectRendererWC } from './cell-re
|
|
|
18
18
|
import type { RapidStatusPillRenderer as RapidStatusPillRendererWC } from './cell-renderers/status-pill.renderer';
|
|
19
19
|
import type { RapidAgTextRenderer as RapidAgTextRendererWC } from './cell-renderers/text.renderer';
|
|
20
20
|
import type { RapidColumnSelection as RapidColumnSelectionWC } from './column-selection';
|
|
21
|
-
import type {
|
|
21
|
+
import type { RapidGridProLegacy as RapidGridProLegacyWC } from './grid-pro-legacy';
|
|
22
22
|
import type { RapidGridPro as RapidGridProWC } from './grid-pro';
|
|
23
23
|
import type { GridReadyEventDetail } from '@genesislcap/grid-pro';
|
|
24
24
|
|
|
@@ -60,24 +60,24 @@ export declare const RapidColumnSelection: React.ForwardRefExoticComponent<
|
|
|
60
60
|
>;
|
|
61
61
|
export type RapidColumnSelectionRef = RapidColumnSelectionWC;
|
|
62
62
|
|
|
63
|
-
export declare const
|
|
63
|
+
export declare const RapidGridProLegacy: React.ForwardRefExoticComponent<
|
|
64
64
|
React.PropsWithChildren<
|
|
65
|
-
Omit<PublicOf<
|
|
65
|
+
Omit<PublicOf<RapidGridProLegacyWC>, 'children' | 'style'> &
|
|
66
66
|
HTMLWCProps & {
|
|
67
|
-
onGridReady?: (event: CustomEvent<
|
|
68
|
-
onOnGridReady?: (event: CustomEvent<
|
|
67
|
+
onGridReady?: (event: CustomEvent<unknown>) => void;
|
|
68
|
+
onOnGridReady?: (event: CustomEvent<unknown>) => void;
|
|
69
69
|
onGridready?: (event: CustomEvent<unknown>) => void;
|
|
70
70
|
}
|
|
71
|
-
> & React.RefAttributes<
|
|
71
|
+
> & React.RefAttributes<RapidGridProLegacyWC>
|
|
72
72
|
>;
|
|
73
|
-
export type
|
|
73
|
+
export type RapidGridProLegacyRef = RapidGridProLegacyWC;
|
|
74
74
|
|
|
75
75
|
export declare const RapidGridPro: React.ForwardRefExoticComponent<
|
|
76
76
|
React.PropsWithChildren<
|
|
77
77
|
Omit<PublicOf<RapidGridProWC>, 'children' | 'style'> &
|
|
78
78
|
HTMLWCProps & {
|
|
79
|
-
onGridReady?: (event: CustomEvent<
|
|
80
|
-
onOnGridReady?: (event: CustomEvent<
|
|
79
|
+
onGridReady?: (event: CustomEvent<GridReadyEventDetail>) => void;
|
|
80
|
+
onOnGridReady?: (event: CustomEvent<GridReadyEventDetail>) => void;
|
|
81
81
|
onGridready?: (event: CustomEvent<unknown>) => void;
|
|
82
82
|
}
|
|
83
83
|
> & React.RefAttributes<RapidGridProWC>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { GridProLegacy, GridProRendererTypes, foundationGridProShadowOptions, defaultGridProConfig as foundationConfig, } from '@genesislcap/grid-pro';
|
|
3
|
+
import { baseLayerLuminance, StandardLuminance } from '@microsoft/fast-components';
|
|
4
|
+
import { observable } from '@microsoft/fast-element';
|
|
5
|
+
import { RapidNumberEditor, RapidSelectEditor, RapidMultiselectEditor, RapidDateEditor, RapidStringEditor, } from './cell-editors';
|
|
6
|
+
import { RapidEditableRenderer, RapidAgActionRenderer, RapidAgActionsMenuRenderer, RapidBooleanRenderer, RapidStatusPillRenderer, RapidAgSelectRenderer, RapidIconRenderer, } from './cell-renderers';
|
|
7
|
+
import { rapidGridProStyles as styles } from './grid-pro.styles';
|
|
8
|
+
import { rapidGridProTemplate as template } from './grid-pro.template';
|
|
9
|
+
import { deriveHeightsFromTokens } from './style';
|
|
10
|
+
import { themeGenesisRapid, themeGenesisRapidDark, themeGenesisRapidLight } from './themes';
|
|
11
|
+
const defaultAgHeight = 32;
|
|
12
|
+
const rapidThemeDark = 'ag-theme-genesis-rapid-dark';
|
|
13
|
+
const rapidThemeLight = 'ag-theme-genesis-rapid-light';
|
|
14
|
+
/**
|
|
15
|
+
* @tagname rapid-grid-pro
|
|
16
|
+
* @deprecated Legacy AG Grid v29 wrapper. Use `RapidGridPro` (AG Grid v36) instead.
|
|
17
|
+
*/
|
|
18
|
+
export class RapidGridProLegacy extends GridProLegacy {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.luminanceObserver = {
|
|
22
|
+
handleChange: (record) => this.handleLuminanceChange(record),
|
|
23
|
+
};
|
|
24
|
+
this.handleLuminanceChange = (record) => {
|
|
25
|
+
const luminance = baseLayerLuminance.getValueFor(record.target);
|
|
26
|
+
this.theme = luminance === StandardLuminance.DarkMode ? rapidThemeDark : rapidThemeLight;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Sets default theme to Rapid
|
|
30
|
+
* @override
|
|
31
|
+
*/
|
|
32
|
+
this.theme = (() => {
|
|
33
|
+
const luminance = localStorage.getItem('luminance');
|
|
34
|
+
return luminance === 'light' ? rapidThemeLight : rapidThemeDark;
|
|
35
|
+
})();
|
|
36
|
+
}
|
|
37
|
+
connectedCallback() {
|
|
38
|
+
var _a;
|
|
39
|
+
super.connectedCallback();
|
|
40
|
+
const luminanceTarget = (_a = this.provider) !== null && _a !== void 0 ? _a : this;
|
|
41
|
+
this.luminanceSubscription = baseLayerLuminance.subscribe(this.luminanceObserver, luminanceTarget);
|
|
42
|
+
}
|
|
43
|
+
disconnectedCallback() {
|
|
44
|
+
var _a;
|
|
45
|
+
const luminanceTarget = (_a = this.provider) !== null && _a !== void 0 ? _a : this;
|
|
46
|
+
baseLayerLuminance.unsubscribe(this.luminanceObserver, luminanceTarget);
|
|
47
|
+
if (this.luminanceSubscription) {
|
|
48
|
+
this.luminanceSubscription.unsubscribe();
|
|
49
|
+
this.luminanceSubscription = undefined;
|
|
50
|
+
}
|
|
51
|
+
super.disconnectedCallback();
|
|
52
|
+
}
|
|
53
|
+
themeChanged(oldValue, newValue) {
|
|
54
|
+
if (!oldValue && newValue !== rapidThemeDark)
|
|
55
|
+
return;
|
|
56
|
+
super.themeChanged(oldValue, newValue);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Handles extra Rapid configs
|
|
60
|
+
* @override
|
|
61
|
+
*/
|
|
62
|
+
set gridOptions(options) {
|
|
63
|
+
var _a, _b, _c, _d;
|
|
64
|
+
const nextOptions = Object.assign({}, options);
|
|
65
|
+
nextOptions.components = Object.assign({ [GridProRendererTypes.action]: RapidAgActionRenderer, [GridProRendererTypes.actionsMenu]: RapidAgActionsMenuRenderer, [GridProRendererTypes.boolean]: RapidBooleanRenderer, [GridProRendererTypes.editable]: RapidEditableRenderer, [GridProRendererTypes.icon]: RapidIconRenderer, [GridProRendererTypes.select]: RapidAgSelectRenderer, [GridProRendererTypes.selectEditor]: RapidSelectEditor, [GridProRendererTypes.numberEditor]: RapidNumberEditor, [GridProRendererTypes.multiselectEditor]: RapidMultiselectEditor, [GridProRendererTypes.dateEditor]: RapidDateEditor, [GridProRendererTypes.stringEditor]: RapidStringEditor, [GridProRendererTypes.statusPill]: RapidStatusPillRenderer }, nextOptions.components);
|
|
66
|
+
const isRapidTheme = this.theme === themeGenesisRapid ||
|
|
67
|
+
this.theme === themeGenesisRapidDark ||
|
|
68
|
+
this.theme === themeGenesisRapidLight;
|
|
69
|
+
if (isRapidTheme) {
|
|
70
|
+
this.headerHeight = (_b = (_a = nextOptions.headerHeight) !== null && _a !== void 0 ? _a : deriveHeightsFromTokens()) !== null && _b !== void 0 ? _b : defaultAgHeight;
|
|
71
|
+
this.rowHeight = (_d = (_c = nextOptions.rowHeight) !== null && _c !== void 0 ? _c : deriveHeightsFromTokens()) !== null && _d !== void 0 ? _d : defaultAgHeight;
|
|
72
|
+
}
|
|
73
|
+
super.gridOptions = nextOptions;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
__decorate([
|
|
77
|
+
observable
|
|
78
|
+
], RapidGridProLegacy.prototype, "provider", void 0);
|
|
79
|
+
// explicitly declaring for extensibility
|
|
80
|
+
export const rapidGridProShadowOptions = foundationGridProShadowOptions;
|
|
81
|
+
export const rapidDefaultGridProConfig = foundationConfig;
|
|
82
|
+
export const rapidGridProLegacy = RapidGridProLegacy.compose(Object.assign({ baseName: 'grid-pro', template,
|
|
83
|
+
styles, shadowOptions: rapidGridProShadowOptions }, rapidDefaultGridProConfig));
|
package/dist/esm/grid-pro.js
CHANGED
|
@@ -1,82 +1,180 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { agDragGhostShadowDomStyles, errorHandlerDialogStyles, gridProColumnSelectionHostStyles, GridPro, GridProRendererTypes, rowMatchAlertStyles, } from '@genesislcap/grid-pro';
|
|
3
|
+
import { css, observable } from '@microsoft/fast-element';
|
|
4
|
+
import { themeBalham } from 'ag-grid-community';
|
|
5
5
|
import { RapidNumberEditor, RapidSelectEditor, RapidMultiselectEditor, RapidDateEditor, RapidStringEditor, } from './cell-editors';
|
|
6
|
-
import { RapidEditableRenderer, RapidAgActionRenderer, RapidAgActionsMenuRenderer, RapidBooleanRenderer, RapidStatusPillRenderer,
|
|
7
|
-
import {
|
|
6
|
+
import { RapidEditableRenderer, RapidAgActionRenderer, RapidAgActionsMenuRenderer, RapidBooleanRenderer, RapidStatusPillRenderer, RapidIconRenderer, RapidAgSelectRenderer, } from './cell-renderers';
|
|
7
|
+
import { rapidDefaultGridProConfig, rapidGridProShadowOptions } from './grid-pro-legacy';
|
|
8
8
|
import { rapidGridProTemplate as template } from './grid-pro.template';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
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 RapidGridPro.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 `GridPro` 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
|
+
}
|
|
14
44
|
/**
|
|
15
45
|
* @tagname rapid-grid-pro
|
|
16
46
|
*/
|
|
17
47
|
export class RapidGridPro extends GridPro {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
* Sets default theme to Rapid
|
|
29
|
-
* @override
|
|
30
|
-
*/
|
|
31
|
-
this.theme = (() => {
|
|
32
|
-
const luminance = localStorage.getItem('luminance');
|
|
33
|
-
return luminance === 'light' ? rapidThemeLight : rapidThemeDark;
|
|
34
|
-
})();
|
|
35
|
-
}
|
|
36
|
-
connectedCallback() {
|
|
37
|
-
var _a;
|
|
38
|
-
super.connectedCallback();
|
|
39
|
-
const luminanceTarget = (_a = this.provider) !== null && _a !== void 0 ? _a : this;
|
|
40
|
-
this.luminanceSubscription = baseLayerLuminance.subscribe(this.luminanceObserver, luminanceTarget);
|
|
48
|
+
getCachedTheme(rowHeight) {
|
|
49
|
+
const key = rowHeight !== null && rowHeight !== void 0 ? rowHeight : 'default';
|
|
50
|
+
let theme = RapidGridPro.cachedThemes.get(key);
|
|
51
|
+
if (!theme) {
|
|
52
|
+
theme = themeBalham.withParams(key === 'default'
|
|
53
|
+
? rapidGridThemeParams
|
|
54
|
+
: Object.assign(Object.assign({}, rapidGridThemeParams), { rowHeight: `${key}px` }));
|
|
55
|
+
RapidGridPro.cachedThemes.set(key, theme);
|
|
56
|
+
}
|
|
57
|
+
return theme;
|
|
41
58
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
59
|
+
/**
|
|
60
|
+
* The height AG will end up using, resolved the same way `GridPro` 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;
|
|
49
68
|
}
|
|
50
|
-
|
|
69
|
+
return toThemeRowHeight(options.rowHeight);
|
|
51
70
|
}
|
|
52
|
-
|
|
53
|
-
|
|
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)
|
|
54
82
|
return;
|
|
55
|
-
|
|
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)));
|
|
56
85
|
}
|
|
57
86
|
/**
|
|
58
87
|
* Handles extra Rapid configs
|
|
59
88
|
* @override
|
|
60
89
|
*/
|
|
61
90
|
set gridOptions(options) {
|
|
62
|
-
var _a, _b, _c, _d;
|
|
63
91
|
const nextOptions = Object.assign({}, options);
|
|
64
|
-
nextOptions.components = Object.assign({ [GridProRendererTypes.action]: RapidAgActionRenderer, [GridProRendererTypes.actionsMenu]: RapidAgActionsMenuRenderer, [GridProRendererTypes.boolean]: RapidBooleanRenderer, [GridProRendererTypes.editable]: RapidEditableRenderer, [GridProRendererTypes.
|
|
65
|
-
|
|
66
|
-
this.theme === themeGenesisRapidDark ||
|
|
67
|
-
this.theme === themeGenesisRapidLight;
|
|
68
|
-
if (isRapidTheme) {
|
|
69
|
-
this.headerHeight = (_b = (_a = nextOptions.headerHeight) !== null && _a !== void 0 ? _a : deriveHeightsFromTokens()) !== null && _b !== void 0 ? _b : defaultAgHeight;
|
|
70
|
-
this.rowHeight = (_d = (_c = nextOptions.rowHeight) !== null && _c !== void 0 ? _c : deriveHeightsFromTokens()) !== null && _d !== void 0 ? _d : defaultAgHeight;
|
|
71
|
-
}
|
|
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));
|
|
72
94
|
super.gridOptions = nextOptions;
|
|
73
95
|
}
|
|
74
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
|
+
RapidGridPro.cachedThemes = new Map();
|
|
75
109
|
__decorate([
|
|
76
110
|
observable
|
|
77
111
|
], RapidGridPro.prototype, "provider", void 0);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
styles
|
|
112
|
+
export const rapidGridPro = RapidGridPro.compose(Object.assign({ baseName: 'grid-pro', template,
|
|
113
|
+
// The legacy compose got these through `rapidGridProStyles` (`foundationGridProStyles` + the rapid
|
|
114
|
+
// themes); the shared template always renders the error-handler dialog, whose overlay is
|
|
115
|
+
// `position: absolute; inset: 0`, so the host has to be the positioned ancestor.
|
|
116
|
+
styles: css `
|
|
117
|
+
${errorHandlerDialogStyles}
|
|
118
|
+
${agDragGhostShadowDomStyles}
|
|
119
|
+
${gridProColumnSelectionHostStyles}
|
|
120
|
+
${rowMatchAlertStyles}
|
|
121
|
+
|
|
122
|
+
:host {
|
|
123
|
+
--datasource-error-background-color: var(--neutral-layer-4);
|
|
124
|
+
--datasource-error-background-opacity: 0.5;
|
|
125
|
+
--datasource-error-dialog-max-width: 50%;
|
|
126
|
+
--datasource-error-dialog-min-width: auto;
|
|
127
|
+
--ag-status-bar-height: 32.5px;
|
|
128
|
+
|
|
129
|
+
position: relative;
|
|
130
|
+
width: 100%;
|
|
131
|
+
height: 100%;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:host([ds-disconnected]) {
|
|
135
|
+
display: block;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
:host([ds-disconnected])::part(grid) {
|
|
139
|
+
cursor: not-allowed;
|
|
140
|
+
opacity: 40%;
|
|
141
|
+
pointer-events: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.ag-status-bar {
|
|
145
|
+
height: var(--ag-status-bar-height);
|
|
146
|
+
}
|
|
147
|
+
.ag-body-vertical-scroll-viewport,
|
|
148
|
+
.ag-body-horizontal-scroll-viewport,
|
|
149
|
+
.ag-horizontal-right-spacer:not(.ag-scroller-corner),
|
|
150
|
+
.ag-horizontal-left-spacer:not(.ag-scroller-corner) {
|
|
151
|
+
scrollbar-color: var(--ag-scrollbar-handle, var(--neutral-layer-1))
|
|
152
|
+
var(--ag-scrollbar-background, var(--neutral-layer-4));
|
|
153
|
+
&:hover {
|
|
154
|
+
scrollbar-color: var(--neutral-fill-rest) var(--neutral-layer-4);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
.ag-body-horizontal-scroll-end-spacer {
|
|
158
|
+
overflow: unset;
|
|
159
|
+
background: var(--ag-scrollbar-background, var(--neutral-layer-4));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/*
|
|
163
|
+
* Server-side and infinite row models: reveal the inactive (unsorted) sort icon on header
|
|
164
|
+
* hover rather than always. The datasource adds .grid-pro-server-side / .grid-pro-infinite to
|
|
165
|
+
* the grid host while attached; unSortIcon renders the .ag-sort-none-icon on sortable columns,
|
|
166
|
+
* and these rules keep just that icon hidden until the header is hovered. Only the none icon
|
|
167
|
+
* is targeted - AG shows the ascending/descending icon (and hides the none icon) once a column
|
|
168
|
+
* is sorted, so a sorted column's arrow stays fully visible at rest. Matches the client-side
|
|
169
|
+
* model's quiet header while keeping sortability discoverable.
|
|
170
|
+
*/
|
|
171
|
+
.grid-pro-server-side .ag-header-cell-sortable .ag-sort-none-icon,
|
|
172
|
+
.grid-pro-infinite .ag-header-cell-sortable .ag-sort-none-icon {
|
|
173
|
+
opacity: 0;
|
|
174
|
+
transition: opacity 0.15s ease-in-out;
|
|
175
|
+
}
|
|
176
|
+
.grid-pro-server-side .ag-header-cell-sortable:hover .ag-sort-none-icon,
|
|
177
|
+
.grid-pro-infinite .ag-header-cell-sortable:hover .ag-sort-none-icon {
|
|
178
|
+
opacity: 1;
|
|
179
|
+
}
|
|
180
|
+
`, shadowOptions: rapidGridProShadowOptions }, rapidDefaultGridProConfig));
|
package/dist/esm/index.js
CHANGED
package/dist/react.cjs
CHANGED
|
@@ -20,7 +20,7 @@ const { RapidAgSelectRenderer: RapidAgSelectRendererWC } = require('./esm/cell-r
|
|
|
20
20
|
const { RapidStatusPillRenderer: RapidStatusPillRendererWC } = require('./esm/cell-renderers/status-pill.renderer.js');
|
|
21
21
|
const { RapidAgTextRenderer: RapidAgTextRendererWC } = require('./esm/cell-renderers/text.renderer.js');
|
|
22
22
|
const { RapidColumnSelection: RapidColumnSelectionWC } = require('./esm/column-selection.js');
|
|
23
|
-
const {
|
|
23
|
+
const { RapidGridProLegacy: RapidGridProLegacyWC } = require('./esm/grid-pro-legacy.js');
|
|
24
24
|
const { RapidGridPro: RapidGridProWC } = require('./esm/grid-pro.js');
|
|
25
25
|
|
|
26
26
|
function _mergeRefs(...refs) {
|
|
@@ -37,7 +37,7 @@ const RapidColumnSelection = React.forwardRef(function RapidColumnSelection(prop
|
|
|
37
37
|
return React.createElement(customElements.getName(RapidColumnSelectionWC) ?? '%%prefix%%-column-selection', { ...rest, ref }, children);
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
const
|
|
40
|
+
const RapidGridProLegacy = React.forwardRef(function RapidGridProLegacy(props, ref) {
|
|
41
41
|
const { onGridReady, onOnGridReady, onGridready, children, ...rest } = props;
|
|
42
42
|
const _innerRef = React.useRef(null);
|
|
43
43
|
const _onGridReadyRef = React.useRef(onGridReady);
|
|
@@ -61,7 +61,7 @@ const RapidGridProBeta = React.forwardRef(function RapidGridProBeta(props, ref)
|
|
|
61
61
|
el.removeEventListener('gridready', _onGridreadyFn);
|
|
62
62
|
};
|
|
63
63
|
}, []);
|
|
64
|
-
return React.createElement(customElements.getName(
|
|
64
|
+
return React.createElement(customElements.getName(RapidGridProLegacyWC) ?? 'rapid-grid-pro', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
const RapidGridPro = React.forwardRef(function RapidGridPro(props, ref) {
|
|
@@ -158,7 +158,7 @@ const RapidAgTextRenderer = React.forwardRef(function RapidAgTextRenderer(props,
|
|
|
158
158
|
|
|
159
159
|
module.exports = {
|
|
160
160
|
RapidColumnSelection,
|
|
161
|
-
|
|
161
|
+
RapidGridProLegacy,
|
|
162
162
|
RapidGridPro,
|
|
163
163
|
RapidDateEditor,
|
|
164
164
|
RapidMultiselectEditor,
|
package/dist/react.mjs
CHANGED
|
@@ -18,7 +18,7 @@ import { RapidAgSelectRenderer as RapidAgSelectRendererWC } from './esm/cell-ren
|
|
|
18
18
|
import { RapidStatusPillRenderer as RapidStatusPillRendererWC } from './esm/cell-renderers/status-pill.renderer.js';
|
|
19
19
|
import { RapidAgTextRenderer as RapidAgTextRendererWC } from './esm/cell-renderers/text.renderer.js';
|
|
20
20
|
import { RapidColumnSelection as RapidColumnSelectionWC } from './esm/column-selection.js';
|
|
21
|
-
import {
|
|
21
|
+
import { RapidGridProLegacy as RapidGridProLegacyWC } from './esm/grid-pro-legacy.js';
|
|
22
22
|
import { RapidGridPro as RapidGridProWC } from './esm/grid-pro.js';
|
|
23
23
|
|
|
24
24
|
function _mergeRefs(...refs) {
|
|
@@ -35,7 +35,7 @@ export const RapidColumnSelection = React.forwardRef(function RapidColumnSelecti
|
|
|
35
35
|
return React.createElement(customElements.getName(RapidColumnSelectionWC) ?? '%%prefix%%-column-selection', { ...rest, ref }, children);
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
export const
|
|
38
|
+
export const RapidGridProLegacy = React.forwardRef(function RapidGridProLegacy(props, ref) {
|
|
39
39
|
const { onGridReady, onOnGridReady, onGridready, children, ...rest } = props;
|
|
40
40
|
const _innerRef = React.useRef(null);
|
|
41
41
|
const _onGridReadyRef = React.useRef(onGridReady);
|
|
@@ -59,7 +59,7 @@ export const RapidGridProBeta = React.forwardRef(function RapidGridProBeta(props
|
|
|
59
59
|
el.removeEventListener('gridready', _onGridreadyFn);
|
|
60
60
|
};
|
|
61
61
|
}, []);
|
|
62
|
-
return React.createElement(customElements.getName(
|
|
62
|
+
return React.createElement(customElements.getName(RapidGridProLegacyWC) ?? 'rapid-grid-pro', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
export const RapidGridPro = React.forwardRef(function RapidGridPro(props, ref) {
|
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": "
|
|
4
|
+
"version": "16.0.0",
|
|
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": "
|
|
41
|
-
"@genesislcap/rollup-builder": "
|
|
42
|
-
"@genesislcap/ts-builder": "
|
|
43
|
-
"@genesislcap/uvu-playwright-builder": "
|
|
44
|
-
"@genesislcap/vite-builder": "
|
|
45
|
-
"@genesislcap/webpack-builder": "
|
|
40
|
+
"@genesislcap/genx": "16.0.0",
|
|
41
|
+
"@genesislcap/rollup-builder": "16.0.0",
|
|
42
|
+
"@genesislcap/ts-builder": "16.0.0",
|
|
43
|
+
"@genesislcap/uvu-playwright-builder": "16.0.0",
|
|
44
|
+
"@genesislcap/vite-builder": "16.0.0",
|
|
45
|
+
"@genesislcap/webpack-builder": "16.0.0"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@genesislcap/foundation-ui": "
|
|
49
|
-
"@genesislcap/grid-pro": "
|
|
50
|
-
"@genesislcap/rapid-design-system": "
|
|
48
|
+
"@genesislcap/foundation-ui": "16.0.0",
|
|
49
|
+
"@genesislcap/grid-pro": "16.0.0",
|
|
50
|
+
"@genesislcap/rapid-design-system": "16.0.0",
|
|
51
51
|
"@microsoft/fast-colors": "5.3.1",
|
|
52
52
|
"@microsoft/fast-components": "2.30.6",
|
|
53
53
|
"@microsoft/fast-element": "1.14.0",
|