@ostack.tech/ui-kform 0.15.2 → 0.15.4
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/ostack-ui-kform.js +24 -25
- package/dist/ostack-ui-kform.js.map +1 -1
- package/package.json +4 -4
package/dist/ostack-ui-kform.js
CHANGED
|
@@ -13,7 +13,7 @@ import { subscribeWithSelector } from "zustand/middleware";
|
|
|
13
13
|
import { shallow } from "zustand/shallow";
|
|
14
14
|
import { fileOpen, fileSave, supported } from "browser-fs-access";
|
|
15
15
|
import { faAngleLeft, faAngleRight, faAnglesLeft, faAnglesRight, faArrowRight, faArrowsToDot, faCaretDown, faChevronDown, faChevronUp, faCircleCheck, faCircleExclamation, faCircleQuestion, faDownload, faFileLines, faFloppyDisk, faFolderOpen, faPlus, faPrint, faTrash, faTriangleExclamation } from "@fortawesome/free-solid-svg-icons";
|
|
16
|
-
import { addDays, format, max, min, parseISO } from "date-fns";
|
|
16
|
+
import { addDays, format, formatISO, max, min, parseISO } from "date-fns";
|
|
17
17
|
import { faCircleCheck as faCircleCheck$1 } from "@fortawesome/free-regular-svg-icons";
|
|
18
18
|
//#region src/providers/PrefixSuffixProvider/defaultPrefixSuffix.ts
|
|
19
19
|
/** Initial default library prefix-suffix. */
|
|
@@ -2224,7 +2224,6 @@ function useRegisterControl({ controller, issuesPanelLabel, ariaLabel, issuesPan
|
|
|
2224
2224
|
const { useState, usePath, useInitialized, useDisplayStatus } = controller;
|
|
2225
2225
|
const path = usePath();
|
|
2226
2226
|
const formIsDisabled = useFormIsDisabled();
|
|
2227
|
-
const displayDisabled = useState((state) => state.initialized && !state.exists) || formIsDisabled;
|
|
2228
2227
|
const displayReadOnly = useFormIsReadOnly();
|
|
2229
2228
|
const initialized = useInitialized();
|
|
2230
2229
|
const displayStatusToDisplay = useDeferredValue(useDisplayStatus());
|
|
@@ -2251,7 +2250,7 @@ function useRegisterControl({ controller, issuesPanelLabel, ariaLabel, issuesPan
|
|
|
2251
2250
|
]);
|
|
2252
2251
|
return useMemo(() => ({
|
|
2253
2252
|
displayLoading: printing ? false : !initialized,
|
|
2254
|
-
displayDisabled: printing ? false :
|
|
2253
|
+
displayDisabled: printing ? false : formIsDisabled,
|
|
2255
2254
|
displayReadOnly: printing ? false : displayReadOnly,
|
|
2256
2255
|
displayStatusToDisplay: printing ? void 0 : displayStatusToDisplay,
|
|
2257
2256
|
displayValidating: printing ? false : displayValidating,
|
|
@@ -2259,15 +2258,15 @@ function useRegisterControl({ controller, issuesPanelLabel, ariaLabel, issuesPan
|
|
|
2259
2258
|
autofocusRef,
|
|
2260
2259
|
handleFocus
|
|
2261
2260
|
}), [
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2261
|
+
printing,
|
|
2262
|
+
initialized,
|
|
2263
|
+
formIsDisabled,
|
|
2265
2264
|
displayReadOnly,
|
|
2266
2265
|
displayStatusToDisplay,
|
|
2267
|
-
|
|
2268
|
-
initialized,
|
|
2266
|
+
displayValidating,
|
|
2269
2267
|
issuesToDisplay,
|
|
2270
|
-
|
|
2268
|
+
autofocusRef,
|
|
2269
|
+
handleFocus
|
|
2271
2270
|
]);
|
|
2272
2271
|
}
|
|
2273
2272
|
/** Hook used to register a label for all control field's controls. */
|
|
@@ -2327,7 +2326,7 @@ var CheckboxControl = forwardRef(function CheckboxControl({ path, issueMessages,
|
|
|
2327
2326
|
required: required ?? restrictions.required === true,
|
|
2328
2327
|
loading: displayLoading || loading,
|
|
2329
2328
|
showSpinner: displayValidating || showSpinner,
|
|
2330
|
-
disabled: displayDisabled || disabled,
|
|
2329
|
+
disabled: displayDisabled || disabled || inputProps.disabled,
|
|
2331
2330
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
2332
2331
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
2333
2332
|
onCheckedChange: combineEventHandlers(onCheckedChange, combineEventHandlers(inputProps.onChange, setFormattedValue)),
|
|
@@ -2507,7 +2506,7 @@ var CheckboxGroupControl = forwardRef(function CheckboxGroupControl({ path, opti
|
|
|
2507
2506
|
required: required ?? restrictions.required === true,
|
|
2508
2507
|
loading: displayLoading || loading,
|
|
2509
2508
|
showSpinner: displayValidating || showSpinner,
|
|
2510
|
-
disabled: displayDisabled || disabled,
|
|
2509
|
+
disabled: displayDisabled || disabled || inputProps.disabled,
|
|
2511
2510
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
2512
2511
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
2513
2512
|
onValueChange: handleValueChange,
|
|
@@ -2627,7 +2626,7 @@ var DateControl = forwardRef(function DateControl({ path, issueMessages, issuesP
|
|
|
2627
2626
|
maxDate: maxDate ?? maxDateRestriction(schema),
|
|
2628
2627
|
loading: displayLoading || loading,
|
|
2629
2628
|
showSpinner: displayValidating || showSpinner,
|
|
2630
|
-
disabled: displayDisabled || disabled,
|
|
2629
|
+
disabled: displayDisabled || disabled || inputProps.disabled,
|
|
2631
2630
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
2632
2631
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
2633
2632
|
endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [popoverIssues, endAdornment] }),
|
|
@@ -2740,7 +2739,7 @@ var DateRangeControl = forwardRef(function DateRangeControl({ startPath, endPath
|
|
|
2740
2739
|
loading: displayStartLoading || displayEndLoading || loading,
|
|
2741
2740
|
showStartSpinner: displayStartValidating || showStartSpinner,
|
|
2742
2741
|
showEndSpinner: displayEndValidating || showEndSpinner,
|
|
2743
|
-
disabled: displayStartDisabled && displayEndDisabled || disabled,
|
|
2742
|
+
disabled: displayStartDisabled && displayEndDisabled || disabled || startInputProps?.disabled && endInputProps?.disabled,
|
|
2744
2743
|
readOnly: displayStartReadOnly && displayEndReadOnly || readOnly || startInputProps?.readOnly && endInputProps?.readOnly,
|
|
2745
2744
|
status: startDisplayStatusToDisplay === "error" || endDisplayStatusToDisplay === "error" ? "invalid" : startDisplayStatusToDisplay === "warning" || endDisplayStatusToDisplay === "warning" ? "warned" : void 0,
|
|
2746
2745
|
onValueChange: combineEventHandlers(onValueChange, handleValueChange),
|
|
@@ -2748,7 +2747,7 @@ var DateRangeControl = forwardRef(function DateRangeControl({ startPath, endPath
|
|
|
2748
2747
|
startInputProps: {
|
|
2749
2748
|
name: startControllerInputProps.name,
|
|
2750
2749
|
...startInputProps,
|
|
2751
|
-
disabled: displayStartDisabled,
|
|
2750
|
+
disabled: displayStartDisabled || startInputProps?.disabled,
|
|
2752
2751
|
readOnly: displayStartReadOnly || startInputProps?.readOnly,
|
|
2753
2752
|
onFocus: combineEventHandlers(startInputProps?.onFocus, handleStartFocus),
|
|
2754
2753
|
ref: useCombinedRef(startControllerInputProps?.ref, useCombinedRef(startAutofocusRef, startInputProps?.ref))
|
|
@@ -2756,7 +2755,7 @@ var DateRangeControl = forwardRef(function DateRangeControl({ startPath, endPath
|
|
|
2756
2755
|
endInputProps: {
|
|
2757
2756
|
name: endControllerInputProps.name,
|
|
2758
2757
|
...endInputProps,
|
|
2759
|
-
disabled: displayEndDisabled,
|
|
2758
|
+
disabled: displayEndDisabled || endInputProps?.disabled,
|
|
2760
2759
|
readOnly: displayEndReadOnly || endInputProps?.readOnly,
|
|
2761
2760
|
onFocus: combineEventHandlers(endInputProps?.onFocus, handleEndFocus),
|
|
2762
2761
|
ref: useCombinedRef(endControllerInputProps?.ref, useCombinedRef(endAutofocusRef, endInputProps?.ref))
|
|
@@ -2836,7 +2835,7 @@ var FileControl = forwardRef(function FileControl({ path, issueMessages, issuesP
|
|
|
2836
2835
|
accept: accept ?? (Array.isArray(restrictions.acceptedFileTypes) ? restrictions.acceptedFileTypes.join() : void 0),
|
|
2837
2836
|
loading: displayLoading || loading,
|
|
2838
2837
|
showSpinner: displayValidating || showSpinner,
|
|
2839
|
-
disabled: displayDisabled || disabled,
|
|
2838
|
+
disabled: displayDisabled || disabled || inputProps.disabled,
|
|
2840
2839
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
2841
2840
|
showClearButton,
|
|
2842
2841
|
clearDescription,
|
|
@@ -4446,7 +4445,7 @@ var NumericControl = forwardRef(function NumericControl({ path, issueMessages, i
|
|
|
4446
4445
|
exclusiveMax: exclusiveMax ?? (restrictions.exclusiveMax == null ? void 0 : formatNumericAsString(restrictions.exclusiveMax, schema)),
|
|
4447
4446
|
loading: displayLoading || loading,
|
|
4448
4447
|
showSpinner: displayValidating || showSpinner,
|
|
4449
|
-
disabled: displayDisabled || disabled,
|
|
4448
|
+
disabled: displayDisabled || disabled || inputProps.disabled,
|
|
4450
4449
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
4451
4450
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
4452
4451
|
endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [popoverIssues, endAdornment] }),
|
|
@@ -4535,7 +4534,7 @@ function PrintAction({ label, keybinds, disabled, loading, onClick, ...otherProp
|
|
|
4535
4534
|
}
|
|
4536
4535
|
/** Default document title when one is not provided. */
|
|
4537
4536
|
function defaultDocumentTitle(formTitle) {
|
|
4538
|
-
return [formTitle,
|
|
4537
|
+
return [formTitle, formatISO(/* @__PURE__ */ new Date(), { representation: "date" })].filter(Boolean).join(" ");
|
|
4539
4538
|
}
|
|
4540
4539
|
//#endregion
|
|
4541
4540
|
//#region src/components/RadioGroupControl/RadioGroupControl.tsx
|
|
@@ -4598,7 +4597,7 @@ var RadioGroupControl = forwardRef(function RadioGroupControl({ path, options, i
|
|
|
4598
4597
|
required: required ?? restrictions.required === true,
|
|
4599
4598
|
loading: displayLoading || loading,
|
|
4600
4599
|
showSpinner: displayValidating || showSpinner,
|
|
4601
|
-
disabled: displayDisabled || disabled,
|
|
4600
|
+
disabled: displayDisabled || disabled || inputProps.disabled,
|
|
4602
4601
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
4603
4602
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
4604
4603
|
showClearButton: showClearButton === "auto" ? formattedValue !== clearedFormattedValue : showClearButton,
|
|
@@ -4717,7 +4716,7 @@ function useFormIsSaving() {
|
|
|
4717
4716
|
}
|
|
4718
4717
|
/** Default file name when one is not provided. */
|
|
4719
4718
|
function defaultFileName(formTitle, extension) {
|
|
4720
|
-
return [[formTitle,
|
|
4719
|
+
return [[formTitle, formatISO(/* @__PURE__ */ new Date(), { representation: "date" })].filter(Boolean).join(" "), extension].filter(Boolean).join("");
|
|
4721
4720
|
}
|
|
4722
4721
|
//#endregion
|
|
4723
4722
|
//#region src/components/SaveAction/SaveAction.tsx
|
|
@@ -4862,7 +4861,7 @@ var SelectControl = forwardRef(function SelectControl({ path, options: groupedOp
|
|
|
4862
4861
|
required: required ?? restrictions.required === true,
|
|
4863
4862
|
loading: displayLoading || loading,
|
|
4864
4863
|
showSpinner: displayValidating || showSpinner,
|
|
4865
|
-
disabled: displayDisabled || disabled,
|
|
4864
|
+
disabled: displayDisabled || disabled || inputProps.disabled,
|
|
4866
4865
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
4867
4866
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
4868
4867
|
showClearButton: showClearButton === "auto" ? formattedValue !== clearedFormattedValue : showClearButton,
|
|
@@ -4959,7 +4958,7 @@ var SelectMultipleControl = forwardRef(function SelectMultipleControl({ path, op
|
|
|
4959
4958
|
required: required ?? restrictions.required === true,
|
|
4960
4959
|
loading: displayLoading || loading,
|
|
4961
4960
|
showSpinner: displayValidating || showSpinner,
|
|
4962
|
-
disabled: displayDisabled || disabled,
|
|
4961
|
+
disabled: displayDisabled || disabled || inputProps.disabled,
|
|
4963
4962
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
4964
4963
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
4965
4964
|
endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [popoverIssues, endAdornment] }),
|
|
@@ -5207,7 +5206,7 @@ var TableControlCell = forwardRef(function TableControlCell({ variant, ...otherP
|
|
|
5207
5206
|
//#region src/components/TableControl/TableControlRow.tsx
|
|
5208
5207
|
/** Row of a table control. */
|
|
5209
5208
|
var TableControlRow = memo(forwardRef(function TableControlRow({ row, index, ...otherProps }, forwardedRef) {
|
|
5210
|
-
const controller = useController(row, { enabled: !useFormIsLoading() && row != null });
|
|
5209
|
+
const controller = useController(row?.toString(), { enabled: !useFormIsLoading() && row != null });
|
|
5211
5210
|
const path = controller.usePath();
|
|
5212
5211
|
useRegisterController(controller);
|
|
5213
5212
|
useRegisterLabel(path, row == null ? null : index + 1);
|
|
@@ -5305,7 +5304,7 @@ var TableControl = forwardRef(function TableControl({ path, issueMessages, issue
|
|
|
5305
5304
|
ariaLabel: otherProps["aria-label"],
|
|
5306
5305
|
preventAutoFocus
|
|
5307
5306
|
});
|
|
5308
|
-
const controlIsDisabled = displayDisabled || disabled;
|
|
5307
|
+
const controlIsDisabled = displayDisabled || disabled || initialized && !exists;
|
|
5309
5308
|
const controlIsReadOnly = displayReadOnly || readOnly || isComputedSchema(schema);
|
|
5310
5309
|
useImperativeHandle(apiRef, () => ({
|
|
5311
5310
|
...controller,
|
|
@@ -5649,7 +5648,7 @@ var TextControl = forwardRef(function TextControl({ path, issueMessages, issuesP
|
|
|
5649
5648
|
pattern: pattern ?? (typeof restrictions.pattern === "string" ? restrictions.pattern : void 0),
|
|
5650
5649
|
loading: displayLoading || loading,
|
|
5651
5650
|
showSpinner: displayValidating || showSpinner,
|
|
5652
|
-
disabled: displayDisabled || disabled,
|
|
5651
|
+
disabled: displayDisabled || disabled || inputProps.disabled,
|
|
5653
5652
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
5654
5653
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
5655
5654
|
endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [popoverIssues, endAdornment] }),
|