@vuu-ui/vuu-data-react 0.13.4 → 0.13.5
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 +20 -17
- package/types/data-editing/EditForm.d.ts +5 -0
- package/types/data-editing/UnsavedChangesReport.d.ts +6 -0
- package/types/data-editing/edit-rule-validation-checker.d.ts +4 -0
- package/types/data-editing/edit-validation-rules.d.ts +1 -0
- package/types/data-editing/form-edit-state.d.ts +7 -0
- package/types/data-editing/get-data-item-edit-control.d.ts +18 -0
- package/types/data-editing/index.d.ts +6 -0
- package/types/data-editing/useEditForm.d.ts +21 -0
- package/types/datasource-provider/RestDataSourceProvider.d.ts +11 -0
- package/types/datasource-provider/VuuDataSourceProvider.d.ts +8 -0
- package/types/datasource-provider/index.d.ts +2 -0
- package/types/datasource-provider/useAutoLoginToVuuServer.d.ts +7 -0
- package/types/hooks/index.d.ts +6 -0
- package/types/hooks/useLookupValues.d.ts +5 -0
- package/types/hooks/useSessionDataSource.d.ts +5 -0
- package/types/hooks/useTypeaheadSuggestions.d.ts +4 -0
- package/types/hooks/useVisualLinks.d.ts +2 -0
- package/types/hooks/useVuuMenuActions.d.ts +44 -0
- package/types/hooks/useVuuTables.d.ts +2 -0
- package/types/index.d.ts +4 -0
- package/types/session-editing-form/SessionEditingForm.d.ts +24 -0
- package/types/session-editing-form/index.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.13.
|
|
2
|
+
"version": "0.13.5",
|
|
3
3
|
"author": "heswell",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@vuu-ui/vuu-data-types": "0.13.
|
|
7
|
-
"@vuu-ui/vuu-filter-types": "0.13.
|
|
8
|
-
"@vuu-ui/vuu-popups": "0.13.
|
|
9
|
-
"@vuu-ui/vuu-protocol-types": "0.13.
|
|
10
|
-
"@vuu-ui/vuu-table-types": "0.13.
|
|
6
|
+
"@vuu-ui/vuu-data-types": "0.13.5",
|
|
7
|
+
"@vuu-ui/vuu-filter-types": "0.13.5",
|
|
8
|
+
"@vuu-ui/vuu-popups": "0.13.5",
|
|
9
|
+
"@vuu-ui/vuu-protocol-types": "0.13.5",
|
|
10
|
+
"@vuu-ui/vuu-table-types": "0.13.5"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@vuu-ui/vuu-context-menu": "0.13.
|
|
14
|
-
"@vuu-ui/vuu-data-remote": "0.13.
|
|
15
|
-
"@vuu-ui/vuu-filter-parser": "0.13.
|
|
16
|
-
"@vuu-ui/vuu-layout": "0.13.
|
|
17
|
-
"@vuu-ui/vuu-popups": "0.13.
|
|
18
|
-
"@vuu-ui/vuu-ui-controls": "0.13.
|
|
19
|
-
"@vuu-ui/vuu-utils": "0.13.
|
|
20
|
-
"@vuu-ui/vuu-table": "0.13.
|
|
13
|
+
"@vuu-ui/vuu-context-menu": "0.13.5",
|
|
14
|
+
"@vuu-ui/vuu-data-remote": "0.13.5",
|
|
15
|
+
"@vuu-ui/vuu-filter-parser": "0.13.5",
|
|
16
|
+
"@vuu-ui/vuu-layout": "0.13.5",
|
|
17
|
+
"@vuu-ui/vuu-popups": "0.13.5",
|
|
18
|
+
"@vuu-ui/vuu-ui-controls": "0.13.5",
|
|
19
|
+
"@vuu-ui/vuu-utils": "0.13.5",
|
|
20
|
+
"@vuu-ui/vuu-table": "0.13.5",
|
|
21
21
|
"@salt-ds/core": "1.43.0",
|
|
22
22
|
"@salt-ds/styles": "0.2.1",
|
|
23
23
|
"@salt-ds/window": "0.1.1"
|
|
@@ -30,16 +30,19 @@
|
|
|
30
30
|
"files": [
|
|
31
31
|
"README.md",
|
|
32
32
|
"esm",
|
|
33
|
-
"cjs"
|
|
33
|
+
"cjs",
|
|
34
|
+
"/types"
|
|
34
35
|
],
|
|
35
36
|
"exports": {
|
|
36
37
|
".": {
|
|
37
38
|
"require": "./cjs/index.js",
|
|
38
|
-
"import": "./esm/index.js"
|
|
39
|
+
"import": "./esm/index.js",
|
|
40
|
+
"types": "./types/index.d.ts"
|
|
39
41
|
}
|
|
40
42
|
},
|
|
41
43
|
"main": "cjs/index.js",
|
|
42
44
|
"module": "esm/index.js",
|
|
43
45
|
"name": "@vuu-ui/vuu-data-react",
|
|
44
|
-
"type": "module"
|
|
46
|
+
"type": "module",
|
|
47
|
+
"types": "types/index.d.ts"
|
|
45
48
|
}
|
|
@@ -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-runtime").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-runtime").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,18 @@
|
|
|
1
|
+
import type { DataValueDescriptor, TableSchemaTable } from "@vuu-ui/vuu-data-types";
|
|
2
|
+
import { VuuTypeaheadInputProps } from "@vuu-ui/vuu-ui-controls";
|
|
3
|
+
import { CommitHandler } from "@vuu-ui/vuu-utils";
|
|
4
|
+
import { InputProps } from "@salt-ds/core";
|
|
5
|
+
export interface DataItemEditControlProps {
|
|
6
|
+
InputProps?: Partial<InputProps>;
|
|
7
|
+
TypeaheadProps?: Pick<VuuTypeaheadInputProps, "highlightFirstSuggestion">;
|
|
8
|
+
commitWhenCleared?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* A table column or form field Descriptor.
|
|
11
|
+
*/
|
|
12
|
+
dataDescriptor: DataValueDescriptor;
|
|
13
|
+
errorMessage?: string;
|
|
14
|
+
onCommit: CommitHandler<HTMLElement>;
|
|
15
|
+
table?: TableSchemaTable;
|
|
16
|
+
}
|
|
17
|
+
export type ValidationStatus = "initial" | true | string;
|
|
18
|
+
export declare const getDataItemEditControl: ({ InputProps, TypeaheadProps, commitWhenCleared, dataDescriptor, errorMessage, onCommit, table, }: DataItemEditControlProps) => import("react/jsx-runtime").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,11 @@
|
|
|
1
|
+
import { TableSchema } from "@vuu-ui/vuu-data-types";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
export type RestDataSourceExtension = {
|
|
4
|
+
createHttpHeaders?: () => Headers;
|
|
5
|
+
};
|
|
6
|
+
export declare const isRestDataSourceExtension: (o?: unknown) => o is RestDataSourceExtension;
|
|
7
|
+
export declare const RestDataSourceProvider: ({ children, createHttpHeaders, tableSchemas, url, }: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
tableSchemas?: Record<string, TableSchema>;
|
|
10
|
+
url: string;
|
|
11
|
+
} & RestDataSourceExtension) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export declare const VuuDataSourceProvider: ({ authenticate, autoConnect, autoLogin, children, websocketUrl, }: {
|
|
3
|
+
authenticate?: boolean;
|
|
4
|
+
autoConnect?: boolean;
|
|
5
|
+
autoLogin?: boolean;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
websocketUrl?: string;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const useAutoLoginToVuuServer: ({ authenticate, autoConnect, secure, websocketUrl, }?: {
|
|
2
|
+
authenticate?: boolean;
|
|
3
|
+
autoConnect?: boolean;
|
|
4
|
+
autoLogin?: boolean;
|
|
5
|
+
secure?: boolean;
|
|
6
|
+
websocketUrl?: string;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
@@ -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,44 @@
|
|
|
1
|
+
import { type MenuActionHandler, type MenuBuilder } 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 { TableContextMenuOptions, TableMenuLocation } from "@vuu-ui/vuu-table";
|
|
5
|
+
import type { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
|
|
6
|
+
export interface VuuMenuActionHookResult {
|
|
7
|
+
menuBuilder: MenuBuilder<TableMenuLocation, TableContextMenuOptions>;
|
|
8
|
+
menuActionHandler: MenuActionHandler;
|
|
9
|
+
}
|
|
10
|
+
export interface MenuActionConfig {
|
|
11
|
+
vuuMenu?: VuuMenu;
|
|
12
|
+
visualLink?: DataSourceVisualLinkCreatedMessage;
|
|
13
|
+
visualLinks?: LinkDescriptorWithLabel[];
|
|
14
|
+
}
|
|
15
|
+
export interface VuuMenuActionHookProps {
|
|
16
|
+
/**
|
|
17
|
+
* By default, vuuMenuActions will be handled automatically. When activated, a
|
|
18
|
+
* message will be sent to server and response will be handled here too.
|
|
19
|
+
* This prop allows client to provide a custom handler for a menu Item. This will
|
|
20
|
+
* take priority and if handler returns true, no further processing for the menu
|
|
21
|
+
* item will be handled by Vuu. This can also be used to prevent an item from being
|
|
22
|
+
* actioned, even when no custom handling is intended. If the handler returns false,
|
|
23
|
+
* Vuu will process the menuItem.
|
|
24
|
+
*/
|
|
25
|
+
clientSideMenuActionHandler?: MenuActionHandler;
|
|
26
|
+
dataSource?: DataSource;
|
|
27
|
+
menuActionConfig?: MenuActionConfig;
|
|
28
|
+
onRpcResponse?: RpcResponseHandler;
|
|
29
|
+
}
|
|
30
|
+
export interface VuuCellContextMenuItemOptions extends VuuMenuItem {
|
|
31
|
+
rowKey: string;
|
|
32
|
+
field: string;
|
|
33
|
+
value: VuuRowDataItemType;
|
|
34
|
+
}
|
|
35
|
+
export interface VuuRowContextMenuItemOptions extends VuuMenuItem {
|
|
36
|
+
rowKey: string;
|
|
37
|
+
row: VuuDataRowDto;
|
|
38
|
+
}
|
|
39
|
+
export interface VuuSelectedRowsContextMenuItemOptions extends VuuMenuItem {
|
|
40
|
+
columns: ColumnDescriptor[];
|
|
41
|
+
}
|
|
42
|
+
export declare const isRowMenu: (options: VuuMenuItem) => options is VuuRowContextMenuItemOptions;
|
|
43
|
+
export declare const isSelectionMenu: (options: VuuMenuItem) => options is VuuSelectedRowsContextMenuItemOptions;
|
|
44
|
+
export declare const useVuuMenuActions: ({ clientSideMenuActionHandler, dataSource, onRpcResponse, }: VuuMenuActionHookProps) => VuuMenuActionHookResult;
|
package/types/index.d.ts
ADDED
|
@@ -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-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./SessionEditingForm";
|