@genesislcap/grid-pro 15.17.0 → 15.18.0-FUI-2601.3

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 (59) hide show
  1. package/dist/custom-elements.json +9111 -7238
  2. package/dist/dts/columns-tool-panel/columns-tool-panel-ag-drag.d.ts +12 -0
  3. package/dist/dts/columns-tool-panel/columns-tool-panel-ag-drag.d.ts.map +1 -0
  4. package/dist/dts/columns-tool-panel/columns-tool-panel.d.ts +150 -0
  5. package/dist/dts/columns-tool-panel/columns-tool-panel.d.ts.map +1 -0
  6. package/dist/dts/columns-tool-panel/columns-tool-panel.styles.d.ts +9 -0
  7. package/dist/dts/columns-tool-panel/columns-tool-panel.styles.d.ts.map +1 -0
  8. package/dist/dts/columns-tool-panel/columns-tool-panel.template.d.ts +12 -0
  9. package/dist/dts/columns-tool-panel/columns-tool-panel.template.d.ts.map +1 -0
  10. package/dist/dts/columns-tool-panel/columns-tool-panel.utils.d.ts +48 -0
  11. package/dist/dts/columns-tool-panel/columns-tool-panel.utils.d.ts.map +1 -0
  12. package/dist/dts/columns-tool-panel/grid-pro-column-drag-bridge.d.ts +39 -0
  13. package/dist/dts/columns-tool-panel/grid-pro-column-drag-bridge.d.ts.map +1 -0
  14. package/dist/dts/columns-tool-panel/index.d.ts +5 -0
  15. package/dist/dts/columns-tool-panel/index.d.ts.map +1 -0
  16. package/dist/dts/grid-pro-beta.d.ts +28 -3
  17. package/dist/dts/grid-pro-beta.d.ts.map +1 -1
  18. package/dist/dts/grid-pro.styles.d.ts.map +1 -1
  19. package/dist/dts/grid-pro.template.d.ts.map +1 -1
  20. package/dist/dts/grid-pro.types.d.ts +10 -0
  21. package/dist/dts/grid-pro.types.d.ts.map +1 -1
  22. package/dist/dts/index.d.ts +2 -0
  23. package/dist/dts/index.d.ts.map +1 -1
  24. package/dist/dts/react.d.ts +29 -9
  25. package/dist/dts/side-bar/index.d.ts +6 -0
  26. package/dist/dts/side-bar/index.d.ts.map +1 -0
  27. package/dist/dts/side-bar/side-bar.d.ts +417 -0
  28. package/dist/dts/side-bar/side-bar.d.ts.map +1 -0
  29. package/dist/dts/side-bar/side-bar.styles.d.ts +19 -0
  30. package/dist/dts/side-bar/side-bar.styles.d.ts.map +1 -0
  31. package/dist/dts/side-bar/side-bar.template.d.ts +11 -0
  32. package/dist/dts/side-bar/side-bar.template.d.ts.map +1 -0
  33. package/dist/dts/side-bar/side-bar.tools.d.ts +12 -0
  34. package/dist/dts/side-bar/side-bar.tools.d.ts.map +1 -0
  35. package/dist/dts/side-bar/side-bar.types.d.ts +77 -0
  36. package/dist/dts/side-bar/side-bar.types.d.ts.map +1 -0
  37. package/dist/esm/columns-tool-panel/columns-tool-panel-ag-drag.js +50 -0
  38. package/dist/esm/columns-tool-panel/columns-tool-panel.js +500 -0
  39. package/dist/esm/columns-tool-panel/columns-tool-panel.styles.js +180 -0
  40. package/dist/esm/columns-tool-panel/columns-tool-panel.template.js +70 -0
  41. package/dist/esm/columns-tool-panel/columns-tool-panel.utils.js +185 -0
  42. package/dist/esm/columns-tool-panel/grid-pro-column-drag-bridge.js +57 -0
  43. package/dist/esm/columns-tool-panel/index.js +4 -0
  44. package/dist/esm/grid-pro-beta.js +93 -3
  45. package/dist/esm/grid-pro.styles.js +4 -0
  46. package/dist/esm/grid-pro.template.js +19 -2
  47. package/dist/esm/grid-pro.types.js +11 -0
  48. package/dist/esm/index.js +2 -0
  49. package/dist/esm/side-bar/index.js +5 -0
  50. package/dist/esm/side-bar/side-bar.js +188 -0
  51. package/dist/esm/side-bar/side-bar.styles.js +155 -0
  52. package/dist/esm/side-bar/side-bar.template.js +48 -0
  53. package/dist/esm/side-bar/side-bar.tools.js +19 -0
  54. package/dist/esm/side-bar/side-bar.types.js +45 -0
  55. package/dist/grid-pro.api.json +10626 -7663
  56. package/dist/grid-pro.d.ts +968 -153
  57. package/dist/react.cjs +20 -6
  58. package/dist/react.mjs +17 -5
  59. package/package.json +14 -14
