@vuu-ui/vuu-data-react 4.0.0-alpha.20 → 4.0.0-alpha.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/package.json +18 -18
  2. package/src/data-editing/get-data-item-edit-control.js +15 -0
  3. package/src/hooks/useLookupValues.js +10 -5
  4. package/src/lost-connection-indicator/useLostConnection.js +7 -6
  5. package/src/session-editing-form/SessionEditingForm.js +5 -3
  6. package/types/data-editing/EditForm.d.ts +1 -1
  7. package/types/data-editing/UnsavedChangesReport.d.ts +1 -1
  8. package/types/data-editing/get-data-item-edit-control.d.ts +5 -3
  9. package/types/data-editing/useEditForm.d.ts +2 -2
  10. package/types/datasource-provider/VuuDataSourceProvider.d.ts +1 -1
  11. package/types/lost-connection-indicator/LostConnectionIndicator.d.ts +1 -1
  12. package/types/session-editing-form/SessionEditingForm.d.ts +1 -1
  13. package/types/datasource-provider/useAutoLoginToVuuServer.d.ts +0 -20
  14. package/types/src/data-editing/EditForm.d.ts +0 -5
  15. package/types/src/data-editing/UnsavedChangesReport.d.ts +0 -6
  16. package/types/src/data-editing/edit-rule-validation-checker.d.ts +0 -4
  17. package/types/src/data-editing/edit-validation-rules.d.ts +0 -1
  18. package/types/src/data-editing/form-edit-state.d.ts +0 -7
  19. package/types/src/data-editing/get-data-item-edit-control.d.ts +0 -37
  20. package/types/src/data-editing/index.d.ts +0 -6
  21. package/types/src/data-editing/useEditForm.d.ts +0 -21
  22. package/types/src/datasource-provider/VuuDataSourceProvider.d.ts +0 -17
  23. package/types/src/datasource-provider/index.d.ts +0 -1
  24. package/types/src/datasource-provider/useAutoLoginToVuuServer.d.ts +0 -20
  25. package/types/src/hooks/useLookupValues.d.ts +0 -5
  26. package/types/src/hooks/useSessionDataSource.d.ts +0 -8
  27. package/types/src/hooks/useTypeaheadSuggestions.d.ts +0 -4
  28. package/types/src/hooks/useVisualLinks.d.ts +0 -2
  29. package/types/src/hooks/useVuuMenuActions.d.ts +0 -39
  30. package/types/src/hooks/useVuuTables.d.ts +0 -2
  31. package/types/src/index.d.ts +0 -10
  32. package/types/src/lost-connection-indicator/LostConnectionIndicator.d.ts +0 -1
  33. package/types/src/lost-connection-indicator/useLostConnection.d.ts +0 -1
  34. package/types/src/session-editing-form/SessionEditingForm.d.ts +0 -24
  35. package/types/src/session-editing-form/index.d.ts +0 -1
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.0.0-alpha.20",
2
+ "version": "4.0.0-alpha.22",
3
3
  "main": "./src/index.js",
4
4
  "author": "heswell",
5
5
  "type": "module",
@@ -11,25 +11,25 @@
11
11
  "type-defs": "node ../../scripts/build-type-defs.mjs"
12
12
  },
13
13
  "devDependencies": {
14
- "@vuu-ui/vuu-data-types": "4.0.0-alpha.20",
15
- "@vuu-ui/vuu-filter-types": "4.0.0-alpha.20",
16
- "@vuu-ui/vuu-protocol-types": "4.0.0-alpha.20",
17
- "@vuu-ui/vuu-table-types": "4.0.0-alpha.20"
14
+ "@vuu-ui/vuu-data-types": "4.0.0-alpha.22",
15
+ "@vuu-ui/vuu-filter-types": "4.0.0-alpha.22",
16
+ "@vuu-ui/vuu-protocol-types": "4.0.0-alpha.22",
17
+ "@vuu-ui/vuu-table-types": "4.0.0-alpha.22"
18
18
  },
