@vuu-ui/vuu-data-react 4.0.0-alpha.2 → 4.0.0-alpha.21
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 -19
- package/src/data-editing/get-data-item-edit-control.js +87 -20
- package/src/data-editing/useEditForm.js +1 -1
- package/src/hooks/useLookupValues.js +10 -5
- package/src/hooks/useVuuMenuActions.js +1 -1
- package/src/lost-connection-indicator/useLostConnection.js +7 -6
- package/src/session-editing-form/SessionEditingForm.js +5 -3
- package/types/data-editing/EditForm.d.ts +1 -1
- package/types/data-editing/UnsavedChangesReport.d.ts +1 -1
- package/types/data-editing/get-data-item-edit-control.d.ts +10 -3
- package/types/data-editing/useEditForm.d.ts +2 -2
- package/types/datasource-provider/VuuDataSourceProvider.d.ts +1 -1
- package/types/lost-connection-indicator/LostConnectionIndicator.d.ts +1 -1
- package/types/session-editing-form/SessionEditingForm.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.0.0-alpha.
|
|
2
|
+
"version": "4.0.0-alpha.21",
|
|
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.
|
|
15
|
-
"@vuu-ui/vuu-filter-types": "4.0.0-alpha.
|
|
16
|
-
"@vuu-ui/vuu-protocol-types": "4.0.0-alpha.
|
|
17
|
-
"@vuu-ui/vuu-table-types": "4.0.0-alpha.
|
|
14
|
+
"@vuu-ui/vuu-data-types": "4.0.0-alpha.21",
|
|
15
|
+
"@vuu-ui/vuu-filter-types": "4.0.0-alpha.21",
|
|
16
|
+
"@vuu-ui/vuu-protocol-types": "4.0.0-alpha.21",
|
|
17
|
+
"@vuu-ui/vuu-table-types": "4.0.0-alpha.21"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@vuu-ui/vuu-context-menu": "4.0.0-alpha.
|
|
21
|
-
"@vuu-ui/vuu-data-remote": "4.0.0-alpha.
|
|
22
|
-
"@vuu-ui/vuu-filter-parser": "4.0.0-alpha.
|
|
23
|
-
"@vuu-ui/vuu-filters": "4.0.0-alpha.
|
|
24
|
-
"@vuu-ui/vuu-layout": "4.0.0-alpha.
|
|
25
|
-
"@vuu-ui/vuu-notifications": "4.0.0-alpha.
|
|
26
|
-
"@vuu-ui/vuu-ui-controls": "4.0.0-alpha.
|
|
27
|
-
"@vuu-ui/vuu-utils": "4.0.0-alpha.
|
|
28
|
-
"@vuu-ui/vuu-table": "4.0.0-alpha.
|
|
29
|
-
"@salt-ds/core": "1.
|
|
30
|
-
"@salt-ds/styles": "0.
|
|
31
|
-
"@salt-ds/window": "0.1.
|
|
32
|
-
"@vuu-ui/core": "4.0.0-alpha.
|
|
20
|
+
"@vuu-ui/vuu-context-menu": "4.0.0-alpha.21",
|
|
21
|
+
"@vuu-ui/vuu-data-remote": "4.0.0-alpha.21",
|
|
22
|
+
"@vuu-ui/vuu-filter-parser": "4.0.0-alpha.21",
|
|
23
|
+
"@vuu-ui/vuu-filters": "4.0.0-alpha.21",
|
|
24
|
+
"@vuu-ui/vuu-layout": "4.0.0-alpha.21",
|
|
25
|
+
"@vuu-ui/vuu-notifications": "4.0.0-alpha.21",
|
|
26
|
+
"@vuu-ui/vuu-ui-controls": "4.0.0-alpha.21",
|
|
27
|
+
"@vuu-ui/vuu-utils": "4.0.0-alpha.21",
|
|
28
|
+
"@vuu-ui/vuu-table": "4.0.0-alpha.21",
|
|
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.21"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"clsx": "^2.0.0",
|
|
@@ -43,8 +43,9 @@
|
|
|
43
43
|
],
|
|
44
44
|
"exports": {
|
|
45
45
|
".": {
|
|
46
|
+
"types": "./types/index.d.ts",
|
|
46
47
|
"import": "./src/index.js",
|
|
47
|
-
"
|
|
48
|
+
"default": "./src/index.js"
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
51
|
"module": "./src/index.js",
|
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { VuuDatePicker, VuuInput, VuuTimePicker, VuuTypeaheadInput } from "@vuu-ui/vuu-ui-controls";
|
|
3
|
-
import {
|
|
3
|
+
import { EpochTimestamp, getTemporalInfo, isDataValueEditable, isTimeDataValueWithMilliseconds, isValidTimeString, isValidTimeStringMillis, parseTemporalInput } from "@vuu-ui/vuu-utils";
|
|
4
4
|
import { ToggleFilter } from "@vuu-ui/vuu-filters";
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const timeOfDayPattern = /^\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?$/;
|
|
6
|
+
const toEpochTimestamp = (value, { encoding })=>{
|
|
7
|
+
if (("string" == typeof value || "number" == typeof value) && !timeOfDayPattern.test(`${value}`)) return EpochTimestamp.fromWire(value, encoding);
|
|
8
|
+
};
|
|
9
|
+
const pad = (n)=>`${n}`.padStart(2, "0");
|
|
10
|
+
function toTimeString(value, timestamp, { timeZone }, milliseconds = false) {
|
|
11
|
+
if (timestamp) {
|
|
12
|
+
const { hour, minute, second, millisecond } = timestamp.getFields(timeZone);
|
|
13
|
+
const timeString = `${pad(hour)}:${pad(minute)}:${pad(second)}`;
|
|
14
|
+
return milliseconds ? `${timeString}.${`${millisecond}`.padStart(3, "0")}` : timeString;
|
|
15
|
+
}
|
|
16
|
+
if ("string" == typeof value) if (milliseconds) {
|
|
17
|
+
const timeString = 8 === value.length ? `${value}.000` : value.slice(0, 12);
|
|
18
|
+
if (isValidTimeStringMillis(timeString)) return timeString;
|
|
19
|
+
} else {
|
|
20
|
+
const timeString = value.slice(0, 8);
|
|
21
|
+
if (isValidTimeString(timeString)) return timeString;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const BOOLEAN_TOGGLE_VALUES = [
|
|
25
|
+
true,
|
|
26
|
+
false
|
|
27
|
+
];
|
|
28
|
+
const getDataItemEditControl = ({ InputProps, TypeaheadProps, className, commitOnBlur, commitWhenCleared, dataDescriptor, editOperation = "update", errorMessage, labels, onCommit, table, values, variant })=>{
|
|
9
29
|
const dataVariant = variant && "toggle" !== variant ? variant : void 0;
|
|
30
|
+
const temporalInfo = getTemporalInfo(dataDescriptor);
|
|
10
31
|
if (!isDataValueEditable(dataDescriptor, editOperation, true)) return /*#__PURE__*/ jsx(VuuInput, {
|
|
11
32
|
variant: "secondary",
|
|
12
33
|
...InputProps,
|
|
@@ -14,26 +35,72 @@ const getDataItemEditControl = ({ InputProps, TypeaheadProps, className, commitO
|
|
|
14
35
|
readOnly: true,
|
|
15
36
|
"data-edit-control": true
|
|
16
37
|
});
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
38
|
+
if (temporalInfo?.kind === "time") {
|
|
39
|
+
const { value, onChange } = InputProps?.inputProps ?? {};
|
|
40
|
+
const baseValue = toEpochTimestamp(value, temporalInfo);
|
|
41
|
+
const handleCommitTime = (evt, timeString)=>{
|
|
42
|
+
if (baseValue) {
|
|
43
|
+
const timestamp = parseTemporalInput(timeString, temporalInfo, baseValue);
|
|
44
|
+
onCommit(evt, timestamp ? `${timestamp.toWire(temporalInfo.encoding)}` : "");
|
|
45
|
+
} else onCommit(evt, timeString);
|
|
46
|
+
};
|
|
47
|
+
return isTimeDataValueWithMilliseconds(dataDescriptor) ? /*#__PURE__*/ jsx(VuuTimePicker, {
|
|
48
|
+
className: className,
|
|
49
|
+
milliseconds: true,
|
|
50
|
+
value: "" === value ? "" : toTimeString(value, baseValue, temporalInfo, true),
|
|
51
|
+
onChange: onChange,
|
|
52
|
+
onCommit: handleCommitTime,
|
|
53
|
+
"data-edit-control": true
|
|
54
|
+
}) : /*#__PURE__*/ jsx(VuuTimePicker, {
|
|
55
|
+
className: className,
|
|
56
|
+
value: "" === value ? "" : toTimeString(value, baseValue, temporalInfo),
|
|
57
|
+
onChange: onChange,
|
|
58
|
+
onCommit: handleCommitTime,
|
|
59
|
+
"data-edit-control": true
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (temporalInfo) {
|
|
63
|
+
const baseValue = toEpochTimestamp(InputProps?.inputProps?.value, temporalInfo);
|
|
64
|
+
const handleCommitDate = (evt, startOfDayMillis)=>{
|
|
65
|
+
let timestamp = EpochTimestamp.fromMillis(startOfDayMillis);
|
|
66
|
+
if (baseValue && "datetime" === temporalInfo.kind) {
|
|
67
|
+
const { year, month, day } = timestamp.getFields(temporalInfo.timeZone);
|
|
68
|
+
const { hour, minute, second, millisecond } = baseValue.getFields(temporalInfo.timeZone);
|
|
69
|
+
timestamp = EpochTimestamp.fromFields({
|
|
70
|
+
year,
|
|
71
|
+
month,
|
|
72
|
+
day,
|
|
73
|
+
hour,
|
|
74
|
+
minute,
|
|
75
|
+
second,
|
|
76
|
+
millisecond
|
|
77
|
+
}, temporalInfo.timeZone, baseValue.subMilliNanos);
|
|
78
|
+
}
|
|
79
|
+
onCommit(evt, `${timestamp.toWire(temporalInfo.encoding)}`);
|
|
80
|
+
};
|
|
81
|
+
return /*#__PURE__*/ jsx(VuuDatePicker, {
|
|
82
|
+
className: className,
|
|
83
|
+
onCommit: handleCommitDate,
|
|
84
|
+
timeZone: temporalInfo.timeZone,
|
|
85
|
+
value: baseValue,
|
|
86
|
+
"data-edit-control": true
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if ("toggle" === variant && "boolean" === dataDescriptor.serverDataType) return /*#__PURE__*/ jsx(ToggleFilter, {
|
|
29
90
|
className: className,
|
|
30
|
-
|
|
31
|
-
"data-edit-control": true
|
|
91
|
+
column: dataDescriptor.name,
|
|
92
|
+
"data-edit-control": true,
|
|
93
|
+
labels: labels,
|
|
94
|
+
onCommit: onCommit,
|
|
95
|
+
table: table,
|
|
96
|
+
values: values?.length ? values : BOOLEAN_TOGGLE_VALUES,
|
|
97
|
+
value: InputProps?.inputProps?.value ?? "all"
|
|
32
98
|
});
|
|
33
|
-
|
|
99
|
+
if ("string" === dataDescriptor.serverDataType && table) if ("toggle" === variant && values?.length) return /*#__PURE__*/ jsx(ToggleFilter, {
|
|
34
100
|
className: className,
|
|
35
101
|
column: dataDescriptor.name,
|
|
36
102
|
"data-edit-control": true,
|
|
103
|
+
labels: labels,
|
|
37
104
|
onCommit: onCommit,
|
|
38
105
|
table: table,
|
|
39
106
|
values: values,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useModal } from "@vuu-ui/core";
|
|
2
3
|
import { Range, buildColumnMap, dataSourceRowToEntity, messageHasDataRows, queryClosest } from "@vuu-ui/vuu-utils";
|
|
3
4
|
import { Button } from "@salt-ds/core";
|
|
4
5
|
import { useCallback, useMemo, useRef, useState } from "react";
|
|
5
6
|
import { UnsavedChangesReport } from "./UnsavedChangesReport.js";
|
|
6
7
|
import { buildValidationChecker, getEditValidationRules } from "./edit-rule-validation-checker.js";
|
|
7
8
|
import { CLEAN_FORM, buildFormEditState } from "./form-edit-state.js";
|
|
8
|
-
import { useModal } from "@vuu-ui/vuu-ui-controls";
|
|
9
9
|
const CLEAN_VALIDATION = {
|
|
10
10
|
ok: true,
|
|
11
11
|
messages: {}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
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,
|
|
@@ -5,9 +5,9 @@ import { getFilterPredicate } from "@vuu-ui/vuu-filter-parser";
|
|
|
5
5
|
import { NotificationType, useNotifications } from "@vuu-ui/vuu-notifications";
|
|
6
6
|
import { BulkEditPanel, isTableLocation } from "@vuu-ui/vuu-table";
|
|
7
7
|
import { getLayoutComponent, isActionMessage, isCustomComponentActionMessage, isSessionTableActionMessage, useData } from "@vuu-ui/vuu-utils";
|
|
8
|
+
import { useModal } from "@vuu-ui/core";
|
|
8
9
|
import { useCallback } from "react";
|
|
9
10
|
import { SessionEditingForm } from "../session-editing-form/index.js";
|
|
10
|
-
import { useModal } from "@vuu-ui/vuu-ui-controls";
|
|
11
11
|
const isRoot = (menu)=>"ROOT" === menu.name;
|
|
12
12
|
const isCellMenu = (options)=>"cell" === options.context;
|
|
13
13
|
const isRowMenu = (options)=>"row" === options.context;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
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
|
-
|
|
23
|
-
|
|
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 {
|
|
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
|
|
@@ -21,6 +22,11 @@ export interface DataItemEditControlProps {
|
|
|
21
22
|
dataDescriptor: DataValueDescriptor;
|
|
22
23
|
editOperation?: "insert" | "update";
|
|
23
24
|
errorMessage?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional labels, only used with 'toggle' variant. If provided, must
|
|
27
|
+
* have same number of items as values. Defaults to values.
|
|
28
|
+
*/
|
|
29
|
+
labels?: string[];
|
|
24
30
|
onCommit: CommitHandler<HTMLElement>;
|
|
25
31
|
table?: TableSchemaTable;
|
|
26
32
|
/**
|
|
@@ -28,10 +34,11 @@ export interface DataItemEditControlProps {
|
|
|
28
34
|
* They will be validated against server with Typeahead service, so
|
|
29
35
|
* unavailable options are not offered.
|
|
30
36
|
* Recommended for toggle filters, not usually necessary for other
|
|
31
|
-
* filter variants.
|
|
37
|
+
* filter variants. Boolean values are supported for toggle filters on
|
|
38
|
+
* boolean columns, where values default to [true, false].
|
|
32
39
|
*/
|
|
33
|
-
values?:
|
|
40
|
+
values?: ToggleFilterValue[];
|
|
34
41
|
variant?: FilterControlVariant;
|
|
35
42
|
}
|
|
36
43
|
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;
|
|
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
|
|
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:
|
|
17
|
+
onChange: FormEventHandler<HTMLElement>;
|
|
18
18
|
onCommit: CommitHandler<HTMLElement>;
|
|
19
19
|
onFocus: FocusEventHandler;
|
|
20
20
|
onSubmit: () => Promise<void>;
|
|
@@ -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;
|