@vuu-ui/vuu-utils 0.8.65 → 0.8.67

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.
@@ -28,6 +28,9 @@ const getFilterTableFeatures = (schemas, getFeaturePath) => schemas.sort(byModul
28
28
  ComponentProps: {
29
29
  tableSchema: schema
30
30
  },
31
+ ViewProps: {
32
+ allowRename: true
33
+ },
31
34
  title: `${schema.table.module} ${schema.table.table}`
32
35
  }));
33
36
  const assertComponentRegistered = (componentName, component) => {
@@ -60,7 +63,10 @@ const getCustomAndTableFeatures = (features, vuuTables) => {
60
63
  title: `${tableSchema.table.module} ${textUtils.wordify(
61
64
  tableSchema.table.table
62
65
  )}`,
63
- ViewProps: viewProps
66
+ ViewProps: {
67
+ ...viewProps,
68
+ allowRename: true
69
+ }
64
70
  });
65
71
  }
66
72
  } else if (isTableSchema(schema) && vuuTables) {
@@ -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 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 title: `${schema.table.module} ${schema.table.table}`,\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 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: viewProps,\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;AA6CxB,MAAM,eAAkB,GAAA,CAAC,OAC9B,KAAA,OAAA,CAAQ,eAAoB,KAAA,eAAA;AAEjB,MAAA,gBAAA,GAAmB,CAAC,MAAA,KAC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T;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 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 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 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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;AAAA,GACF;AACA,EAAO,OAAA,CAAC,gBAAgB,aAAa,CAAA,CAAA;AACvC;;;;;;;;;;;;"}
package/cjs/index.js CHANGED
@@ -284,6 +284,7 @@ exports.debounce = perfUtils.debounce;
284
284
  exports.throttle = perfUtils.throttle;
285
285
  exports.isOpenDialogAction = protocolMessageUtils.isOpenDialogAction;
286
286
  exports.isOpenSessionTableDialogMessage = protocolMessageUtils.isOpenSessionTableDialogMessage;
287
+ exports.isRequestResponse = protocolMessageUtils.isRequestResponse;
287
288
  exports.isVuuMenuRpcRequest = protocolMessageUtils.isVuuMenuRpcRequest;
288
289
  exports.NULL_RANGE = rangeUtils.NULL_RANGE;
289
290
  exports.WindowRange = rangeUtils.WindowRange;
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -13,10 +13,12 @@ const MENU_RPC_TYPES = [
13
13
  "VP_EDIT_SUBMIT_FORM_RPC"
14
14
  ];
15
15
  const isVuuMenuRpcRequest = (message) => MENU_RPC_TYPES.includes(message["type"]);
16
+ const isRequestResponse = (message) => "requestId" in message;
16
17
  const isOpenSessionTableDialogMessage = (rpcResponse) => rpcResponse.type === "VIEW_PORT_MENU_RESP" && isOpenDialogAction(rpcResponse.action) && "tableSchema" in rpcResponse.action;
17
18
  const isOpenDialogAction = (action) => action !== void 0 && action.type === "OPEN_DIALOG_ACTION";
18
19
 
19
20
  exports.isOpenDialogAction = isOpenDialogAction;
20
21
  exports.isOpenSessionTableDialogMessage = isOpenSessionTableDialogMessage;
22
+ exports.isRequestResponse = isRequestResponse;
21
23
  exports.isVuuMenuRpcRequest = isVuuMenuRpcRequest;
22
24
  //# sourceMappingURL=protocol-message-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"protocol-message-utils.js","sources":["../src/protocol-message-utils.ts"],"sourcesContent":["import {\n MenuRpcAction,\n MenuRpcResponse,\n OpenDialogActionWithSchema,\n RpcResponse,\n VuuUIMessageOut,\n} from \"@vuu-ui/vuu-data-types\";\nimport {\n ClientToServerMenuRPC,\n OpenDialogAction,\n VuuRpcRequest,\n} from \"@vuu-ui/vuu-protocol-types\";\n\nconst MENU_RPC_TYPES = [\n \"VIEW_PORT_MENUS_SELECT_RPC\",\n \"VIEW_PORT_MENU_TABLE_RPC\",\n \"VIEW_PORT_MENU_ROW_RPC\",\n \"VIEW_PORT_MENU_CELL_RPC\",\n \"VP_EDIT_CELL_RPC\",\n \"VP_EDIT_ROW_RPC\",\n \"VP_EDIT_ADD_ROW_RPC\",\n \"VP_EDIT_DELETE_CELL_RPC\",\n \"VP_EDIT_DELETE_ROW_RPC\",\n \"VP_EDIT_SUBMIT_FORM_RPC\",\n];\n\nexport const isVuuMenuRpcRequest = (\n message: VuuUIMessageOut | VuuRpcRequest | ClientToServerMenuRPC\n): message is ClientToServerMenuRPC => MENU_RPC_TYPES.includes(message[\"type\"]);\n\nexport const isOpenSessionTableDialogMessage = (\n rpcResponse: RpcResponse\n): rpcResponse is MenuRpcResponse<OpenDialogActionWithSchema> =>\n rpcResponse.type === \"VIEW_PORT_MENU_RESP\" &&\n isOpenDialogAction(rpcResponse.action) &&\n \"tableSchema\" in rpcResponse.action;\n\nexport const isOpenDialogAction = (\n action?: MenuRpcAction\n): action is OpenDialogAction =>\n action !== undefined && action.type === \"OPEN_DIALOG_ACTION\";\n"],"names":[],"mappings":";;AAaA,MAAM,cAAiB,GAAA;AAAA,EACrB,4BAAA;AAAA,EACA,0BAAA;AAAA,EACA,wBAAA;AAAA,EACA,yBAAA;AAAA,EACA,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA,qBAAA;AAAA,EACA,yBAAA;AAAA,EACA,wBAAA;AAAA,EACA,yBAAA;AACF,CAAA,CAAA;AAEO,MAAM,sBAAsB,CACjC,OAAA,KACqC,eAAe,QAAS,CAAA,OAAA,CAAQ,MAAM,CAAC,EAAA;AAEjE,MAAA,+BAAA,GAAkC,CAC7C,WAAA,KAEA,WAAY,CAAA,IAAA,KAAS,qBACrB,IAAA,kBAAA,CAAmB,WAAY,CAAA,MAAM,CACrC,IAAA,aAAA,IAAiB,WAAY,CAAA,OAAA;AAExB,MAAM,qBAAqB,CAChC,MAAA,KAEA,MAAW,KAAA,KAAA,CAAA,IAAa,OAAO,IAAS,KAAA;;;;;;"}
1
+ {"version":3,"file":"protocol-message-utils.js","sources":["../src/protocol-message-utils.ts"],"sourcesContent":["import type {\n MenuRpcAction,\n MenuRpcResponse,\n OpenDialogActionWithSchema,\n RpcResponse,\n VuuUIMessageOut,\n VuuUiMessageInRequestResponse,\n} from \"@vuu-ui/vuu-data-types\";\nimport {\n ClientToServerMenuRPC,\n OpenDialogAction,\n VuuRpcRequest,\n} from \"@vuu-ui/vuu-protocol-types\";\n\nconst MENU_RPC_TYPES = [\n \"VIEW_PORT_MENUS_SELECT_RPC\",\n \"VIEW_PORT_MENU_TABLE_RPC\",\n \"VIEW_PORT_MENU_ROW_RPC\",\n \"VIEW_PORT_MENU_CELL_RPC\",\n \"VP_EDIT_CELL_RPC\",\n \"VP_EDIT_ROW_RPC\",\n \"VP_EDIT_ADD_ROW_RPC\",\n \"VP_EDIT_DELETE_CELL_RPC\",\n \"VP_EDIT_DELETE_ROW_RPC\",\n \"VP_EDIT_SUBMIT_FORM_RPC\",\n];\n\nexport const isVuuMenuRpcRequest = (\n message: VuuUIMessageOut | VuuRpcRequest | ClientToServerMenuRPC\n): message is ClientToServerMenuRPC => MENU_RPC_TYPES.includes(message[\"type\"]);\n\nexport const isRequestResponse = (\n message: object\n): message is VuuUiMessageInRequestResponse => \"requestId\" in message;\n\nexport const isOpenSessionTableDialogMessage = (\n rpcResponse: RpcResponse\n): rpcResponse is MenuRpcResponse<OpenDialogActionWithSchema> =>\n rpcResponse.type === \"VIEW_PORT_MENU_RESP\" &&\n isOpenDialogAction(rpcResponse.action) &&\n \"tableSchema\" in rpcResponse.action;\n\nexport const isOpenDialogAction = (\n action?: MenuRpcAction\n): action is OpenDialogAction =>\n action !== undefined && action.type === \"OPEN_DIALOG_ACTION\";\n"],"names":[],"mappings":";;AAcA,MAAM,cAAiB,GAAA;AAAA,EACrB,4BAAA;AAAA,EACA,0BAAA;AAAA,EACA,wBAAA;AAAA,EACA,yBAAA;AAAA,EACA,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA,qBAAA;AAAA,EACA,yBAAA;AAAA,EACA,wBAAA;AAAA,EACA,yBAAA;AACF,CAAA,CAAA;AAEO,MAAM,sBAAsB,CACjC,OAAA,KACqC,eAAe,QAAS,CAAA,OAAA,CAAQ,MAAM,CAAC,EAAA;AAEjE,MAAA,iBAAA,GAAoB,CAC/B,OAAA,KAC6C,WAAe,IAAA,QAAA;AAEjD,MAAA,+BAAA,GAAkC,CAC7C,WAAA,KAEA,WAAY,CAAA,IAAA,KAAS,qBACrB,IAAA,kBAAA,CAAmB,WAAY,CAAA,MAAM,CACrC,IAAA,aAAA,IAAiB,WAAY,CAAA,OAAA;AAExB,MAAM,qBAAqB,CAChC,MAAA,KAEA,MAAW,KAAA,KAAA,CAAA,IAAa,OAAO,IAAS,KAAA;;;;;;;"}
@@ -26,6 +26,9 @@ const getFilterTableFeatures = (schemas, getFeaturePath) => schemas.sort(byModul
26
26
  ComponentProps: {
27
27
  tableSchema: schema
28
28
  },
29
+ ViewProps: {
30
+ allowRename: true
31
+ },
29
32
  title: `${schema.table.module} ${schema.table.table}`
30
33
  }));