19
19
  "dependencies": {
20
- "@vuu-ui/vuu-context-menu": "4.0.0-alpha.20",
21
- "@vuu-ui/vuu-data-remote": "4.0.0-alpha.20",
22
- "@vuu-ui/vuu-filter-parser": "4.0.0-alpha.20",
23
- "@vuu-ui/vuu-filters": "4.0.0-alpha.20",
24
- "@vuu-ui/vuu-layout": "4.0.0-alpha.20",
25
- "@vuu-ui/vuu-notifications": "4.0.0-alpha.20",
26
- "@vuu-ui/vuu-ui-controls": "4.0.0-alpha.20",
27
- "@vuu-ui/vuu-utils": "4.0.0-alpha.20",
28
- "@vuu-ui/vuu-table": "4.0.0-alpha.20",
29
- "@salt-ds/core": "1.67.0",
30
- "@salt-ds/styles": "0.2.1",
31
- "@salt-ds/window": "0.1.1",
32
- "@vuu-ui/core": "4.0.0-alpha.20"
20
+ "@vuu-ui/vuu-context-menu": "4.0.0-alpha.22",
21
+ "@vuu-ui/vuu-data-remote": "4.0.0-alpha.22",
22
+ "@vuu-ui/vuu-filter-parser": "4.0.0-alpha.22",
23
+ "@vuu-ui/vuu-filters": "4.0.0-alpha.22",
24
+ "@vuu-ui/vuu-layout": "4.0.0-alpha.22",
25
+ "@vuu-ui/vuu-notifications": "4.0.0-alpha.22",
26
+ "@vuu-ui/vuu-ui-controls": "4.0.0-alpha.22",
27
+ "@vuu-ui/vuu-utils": "4.0.0-alpha.22",
28
+ "@vuu-ui/vuu-table": "4.0.0-alpha.22",
29
+ "@salt-ds/core": "1.72.0",
30
+ "@salt-ds/styles": "0.4.1",
31
+ "@salt-ds/window": "0.1.2",
32
+ "@vuu-ui/core": "4.0.0-alpha.22"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "clsx": "^2.0.0",
@@ -21,6 +21,10 @@ function toTimeString(value, timestamp, { timeZone }, milliseconds = false) {
21
21
  if (isValidTimeString(timeString)) return timeString;
22
22
  }
23
23
  }
24
+ const BOOLEAN_TOGGLE_VALUES = [
25
+ true,
26
+ false
27
+ ];
24
28
  const getDataItemEditControl = ({ InputProps, TypeaheadProps, className, commitOnBlur, commitWhenCleared, dataDescriptor, editOperation = "update", errorMessage, labels, onCommit, table, values, variant })=>{
25
29
  const dataVariant = variant && "toggle" !== variant ? variant : void 0;
26
30
  const temporalInfo = getTemporalInfo(dataDescriptor);
@@ -82,6 +86,17 @@ const getDataItemEditControl = ({ InputProps, TypeaheadProps, className, commitO
82
86
  "data-edit-control": true
83
87
  });
84
88
  }
