@vuu-ui/vuu-utils 0.8.76 → 0.8.77

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 (138) hide show
  1. package/cjs/ShellContext.js +13 -0
  2. package/cjs/ShellContext.js.map +1 -0
  3. package/cjs/ThemeProvider.js +6 -6
  4. package/cjs/component-registry.js +0 -9
  5. package/cjs/component-registry.js.map +1 -1
  6. package/cjs/context-definitions/WorkspaceContext.js +20 -0
  7. package/cjs/context-definitions/WorkspaceContext.js.map +1 -0
  8. package/cjs/index.js +6 -0
  9. package/cjs/index.js.map +1 -1
  10. package/cjs/react-utils.js +4 -4
  11. package/cjs/useId.js +2 -2
  12. package/cjs/useLayoutEffectSkipFirst.js +3 -3
  13. package/esm/ShellContext.js +10 -0
  14. package/esm/ShellContext.js.map +1 -0
  15. package/esm/component-registry.js +0 -9
  16. package/esm/component-registry.js.map +1 -1
  17. package/esm/context-definitions/WorkspaceContext.js +17 -0
  18. package/esm/context-definitions/WorkspaceContext.js.map +1 -0
  19. package/esm/index.js +2 -0
  20. package/esm/index.js.map +1 -1
  21. package/package.json +6 -6
  22. package/types/vuu-shell/src/ShellContextProvider.d.ts +10 -0
  23. package/types/vuu-shell/src/app-header/AppHeader.d.ts +6 -0
  24. package/types/vuu-shell/src/app-header/index.d.ts +1 -0
  25. package/types/vuu-shell/src/application-provider/ApplicationContext.d.ts +12 -0
  26. package/types/vuu-shell/src/application-provider/ApplicationProvider.d.ts +19 -0
  27. package/types/vuu-shell/src/application-provider/index.d.ts +1 -0
  28. package/types/vuu-shell/src/connection-status/ConnectionStatusIndicator.d.ts +10 -0
  29. package/types/vuu-shell/src/connection-status/index.d.ts +1 -0
  30. package/types/vuu-shell/src/datasource-provider/DataSourceProvider.d.ts +21 -0
  31. package/types/vuu-shell/src/datasource-provider/index.d.ts +1 -0
  32. package/types/vuu-shell/src/feature/Feature.d.ts +26 -0
  33. package/types/vuu-shell/src/feature/FeatureErrorBoundary.d.ts +13 -0
  34. package/types/vuu-shell/src/feature/Loader.d.ts +2 -0
  35. package/types/vuu-shell/src/feature/index.d.ts +1 -0
  36. package/types/vuu-shell/src/feature-list/FeatureList.d.ts +7 -0
  37. package/types/vuu-shell/src/feature-list/index.d.ts +1 -0
  38. package/types/vuu-shell/src/feature-provider/FeatureProvider.d.ts +14 -0
  39. package/types/vuu-shell/src/feature-provider/index.d.ts +2 -0
  40. package/types/vuu-shell/src/feature-provider/useVuuFeatures.d.ts +9 -0
  41. package/types/vuu-shell/src/index.d.ts +16 -0
  42. package/types/vuu-shell/src/left-nav/LeftNav.d.ts +18 -0
  43. package/types/vuu-shell/src/left-nav/index.d.ts +1 -0
  44. package/types/vuu-shell/src/login/LoginPanel.d.ts +7 -0
  45. package/types/vuu-shell/src/login/VuuLogo.d.ts +2 -0
  46. package/types/vuu-shell/src/login/index.d.ts +2 -0
  47. package/types/vuu-shell/src/login/login-utils.d.ts +4 -0
  48. package/types/vuu-shell/src/persistence-manager/LocalPersistenceManager.d.ts +21 -0
  49. package/types/vuu-shell/src/persistence-manager/PersistenceManager.d.ts +66 -0
  50. package/types/vuu-shell/src/persistence-manager/PersistenceProvider.d.ts +11 -0
  51. package/types/vuu-shell/src/persistence-manager/RemotePersistenceManager.d.ts +23 -0
  52. package/types/vuu-shell/src/persistence-manager/StaticPersistenceManager.d.ts +21 -0
  53. package/types/vuu-shell/src/persistence-manager/index.d.ts +5 -0
  54. package/types/vuu-shell/src/shell-layout-templates/context-panel/ContextPanel.d.ts +11 -0
  55. package/types/vuu-shell/src/shell-layout-templates/context-panel/index.d.ts +1 -0
  56. package/types/vuu-shell/src/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.d.ts +2 -0
  57. package/types/vuu-shell/src/shell-layout-templates/index.d.ts +3 -0
  58. package/types/vuu-shell/src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.d.ts +2 -0
  59. package/types/vuu-shell/src/shell-layout-templates/side-panel/SidePanel.d.ts +8 -0
  60. package/types/vuu-shell/src/shell-layout-templates/side-panel/index.d.ts +1 -0
  61. package/types/vuu-shell/src/shell-layout-templates/simple-content-pane/useSimpleContentPane.d.ts +2 -0
  62. package/types/vuu-shell/src/shell-layout-templates/useShellLayout.d.ts +41 -0
  63. package/types/vuu-shell/src/shell.d.ts +15 -0
  64. package/types/vuu-shell/src/theme-switch/ThemeSwitch.d.ts +8 -0
  65. package/types/vuu-shell/src/theme-switch/index.d.ts +1 -0
  66. package/types/vuu-shell/src/user-settings/SettingsForm.d.ts +47 -0
  67. package/types/vuu-shell/src/user-settings/UserSettingsPanel.d.ts +3 -0
  68. package/types/vuu-shell/src/user-settings/index.d.ts +2 -0
  69. package/types/vuu-shell/src/workspace-management/LayoutList.d.ts +2 -0
  70. package/types/vuu-shell/src/workspace-management/LayoutTile.d.ts +7 -0
  71. package/types/vuu-shell/src/workspace-management/SaveLayoutPanel.d.ts +10 -0
  72. package/types/vuu-shell/src/workspace-management/WorkspaceProvider.d.ts +53 -0
  73. package/types/vuu-shell/src/workspace-management/defaultWorkspaceJSON.d.ts +9 -0
  74. package/types/vuu-shell/src/workspace-management/index.d.ts +5 -0
  75. package/types/vuu-shell/src/workspace-management/screenshot-utils.d.ts +6 -0
  76. package/types/vuu-shell/src/workspace-management/useWorkspaceContextMenuItems.d.ts +5 -0
  77. package/types/vuu-utils/src/ShellContext.d.ts +12 -0
  78. package/types/vuu-utils/src/context-definitions/WorkspaceContext.d.ts +17 -0
  79. package/types/{index.d.ts → vuu-utils/src/index.d.ts} +4 -0
  80. package/types/{json-types.d.ts → vuu-utils/src/json-types.d.ts} +1 -1
  81. package/types/vuu-utils/src/layout-types.d.ts +19 -0
  82. /package/types/{DataWindow.d.ts → vuu-utils/src/DataWindow.d.ts} +0 -0
  83. /package/types/{ThemeProvider.d.ts → vuu-utils/src/ThemeProvider.d.ts} +0 -0
  84. /package/types/{array-utils.d.ts → vuu-utils/src/array-utils.d.ts} +0 -0
  85. /package/types/{box-utils.d.ts → vuu-utils/src/box-utils.d.ts} +0 -0
  86. /package/types/{broadcast-channel.d.ts → vuu-utils/src/broadcast-channel.d.ts} +0 -0
  87. /package/types/{column-utils.d.ts → vuu-utils/src/column-utils.d.ts} +0 -0
  88. /package/types/{common-types.d.ts → vuu-utils/src/common-types.d.ts} +0 -0
  89. /package/types/{component-registry.d.ts → vuu-utils/src/component-registry.d.ts} +0 -0
  90. /package/types/{cookie-utils.d.ts → vuu-utils/src/cookie-utils.d.ts} +0 -0
  91. /package/types/{css-utils.d.ts → vuu-utils/src/css-utils.d.ts} +0 -0
  92. /package/types/{data-utils.d.ts → vuu-utils/src/data-utils.d.ts} +0 -0
  93. /package/types/{datasource-action-utils.d.ts → vuu-utils/src/datasource-action-utils.d.ts} +0 -0
  94. /package/types/{datasource-utils.d.ts → vuu-utils/src/datasource-utils.d.ts} +0 -0
  95. /package/types/{date → vuu-utils/src/date}/date-utils.d.ts +0 -0
  96. /package/types/{date → vuu-utils/src/date}/dateTimePattern.d.ts +0 -0
  97. /package/types/{date → vuu-utils/src/date}/formatter.d.ts +0 -0
  98. /package/types/{date → vuu-utils/src/date}/index.d.ts +0 -0
  99. /package/types/{date → vuu-utils/src/date}/types.d.ts +0 -0
  100. /package/types/{debug-utils.d.ts → vuu-utils/src/debug-utils.d.ts} +0 -0
  101. /package/types/{event-emitter.d.ts → vuu-utils/src/event-emitter.d.ts} +0 -0
  102. /package/types/{feature-utils.d.ts → vuu-utils/src/feature-utils.d.ts} +0 -0
  103. /package/types/{filters → vuu-utils/src/filters}/filterAsQuery.d.ts +0 -0
  104. /package/types/{filters → vuu-utils/src/filters}/index.d.ts +0 -0
  105. /package/types/{filters → vuu-utils/src/filters}/utils.d.ts +0 -0
  106. /package/types/{form-utils.d.ts → vuu-utils/src/form-utils.d.ts} +0 -0
  107. /package/types/{formatting-utils.d.ts → vuu-utils/src/formatting-utils.d.ts} +0 -0
  108. /package/types/{getUniqueId.d.ts → vuu-utils/src/getUniqueId.d.ts} +0 -0
  109. /package/types/{group-utils.d.ts → vuu-utils/src/group-utils.d.ts} +0 -0
  110. /package/types/{html-utils.d.ts → vuu-utils/src/html-utils.d.ts} +0 -0
  111. /package/types/{input-utils.d.ts → vuu-utils/src/input-utils.d.ts} +0 -0
  112. /package/types/{invariant.d.ts → vuu-utils/src/invariant.d.ts} +0 -0
  113. /package/types/{itemToString.d.ts → vuu-utils/src/itemToString.d.ts} +0 -0
  114. /package/types/{json-utils.d.ts → vuu-utils/src/json-utils.d.ts} +0 -0
  115. /package/types/{keyboard-utils.d.ts → vuu-utils/src/keyboard-utils.d.ts} +0 -0
  116. /package/types/{keyset.d.ts → vuu-utils/src/keyset.d.ts} +0 -0
  117. /package/types/{list-utils.d.ts → vuu-utils/src/list-utils.d.ts} +0 -0
  118. /package/types/{local-storage-utils.d.ts → vuu-utils/src/local-storage-utils.d.ts} +0 -0
  119. /package/types/{logging-utils.d.ts → vuu-utils/src/logging-utils.d.ts} +0 -0
  120. /package/types/{menu-utils.d.ts → vuu-utils/src/menu-utils.d.ts} +0 -0
  121. /package/types/{module-utils.d.ts → vuu-utils/src/module-utils.d.ts} +0 -0
  122. /package/types/{nanoid → vuu-utils/src/nanoid}/index.d.ts +0 -0
  123. /package/types/{perf-utils.d.ts → vuu-utils/src/perf-utils.d.ts} +0 -0
  124. /package/types/{protocol-message-utils.d.ts → vuu-utils/src/protocol-message-utils.d.ts} +0 -0
  125. /package/types/{range-utils.d.ts → vuu-utils/src/range-utils.d.ts} +0 -0
  126. /package/types/{react-utils.d.ts → vuu-utils/src/react-utils.d.ts} +0 -0
  127. /package/types/{round-decimal.d.ts → vuu-utils/src/round-decimal.d.ts} +0 -0
  128. /package/types/{row-utils.d.ts → vuu-utils/src/row-utils.d.ts} +0 -0
  129. /package/types/{selection-utils.d.ts → vuu-utils/src/selection-utils.d.ts} +0 -0
  130. /package/types/{shell-layout-types.d.ts → vuu-utils/src/shell-layout-types.d.ts} +0 -0
  131. /package/types/{sort-utils.d.ts → vuu-utils/src/sort-utils.d.ts} +0 -0
  132. /package/types/{table-schema-utils.d.ts → vuu-utils/src/table-schema-utils.d.ts} +0 -0
  133. /package/types/{text-utils.d.ts → vuu-utils/src/text-utils.d.ts} +0 -0
  134. /package/types/{ts-utils.d.ts → vuu-utils/src/ts-utils.d.ts} +0 -0
  135. /package/types/{url-utils.d.ts → vuu-utils/src/url-utils.d.ts} +0 -0
  136. /package/types/{useId.d.ts → vuu-utils/src/useId.d.ts} +0 -0
  137. /package/types/{useLayoutEffectSkipFirst.d.ts → vuu-utils/src/useLayoutEffectSkipFirst.d.ts} +0 -0
  138. /package/types/{user-types.d.ts → vuu-utils/src/user-types.d.ts} +0 -0
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+
5
+ const defaultConfig = {};
6
+ const ShellContext = React.createContext(defaultConfig);
7
+ const useShellContext = () => {
8
+ return React.useContext(ShellContext);
9
+ };
10
+
11
+ exports.ShellContext = ShellContext;
12
+ exports.useShellContext = useShellContext;
13
+ //# sourceMappingURL=ShellContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShellContext.js","sources":["../src/ShellContext.ts"],"sourcesContent":["import { RpcResponseHandler } from \"packages/vuu-data-types\";\nimport { LookupTableProvider } from \"packages/vuu-shell/src\";\nimport {\n DefaultColumnConfiguration,\n DefaultTableConfiguration,\n} from \"packages/vuu-table-types\";\nimport { createContext, useContext } from \"react\";\n\nexport interface ShellContextProps {\n getDefaultColumnConfig?: DefaultColumnConfiguration;\n getDefaultTableConfig?: DefaultTableConfiguration;\n getLookupValues?: LookupTableProvider;\n handleRpcResponse?: RpcResponseHandler;\n}\n\nconst defaultConfig = {};\n\nexport const ShellContext = createContext<ShellContextProps>(defaultConfig);\n\nexport const useShellContext = () => {\n return useContext(ShellContext);\n};\n"],"names":["createContext","useContext"],"mappings":";;;;AAeA,MAAM,gBAAgB,EAAC,CAAA;AAEV,MAAA,YAAA,GAAeA,oBAAiC,aAAa,EAAA;AAEnE,MAAM,kBAAkB,MAAM;AACnC,EAAA,OAAOC,iBAAW,YAAY,CAAA,CAAA;AAChC;;;;;"}
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
- var react = require('react');
4
+ var React = require('react');
5
5
  var cx = require('clsx');
