@genesislcap/grid-pro 15.62.0 → 15.64.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 (49) hide show
  1. package/.cursor/rules/ag-embedded-components.mdc +1 -0
  2. package/dist/custom-elements.json +11320 -10780
  3. package/dist/dts/column-selection/column-selection.d.ts +11 -2
  4. package/dist/dts/column-selection/column-selection.d.ts.map +1 -1
  5. package/dist/dts/column-selection/column-selection.styles.d.ts.map +1 -1
  6. package/dist/dts/column-selection/column-selection.template.d.ts.map +1 -1
  7. package/dist/dts/datasource/base.datasource.d.ts +2 -1
  8. package/dist/dts/datasource/base.datasource.d.ts.map +1 -1
  9. package/dist/dts/grid-components.d.ts +9 -0
  10. package/dist/dts/grid-components.d.ts.map +1 -1
  11. package/dist/dts/grid-pro.d.ts +59 -12
  12. package/dist/dts/grid-pro.d.ts.map +1 -1
  13. package/dist/dts/grid-pro.template.d.ts.map +1 -1
  14. package/dist/dts/grid-pro.types.d.ts +4 -7
  15. package/dist/dts/grid-pro.types.d.ts.map +1 -1
  16. package/dist/dts/index.d.ts +1 -0
  17. package/dist/dts/index.d.ts.map +1 -1
  18. package/dist/dts/react.d.ts +68 -58
  19. package/dist/dts/status-bar/index.d.ts +5 -0
  20. package/dist/dts/status-bar/index.d.ts.map +1 -0
  21. package/dist/dts/status-bar/resolve-status-bar-panels.d.ts +43 -0
  22. package/dist/dts/status-bar/resolve-status-bar-panels.d.ts.map +1 -0
  23. package/dist/dts/status-bar/status-bar.d.ts +439 -0
  24. package/dist/dts/status-bar/status-bar.d.ts.map +1 -0
  25. package/dist/dts/status-bar/status-bar.styles.d.ts +6 -0
  26. package/dist/dts/status-bar/status-bar.styles.d.ts.map +1 -0
  27. package/dist/dts/status-bar/status-bar.template.d.ts +12 -0
  28. package/dist/dts/status-bar/status-bar.template.d.ts.map +1 -0
  29. package/dist/esm/column-selection/column-selection.js +25 -4
  30. package/dist/esm/column-selection/column-selection.styles.js +218 -11
  31. package/dist/esm/column-selection/column-selection.template.js +9 -3
  32. package/dist/esm/datasource/base.datasource.js +3 -3
  33. package/dist/esm/grid-components.js +2 -0
  34. package/dist/esm/grid-pro.js +147 -116
  35. package/dist/esm/grid-pro.styles.js +1 -1
  36. package/dist/esm/grid-pro.template.js +23 -10
  37. package/dist/esm/grid-pro.types.js +2 -3
  38. package/dist/esm/index.js +1 -0
  39. package/dist/esm/status-bar/index.js +4 -0
  40. package/dist/esm/status-bar/resolve-status-bar-panels.js +67 -0
  41. package/dist/esm/status-bar/status-bar.js +171 -0
  42. package/dist/esm/status-bar/status-bar.styles.js +49 -0
  43. package/dist/esm/status-bar/status-bar.template.js +16 -0
  44. package/dist/esm/status-bar-components/row-count.status-bar.js +2 -1
  45. package/dist/grid-pro.api.json +1333 -88
  46. package/dist/grid-pro.d.ts +581 -21
  47. package/dist/react.cjs +46 -39
  48. package/dist/react.mjs +38 -32
  49. package/package.json +12 -12
