@vuu-ui/vuu-utils 0.8.78 → 0.8.79
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.
- package/cjs/ShellContext.js.map +1 -1
- package/cjs/feature-utils.js +1 -1
- package/cjs/feature-utils.js.map +1 -1
- package/esm/ShellContext.js.map +1 -1
- package/esm/feature-utils.js +1 -1
- package/esm/feature-utils.js.map +1 -1
- package/package.json +6 -6
- package/types/{vuu-utils/src/ShellContext.d.ts → ShellContext.d.ts} +2 -2
- package/types/{vuu-utils/src/feature-utils.d.ts → feature-utils.d.ts} +18 -1
- package/types/vuu-shell/src/ShellContextProvider.d.ts +0 -10
- package/types/vuu-shell/src/app-header/AppHeader.d.ts +0 -6
- package/types/vuu-shell/src/app-header/index.d.ts +0 -1
- package/types/vuu-shell/src/application-provider/ApplicationContext.d.ts +0 -12
- package/types/vuu-shell/src/application-provider/ApplicationProvider.d.ts +0 -19
- package/types/vuu-shell/src/application-provider/index.d.ts +0 -1
- package/types/vuu-shell/src/connection-status/ConnectionStatusIndicator.d.ts +0 -10
- package/types/vuu-shell/src/connection-status/index.d.ts +0 -1
- package/types/vuu-shell/src/datasource-provider/DataSourceProvider.d.ts +0 -21
- package/types/vuu-shell/src/datasource-provider/index.d.ts +0 -1
- package/types/vuu-shell/src/feature/Feature.d.ts +0 -26
- package/types/vuu-shell/src/feature/FeatureErrorBoundary.d.ts +0 -13
- package/types/vuu-shell/src/feature/Loader.d.ts +0 -2
- package/types/vuu-shell/src/feature/index.d.ts +0 -1
- package/types/vuu-shell/src/feature-list/FeatureList.d.ts +0 -7
- package/types/vuu-shell/src/feature-list/index.d.ts +0 -1
- package/types/vuu-shell/src/feature-provider/FeatureProvider.d.ts +0 -14
- package/types/vuu-shell/src/feature-provider/index.d.ts +0 -2
- package/types/vuu-shell/src/feature-provider/useVuuFeatures.d.ts +0 -9
- package/types/vuu-shell/src/index.d.ts +0 -16
- package/types/vuu-shell/src/left-nav/LeftNav.d.ts +0 -18
- package/types/vuu-shell/src/left-nav/index.d.ts +0 -1
- package/types/vuu-shell/src/login/LoginPanel.d.ts +0 -7
- package/types/vuu-shell/src/login/VuuLogo.d.ts +0 -2
- package/types/vuu-shell/src/login/index.d.ts +0 -2
- package/types/vuu-shell/src/login/login-utils.d.ts +0 -4
- package/types/vuu-shell/src/persistence-manager/LocalPersistenceManager.d.ts +0 -21
- package/types/vuu-shell/src/persistence-manager/PersistenceManager.d.ts +0 -66
- package/types/vuu-shell/src/persistence-manager/PersistenceProvider.d.ts +0 -11
- package/types/vuu-shell/src/persistence-manager/RemotePersistenceManager.d.ts +0 -23
- package/types/vuu-shell/src/persistence-manager/StaticPersistenceManager.d.ts +0 -21
- package/types/vuu-shell/src/persistence-manager/index.d.ts +0 -5
- package/types/vuu-shell/src/shell-layout-templates/context-panel/ContextPanel.d.ts +0 -11
- package/types/vuu-shell/src/shell-layout-templates/context-panel/index.d.ts +0 -1
- package/types/vuu-shell/src/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.d.ts +0 -2
- package/types/vuu-shell/src/shell-layout-templates/index.d.ts +0 -3
- package/types/vuu-shell/src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.d.ts +0 -2
- package/types/vuu-shell/src/shell-layout-templates/side-panel/SidePanel.d.ts +0 -8
- package/types/vuu-shell/src/shell-layout-templates/side-panel/index.d.ts +0 -1
- package/types/vuu-shell/src/shell-layout-templates/simple-content-pane/useSimpleContentPane.d.ts +0 -2
- package/types/vuu-shell/src/shell-layout-templates/useShellLayout.d.ts +0 -41
- package/types/vuu-shell/src/shell.d.ts +0 -15
- package/types/vuu-shell/src/theme-switch/ThemeSwitch.d.ts +0 -8
- package/types/vuu-shell/src/theme-switch/index.d.ts +0 -1
- package/types/vuu-shell/src/user-settings/SettingsForm.d.ts +0 -47
- package/types/vuu-shell/src/user-settings/UserSettingsPanel.d.ts +0 -3
- package/types/vuu-shell/src/user-settings/index.d.ts +0 -2
- package/types/vuu-shell/src/workspace-management/LayoutList.d.ts +0 -2
- package/types/vuu-shell/src/workspace-management/LayoutTile.d.ts +0 -7
- package/types/vuu-shell/src/workspace-management/SaveLayoutPanel.d.ts +0 -10
- package/types/vuu-shell/src/workspace-management/WorkspaceProvider.d.ts +0 -53
- package/types/vuu-shell/src/workspace-management/defaultWorkspaceJSON.d.ts +0 -9
- package/types/vuu-shell/src/workspace-management/index.d.ts +0 -5
- package/types/vuu-shell/src/workspace-management/screenshot-utils.d.ts +0 -6
- package/types/vuu-shell/src/workspace-management/useWorkspaceContextMenuItems.d.ts +0 -5
- /package/types/{vuu-utils/src/DataWindow.d.ts → DataWindow.d.ts} +0 -0
- /package/types/{vuu-utils/src/ThemeProvider.d.ts → ThemeProvider.d.ts} +0 -0
- /package/types/{vuu-utils/src/array-utils.d.ts → array-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/box-utils.d.ts → box-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/broadcast-channel.d.ts → broadcast-channel.d.ts} +0 -0
- /package/types/{vuu-utils/src/column-utils.d.ts → column-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/common-types.d.ts → common-types.d.ts} +0 -0
- /package/types/{vuu-utils/src/component-registry.d.ts → component-registry.d.ts} +0 -0
- /package/types/{vuu-utils/src/context-definitions → context-definitions}/WorkspaceContext.d.ts +0 -0
- /package/types/{vuu-utils/src/cookie-utils.d.ts → cookie-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/css-utils.d.ts → css-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/data-utils.d.ts → data-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/datasource-action-utils.d.ts → datasource-action-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/datasource-utils.d.ts → datasource-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/date → date}/date-utils.d.ts +0 -0
- /package/types/{vuu-utils/src/date → date}/dateTimePattern.d.ts +0 -0
- /package/types/{vuu-utils/src/date → date}/formatter.d.ts +0 -0
- /package/types/{vuu-utils/src/date → date}/index.d.ts +0 -0
- /package/types/{vuu-utils/src/date → date}/types.d.ts +0 -0
- /package/types/{vuu-utils/src/debug-utils.d.ts → debug-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/event-emitter.d.ts → event-emitter.d.ts} +0 -0
- /package/types/{vuu-utils/src/filters → filters}/filterAsQuery.d.ts +0 -0
- /package/types/{vuu-utils/src/filters → filters}/index.d.ts +0 -0
- /package/types/{vuu-utils/src/filters → filters}/utils.d.ts +0 -0
- /package/types/{vuu-utils/src/form-utils.d.ts → form-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/formatting-utils.d.ts → formatting-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/getUniqueId.d.ts → getUniqueId.d.ts} +0 -0
- /package/types/{vuu-utils/src/group-utils.d.ts → group-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/html-utils.d.ts → html-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/index.d.ts → index.d.ts} +0 -0
- /package/types/{vuu-utils/src/input-utils.d.ts → input-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/invariant.d.ts → invariant.d.ts} +0 -0
- /package/types/{vuu-utils/src/itemToString.d.ts → itemToString.d.ts} +0 -0
- /package/types/{vuu-utils/src/json-types.d.ts → json-types.d.ts} +0 -0
- /package/types/{vuu-utils/src/json-utils.d.ts → json-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/keyboard-utils.d.ts → keyboard-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/keyset.d.ts → keyset.d.ts} +0 -0
- /package/types/{vuu-utils/src/layout-types.d.ts → layout-types.d.ts} +0 -0
- /package/types/{vuu-utils/src/list-utils.d.ts → list-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/local-storage-utils.d.ts → local-storage-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/logging-utils.d.ts → logging-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/menu-utils.d.ts → menu-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/module-utils.d.ts → module-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/nanoid → nanoid}/index.d.ts +0 -0
- /package/types/{vuu-utils/src/perf-utils.d.ts → perf-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/protocol-message-utils.d.ts → protocol-message-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/range-utils.d.ts → range-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/react-utils.d.ts → react-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/round-decimal.d.ts → round-decimal.d.ts} +0 -0
- /package/types/{vuu-utils/src/row-utils.d.ts → row-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/selection-utils.d.ts → selection-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/shell-layout-types.d.ts → shell-layout-types.d.ts} +0 -0
- /package/types/{vuu-utils/src/sort-utils.d.ts → sort-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/table-schema-utils.d.ts → table-schema-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/text-utils.d.ts → text-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/ts-utils.d.ts → ts-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/url-utils.d.ts → url-utils.d.ts} +0 -0
- /package/types/{vuu-utils/src/useId.d.ts → useId.d.ts} +0 -0
- /package/types/{vuu-utils/src/useLayoutEffectSkipFirst.d.ts → useLayoutEffectSkipFirst.d.ts} +0 -0
- /package/types/{vuu-utils/src/user-types.d.ts → user-types.d.ts} +0 -0
package/cjs/ShellContext.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShellContext.js","sources":["../src/ShellContext.ts"],"sourcesContent":["import { RpcResponseHandler } from \"
|
|
1
|
+
{"version":3,"file":"ShellContext.js","sources":["../src/ShellContext.ts"],"sourcesContent":["import { RpcResponseHandler } from \"@vuu-ui/vuu-data-types\";\nimport {\n DefaultColumnConfiguration,\n DefaultTableConfiguration,\n} from \"packages/vuu-table-types\";\nimport { createContext, useContext } from \"react\";\nimport { LookupTableProvider } from \"./feature-utils\";\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;;;;;"}
|
package/cjs/feature-utils.js
CHANGED
|
@@ -7,7 +7,7 @@ const env = process.env.NODE_ENV;
|
|
|
7
7
|
const isCustomFeature = (feature) => feature.leftNavLocation === "vuu-features";
|
|
8
8
|
const isWildcardSchema = (schema) => schema === "*";
|
|
9
9
|
const isTableSchema = (schema) => typeof schema === "object" && typeof schema.module === "string" && typeof schema.table === "string";
|
|
10
|
-
const hasFilterTableFeatureProps = (props) => "tableSchema" in
|
|
10
|
+
const hasFilterTableFeatureProps = (props) => typeof props.ComponentProps === "object" && props.ComponentProps !== null && "tableSchema" in props.ComponentProps;
|
|
11
11
|
const byModule = (schema1, schema2) => {
|
|
12
12
|
const m1 = schema1.table.module.toLowerCase();
|
|
13
13
|
const m2 = schema2.table.module.toLowerCase();
|
package/cjs/feature-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-utils.js","sources":["../src/feature-utils.ts"],"sourcesContent":["import type { TableSchema } from \"@vuu-ui/vuu-data-types\";\nimport type { VuuTable } from \"@vuu-ui/vuu-protocol-types\";\nimport type { FeatureProps } from \"@vuu-ui/vuu-shell\";\nimport { partition } from \"./array-utils\";\nimport { wordify } from \"./text-utils\";\n\nexport type PathMap = { [key: string]: Pick<FeatureConfig, \"css\" | \"url\"> };\nexport type Environment = \"development\" | \"production\";\nexport const env = process.env.NODE_ENV as Environment;\n\nexport interface ViewConfig {\n allowRename?: boolean;\n closeable?: boolean;\n header?: boolean;\n}\n\ndeclare global {\n const vuuConfig: Promise<VuuConfig>;\n}\n\nexport interface FeatureConfig {\n name: string;\n title: string;\n url: string;\n css?: string;\n leftNavLocation: \"vuu-features\" | \"vuu-tables\";\n featureProps?: {\n schema?: \"*\" | VuuTable;\n schemas?: VuuTable[];\n };\n viewProps?: ViewConfig;\n}\n\nexport interface VuuConfig {\n features: Features;\n authUrl?: string;\n websocketUrl: string;\n ssl: boolean;\n}\n\nexport interface FilterTableFeatureProps {\n tableSchema: TableSchema;\n}\n\nexport type Features = {\n [key: string]: FeatureConfig;\n};\nexport interface VuuConfig {\n features: Features;\n authUrl?: string;\n websocketUrl: string;\n ssl: boolean;\n}\n\nexport const isCustomFeature = (feature: FeatureConfig) =>\n feature.leftNavLocation === \"vuu-features\";\n\nexport const isWildcardSchema = (schema?: \"*\" | VuuTable): schema is \"*\" =>\n schema === \"*\";\nexport const isTableSchema = (schema?: \"*\" | VuuTable): schema is VuuTable =>\n typeof schema === \"object\" &&\n typeof schema.module === \"string\" &&\n typeof schema.table === \"string\";\n\nexport interface FeaturePropsWithFilterTableFeature\n extends Omit<FeatureProps, \"ComponentProps\"> {\n ComponentProps: FilterTableFeatureProps;\n}\n\nexport const hasFilterTableFeatureProps = (\n props: FeatureProps\n): props is FeaturePropsWithFilterTableFeature =>\n \"tableSchema\" in (props?.ComponentProps ?? {});\n\n// Sort TableScheas by module\nexport const byModule = (schema1: TableSchema, schema2: TableSchema) => {\n const m1 = schema1.table.module.toLowerCase();\n const m2 = schema2.table.module.toLowerCase();\n if (m1 < m2) {\n return -1;\n } else if (m1 > m2) {\n return 1;\n } else if (schema1.table.table < schema2.table.table) {\n return -1;\n } else if (schema1.table.table > schema2.table.table) {\n return 1;\n } else {\n return 0;\n }\n};\n\nexport type GetFeaturePaths = (params: {\n env: Environment;\n fileName: string;\n withCss?: boolean;\n}) => FeatureProps;\n\nexport const getFilterTableFeatures = (\n schemas: TableSchema[],\n getFeaturePath: GetFeaturePaths\n) =>\n schemas\n .sort(byModule)\n .map<FeatureProps<FilterTableFeatureProps>>((schema) => ({\n ...getFeaturePath({ env, fileName: \"FilterTable\" }),\n ComponentProps: {\n tableSchema: schema,\n },\n ViewProps: {\n allowRename: true,\n },\n title: `${schema.table.module} ${schema.table.table}`,\n }));\n\nexport type Component = {\n componentName: string;\n component: unknown;\n};\n\nexport const assertComponentRegistered = (\n componentName: string,\n component: unknown\n) => {\n if (typeof component !== \"function\") {\n console.warn(\n `${componentName} module not loaded, will be unabale to deserialize from layout JSON`\n );\n }\n};\n\nexport const assertComponentsRegistered = (componentList: Component[]) => {\n for (const { componentName, component } of componentList) {\n assertComponentRegistered(componentName, component);\n }\n};\n\nexport const getCustomAndTableFeatures = (\n features: Features,\n vuuTables: Map<string, TableSchema>\n): [FeatureProps[], FeatureProps<FilterTableFeatureProps>[]] => {\n const [customFeatureConfig, tableFeaturesConfig] = partition(\n Object.values(features),\n isCustomFeature\n );\n\n const customFeatures: FeatureProps[] = [];\n const tableFeatures: FeatureProps<FilterTableFeatureProps>[] = [];\n\n for (const {\n featureProps = {},\n viewProps,\n ...feature\n } of tableFeaturesConfig) {\n const { schema } = featureProps;\n if (isWildcardSchema(schema) && vuuTables) {\n for (const tableSchema of vuuTables.values()) {\n tableFeatures.push({\n ...feature,\n ComponentProps: {\n tableSchema,\n },\n title: `${tableSchema.table.module} ${wordify(\n tableSchema.table.table\n )}`,\n ViewProps: {\n ...viewProps,\n allowRename: true,\n },\n });\n }\n } else if (isTableSchema(schema) && vuuTables) {\n const tableSchema = vuuTables.get(schema.table);\n if (tableSchema) {\n tableFeatures.push({\n ...feature,\n ComponentProps: {\n tableSchema,\n },\n ViewProps: viewProps,\n });\n }\n }\n }\n\n for (const {\n featureProps = {},\n viewProps,\n ...feature\n } of customFeatureConfig) {\n const { schema, schemas } = featureProps;\n if (isTableSchema(schema) && vuuTables) {\n const tableSchema = vuuTables.get(schema.table);\n customFeatures.push({\n ...feature,\n ComponentProps: {\n tableSchema,\n },\n ViewProps: viewProps,\n });\n } else if (Array.isArray(schemas) && vuuTables) {\n customFeatures.push({\n ...feature,\n ComponentProps: schemas.reduce<Record<string, TableSchema>>(\n (map, schema) => {\n map[`${schema.table}Schema`] = vuuTables.get(\n schema.table\n ) as TableSchema;\n return map;\n },\n {}\n ),\n ViewProps: viewProps,\n });\n } else {\n customFeatures.push(feature);\n }\n }\n return [customFeatures, tableFeatures];\n};\n"],"names":["partition","wordify","schema"],"mappings":";;;;;AAQa,MAAA,GAAA,GAAM,QAAQ,GAAI,CAAA,SAAA;AA8CxB,MAAM,eAAkB,GAAA,CAAC,OAC9B,KAAA,OAAA,CAAQ,eAAoB,KAAA,eAAA;AAEjB,MAAA,gBAAA,GAAmB,CAAC,MAAA,KAC/B,MAAW,KAAA,IAAA;AACN,MAAM,aAAgB,GAAA,CAAC,MAC5B,KAAA,OAAO,MAAW,KAAA,QAAA,IAClB,OAAO,MAAA,CAAO,MAAW,KAAA,QAAA,IACzB,OAAO,MAAA,CAAO,KAAU,KAAA,SAAA;AAOnB,MAAM,6BAA6B,CACxC,KAAA,KAEA,aAAkB,KAAA,KAAA,EAAO,kBAAkB,EAAC,EAAA;AAGjC,MAAA,QAAA,GAAW,CAAC,OAAA,EAAsB,OAAyB,KAAA;AACtE,EAAA,MAAM,EAAK,GAAA,OAAA,CAAQ,KAAM,CAAA,MAAA,CAAO,WAAY,EAAA,CAAA;AAC5C,EAAA,MAAM,EAAK,GAAA,OAAA,CAAQ,KAAM,CAAA,MAAA,CAAO,WAAY,EAAA,CAAA;AAC5C,EAAA,IAAI,KAAK,EAAI,EAAA;AACX,IAAO,OAAA,CAAA,CAAA,CAAA;AAAA,GACT,MA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file":"feature-utils.js","sources":["../src/feature-utils.ts"],"sourcesContent":["import type { TableSchema } from \"@vuu-ui/vuu-data-types\";\nimport type { VuuTable } from \"@vuu-ui/vuu-protocol-types\";\nimport { ListOption } from \"@vuu-ui/vuu-table-types\";\nimport { partition } from \"./array-utils\";\nimport { wordify } from \"./text-utils\";\n\nexport type PathMap = { [key: string]: Pick<FeatureConfig, \"css\" | \"url\"> };\nexport type Environment = \"development\" | \"production\";\nexport const env = process.env.NODE_ENV as Environment;\n\nexport type LookupTableProvider = (table: VuuTable) => ListOption[];\n\nexport interface ViewConfig {\n allowRename?: boolean;\n closeable?: boolean;\n header?: boolean;\n}\n\nexport interface FeatureProps<P extends object | undefined = object> {\n /**\n props that will be passed to the lazily loaded component.\n */\n ComponentProps?: P;\n ViewProps?: ViewConfig;\n css?: string;\n height?: number;\n title?: string;\n /** \n The url of javascript bundle to lazily load. Bundle must provide a default export\n and that export must be a React component.\n */\n url: string;\n width?: number;\n}\n\ndeclare global {\n const vuuConfig: Promise<VuuConfig>;\n}\n\nexport interface FeatureConfig {\n name: string;\n title: string;\n url: string;\n css?: string;\n leftNavLocation: \"vuu-features\" | \"vuu-tables\";\n featureProps?: {\n schema?: \"*\" | VuuTable;\n schemas?: VuuTable[];\n };\n viewProps?: ViewConfig;\n}\n\nexport interface VuuConfig {\n features: Features;\n authUrl?: string;\n websocketUrl: string;\n ssl: boolean;\n}\n\nexport interface FilterTableFeatureProps {\n tableSchema: TableSchema;\n}\n\nexport type Features = {\n [key: string]: FeatureConfig;\n};\nexport interface VuuConfig {\n features: Features;\n authUrl?: string;\n websocketUrl: string;\n ssl: boolean;\n}\n\nexport const isCustomFeature = (feature: FeatureConfig) =>\n feature.leftNavLocation === \"vuu-features\";\n\nexport const isWildcardSchema = (schema?: \"*\" | VuuTable): schema is \"*\" =>\n schema === \"*\";\nexport const isTableSchema = (schema?: \"*\" | VuuTable): schema is VuuTable =>\n typeof schema === \"object\" &&\n typeof schema.module === \"string\" &&\n typeof schema.table === \"string\";\n\nexport interface FeaturePropsWithFilterTableFeature\n extends Omit<FeatureProps, \"ComponentProps\"> {\n ComponentProps: FilterTableFeatureProps;\n}\n\nexport const hasFilterTableFeatureProps = (\n props: FeatureProps\n): props is FeaturePropsWithFilterTableFeature =>\n typeof props.ComponentProps === \"object\" &&\n props.ComponentProps !== null &&\n \"tableSchema\" in props.ComponentProps;\n\n// Sort TableScheas by module\nexport const byModule = (schema1: TableSchema, schema2: TableSchema) => {\n const m1 = schema1.table.module.toLowerCase();\n const m2 = schema2.table.module.toLowerCase();\n if (m1 < m2) {\n return -1;\n } else if (m1 > m2) {\n return 1;\n } else if (schema1.table.table < schema2.table.table) {\n return -1;\n } else if (schema1.table.table > schema2.table.table) {\n return 1;\n } else {\n return 0;\n }\n};\n\nexport type GetFeaturePaths = (params: {\n env: Environment;\n fileName: string;\n withCss?: boolean;\n}) => FeatureProps;\n\nexport const getFilterTableFeatures = (\n schemas: TableSchema[],\n getFeaturePath: GetFeaturePaths\n) =>\n schemas\n .sort(byModule)\n .map<FeatureProps<FilterTableFeatureProps>>((schema) => ({\n ...getFeaturePath({ env, fileName: \"FilterTable\" }),\n ComponentProps: {\n tableSchema: schema,\n },\n ViewProps: {\n allowRename: true,\n },\n title: `${schema.table.module} ${schema.table.table}`,\n }));\n\nexport type Component = {\n componentName: string;\n component: unknown;\n};\n\nexport const assertComponentRegistered = (\n componentName: string,\n component: unknown\n) => {\n if (typeof component !== \"function\") {\n console.warn(\n `${componentName} module not loaded, will be unabale to deserialize from layout JSON`\n );\n }\n};\n\nexport const assertComponentsRegistered = (componentList: Component[]) => {\n for (const { componentName, component } of componentList) {\n assertComponentRegistered(componentName, component);\n }\n};\n\nexport const getCustomAndTableFeatures = (\n features: Features,\n vuuTables: Map<string, TableSchema>\n): [FeatureProps[], FeatureProps<FilterTableFeatureProps>[]] => {\n const [customFeatureConfig, tableFeaturesConfig] = partition(\n Object.values(features),\n isCustomFeature\n );\n\n const customFeatures: FeatureProps[] = [];\n const tableFeatures: FeatureProps<FilterTableFeatureProps>[] = [];\n\n for (const {\n featureProps = {},\n viewProps,\n ...feature\n } of tableFeaturesConfig) {\n const { schema } = featureProps;\n if (isWildcardSchema(schema) && vuuTables) {\n for (const tableSchema of vuuTables.values()) {\n tableFeatures.push({\n ...feature,\n ComponentProps: {\n tableSchema,\n },\n title: `${tableSchema.table.module} ${wordify(\n tableSchema.table.table\n )}`,\n ViewProps: {\n ...viewProps,\n allowRename: true,\n },\n });\n }\n } else if (isTableSchema(schema) && vuuTables) {\n const tableSchema = vuuTables.get(schema.table);\n if (tableSchema) {\n tableFeatures.push({\n ...feature,\n ComponentProps: {\n tableSchema,\n },\n ViewProps: viewProps,\n });\n }\n }\n }\n\n for (const {\n featureProps = {},\n viewProps,\n ...feature\n } of customFeatureConfig) {\n const { schema, schemas } = featureProps;\n if (isTableSchema(schema) && vuuTables) {\n const tableSchema = vuuTables.get(schema.table);\n customFeatures.push({\n ...feature,\n ComponentProps: {\n tableSchema,\n },\n ViewProps: viewProps,\n });\n } else if (Array.isArray(schemas) && vuuTables) {\n customFeatures.push({\n ...feature,\n ComponentProps: schemas.reduce<Record<string, TableSchema>>(\n (map, schema) => {\n map[`${schema.table}Schema`] = vuuTables.get(\n schema.table\n ) as TableSchema;\n return map;\n },\n {}\n ),\n ViewProps: viewProps,\n });\n } else {\n customFeatures.push(feature);\n }\n }\n return [customFeatures, tableFeatures];\n};\n"],"names":["partition","wordify","schema"],"mappings":";;;;;AAQa,MAAA,GAAA,GAAM,QAAQ,GAAI,CAAA,SAAA;AAiExB,MAAM,eAAkB,GAAA,CAAC,OAC9B,KAAA,OAAA,CAAQ,eAAoB,KAAA,eAAA;AAEjB,MAAA,gBAAA,GAAmB,CAAC,MAAA,KAC/B,MAAW,KAAA,IAAA;AACN,MAAM,aAAgB,GAAA,CAAC,MAC5B,KAAA,OAAO,MAAW,KAAA,QAAA,IAClB,OAAO,MAAA,CAAO,MAAW,KAAA,QAAA,IACzB,OAAO,M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,CAAA,MAAA;AAAA,UACtB,CAAC,KAAKC,OAAW,KAAA;AACf,YAAA,GAAA,CAAI,CAAGA,EAAAA,OAAAA,CAAO,KAAK,CAAA,MAAA,CAAQ,IAAI,SAAU,CAAA,GAAA;AAAA,cACvCA,OAAO,CAAA,KAAA;AAAA,aACT,CAAA;AACA,YAAO,OAAA,GAAA,CAAA;AAAA,WACT;AAAA,UACA,EAAC;AAAA,SACH;AAAA,QACA,SAAW,EAAA,SAAA;AAAA,OACZ,CAAA,CAAA;AAAA,KACI,MAAA;AACL,MAAA,cAAA,CAAe,KAAK,OAAO,CAAA,CAAA;AAAA,KAC7B;AAAA,GACF;AACA,EAAO,OAAA,CAAC,gBAAgB,aAAa,CAAA,CAAA;AACvC;;;;;;;;;;;;;"}
|
package/esm/ShellContext.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShellContext.js","sources":["../src/ShellContext.ts"],"sourcesContent":["import { RpcResponseHandler } from \"
|
|
1
|
+
{"version":3,"file":"ShellContext.js","sources":["../src/ShellContext.ts"],"sourcesContent":["import { RpcResponseHandler } from \"@vuu-ui/vuu-data-types\";\nimport {\n DefaultColumnConfiguration,\n DefaultTableConfiguration,\n} from \"packages/vuu-table-types\";\nimport { createContext, useContext } from \"react\";\nimport { LookupTableProvider } from \"./feature-utils\";\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;;;;"}
|
package/esm/feature-utils.js
CHANGED
|
@@ -5,7 +5,7 @@ const env = process.env.NODE_ENV;
|
|
|
5
5
|
const isCustomFeature = (feature) => feature.leftNavLocation === "vuu-features";
|
|
6
6
|
const isWildcardSchema = (schema) => schema === "*";
|
|
7
7
|
const isTableSchema = (schema) => typeof schema === "object" && typeof schema.module === "string" && typeof schema.table === "string";
|
|
8
|
-
const hasFilterTableFeatureProps = (props) => "tableSchema" in
|
|
8
|
+
const hasFilterTableFeatureProps = (props) => typeof props.ComponentProps === "object" && props.ComponentProps !== null && "tableSchema" in props.ComponentProps;
|
|
9
9
|
const byModule = (schema1, schema2) => {
|
|
10
10
|
const m1 = schema1.table.module.toLowerCase();
|
|
11
11
|
const m2 = schema2.table.module.toLowerCase();
|
package/esm/feature-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-utils.js","sources":["../src/feature-utils.ts"],"sourcesContent":["import type { TableSchema } from \"@vuu-ui/vuu-data-types\";\nimport type { VuuTable } from \"@vuu-ui/vuu-protocol-types\";\nimport type { FeatureProps } from \"@vuu-ui/vuu-shell\";\nimport { partition } from \"./array-utils\";\nimport { wordify } from \"./text-utils\";\n\nexport type PathMap = { [key: string]: Pick<FeatureConfig, \"css\" | \"url\"> };\nexport type Environment = \"development\" | \"production\";\nexport const env = process.env.NODE_ENV as Environment;\n\nexport interface ViewConfig {\n allowRename?: boolean;\n closeable?: boolean;\n header?: boolean;\n}\n\ndeclare global {\n const vuuConfig: Promise<VuuConfig>;\n}\n\nexport interface FeatureConfig {\n name: string;\n title: string;\n url: string;\n css?: string;\n leftNavLocation: \"vuu-features\" | \"vuu-tables\";\n featureProps?: {\n schema?: \"*\" | VuuTable;\n schemas?: VuuTable[];\n };\n viewProps?: ViewConfig;\n}\n\nexport interface VuuConfig {\n features: Features;\n authUrl?: string;\n websocketUrl: string;\n ssl: boolean;\n}\n\nexport interface FilterTableFeatureProps {\n tableSchema: TableSchema;\n}\n\nexport type Features = {\n [key: string]: FeatureConfig;\n};\nexport interface VuuConfig {\n features: Features;\n authUrl?: string;\n websocketUrl: string;\n ssl: boolean;\n}\n\nexport const isCustomFeature = (feature: FeatureConfig) =>\n feature.leftNavLocation === \"vuu-features\";\n\nexport const isWildcardSchema = (schema?: \"*\" | VuuTable): schema is \"*\" =>\n schema === \"*\";\nexport const isTableSchema = (schema?: \"*\" | VuuTable): schema is VuuTable =>\n typeof schema === \"object\" &&\n typeof schema.module === \"string\" &&\n typeof schema.table === \"string\";\n\nexport interface FeaturePropsWithFilterTableFeature\n extends Omit<FeatureProps, \"ComponentProps\"> {\n ComponentProps: FilterTableFeatureProps;\n}\n\nexport const hasFilterTableFeatureProps = (\n props: FeatureProps\n): props is FeaturePropsWithFilterTableFeature =>\n \"tableSchema\" in (props?.ComponentProps ?? {});\n\n// Sort TableScheas by module\nexport const byModule = (schema1: TableSchema, schema2: TableSchema) => {\n const m1 = schema1.table.module.toLowerCase();\n const m2 = schema2.table.module.toLowerCase();\n if (m1 < m2) {\n return -1;\n } else if (m1 > m2) {\n return 1;\n } else if (schema1.table.table < schema2.table.table) {\n return -1;\n } else if (schema1.table.table > schema2.table.table) {\n return 1;\n } else {\n return 0;\n }\n};\n\nexport type GetFeaturePaths = (params: {\n env: Environment;\n fileName: string;\n withCss?: boolean;\n}) => FeatureProps;\n\nexport const getFilterTableFeatures = (\n schemas: TableSchema[],\n getFeaturePath: GetFeaturePaths\n) =>\n schemas\n .sort(byModule)\n .map<FeatureProps<FilterTableFeatureProps>>((schema) => ({\n ...getFeaturePath({ env, fileName: \"FilterTable\" }),\n ComponentProps: {\n tableSchema: schema,\n },\n ViewProps: {\n allowRename: true,\n },\n title: `${schema.table.module} ${schema.table.table}`,\n }));\n\nexport type Component = {\n componentName: string;\n component: unknown;\n};\n\nexport const assertComponentRegistered = (\n componentName: string,\n component: unknown\n) => {\n if (typeof component !== \"function\") {\n console.warn(\n `${componentName} module not loaded, will be unabale to deserialize from layout JSON`\n );\n }\n};\n\nexport const assertComponentsRegistered = (componentList: Component[]) => {\n for (const { componentName, component } of componentList) {\n assertComponentRegistered(componentName, component);\n }\n};\n\nexport const getCustomAndTableFeatures = (\n features: Features,\n vuuTables: Map<string, TableSchema>\n): [FeatureProps[], FeatureProps<FilterTableFeatureProps>[]] => {\n const [customFeatureConfig, tableFeaturesConfig] = partition(\n Object.values(features),\n isCustomFeature\n );\n\n const customFeatures: FeatureProps[] = [];\n const tableFeatures: FeatureProps<FilterTableFeatureProps>[] = [];\n\n for (const {\n featureProps = {},\n viewProps,\n ...feature\n } of tableFeaturesConfig) {\n const { schema } = featureProps;\n if (isWildcardSchema(schema) && vuuTables) {\n for (const tableSchema of vuuTables.values()) {\n tableFeatures.push({\n ...feature,\n ComponentProps: {\n tableSchema,\n },\n title: `${tableSchema.table.module} ${wordify(\n tableSchema.table.table\n )}`,\n ViewProps: {\n ...viewProps,\n allowRename: true,\n },\n });\n }\n } else if (isTableSchema(schema) && vuuTables) {\n const tableSchema = vuuTables.get(schema.table);\n if (tableSchema) {\n tableFeatures.push({\n ...feature,\n ComponentProps: {\n tableSchema,\n },\n ViewProps: viewProps,\n });\n }\n }\n }\n\n for (const {\n featureProps = {},\n viewProps,\n ...feature\n } of customFeatureConfig) {\n const { schema, schemas } = featureProps;\n if (isTableSchema(schema) && vuuTables) {\n const tableSchema = vuuTables.get(schema.table);\n customFeatures.push({\n ...feature,\n ComponentProps: {\n tableSchema,\n },\n ViewProps: viewProps,\n });\n } else if (Array.isArray(schemas) && vuuTables) {\n customFeatures.push({\n ...feature,\n ComponentProps: schemas.reduce<Record<string, TableSchema>>(\n (map, schema) => {\n map[`${schema.table}Schema`] = vuuTables.get(\n schema.table\n ) as TableSchema;\n return map;\n },\n {}\n ),\n ViewProps: viewProps,\n });\n } else {\n customFeatures.push(feature);\n }\n }\n return [customFeatures, tableFeatures];\n};\n"],"names":["schema"],"mappings":";;;AAQa,MAAA,GAAA,GAAM,QAAQ,GAAI,CAAA,SA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AAA,SAAA;AAAA,OACZ,CAAA,CAAA;AAAA,KACQ,MAAA,IAAA,KAAA,CAAM,OAAQ,CAAA,OAAO,KAAK,SAAW,EAAA;AAC9C,MAAA,cAAA,CAAe,IAAK,CAAA;AAAA,QAClB,GAAG,OAAA;AAAA,QACH,gBAAgB,OAAQ,CAAA,MAAA;AAAA,UACtB,CAAC,KAAKA,OAAW,KAAA;AACf,YAAA,GAAA,CAAI,CAAGA,EAAAA,OAAAA,CAAO,KAAK,CAAA,MAAA,CAAQ,IAAI,SAAU,CAAA,GAAA;AAAA,cACvCA,OAAO,CAAA,KAAA;AAAA,aACT,CAAA;AACA,YAAO,OAAA,GAAA,CAAA;AAAA,WACT;AAAA,UACA,EAAC;AAAA,SACH;AAAA,QACA,SAAW,EAAA,SAAA;AAAA,OACZ,CAAA,CAAA;AAAA,KACI,MAAA;AACL,MAAA,cAAA,CAAe,KAAK,OAAO,CAAA,CAAA;AAAA,KAC7B;AAAA,GACF;AACA,EAAO,OAAA,CAAC,gBAAgB,aAAa,CAAA,CAAA;AACvC;;;;"}
|
|
1
|
+
{"version":3,"file":"feature-utils.js","sources":["../src/feature-utils.ts"],"sourcesContent":["import type { TableSchema } from \"@vuu-ui/vuu-data-types\";\nimport type { VuuTable } from \"@vuu-ui/vuu-protocol-types\";\nimport { ListOption } from \"@vuu-ui/vuu-table-types\";\nimport { partition } from \"./array-utils\";\nimport { wordify } from \"./text-utils\";\n\nexport type PathMap = { [key: string]: Pick<FeatureConfig, \"css\" | \"url\"> };\nexport type Environment = \"development\" | \"production\";\nexport const env = process.env.NODE_ENV as Environment;\n\nexport type LookupTableProvider = (table: VuuTable) => ListOption[];\n\nexport interface ViewConfig {\n allowRename?: boolean;\n closeable?: boolean;\n header?: boolean;\n}\n\nexport interface FeatureProps<P extends object | undefined = object> {\n /**\n props that will be passed to the lazily loaded component.\n */\n ComponentProps?: P;\n ViewProps?: ViewConfig;\n css?: string;\n height?: number;\n title?: string;\n /** \n The url of javascript bundle to lazily load. Bundle must provide a default export\n and that export must be a React component.\n */\n url: string;\n width?: number;\n}\n\ndeclare global {\n const vuuConfig: Promise<VuuConfig>;\n}\n\nexport interface FeatureConfig {\n name: string;\n title: string;\n url: string;\n css?: string;\n leftNavLocation: \"vuu-features\" | \"vuu-tables\";\n featureProps?: {\n schema?: \"*\" | VuuTable;\n schemas?: VuuTable[];\n };\n viewProps?: ViewConfig;\n}\n\nexport interface VuuConfig {\n features: Features;\n authUrl?: string;\n websocketUrl: string;\n ssl: boolean;\n}\n\nexport interface FilterTableFeatureProps {\n tableSchema: TableSchema;\n}\n\nexport type Features = {\n [key: string]: FeatureConfig;\n};\nexport interface VuuConfig {\n features: Features;\n authUrl?: string;\n websocketUrl: string;\n ssl: boolean;\n}\n\nexport const isCustomFeature = (feature: FeatureConfig) =>\n feature.leftNavLocation === \"vuu-features\";\n\nexport const isWildcardSchema = (schema?: \"*\" | VuuTable): schema is \"*\" =>\n schema === \"*\";\nexport const isTableSchema = (schema?: \"*\" | VuuTable): schema is VuuTable =>\n typeof schema === \"object\" &&\n typeof schema.module === \"string\" &&\n typeof schema.table === \"string\";\n\nexport interface FeaturePropsWithFilterTableFeature\n extends Omit<FeatureProps, \"ComponentProps\"> {\n ComponentProps: FilterTableFeatureProps;\n}\n\nexport const hasFilterTableFeatureProps = (\n props: FeatureProps\n): props is FeaturePropsWithFilterTableFeature =>\n typeof props.ComponentProps === \"object\" &&\n props.ComponentProps !== null &&\n \"tableSchema\" in props.ComponentProps;\n\n// Sort TableScheas by module\nexport const byModule = (schema1: TableSchema, schema2: TableSchema) => {\n const m1 = schema1.table.module.toLowerCase();\n const m2 = schema2.table.module.toLowerCase();\n if (m1 < m2) {\n return -1;\n } else if (m1 > m2) {\n return 1;\n } else if (schema1.table.table < schema2.table.table) {\n return -1;\n } else if (schema1.table.table > schema2.table.table) {\n return 1;\n } else {\n return 0;\n }\n};\n\nexport type GetFeaturePaths = (params: {\n env: Environment;\n fileName: string;\n withCss?: boolean;\n}) => FeatureProps;\n\nexport const getFilterTableFeatures = (\n schemas: TableSchema[],\n getFeaturePath: GetFeaturePaths\n) =>\n schemas\n .sort(byModule)\n .map<FeatureProps<FilterTableFeatureProps>>((schema) => ({\n ...getFeaturePath({ env, fileName: \"FilterTable\" }),\n ComponentProps: {\n tableSchema: schema,\n },\n ViewProps: {\n allowRename: true,\n },\n title: `${schema.table.module} ${schema.table.table}`,\n }));\n\nexport type Component = {\n componentName: string;\n component: unknown;\n};\n\nexport const assertComponentRegistered = (\n componentName: string,\n component: unknown\n) => {\n if (typeof component !== \"function\") {\n console.warn(\n `${componentName} module not loaded, will be unabale to deserialize from layout JSON`\n );\n }\n};\n\nexport const assertComponentsRegistered = (componentList: Component[]) => {\n for (const { componentName, component } of componentList) {\n assertComponentRegistered(componentName, component);\n }\n};\n\nexport const getCustomAndTableFeatures = (\n features: Features,\n vuuTables: Map<string, TableSchema>\n): [FeatureProps[], FeatureProps<FilterTableFeatureProps>[]] => {\n const [customFeatureConfig, tableFeaturesConfig] = partition(\n Object.values(features),\n isCustomFeature\n );\n\n const customFeatures: FeatureProps[] = [];\n const tableFeatures: FeatureProps<FilterTableFeatureProps>[] = [];\n\n for (const {\n featureProps = {},\n viewProps,\n ...feature\n } of tableFeaturesConfig) {\n const { schema } = featureProps;\n if (isWildcardSchema(schema) && vuuTables) {\n for (const tableSchema of vuuTables.values()) {\n tableFeatures.push({\n ...feature,\n ComponentProps: {\n tableSchema,\n },\n title: `${tableSchema.table.module} ${wordify(\n tableSchema.table.table\n )}`,\n ViewProps: {\n ...viewProps,\n allowRename: true,\n },\n });\n }\n } else if (isTableSchema(schema) && vuuTables) {\n const tableSchema = vuuTables.get(schema.table);\n if (tableSchema) {\n tableFeatures.push({\n ...feature,\n ComponentProps: {\n tableSchema,\n },\n ViewProps: viewProps,\n });\n }\n }\n }\n\n for (const {\n featureProps = {},\n viewProps,\n ...feature\n } of customFeatureConfig) {\n const { schema, schemas } = featureProps;\n if (isTableSchema(schema) && vuuTables) {\n const tableSchema = vuuTables.get(schema.table);\n customFeatures.push({\n ...feature,\n ComponentProps: {\n tableSchema,\n },\n ViewProps: viewProps,\n });\n } else if (Array.isArray(schemas) && vuuTables) {\n customFeatures.push({\n ...feature,\n ComponentProps: schemas.reduce<Record<string, TableSchema>>(\n (map, schema) => {\n map[`${schema.table}Schema`] = vuuTables.get(\n schema.table\n ) as TableSchema;\n return map;\n },\n {}\n ),\n ViewProps: viewProps,\n });\n } else {\n customFeatures.push(feature);\n }\n }\n return [customFeatures, tableFeatures];\n};\n"],"names":["schema"],"mappings":";;;AAQa,MAAA,GAAA,GAAM,QAAQ,GAAI,CAAA,SAAA;AAiExB,MAAM,eAAkB,GAAA,CAAC,OAC9B,KAAA,OAAA,CAAQ,eAAoB,KAAA,eAAA;AAEjB,MAAA,gBAAA,GAAmB,CAAC,MAAA,KAC/B,MAAW,KAAA,IAAA;AACN,MAAM,aAAgB,GAAA,CAAC,MAC5B,KAAA,OAAO,MAAW,KAAA,QAAA,IAClB,OAAO,MAAA,CAAO,MAAW,KAAA,QAAA,IACzB,OAAO,MAAA,CAAO,KAAU,KAAA,SAAA;AAOb,MAAA,0BAAA,GAA6B,CACxC,KAAA,KAEA,OAAO,KAAA,CAAM,cAAmB,KAAA,QAAA,IAChC,KAAM,CAAA,cAAA,KAAmB,IACzB,IAAA,aAAA,IAAiB,KAAM,CAAA,eAAA;AAGZ,MAAA,QAAA,GAAW,CAAC,OAAA,EAAsB,OAAyB,KAAA;AACtE,EAAA,MAAM,EAAK,GAAA,OAAA,CAAQ,KAAM,CAAA,MAAA,CAAO,WAAY,EAAA,CAAA;AAC5C,EAAA,MAAM,EAAK,GAAA,OAAA,CAAQ,KAAM,CAAA,MAAA,CAAO,WAAY,EAAA,CAAA;AAC5C,EAAA,IAAI,KAAK,EAAI,EAAA;AACX,IAAO,OAAA,CAAA,CAAA,CAAA;AAAA,GACT,MAAA,IAAW,KAAK,EAAI,EAAA;AAClB,IAAO,OAAA,CAAA,CAAA;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"0.8.79",
|
|
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.
|
|
8
|
-
"@vuu-ui/vuu-table-types": "0.8.
|
|
9
|
-
"@vuu-ui/vuu-filter-types": "0.8.
|
|
10
|
-
"@vuu-ui/vuu-protocol-types": "0.8.
|
|
7
|
+
"@vuu-ui/vuu-data-types": "0.8.79",
|
|
8
|
+
"@vuu-ui/vuu-table-types": "0.8.79",
|
|
9
|
+
"@vuu-ui/vuu-filter-types": "0.8.79",
|
|
10
|
+
"@vuu-ui/vuu-protocol-types": "0.8.79"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"@internationalized/date": "^3.0.0",
|
|
14
|
-
"@vuu-ui/vuu-filter-parser": "0.8.
|
|
14
|
+
"@vuu-ui/vuu-filter-parser": "0.8.79",
|
|
15
15
|
"clsx": "^2.0.0",
|
|
16
16
|
"react": ">=17.0.2",
|
|
17
17
|
"react-dom": ">=17.0.2"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { RpcResponseHandler } from "
|
|
3
|
-
import { LookupTableProvider } from "packages/vuu-shell/src";
|
|
2
|
+
import { RpcResponseHandler } from "@vuu-ui/vuu-data-types";
|
|
4
3
|
import { DefaultColumnConfiguration, DefaultTableConfiguration } from "packages/vuu-table-types";
|
|
4
|
+
import { LookupTableProvider } from "./feature-utils";
|
|
5
5
|
export interface ShellContextProps {
|
|
6
6
|
getDefaultColumnConfig?: DefaultColumnConfiguration;
|
|
7
7
|
getDefaultTableConfig?: DefaultTableConfiguration;
|
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
import type { TableSchema } from "@vuu-ui/vuu-data-types";
|
|
2
2
|
import type { VuuTable } from "@vuu-ui/vuu-protocol-types";
|
|
3
|
-
import
|
|
3
|
+
import { ListOption } from "@vuu-ui/vuu-table-types";
|
|
4
4
|
export type PathMap = {
|
|
5
5
|
[key: string]: Pick<FeatureConfig, "css" | "url">;
|
|
6
6
|
};
|
|
7
7
|
export type Environment = "development" | "production";
|
|
8
8
|
export declare const env: Environment;
|
|
9
|
+
export type LookupTableProvider = (table: VuuTable) => ListOption[];
|
|
9
10
|
export interface ViewConfig {
|
|
10
11
|
allowRename?: boolean;
|
|
11
12
|
closeable?: boolean;
|
|
12
13
|
header?: boolean;
|
|
13
14
|
}
|
|
15
|
+
export interface FeatureProps<P extends object | undefined = object> {
|
|
16
|
+
/**
|
|
17
|
+
props that will be passed to the lazily loaded component.
|
|
18
|
+
*/
|
|
19
|
+
ComponentProps?: P;
|
|
20
|
+
ViewProps?: ViewConfig;
|
|
21
|
+
css?: string;
|
|
22
|
+
height?: number;
|
|
23
|
+
title?: string;
|
|
24
|
+
/**
|
|
25
|
+
The url of javascript bundle to lazily load. Bundle must provide a default export
|
|
26
|
+
and that export must be a React component.
|
|
27
|
+
*/
|
|
28
|
+
url: string;
|
|
29
|
+
width?: number;
|
|
30
|
+
}
|
|
14
31
|
declare global {
|
|
15
32
|
const vuuConfig: Promise<VuuConfig>;
|
|
16
33
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
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;
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './AppHeader';
|
|
@@ -1,12 +0,0 @@
|
|
|
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>;
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./ApplicationProvider";
|
|
@@ -1,10 +0,0 @@
|
|
|
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 {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./ConnectionStatusIndicator";
|
|
@@ -1,21 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./DataSourceProvider";
|
|
@@ -1,26 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Feature';
|
|
@@ -1,7 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./FeatureList";
|
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Features, FilterTableFeatureProps } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import { FeatureProps } from "../feature/Feature";
|
|
3
|
-
export interface FeaturesHookProps {
|
|
4
|
-
features: Features;
|
|
5
|
-
}
|
|
6
|
-
export declare const useVuuFeatures: ({ features, }: FeaturesHookProps) => [
|
|
7
|
-
FeatureProps[],
|
|
8
|
-
FeatureProps<FilterTableFeatureProps>[]
|
|
9
|
-
];
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export * from "./application-provider";
|
|
2
|
-
export * from "./app-header";
|
|
3
|
-
export * from "./connection-status";
|
|
4
|
-
export * from "./datasource-provider";
|
|
5
|
-
export * from "./feature";
|
|
6
|
-
export * from "./feature-provider";
|
|
7
|
-
export * from "./left-nav";
|
|
8
|
-
export * from "./login";
|
|
9
|
-
export * from "./persistence-manager";
|
|
10
|
-
export * from "./shell";
|
|
11
|
-
export * from "./shell-layout-templates";
|
|
12
|
-
export * from "./ShellContextProvider";
|
|
13
|
-
export * from "./feature-list";
|
|
14
|
-
export * from "./theme-switch";
|
|
15
|
-
export * from "./user-settings";
|
|
16
|
-
export * from "./workspace-management";
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { FilterTableFeatureProps } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import { HTMLAttributes } from "react";
|
|
3
|
-
import { FeatureProps } from "../feature";
|
|
4
|
-
export type NavDisplayStatus = "menu-full" | "menu-icons" | "menu-full-content" | "menu-icons-content";
|
|
5
|
-
export type NavDisplayStatusHandler = (navDisplayStatus: NavDisplayStatus) => void;
|
|
6
|
-
export interface LeftNavProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
-
"data-path"?: string;
|
|
8
|
-
defaultActiveTabIndex?: number;
|
|
9
|
-
defaultExpanded?: boolean;
|
|
10
|
-
features?: FeatureProps[];
|
|
11
|
-
onActiveChange?: (activeTabIndex: number) => void;
|
|
12
|
-
onTogglePrimaryMenu?: (expanded: boolean) => void;
|
|
13
|
-
sizeCollapsed?: number;
|
|
14
|
-
sizeContent?: number;
|
|
15
|
-
sizeExpanded?: number;
|
|
16
|
-
tableFeatures?: FeatureProps<FilterTableFeatureProps>[];
|
|
17
|
-
}
|
|
18
|
-
export declare const LeftNav: (props: LeftNavProps) => JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./LeftNav";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes } from "react";
|
|
2
|
-
export interface LoginPanelProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSubmit"> {
|
|
3
|
-
appName?: string;
|
|
4
|
-
onSubmit: (username: string, password?: string) => void;
|
|
5
|
-
requirePassword?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare const LoginPanel: ({ appName, className, requirePassword, onSubmit, ...htmlAttributes }: LoginPanelProps) => JSX.Element;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ApplicationJSON, LayoutJSON, Settings, Layout, LayoutMetadata, LayoutMetadataDto } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import { IPersistenceManager } from "./PersistenceManager";
|
|
3
|
-
export declare class LocalPersistenceManager implements IPersistenceManager {
|
|
4
|
-
#private;
|
|
5
|
-
metadataSaveLocation: string;
|
|
6
|
-
layoutsSaveLocation: string;
|
|
7
|
-
constructor(urlKey?: string);
|
|
8
|
-
createLayout(metadata: LayoutMetadataDto, layout: LayoutJSON): Promise<LayoutMetadata>;
|
|
9
|
-
updateLayout(id: string, newMetadata: LayoutMetadataDto, newLayout: LayoutJSON): Promise<void>;
|
|
10
|
-
deleteLayout(id: string): Promise<void>;
|
|
11
|
-
loadLayout(id: string): Promise<LayoutJSON>;
|
|
12
|
-
loadMetadata(): Promise<LayoutMetadata[]>;
|
|
13
|
-
loadApplicationJSON(): Promise<ApplicationJSON | undefined>;
|
|
14
|
-
saveApplicationJSON(applicationJSON: ApplicationJSON): Promise<void>;
|
|
15
|
-
loadLayouts: () => Promise<Layout[]>;
|
|
16
|
-
saveLayoutsWithMetadata: (layouts: Layout[], metadata: LayoutMetadata[]) => void;
|
|
17
|
-
validateIds: (id: string) => Promise<void>;
|
|
18
|
-
validateId: (id: string, dataType: "metadata" | "layout") => Promise<void>;
|
|
19
|
-
getUserSettings(): Promise<Settings>;
|
|
20
|
-
saveUserSettings(userSettings: Settings): void;
|
|
21
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { ApplicationJSON, LayoutJSON, LayoutMetadata, LayoutMetadataDto, Settings } from "@vuu-ui/vuu-utils";
|
|
2
|
-
export interface IPersistenceManager {
|
|
3
|
-
/**
|
|
4
|
-
* Saves a new layout and its corresponding metadata
|
|
5
|
-
*
|
|
6
|
-
* @param metadata - Metadata about the layout to be saved
|
|
7
|
-
* @param layout - Full JSON representation of the layout to be saved
|
|
8
|
-
*
|
|
9
|
-
* @returns Unique identifier assigned to the saved layout
|
|
10
|
-
*/
|
|
11
|
-
createLayout: (metadata: LayoutMetadataDto, layout: LayoutJSON) => Promise<LayoutMetadata>;
|
|
12
|
-
/**
|
|
13
|
-
* Overwrites an existing layout and its corresponding metadata with the provided information
|
|
14
|
-
*
|
|
15
|
-
* @param id - Unique identifier of the existing layout to be updated
|
|
16
|
-
* @param metadata - Metadata describing the new layout to overwrite with
|
|
17
|
-
* @param layout - Full JSON representation of the new layout to overwrite with
|
|
18
|
-
*/
|
|
19
|
-
updateLayout: (id: string, metadata: LayoutMetadataDto, layout: LayoutJSON) => Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Deletes an existing layout and its corresponding metadata
|
|
22
|
-
*
|
|
23
|
-
* @param id - Unique identifier of the existing layout to be deleted
|
|
24
|
-
*/
|
|
25
|
-
deleteLayout: (id: string) => Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Retrieves an existing layout
|
|
28
|
-
*
|
|
29
|
-
* @param id - Unique identifier of the existing layout to be retrieved
|
|
30
|
-
*
|
|
31
|
-
* @returns Full JSON representation of the layout corresponding to the provided ID
|
|
32
|
-
*/
|
|
33
|
-
loadLayout: (id: string) => Promise<LayoutJSON>;
|
|
34
|
-
/**
|
|
35
|
-
* Retrieves metadata for all existing layouts
|
|
36
|
-
*
|
|
37
|
-
* @returns an array of all persisted layout metadata
|
|
38
|
-
*/
|
|
39
|
-
loadMetadata: () => Promise<LayoutMetadata[]>;
|
|
40
|
-
/**
|
|
41
|
-
* Retrieves the application JSON. This includes the application layout,
|
|
42
|
-
* which describes all layouts on screen
|
|
43
|
-
*
|
|
44
|
-
* @returns Full JSON representation of the application json
|
|
45
|
-
*/
|
|
46
|
-
loadApplicationJSON: () => Promise<ApplicationJSON | undefined>;
|
|
47
|
-
/**
|
|
48
|
-
* Saves the application JSON. This includes the application layout,
|
|
49
|
-
* which describes all layouts on screen
|
|
50
|
-
*
|
|
51
|
-
* @param layout - Full JSON representation of the application layout to be saved
|
|
52
|
-
*/
|
|
53
|
-
saveApplicationJSON: (layout: ApplicationJSON) => Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Save user settings. These get saved within the Application JSON.
|
|
56
|
-
*
|
|
57
|
-
* @param userSettings
|
|
58
|
-
*/
|
|
59
|
-
saveUserSettings: (userSettings: Settings) => void;
|
|
60
|
-
/**
|
|
61
|
-
* Get the user settings. These are stored within Application JSON.
|
|
62
|
-
*
|
|
63
|
-
* @returns userSettings
|
|
64
|
-
*/
|
|
65
|
-
getUserSettings: () => Promise<Settings>;
|
|
66
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from "react";
|
|
2
|
-
import { IPersistenceManager } from ".";
|
|
3
|
-
export interface PersistenceContextProps {
|
|
4
|
-
persistenceManager?: IPersistenceManager;
|
|
5
|
-
}
|
|
6
|
-
export declare const PersistenceContext: import("react").Context<PersistenceContextProps>;
|
|
7
|
-
export interface PersistenceProviderProps extends PersistenceContextProps {
|
|
8
|
-
children: ReactNode;
|
|
9
|
-
}
|
|
10
|
-
export declare const PersistenceProvider: ({ children, persistenceManager, }: PersistenceProviderProps) => ReactElement;
|
|
11
|
-
export declare const usePersistenceManager: () => IPersistenceManager | undefined;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ApplicationJSON, LayoutJSON, LayoutMetadata, LayoutMetadataDto, Settings } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import { IPersistenceManager } from "./PersistenceManager";
|
|
3
|
-
export type CreateLayoutResponseDto = {
|
|
4
|
-
metadata: LayoutMetadata;
|
|
5
|
-
};
|
|
6
|
-
export type GetLayoutResponseDto = {
|
|
7
|
-
definition: LayoutJSON;
|
|
8
|
-
};
|
|
9
|
-
export type GetApplicationResponseDto = {
|
|
10
|
-
definition: ApplicationJSON;
|
|
11
|
-
};
|
|
12
|
-
export declare class RemotePersistenceManager implements IPersistenceManager {
|
|
13
|
-
username: string;
|
|
14
|
-
createLayout(metadata: LayoutMetadataDto, layout: LayoutJSON): Promise<LayoutMetadata>;
|
|
15
|
-
updateLayout(id: string, metadata: LayoutMetadataDto, newLayoutJson: LayoutJSON): Promise<void>;
|
|
16
|
-
deleteLayout(id: string): Promise<void>;
|
|
17
|
-
loadLayout(id: string): Promise<LayoutJSON>;
|
|
18
|
-
loadMetadata(): Promise<LayoutMetadata[]>;
|
|
19
|
-
saveApplicationJSON(applicationJSON: ApplicationJSON): Promise<void>;
|
|
20
|
-
loadApplicationJSON(): Promise<ApplicationJSON>;
|
|
21
|
-
getUserSettings(): Promise<{}>;
|
|
22
|
-
saveUserSettings(userSettings: Settings): void;
|
|
23
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ApplicationJSON, LayoutJSON, LayoutMetadata, Settings } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import { IPersistenceManager } from "./PersistenceManager";
|
|
3
|
-
export declare class StaticPersistenceManager implements IPersistenceManager {
|
|
4
|
-
#private;
|
|
5
|
-
constructor({ applicationJSON, applicationLoadDelay, layoutMetadata, }: {
|
|
6
|
-
applicationJSON?: ApplicationJSON;
|
|
7
|
-
applicationLoadDelay?: number;
|
|
8
|
-
layoutMetadata?: LayoutMetadata[];
|
|
9
|
-
});
|
|
10
|
-
createLayout(): Promise<LayoutMetadata>;
|
|
11
|
-
updateLayout(): Promise<void>;
|
|
12
|
-
deleteLayout(): Promise<void>;
|
|
13
|
-
loadLayout(id: string): Promise<LayoutJSON<{
|
|
14
|
-
[key: string]: any;
|
|
15
|
-
}>>;
|
|
16
|
-
loadMetadata(): Promise<LayoutMetadata[]>;
|
|
17
|
-
loadApplicationJSON(): Promise<ApplicationJSON | undefined>;
|
|
18
|
-
saveApplicationJSON(applicationJson: ApplicationJSON): Promise<void>;
|
|
19
|
-
getUserSettings(): Promise<Settings>;
|
|
20
|
-
saveUserSettings(userSettings: Settings): void;
|
|
21
|
-
}
|