@adaptabletools/adaptable 24.0.0-canary.6 → 24.0.0-canary.8

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 (85) hide show
  1. package/index.css +36 -173
  2. package/package.json +1 -1
  3. package/src/AdaptableOptions/DefaultAdaptableOptions.js +6 -0
  4. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +83 -4
  5. package/src/AdaptableState/StyledColumns/GradientStyle.d.ts +4 -0
  6. package/src/Api/Implementation/QuickSearchApiImpl.js +2 -2
  7. package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +0 -1
  8. package/src/Api/Implementation/UserInterfaceApiImpl.js +9 -15
  9. package/src/Api/Internal/AdaptableInternalApi.js +5 -3
  10. package/src/Api/Internal/StateInternalApi.js +4 -3
  11. package/src/Api/UserInterfaceApi.d.ts +0 -4
  12. package/src/Redux/ActionsReducers/QuickSearchRedux.d.ts +9 -0
  13. package/src/Redux/ActionsReducers/QuickSearchRedux.js +9 -0
  14. package/src/Redux/Store/AdaptableStore.js +4 -2
  15. package/src/Utilities/Helpers/UIHelper.d.ts +6 -11
  16. package/src/Utilities/Helpers/UIHelper.js +6 -33
  17. package/src/View/Components/Popups/AdaptablePopup/Navigation.js +9 -11
  18. package/src/View/Components/StyleComponent.js +2 -2
  19. package/src/View/Dashboard/Dashboard.d.ts +1 -1
  20. package/src/View/Dashboard/Dashboard.js +1 -1
  21. package/src/View/Filter/ColumnFilter/ColumnFilterNew.js +14 -9
  22. package/src/View/QuickSearch/QuickSearchInput.js +1 -1
  23. package/src/View/QuickSearch/QuickSearchPopup.d.ts +1 -1
  24. package/src/View/QuickSearch/QuickSearchPopup.js +1 -1
  25. package/src/View/QuickSearch/Utilities/useQuickSearchDebounced.d.ts +2 -2
  26. package/src/View/StyledColumn/RangesComponent.js +8 -11
  27. package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.d.ts +0 -2
  28. package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.js +2 -2
  29. package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +2 -3
  30. package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.d.ts +0 -3
  31. package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.js +3 -3
  32. package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +7 -11
  33. package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.js +4 -4
  34. package/src/View/StyledColumn/Wizard/StyledColumnWizardGradientSection.js +2 -2
  35. package/src/View/StyledColumn/Wizard/StyledColumnWizardIconSection.js +2 -2
  36. package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.js +7 -7
  37. package/src/View/StyledColumn/Wizard/StyledColumnWizardRatingSection.js +4 -4
  38. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.js +3 -3
  39. package/src/components/ColorField/index.d.ts +13 -0
  40. package/src/components/ColorField/index.js +26 -0
  41. package/src/components/aql/QueryBuilder/GroupEditor.js +1 -1
  42. package/src/components/aql/QueryBuilder/QueryBuilder.d.ts +5 -0
  43. package/src/components/aql/QueryBuilder/QueryBuilder.js +1 -1
  44. package/src/components/aql/QueryBuilder/context.d.ts +7 -0
  45. package/src/components/aql/QueryBuilder/context.js +3 -1
  46. package/src/env.js +2 -2
  47. package/src/migration/VersionUpgrade24.d.ts +9 -0
  48. package/src/migration/VersionUpgrade24.js +27 -0
  49. package/src/setupDevTools.js +163 -9
  50. package/src/types.d.ts +1 -1
  51. package/tsconfig.esm.tsbuildinfo +1 -1
  52. package/vendor/components/ColorField/index.d.ts +53 -0
  53. package/vendor/components/ColorField/index.d.ts.map +1 -0
  54. package/vendor/components/ColorField/index.js +80 -0
  55. package/vendor/components/ColorField/index.js.map +1 -0
  56. package/vendor/components/ColorPicker/colorPickerTab.d.ts +2 -2
  57. package/vendor/components/ColorPicker/colorPickerTab.d.ts.map +1 -1
  58. package/vendor/components/ColorPicker/colorPickerTab.js +6 -28
  59. package/vendor/components/ColorPicker/colorPickerTab.js.map +1 -1
  60. package/vendor/components/ColorPicker/index.d.ts +76 -9
  61. package/vendor/components/ColorPicker/index.d.ts.map +1 -1
  62. package/vendor/components/ColorPicker/index.js +217 -27
  63. package/vendor/components/ColorPicker/index.js.map +1 -1
  64. package/vendor/components/ColorPicker/themeColors.d.ts +74 -4
  65. package/vendor/components/ColorPicker/themeColors.d.ts.map +1 -1
  66. package/vendor/components/ColorPicker/themeColors.js +206 -18
  67. package/vendor/components/ColorPicker/themeColors.js.map +1 -1
  68. package/vendor/components/NumberInput/index.d.ts +51 -0
  69. package/vendor/components/NumberInput/index.d.ts.map +1 -0
  70. package/vendor/components/NumberInput/index.js +82 -0
  71. package/vendor/components/NumberInput/index.js.map +1 -0
  72. package/vendor/components/index.css +73 -24
  73. package/vendor/components/index.d.ts +6 -2
  74. package/vendor/components/index.d.ts.map +1 -1
  75. package/vendor/components/index.js +3 -1
  76. package/vendor/components/index.js.map +1 -1
  77. package/vendor/components/ui/input-group.d.ts.map +1 -1
  78. package/vendor/components/ui/input-group.js +5 -4
  79. package/vendor/components/ui/input-group.js.map +1 -1
  80. package/src/components/ColorPicker/ColorPicker.d.ts +0 -12
  81. package/src/components/ColorPicker/ColorPicker.js +0 -48
  82. package/src/components/ColorPicker/OptionalColorPicker.d.ts +0 -12
  83. package/src/components/ColorPicker/OptionalColorPicker.js +0 -13
  84. package/src/components/ColorPicker/index.d.ts +0 -2
  85. package/src/components/ColorPicker/index.js +0 -2
