@xh/hoist 74.0.0 → 74.1.1

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 (33) hide show
  1. package/CHANGELOG.md +36 -4
  2. package/build/types/cmp/grouping/GroupingChooserModel.d.ts +8 -4
  3. package/build/types/cmp/viewmanager/ViewInfo.d.ts +7 -3
  4. package/build/types/core/types/Interfaces.d.ts +1 -1
  5. package/build/types/desktop/cmp/grouping/GroupingChooser.d.ts +17 -6
  6. package/build/types/desktop/cmp/panel/Panel.d.ts +1 -1
  7. package/build/types/desktop/cmp/viewmanager/ViewManager.d.ts +26 -10
  8. package/build/types/mobile/cmp/grouping/GroupingChooser.d.ts +2 -6
  9. package/build/types/utils/impl/MenuItems.d.ts +13 -0
  10. package/build/types/utils/impl/index.d.ts +1 -0
  11. package/cmp/grouping/GroupingChooserModel.ts +25 -12
  12. package/cmp/viewmanager/ViewInfo.ts +7 -3
  13. package/core/HoistAppModel.ts +1 -0
  14. package/core/exception/ExceptionHandler.ts +1 -1
  15. package/core/types/Interfaces.ts +2 -2
  16. package/desktop/cmp/button/AppMenuButton.ts +3 -46
  17. package/desktop/cmp/grouping/GroupingChooser.scss +39 -35
  18. package/desktop/cmp/grouping/GroupingChooser.ts +157 -89
  19. package/desktop/cmp/panel/Panel.ts +1 -1
  20. package/desktop/cmp/viewmanager/ViewManager.ts +58 -16
  21. package/desktop/cmp/viewmanager/ViewMenu.ts +9 -2
  22. package/mobile/appcontainer/FeedbackDialog.ts +4 -0
  23. package/mobile/appcontainer/OptionsDialog.ts +3 -1
  24. package/mobile/cmp/grid/impl/ColChooser.ts +3 -2
  25. package/mobile/cmp/grouping/GroupingChooser.scss +41 -20
  26. package/mobile/cmp/grouping/GroupingChooser.ts +60 -89
  27. package/mobile/cmp/panel/DialogPanel.scss +5 -0
  28. package/package.json +1 -1
  29. package/svc/TrackService.ts +4 -3
  30. package/tsconfig.tsbuildinfo +1 -1
  31. package/utils/impl/MenuItems.ts +57 -0
  32. package/utils/impl/index.ts +1 -0
  33. package/utils/js/LangUtils.ts +1 -1
@@ -0,0 +1,57 @@
1
+ import {isMenuItem, MenuItemLike} from '@xh/hoist/core';
2
+ import {menuDivider, menuItem} from '@xh/hoist/kit/blueprint';
3
+ import {MenuItemProps} from '@blueprintjs/core';
4
+ import {wait} from '@xh/hoist/promise';
5
+ import {isOmitted} from '@xh/hoist/utils/impl/IsOmitted';
6
+ import {filterConsecutiveMenuSeparators} from '@xh/hoist/utils/impl/Separators';
7
+ import {clone, isEmpty} from 'lodash';
8
+ import {ReactNode} from 'react';
9
+
10
+ /**
11
+ * Parse MenuItem configs into Blueprint MenuItems.
12
+ *
13
+ * Note this is currently used in a few limited places and is not generally applied to all menu-
14
+ * like components in Hoist. In particular, it is not used by the `menu` component re-exported from
15
+ * Blueprint. See https://github.com/xh/hoist-react/issues/2400 covering TBD work to more fully
16
+ * standardize a Hoist menu component that might then incorporate this processing.
17
+ *
18
+ * @internal
19
+ */
20
+ export function parseMenuItems(items: MenuItemLike[]): ReactNode[] {
21
+ items = items.map(item => {
22
+ if (!isMenuItem(item)) return item;
23
+
24
+ item = clone(item);
25
+ item.items = clone(item.items);
26
+ item.prepareFn?.(item);
27
+ return item;
28
+ });
29
+
30
+ return items
31
+ .filter(it => !isMenuItem(it) || (!it.hidden && !isOmitted(it)))
32
+ .filter(filterConsecutiveMenuSeparators())
33
+ .map(item => {
34
+ if (item === '-') return menuDivider();
35
+ if (!isMenuItem(item)) return item;
36
+
37
+ const {actionFn} = item;
38
+
39
+ // Create menuItem from config
40
+ const cfg: MenuItemProps = {
41
+ text: item.text,
42
+ icon: item.icon,
43
+ intent: item.intent,
44
+ className: item.className,
45
+ onClick: actionFn ? e => wait().then(() => actionFn(e)) : null, // do async to allow menu to close
46
+ disabled: item.disabled
47
+ };
48
+
49
+ // Recursively parse any submenus
50
+ if (!isEmpty(item.items)) {
51
+ cfg.children = parseMenuItems(item.items);
52
+ cfg.popoverProps = {openOnTargetFocus: false};
53
+ }
54
+
55
+ return menuItem(cfg);
56
+ });
57
+ }
@@ -8,3 +8,4 @@ export * from './Separators';
8
8
  export * from './TimeZone';
9
9
  export * from './Equals';
10
10
  export * from './IsOmitted';
11
+ export * from './MenuItems';
@@ -178,7 +178,7 @@ export function apiDeprecated(name: string, opts: APIWarnOptions = {}) {
178
178
 
179
179
  const v = opts.v ?? 'a future release',
180
180
  msg = opts.msg ? ` ${opts.msg}.` : '',
181
- warn = `The use of '${name}' has been deprecated and will be removed in ${v}.${msg}`;
181
+ warn = `The use of '${name}' has been deprecated and will be removed in ${v}. ${msg}`;
182
182
  if (!_seenWarnings[warn]) {
183
183
  console.warn(warn);
184
184
  _seenWarnings[warn] = true;