6
6
 
7
7
  const DEFAULT_DENSITY = "medium";
8
8
  const DEFAULT_THEME = "salt-theme";
9
9
  const DEFAULT_THEME_MODE = "light";
10
- const ThemeContext = react.createContext({
10
+ const ThemeContext = React.createContext({
11
11
  density: "high",
12
12
  theme: "vuu",
13
13
  themeMode: "light"
@@ -18,7 +18,7 @@ const DEFAULT_THEME_ATTRIBUTES = [
18
18
  "light"
19
19
  ];
20
20
  const useThemeAttributes = (themeAttributes) => {
21
- const context = react.useContext(ThemeContext);
21
+ const context = React.useContext(ThemeContext);
22
22
  if (themeAttributes) {
23
23
  return [
24
24
  themeAttributes.themeClass,
@@ -35,8 +35,8 @@ const useThemeAttributes = (themeAttributes) => {
35
35
  return DEFAULT_THEME_ATTRIBUTES;
36
36
  };
37
37
  const createThemedChildren = (children, theme, themeMode, density) => {
38
- if (react.isValidElement(children)) {
39
- return react.cloneElement(children, {
38
+ if (React.isValidElement(children)) {
39
+ return React.cloneElement(children, {
40
40
  className: cx(
41
41
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
42
42
  children.props?.className,
@@ -67,7 +67,7 @@ const ThemeProvider = ({
67
67
  density: inheritedDensity,
68
68
  themeMode: inheritedThemeMode,
69
69
  theme: inheritedTheme
70
- } = react.useContext(ThemeContext);
70
+ } = React.useContext(ThemeContext);
71
71
  const density = densityProp ?? inheritedDensity ?? DEFAULT_DENSITY;
72
72
  const themeMode = themeModeProp ?? inheritedThemeMode ?? DEFAULT_THEME_MODE;
73
73
  const theme = themeProp ?? inheritedTheme ?? DEFAULT_THEME;
@@ -21,19 +21,10 @@ const isTypeCompatible = (rendererType, serverDataType) => {
21
21
  return rendererType === serverDataType;
22
22
  }
23
23
  };
24
- const assertComponentRegistered = (componentType) => {
25
- if (!layoutComponentsMap.has(componentType)) {
26
- console.warn(
27
- `isContainer check on ${componentType}, which has not been registered`
28
- );
29
- }
30
- };
31
24
  const isContainer = (componentType) => {
32
- assertComponentRegistered(componentType);
33
25
  return containersSet.has(componentType);
34
26
  };
35
27
  const isView = (componentType) => {
36
- assertComponentRegistered(componentType);
37
28
  return viewsSet.has(componentType);
38
29
  };
39
30
  const isLayoutComponent = (componentType) => isContainer(componentType) || isView(componentType);
@@ -1 +1 @@
1
- {"version":3,"file":"component-registry.js","sources":["../src/component-registry.ts"],"sourcesContent":["import { DataSourceRow } from \"@vuu-ui/vuu-data-types\";\nimport {\n VuuColumnDataType,\n VuuRowDataItemType,\n} from \"@vuu-ui/vuu-protocol-types\";\nimport {\n ColumnDescriptor,\n ColumnDescriptorCustomRenderer,\n ColumnTypeRendering,\n EditValidationRule,\n HeaderCellProps,\n TableCellRendererProps,\n} from \"@vuu-ui/vuu-table-types\";\nimport { FunctionComponent as FC, HTMLAttributes } from \"react\";\nimport {\n ColumnMap,\n isColumnTypeRenderer,\n isTypeDescriptor,\n} from \"./column-utils\";\n\nexport interface CellConfigPanelProps extends HTMLAttributes<HTMLDivElement> {\n onConfigChange: () => void;\n}\n\nexport type PropertyChangeHandler = (\n propertyName: string,\n propertyValue: string | number | boolean\n) => void;\n\nexport type ColumnRenderPropsChangeHandler = (\n renderProps: ColumnTypeRendering\n) => void;\n\nexport interface ConfigurationEditorProps {\n column: ColumnDescriptorCustomRenderer;\n onChangeRendering: ColumnRenderPropsChangeHandler;\n}\n\nexport type RowClassNameGenerator = (\n row: DataSourceRow,\n columnMap: ColumnMap\n) => string | undefined;\n\nexport type RowClassGenerator = {\n id: string;\n fn: RowClassNameGenerator;\n};\n\nexport type ConfigEditorComponent = FC<CellConfigPanelProps>;\n\nconst containersSet = new Set<string>();\nconst viewsSet = new Set<string>();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst layoutComponentsMap = new Map<string, FC<any>>();\nconst cellRenderersMap = new Map<string, FC<TableCellRendererProps>>();\nconst columnHeaderRenderersMap = new Map<string, FC<HeaderCellProps>>();\nconst configEditorsMap = new Map<string, FC<ConfigurationEditorProps>>();\nconst cellConfigPanelsMap = new Map<string, ConfigEditorComponent>();\nconst editRuleValidatorsMap = new Map<string, EditRuleValidator>();\nconst optionsMap = new Map<string, CellRendererOptions>();\nconst rowClassGeneratorsMap = new Map<string, RowClassGenerator>();\n\nexport type EditRuleValidator = (\n editRule: EditValidationRule,\n value?: VuuRowDataItemType\n) => boolean | string;\n\nexport type layoutComponentType = \"container\" | \"view\";\n\nexport type ComponentType =\n | layoutComponentType\n | \"cell-renderer\"\n | \"cell-config-panel\"\n | \"column-header-content-renderer\"\n | \"column-header-label-renderer\"\n | \"component\"\n | \"data-edit-validator\"\n | \"row-class-generator\";\n\ntype CellRendererOptions = {\n configEditor?: string;\n description?: string;\n label?: string;\n serverDataType?: VuuColumnDataType | VuuColumnDataType[] | \"json\" | \"private\";\n userCanAssign?: boolean;\n};\nexport interface CellRendererDescriptor extends CellRendererOptions {\n name: string;\n}\n\nconst isTypeCompatible = (\n rendererType:\n | VuuColumnDataType\n | (VuuColumnDataType | \"json\")[]\n | \"json\"\n | \"private\"\n | undefined,\n serverDataType: VuuColumnDataType | \"json\"\n) => {\n if (rendererType === undefined || rendererType === \"private\") {\n return true;\n } else if (Array.isArray(rendererType)) {\n return rendererType.includes(serverDataType);\n } else {\n return rendererType === serverDataType;\n }\n};\n\nconst assertComponentRegistered = (componentType: string) => {\n if (!layoutComponentsMap.has(componentType)) {\n console.warn(\n `isContainer check on ${componentType}, which has not been registered`\n );\n }\n};\n\n/**\n * This check is performed during construction of UI from JSON. If component\n * is not registered, it will log a warning.\n */\nexport const isContainer = (componentType: string) => {\n assertComponentRegistered(componentType);\n return containersSet.has(componentType);\n};\n\n/**\n * This check is performed during construction of UI from JSON. If component\n * is not registered, it will log a warning.\n */\nexport const isView = (componentType: string) => {\n assertComponentRegistered(componentType);\n return viewsSet.has(componentType);\n};\n\n/**\n * This check is performed during construction of UI from JSON. If component\n * is not registered, it will log a warning.\n */\nexport const isLayoutComponent = (\n componentType: string\n): componentType is layoutComponentType =>\n isContainer(componentType) || isView(componentType);\n\nconst isCellRenderer = (\n type: ComponentType,\n component: unknown\n): component is FC<TableCellRendererProps> =>\n component !== undefined && type === \"cell-renderer\";\n\nconst isColumnHeaderContentRenderer = (\n type: ComponentType,\n component: unknown\n): component is FC<HeaderCellProps> =>\n type === \"column-header-content-renderer\";\nconst isColumnHeaderLabelRenderer = (\n type: ComponentType,\n component: unknown\n): component is FC<HeaderCellProps> => type === \"column-header-label-renderer\";\n\nconst isCellConfigPanel = (\n type: ComponentType,\n component: unknown\n): component is FC<CellConfigPanelProps> => type === \"cell-config-panel\";\n\nconst isEditRuleValidator = (\n type: ComponentType,\n component: unknown\n): component is EditRuleValidator => type === \"data-edit-validator\";\n\nconst isRowClassGenerator = (\n type: ComponentType,\n component: unknown\n): component is RowClassGenerator => type === \"row-class-generator\";\n\nexport function registerComponent(\n componentName: string,\n component: RowClassGenerator,\n componentType: \"row-class-generator\",\n options?: CellRendererOptions\n): void;\nexport function registerComponent(\n componentName: string,\n component: EditRuleValidator,\n componentType: \"data-edit-validator\",\n options?: CellRendererOptions\n): void;\nexport function registerComponent(\n componentName: string,\n // unknown won't work for us here, we'll get the default children\n // definition for FC which conflicts with some components props.\n // VoidFunctionComponent doesn't help either\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: FC<any>,\n componentType: Omit<\n ComponentType,\n \"data-edit-validator\" | \"row-class-generator\"\n >,\n options?: CellRendererOptions\n): void;\nexport function registerComponent(\n componentName: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n componentType: any,\n options?: CellRendererOptions\n): void {\n if (\n componentType === \"container\" ||\n componentType === \"view\" ||\n componentType === \"component\"\n ) {\n layoutComponentsMap.set(componentName, component);\n if (componentType === \"container\") {\n containersSet.add(componentName);\n } else if (componentType === \"view\") {\n viewsSet.add(componentName);\n }\n } else if (isCellRenderer(componentType, component)) {\n cellRenderersMap.set(componentName, component);\n } else if (isColumnHeaderContentRenderer(componentType, component)) {\n columnHeaderRenderersMap.set(componentName, component);\n } else if (isColumnHeaderLabelRenderer(componentType, component)) {\n columnHeaderRenderersMap.set(componentName, component);\n } else if (isCellConfigPanel(componentType, component)) {\n cellConfigPanelsMap.set(componentName, component);\n } else if (isEditRuleValidator(componentType, component)) {\n editRuleValidatorsMap.set(componentName, component);\n } else if (isRowClassGenerator(componentType, component)) {\n rowClassGeneratorsMap.set(componentName, component);\n }\n if (options) {\n optionsMap.set(componentName, options);\n }\n}\n\nexport const registerConfigurationEditor = (\n componentName: string,\n configurationEditor: FC<ConfigurationEditorProps>\n) => {\n configEditorsMap.set(componentName, configurationEditor);\n};\n\n// This is invoked by settings panel to allow users to assign\n// non-default, cell renderers. Ignore renderers registered\n// with the attribute userCanAssign = false\nexport const getRegisteredCellRenderers = (\n serverDataType?: VuuColumnDataType | \"json\"\n): CellRendererDescriptor[] => {\n const rendererNames = Array.from(cellRenderersMap.keys());\n const allRenderers = rendererNames\n .map<CellRendererDescriptor>((name) => ({\n name,\n ...(optionsMap.get(name) as CellRendererOptions),\n }))\n .filter(({ userCanAssign }) => userCanAssign !== false);\n if (serverDataType) {\n return allRenderers.filter((renderer) =>\n isTypeCompatible(renderer.serverDataType, serverDataType)\n );\n } else {\n return allRenderers;\n }\n};\n\nexport const getLayoutComponent = (componentName: string) => {\n const layoutComponent = layoutComponentsMap.get(componentName);\n if (layoutComponent) {\n return layoutComponent;\n } else {\n throw Error(\n `layout component ${componentName} not found in ComponentRegistry`\n );\n }\n};\n\nexport const getCellRendererOptions = (renderName: string) =>\n optionsMap.get(renderName);\n\nexport function getCellRenderer(column: ColumnDescriptor) {\n return dataCellRenderer(column);\n}\nexport function getColumnHeaderContentRenderer(column: ColumnDescriptor) {\n if (column.colHeaderContentRenderer) {\n return columnHeaderRenderersMap.get(column.colHeaderContentRenderer);\n }\n}\nexport function getColumnHeaderLabelRenderer(column: ColumnDescriptor) {\n if (column.colHeaderLabelRenderer) {\n return columnHeaderRenderersMap.get(column.colHeaderLabelRenderer);\n }\n}\nexport const getRowClassNameGenerator = (generatorId: string) =>\n rowClassGeneratorsMap.get(generatorId);\n\nexport function getConfigurationEditor(configEditor = \"\") {\n return configEditorsMap.get(configEditor);\n}\n\nexport function getCellConfigPanelRenderer(name: string) {\n return cellConfigPanelsMap.get(name);\n}\n\nexport function getEditRuleValidator(name: string) {\n return editRuleValidatorsMap.get(name);\n}\n\nfunction dataCellRenderer(column: ColumnDescriptor) {\n if (isTypeDescriptor(column.type)) {\n const { renderer } = column.type;\n if (isColumnTypeRenderer(renderer)) {\n return cellRenderersMap.get(renderer.name);\n }\n } else if (column.serverDataType === \"boolean\") {\n return cellRenderersMap.get(\"checkbox-cell\");\n } else if (column.editable) {\n // we can only offer a text input edit as a generic editor.\n // If a more specialised editor is required, user must configure\n // it in column config.\n return cellRenderersMap.get(\"input-cell\");\n }\n}\n"],"names":["isTypeDescriptor","isColumnTypeRenderer"],"mappings":";;;;AAkDA,MAAM,aAAA,uBAAoB,GAAY,EAAA,CAAA;AACtC,MAAM,QAAA,uBAAe,GAAY,EAAA,CAAA;AAGjC,MAAM,mBAAA,uBAA0B,GAAqB,EAAA,CAAA;AACrD,MAAM,gBAAA,uBAAuB,GAAwC,EAAA,CAAA;AACrE,MAAM,wBAAA,uBAA+B,GAAiC,EAAA,CAAA;AACtE,MAAM,gBAAA,uBAAuB,GAA0C,EAAA,CAAA;AACvE,MAAM,mBAAA,uBAA0B,GAAmC,EAAA,CAAA;AACnE,MAAM,qBAAA,uBAA4B,GAA+B,EAAA,CAAA;AACjE,MAAM,UAAA,uBAAiB,GAAiC,EAAA,CAAA;AACxD,MAAM,qBAAA,uBAA4B,GAA+B,EAAA,CAAA;AA8BjE,MAA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,MAAO,OAAA,gBAAA,CAAiB,GAAI,CAAA,QAAA,CAAS,IAAI,CAAA,CAAA;AAAA,KAC3C;AAAA,GACF,MAAA,IAAW,MAAO,CAAA,cAAA,KAAmB,SAAW,EAAA;AAC9C,IAAO,OAAA,gBAAA,CAAiB,IAAI,eAAe,CAAA,CAAA;AAAA,GAC7C,MAAA,IAAW,OAAO,QAAU,EAAA;AAI1B,IAAO,OAAA,gBAAA,CAAiB,IAAI,YAAY,CAAA,CAAA;AAAA,GAC1C;AACF;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"component-registry.js","sources":["../src/component-registry.ts"],"sourcesContent":["import { DataSourceRow } from \"@vuu-ui/vuu-data-types\";\nimport {\n VuuColumnDataType,\n VuuRowDataItemType,\n} from \"@vuu-ui/vuu-protocol-types\";\nimport {\n ColumnDescriptor,\n ColumnDescriptorCustomRenderer,\n ColumnTypeRendering,\n EditValidationRule,\n HeaderCellProps,\n TableCellRendererProps,\n} from \"@vuu-ui/vuu-table-types\";\nimport { FunctionComponent as FC, HTMLAttributes } from \"react\";\nimport {\n ColumnMap,\n isColumnTypeRenderer,\n isTypeDescriptor,\n} from \"./column-utils\";\n\nexport interface CellConfigPanelProps extends HTMLAttributes<HTMLDivElement> {\n onConfigChange: () => void;\n}\n\nexport type PropertyChangeHandler = (\n propertyName: string,\n propertyValue: string | number | boolean\n) => void;\n\nexport type ColumnRenderPropsChangeHandler = (\n renderProps: ColumnTypeRendering\n) => void;\n\nexport interface ConfigurationEditorProps {\n column: ColumnDescriptorCustomRenderer;\n onChangeRendering: ColumnRenderPropsChangeHandler;\n}\n\nexport type RowClassNameGenerator = (\n row: DataSourceRow,\n columnMap: ColumnMap\n) => string | undefined;\n\nexport type RowClassGenerator = {\n id: string;\n fn: RowClassNameGenerator;\n};\n\nexport type ConfigEditorComponent = FC<CellConfigPanelProps>;\n\nconst containersSet = new Set<string>();\nconst viewsSet = new Set<string>();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst layoutComponentsMap = new Map<string, FC<any>>();\nconst cellRenderersMap = new Map<string, FC<TableCellRendererProps>>();\nconst columnHeaderRenderersMap = new Map<string, FC<HeaderCellProps>>();\nconst configEditorsMap = new Map<string, FC<ConfigurationEditorProps>>();\nconst cellConfigPanelsMap = new Map<string, ConfigEditorComponent>();\nconst editRuleValidatorsMap = new Map<string, EditRuleValidator>();\nconst optionsMap = new Map<string, CellRendererOptions>();\nconst rowClassGeneratorsMap = new Map<string, RowClassGenerator>();\n\nexport type EditRuleValidator = (\n editRule: EditValidationRule,\n value?: VuuRowDataItemType\n) => boolean | string;\n\nexport type layoutComponentType = \"container\" | \"view\";\n\nexport type ComponentType =\n | layoutComponentType\n | \"cell-renderer\"\n | \"cell-config-panel\"\n | \"column-header-content-renderer\"\n | \"column-header-label-renderer\"\n | \"component\"\n | \"data-edit-validator\"\n | \"row-class-generator\";\n\ntype CellRendererOptions = {\n configEditor?: string;\n description?: string;\n label?: string;\n serverDataType?: VuuColumnDataType | VuuColumnDataType[] | \"json\" | \"private\";\n userCanAssign?: boolean;\n};\nexport interface CellRendererDescriptor extends CellRendererOptions {\n name: string;\n}\n\nconst isTypeCompatible = (\n rendererType:\n | VuuColumnDataType\n | (VuuColumnDataType | \"json\")[]\n | \"json\"\n | \"private\"\n | undefined,\n serverDataType: VuuColumnDataType | \"json\"\n) => {\n if (rendererType === undefined || rendererType === \"private\") {\n return true;\n } else if (Array.isArray(rendererType)) {\n return rendererType.includes(serverDataType);\n } else {\n return rendererType === serverDataType;\n }\n};\n\n/**\n * This check is performed during construction of UI from JSON. If component\n * is not registered, it will log a warning.\n */\nexport const isContainer = (componentType: string) => {\n return containersSet.has(componentType);\n};\n\n/**\n * This check is performed during construction of UI from JSON. If component\n * is not registered, it will log a warning.\n */\nexport const isView = (componentType: string) => {\n return viewsSet.has(componentType);\n};\n\n/**\n * This check is performed during construction of UI from JSON. If component\n * is not registered, it will log a warning.\n */\nexport const isLayoutComponent = (\n componentType: string\n): componentType is layoutComponentType =>\n isContainer(componentType) || isView(componentType);\n\nconst isCellRenderer = (\n type: ComponentType,\n component: unknown\n): component is FC<TableCellRendererProps> =>\n component !== undefined && type === \"cell-renderer\";\n\nconst isColumnHeaderContentRenderer = (\n type: ComponentType,\n component: unknown\n): component is FC<HeaderCellProps> =>\n type === \"column-header-content-renderer\";\nconst isColumnHeaderLabelRenderer = (\n type: ComponentType,\n component: unknown\n): component is FC<HeaderCellProps> => type === \"column-header-label-renderer\";\n\nconst isCellConfigPanel = (\n type: ComponentType,\n component: unknown\n): component is FC<CellConfigPanelProps> => type === \"cell-config-panel\";\n\nconst isEditRuleValidator = (\n type: ComponentType,\n component: unknown\n): component is EditRuleValidator => type === \"data-edit-validator\";\n\nconst isRowClassGenerator = (\n type: ComponentType,\n component: unknown\n): component is RowClassGenerator => type === \"row-class-generator\";\n\nexport function registerComponent(\n componentName: string,\n component: RowClassGenerator,\n componentType: \"row-class-generator\",\n options?: CellRendererOptions\n): void;\nexport function registerComponent(\n componentName: string,\n component: EditRuleValidator,\n componentType: \"data-edit-validator\",\n options?: CellRendererOptions\n): void;\nexport function registerComponent(\n componentName: string,\n // unknown won't work for us here, we'll get the default children\n // definition for FC which conflicts with some components props.\n // VoidFunctionComponent doesn't help either\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: FC<any>,\n componentType: Omit<\n ComponentType,\n \"data-edit-validator\" | \"row-class-generator\"\n >,\n options?: CellRendererOptions\n): void;\nexport function registerComponent(\n componentName: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n componentType: any,\n options?: CellRendererOptions\n): void {\n if (\n componentType === \"container\" ||\n componentType === \"view\" ||\n componentType === \"component\"\n ) {\n layoutComponentsMap.set(componentName, component);\n if (componentType === \"container\") {\n containersSet.add(componentName);\n } else if (componentType === \"view\") {\n viewsSet.add(componentName);\n }\n } else if (isCellRenderer(componentType, component)) {\n cellRenderersMap.set(componentName, component);\n } else if (isColumnHeaderContentRenderer(componentType, component)) {\n columnHeaderRenderersMap.set(componentName, component);\n } else if (isColumnHeaderLabelRenderer(componentType, component)) {\n columnHeaderRenderersMap.set(componentName, component);\n } else if (isCellConfigPanel(componentType, component)) {\n cellConfigPanelsMap.set(componentName, component);\n } else if (isEditRuleValidator(componentType, component)) {\n editRuleValidatorsMap.set(componentName, component);\n } else if (isRowClassGenerator(componentType, component)) {\n rowClassGeneratorsMap.set(componentName, component);\n }\n if (options) {\n optionsMap.set(componentName, options);\n }\n}\n\nexport const registerConfigurationEditor = (\n componentName: string,\n configurationEditor: FC<ConfigurationEditorProps>\n) => {\n configEditorsMap.set(componentName, configurationEditor);\n};\n\n// This is invoked by settings panel to allow users to assign\n// non-default, cell renderers. Ignore renderers registered\n// with the attribute userCanAssign = false\nexport const getRegisteredCellRenderers = (\n serverDataType?: VuuColumnDataType | \"json\"\n): CellRendererDescriptor[] => {\n const rendererNames = Array.from(cellRenderersMap.keys());\n const allRenderers = rendererNames\n .map<CellRendererDescriptor>((name) => ({\n name,\n ...(optionsMap.get(name) as CellRendererOptions),\n }))\n .filter(({ userCanAssign }) => userCanAssign !== false);\n if (serverDataType) {\n return allRenderers.filter((renderer) =>\n isTypeCompatible(renderer.serverDataType, serverDataType)\n );\n } else {\n return allRenderers;\n }\n};\n\nexport const getLayoutComponent = (componentName: string) => {\n const layoutComponent = layoutComponentsMap.get(componentName);\n if (layoutComponent) {\n return layoutComponent;\n } else {\n throw Error(\n `layout component ${componentName} not found in ComponentRegistry`\n );\n }\n};\n\nexport const getCellRendererOptions = (renderName: string) =>\n optionsMap.get(renderName);\n\nexport function getCellRenderer(column: ColumnDescriptor) {\n return dataCellRenderer(column);\n}\nexport function getColumnHeaderContentRenderer(column: ColumnDescriptor) {\n if (column.colHeaderContentRenderer) {\n return columnHeaderRenderersMap.get(column.colHeaderContentRenderer);\n }\n}\nexport function getColumnHeaderLabelRenderer(column: ColumnDescriptor) {\n if (column.colHeaderLabelRenderer) {\n return columnHeaderRenderersMap.get(column.colHeaderLabelRenderer);\n }\n}\nexport const getRowClassNameGenerator = (generatorId: string) =>\n rowClassGeneratorsMap.get(generatorId);\n\nexport function getConfigurationEditor(configEditor = \"\") {\n return configEditorsMap.get(configEditor);\n}\n\nexport function getCellConfigPanelRenderer(name: string) {\n return cellConfigPanelsMap.get(name);\n}\n\nexport function getEditRuleValidator(name: string) {\n return editRuleValidatorsMap.get(name);\n}\n\nfunction dataCellRenderer(column: ColumnDescriptor) {\n if (isTypeDescriptor(column.type)) {\n const { renderer } = column.type;\n if (isColumnTypeRenderer(renderer)) {\n return cellRenderersMap.get(renderer.name);\n }\n } else if (column.serverDataType === \"boolean\") {\n return cellRenderersMap.get(\"checkbox-cell\");\n } else if (column.editable) {\n // we can only offer a text input edit as a generic editor.\n // If a more specialised editor is required, user must configure\n // it in column config.\n return cellRenderersMap.get(\"input-cell\");\n }\n}\n"],"names":["isTypeDescriptor","isColumnTypeRenderer"],"mappings":";;;;AAkDA,MAAM,aAAA,uBAAoB,GAAY,EAAA,CAAA;AACtC,MAAM,QAAA,uBAAe,GAAY,EAAA,CAAA;AAGjC,MAAM,mBAAA,uBAA0B,GAAqB,EAAA,CAAA;AACrD,MAAM,gBAAA,uBAAuB,GAAwC,EAAA,CAAA;AACrE,MAAM,wBAAA,uBAA+B,GAAiC,EAAA,CAAA;AACtE,MAAM,gBAAA,uBAAuB,GAA0C,EAAA,CAAA;AACvE,MAAM,mBAAA,uBAA0B,GAAmC,EAAA,CAAA;AACnE,MAAM,qBAAA,uBAA4B,GAA+B,EAAA,CAAA;AACjE,MAAM,UAAA,uBAAiB,GAAiC,EAAA,CAAA;AACxD,MAAM,qBAAA,uBAA4B,GAA+B,EAAA,CAAA;AA8BjE,MAAM,gBAAA,GAAmB,CACvB,YAAA,EAMA,cACG,KAAA;AACH,EAAI,IAAA,YAAA,KAAiB,KAAa,CAAA,IAAA,YAAA,KAAiB,SAAW,EAAA;AAC5D,IAAO,OAAA,I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A0B,EAAA;AACrE,EAAA,IAAI,OAAO,sBAAwB,EAAA;AACjC,IAAO,OAAA,wBAAA,CAAyB,GAAI,CAAA,MAAA,CAAO,sBAAsB,CAAA,CAAA;AAAA,GACnE;AACF,CAAA;AACO,MAAM,wBAA2B,GAAA,CAAC,WACvC,KAAA,qBAAA,CAAsB,IAAI,WAAW,EAAA;AAEvB,SAAA,sBAAA,CAAuB,eAAe,EAAI,EAAA;AACxD,EAAO,OAAA,gBAAA,CAAiB,IAAI,YAAY,CAAA,CAAA;AAC1C,CAAA;AAEO,SAAS,2BAA2B,IAAc,EAAA;AACvD,EAAO,OAAA,mBAAA,CAAoB,IAAI,IAAI,CAAA,CAAA;AACrC,CAAA;AAEO,SAAS,qBAAqB,IAAc,EAAA;AACjD,EAAO,OAAA,qBAAA,CAAsB,IAAI,IAAI,CAAA,CAAA;AACvC,CAAA;AAEA,SAAS,iBAAiB,MAA0B,EAAA;AAClD,EAAI,IAAAA,4BAAA,CAAiB,MAAO,CAAA,IAAI,CAAG,EAAA;AACjC,IAAM,MAAA,EAAE,QAAS,EAAA,GAAI,MAAO,CAAA,IAAA,CAAA;AAC5B,IAAI,IAAAC,gCAAA,CAAqB,QAAQ,CAAG,EAAA;AAClC,MAAO,OAAA,gBAAA,CAAiB,GAAI,CAAA,QAAA,CAAS,IAAI,CAAA,CAAA;AAAA,KAC3C;AAAA,GACF,MAAA,IAAW,MAAO,CAAA,cAAA,KAAmB,SAAW,EAAA;AAC9C,IAAO,OAAA,gBAAA,CAAiB,IAAI,eAAe,CAAA,CAAA;AAAA,GAC7C,MAAA,IAAW,OAAO,QAAU,EAAA;AAI1B,IAAO,OAAA,gBAAA,CAAiB,IAAI,YAAY,CAAA,CAAA;AAAA,GAC1C;AACF;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+
5
+ const WorkspaceContext = React.createContext({
6
+ getApplicationSettings: () => void 0,
7
+ layoutMetadata: [],
8
+ saveLayout: () => void 0,
9
+ saveApplicationLayout: () => void 0,
10
+ saveApplicationSettings: () => void 0,
11
+ loadLayoutById: () => void 0
12
+ });
13
+ const usePlaceholderJSON = () => {
14
+ const { layoutPlaceholderJSON } = React.useContext(WorkspaceContext);
15
+ return layoutPlaceholderJSON;
16
+ };
17
+
18
+ exports.WorkspaceContext = WorkspaceContext;
19
+ exports.usePlaceholderJSON = usePlaceholderJSON;
20
+ //# sourceMappingURL=WorkspaceContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkspaceContext.js","sources":["../../src/context-definitions/WorkspaceContext.tsx"],"sourcesContent":["import React, { useContext } from \"react\";\nimport {\n ApplicationSetting,\n ApplicationSettings,\n LayoutJSON,\n} from \"../json-types\";\nimport { LayoutMetadata, LayoutMetadataDto } from \"../layout-types\";\n\nexport interface WorkspaceContextProps {\n layoutMetadata: LayoutMetadata[];\n layoutPlaceholderJSON?: LayoutJSON;\n getApplicationSettings: (\n key?: keyof ApplicationSettings\n ) => ApplicationSettings | ApplicationSetting | undefined;\n loadLayoutById: (id: string) => void;\n saveApplicationSettings: (\n settings: ApplicationSettings | ApplicationSetting,\n key?: keyof ApplicationSettings\n ) => void;\n saveLayout: (n: LayoutMetadataDto) => void;\n saveApplicationLayout: (layout: LayoutJSON) => void;\n workspaceJSON?: LayoutJSON;\n}\n\nexport const WorkspaceContext = React.createContext<WorkspaceContextProps>({\n getApplicationSettings: () => undefined,\n layoutMetadata: [],\n saveLayout: () => undefined,\n saveApplicationLayout: () => undefined,\n saveApplicationSettings: () => undefined,\n loadLayoutById: () => undefined,\n});\n\nexport const usePlaceholderJSON = () => {\n const { layoutPlaceholderJSON } = useContext(WorkspaceContext);\n return layoutPlaceholderJSON;\n};\n"],"names":["useContext"],"mappings":";;;;AAwBa,MAAA,gBAAA,GAAmB,MAAM,aAAqC,CAAA;AAAA,EACzE,wBAAwB,MAAM,KAAA,CAAA;AAAA,EAC9B,gBAAgB,EAAC;AAAA,EACjB,YAAY,MAAM,KAAA,CAAA;AAAA,EAClB,uBAAuB,MAAM,KAAA,CAAA;AAAA,EAC7B,yBAAyB,MAAM,KAAA,CAAA;AAAA,EAC/B,gBAAgB,MAAM,KAAA,CAAA;AACxB,CAAC,EAAA;AAEM,MAAM,qBAAqB,MAAM;AACtC,EAAA,MAAM,EAAE,qBAAA,EAA0B,GAAAA,gBAAA,CAAW,gBAAgB,CAAA,CAAA;AAC7D,EAAO,OAAA,qBAAA,CAAA;AACT;;;;;"}
package/cjs/index.js CHANGED
@@ -53,6 +53,8 @@ var tsUtils = require('./ts-utils.js');
53
53
  var urlUtils = require('./url-utils.js');
54
54
  var useId = require('./useId.js');
55
55
  var useLayoutEffectSkipFirst = require('./useLayoutEffectSkipFirst.js');
56
+ var ShellContext = require('./ShellContext.js');
57
+ var WorkspaceContext = require('./context-definitions/WorkspaceContext.js');
56
58
 
57
59
 
58
60
 
@@ -327,4 +329,8 @@ exports.getUrlParameter = urlUtils.getUrlParameter;
327
329
  exports.hasUrlParameter = urlUtils.hasUrlParameter;
328
330
  exports.useId = useId.useId;
329
331
  exports.useLayoutEffectSkipFirst = useLayoutEffectSkipFirst.useLayoutEffectSkipFirst;
332
+ exports.ShellContext = ShellContext.ShellContext;
333
+ exports.useShellContext = ShellContext.useShellContext;
334
+ exports.WorkspaceContext = WorkspaceContext.WorkspaceContext;
335
+ exports.usePlaceholderJSON = WorkspaceContext.usePlaceholderJSON;
330
336
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var react = require('react');
3
+ var React = require('react');
4
4
 
5
5
  const EMPTY_ARRAY = [];
6
6
  const asReactElements = (children) => {
7
7
  const isArray = Array.isArray(children);
8
- const count = isArray ? children.length : react.Children.count(children);
9
- if (isArray && children.every(react.isValidElement)) {
8
+ const count = isArray ? children.length : React.Children.count(children);
9
+ if (isArray && children.every(React.isValidElement)) {
10
10
  return children;
11
- } else if (count === 1 && !isArray && react.isValidElement(children)) {
11
+ } else if (count === 1 && !isArray && React.isValidElement(children)) {
12
12
  return [children];
13
13
  } else if (count > 1) {
14
14
  return children;
package/cjs/useId.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var react = require('react');
3
+ var React = require('react');
4
4
 
5
5
  let vuuComponentIdCount = 0;
6
- const useId = (id) => react.useMemo(() => id ?? `vuu-${++vuuComponentIdCount}`, [id]);
6
+ const useId = (id) => React.useMemo(() => id ?? `vuu-${++vuuComponentIdCount}`, [id]);
7
7
 
8
8
  exports.useId = useId;
9
9
  //# sourceMappingURL=useId.js.map
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var react = require('react');
3
+ var React = require('react');
4
4
 
5
5
  const useLayoutEffectSkipFirst = (func, deps) => {
6
- const goodToGo = react.useRef(false);
7
- react.useLayoutEffect(() => {
6
+ const goodToGo = React.useRef(false);
7
+ React.useLayoutEffect(() => {
8
8
  if (goodToGo.current) {
9
9
  func();
10
10
  } else {
@@ -0,0 +1,10 @@
1
+ import { createContext, useContext } from 'react';
2
+
3
+ const defaultConfig = {};
4
+ const ShellContext = createContext(defaultConfig);
5
+ const useShellContext = () => {
6
+ return useContext(ShellContext);
7
+ };
8
+
9
+ export { ShellContext, useShellContext };
10
+ //# sourceMappingURL=ShellContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShellContext.js","sources":["../src/ShellContext.ts"],"sourcesContent":["import { RpcResponseHandler } from \"packages/vuu-data-types\";\nimport { LookupTableProvider } from \"packages/vuu-shell/src\";\nimport {\n DefaultColumnConfiguration,\n DefaultTableConfiguration,\n} from \"packages/vuu-table-types\";\nimport { createContext, useContext } from \"react\";\n\nexport interface ShellContextProps {\n getDefaultColumnConfig?: DefaultColumnConfiguration;\n getDefaultTableConfig?: DefaultTableConfiguration;\n getLookupValues?: LookupTableProvider;\n handleRpcResponse?: RpcResponseHandler;\n}\n\nconst defaultConfig = {};\n\nexport const ShellContext = createContext<ShellContextProps>(defaultConfig);\n\nexport const useShellContext = () => {\n return useContext(ShellContext);\n};\n"],"names":[],"mappings":";;AAeA,MAAM,gBAAgB,EAAC,CAAA;AAEV,MAAA,YAAA,GAAe,cAAiC,aAAa,EAAA;AAEnE,MAAM,kBAAkB,MAAM;AACnC,EAAA,OAAO,WAAW,YAAY,CAAA,CAAA;AAChC;;;;"}
@@ -19,19 +19,10 @@ const isTypeCompatible = (rendererType, serverDataType) => {
19
19
  return rendererType === serverDataType;
20
20
  }
21
21
  };
22
- const assertComponentRegistered = (componentType) => {
23
- if (!layoutComponentsMap.has(componentType)) {
24
- console.warn(
25
- `isContainer check on ${componentType}, which has not been registered`
26
- );
27
- }
28
- };
29
22
  const isContainer = (componentType) => {
30
- assertComponentRegistered(componentType);
31
23
  return containersSet.has(componentType);
32
24
  };
33
25
  const isView = (componentType) => {
34
- assertComponentRegistered(componentType);
35
26
  return viewsSet.has(componentType);
36
27
  };
37
28
  const isLayoutComponent = (componentType) => isContainer(componentType) || isView(componentType);
@@ -1 +1 @@
1
- {"version":3,"file":"component-registry.js","sources":["../src/component-registry.ts"],"sourcesContent":["import { DataSourceRow } from \"@vuu-ui/vuu-data-types\";\nimport {\n VuuColumnDataType,\n VuuRowDataItemType,\n} from \"@vuu-ui/vuu-protocol-types\";\nimport {\n ColumnDescriptor,\n ColumnDescriptorCustomRenderer,\n ColumnTypeRendering,\n EditValidationRule,\n HeaderCellProps,\n TableCellRendererProps,\n} from \"@vuu-ui/vuu-table-types\";\nimport { FunctionComponent as FC, HTMLAttributes } from \"react\";\nimport {\n ColumnMap,\n isColumnTypeRenderer,\n isTypeDescriptor,\n} from \"./column-utils\";\n\nexport interface CellConfigPanelProps extends HTMLAttributes<HTMLDivElement> {\n onConfigChange: () => void;\n}\n\nexport type PropertyChangeHandler = (\n propertyName: string,\n propertyValue: string | number | boolean\n) => void;\n\nexport type ColumnRenderPropsChangeHandler = (\n renderProps: ColumnTypeRendering\n) => void;\n\nexport interface ConfigurationEditorProps {\n column: ColumnDescriptorCustomRenderer;\n onChangeRendering: ColumnRenderPropsChangeHandler;\n}\n\nexport type RowClassNameGenerator = (\n row: DataSourceRow,\n columnMap: ColumnMap\n) => string | undefined;\n\nexport type RowClassGenerator = {\n id: string;\n fn: RowClassNameGenerator;\n};\n\nexport type ConfigEditorComponent = FC<CellConfigPanelProps>;\n\nconst containersSet = new Set<string>();\nconst viewsSet = new Set<string>();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst layoutComponentsMap = new Map<string, FC<any>>();\nconst cellRenderersMap = new Map<string, FC<TableCellRendererProps>>();\nconst columnHeaderRenderersMap = new Map<string, FC<HeaderCellProps>>();\nconst configEditorsMap = new Map<string, FC<ConfigurationEditorProps>>();\nconst cellConfigPanelsMap = new Map<string, ConfigEditorComponent>();\nconst editRuleValidatorsMap = new Map<string, EditRuleValidator>();\nconst optionsMap = new Map<string, CellRendererOptions>();\nconst rowClassGeneratorsMap = new Map<string, RowClassGenerator>();\n\nexport type EditRuleValidator = (\n editRule: EditValidationRule,\n value?: VuuRowDataItemType\n) => boolean | string;\n\nexport type layoutComponentType = \"container\" | \"view\";\n\nexport type ComponentType =\n | layoutComponentType\n | \"cell-renderer\"\n | \"cell-config-panel\"\n | \"column-header-content-renderer\"\n | \"column-header-label-renderer\"\n | \"component\"\n | \"data-edit-validator\"\n | \"row-class-generator\";\n\ntype CellRendererOptions = {\n configEditor?: string;\n description?: string;\n label?: string;\n serverDataType?: VuuColumnDataType | VuuColumnDataType[] | \"json\" | \"private\";\n userCanAssign?: boolean;\n};\nexport interface CellRendererDescriptor extends CellRendererOptions {\n name: string;\n}\n\nconst isTypeCompatible = (\n rendererType:\n | VuuColumnDataType\n | (VuuColumnDataType | \"json\")[]\n | \"json\"\n | \"private\"\n | undefined,\n serverDataType: VuuColumnDataType | \"json\"\n) => {\n if (rendererType === undefined || rendererType === \"private\") {\n return true;\n } else if (Array.isArray(rendererType)) {\n return rendererType.includes(serverDataType);\n } else {\n return rendererType === serverDataType;\n }\n};\n\nconst assertComponentRegistered = (componentType: string) => {\n if (!layoutComponentsMap.has(componentType)) {\n console.warn(\n `isContainer check on ${componentType}, which has not been registered`\n );\n }\n};\n\n/**\n * This check is performed during construction of UI from JSON. If component\n * is not registered, it will log a warning.\n */\nexport const isContainer = (componentType: string) => {\n assertComponentRegistered(componentType);\n return containersSet.has(componentType);\n};\n\n/**\n * This check is performed during construction of UI from JSON. If component\n * is not registered, it will log a warning.\n */\nexport const isView = (componentType: string) => {\n assertComponentRegistered(componentType);\n return viewsSet.has(componentType);\n};\n\n/**\n * This check is performed during construction of UI from JSON. If component\n * is not registered, it will log a warning.\n */\nexport const isLayoutComponent = (\n componentType: string\n): componentType is layoutComponentType =>\n isContainer(componentType) || isView(componentType);\n\nconst isCellRenderer = (\n type: ComponentType,\n component: unknown\n): component is FC<TableCellRendererProps> =>\n component !== undefined && type === \"cell-renderer\";\n\nconst isColumnHeaderContentRenderer = (\n type: ComponentType,\n component: unknown\n): component is FC<HeaderCellProps> =>\n type === \"column-header-content-renderer\";\nconst isColumnHeaderLabelRenderer = (\n type: ComponentType,\n component: unknown\n): component is FC<HeaderCellProps> => type === \"column-header-label-renderer\";\n\nconst isCellConfigPanel = (\n type: ComponentType,\n component: unknown\n): component is FC<CellConfigPanelProps> => type === \"cell-config-panel\";\n\nconst isEditRuleValidator = (\n type: ComponentType,\n component: unknown\n): component is EditRuleValidator => type === \"data-edit-validator\";\n\nconst isRowClassGenerator = (\n type: ComponentType,\n component: unknown\n): component is RowClassGenerator => type === \"row-class-generator\";\n\nexport function registerComponent(\n componentName: string,\n component: RowClassGenerator,\n componentType: \"row-class-generator\",\n options?: CellRendererOptions\n): void;\nexport function registerComponent(\n componentName: string,\n component: EditRuleValidator,\n componentType: \"data-edit-validator\",\n options?: CellRendererOptions\n): void;\nexport function registerComponent(\n componentName: string,\n // unknown won't work for us here, we'll get the default children\n // definition for FC which conflicts with some components props.\n // VoidFunctionComponent doesn't help either\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: FC<any>,\n componentType: Omit<\n ComponentType,\n \"data-edit-validator\" | \"row-class-generator\"\n >,\n options?: CellRendererOptions\n): void;\nexport function registerComponent(\n componentName: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n componentType: any,\n options?: CellRendererOptions\n): void {\n if (\n componentType === \"container\" ||\n componentType === \"view\" ||\n componentType === \"component\"\n ) {\n layoutComponentsMap.set(componentName, component);\n if (componentType === \"container\") {\n containersSet.add(componentName);\n } else if (componentType === \"view\") {\n viewsSet.add(componentName);\n }\n } else if (isCellRenderer(componentType, component)) {\n cellRenderersMap.set(componentName, component);\n } else if (isColumnHeaderContentRenderer(componentType, component)) {\n columnHeaderRenderersMap.set(componentName, component);\n } else if (isColumnHeaderLabelRenderer(componentType, component)) {\n columnHeaderRenderersMap.set(componentName, component);\n } else if (isCellConfigPanel(componentType, component)) {\n cellConfigPanelsMap.set(componentName, component);\n } else if (isEditRuleValidator(componentType, component)) {\n editRuleValidatorsMap.set(componentName, component);\n } else if (isRowClassGenerator(componentType, component)) {\n rowClassGeneratorsMap.set(componentName, component);\n }\n if (options) {\n optionsMap.set(componentName, options);\n }\n}\n\nexport const registerConfigurationEditor = (\n componentName: string,\n configurationEditor: FC<ConfigurationEditorProps>\n) => {\n configEditorsMap.set(componentName, configurationEditor);\n};\n\n// This is invoked by settings panel to allow users to assign\n// non-default, cell renderers. Ignore renderers registered\n// with the attribute userCanAssign = false\nexport const getRegisteredCellRenderers = (\n serverDataType?: VuuColumnDataType | \"json\"\n): CellRendererDescriptor[] => {\n const rendererNames = Array.from(cellRenderersMap.keys());\n const allRenderers = rendererNames\n .map<CellRendererDescriptor>((name) => ({\n name,\n ...(optionsMap.get(name) as CellRendererOptions),\n }))\n .filter(({ userCanAssign }) => userCanAssign !== false);\n if (serverDataType) {\n return allRenderers.filter((renderer) =>\n isTypeCompatible(renderer.serverDataType, serverDataType)\n );\n } else {\n return allRenderers;\n }\n};\n\nexport const getLayoutComponent = (componentName: string) => {\n const layoutComponent = layoutComponentsMap.get(componentName);\n if (layoutComponent) {\n return layoutComponent;\n } else {\n throw Error(\n `layout component ${componentName} not found in ComponentRegistry`\n );\n }\n};\n\nexport const getCellRendererOptions = (renderName: string) =>\n optionsMap.get(renderName);\n\nexport function getCellRenderer(column: ColumnDescriptor) {\n return dataCellRenderer(column);\n}\nexport function getColumnHeaderContentRenderer(column: ColumnDescriptor) {\n if (column.colHeaderContentRenderer) {\n return columnHeaderRenderersMap.get(column.colHeaderContentRenderer);\n }\n}\nexport function getColumnHeaderLabelRenderer(column: ColumnDescriptor) {\n if (column.colHeaderLabelRenderer) {\n return columnHeaderRenderersMap.get(column.colHeaderLabelRenderer);\n }\n}\nexport const getRowClassNameGenerator = (generatorId: string) =>\n rowClassGeneratorsMap.get(generatorId);\n\nexport function getConfigurationEditor(configEditor = \"\") {\n return configEditorsMap.get(configEditor);\n}\n\nexport function getCellConfigPanelRenderer(name: string) {\n return cellConfigPanelsMap.get(name);\n}\n\nexport function getEditRuleValidator(name: string) {\n return editRuleValidatorsMap.get(name);\n}\n\nfunction dataCellRenderer(column: ColumnDescriptor) {\n if (isTypeDescriptor(column.type)) {\n const { renderer } = column.type;\n if (isColumnTypeRenderer(renderer)) {\n return cellRenderersMap.get(renderer.name);\n }\n } else if (column.serverDataType === \"boolean\") {\n return cellRenderersMap.get(\"checkbox-cell\");\n } else if (column.editable) {\n // we can only offer a text input edit as a generic editor.\n // If a more specialised editor is required, user must configure\n // it in column config.\n return cellRenderersMap.get(\"input-cell\");\n }\n}\n"],"names":[],"mappings":";;AAkDA,MAAM,aAAA,uBAAoB,GAAY,EAAA,CAAA;AACtC,MAAM,QAAA,uBAAe,GAAY,EAAA,CAAA;AAGjC,MAAM,mBAAA,uBAA0B,GAAqB,EAAA,CAAA;AACrD,MAAM,gBAAA,uBAAuB,GAAwC,EAAA,CAAA;AACrE,MAAM,wBAAA,uBAA+B,GAAiC,EAAA,CAAA;AACtE,MAAM,gBAAA,uBAAuB,GAA0C,EAAA,CAAA;AACvE,MAAM,mBAAA,uBAA0B,GAAmC,EAAA,CAAA;AACnE,MAAM,qBAAA,uBAA4B,GAA+B,EAAA,CAAA;AACjE,MAAM,UAAA,uBAAiB,GAAiC,EAAA,CAAA;AACxD,MAAM,qBAAA,uBAA4B,GAA+B,EAAA,CAAA;AA8BjE,MAAM,gBAAA,GAAmB,CACvB,YAAA,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I,CAAA,QAAA,CAAS,IAAI,CAAA,CAAA;AAAA,KAC3C;AAAA,GACF,MAAA,IAAW,MAAO,CAAA,cAAA,KAAmB,SAAW,EAAA;AAC9C,IAAO,OAAA,gBAAA,CAAiB,IAAI,eAAe,CAAA,CAAA;AAAA,GAC7C,MAAA,IAAW,OAAO,QAAU,EAAA;AAI1B,IAAO,OAAA,gBAAA,CAAiB,IAAI,YAAY,CAAA,CAAA;AAAA,GAC1C;AACF;;;;"}
1
+ {"version":3,"file":"component-registry.js","sources":["../src/component-registry.ts"],"sourcesContent":["import { DataSourceRow } from \"@vuu-ui/vuu-data-types\";\nimport {\n VuuColumnDataType,\n VuuRowDataItemType,\n} from \"@vuu-ui/vuu-protocol-types\";\nimport {\n ColumnDescriptor,\n ColumnDescriptorCustomRenderer,\n ColumnTypeRendering,\n EditValidationRule,\n HeaderCellProps,\n TableCellRendererProps,\n} from \"@vuu-ui/vuu-table-types\";\nimport { FunctionComponent as FC, HTMLAttributes } from \"react\";\nimport {\n ColumnMap,\n isColumnTypeRenderer,\n isTypeDescriptor,\n} from \"./column-utils\";\n\nexport interface CellConfigPanelProps extends HTMLAttributes<HTMLDivElement> {\n onConfigChange: () => void;\n}\n\nexport type PropertyChangeHandler = (\n propertyName: string,\n propertyValue: string | number | boolean\n) => void;\n\nexport type ColumnRenderPropsChangeHandler = (\n renderProps: ColumnTypeRendering\n) => void;\n\nexport interface ConfigurationEditorProps {\n column: ColumnDescriptorCustomRenderer;\n onChangeRendering: ColumnRenderPropsChangeHandler;\n}\n\nexport type RowClassNameGenerator = (\n row: DataSourceRow,\n columnMap: ColumnMap\n) => string | undefined;\n\nexport type RowClassGenerator = {\n id: string;\n fn: RowClassNameGenerator;\n};\n\nexport type ConfigEditorComponent = FC<CellConfigPanelProps>;\n\nconst containersSet = new Set<string>();\nconst viewsSet = new Set<string>();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst layoutComponentsMap = new Map<string, FC<any>>();\nconst cellRenderersMap = new Map<string, FC<TableCellRendererProps>>();\nconst columnHeaderRenderersMap = new Map<string, FC<HeaderCellProps>>();\nconst configEditorsMap = new Map<string, FC<ConfigurationEditorProps>>();\nconst cellConfigPanelsMap = new Map<string, ConfigEditorComponent>();\nconst editRuleValidatorsMap = new Map<string, EditRuleValidator>();\nconst optionsMap = new Map<string, CellRendererOptions>();\nconst rowClassGeneratorsMap = new Map<string, RowClassGenerator>();\n\nexport type EditRuleValidator = (\n editRule: EditValidationRule,\n value?: VuuRowDataItemType\n) => boolean | string;\n\nexport type layoutComponentType = \"container\" | \"view\";\n\nexport type ComponentType =\n | layoutComponentType\n | \"cell-renderer\"\n | \"cell-config-panel\"\n | \"column-header-content-renderer\"\n | \"column-header-label-renderer\"\n | \"component\"\n | \"data-edit-validator\"\n | \"row-class-generator\";\n\ntype CellRendererOptions = {\n configEditor?: string;\n description?: string;\n label?: string;\n serverDataType?: VuuColumnDataType | VuuColumnDataType[] | \"json\" | \"private\";\n userCanAssign?: boolean;\n};\nexport interface CellRendererDescriptor extends CellRendererOptions {\n name: string;\n}\n\nconst isTypeCompatible = (\n rendererType:\n | VuuColumnDataType\n | (VuuColumnDataType | \"json\")[]\n | \"json\"\n | \"private\"\n | undefined,\n serverDataType: VuuColumnDataType | \"json\"\n) => {\n if (rendererType === undefined || rendererType === \"private\") {\n return true;\n } else if (Array.isArray(rendererType)) {\n return rendererType.includes(serverDataType);\n } else {\n return rendererType === serverDataType;\n }\n};\n\n/**\n * This check is performed during construction of UI from JSON. If component\n * is not registered, it will log a warning.\n */\nexport const isContainer = (componentType: string) => {\n return containersSet.has(componentType);\n};\n\n/**\n * This check is performed during construction of UI from JSON. If component\n * is not registered, it will log a warning.\n */\nexport const isView = (componentType: string) => {\n return viewsSet.has(componentType);\n};\n\n/**\n * This check is performed during construction of UI from JSON. If component\n * is not registered, it will log a warning.\n */\nexport const isLayoutComponent = (\n componentType: string\n): componentType is layoutComponentType =>\n isContainer(componentType) || isView(componentType);\n\nconst isCellRenderer = (\n type: ComponentType,\n component: unknown\n): component is FC<TableCellRendererProps> =>\n component !== undefined && type === \"cell-renderer\";\n\nconst isColumnHeaderContentRenderer = (\n type: ComponentType,\n component: unknown\n): component is FC<HeaderCellProps> =>\n type === \"column-header-content-renderer\";\nconst isColumnHeaderLabelRenderer = (\n type: ComponentType,\n component: unknown\n): component is FC<HeaderCellProps> => type === \"column-header-label-renderer\";\n\nconst isCellConfigPanel = (\n type: ComponentType,\n component: unknown\n): component is FC<CellConfigPanelProps> => type === \"cell-config-panel\";\n\nconst isEditRuleValidator = (\n type: ComponentType,\n component: unknown\n): component is EditRuleValidator => type === \"data-edit-validator\";\n\nconst isRowClassGenerator = (\n type: ComponentType,\n component: unknown\n): component is RowClassGenerator => type === \"row-class-generator\";\n\nexport function registerComponent(\n componentName: string,\n component: RowClassGenerator,\n componentType: \"row-class-generator\",\n options?: CellRendererOptions\n): void;\nexport function registerComponent(\n componentName: string,\n component: EditRuleValidator,\n componentType: \"data-edit-validator\",\n options?: CellRendererOptions\n): void;\nexport function registerComponent(\n componentName: string,\n // unknown won't work for us here, we'll get the default children\n // definition for FC which conflicts with some components props.\n // VoidFunctionComponent doesn't help either\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: FC<any>,\n componentType: Omit<\n ComponentType,\n \"data-edit-validator\" | \"row-class-generator\"\n >,\n options?: CellRendererOptions\n): void;\nexport function registerComponent(\n componentName: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n componentType: any,\n options?: CellRendererOptions\n): void {\n if (\n componentType === \"container\" ||\n componentType === \"view\" ||\n componentType === \"component\"\n ) {\n layoutComponentsMap.set(componentName, component);\n if (componentType === \"container\") {\n containersSet.add(componentName);\n } else if (componentType === \"view\") {\n viewsSet.add(componentName);\n }\n } else if (isCellRenderer(componentType, component)) {\n cellRenderersMap.set(componentName, component);\n } else if (isColumnHeaderContentRenderer(componentType, component)) {\n columnHeaderRenderersMap.set(componentName, component);\n } else if (isColumnHeaderLabelRenderer(componentType, component)) {\n columnHeaderRenderersMap.set(componentName, component);\n } else if (isCellConfigPanel(componentType, component)) {\n cellConfigPanelsMap.set(componentName, component);\n } else if (isEditRuleValidator(componentType, component)) {\n editRuleValidatorsMap.set(componentName, component);\n } else if (isRowClassGenerator(componentType, component)) {\n rowClassGeneratorsMap.set(componentName, component);\n }\n if (options) {\n optionsMap.set(componentName, options);\n }\n}\n\nexport const registerConfigurationEditor = (\n componentName: string,\n configurationEditor: FC<ConfigurationEditorProps>\n) => {\n configEditorsMap.set(componentName, configurationEditor);\n};\n\n// This is invoked by settings panel to allow users to assign\n// non-default, cell renderers. Ignore renderers registered\n// with the attribute userCanAssign = false\nexport const getRegisteredCellRenderers = (\n serverDataType?: VuuColumnDataType | \"json\"\n): CellRendererDescriptor[] => {\n const rendererNames = Array.from(cellRenderersMap.keys());\n const allRenderers = rendererNames\n .map<CellRendererDescriptor>((name) => ({\n name,\n ...(optionsMap.get(name) as CellRendererOptions),\n }))\n .filter(({ userCanAssign }) => userCanAssign !== false);\n if (serverDataType) {\n return allRenderers.filter((renderer) =>\n isTypeCompatible(renderer.serverDataType, serverDataType)\n );\n } else {\n return allRenderers;\n }\n};\n\nexport const getLayoutComponent = (componentName: string) => {\n const layoutComponent = layoutComponentsMap.get(componentName);\n if (layoutComponent) {\n return layoutComponent;\n } else {\n throw Error(\n `layout component ${componentName} not found in ComponentRegistry`\n );\n }\n};\n\nexport const getCellRendererOptions = (renderName: string) =>\n optionsMap.get(renderName);\n\nexport function getCellRenderer(column: ColumnDescriptor) {\n return dataCellRenderer(column);\n}\nexport function getColumnHeaderContentRenderer(column: ColumnDescriptor) {\n if (column.colHeaderContentRenderer) {\n return columnHeaderRenderersMap.get(column.colHeaderContentRenderer);\n }\n}\nexport function getColumnHeaderLabelRenderer(column: ColumnDescriptor) {\n if (column.colHeaderLabelRenderer) {\n return columnHeaderRenderersMap.get(column.colHeaderLabelRenderer);\n }\n}\nexport const getRowClassNameGenerator = (generatorId: string) =>\n rowClassGeneratorsMap.get(generatorId);\n\nexport function getConfigurationEditor(configEditor = \"\") {\n return configEditorsMap.get(configEditor);\n}\n\nexport function getCellConfigPanelRenderer(name: string) {\n return cellConfigPanelsMap.get(name);\n}\n\nexport function getEditRuleValidator(name: string) {\n return editRuleValidatorsMap.get(name);\n}\n\nfunction dataCellRenderer(column: ColumnDescriptor) {\n if (isTypeDescriptor(column.type)) {\n const { renderer } = column.type;\n if (isColumnTypeRenderer(renderer)) {\n return cellRenderersMap.get(renderer.name);\n }\n } else if (column.serverDataType === \"boolean\") {\n return cellRenderersMap.get(\"checkbox-cell\");\n } else if (column.editable) {\n // we can only offer a text input edit as a generic editor.\n // If a more specialised editor is required, user must configure\n // it in column config.\n return cellRenderersMap.get(\"input-cell\");\n }\n}\n"],"names":[],"mappings":";;AAkDA,MAAM,aAAA,uBAAoB,GAAY,EAAA,CAAA;AACtC,MAAM,QAAA,uBAAe,GAAY,EAAA,CAAA;AAGjC,MAAM,mBAAA,uBAA0B,GAAqB,EAAA,CAAA;AACrD,MAAM,gBAAA,uBAAuB,GAAwC,EAAA,CAAA;AACrE,MAAM,wBAAA,uBAA+B,GAAiC,EAAA,CAAA;AACtE,MAAM,gBAAA,uBAAuB,GAA0C,EAAA,CAAA;AACvE,MAAM,mBAAA,uBAA0B,GAAmC,EAAA,CAAA;AACnE,MAAM,qBAAA,uBAA4B,GAA+B,EAAA,CAAA;AACjE,MAAM,UAAA,uBAAiB,GAAiC,EAAA,CAAA;AACxD,MAAM,qBAAA,uBAA4B,GAA+B,EAAA,CAAA;AA8BjE,MAAM,gBAAA,GAAmB,CACvB,YAAA,EAMA,cACG,KAAA;AACH,EAAI,IAAA,YAAA,KAAiB,KAAa,CAAA,IAAA,YAAA,KAAiB,SAAW,EAAA;AAC5D,IAAO,OAAA,IAAA,CAAA;AAAA,GACE,MAAA,IAAA,KAAA,CAAM,OAAQ,CAAA,YAAY,CAAG,EAAA;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AyB,GAAI,CAAA,MAAA,CAAO,sBAAsB,CAAA,CAAA;AAAA,GACnE;AACF,CAAA;AACO,MAAM,wBAA2B,GAAA,CAAC,WACvC,KAAA,qBAAA,CAAsB,IAAI,WAAW,EAAA;AAEvB,SAAA,sBAAA,CAAuB,eAAe,EAAI,EAAA;AACxD,EAAO,OAAA,gBAAA,CAAiB,IAAI,YAAY,CAAA,CAAA;AAC1C,CAAA;AAEO,SAAS,2BAA2B,IAAc,EAAA;AACvD,EAAO,OAAA,mBAAA,CAAoB,IAAI,IAAI,CAAA,CAAA;AACrC,CAAA;AAEO,SAAS,qBAAqB,IAAc,EAAA;AACjD,EAAO,OAAA,qBAAA,CAAsB,IAAI,IAAI,CAAA,CAAA;AACvC,CAAA;AAEA,SAAS,iBAAiB,MAA0B,EAAA;AAClD,EAAI,IAAA,gBAAA,CAAiB,MAAO,CAAA,IAAI,CAAG,EAAA;AACjC,IAAM,MAAA,EAAE,QAAS,EAAA,GAAI,MAAO,CAAA,IAAA,CAAA;AAC5B,IAAI,IAAA,oBAAA,CAAqB,QAAQ,CAAG,EAAA;AAClC,MAAO,OAAA,gBAAA,CAAiB,GAAI,CAAA,QAAA,CAAS,IAAI,CAAA,CAAA;AAAA,KAC3C;AAAA,GACF,MAAA,IAAW,MAAO,CAAA,cAAA,KAAmB,SAAW,EAAA;AAC9C,IAAO,OAAA,gBAAA,CAAiB,IAAI,eAAe,CAAA,CAAA;AAAA,GAC7C,MAAA,IAAW,OAAO,QAAU,EAAA;AAI1B,IAAO,OAAA,gBAAA,CAAiB,IAAI,YAAY,CAAA,CAAA;AAAA,GAC1C;AACF;;;;"}
@@ -0,0 +1,17 @@
1
+ import React, { useContext } from 'react';
2
+
3
+ const WorkspaceContext = React.createContext({
4
+ getApplicationSettings: () => void 0,
5
+ layoutMetadata: [],
6
+ saveLayout: () => void 0,
7
+ saveApplicationLayout: () => void 0,
8
+ saveApplicationSettings: () => void 0,
9
+ loadLayoutById: () => void 0
10
+ });
11
+ const usePlaceholderJSON = () => {
12
+ const { layoutPlaceholderJSON } = useContext(WorkspaceContext);
13
+ return layoutPlaceholderJSON;
14
+ };
15
+
16
+ export { WorkspaceContext, usePlaceholderJSON };
17
+ //# sourceMappingURL=WorkspaceContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkspaceContext.js","sources":["../../src/context-definitions/WorkspaceContext.tsx"],"sourcesContent":["import React, { useContext } from \"react\";\nimport {\n ApplicationSetting,\n ApplicationSettings,\n LayoutJSON,\n} from \"../json-types\";\nimport { LayoutMetadata, LayoutMetadataDto } from \"../layout-types\";\n\nexport interface WorkspaceContextProps {\n layoutMetadata: LayoutMetadata[];\n layoutPlaceholderJSON?: LayoutJSON;\n getApplicationSettings: (\n key?: keyof ApplicationSettings\n ) => ApplicationSettings | ApplicationSetting | undefined;\n loadLayoutById: (id: string) => void;\n saveApplicationSettings: (\n settings: ApplicationSettings | ApplicationSetting,\n key?: keyof ApplicationSettings\n ) => void;\n saveLayout: (n: LayoutMetadataDto) => void;\n saveApplicationLayout: (layout: LayoutJSON) => void;\n workspaceJSON?: LayoutJSON;\n}\n\nexport const WorkspaceContext = React.createContext<WorkspaceContextProps>({\n getApplicationSettings: () => undefined,\n layoutMetadata: [],\n saveLayout: () => undefined,\n saveApplicationLayout: () => undefined,\n saveApplicationSettings: () => undefined,\n loadLayoutById: () => undefined,\n});\n\nexport const usePlaceholderJSON = () => {\n const { layoutPlaceholderJSON } = useContext(WorkspaceContext);\n return layoutPlaceholderJSON;\n};\n"],"names":[],"mappings":";;AAwBa,MAAA,gBAAA,GAAmB,MAAM,aAAqC,CAAA;AAAA,EACzE,wBAAwB,MAAM,KAAA,CAAA;AAAA,EAC9B,gBAAgB,EAAC;AAAA,EACjB,YAAY,MAAM,KAAA,CAAA;AAAA,EAClB,uBAAuB,MAAM,KAAA,CAAA;AAAA,EAC7B,yBAAyB,MAAM,KAAA,CAAA;AAAA,EAC/B,gBAAgB,MAAM,KAAA,CAAA;AACxB,CAAC,EAAA;AAEM,MAAM,qBAAqB,MAAM;AACtC,EAAA,MAAM,EAAE,qBAAA,EAA0B,GAAA,UAAA,CAAW,gBAAgB,CAAA,CAAA;AAC7D,EAAO,OAAA,qBAAA,CAAA;AACT;;;;"}
package/esm/index.js CHANGED
@@ -51,4 +51,6 @@ export { isNotNullOrUndefined } from './ts-utils.js';
51
51
  export { getUrlParameter, hasUrlParameter } from './url-utils.js';
52
52
  export { useId } from './useId.js';
53
53
  export { useLayoutEffectSkipFirst } from './useLayoutEffectSkipFirst.js';
54
+ export { ShellContext, useShellContext } from './ShellContext.js';
55
+ export { WorkspaceContext, usePlaceholderJSON } from './context-definitions/WorkspaceContext.js';
54
56
  //# sourceMappingURL=index.js.map
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
- "version": "0.8.76",
2
+ "version": "0.8.77",
3
3
  "author": "heswell",
4
4
  "license": "Apache-2.0",
5
5
  "types": "types/index.d.ts",
6
6
  "devDependencies": {
7
- "@vuu-ui/vuu-data-types": "0.8.76",
8
- "@vuu-ui/vuu-table-types": "0.8.76",
9
- "@vuu-ui/vuu-filter-types": "0.8.76",
10
- "@vuu-ui/vuu-protocol-types": "0.8.76"
7
+ "@vuu-ui/vuu-data-types": "0.8.77",
8
+ "@vuu-ui/vuu-table-types": "0.8.77",
9
+ "@vuu-ui/vuu-filter-types": "0.8.77",
10
+ "@vuu-ui/vuu-protocol-types": "0.8.77"
11
11
  },
12
12
  "peerDependencies": {
13
13
  "@internationalized/date": "^3.0.0",
14
- "@vuu-ui/vuu-filter-parser": "0.8.76",
14
+ "@vuu-ui/vuu-filter-parser": "0.8.77",
15
15
  "clsx": "^2.0.0",
16
16
  "react": ">=17.0.2",
17
17
  "react-dom": ">=17.0.2"
@@ -0,0 +1,10 @@
1
+ import type { VuuTable } from "@vuu-ui/vuu-protocol-types";
2
+ import { ListOption } from "@vuu-ui/vuu-table-types";
3
+ import { ShellContextProps } from "@vuu-ui/vuu-utils";
4
+ import { ReactElement, ReactNode } from "react";
5
+ export type LookupTableProvider = (table: VuuTable) => ListOption[];
6
+ export interface ShellProviderProps {
7
+ children: ReactNode;
8
+ value?: ShellContextProps;
9
+ }
10
+ export declare const ShellContextProvider: ({ children, value, }: ShellProviderProps) => ReactElement;
@@ -0,0 +1,6 @@
1
+ import { ThemeMode } from "@vuu-ui/vuu-utils";
2
+ import { HTMLAttributes } from "react";
3
+ export interface AppHeaderProps extends HTMLAttributes<HTMLDivElement> {
4
+ themeMode?: ThemeMode;
5
+ }
6
+ export declare const AppHeader: ({ className: classNameProp, themeMode: _, ...htmlAttributes }: AppHeaderProps) => JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './AppHeader';
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import type { Settings, VuuUser } from "@vuu-ui/vuu-utils";
3
+ import { VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
4
+ import { SettingsSchema } from "../user-settings";
5
+ export interface ApplicationContextProps {
6
+ onUserSettingChanged: (propertyName: string, value: VuuRowDataItemType) => void;
7
+ loginUrl?: string;
8
+ userSettings?: Settings;
9
+ userSettingsSchema?: SettingsSchema;
10
+ user: VuuUser;
11
+ }
12
+ export declare const ApplicationContext: import("react").Context<ApplicationContextProps>;
@@ -0,0 +1,19 @@
1
+ import { VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
2
+ import { Density, ThemeContextProps } from "@salt-ds/core";
3
+ import { ReactElement, ReactNode } from "react";
4
+ import { ApplicationContextProps } from "./ApplicationContext";
5
+ export interface ApplicationProviderProps extends Partial<Pick<ThemeContextProps, "theme" | "mode">>, Partial<Omit<ApplicationContextProps, "userSettings">> {
6
+ children: ReactNode;
7
+ density?: Density;
8
+ }
9
+ export declare const ApplicationProvider: ({ children, density: densityProp, loginUrl, mode, theme, userSettingsSchema: userSettingsSchema, user, }: ApplicationProviderProps) => ReactElement | null;
10
+ export declare const useApplicationUser: () => import("packages/vuu-utils/src").VuuUser;
11
+ export declare const useLoginUrl: () => string | undefined;
12
+ export declare const useApplicationSettings: () => {
13
+ onUserSettingChanged: (propertyName: string, value: VuuRowDataItemType) => void;
14
+ userSettings: import("packages/vuu-utils/src").Settings | undefined;
15
+ userSettingsSchema: import("packages/vuu-shell/src").SettingsSchema | undefined;
16
+ };
17
+ export declare const useUserSetting: () => {
18
+ userSettings: import("packages/vuu-utils/src").Settings | undefined;
19
+ };
@@ -0,0 +1 @@
1
+ export * from "./ApplicationProvider";
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ type connectionStatus = "connected" | "reconnected" | "connecting" | "disconnected";
3
+ interface ConnectionStatusProps {
4
+ connectionStatus: connectionStatus;
5
+ className?: string;
6
+ props?: unknown;
7
+ element?: string;
8
+ }
9
+ export declare const ConnectionStatusIndicator: ({ connectionStatus, className, element, ...props }: ConnectionStatusProps) => JSX.Element;
10
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./ConnectionStatusIndicator";
@@ -0,0 +1,21 @@
1
+ import { ServerAPI } from "@vuu-ui/vuu-data-remote";
2
+ import { DataSource, DataSourceConstructorProps } from "@vuu-ui/vuu-data-types";
3
+ import { ReactNode } from "react";
4
+ export type DataSourceConstructor = {
5
+ new (props: DataSourceConstructorProps): DataSource;
6
+ };
7
+ export interface DataSourceContextProps {
8
+ isLocalData: boolean;
9
+ VuuDataSource: DataSourceConstructor;
10
+ vuuModuleName?: string;
11
+ getServerAPI: () => Promise<Pick<ServerAPI, "getTableList" | "getTableSchema">>;
12
+ }
13
+ /**
14
+ * If a client is adding a DataSOurceProvider, it will ususlly be
15
+ * to install local test data, so we default isLocalData to true
16
+ */
17
+ export declare const DataSourceProvider: ({ children, getServerAPI, isLocalData, VuuDataSource, vuuModuleName, }: Omit<DataSourceContextProps, "isLocalData"> & {
18
+ children: ReactNode;
19
+ isLocalData?: boolean | undefined;
20
+ }) => JSX.Element;
21
+ export declare const useDataSource: () => DataSourceContextProps;
@@ -0,0 +1 @@
1
+ export * from "./DataSourceProvider";
@@ -0,0 +1,26 @@
1
+ import { ViewConfig } from "@vuu-ui/vuu-utils";
2
+ import React from "react";
3
+ export interface FeatureProps<P extends object | undefined = object> {
4
+ /**
5
+ props that will be passed to the lazily loaded component.
6
+ */
7
+ ComponentProps?: P;
8
+ ViewProps?: ViewConfig;
9
+ css?: string;
10
+ height?: number;
11
+ title?: string;
12
+ /**
13
+ The url of javascript bundle to lazily load. Bundle must provide a default export
14
+ and that export must be a React component.
15
+ */
16
+ url: string;
17
+ width?: number;
18
+ }
19
+ declare function RawFeature<Params extends object | undefined>({ url, css, ComponentProps: params, ...props }: FeatureProps<Params>): JSX.Element;
20
+ /**
21
+ Feature is a wrapper around React Lazy Loading. It will load a component
22
+ from the given url. That url must resolve to a javascript bundle with a
23
+ single default export. That export must be a React component.
24
+ */
25
+ export declare const Feature: React.MemoExoticComponent<typeof RawFeature>;
26
+ export {};
@@ -0,0 +1,13 @@
1
+ import React, { ErrorInfo, ReactNode } from "react";
2
+ import { FeatureProps } from "./Feature";
3
+ export interface FeatureErrorBoundaryProps extends FeatureProps {
4
+ children: ReactNode;
5
+ }
6
+ export declare class FeatureErrorBoundary extends React.Component<FeatureErrorBoundaryProps, any> {
7
+ constructor(props: FeatureErrorBoundaryProps);
8
+ static getDerivedStateFromError(error: Error): {
9
+ errorMessage: string;
10
+ };
11
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
12
+ render(): React.ReactNode;
13
+ }
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const Loader: () => JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './Feature';
@@ -0,0 +1,7 @@
1
+ import { HTMLAttributes } from "react";
2
+ import { FeatureProps } from "../feature/Feature";
3
+ export type GroupedFeatureProps<P extends object | undefined = object> = Record<string, FeatureProps<P>[]>;
4
+ export interface FeatureListProps<P extends object | undefined = object> extends HTMLAttributes<HTMLDivElement> {
5
+ features: FeatureProps<P>[] | GroupedFeatureProps<P>;
6
+ }
7
+ export declare const FeatureList: ({ features, title, ...htmlAttributes }: FeatureListProps) => JSX.Element;
@@ -0,0 +1 @@
1
+ export * from "./FeatureList";
@@ -0,0 +1,14 @@
1
+ import { Features, FilterTableFeatureProps } from "@vuu-ui/vuu-utils";
2
+ import { ReactElement, ReactNode } from "react";
3
+ import { FeatureProps } from "../feature/Feature";
4
+ export interface FeatureContextProps {
5
+ features: FeatureProps[];
6
+ tableFeatures: FeatureProps<FilterTableFeatureProps>[];
7
+ }
8
+ export interface FeatureProviderProps extends Partial<FeatureContextProps> {
9
+ children: ReactNode;
10
+ configuredFeatures: Features;
11
+ }
12
+ export declare const FeatureProvider: ({ children, configuredFeatures, features: featuresProp, tableFeatures: tableFeaturesProp, }: FeatureProviderProps) => ReactElement;
13
+ export type FeaturesHook = (props?: Partial<FeatureContextProps>) => FeatureContextProps;
14
+ export declare const useFeatures: FeaturesHook;