@@ -0,0 +1,188 @@
1
+ import { __decorate } from "tslib";
2
+ import { insertDocumentCSSRule, LifecycleMixin } from '@genesislcap/foundation-utils';
3
+ import { attr, customElement, observable } from '@microsoft/fast-element';
4
+ import { FoundationElement } from '@microsoft/fast-foundation';
5
+ import { agGridAlpineFontFace } from '../external/fonts';
6
+ import { agThemeFontsId } from '../grid-pro.types';
7
+ import { gridProSideBarChromeStyles } from './side-bar.styles';
8
+ import { getGridProSideBarTemplate } from './side-bar.template';
9
+ import { GRID_PRO_DEFAULT_SIDE_BAR_TOOLS } from './side-bar.tools';
10
+ import { GridProSideBarTool, initLocalSideBarPanel, } from './side-bar.types';
11
+ /**
12
+ * The Grid Pro Side Bar element.
13
+ * @remarks No shadow root — chrome stays in Grid Pro's tree so host CSS still applies.
14
+ * @public
15
+ * @remarks
16
+ * HTML Element: \<grid-pro-side-bar\>
17
+ */
18
+ let GridProSideBar = class GridProSideBar extends LifecycleMixin(FoundationElement) {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.prefix = 'foundation';
22
+ this.tools = GRID_PRO_DEFAULT_SIDE_BAR_TOOLS;
23
+ this.open = false;
24
+ this.activeTool = GridProSideBarTool.columns;
25
+ this.mountedPanels = new Map();
26
+ }
27
+ prefixChanged() {
28
+ if (this.$fastController) {
29
+ this.$fastController.template = getGridProSideBarTemplate(this.prefix || 'foundation');
30
+ }
31
+ }
32
+ toolsChanged() {
33
+ var _a, _b, _c, _d;
34
+ if (!((_a = this.tools) === null || _a === void 0 ? void 0 : _a.some((t) => t.id === this.activeTool))) {
35
+ this.activeTool = (_d = (_c = (_b = this.tools) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : GridProSideBarTool.columns;
36
+ }
37
+ this.mountActiveTool();
38
+ }
39
+ gridApiChanged() {
40
+ this.mountActiveTool();
41
+ }
42
+ columnDragBridgeChanged() {
43
+ this.refreshMountedLocalPanels();
44
+ }
45
+ panelHostChanged() {
46
+ this.mountActiveTool();
47
+ }
48
+ getToolPanelParams(def) {
49
+ var _a, _b;
50
+ return Object.assign(Object.assign({ api: this.gridApi, context: (_b = (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getGridOption) === null || _b === void 0 ? void 0 : _b.call(_a, 'context') }, def.toolPanelParams), { columnDragBridge: this.columnDragBridge });
51
+ }
52
+ refreshMountedLocalPanels() {
53
+ var _a, _b, _c;
54
+ if (!this.gridApi) {
55
+ return;
56
+ }
57
+ for (const [defId, mounted] of this.mountedPanels) {
58
+ const def = (_a = this.tools) === null || _a === void 0 ? void 0 : _a.find((t) => t.id === defId);
59
+ if (def === null || def === void 0 ? void 0 : def.createPanel) {
60
+ (_c = (_b = mounted.panel).refresh) === null || _c === void 0 ? void 0 : _c.call(_b, this.getToolPanelParams(def));
61
+ }
62
+ }
63
+ }
64
+ connectedCallback() {
65
+ super.connectedCallback();
66
+ insertDocumentCSSRule(agGridAlpineFontFace, agThemeFontsId('alpine'));
67
+ }
68
+ disconnectedCallback() {
69
+ this.destroyTools();
70
+ super.disconnectedCallback();
71
+ }
72
+ /**
73
+ * Selects a tool. Clicking the active open tool collapses the panel.
74
+ * @public
75
+ */
76
+ selectTool(tool) {
77
+ var _a;
78
+ if (!((_a = this.tools) === null || _a === void 0 ? void 0 : _a.some((t) => t.id === tool))) {
79
+ return;
80
+ }
81
+ if (this.activeTool === tool && this.open) {
82
+ this.open = false;
83
+ this.closeAgToolPanel();
84
+ return;
85
+ }
86
+ this.activeTool = tool;
87
+ this.open = true;
88
+ this.mountActiveTool();
89
+ }
90
+ /**
91
+ * @internal
92
+ */
93
+ handleToolClick(id) {
94
+ this.selectTool(id);
95
+ }
96
+ /**
97
+ * @public
98
+ */
99
+ mountActiveTool() {
100
+ var _a, _b, _c;
101
+ if (!this.gridApi || !this.panelHost) {
102
+ return;
103
+ }
104
+ if (!this.open) {
105
+ this.closeAgToolPanel();
106
+ return;
107
+ }
108
+ const def = (_a = this.tools) === null || _a === void 0 ? void 0 : _a.find((t) => t.id === this.activeTool);
109
+ if (!def) {
110
+ this.panelHost.replaceChildren();
111
+ return;
112
+ }
113
+ if (def.createPanel) {
114
+ this.closeAgToolPanel();
115
+ let mounted = this.mountedPanels.get(def.id);
116
+ if (!mounted) {
117
+ const panel = initLocalSideBarPanel(def.createPanel(), this.getToolPanelParams(def));
118
+ mounted = { defId: def.id, panel };
119
+ this.mountedPanels.set(def.id, mounted);
120
+ }
121
+ const gui = mounted.panel.getGui();
122
+ if (gui instanceof HTMLElement &&
123
+ gui.tagName.toLowerCase() === 'grid-pro-columns-tool-panel') {
124
+ gui.setAttribute('prefix', this.prefix || 'foundation');
125
+ }
126
+ this.panelHost.replaceChildren(gui);
127
+ (_c = (_b = mounted.panel).refresh) === null || _c === void 0 ? void 0 : _c.call(_b, this.getToolPanelParams(def));
128
+ return;
129
+ }
130
+ if (def.toolPanel != null) {
131
+ this.panelHost.replaceChildren();
132
+ if (typeof this.gridApi.openToolPanel === 'function') {
133
+ this.gridApi.openToolPanel(def.id, this.panelHost);
134
+ }
135
+ return;
136
+ }
137
+ this.panelHost.replaceChildren();
138
+ }
139
+ /**
140
+ * @public
141
+ */
142
+ destroyTools() {
143
+ var _a, _b, _c, _d;
144
+ this.closeAgToolPanel();
145
+ for (const mounted of this.mountedPanels.values()) {
146
+ (_a = mounted.destroy) === null || _a === void 0 ? void 0 : _a.call(mounted);
147
+ (_c = (_b = mounted.panel).destroy) === null || _c === void 0 ? void 0 : _c.call(_b);
148
+ }
149
+ this.mountedPanels.clear();
150
+ (_d = this.panelHost) === null || _d === void 0 ? void 0 : _d.replaceChildren();
151
+ }
152
+ closeAgToolPanel() {
153
+ var _a;
154
+ if (typeof ((_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.closeToolPanel) === 'function') {
155
+ this.gridApi.closeToolPanel();
156
+ }
157
+ }
158
+ };
159
+ __decorate([
160
+ attr
161
+ ], GridProSideBar.prototype, "prefix", void 0);
162
+ __decorate([
163
+ observable
164
+ ], GridProSideBar.prototype, "tools", void 0);
165
+ __decorate([
166
+ observable
167
+ ], GridProSideBar.prototype, "gridApi", void 0);
168
+ __decorate([
169
+ observable
170
+ ], GridProSideBar.prototype, "columnDragBridge", void 0);
171
+ __decorate([
172
+ observable
173
+ ], GridProSideBar.prototype, "open", void 0);
174
+ __decorate([
175
+ observable
176
+ ], GridProSideBar.prototype, "activeTool", void 0);
177
+ __decorate([
178
+ observable
179
+ ], GridProSideBar.prototype, "panelHost", void 0);
180
+ GridProSideBar = __decorate([
181
+ customElement({
182
+ name: 'grid-pro-side-bar',
183
+ template: getGridProSideBarTemplate(),
184
+ styles: gridProSideBarChromeStyles,
185
+ shadowOptions: null,
186
+ })
187
+ ], GridProSideBar);
188
+ export { GridProSideBar };
@@ -0,0 +1,155 @@
1
+ import { css } from '@microsoft/fast-element';
2
+ /**
3
+ * Layout on the Grid Pro host when `with-side-bar` is set.
4
+ * @public
5
+ */
6
+ export const gridProSideBarHostStyles = css `
7
+ :host([with-side-bar]) {
8
+ display: flex;
9
+ flex-direction: row;
10
+ min-height: 0;
11
+ }
12
+
13
+ :host([with-side-bar]) [part='grid'] {
14
+ flex: 1 1 auto;
15
+ min-width: 0;
16
+ height: 100%;
17
+ }
18
+ `;
19
+ /**
20
+ * Chrome for {@link GridProSideBar}. Uses class selectors (no `:host`) because the
21
+ * element has no shadow — styles land on Grid Pro's shadow root.
22
+ * @public
23
+ */
24
+ export const gridProSideBarChromeStyles = css `
25
+ .grid-pro-side-bar {
26
+ --ag-icon-font-family: agGridAlpine;
27
+ --ag-icon-size: 16px;
28
+
29
+ display: flex;
30
+ flex-direction: row-reverse;
31
+ flex: 0 0 auto;
32
+ min-height: 0;
33
+ height: 100%;
34
+ z-index: 1;
35
+ border-left: 1px solid var(--neutral-stroke-divider-rest, var(--ag-border-color));
36
+ background: var(--neutral-layer-2, var(--ag-control-panel-background-color));
37
+ color: var(--neutral-foreground-rest, var(--ag-foreground-color));
38
+ }
39
+
40
+ .grid-pro-side-bar-buttons {
41
+ display: flex;
42
+ flex-direction: column;
43
+ flex: 0 0 auto;
44
+ border-left: 1px solid var(--neutral-stroke-divider-rest, var(--ag-border-color));
45
+ }
46
+
47
+ .grid-pro-side-bar-button {
48
+ margin: 0;
49
+ height: auto !important;
50
+ min-height: 0;
51
+ border-bottom: 1px solid var(--neutral-stroke-divider-rest, var(--ag-border-color));
52
+ }
53
+
54
+ .grid-pro-side-bar-button::part(control) {
55
+ display: flex;
56
+ flex-direction: column;
57
+ align-items: center;
58
+ padding: 12px 8px;
59
+ border: 0;
60
+ border-radius: 0;
61
+ min-width: 0;
62
+ min-height: 0;
63
+ height: auto;
64
+ white-space: nowrap;
65
+ }
66
+
67
+ .grid-pro-side-bar-button::part(content) {
68
+ display: flex;
69
+ flex-direction: column;
70
+ align-items: center;
71
+ gap: 4px;
72
+ }
73
+
74
+ .grid-pro-side-bar-button-icon {
75
+ display: block;
76
+ font-family: agGridAlpine;
77
+ font-size: var(--ag-icon-size, 16px);
78
+ line-height: var(--ag-icon-size, 16px);
79
+ font-style: normal;
80
+ font-weight: normal;
81
+ speak: none;
82
+ -webkit-font-smoothing: antialiased;
83
+ -moz-osx-font-smoothing: grayscale;
84
+ }
85
+
86
+ .grid-pro-side-bar-button-icon::before {
87
+ font-family: agGridAlpine;
88
+ background-color: transparent;
89
+ }
90
+
91
+ .grid-pro-side-bar-button-icon.ag-icon-columns::before {
92
+ content: '\\f10a';
93
+ }
94
+
95
+ .grid-pro-side-bar-button-icon.ag-icon-filter::before {
96
+ content: '\\f114';
97
+ }
98
+
99
+ .grid-pro-side-bar-button-icon[hidden] {
100
+ display: none;
101
+ }
102
+
103
+ .grid-pro-side-bar-button-label {
104
+ writing-mode: vertical-rl;
105
+ }
106
+
107
+ .grid-pro-side-bar-button:hover::part(control),
108
+ .grid-pro-side-bar-button[aria-selected='true']::part(control) {
109
+ background: var(--neutral-fill-hover, rgb(255 255 255 / 6%));
110
+ }
111
+
112
+ .grid-pro-side-bar-button:hover::part(content)::before {
113
+ background: transparent;
114
+ }
115
+
116
+ .grid-pro-side-bar-panel {
117
+ display: flex;
118
+ flex-direction: column;
119
+ flex: 0 0 auto;
120
+ width: 260px;
121
+ max-width: 40vw;
122
+ min-height: 0;
123
+ }
124
+
125
+ .grid-pro-side-bar-panel[hidden] {
126
+ display: none;
127
+ }
128
+
129
+ .grid-pro-side-bar-panel-host {
130
+ flex: 1 1 auto;
131
+ min-height: 0;
132
+ overflow: auto;
133
+ }
134
+
135
+ .grid-pro-side-bar-panel-host .ag-filter-toolpanel,
136
+ .grid-pro-side-bar-panel-host .ag-tool-panel-wrapper {
137
+ height: 100%;
138
+ width: 100%;
139
+ }
140
+
141
+ .grid-pro-columns-checkbox {
142
+ margin: 0;
143
+
144
+ --design-unit: 3;
145
+ }
146
+ `;
147
+ /**
148
+ * Host + chrome. Prefer {@link gridProSideBarHostStyles} on Grid Pro and
149
+ * {@link gridProSideBarChromeStyles} on the side-bar element.
150
+ * @public
151
+ */
152
+ export const gridProSideBarStyles = css `
153
+ ${gridProSideBarHostStyles}
154
+ ${gridProSideBarChromeStyles}
155
+ `;
@@ -0,0 +1,48 @@
1
+ import { html, ref, repeat } from '@microsoft/fast-element';
2
+ /**
3
+ * Community side bar chrome. Prefix selects DS buttons (`rapid-button`, `zero-button`).
4
+ * @public
5
+ */
6
+ export const getGridProSideBarTemplate = (prefix = 'foundation') => {
7
+ const buttonTag = `${prefix}-button`;
8
+ return html `
9
+ <template>
10
+ <div class="grid-pro-side-bar-buttons" role="tablist" aria-label="Grid tools">
11
+ ${repeat((x) => x.tools, html `
12
+ <${buttonTag}
13
+ appearance="lightweight"
14
+ role="tab"
15
+ class="grid-pro-side-bar-button"
16
+ data-test-id="${(x) => `grid-pro-side-bar-tool-${x.id}`}"
17
+ aria-selected="${(x, c) => c.parent.open &&
18
+ c.parent.activeTool === x.id}"
19
+ @click="${(x, c) => c.parent.handleToolClick(x.id)}"
20
+ >
21
+ <span
22
+ class="ag-icon grid-pro-side-bar-button-icon ${(x) => x.iconKey ? `ag-icon-${x.iconKey}` : ''}"
23
+ aria-hidden="true"
24
+ ?hidden="${(x) => !x.iconKey}"
25
+ ></span>
26
+ <span class="grid-pro-side-bar-button-label">${(x) => x.label}</span>
27
+ </${buttonTag}>
28
+ `)}
29
+ </div>
30
+ <div
31
+ class="grid-pro-side-bar-panel"
32
+ part="side-bar-panel"
33
+ data-test-id="grid-pro-side-bar-panel"
34
+ ?hidden="${(x) => !x.open}"
35
+ >
36
+ <div
37
+ class="grid-pro-side-bar-panel-host"
38
+ data-test-id="grid-pro-side-bar-panel-host"
39
+ ${ref('panelHost')}
40
+ ></div>
41
+ </div>
42
+ </template>
43
+ `;
44
+ };
45
+ /**
46
+ * @public
47
+ */
48
+ export const gridProSideBarTemplate = getGridProSideBarTemplate();
@@ -0,0 +1,19 @@
1
+ import { ColumnsToolPanel } from '../columns-tool-panel';
2
+ import { GridProSideBarTool } from './side-bar.types';
3
+ /**
4
+ * Built-in Columns picker (Community, no AG SideBarModule).
5
+ * @public
6
+ */
7
+ export const gridProSideBarColumnsTool = {
8
+ id: GridProSideBarTool.columns,
9
+ label: 'Columns',
10
+ iconKey: 'columns',
11
+ createPanel: () => new ColumnsToolPanel(),
12
+ };
13
+ /**
14
+ * Default tools when `with-side-bar` is set and `sideBarTools` is not provided.
15
+ * @public
16
+ */
17
+ export const GRID_PRO_DEFAULT_SIDE_BAR_TOOLS = [
18
+ gridProSideBarColumnsTool,
19
+ ];
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Well-known Community side-bar tool ids.
3
+ * @public
4
+ */
5
+ export const GridProSideBarTool = {
6
+ columns: 'columns',
7
+ filters: 'filters',
8
+ };
9
+ /**
10
+ * Built-in AG Filters tool (Enterprise `FiltersToolPanelModule` required at app register).
11
+ * @public
12
+ */
13
+ export const gridProSideBarFiltersTool = {
14
+ id: GridProSideBarTool.filters,
15
+ label: 'Filters',
16
+ labelKey: 'filters',
17
+ iconKey: 'filter',
18
+ toolPanel: 'agFiltersToolPanel',
19
+ };
20
+ /**
21
+ * Builds a custom tool panel def (AG-style registration into our shell).
22
+ * @public
23
+ */
24
+ export function createGridProSideBarTool(def) {
25
+ return def;
26
+ }
27
+ /**
28
+ * @internal
29
+ */
30
+ export function resolveAgSideBarToolPanels(tools) {
31
+ return tools
32
+ .filter((t) => t.toolPanel != null && !t.createPanel)
33
+ .map((t) => {
34
+ var _a, _b;
35
+ return (Object.assign({ id: t.id, labelKey: (_a = t.labelKey) !== null && _a !== void 0 ? _a : t.id, labelDefault: t.label, iconKey: (_b = t.iconKey) !== null && _b !== void 0 ? _b : t.id, toolPanel: t.toolPanel }, (t.toolPanelParams != null ? { toolPanelParams: t.toolPanelParams } : {})));
36
+ });
37
+ }
38
+ /**
39
+ * @internal
40
+ */
41
+ export function initLocalSideBarPanel(panel, params) {
42
+ var _a;
43
+ (_a = panel.init) === null || _a === void 0 ? void 0 : _a.call(panel, params);
44
+ return panel;
45
+ }