31
34
  const assertComponentRegistered = (componentName, component) => {
@@ -58,7 +61,10 @@ const getCustomAndTableFeatures = (features, vuuTables) => {
58
61
  title: `${tableSchema.table.module} ${wordify(
59
62
  tableSchema.table.table
60
63
  )}`,
61
- ViewProps: viewProps
64
+ ViewProps: {
65
+ ...viewProps,
66
+ allowRename: true
67
+ }
62
68
  });
63
69
  }
64
70
  } else if (isTableSchema(schema) && vuuTables) {
@@ -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 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 title: `${schema.table.module} ${schema.table.table}`,\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 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: viewProps,\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,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AAGA,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 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 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 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;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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A,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/index.js CHANGED
@@ -38,7 +38,7 @@ export { uuid } from './nanoid/index.js';
38
38
  export { asReactElements } from './react-utils.js';
39
39
  export { roundDecimal } from './round-decimal.js';
40
40
  export { debounce, throttle } from './perf-utils.js';
41
- export { isOpenDialogAction, isOpenSessionTableDialogMessage, isVuuMenuRpcRequest } from './protocol-message-utils.js';
41
+ export { isOpenDialogAction, isOpenSessionTableDialogMessage, isRequestResponse, isVuuMenuRpcRequest } from './protocol-message-utils.js';
42
42
  export { NULL_RANGE, WindowRange, getFullRange, rangeNewItems, rangesAreSame, resetRange, withinRange } from './range-utils.js';
43
43
  export { actualRowPositioning, asDataSourceRowObject, getIndexFromRowElement, getRowElementAtIndex, virtualRowPositioning } from './row-utils.js';
44
44
  export { RowSelected, deselectItem, expandSelection, getSelectionStatus, isRowSelected, isRowSelectedLast, isSelected, selectItem } from './selection-utils.js';
@@ -11,8 +11,9 @@ const MENU_RPC_TYPES = [
11
11
  "VP_EDIT_SUBMIT_FORM_RPC"
12
12
  ];
13
13
  const isVuuMenuRpcRequest = (message) => MENU_RPC_TYPES.includes(message["type"]);
14
+ const isRequestResponse = (message) => "requestId" in message;
14
15
  const isOpenSessionTableDialogMessage = (rpcResponse) => rpcResponse.type === "VIEW_PORT_MENU_RESP" && isOpenDialogAction(rpcResponse.action) && "tableSchema" in rpcResponse.action;
15
16
  const isOpenDialogAction = (action) => action !== void 0 && action.type === "OPEN_DIALOG_ACTION";
16
17
 
17
- export { isOpenDialogAction, isOpenSessionTableDialogMessage, isVuuMenuRpcRequest };
18
+ export { isOpenDialogAction, isOpenSessionTableDialogMessage, isRequestResponse, isVuuMenuRpcRequest };
18
19
  //# sourceMappingURL=protocol-message-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"protocol-message-utils.js","sources":["../src/protocol-message-utils.ts"],"sourcesContent":["import {\n MenuRpcAction,\n MenuRpcResponse,\n OpenDialogActionWithSchema,\n RpcResponse,\n VuuUIMessageOut,\n} from \"@vuu-ui/vuu-data-types\";\nimport {\n ClientToServerMenuRPC,\n OpenDialogAction,\n VuuRpcRequest,\n} from \"@vuu-ui/vuu-protocol-types\";\n\nconst MENU_RPC_TYPES = [\n \"VIEW_PORT_MENUS_SELECT_RPC\",\n \"VIEW_PORT_MENU_TABLE_RPC\",\n \"VIEW_PORT_MENU_ROW_RPC\",\n \"VIEW_PORT_MENU_CELL_RPC\",\n \"VP_EDIT_CELL_RPC\",\n \"VP_EDIT_ROW_RPC\",\n \"VP_EDIT_ADD_ROW_RPC\",\n \"VP_EDIT_DELETE_CELL_RPC\",\n \"VP_EDIT_DELETE_ROW_RPC\",\n \"VP_EDIT_SUBMIT_FORM_RPC\",\n];\n\nexport const isVuuMenuRpcRequest = (\n message: VuuUIMessageOut | VuuRpcRequest | ClientToServerMenuRPC\n): message is ClientToServerMenuRPC => MENU_RPC_TYPES.includes(message[\"type\"]);\n\nexport const isOpenSessionTableDialogMessage = (\n rpcResponse: RpcResponse\n): rpcResponse is MenuRpcResponse<OpenDialogActionWithSchema> =>\n rpcResponse.type === \"VIEW_PORT_MENU_RESP\" &&\n isOpenDialogAction(rpcResponse.action) &&\n \"tableSchema\" in rpcResponse.action;\n\nexport const isOpenDialogAction = (\n action?: MenuRpcAction\n): action is OpenDialogAction =>\n action !== undefined && action.type === \"OPEN_DIALOG_ACTION\";\n"],"names":[],"mappings":"AAaA,MAAM,cAAiB,GAAA;AAAA,EACrB,4BAAA;AAAA,EACA,0BAAA;AAAA,EACA,wBAAA;AAAA,EACA,yBAAA;AAAA,EACA,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA,qBAAA;AAAA,EACA,yBAAA;AAAA,EACA,wBAAA;AAAA,EACA,yBAAA;AACF,CAAA,CAAA;AAEO,MAAM,sBAAsB,CACjC,OAAA,KACqC,eAAe,QAAS,CAAA,OAAA,CAAQ,MAAM,CAAC,EAAA;AAEjE,MAAA,+BAAA,GAAkC,CAC7C,WAAA,KAEA,WAAY,CAAA,IAAA,KAAS,qBACrB,IAAA,kBAAA,CAAmB,WAAY,CAAA,MAAM,CACrC,IAAA,aAAA,IAAiB,WAAY,CAAA,OAAA;AAExB,MAAM,qBAAqB,CAChC,MAAA,KAEA,MAAW,KAAA,KAAA,CAAA,IAAa,OAAO,IAAS,KAAA;;;;"}
1
+ {"version":3,"file":"protocol-message-utils.js","sources":["../src/protocol-message-utils.ts"],"sourcesContent":["import type {\n MenuRpcAction,\n MenuRpcResponse,\n OpenDialogActionWithSchema,\n RpcResponse,\n VuuUIMessageOut,\n VuuUiMessageInRequestResponse,\n} from \"@vuu-ui/vuu-data-types\";\nimport {\n ClientToServerMenuRPC,\n OpenDialogAction,\n VuuRpcRequest,\n} from \"@vuu-ui/vuu-protocol-types\";\n\nconst MENU_RPC_TYPES = [\n \"VIEW_PORT_MENUS_SELECT_RPC\",\n \"VIEW_PORT_MENU_TABLE_RPC\",\n \"VIEW_PORT_MENU_ROW_RPC\",\n \"VIEW_PORT_MENU_CELL_RPC\",\n \"VP_EDIT_CELL_RPC\",\n \"VP_EDIT_ROW_RPC\",\n \"VP_EDIT_ADD_ROW_RPC\",\n \"VP_EDIT_DELETE_CELL_RPC\",\n \"VP_EDIT_DELETE_ROW_RPC\",\n \"VP_EDIT_SUBMIT_FORM_RPC\",\n];\n\nexport const isVuuMenuRpcRequest = (\n message: VuuUIMessageOut | VuuRpcRequest | ClientToServerMenuRPC\n): message is ClientToServerMenuRPC => MENU_RPC_TYPES.includes(message[\"type\"]);\n\nexport const isRequestResponse = (\n message: object\n): message is VuuUiMessageInRequestResponse => \"requestId\" in message;\n\nexport const isOpenSessionTableDialogMessage = (\n rpcResponse: RpcResponse\n): rpcResponse is MenuRpcResponse<OpenDialogActionWithSchema> =>\n rpcResponse.type === \"VIEW_PORT_MENU_RESP\" &&\n isOpenDialogAction(rpcResponse.action) &&\n \"tableSchema\" in rpcResponse.action;\n\nexport const isOpenDialogAction = (\n action?: MenuRpcAction\n): action is OpenDialogAction =>\n action !== undefined && action.type === \"OPEN_DIALOG_ACTION\";\n"],"names":[],"mappings":"AAcA,MAAM,cAAiB,GAAA;AAAA,EACrB,4BAAA;AAAA,EACA,0BAAA;AAAA,EACA,wBAAA;AAAA,EACA,yBAAA;AAAA,EACA,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA,qBAAA;AAAA,EACA,yBAAA;AAAA,EACA,wBAAA;AAAA,EACA,yBAAA;AACF,CAAA,CAAA;AAEO,MAAM,sBAAsB,CACjC,OAAA,KACqC,eAAe,QAAS,CAAA,OAAA,CAAQ,MAAM,CAAC,EAAA;AAEjE,MAAA,iBAAA,GAAoB,CAC/B,OAAA,KAC6C,WAAe,IAAA,QAAA;AAEjD,MAAA,+BAAA,GAAkC,CAC7C,WAAA,KAEA,WAAY,CAAA,IAAA,KAAS,qBACrB,IAAA,kBAAA,CAAmB,WAAY,CAAA,MAAM,CACrC,IAAA,aAAA,IAAiB,WAAY,CAAA,OAAA;AAExB,MAAM,qBAAqB,CAChC,MAAA,KAEA,MAAW,KAAA,KAAA,CAAA,IAAa,OAAO,IAAS,KAAA;;;;"}
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
- "version": "0.8.65",
2
+ "version": "0.8.67",
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.65",
8
- "@vuu-ui/vuu-table-types": "0.8.65",
9
- "@vuu-ui/vuu-filter-types": "0.8.65",
10
- "@vuu-ui/vuu-protocol-types": "0.8.65"
7
+ "@vuu-ui/vuu-data-types": "0.8.67",
8
+ "@vuu-ui/vuu-table-types": "0.8.67",
9
+ "@vuu-ui/vuu-filter-types": "0.8.67",
10
+ "@vuu-ui/vuu-protocol-types": "0.8.67"
11
11
  },