@@ -4,6 +4,7 @@ import { resolveVisibleSettingsPanelNavigationGroups } from './Utilities/Helpers
4
4
  import { isTransientReduxAction } from './Redux/Store/isTransientReduxAction';
5
5
  import { isPivotLayout } from './Utilities/Helpers/Layouts/LayoutHelper';
6
6
  import { debug } from '@infinite-table/infinite-react';
7
+ import { colorSchemeDark, colorSchemeLight, themeQuartz } from 'ag-grid-enterprise';
7
8
  import { warnOnce } from './agGrid/AdaptableLogger';
8
9
  let DEV_TOOLS_LISTENING_STARTED = false;
9
10
  let DEV_TOOLS_READY = false;
@@ -204,39 +205,192 @@ function handleOpenSettingsPanelMessage(payload) {
204
205
  console.warn(error.message);
205
206
  }
206
207
  }
207
- function applyThemeToDocumentElement(payload) {
208
- const style = document.documentElement.style;
208
+ const THEME_PREVIEW_ATTR = 'data-ab-devtools-theme-preview';
209
+ function clearInlineAbVars(el) {
210
+ const style = el.style;
209
211
  for (let i = style.length - 1; i >= 0; i--) {
210
212
  const prop = style[i];
211
- if (prop.startsWith('--ab-')) {
213
+ if (prop?.startsWith('--ab-') && !prop.startsWith('--ab-qs-')) {
212
214
  style.removeProperty(prop);
213
215
  }
214
216
  }
217
+ }
218
+ let themeAliasMaps = null;
219
+ let themeAliasSheetCount = -1;
220
+ function collectThemeAliases() {
221
+ const sheetCount = document.styleSheets.length;
222
+ if (themeAliasMaps && themeAliasSheetCount === sheetCount) {
223
+ return themeAliasMaps;
224
+ }
225
+ const root = new Map();
226
+ const dark = new Map();
227
+ const visit = (rules) => {
228
+ for (let index = 0; index < rules.length; index++) {
229
+ const rule = rules[index];
230
+ const group = rule;
231
+ if (group.cssRules) {
232
+ visit(group.cssRules);
233
+ }
234
+ const styleRule = rule;
235
+ if (!styleRule.style || !styleRule.selectorText) {
236
+ continue;
237
+ }
238
+ const selector = styleRule.selectorText;
239
+ const isDark = selector.includes('ab--theme-dark');
240
+ const isRoot = selector.includes(':root') ||
241
+ selector.includes('ab--theme-light') ||
242
+ /(^|[^\w-])html([^\w-]|$)/.test(selector);
243
+ if (!isDark && !isRoot) {
244
+ continue;
245
+ }
246
+ const target = isDark ? dark : root;
247
+ for (let i = 0; i < styleRule.style.length; i++) {
248
+ const prop = styleRule.style[i];
249
+ if (!prop?.startsWith('--')) {
250
+ continue;
251
+ }
252
+ const value = styleRule.style.getPropertyValue(prop).trim();
253
+ if (value.includes('var(')) {
254
+ target.set(prop, value);
255
+ }
256
+ }
257
+ }
258
+ };
259
+ for (let index = 0; index < document.styleSheets.length; index++) {
260
+ const sheet = document.styleSheets[index];
261
+ try {
262
+ visit(sheet.cssRules);
263
+ }
264
+ catch {
265
+ }
266
+ }
267
+ themeAliasMaps = { root, dark };
268
+ themeAliasSheetCount = sheetCount;
269
+ return themeAliasMaps;
270
+ }
271
+ let darkThemeProbe = null;
272
+ function themeDefaultStyle(variant) {
273
+ if (variant === 'light') {
274
+ return getComputedStyle(document.documentElement);
275
+ }
276
+ if (!darkThemeProbe) {
277
+ darkThemeProbe = document.createElement('div');
278
+ darkThemeProbe.className = 'ab--theme-dark';
279
+ darkThemeProbe.setAttribute('data-ab-devtools-theme-probe', '');
280
+ darkThemeProbe.style.cssText =
281
+ 'position:absolute;width:0;height:0;overflow:hidden;pointer-events:none';
282
+ document.body.appendChild(darkThemeProbe);
283
+ }
284
+ return getComputedStyle(darkThemeProbe);
285
+ }
286
+ function installLiveAliases(el, variant) {
287
+ const { root, dark } = collectThemeAliases();
288
+ const defaults = themeDefaultStyle(variant);
289
+ const aliases = variant === 'dark' ? new Map([...root, ...dark]) : root;
290
+ for (const [name, raw] of aliases) {
291
+ const inline = el.style.getPropertyValue(name).trim();
292
+ const fallback = defaults.getPropertyValue(name).trim();
293
+ if (!inline || inline === raw || inline === fallback) {
294
+ el.style.setProperty(name, raw);
295
+ }
296
+ }
297
+ }
298
+ function clearDocumentThemePreview() {
299
+ clearInlineAbVars(document.documentElement);
300
+ }
301
+ function getInstanceThemeElements(adaptableId) {
302
+ const instance = getRegistration(adaptableId)?.instance;
303
+ if (!instance) {
304
+ return [];
305
+ }
306
+ const elements = [
307
+ instance.getAdaptableContainerElement(),
308
+ instance.getAgGridContainerElement(),
309
+ ].filter((el) => el instanceof HTMLElement);
310
+ return [...new Set(elements)];
311
+ }
312
+ const originalAgGridThemes = new Map();
313
+ function applyAgGridPreviewTheme(adaptableId, variant) {
314
+ const instance = getRegistration(adaptableId)?.instance;
315
+ const gridApi = instance?.agGridAdapter.getAgGridApi();
316
+ if (!instance || instance.isDestroyed || !gridApi || gridApi.isDestroyed()) {
317
+ return;
318
+ }
319
+ if (instance.agGridThemeAdapter.getAgGridThemeMode() === 'legacy') {
320
+ return;
321
+ }
322
+ if (!originalAgGridThemes.has(adaptableId)) {
323
+ originalAgGridThemes.set(adaptableId, gridApi.getGridOption('theme'));
324
+ }
325
+ const original = originalAgGridThemes.get(adaptableId);
326
+ const base = original && original !== 'legacy' && typeof original.withPart === 'function'
327
+ ? original
328
+ : themeQuartz;
329
+ gridApi.setGridOption('theme', base.withPart(variant === 'dark' ? colorSchemeDark : colorSchemeLight));
330
+ }
331
+ function syncAgGridPreviewThemes(activeId, variant) {
332
+ applyAgGridPreviewTheme(activeId, variant);
333
+ }
334
+ function applyThemeVars(el, payload) {
335
+ clearInlineAbVars(el);
215
336
  for (const [name, value] of Object.entries(payload.light)) {
216
337
  if (value != null && value !== '') {
217
- style.setProperty(name, String(value));
338
+ el.style.setProperty(name, String(value));
218
339
  }
219
340
  }
220
341
  if (payload.variant === 'dark') {
221
342
  for (const [name, value] of Object.entries(payload.dark)) {
222
343
  if (value != null && value !== '') {
223
- style.setProperty(name, String(value));
344
+ el.style.setProperty(name, String(value));
224
345
  }
225
346
  }
347
+ el.classList.add('ab--theme-dark');
226
348
  }
349
+ else if (el.getAttribute(THEME_PREVIEW_ATTR) === 'dark') {
350
+ el.classList.remove('ab--theme-dark');
351
+ }
352
+ el.setAttribute(THEME_PREVIEW_ATTR, payload.variant);
353
+ installLiveAliases(el, payload.variant);
227
354
  }
228
355
  function handleThemeVarChangeMessage(payload) {
229
- const { name, value } = payload ?? {};
230
- if (!name) {
356
+ const { name, value, adaptableId } = payload ?? {};
357
+ if (!name || !adaptableId) {
231
358
  return;
232
359
  }
233
- document.documentElement.style.setProperty(name, String(value ?? ''));
360
+ const targets = getInstanceThemeElements(adaptableId);
361
+ if (targets.length === 0) {
362
+ console.warn(`Adaptable DevTools: no theme container for "${adaptableId}"`);
363
+ return;
364
+ }
365
+ const variant = payload.variant === 'dark' ? 'dark' : 'light';
366
+ clearDocumentThemePreview();
367
+ for (const el of targets) {
368
+ if (!el.hasAttribute(THEME_PREVIEW_ATTR)) {
369
+ el.setAttribute(THEME_PREVIEW_ATTR, variant);
370
+ }
371
+ installLiveAliases(el, variant);
372
+ el.style.setProperty(name, String(value ?? ''));
373
+ }
234
374
  }
235
375
  function handleApplyThemeMessage(payload) {
236
376
  if (!payload || (payload.variant !== 'light' && payload.variant !== 'dark')) {
237
377
  return;
238
378
  }
239
- applyThemeToDocumentElement(payload);
379
+ const { adaptableId } = payload;
380
+ if (!adaptableId) {
381
+ console.warn('Adaptable DevTools: apply-theme message missing adaptableId');
382
+ return;
383
+ }
384
+ const targets = getInstanceThemeElements(adaptableId);
385
+ if (targets.length === 0) {
386
+ console.warn(`Adaptable DevTools: no theme container for "${adaptableId}"`);
387
+ return;
388
+ }
389
+ clearDocumentThemePreview();
390
+ for (const el of targets) {
391
+ applyThemeVars(el, payload);
392
+ }
393
+ syncAgGridPreviewThemes(adaptableId, payload.variant);
240
394
  }
241
395
  function handleLoadVariantMessage(payload) {
242
396
  const { adaptableId, variant } = payload ?? {};
package/src/types.d.ts CHANGED
@@ -49,7 +49,7 @@ export type { BaseState } from './AdaptableState/BaseState';
49
49
  export type { AdaptableNote, NoteState, AdaptableNotes } from './AdaptableState/NoteState';
50
50
  export type { TeamSharingOptions, SharedEntitiesContext, } from './AdaptableOptions/TeamSharingOptions';
51
51
  export type { ToolPanelOptions, CustomToolPanel, ToolPanelButtonContext, CustomToolPanelButtonContext, } from './AdaptableOptions/ToolPanelOptions';
52
- export type { UserInterfaceOptions, LoadingScreenOptions, ObjectTagsContext, CustomIcon, } from './AdaptableOptions/UserInterfaceOptions';
52
+ export type { UserInterfaceOptions, LoadingScreenOptions, ColourPickerOptions, ColourPickerTab, ColourPickerColour, ColourPickerFilterContext, ColourPickerFilterResult, ObjectTagsContext, CustomIcon, } from './AdaptableOptions/UserInterfaceOptions';
53
53
  export type { ContextMenuOptions, AdaptableSystemContextMenuItem, CustomContextMenuContext, CustomContextMenuItem, UserContextMenuItem, AgGridContextMenuItemType, DefaultAdaptableMenuStructure, DefaultAgGridMenuStructure, CustomGroupContextMenuItem, } from './AdaptableOptions/ContextMenuOptions';
54
54
  export type { ColumnMenuOptions, CustomColumnMenuContext, CustomColumnMenuItem, UserColumnMenuItem, AdaptableSystemColumnMenuItem, AgGridColumnMenuItemType, CustomGroupColumnMenuItem, } from './AdaptableOptions/ColumnMenuOptions';
55
55
  export type { CustomSettingsPanel, SettingsPanelOptions, SettingsPanelDisplayOptions, SettingsPanelNavigation, SettingsPanelNavigationGroup, SettingsPanelNavigationContext, SettingsPanelNavigationConfigurer, LegacyFlatSettingsPanelNavigation, PopupType, } from './AdaptableOptions/SettingsPanelOptions';