89
+ if ("toggle" === variant && "boolean" === dataDescriptor.serverDataType) return /*#__PURE__*/ jsx(ToggleFilter, {
90
+ className: className,
91
+ column: dataDescriptor.name,
92
+ "data-edit-control": true,
93
+ disableTypeahead: true,
94
+ labels: labels,
95
+ onCommit: onCommit,
96
+ table: table,
97
+ values: values?.length ? values : BOOLEAN_TOGGLE_VALUES,
98
+ value: InputProps?.inputProps?.value ?? "all"
99
+ });
85
100
  if ("string" === dataDescriptor.serverDataType && table) if ("toggle" === variant && values?.length) return /*#__PURE__*/ jsx(ToggleFilter, {
86
101
  className: className,
87
102
  column: dataDescriptor.name,
@@ -1,4 +1,5 @@
1
- import { VuuDataSource } from "@vuu-ui/vuu-data-remote";
1
+ import { useData, useOptionalVuuConnectionId } from "@vuu-ui/core";
2
+ import { DEFAULT_CONNECTION_ID } from "@vuu-ui/vuu-data-remote";
2
3
  import { Range, buildColumnMap, getSelectedOption, isLookupRenderer, isTypeDescriptor, isValueListRenderer, useShellContext } from "@vuu-ui/vuu-utils";
3
4
  import { useMemo, useState } from "react";
4
5
  const NO_VALUES = [];
@@ -7,8 +8,8 @@ const toListOption = (value)=>({
7
8
  value
8
9
  });
9
10
  const lookupValueMap = new Map();
10
- const loadLookupValues = ({ labelColumn, table, valueColumn })=>{
11
- const tableKey = `${table.module}:${table.table}`;
11
+ const loadLookupValues = (connectionId, VuuDataSource, { labelColumn, table, valueColumn })=>{
12
+ const tableKey = `${connectionId}:${table.module}:${table.table}`;
12
13
  const lookupValues = lookupValueMap.get(tableKey);
13
14
  if (lookupValues) return lookupValues;
14
15
  {
@@ -49,6 +50,8 @@ const getLookupDetails = ({ name, type })=>{
49
50
  const useLookupValues = (column, initialValueProp)=>{
50
51
  const { type: columnType } = column;
51
52
  const { getLookupValues } = useShellContext();
53
+ const { VuuDataSource } = useData();
54
+ const connectionId = useOptionalVuuConnectionId() ?? DEFAULT_CONNECTION_ID;
52
55
  const initialState = useMemo(()=>{
53
56
  if (isTypeDescriptor(columnType) && isValueListRenderer(columnType?.renderer)) {
54
57
  const values = columnType.renderer.values.map(toListOption);
@@ -75,7 +78,7 @@ const useLookupValues = (column, initialValueProp)=>{
75
78
  useMemo(()=>{
76
79
  if (values === NO_VALUES) {
77
80
  const lookupDetails = getLookupDetails(column);
78
- loadLookupValues(lookupDetails).then((values)=>setLookupState({
81
+ loadLookupValues(connectionId, VuuDataSource, lookupDetails).then((values)=>setLookupState({
79
82
  initialValue: getSelectedOption(values, initialValueProp) ?? null,
80
83
  values
81
84
  }));
@@ -83,7 +86,9 @@ const useLookupValues = (column, initialValueProp)=>{
83
86
  }, [
84
87
  values,
85
88
  column,
86
- initialValueProp
89
+ initialValueProp,
90
+ connectionId,
91
+ VuuDataSource
87
92
  ]);
88
93
  return {
89
94
  initialValue,
@@ -1,11 +1,13 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { ConnectionManager, isConnected } from "@vuu-ui/vuu-data-remote";
3
- import { useCallback, useMemo, useRef } from "react";
2
+ import { useOptionalVuuConnectionId } from "@vuu-ui/core";
3
+ import { ConnectionManager, DEFAULT_CONNECTION_ID, isConnected } from "@vuu-ui/vuu-data-remote";
4
+ import { useCallback, useEffect, useRef } from "react";
4
5
  import { NotificationType, useNotifications } from "@vuu-ui/vuu-notifications";
5
6
  import { LostConnectionIndicator } from "./LostConnectionIndicator.js";
6
7
  const useLostConnection = ()=>{
7
8
  const { hideNotification, showNotification } = useNotifications();
8
- const isConnectedRef = useRef(ConnectionManager.connected);
9
+ const connectionId = useOptionalVuuConnectionId() ?? DEFAULT_CONNECTION_ID;
10
+ const isConnectedRef = useRef(ConnectionManager.connectedFor(connectionId));
9
11
  const handleConnectionStatusChange = useCallback((connectionStatus)=>{
10
12
  const { current: wasConnected } = isConnectedRef;
11
13
  isConnectedRef.current = isConnected(connectionStatus);
@@ -19,9 +21,8 @@ const useLostConnection = ()=>{
19
21
  hideNotification,
20
22
  showNotification
21
23
  ]);
22
- useMemo(async ()=>{
23
- ConnectionManager.on("connection-status", handleConnectionStatusChange);
24
- }, [
24
+ useEffect(()=>ConnectionManager.onConnectionStatus(connectionId, handleConnectionStatusChange), [
25
+ connectionId,
25
26
  handleConnectionStatusChange
26
27
  ]);
27
28
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { VuuDataSource } from "@vuu-ui/vuu-data-remote";
2
+ import { useData } from "@vuu-ui/core";
3
3
  import { Range, buildColumnMap, getTypedValue, queryClosest, shallowEquals } from "@vuu-ui/vuu-utils";
4
4
  import { Button, FormField, FormFieldHelperText, FormFieldLabel, Input, useIdMemo } from "@salt-ds/core";
5
5
  import { useComponentCssInjection } from "@salt-ds/styles";
@@ -31,7 +31,7 @@ const Status = {
31
31
  changed: 2,
32
32
  invalid: 3
33
33
  };
34
- const getDataSource = (dataSource, schema)=>{
34
+ const getDataSource = (VuuDataSource, dataSource, schema)=>{
35
35
  if (dataSource) return dataSource;
36
36
  if (schema) return new VuuDataSource({
37
37
  bufferSize: 0,
@@ -53,8 +53,9 @@ const SessionEditingForm_SessionEditingForm = ({ className, config: { fields, ke
53
53
  const formContentRef = useRef(null);
54
54
  const initialDataRef = useRef(void 0);
55
55
  const dataStatusRef = useRef(Status.uninitialised);
56
+ const { VuuDataSource } = useData();
56
57
  const dataSource = useMemo(()=>{
57
- const ds = getDataSource(dataSourceProp, schema);
58
+ const ds = getDataSource(VuuDataSource, dataSourceProp, schema);
58
59
  const { columns } = ds;
59
60
  const columnMap = buildColumnMap(ds.columns);
60
61
  const applyServerData = (data)=>{
@@ -76,6 +77,7 @@ const SessionEditingForm_SessionEditingForm = ({ className, config: { fields, ke
76
77
  });
77
78
  return ds;
78
79
  }, [
80
+ VuuDataSource,
79
81
  dataSourceProp,
80
82
  schema
81
83
  ]);
@@ -2,4 +2,4 @@ import type { HTMLAttributes } from "react";
2
2
  import { type EditFormHookProps } from "./useEditForm";
3
3
  export interface EditFormProps extends EditFormHookProps, Omit<HTMLAttributes<HTMLDivElement>, "onSubmit"> {
4
4
  }
5
- export declare const EditForm: ({ className, dataSource, formFieldDescriptors, onSubmit: onSubmitProp, ...htmlAttributes }: EditFormProps) => import("react").JSX.Element;
5
+ export declare const EditForm: ({ className, dataSource, formFieldDescriptors, onSubmit: onSubmitProp, ...htmlAttributes }: EditFormProps) => import("react/jsx-runtime").JSX.Element;
@@ -3,4 +3,4 @@ export interface UnsavedChangesReportProps<T extends Entity = Entity> {
3
3
  entity: T;
4
4
  editedEntity: T;
5
5
  }
6
- export declare const UnsavedChangesReport: ({ entity, editedEntity, }: UnsavedChangesReportProps) => import("react").JSX.Element;
6
+ export declare const UnsavedChangesReport: ({ entity, editedEntity, }: UnsavedChangesReportProps) => import("react/jsx-runtime").JSX.Element;
@@ -2,6 +2,7 @@ import type { DataValueDescriptor, TableSchemaTable } from "@vuu-ui/vuu-data-typ
2
2
  import { type VuuTypeaheadInputProps } from "@vuu-ui/vuu-ui-controls";
3
3
  import { type CommitHandler } from "@vuu-ui/vuu-utils";
4
4
  import type { InputProps } from "@salt-ds/core";
5
+ import { type ToggleFilterValue } from "@vuu-ui/vuu-filters";
5
6
  /**
6
7
  * variant can be used to provide a rendering hint to the filter control rendered.
7
8
  * 'toggle' for A ToggleButtonGroup, only suitable for up to 3 value choices
@@ -33,10 +34,11 @@ export interface DataItemEditControlProps {
33
34
  * They will be validated against server with Typeahead service, so
34
35
  * unavailable options are not offered.
35
36
  * Recommended for toggle filters, not usually necessary for other
36
- * filter variants.
37
+ * filter variants. Boolean values are supported for toggle filters on
38
+ * boolean columns, where values default to [true, false].
37
39
  */
38
- values?: string[];
40
+ values?: ToggleFilterValue[];
39
41
  variant?: FilterControlVariant;
40
42
  }
41
43
  export type ValidationStatus = "initial" | true | string;
42
- export declare const getDataItemEditControl: ({ InputProps, TypeaheadProps, className, commitOnBlur, commitWhenCleared, dataDescriptor, editOperation, errorMessage, labels, onCommit, table, values, variant, }: DataItemEditControlProps) => import("react").JSX.Element;
44
+ export declare const getDataItemEditControl: ({ InputProps, TypeaheadProps, className, commitOnBlur, commitWhenCleared, dataDescriptor, editOperation, errorMessage, labels, onCommit, table, values, variant, }: DataItemEditControlProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import type { DataSource, DataValueDescriptor } from "@vuu-ui/vuu-data-types";
2
2
  import { type CommitHandler, type Entity } from "@vuu-ui/vuu-utils";
3
- import { type ChangeEventHandler, type FocusEventHandler } from "react";
3
+ import { type FormEventHandler, type FocusEventHandler } from "react";
4
4
  export interface EditFormHookProps {
5
5
  dataSource?: DataSource;
6
6
  formFieldDescriptors: DataValueDescriptor[];
@@ -14,7 +14,7 @@ export declare const useEditForm: ({ dataSource, formFieldDescriptors, onSubmit,
14
14
  isClean: boolean;
15
15
  ok: boolean;
16
16
  onCancel: () => Promise<void>;
17
- onChange: ChangeEventHandler<HTMLElement>;
17
+ onChange: FormEventHandler<HTMLElement>;
18
18
  onCommit: CommitHandler<HTMLElement>;
19
19
  onFocus: FocusEventHandler;
20
20
  onSubmit: () => Promise<void>;
@@ -5,4 +5,4 @@ import { type ReactNode } from "react";
5
5
  */
6
6
  export declare const VuuDataSourceProvider: ({ children, }: {
7
7
  children: ReactNode;
8
- }) => import("react").JSX.Element;
8
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- export declare const LostConnectionIndicator: () => import("react").JSX.Element;
1
+ export declare const LostConnectionIndicator: () => import("react/jsx-runtime").JSX.Element;
@@ -21,4 +21,4 @@ export interface SessionEditingFormProps extends HTMLAttributes<HTMLDivElement>
21
21
  dataSource?: DataSource;
22
22
  schema?: TableSchema;
23
23
  }
24
- export declare const SessionEditingForm: ({ className, config: { fields, key: keyField }, dataSource: dataSourceProp, id: idProp, onClose, schema, ...htmlAttributes }: SessionEditingFormProps) => import("react").JSX.Element;
24
+ export declare const SessionEditingForm: ({ className, config: { fields, key: keyField }, dataSource: dataSourceProp, id: idProp, onClose, schema, ...htmlAttributes }: SessionEditingFormProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,20 +0,0 @@
1
- export declare const useAutoLoginToVuuServer: ({ authenticate, autoConnect, secure, token: tokenProp, user, websocketUrl, }?: {
2
- /**
3
- * if true, auth url on vuuserver will be used to get token
4
- * auth url is "/api/authn"
5
- */
6
- authenticate?: boolean;
7
- /**
8
- * true by default, will go ahead and open websocket connection
9
- */
10
- autoConnect?: boolean;
11
- autoLogin?: boolean;
12
- secure?: boolean;
13
- /**
14
- * use with no authenticate step, to provide auth token.
15
- * Used when vuu server is performing no token check
16
- */
17
- token?: string;
18
- user?: string;
19
- websocketUrl?: string;
20
- }) => import("react/jsx-runtime").JSX.Element | undefined;
@@ -1,5 +0,0 @@
1
- import { HTMLAttributes } from "react";
2
- import { EditFormHookProps } from "./useEditForm";
3
- export interface EditFormProps extends EditFormHookProps, Omit<HTMLAttributes<HTMLDivElement>, "onSubmit"> {
4
- }
5
- export declare const EditForm: ({ className, dataSource, formFieldDescriptors, onSubmit: onSubmitProp, ...htmlAttributes }: EditFormProps) => import("react").JSX.Element;
@@ -1,6 +0,0 @@
1
- import { Entity } from "@vuu-ui/vuu-utils";
2
- export interface UnsavedChangesReportProps<T extends Entity = Entity> {
3
- entity: T;
4
- editedEntity: T;
5
- }
6
- export declare const UnsavedChangesReport: ({ entity, editedEntity, }: UnsavedChangesReportProps) => import("react").JSX.Element;
@@ -1,4 +0,0 @@
1
- import type { DataValueDescriptor, DataValueValidationChecker, EditPhase, EditRuleValidationSuccessResult, EditValidationRule } from "@vuu-ui/vuu-data-types";
2
- export declare const OK: EditRuleValidationSuccessResult;
3
- export declare function getEditValidationRules(descriptor: DataValueDescriptor, editPhase: EditPhase | "*"): EditValidationRule[];
4
- export declare const buildValidationChecker: (rules: EditValidationRule[]) => DataValueValidationChecker;
@@ -1 +0,0 @@
1
- export declare const registerRules: () => void;
@@ -1,7 +0,0 @@
1
- import { Entity } from "@vuu-ui/vuu-utils";
2
- export type FormEditState = {
3
- isClean: boolean;
4
- editedFields: string[];
5
- };
6
- export declare const CLEAN_FORM: FormEditState;
7
- export declare const buildFormEditState: (entity: Entity | undefined, newEntity: Entity) => FormEditState;
@@ -1,37 +0,0 @@
1
- import type { DataValueDescriptor, TableSchemaTable } from "@vuu-ui/vuu-data-types";
2
- import { type VuuTypeaheadInputProps } from "@vuu-ui/vuu-ui-controls";
3
- import { type CommitHandler } from "@vuu-ui/vuu-utils";
4
- import type { InputProps } from "@salt-ds/core";
5
- /**
6
- * variant can be used to provide a rendering hint to the filter control rendered.
7
- * 'toggle' for A ToggleButtonGroup, only suitable for up to 3 value choices
8
- * 'search' to render a search icon and require at least one character to be entered.
9
- * 'pick' to show a dropdown list, even before any text is entered, best for smaller lists
10
- */
11
- export type FilterControlVariant = "search" | "pick" | "toggle";
12
- export interface DataItemEditControlProps {
13
- InputProps?: Partial<InputProps>;
14
- TypeaheadProps?: Pick<VuuTypeaheadInputProps, "highlightFirstSuggestion" | "minCharacterCountToTriggerSuggestions" | "selectOnTab">;
15
- className?: string;
16
- commitOnBlur?: boolean;
17
- commitWhenCleared?: boolean;
18
- /**
19
- * A table column or form field Descriptor.
20
- */
21
- dataDescriptor: DataValueDescriptor;
22
- editOperation?: "insert" | "update";
23
- errorMessage?: string;
24
- onCommit: CommitHandler<HTMLElement>;
25
- table?: TableSchemaTable;
26
- /**
27
- * Where provided, only these values will be offered as suggestions.
28
- * They will be validated against server with Typeahead service, so
29
- * unavailable options are not offered.
30
- * Recommended for toggle filters, not usually necessary for other
31
- * filter variants.
32
- */
33
- values?: string[];
34
- variant?: FilterControlVariant;
35
- }
36
- export type ValidationStatus = "initial" | true | string;
37
- export declare const getDataItemEditControl: ({ InputProps, TypeaheadProps, className, commitOnBlur, commitWhenCleared, dataDescriptor, editOperation, errorMessage, onCommit, table, values, variant, }: DataItemEditControlProps) => import("react").JSX.Element;
@@ -1,6 +0,0 @@
1
- export * from "./get-data-item-edit-control";
2
- export * from "./EditForm";
3
- export * from "./edit-rule-validation-checker";
4
- export * from "./UnsavedChangesReport";
5
- export * from "./useEditForm";
6
- export * from "./form-edit-state";
@@ -1,21 +0,0 @@
1
- import type { DataSource, DataValueDescriptor } from "@vuu-ui/vuu-data-types";
2
- import { CommitHandler, Entity } from "@vuu-ui/vuu-utils";
3
- import { FocusEventHandler, SyntheticEvent } from "react";
4
- export interface EditFormHookProps {
5
- dataSource?: DataSource;
6
- formFieldDescriptors: DataValueDescriptor[];
7
- onSubmit?: () => void;
8
- }
9
- export declare const useEditForm: ({ dataSource, formFieldDescriptors, onSubmit, }: EditFormHookProps) => {
10
- editedFields: string[];
11
- editEntity: Entity | undefined;
12
- errorMessages: Record<string, string>;
13
- formFieldsContainerRef: import("react").RefObject<HTMLDivElement | null>;
14
- isClean: boolean;
15
- ok: boolean;
16
- onCancel: () => Promise<void>;
17
- onChange: (evt: SyntheticEvent<HTMLInputElement>) => void;
18
- onCommit: CommitHandler<HTMLElement>;
19
- onFocus: FocusEventHandler;
20
- onSubmit: () => Promise<void>;
21
- };
@@ -1,17 +0,0 @@
1
- import { ReactNode } from "react";
2
- /**
3
- * DataSource Providers inject a DataSource constructor, made available
4
- * to clients via the useData hook. This provider offers the standard
5
- * VuuDataSource, which will source data from a remote vuu server.
6
- *
7
- * In production code, it will generally be used without props, authentication
8
- * and connection to vuu server will be handled elsewhere. The props are
9
- * useful for rendering standalone components.
10
- */
11
- export declare const VuuDataSourceProvider: ({ authenticate, autoConnect, autoLogin, children, websocketUrl, }: {
12
- authenticate?: boolean;
13
- autoConnect?: boolean;
14
- autoLogin?: boolean;
15
- children: ReactNode;
16
- websocketUrl?: string;
17
- }) => import("react").JSX.Element;
@@ -1 +0,0 @@
1
- export * from "./VuuDataSourceProvider";
@@ -1,20 +0,0 @@
1
- export declare const useAutoLoginToVuuServer: ({ authenticate, autoConnect, secure, token: tokenProp, user, websocketUrl, }?: {
2
- /**
3
- * if true, auth url on vuuserver will be used to get token
4
- * auth url is "/api/authn"
5
- */
6
- authenticate?: boolean;
7
- /**
8
- * true by default, will go ahead and open websocket connection
9
- */
10
- autoConnect?: boolean;
11
- autoLogin?: boolean;
12
- secure?: boolean;
13
- /**
14
- * use with no authenticate step, to provide auth token.
15
- * Used when vuu server is performing no token check
16
- */
17
- token?: string;
18
- user?: string;
19
- websocketUrl?: string;
20
- }) => import("react").JSX.Element | undefined;
@@ -1,5 +0,0 @@
1
- import { ColumnDescriptor, ListOption } from "@vuu-ui/vuu-table-types";
2
- export declare const useLookupValues: (column: ColumnDescriptor, initialValueProp: number | string) => {
3
- initialValue: ListOption | null;
4
- values: ListOption[];
5
- };
@@ -1,8 +0,0 @@
1
- import type { DataSource, DataSourceConfigChangeHandler, DataSourceConstructorProps } from "@vuu-ui/vuu-data-types";
2
- export interface SessionStateHookProps {
3
- onConfigChange?: DataSourceConfigChangeHandler;
4
- }
5
- export declare const useSessionDataSource: (props?: SessionStateHookProps) => {
6
- clearDataSource: (sessionKey: string, unsubscribe?: boolean) => void;
7
- getDataSource: (sessionKey: string, dataSourceConstructorProps?: DataSourceConstructorProps) => DataSource;
8
- };
@@ -1,4 +0,0 @@
1
- import { SuggestionFetcher, TableSchemaTable } from "@vuu-ui/vuu-data-types";
2
- import { TypeaheadParams } from "@vuu-ui/vuu-protocol-types";
3
- export declare const getTypeaheadParams: (table: TableSchemaTable, column: string, text?: string, selectedValues?: string[]) => TypeaheadParams;
4
- export declare const useTypeaheadSuggestions: () => SuggestionFetcher;
@@ -1,2 +0,0 @@
1
- import type { DataSource } from "@vuu-ui/vuu-data-types";
2
- export declare const useVisualLinks: (dataSource: DataSource) => void;
@@ -1,39 +0,0 @@
1
- import { type MenuActionHandler } from "@vuu-ui/vuu-context-menu";
2
- import { DataSource, DataSourceVisualLinkCreatedMessage, RpcResponseHandler } from "@vuu-ui/vuu-data-types";
3
- import type { LinkDescriptorWithLabel, VuuDataRowDto, VuuMenu, VuuMenuItem, VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
4
- import type { ColumnDescriptor, TableContextMenuDef } from "@vuu-ui/vuu-table-types";
5
- export interface MenuActionConfig {
6
- vuuMenu?: VuuMenu;
7
- visualLink?: DataSourceVisualLinkCreatedMessage;
8
- visualLinks?: LinkDescriptorWithLabel[];
9
- }
10
- export interface VuuMenuActionHookProps {
11
- /**
12
- * By default, vuuMenuActions will be handled automatically. When activated, a
13
- * message will be sent to server and response will be handled here too.
14
- * This prop allows client to provide a custom handler for a menu Item. This will
15
- * take priority and if handler returns true, no further processing for the menu
16
- * item will be handled by Vuu. This can also be used to prevent an item from being
17
- * actioned, even when no custom handling is intended. If the handler returns false,
18
- * Vuu will process the menuItem.
19
- */
20
- clientSideMenuActionHandler?: MenuActionHandler;
21
- dataSource?: DataSource;
22
- menuActionConfig?: MenuActionConfig;
23
- onRpcResponse?: RpcResponseHandler;
24
- }
25
- export interface VuuCellContextMenuItemOptions extends VuuMenuItem {
26
- rowKey: string;
27
- field: string;
28
- value: VuuRowDataItemType;
29
- }
30
- export interface VuuRowContextMenuItemOptions extends VuuMenuItem {
31
- rowKey: string;
32
- row: VuuDataRowDto;
33
- }
34
- export interface VuuSelectedRowsContextMenuItemOptions extends VuuMenuItem {
35
- columns: ColumnDescriptor[];
36
- }
37
- export declare const isRowMenu: (options: VuuMenuItem) => options is VuuRowContextMenuItemOptions;
38
- export declare const isSelectionMenu: (options: VuuMenuItem) => options is VuuSelectedRowsContextMenuItemOptions;
39
- export declare const useVuuMenuActions: ({ clientSideMenuActionHandler, dataSource, onRpcResponse, }: VuuMenuActionHookProps) => TableContextMenuDef;
@@ -1,2 +0,0 @@
1
- import type { TableSchema } from "@vuu-ui/vuu-data-types";
2
- export declare const useVuuTables: () => TableSchema[] | undefined;
@@ -1,10 +0,0 @@
1
- export * from "./data-editing";
2
- export * from "./datasource-provider";
3
- export { useLookupValues } from "./hooks/useLookupValues";
4
- export { useSessionDataSource } from "./hooks/useSessionDataSource";
5
- export { getTypeaheadParams, useTypeaheadSuggestions, } from "./hooks/useTypeaheadSuggestions";
6
- export { useVisualLinks } from "./hooks/useVisualLinks";
7
- export { isRowMenu, isSelectionMenu, useVuuMenuActions, type MenuActionConfig, } from "./hooks/useVuuMenuActions";
8
- export { useVuuTables } from "./hooks/useVuuTables";
9
- export { useLostConnection } from "./lost-connection-indicator/useLostConnection";
10
- export * from "./session-editing-form";
@@ -1 +0,0 @@
1
- export declare const LostConnectionIndicator: () => import("react").JSX.Element;
@@ -1 +0,0 @@
1
- export declare const useLostConnection: () => void;
@@ -1,24 +0,0 @@
1
- import { DataSource, TableSchema } from "@vuu-ui/vuu-data-types";
2
- import { VuuColumnDataType } from "@vuu-ui/vuu-protocol-types";
3
- import { HTMLAttributes } from "react";
4
- export type FormFieldDescriptor = {
5
- isKeyField?: boolean;
6
- label?: string;
7
- name: string;
8
- type: VuuColumnDataType;
9
- description: string;
10
- readonly?: boolean;
11
- required?: boolean;
12
- };
13
- export type FormConfig = {
14
- title: string;
15
- key: string;
16
- fields: FormFieldDescriptor[];
17
- };
18
- export interface SessionEditingFormProps extends HTMLAttributes<HTMLDivElement> {
19
- config: FormConfig;
20
- onClose?: () => void;
21
- dataSource?: DataSource;
22
- schema?: TableSchema;
23
- }
24
- export declare const SessionEditingForm: ({ className, config: { fields, key: keyField }, dataSource: dataSourceProp, id: idProp, onClose, schema, ...htmlAttributes }: SessionEditingFormProps) => import("react").JSX.Element;
@@ -1 +0,0 @@
1
- export * from "./SessionEditingForm";