@vuu-ui/vuu-data-react 3.5.6 → 3.5.8
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/package.json +14 -14
- package/src/data-editing/get-data-item-edit-control.js +1 -0
- package/types/src/data-editing/EditForm.d.ts +5 -0
- package/types/src/data-editing/UnsavedChangesReport.d.ts +6 -0
- package/types/src/data-editing/edit-rule-validation-checker.d.ts +4 -0
- package/types/src/data-editing/edit-validation-rules.d.ts +1 -0
- package/types/src/data-editing/form-edit-state.d.ts +7 -0
- package/types/src/data-editing/get-data-item-edit-control.d.ts +37 -0
- package/types/src/data-editing/index.d.ts +6 -0
- package/types/src/data-editing/useEditForm.d.ts +21 -0
- package/types/src/datasource-provider/VuuDataSourceProvider.d.ts +17 -0
- package/types/src/datasource-provider/index.d.ts +1 -0
- package/types/src/datasource-provider/useAutoLoginToVuuServer.d.ts +20 -0
- package/types/src/hooks/useLookupValues.d.ts +5 -0
- package/types/src/hooks/useSessionDataSource.d.ts +8 -0
- package/types/src/hooks/useTypeaheadSuggestions.d.ts +4 -0
- package/types/src/hooks/useVisualLinks.d.ts +2 -0
- package/types/src/hooks/useVuuMenuActions.d.ts +39 -0
- package/types/src/hooks/useVuuTables.d.ts +2 -0
- package/types/src/index.d.ts +10 -0
- package/types/src/lost-connection-indicator/LostConnectionIndicator.d.ts +1 -0
- package/types/src/lost-connection-indicator/useLostConnection.d.ts +1 -0
- package/types/src/session-editing-form/SessionEditingForm.d.ts +24 -0
- package/types/src/session-editing-form/index.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.5.
|
|
2
|
+
"version": "3.5.8",
|
|
3
3
|
"main": "./src/index.js",
|
|
4
4
|
"author": "heswell",
|
|
5
5
|
"license": "Apache-2.0",
|
|
@@ -10,21 +10,21 @@
|
|
|
10
10
|
"type-defs": "node ../../scripts/build-type-defs.mjs"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@vuu-ui/vuu-data-types": "3.5.
|
|
14
|
-
"@vuu-ui/vuu-filter-types": "3.5.
|
|
15
|
-
"@vuu-ui/vuu-protocol-types": "3.5.
|
|
16
|
-
"@vuu-ui/vuu-table-types": "3.5.
|
|
13
|
+
"@vuu-ui/vuu-data-types": "3.5.8",
|
|
14
|
+
"@vuu-ui/vuu-filter-types": "3.5.8",
|
|
15
|
+
"@vuu-ui/vuu-protocol-types": "3.5.8",
|
|
16
|
+
"@vuu-ui/vuu-table-types": "3.5.8"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@vuu-ui/vuu-context-menu": "3.5.
|
|
20
|
-
"@vuu-ui/vuu-data-remote": "3.5.
|
|
21
|
-
"@vuu-ui/vuu-filter-parser": "3.5.
|
|
22
|
-
"@vuu-ui/vuu-filters": "3.5.
|
|
23
|
-
"@vuu-ui/vuu-layout": "3.5.
|
|
24
|
-
"@vuu-ui/vuu-notifications": "3.5.
|
|
25
|
-
"@vuu-ui/vuu-ui-controls": "3.5.
|
|
26
|
-
"@vuu-ui/vuu-utils": "3.5.
|
|
27
|
-
"@vuu-ui/vuu-table": "3.5.
|
|
19
|
+
"@vuu-ui/vuu-context-menu": "3.5.8",
|
|
20
|
+
"@vuu-ui/vuu-data-remote": "3.5.8",
|
|
21
|
+
"@vuu-ui/vuu-filter-parser": "3.5.8",
|
|
22
|
+
"@vuu-ui/vuu-filters": "3.5.8",
|
|
23
|
+
"@vuu-ui/vuu-layout": "3.5.8",
|
|
24
|
+
"@vuu-ui/vuu-notifications": "3.5.8",
|
|
25
|
+
"@vuu-ui/vuu-ui-controls": "3.5.8",
|
|
26
|
+
"@vuu-ui/vuu-utils": "3.5.8",
|
|
27
|
+
"@vuu-ui/vuu-table": "3.5.8",
|
|
28
28
|
"@salt-ds/core": "1.54.1",
|
|
29
29
|
"@salt-ds/styles": "0.2.1",
|
|
30
30
|
"@salt-ds/window": "0.1.1"
|
|
@@ -0,0 +1,5 @@
|
|
|
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;
|
|
@@ -0,0 +1,6 @@
|
|
|
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;
|
|
@@ -0,0 +1,4 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const registerRules: () => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
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;
|
|
@@ -0,0 +1,37 @@
|
|
|
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;
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./VuuDataSourceProvider";
|
|
@@ -0,0 +1,20 @@
|
|
|
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;
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
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;
|
|
@@ -0,0 +1,39 @@
|
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
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";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LostConnectionIndicator: () => import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useLostConnection: () => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./SessionEditingForm";
|