orc-shared 1.2.0-pre.0 → 1.3.0-dev.1
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/dist/components/MaterialUI/Inputs/InputBase.js +2 -1
- package/dist/components/MaterialUI/Inputs/InputBaseProps.js +4 -1
- package/dist/components/MaterialUI/Inputs/TimePicker.js +5 -2
- package/package.json +1 -1
- package/src/components/MaterialUI/Inputs/InputBase.js +2 -1
- package/src/components/MaterialUI/Inputs/InputBaseProps.js +2 -0
- package/src/components/MaterialUI/Inputs/InputBaseProps.test.js +2 -0
- package/src/components/MaterialUI/Inputs/TimePicker.js +6 -2
|
@@ -156,6 +156,7 @@ var InputBase = function InputBase(_ref) {
|
|
|
156
156
|
var endAdornment = inputProps == null ? void 0 : inputProps.get(_InputBaseProps.default.propNames.endAdornment);
|
|
157
157
|
var metadata = inputProps == null ? void 0 : inputProps.get(_InputBaseProps.default.propNames.metadata);
|
|
158
158
|
var autoComplete = inputProps == null ? void 0 : inputProps.get(_InputBaseProps.default.propNames.autoComplete);
|
|
159
|
+
var timeoutDelay = (inputProps == null ? void 0 : inputProps.get(_InputBaseProps.default.propNames.timeoutDelay)) || 100;
|
|
159
160
|
var tooltipText = type === "text" ? value : "";
|
|
160
161
|
|
|
161
162
|
var onClick = function onClick(item) {
|
|
@@ -193,7 +194,7 @@ var InputBase = function InputBase(_ref) {
|
|
|
193
194
|
if (inputText !== value && inputText != null && window.bypassDebounce !== true) {
|
|
194
195
|
var timeOutId = setTimeout(function () {
|
|
195
196
|
return update(inputText, metadata);
|
|
196
|
-
},
|
|
197
|
+
}, timeoutDelay);
|
|
197
198
|
return function () {
|
|
198
199
|
return clearTimeout(timeOutId);
|
|
199
200
|
};
|
|
@@ -69,6 +69,8 @@ var InputBaseProps = /*#__PURE__*/function (_ComponentProps) {
|
|
|
69
69
|
|
|
70
70
|
_this.componentProps.set(_this.constructor.propNames.autoComplete, null);
|
|
71
71
|
|
|
72
|
+
_this.componentProps.set(_this.constructor.propNames.timeoutDelay, null);
|
|
73
|
+
|
|
72
74
|
_this.componentClasses.set(_this.constructor.ruleNames.input, null);
|
|
73
75
|
|
|
74
76
|
_this.componentClasses.set(_this.constructor.ruleNames.errorText, null);
|
|
@@ -103,7 +105,8 @@ _defineProperty(InputBaseProps, "propNames", {
|
|
|
103
105
|
startAdornment: "startAdornment",
|
|
104
106
|
endAdornment: "endAdornment",
|
|
105
107
|
metadata: "metadata",
|
|
106
|
-
autoComplete: "autoComplete"
|
|
108
|
+
autoComplete: "autoComplete",
|
|
109
|
+
timeoutDelay: "timeoutDelay"
|
|
107
110
|
});
|
|
108
111
|
|
|
109
112
|
_defineProperty(InputBaseProps, "ruleNames", {
|
|
@@ -295,6 +295,9 @@ var TimePicker = function TimePicker(_ref4) {
|
|
|
295
295
|
time = _useState2[0],
|
|
296
296
|
setTime = _useState2[1];
|
|
297
297
|
|
|
298
|
+
(0, _react.useEffect)(function () {
|
|
299
|
+
setTime(parseTime(value || "00:00"));
|
|
300
|
+
}, [value, setTime]);
|
|
298
301
|
var userTimeZone = (0, _timezoneHelper.getTimeZoneName)();
|
|
299
302
|
var localizedTimeZoneName = (0, _reactRedux.useSelector)((0, _metadata.namedLookupLocalizedSelector)("customer", "TimeZone", userTimeZone, null));
|
|
300
303
|
|
|
@@ -365,11 +368,11 @@ var TimePicker = function TimePicker(_ref4) {
|
|
|
365
368
|
}, showTimeZone && getTimeZone(requestedTimeZone)));
|
|
366
369
|
};
|
|
367
370
|
|
|
368
|
-
__signature__(TimePicker, "useStyles{classes}\nuseState{[time, setTime](parseTime(value || \"00:00\"))}\nuseSelector{localizedTimeZoneName}", function () {
|
|
371
|
+
__signature__(TimePicker, "useStyles{classes}\nuseState{[time, setTime](parseTime(value || \"00:00\"))}\nuseEffect{}\nuseSelector{localizedTimeZoneName}", function () {
|
|
369
372
|
return [useStyles, _reactRedux.useSelector];
|
|
370
373
|
});
|
|
371
374
|
|
|
372
|
-
__signature__(TimePicker, "useStyles{classes}\nuseState{[time, setTime](parseTime(value || \"00:00\"))}\nuseSelector{localizedTimeZoneName}", function () {
|
|
375
|
+
__signature__(TimePicker, "useStyles{classes}\nuseState{[time, setTime](parseTime(value || \"00:00\"))}\nuseEffect{}\nuseSelector{localizedTimeZoneName}", function () {
|
|
373
376
|
return [useStyles, _reactRedux.useSelector];
|
|
374
377
|
});
|
|
375
378
|
|
package/package.json
CHANGED
|
@@ -99,6 +99,7 @@ const InputBase = ({ inputProps }) => {
|
|
|
99
99
|
const endAdornment = inputProps?.get(InputBaseProps.propNames.endAdornment);
|
|
100
100
|
const metadata = inputProps?.get(InputBaseProps.propNames.metadata);
|
|
101
101
|
const autoComplete = inputProps?.get(InputBaseProps.propNames.autoComplete);
|
|
102
|
+
const timeoutDelay = inputProps?.get(InputBaseProps.propNames.timeoutDelay) || 100;
|
|
102
103
|
|
|
103
104
|
const tooltipText = type === "text" ? value : "";
|
|
104
105
|
|
|
@@ -128,7 +129,7 @@ const InputBase = ({ inputProps }) => {
|
|
|
128
129
|
|
|
129
130
|
React.useEffect(() => {
|
|
130
131
|
if (inputText !== value && inputText != null && window.bypassDebounce !== true) {
|
|
131
|
-
const timeOutId = setTimeout(() => update(inputText, metadata),
|
|
132
|
+
const timeOutId = setTimeout(() => update(inputText, metadata), timeoutDelay);
|
|
132
133
|
return () => clearTimeout(timeOutId);
|
|
133
134
|
}
|
|
134
135
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -17,6 +17,7 @@ class InputBaseProps extends ComponentProps {
|
|
|
17
17
|
endAdornment: "endAdornment",
|
|
18
18
|
metadata: "metadata",
|
|
19
19
|
autoComplete: "autoComplete",
|
|
20
|
+
timeoutDelay: "timeoutDelay",
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
static ruleNames = {
|
|
@@ -41,6 +42,7 @@ class InputBaseProps extends ComponentProps {
|
|
|
41
42
|
this.componentProps.set(this.constructor.propNames.endAdornment, null);
|
|
42
43
|
this.componentProps.set(this.constructor.propNames.metadata, null);
|
|
43
44
|
this.componentProps.set(this.constructor.propNames.autoComplete, null);
|
|
45
|
+
this.componentProps.set(this.constructor.propNames.timeoutDelay, null);
|
|
44
46
|
|
|
45
47
|
this.componentClasses.set(this.constructor.ruleNames.input, null);
|
|
46
48
|
this.componentClasses.set(this.constructor.ruleNames.errorText, null);
|
|
@@ -18,6 +18,7 @@ describe("InputBase Props", () => {
|
|
|
18
18
|
"endAdornment",
|
|
19
19
|
"metadata",
|
|
20
20
|
"autoComplete",
|
|
21
|
+
"timeoutDelay",
|
|
21
22
|
];
|
|
22
23
|
|
|
23
24
|
expect(InputBaseProps.propNames, "to have keys", propNames);
|
|
@@ -40,6 +41,7 @@ describe("InputBase Props", () => {
|
|
|
40
41
|
"endAdornment",
|
|
41
42
|
"metadata",
|
|
42
43
|
"autoComplete",
|
|
44
|
+
"timeoutDelay",
|
|
43
45
|
];
|
|
44
46
|
|
|
45
47
|
const ruleNames = ["input", "errorText"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
2
|
import { makeStyles } from "@material-ui/core/styles";
|
|
3
3
|
import Select from "./Select";
|
|
4
4
|
import SelectProps from "./SelectProps";
|
|
@@ -178,7 +178,11 @@ export const MinsSelect = ({ updateTimeOptions, time }) => {
|
|
|
178
178
|
const TimePicker = ({ value, onChange, showTimeZone, showAMPM, requestedTimeZone }) => {
|
|
179
179
|
const classes = useStyles();
|
|
180
180
|
showAMPM = showAMPM ?? isBrowserUsingAMPM();
|
|
181
|
-
const [time, setTime] = useState(parseTime(value || "00:00"));
|
|
181
|
+
const [time, setTime] = useState( parseTime(value || "00:00"));
|
|
182
|
+
|
|
183
|
+
useEffect(() => {
|
|
184
|
+
setTime(parseTime(value || "00:00"));
|
|
185
|
+
}, [value, setTime]);
|
|
182
186
|
|
|
183
187
|
const userTimeZone = getTimeZoneName();
|
|
184
188
|
const localizedTimeZoneName = useSelector(namedLookupLocalizedSelector("customer", "TimeZone", userTimeZone, null));
|