@douglasneuroinformatics/libui 3.7.5 → 3.7.6
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.js +17 -7
- package/dist/components.js.map +1 -1
- package/dist/douglasneuroinformatics-libui-3.7.6.tgz +0 -0
- package/package.json +2 -2
- package/src/components/Form/DateField/DateField.tsx +1 -1
- package/src/components/Form/NumberRecordField.tsx +9 -3
- package/src/components/Form/RecordArrayField.tsx +9 -3
- package/dist/douglasneuroinformatics-libui-3.7.5.tgz +0 -0
package/dist/components.js
CHANGED
|
@@ -2633,12 +2633,17 @@ var NumberRecordField = ({
|
|
|
2633
2633
|
setValue: setRecordValue,
|
|
2634
2634
|
value: recordValue
|
|
2635
2635
|
}) => {
|
|
2636
|
-
const
|
|
2636
|
+
const optionsRef = useRef3(options);
|
|
2637
2637
|
useEffect4(() => {
|
|
2638
|
-
if (
|
|
2638
|
+
if (!recordValue) {
|
|
2639
2639
|
setRecordValue({});
|
|
2640
2640
|
}
|
|
2641
|
-
|
|
2641
|
+
}, []);
|
|
2642
|
+
useEffect4(() => {
|
|
2643
|
+
if (optionsRef.current !== options) {
|
|
2644
|
+
setRecordValue({});
|
|
2645
|
+
optionsRef.current = options;
|
|
2646
|
+
}
|
|
2642
2647
|
}, [options]);
|
|
2643
2648
|
if (!recordValue) {
|
|
2644
2649
|
return null;
|
|
@@ -2784,7 +2789,7 @@ var isValidDateString = (s) => /^(\d{4})-((0[1-9])|(1[0-2]))-((0[1-9])|([12])[0-
|
|
|
2784
2789
|
var DateField = ({ disabled, error, label, name, readOnly, setValue, value }) => {
|
|
2785
2790
|
const [isDatePickerOpen, setIsDatePickerOpen] = useState5(false);
|
|
2786
2791
|
const [isInputFocused, setIsInputFocused] = useState5(false);
|
|
2787
|
-
const [inputValue, setInputValue] = useState5("");
|
|
2792
|
+
const [inputValue, setInputValue] = useState5(value ? toBasicISOString2(value) : "");
|
|
2788
2793
|
useEffect5(() => {
|
|
2789
2794
|
const isSelecting = isDatePickerOpen || isInputFocused;
|
|
2790
2795
|
if (isSelecting) {
|
|
@@ -3227,14 +3232,19 @@ var RecordArrayField = memo(function RecordArrayField2({
|
|
|
3227
3232
|
setValue: setArrayValue,
|
|
3228
3233
|
value: arrayValue
|
|
3229
3234
|
}) {
|
|
3230
|
-
const
|
|
3235
|
+
const fieldsetRef = useRef4(fieldset);
|
|
3231
3236
|
const { t } = useTranslation("libui");
|
|
3232
3237
|
const createNewRecord = () => Object.fromEntries(Object.keys(fieldset).map((fieldName) => [fieldName, void 0]));
|
|
3233
3238
|
useEffect8(() => {
|
|
3234
|
-
if (
|
|
3239
|
+
if (!arrayValue) {
|
|
3240
|
+
setArrayValue([createNewRecord()]);
|
|
3241
|
+
}
|
|
3242
|
+
}, []);
|
|
3243
|
+
useEffect8(() => {
|
|
3244
|
+
if (fieldsetRef.current !== fieldset) {
|
|
3235
3245
|
setArrayValue([createNewRecord()]);
|
|
3246
|
+
fieldsetRef.current = fieldset;
|
|
3236
3247
|
}
|
|
3237
|
-
isFirstRenderRef.current = false;
|
|
3238
3248
|
}, [fieldset]);
|
|
3239
3249
|
if (!arrayValue) {
|
|
3240
3250
|
return null;
|