@vuu-ui/vuu-data-react 4.2.0 → 4.2.2
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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.2.
|
|
2
|
+
"version": "4.2.2",
|
|
3
3
|
"main": "./src/index.js",
|
|
4
4
|
"author": "heswell",
|
|
5
5
|
"license": "Apache-2.0",
|
|
@@ -9,21 +9,21 @@
|
|
|
9
9
|
"type-defs": "node ../../scripts/build-type-defs.mjs"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@vuu-ui/vuu-data-types": "4.2.
|
|
13
|
-
"@vuu-ui/vuu-filter-types": "4.2.
|
|
14
|
-
"@vuu-ui/vuu-protocol-types": "4.2.
|
|
15
|
-
"@vuu-ui/vuu-table-types": "4.2.
|
|
12
|
+
"@vuu-ui/vuu-data-types": "4.2.2",
|
|
13
|
+
"@vuu-ui/vuu-filter-types": "4.2.2",
|
|
14
|
+
"@vuu-ui/vuu-protocol-types": "4.2.2",
|
|
15
|
+
"@vuu-ui/vuu-table-types": "4.2.2"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@vuu-ui/vuu-context-menu": "4.2.
|
|
19
|
-
"@vuu-ui/vuu-data-remote": "4.2.
|
|
20
|
-
"@vuu-ui/vuu-filter-parser": "4.2.
|
|
21
|
-
"@vuu-ui/vuu-filters": "4.2.
|
|
22
|
-
"@vuu-ui/vuu-layout": "4.2.
|
|
23
|
-
"@vuu-ui/vuu-notifications": "4.2.
|
|
24
|
-
"@vuu-ui/vuu-ui-controls": "4.2.
|
|
25
|
-
"@vuu-ui/vuu-utils": "4.2.
|
|
26
|
-
"@vuu-ui/vuu-table": "4.2.
|
|
18
|
+
"@vuu-ui/vuu-context-menu": "4.2.2",
|
|
19
|
+
"@vuu-ui/vuu-data-remote": "4.2.2",
|
|
20
|
+
"@vuu-ui/vuu-filter-parser": "4.2.2",
|
|
21
|
+
"@vuu-ui/vuu-filters": "4.2.2",
|
|
22
|
+
"@vuu-ui/vuu-layout": "4.2.2",
|
|
23
|
+
"@vuu-ui/vuu-notifications": "4.2.2",
|
|
24
|
+
"@vuu-ui/vuu-ui-controls": "4.2.2",
|
|
25
|
+
"@vuu-ui/vuu-utils": "4.2.2",
|
|
26
|
+
"@vuu-ui/vuu-table": "4.2.2",
|
|
27
27
|
"@salt-ds/core": "1.74.0",
|
|
28
28
|
"@salt-ds/styles": "0.4.2",
|
|
29
29
|
"@salt-ds/window": "0.1.2"
|
|
@@ -2,6 +2,14 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { VuuDatePicker, VuuInput, VuuTimePicker, VuuTypeaheadInput } from "@vuu-ui/vuu-ui-controls";
|
|
3
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 showToggleFilter = ({ serverDataType }, variant, values, table)=>{
|
|
6
|
+
if ("toggle" === variant) {
|
|
7
|
+
if ("boolean" === serverDataType) return true;
|
|
8
|
+
if ("char" === serverDataType && values?.length) return true;
|
|
9
|
+
if ("string" === serverDataType && table && values?.length) return true;
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
12
|
+
};
|
|
5
13
|
const timeOfDayPattern = /^\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?$/;
|
|
6
14
|
const toEpochTimestamp = (value, { encoding })=>{
|
|
7
15
|
if (("string" == typeof value || "number" == typeof value) && !timeOfDayPattern.test(`${value}`)) return EpochTimestamp.fromWire(value, encoding);
|
|
@@ -25,7 +33,7 @@ const BOOLEAN_TOGGLE_VALUES = [
|
|
|
25
33
|
true,
|
|
26
34
|
false
|
|
27
35
|
];
|
|
28
|
-
const getDataItemEditControl = ({ InputProps, TypeaheadProps, className, commitOnBlur, commitWhenCleared, dataDescriptor, editOperation = "update", errorMessage, labels, onCommit, table, values, variant })=>{
|
|
36
|
+
const getDataItemEditControl = ({ InputProps, TypeaheadProps, appearance, className, commitOnBlur, commitWhenCleared, dataDescriptor, editOperation = "update", errorMessage, labels, onCommit, table, values, variant })=>{
|
|
29
37
|
const dataVariant = variant && "toggle" !== variant ? variant : void 0;
|
|
30
38
|
const temporalInfo = getTemporalInfo(dataDescriptor);
|
|
31
39
|
if (!isDataValueEditable(dataDescriptor, editOperation, true)) return /*#__PURE__*/ jsx(VuuInput, {
|
|
@@ -86,28 +94,19 @@ const getDataItemEditControl = ({ InputProps, TypeaheadProps, className, commitO
|
|
|
86
94
|
"data-edit-control": true
|
|
87
95
|
});
|
|
88
96
|
}
|
|
89
|
-
if (
|
|
97
|
+
if (showToggleFilter(dataDescriptor, variant, values)) return /*#__PURE__*/ jsx(ToggleFilter, {
|
|
98
|
+
appearance: "transparent" !== appearance ? appearance : void 0,
|
|
90
99
|
className: className,
|
|
91
100
|
column: dataDescriptor.name,
|
|
92
101
|
"data-edit-control": true,
|
|
93
|
-
disableTypeahead:
|
|
102
|
+
disableTypeahead: "string" !== dataDescriptor.serverDataType,
|
|
94
103
|
labels: labels,
|
|
95
104
|
onCommit: onCommit,
|
|
96
105
|
table: table,
|
|
97
106
|
values: values?.length ? values : BOOLEAN_TOGGLE_VALUES,
|
|
98
107
|
value: InputProps?.inputProps?.value ?? "all"
|
|
99
108
|
});
|
|
100
|
-
if ("string" === dataDescriptor.serverDataType && table)
|
|
101
|
-
className: className,
|
|
102
|
-
column: dataDescriptor.name,
|
|
103
|
-
"data-edit-control": true,
|
|
104
|
-
labels: labels,
|
|
105
|
-
onCommit: onCommit,
|
|
106
|
-
table: table,
|
|
107
|
-
values: values,
|
|
108
|
-
value: InputProps?.inputProps?.value ?? "all"
|
|
109
|
-
});
|
|
110
|
-
else return /*#__PURE__*/ jsx(VuuTypeaheadInput, {
|
|
109
|
+
if ("string" === dataDescriptor.serverDataType && table) return /*#__PURE__*/ jsx(VuuTypeaheadInput, {
|
|
111
110
|
...InputProps,
|
|
112
111
|
...TypeaheadProps,
|
|
113
112
|
className: className,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DataValueDescriptor, TableSchemaTable } from "@vuu-ui/vuu-data-types";
|
|
2
2
|
import { type VuuTypeaheadInputProps } from "@vuu-ui/vuu-ui-controls";
|
|
3
3
|
import { type CommitHandler } from "@vuu-ui/vuu-utils";
|
|
4
|
-
import type { InputProps } from "@salt-ds/core";
|
|
4
|
+
import type { ButtonAppearance, InputProps } from "@salt-ds/core";
|
|
5
5
|
import { type ToggleFilterValue } from "@vuu-ui/vuu-filters";
|
|
6
6
|
/**
|
|
7
7
|
* variant can be used to provide a rendering hint to the filter control rendered.
|
|
@@ -13,6 +13,10 @@ export type FilterControlVariant = "search" | "pick" | "toggle";
|
|
|
13
13
|
export interface DataItemEditControlProps {
|
|
14
14
|
InputProps?: Partial<InputProps>;
|
|
15
15
|
TypeaheadProps?: Pick<VuuTypeaheadInputProps, "highlightFirstSuggestion" | "minCharacterCountToTriggerSuggestions" | "selectOnTab">;
|
|
16
|
+
/**
|
|
17
|
+
* Appearance only currently honored bu ToggleFilter
|
|
18
|
+
*/
|
|
19
|
+
appearance?: ButtonAppearance;
|
|
16
20
|
className?: string;
|
|
17
21
|
commitOnBlur?: boolean;
|
|
18
22
|
commitWhenCleared?: boolean;
|
|
@@ -42,4 +46,4 @@ export interface DataItemEditControlProps {
|
|
|
42
46
|
variant?: FilterControlVariant;
|
|
43
47
|
}
|
|
44
48
|
export type ValidationStatus = "initial" | true | string;
|
|
45
|
-
export declare const getDataItemEditControl: ({ InputProps, TypeaheadProps, className, commitOnBlur, commitWhenCleared, dataDescriptor, editOperation, errorMessage, labels, onCommit, table, values, variant, }: DataItemEditControlProps) => import("react").JSX.Element;
|
|
49
|
+
export declare const getDataItemEditControl: ({ InputProps, TypeaheadProps, appearance, className, commitOnBlur, commitWhenCleared, dataDescriptor, editOperation, errorMessage, labels, onCommit, table, values, variant, }: DataItemEditControlProps) => import("react").JSX.Element;
|