12
12
  "peerDependencies": {
13
13
  "@internationalized/date": "^3.0.0",
14
- "@vuu-ui/vuu-filter-parser": "0.8.65",
14
+ "@vuu-ui/vuu-filter-parser": "0.8.67",
15
15
  "clsx": "^2.0.0",
16
16
  "react": ">=17.0.2",
17
17
  "react-dom": ">=17.0.2"
@@ -0,0 +1,16 @@
1
+ interface VuuBroadcastChannelEventMap<T> {
2
+ message: MessageEvent<T>;
3
+ messageerror: MessageEvent<T>;
4
+ }
5
+ export interface VuuBroadcastChannel<T> extends EventTarget {
6
+ readonly name: string;
7
+ onmessage: ((this: BroadcastChannel, evt: MessageEvent<T>) => void) | null;
8
+ onmessageerror: ((this: BroadcastChannel, evt: MessageEvent<T>) => void) | null;
9
+ close(): void;
10
+ postMessage(message: T): void;
11
+ addEventListener<K extends keyof VuuBroadcastChannelEventMap<T>>(type: K, listener: (this: BroadcastChannel, evt: VuuBroadcastChannelEventMap<T>[K]) => void, options?: boolean | AddEventListenerOptions): void;
12
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
13
+ removeEventListener<K extends keyof VuuBroadcastChannelEventMap<T>>(type: K, listener: (this: BroadcastChannel, evt: VuuBroadcastChannelEventMap<T>[K]) => void, options?: boolean | EventListenerOptions): void;
14
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
15
+ }
16
+ export {};
@@ -7,6 +7,7 @@ export type PathMap = {
7
7
  export type Environment = "development" | "production";
8
8
  export declare const env: Environment;
9
9
  export interface ViewConfig {
10
+ allowRename?: boolean;
10
11
  closeable?: boolean;
11
12
  header?: boolean;
12
13
  }
package/types/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./array-utils";
2
2
  export * from "./box-utils";
3
+ export * from "./broadcast-channel";
3
4
  export * from "./column-utils";
4
5
  export * from "./cookie-utils";
5
6
  export * from "./component-registry";
@@ -1,5 +1,6 @@
1
- import { MenuRpcAction, MenuRpcResponse, OpenDialogActionWithSchema, RpcResponse, VuuUIMessageOut } from "@vuu-ui/vuu-data-types";
1
+ import type { MenuRpcAction, MenuRpcResponse, OpenDialogActionWithSchema, RpcResponse, VuuUIMessageOut, VuuUiMessageInRequestResponse } from "@vuu-ui/vuu-data-types";
2
2
  import { ClientToServerMenuRPC, OpenDialogAction, VuuRpcRequest } from "@vuu-ui/vuu-protocol-types";
3
3
  export declare const isVuuMenuRpcRequest: (message: VuuUIMessageOut | VuuRpcRequest | ClientToServerMenuRPC) => message is ClientToServerMenuRPC;
4
+ export declare const isRequestResponse: (message: object) => message is VuuUiMessageInRequestResponse;
4
5
  export declare const isOpenSessionTableDialogMessage: (rpcResponse: RpcResponse) => rpcResponse is MenuRpcResponse<OpenDialogActionWithSchema>;
5
6
  export declare const isOpenDialogAction: (action?: MenuRpcAction) => action is OpenDialogAction;