@@ -0,0 +1,171 @@
1
+ import { __decorate } from "tslib";
2
+ import { LifecycleMixin } from '@genesislcap/foundation-utils';
3
+ import { observable } from '@microsoft/fast-element';
4
+ import { FoundationElement } from '@microsoft/fast-foundation';
5
+ import { GridProStatusBarTypes } from '../grid-pro.types';
6
+ import { LabelValueStatusBarComponent, LoadMoreStatusBarComponent, ReloadStatusBarComponent, RowCountStatusBarComponent, } from '../status-bar-components';
7
+ import { logger } from '../utils/logger';
8
+ import { resolveStatusBarPanels, } from './resolve-status-bar-panels';
9
+ import { statusBarStyles as styles } from './status-bar.styles';
10
+ import { getStatusBarTemplate } from './status-bar.template';
11
+ const PANEL_CTORS = {
12
+ [GridProStatusBarTypes.labelValue]: LabelValueStatusBarComponent,
13
+ [GridProStatusBarTypes.loadMore]: LoadMoreStatusBarComponent,
14
+ [GridProStatusBarTypes.reload]: ReloadStatusBarComponent,
15
+ [GridProStatusBarTypes.rowCount]: RowCountStatusBarComponent,
16
+ };
17
+ /**
18
+ * Status bar under the grid. Mounts the existing `IStatusPanelComp` panels.
19
+ *
20
+ * @public
21
+ * @remarks
22
+ * HTML Element: \<%%prefix%%-grid-pro-status-bar\>
23
+ *
24
+ * @tagname %%prefix%%-grid-pro-status-bar
25
+ */
26
+ export class GridProStatusBar extends LifecycleMixin(FoundationElement) {
27
+ constructor() {
28
+ super(...arguments);
29
+ /** Grid Pro host that owns the api, datasource, and `statusBarConfig`. */
30
+ this.gridHost = null;
31
+ /** Optional explicit AG grid API (v36). Falls back to `gridHost.gridApi` when present. */
32
+ this.gridApi = null;
33
+ /**
34
+ * Panel config. Grid Pro binds its own `statusBarConfig` here.
35
+ * When unset, `gridHost.statusBarConfig` is used.
36
+ */
37
+ this.statusBarConfig = null;
38
+ this.panels = new Map();
39
+ this.warnedPanelTypes = new Set();
40
+ }
41
+ gridHostChanged() {
42
+ this.syncPanels();
43
+ }
44
+ gridApiChanged() {
45
+ this.syncPanels();
46
+ }
47
+ statusBarConfigChanged() {
48
+ this.syncPanels();
49
+ }
50
+ leftElChanged() {
51
+ this.syncPanels();
52
+ }
53
+ rightElChanged() {
54
+ this.syncPanels();
55
+ }
56
+ /**
57
+ * Rebuilds the mounted panels from the current host / api / config.
58
+ * @public
59
+ */
60
+ syncPanels() {
61
+ var _a;
62
+ if (!this.leftEl || !this.rightEl) {
63
+ return;
64
+ }
65
+ this.releasePanels();
66
+ const host = this.gridHost;
67
+ const api = this.resolveApi();
68
+ if (!(host === null || host === void 0 ? void 0 : host.withStatusBar) || !api) {
69
+ return;
70
+ }
71
+ const defs = resolveStatusBarPanels({
72
+ withStatusBar: host.withStatusBar,
73
+ statusBarConfig: (_a = this.statusBarConfig) !== null && _a !== void 0 ? _a : host.statusBarConfig,
74
+ isServerSide: host.isServerSide,
75
+ isInfiniteRowModel: host.isInfiniteRowModel,
76
+ gridProDatasource: host.gridProDatasource,
77
+ });
78
+ for (const def of defs) {
79
+ this.mountPanel(def, api);
80
+ }
81
+ }
82
+ /**
83
+ * Returns a mounted panel by type.
84
+ * @public
85
+ */
86
+ getStatusPanel(key) {
87
+ return this.panels.get(key);
88
+ }
89
+ /**
90
+ * Destroys the mounted panels. Call before the grid api is destroyed.
91
+ * @internal
92
+ */
93
+ releasePanels() {
94
+ var _a, _b, _c, _d, _e;
95
+ for (const panel of this.panels.values()) {
96
+ (_a = panel.destroy) === null || _a === void 0 ? void 0 : _a.call(panel);
97
+ (_c = (_b = panel.getGui) === null || _b === void 0 ? void 0 : _b.call(panel)) === null || _c === void 0 ? void 0 : _c.remove();
98
+ }
99
+ this.panels.clear();
100
+ (_d = this.leftEl) === null || _d === void 0 ? void 0 : _d.replaceChildren();
101
+ (_e = this.rightEl) === null || _e === void 0 ? void 0 : _e.replaceChildren();
102
+ }
103
+ connectedCallback() {
104
+ super.connectedCallback();
105
+ if (!this.panels.size) {
106
+ this.syncPanels();
107
+ }
108
+ }
109
+ disconnectedCallback() {
110
+ super.disconnectedCallback();
111
+ // foundation-layout moves the grid without tearing it down; keep the panels for the reconnect.
112
+ if (!this.shouldRunDisconnect) {
113
+ queueMicrotask(() => {
114
+ if (!this.isConnected) {
115
+ this.releasePanels();
116
+ }
117
+ });
118
+ return;
119
+ }
120
+ this.releasePanels();
121
+ }
122
+ resolveApi() {
123
+ var _a, _b, _c;
124
+ return (_c = (_a = this.gridApi) !== null && _a !== void 0 ? _a : (_b = this.gridHost) === null || _b === void 0 ? void 0 : _b.gridApi) !== null && _c !== void 0 ? _c : null;
125
+ }
126
+ mountPanel(def, api) {
127
+ var _a, _b;
128
+ const Ctor = PANEL_CTORS[def.statusPanel];
129
+ if (!Ctor) {
130
+ if (!this.warnedPanelTypes.has(def.statusPanel)) {
131
+ this.warnedPanelTypes.add(def.statusPanel);
132
+ logger.warn(`Grid Pro status bar: no panel for type '${def.statusPanel}', skipping it`);
133
+ }
134
+ return;
135
+ }
136
+ const panel = new Ctor();
137
+ const params = Object.assign(Object.assign({ api, context: {} }, def.statusPanelParams), (_b = (_a = this.gridHost) === null || _a === void 0 ? void 0 : _a.getStatusPanelState) === null || _b === void 0 ? void 0 : _b.call(_a, def.statusPanel));
138
+ panel.init(params);
139
+ const gui = panel.getGui();
140
+ const target = def.align === 'right' ? this.rightEl : this.leftEl;
141
+ target.appendChild(gui);
142
+ this.panels.set(def.statusPanel, panel);
143
+ }
144
+ }
145
+ __decorate([
146
+ observable
147
+ ], GridProStatusBar.prototype, "gridHost", void 0);
148
+ __decorate([
149
+ observable
150
+ ], GridProStatusBar.prototype, "gridApi", void 0);
151
+ __decorate([
152
+ observable
153
+ ], GridProStatusBar.prototype, "statusBarConfig", void 0);
154
+ __decorate([
155
+ observable
156
+ ], GridProStatusBar.prototype, "leftEl", void 0);
157
+ __decorate([
158
+ observable
159
+ ], GridProStatusBar.prototype, "rightEl", void 0);
160
+ /**
161
+ * Foundation Grid Pro Status Bar registration.
162
+ *
163
+ * @public
164
+ * @remarks
165
+ * HTML Element: \<foundation-grid-pro-status-bar\>
166
+ */
167
+ export const foundationGridProStatusBar = GridProStatusBar.compose({
168
+ baseName: 'grid-pro-status-bar',
169
+ template: getStatusBarTemplate(),
170
+ styles,
171
+ });
@@ -0,0 +1,49 @@
1
+ import { css } from '@microsoft/fast-element';
2
+ /**
3
+ * Status-bar host styles. Tokens follow the grid so the bar matches.
4
+ * @public
5
+ */
6
+ export const statusBarStyles = css `
7
+ :host {
8
+ display: flex;
9
+ flex: 0 0 auto;
10
+ align-self: stretch;
11
+ width: 100%;
12
+ box-sizing: border-box;
13
+ }
14
+
15
+ .ag-status-bar {
16
+ display: flex;
17
+ align-items: center;
18
+ justify-content: space-between;
19
+ gap: calc(var(--ag-grid-size, 4px) * 2);
20
+ box-sizing: border-box;
21
+ width: 100%;
22
+ height: var(--ag-status-bar-height, 32.5px);
23
+ padding: 0 calc(var(--ag-grid-size, 4px) * 2);
24
+ background: var(
25
+ --ag-status-bar-background-color,
26
+ var(--ag-header-background-color, var(--neutral-layer-2))
27
+ );
28
+ border-block-start: 1px solid
29
+ var(--ag-border-color, var(--neutral-stroke-divider-rest, var(--neutral-stroke-rest)));
30
+ color: var(--ag-foreground-color, var(--neutral-foreground-rest));
31
+ font-size: var(--ag-data-font-size, var(--type-ramp-minus-1-font-size));
32
+ }
33
+
34
+ .ag-status-bar-left,
35
+ .ag-status-bar-right {
36
+ display: flex;
37
+ align-items: center;
38
+ min-width: 0;
39
+ gap: calc(var(--ag-grid-size, 4px) * 2);
40
+ }
41
+
42
+ .ag-status-bar-right {
43
+ margin-inline-start: auto;
44
+ }
45
+
46
+ .ag-status-name-value {
47
+ padding-block: var(--ag-grid-size, 4px);
48
+ }
49
+ `;
@@ -0,0 +1,16 @@
1
+ import { html, ref } from '@microsoft/fast-element';
2
+ /**
3
+ * Community status-bar layout: left-aligned info panels, right-aligned actions.
4
+ * @public
5
+ */
6
+ export const getStatusBarTemplate = () => html `
7
+ <div class="ag-status-bar" part="status-bar" data-test-id="grid-pro-status-bar">
8
+ <div class="ag-status-bar-left" part="status-bar-left" ${ref('leftEl')}></div>
9
+ <div class="ag-status-bar-right" part="status-bar-right" ${ref('rightEl')}></div>
10
+ </div>
11
+ `;
12
+ /**
13
+ * Default status bar template.
14
+ * @public
15
+ */
16
+ export const statusBarTemplate = getStatusBarTemplate();
@@ -48,7 +48,8 @@ export class RowCountStatusBarComponent {
48
48
  return this.element;
49
49
  }
50
50
  destroy() {
51
- if (this.api && this.modelUpdatedHandler) {
51
+ var _a, _b;
52
+ if (this.api && this.modelUpdatedHandler && !((_b = (_a = this.api).isDestroyed) === null || _b === void 0 ? void 0 : _b.call(_a))) {
52
53
  this.api.removeEventListener('modelUpdated', this.modelUpdatedHandler);
53
54
  this.api.removeEventListener('rowDataUpdated', this.modelUpdatedHandler);
54
55
  }