@ostack.tech/ui-kform 0.6.4 → 0.7.0
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 +83 -52
- package/dist/ostack-ui-kform.js.map +1 -1
- package/dist/types/components/FileControl/FileControl.d.ts +2 -2
- package/dist/types/components/LoadAction/LoadAction.d.ts +1 -1
- package/dist/types/components/PrintAction/PrintAction.d.ts +1 -1
- package/dist/types/components/SaveAction/SaveAction.d.ts +1 -1
- package/dist/types/components/SubmitAction/SubmitAction.d.ts +1 -1
- package/dist/types/components/ValidateAction/ValidateAction.d.ts +1 -1
- package/dist/types/utils/useRegisterControl.d.ts +1 -0
- package/package.json +4 -4
package/dist/ostack-ui-kform.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { usePrefix as usePrefix$1, useControllableState, useLatestValues, combineEventHandlers, LocalizationProvider as LocalizationProvider$1, usePrinting, useConstant, useSpacing, useCssVars, NATIVE_CONTROLS, useResponsiveValues, useCombinedRef, cx, useIsInRoot, warnOnce, usePrintInProgress, PrefixProvider, Root, computed, TabContent, ErrorBoundary, DocumentTitle, Spinner, useToastManager, useStartPrintingTask, Tabs, useErrorReporter, EMPTY_STORE, Field, Feedback, FeedbackList, FeedbackPopover, useMediaBreakpointUp, DropdownMenu, DropdownMenuTrigger, Button, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuGroup, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, DropdownMenuItem, useAlertDialog, DropdownMenuRadioItem, controlStatusToAccent, VisuallyHidden, IconButton, Tab, boolDataAttr, TabList, useIsInTableCell, useDataTableColumnLabel, useOnFieldLabelChange, Checkbox, OptionsGroup, Option, CheckboxGroup, useDateTransformer, DateInput, DateRangeInput, usePrintClassNames, Input, Dialog, Tooltip, DialogTrigger, ControlAddon, Icon, DialogContent, DialogHeader, DialogTitle, DialogBody, Alert, Stack, Popover, PopoverTrigger, PopoverContent, useMeasure, Container, Select, MenuListItem, MenuList, StepContent, Step, StepList, Stepper, CloseButton, useScrollPosition, setBoolDataAttr, Card, CardHeader, CardTitle, CardBody, useIntersectionObserver, useKeyboardShortcut, NumericInput, Link, usePrint, usePrinterDocumentTitle, PrinterTrigger, RadioGroup, Radio, ButtonGroup, AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogBody, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, DataTableCell, DataTableRow, useDataTableApiRef, DataTable, Slot, DataTableContent, DataTablePagination, DataTableRowsPerPage, TextArea, PortalContext } from "@ostack.tech/ui";
|
|
3
3
|
import { AbsolutePath, AbsolutePathFragment, PathMultimap, sliceTable, listableSize, Path, ValidationFailure, nullableSchemaInnerSchema, compareSchemaPaths, PromiseCancellationException, arrayToTable, indexOfTableRowId, isComputedSchema } from "@ostack.tech/kform";
|
|
4
|
-
import { useResolvedPath, equals, useFormController, useForm, FormContext, CurrentPath, useCurrentPath, useFormManager, useFormattedValue, InvalidPathError, AtPathError, useIssuesTracker, useFormContext, useInput, useListableInput, formatTemporalAsString, useTemporalInput, useFileInput, useController, useNumericInput, formatNumericAsString, useFormatter } from "@ostack.tech/kform-react";
|
|
4
|
+
import { useResolvedPath, equals, useFormController, useForm, FormContext, CurrentPath, useCurrentPath, useFormManager, useFormattedValue, InvalidPathError, AtPathError, useIssuesTracker, useFormContext, useInput, useListableInput, formatTemporalAsString, useTemporalInput, useFileInput, toFileList, useController, useNumericInput, formatNumericAsString, useFormatter } from "@ostack.tech/kform-react";
|
|
5
5
|
import { createContext, useContext, useCallback, useMemo, useRef, useEffect, forwardRef, useState, useImperativeHandle, startTransition, Suspense, useDeferredValue, Children, isValidElement, createElement, memo } from "react";
|
|
6
6
|
import { createStore, useStore } from "zustand";
|
|
7
7
|
import { subscribeWithSelector } from "zustand/middleware";
|
|
@@ -150,7 +150,7 @@ function pathSpecificity(path) {
|
|
|
150
150
|
}
|
|
151
151
|
return specificity;
|
|
152
152
|
}
|
|
153
|
-
const INITIAL = Symbol();
|
|
153
|
+
const INITIAL = /* @__PURE__ */ Symbol();
|
|
154
154
|
function useEqualityFn(selector, equalityFn = Object.is) {
|
|
155
155
|
const latest = useRef(INITIAL);
|
|
156
156
|
return (state) => {
|
|
@@ -2283,7 +2283,7 @@ function AnnexesMenuItem({
|
|
|
2283
2283
|
circle: true,
|
|
2284
2284
|
disabled: formIsDisabled,
|
|
2285
2285
|
onClick: handleRemoveButtonClick,
|
|
2286
|
-
"aria-hidden":
|
|
2286
|
+
"aria-hidden": true
|
|
2287
2287
|
}
|
|
2288
2288
|
)
|
|
2289
2289
|
] })
|
|
@@ -2618,14 +2618,13 @@ function useRegisterControl({
|
|
|
2618
2618
|
const { useState: useState2, usePath, useInitialized, useDisplayStatus } = controller;
|
|
2619
2619
|
const path = usePath();
|
|
2620
2620
|
const formIsDisabled = useFormIsDisabled();
|
|
2621
|
-
const displayDisabled = useState2((state) =>
|
|
2621
|
+
const displayDisabled = useState2((state) => state.initialized && !state.exists) || formIsDisabled;
|
|
2622
2622
|
const displayReadOnly = useFormIsReadOnly();
|
|
2623
|
-
const deferredIsValidating = useDeferredValue(
|
|
2624
|
-
useState2((state) => state.validationStatus === "validating")
|
|
2625
|
-
);
|
|
2626
2623
|
const initialized = useInitialized();
|
|
2627
|
-
const displayLoading = !initialized || deferredIsValidating;
|
|
2628
2624
|
const displayStatusToDisplay = useDeferredValue(useDisplayStatus());
|
|
2625
|
+
const displayValidating = useDeferredValue(
|
|
2626
|
+
useState2((state) => state.validationStatus === "validating")
|
|
2627
|
+
);
|
|
2629
2628
|
const issuesToDisplay = useDeferredValue(
|
|
2630
2629
|
useState2((state) => state.touched ? state.issues : [], {
|
|
2631
2630
|
equalityFn: shallow
|
|
@@ -2662,21 +2661,23 @@ function useRegisterControl({
|
|
|
2662
2661
|
);
|
|
2663
2662
|
return useMemo(
|
|
2664
2663
|
() => ({
|
|
2665
|
-
displayLoading: printing ? false :
|
|
2664
|
+
displayLoading: printing ? false : !initialized,
|
|
2666
2665
|
displayDisabled: printing ? false : displayDisabled,
|
|
2667
2666
|
displayReadOnly: printing ? false : displayReadOnly,
|
|
2668
2667
|
displayStatusToDisplay: printing ? void 0 : displayStatusToDisplay,
|
|
2668
|
+
displayValidating: printing ? false : displayValidating,
|
|
2669
2669
|
issuesToDisplay: printing ? [] : issuesToDisplay,
|
|
2670
2670
|
autofocusRef,
|
|
2671
2671
|
handleFocus
|
|
2672
2672
|
}),
|
|
2673
2673
|
[
|
|
2674
2674
|
autofocusRef,
|
|
2675
|
+
displayValidating,
|
|
2675
2676
|
displayDisabled,
|
|
2676
|
-
displayLoading,
|
|
2677
2677
|
displayReadOnly,
|
|
2678
2678
|
displayStatusToDisplay,
|
|
2679
2679
|
handleFocus,
|
|
2680
|
+
initialized,
|
|
2680
2681
|
issuesToDisplay,
|
|
2681
2682
|
printing
|
|
2682
2683
|
]
|
|
@@ -2715,6 +2716,7 @@ const CheckboxControl = forwardRef(function CheckboxControl2({
|
|
|
2715
2716
|
onTouchedStatusChange,
|
|
2716
2717
|
required,
|
|
2717
2718
|
loading,
|
|
2719
|
+
showSpinner,
|
|
2718
2720
|
disabled,
|
|
2719
2721
|
readOnly,
|
|
2720
2722
|
onFocus,
|
|
@@ -2746,6 +2748,7 @@ const CheckboxControl = forwardRef(function CheckboxControl2({
|
|
|
2746
2748
|
displayDisabled,
|
|
2747
2749
|
displayReadOnly,
|
|
2748
2750
|
displayStatusToDisplay,
|
|
2751
|
+
displayValidating,
|
|
2749
2752
|
issuesToDisplay,
|
|
2750
2753
|
autofocusRef,
|
|
2751
2754
|
handleFocus
|
|
@@ -2783,6 +2786,7 @@ const CheckboxControl = forwardRef(function CheckboxControl2({
|
|
|
2783
2786
|
name: inputProps.name,
|
|
2784
2787
|
required: required ?? restrictions.required === true,
|
|
2785
2788
|
loading: displayLoading || loading,
|
|
2789
|
+
showSpinner: displayValidating || showSpinner,
|
|
2786
2790
|
disabled: displayDisabled || disabled,
|
|
2787
2791
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
2788
2792
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
@@ -2861,6 +2865,7 @@ const CheckboxGroupControl = forwardRef(function CheckboxGroupControl2({
|
|
|
2861
2865
|
onTouchedStatusChange,
|
|
2862
2866
|
required,
|
|
2863
2867
|
loading,
|
|
2868
|
+
showSpinner,
|
|
2864
2869
|
disabled,
|
|
2865
2870
|
readOnly,
|
|
2866
2871
|
onFocus,
|
|
@@ -2913,6 +2918,7 @@ const CheckboxGroupControl = forwardRef(function CheckboxGroupControl2({
|
|
|
2913
2918
|
displayDisabled,
|
|
2914
2919
|
displayReadOnly,
|
|
2915
2920
|
displayStatusToDisplay,
|
|
2921
|
+
displayValidating,
|
|
2916
2922
|
issuesToDisplay,
|
|
2917
2923
|
autofocusRef,
|
|
2918
2924
|
handleFocus
|
|
@@ -2954,6 +2960,7 @@ const CheckboxGroupControl = forwardRef(function CheckboxGroupControl2({
|
|
|
2954
2960
|
name: inputProps.name,
|
|
2955
2961
|
required: required ?? restrictions.required === true,
|
|
2956
2962
|
loading: displayLoading || loading,
|
|
2963
|
+
showSpinner: displayValidating || showSpinner,
|
|
2957
2964
|
disabled: displayDisabled || disabled,
|
|
2958
2965
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
2959
2966
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
@@ -3045,6 +3052,7 @@ const DateControl = forwardRef(function DateControl2({
|
|
|
3045
3052
|
minDate,
|
|
3046
3053
|
maxDate,
|
|
3047
3054
|
loading,
|
|
3055
|
+
showSpinner,
|
|
3048
3056
|
disabled,
|
|
3049
3057
|
readOnly,
|
|
3050
3058
|
onFocus,
|
|
@@ -3087,6 +3095,7 @@ const DateControl = forwardRef(function DateControl2({
|
|
|
3087
3095
|
displayDisabled,
|
|
3088
3096
|
displayReadOnly,
|
|
3089
3097
|
displayStatusToDisplay,
|
|
3098
|
+
displayValidating,
|
|
3090
3099
|
issuesToDisplay,
|
|
3091
3100
|
autofocusRef,
|
|
3092
3101
|
handleFocus
|
|
@@ -3130,6 +3139,7 @@ const DateControl = forwardRef(function DateControl2({
|
|
|
3130
3139
|
minDate: minDate ?? minDateRestriction(schema),
|
|
3131
3140
|
maxDate: maxDate ?? maxDateRestriction(schema),
|
|
3132
3141
|
loading: displayLoading || loading,
|
|
3142
|
+
showSpinner: displayValidating || showSpinner,
|
|
3133
3143
|
disabled: displayDisabled || disabled,
|
|
3134
3144
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
3135
3145
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
@@ -3166,8 +3176,10 @@ const DateRangeControl = forwardRef(function DateRangeControl2({
|
|
|
3166
3176
|
required,
|
|
3167
3177
|
minDate,
|
|
3168
3178
|
maxDate,
|
|
3169
|
-
|
|
3170
|
-
|
|
3179
|
+
loading,
|
|
3180
|
+
showSpinners = loading,
|
|
3181
|
+
showStartSpinner = showSpinners,
|
|
3182
|
+
showEndSpinner = showSpinners,
|
|
3171
3183
|
disabled,
|
|
3172
3184
|
readOnly,
|
|
3173
3185
|
startInputProps,
|
|
@@ -3263,6 +3275,7 @@ const DateRangeControl = forwardRef(function DateRangeControl2({
|
|
|
3263
3275
|
displayDisabled: displayStartDisabled,
|
|
3264
3276
|
displayReadOnly: displayStartReadOnly,
|
|
3265
3277
|
displayStatusToDisplay: startDisplayStatusToDisplay,
|
|
3278
|
+
displayValidating: displayStartValidating,
|
|
3266
3279
|
issuesToDisplay: startIssuesToDisplay,
|
|
3267
3280
|
autofocusRef: startAutofocusRef,
|
|
3268
3281
|
handleFocus: handleStartFocus
|
|
@@ -3279,6 +3292,7 @@ const DateRangeControl = forwardRef(function DateRangeControl2({
|
|
|
3279
3292
|
displayDisabled: displayEndDisabled,
|
|
3280
3293
|
displayReadOnly: displayEndReadOnly,
|
|
3281
3294
|
displayStatusToDisplay: endDisplayStatusToDisplay,
|
|
3295
|
+
displayValidating: displayEndValidating,
|
|
3282
3296
|
issuesToDisplay: endIssuesToDisplay,
|
|
3283
3297
|
autofocusRef: endAutofocusRef,
|
|
3284
3298
|
handleFocus: handleEndFocus
|
|
@@ -3330,8 +3344,9 @@ const DateRangeControl = forwardRef(function DateRangeControl2({
|
|
|
3330
3344
|
required: required ?? (startRestrictions.required === true || endRestrictions.required === true),
|
|
3331
3345
|
minDate: minDate ?? minDateRestriction(startSchema),
|
|
3332
3346
|
maxDate: maxDate ?? maxDateRestriction(endSchema),
|
|
3333
|
-
|
|
3334
|
-
|
|
3347
|
+
loading: displayStartLoading || displayEndLoading || loading,
|
|
3348
|
+
showStartSpinner: displayStartValidating || showStartSpinner,
|
|
3349
|
+
showEndSpinner: displayEndValidating || showEndSpinner,
|
|
3335
3350
|
disabled: displayStartDisabled && displayEndDisabled || disabled,
|
|
3336
3351
|
readOnly: displayStartReadOnly && displayEndReadOnly || readOnly || startInputProps?.readOnly && endInputProps?.readOnly,
|
|
3337
3352
|
status: startDisplayStatusToDisplay === "error" || endDisplayStatusToDisplay === "error" ? "invalid" : startDisplayStatusToDisplay === "warning" || endDisplayStatusToDisplay === "warning" ? "warned" : void 0,
|
|
@@ -3402,6 +3417,7 @@ const FileControl = forwardRef(function FileControl2({
|
|
|
3402
3417
|
required,
|
|
3403
3418
|
accept,
|
|
3404
3419
|
loading,
|
|
3420
|
+
showSpinner,
|
|
3405
3421
|
disabled,
|
|
3406
3422
|
readOnly,
|
|
3407
3423
|
showClearButton,
|
|
@@ -3419,17 +3435,17 @@ const FileControl = forwardRef(function FileControl2({
|
|
|
3419
3435
|
downloadFileButtonLabel ??= locale7.FileControl.downloadFileButtonLabel;
|
|
3420
3436
|
fallbackText ??= locale7.FileControl.fallbackText;
|
|
3421
3437
|
const { printHidden } = usePrintClassNames();
|
|
3422
|
-
const
|
|
3438
|
+
const latestFile = useRef(null);
|
|
3423
3439
|
const [file, setFile] = useState(null);
|
|
3424
3440
|
const controller = useFileInput(
|
|
3425
3441
|
path,
|
|
3426
3442
|
{
|
|
3427
3443
|
enabled: !useFormIsLoading(),
|
|
3428
3444
|
formManager,
|
|
3429
|
-
|
|
3430
|
-
setFile(
|
|
3431
|
-
|
|
3432
|
-
return
|
|
3445
|
+
formatFromJsFile: useCallback((fileValue) => {
|
|
3446
|
+
setFile(fileValue);
|
|
3447
|
+
latestFile.current = fileValue;
|
|
3448
|
+
return fileValue;
|
|
3433
3449
|
}, []),
|
|
3434
3450
|
onInitialized,
|
|
3435
3451
|
onFormManagerEvent,
|
|
@@ -3448,6 +3464,7 @@ const FileControl = forwardRef(function FileControl2({
|
|
|
3448
3464
|
displayDisabled,
|
|
3449
3465
|
displayReadOnly,
|
|
3450
3466
|
displayStatusToDisplay,
|
|
3467
|
+
displayValidating,
|
|
3451
3468
|
issuesToDisplay,
|
|
3452
3469
|
autofocusRef,
|
|
3453
3470
|
handleFocus
|
|
@@ -3470,7 +3487,7 @@ const FileControl = forwardRef(function FileControl2({
|
|
|
3470
3487
|
onChange?.(evt);
|
|
3471
3488
|
inputProps.onChange(evt);
|
|
3472
3489
|
} else {
|
|
3473
|
-
evt.target.files =
|
|
3490
|
+
evt.target.files = toFileList(latestFile.current);
|
|
3474
3491
|
}
|
|
3475
3492
|
},
|
|
3476
3493
|
[inputProps, onChange]
|
|
@@ -3507,6 +3524,7 @@ const FileControl = forwardRef(function FileControl2({
|
|
|
3507
3524
|
required: required ?? restrictions.required == true,
|
|
3508
3525
|
accept: accept ?? (Array.isArray(restrictions.acceptedFileTypes) ? restrictions.acceptedFileTypes.join() : void 0),
|
|
3509
3526
|
loading: displayLoading || loading,
|
|
3527
|
+
showSpinner: displayValidating || showSpinner,
|
|
3510
3528
|
disabled: displayDisabled || disabled,
|
|
3511
3529
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
3512
3530
|
showClearButton,
|
|
@@ -4858,7 +4876,7 @@ function IssuesPanelControls({
|
|
|
4858
4876
|
),
|
|
4859
4877
|
children: [
|
|
4860
4878
|
paginationLabel && currentPageIndex !== -1 && /* @__PURE__ */ jsx(VisuallyHidden, { children: paginationLabel(currentPageIndex + 1, nPages) }),
|
|
4861
|
-
/* @__PURE__ */ jsxs("span", { "aria-hidden":
|
|
4879
|
+
/* @__PURE__ */ jsxs("span", { "aria-hidden": true, children: [
|
|
4862
4880
|
currentPageIndex === -1 ? "-" : currentPageIndex + 1,
|
|
4863
4881
|
" / ",
|
|
4864
4882
|
nPages
|
|
@@ -5546,7 +5564,6 @@ function LoadAction({
|
|
|
5546
5564
|
label,
|
|
5547
5565
|
keybinds,
|
|
5548
5566
|
loading,
|
|
5549
|
-
enabledWhenLoading,
|
|
5550
5567
|
disabled,
|
|
5551
5568
|
onClick,
|
|
5552
5569
|
decode,
|
|
@@ -5580,10 +5597,9 @@ function LoadAction({
|
|
|
5580
5597
|
});
|
|
5581
5598
|
const formIsDisabled = useFormIsDisabled();
|
|
5582
5599
|
const formIsLoading = useFormIsLoading();
|
|
5583
|
-
const shouldDisable = disabled || loading && !enabledWhenLoading || formIsDisabled || formIsLoading;
|
|
5584
5600
|
const formAppEl = useFormAppElement();
|
|
5585
5601
|
useKeyboardShortcut(keybinds, () => load(), {
|
|
5586
|
-
enabled: !
|
|
5602
|
+
enabled: !disabled && !loading && !formIsDisabled && !formIsLoading,
|
|
5587
5603
|
target: formAppEl,
|
|
5588
5604
|
preventDefault: true
|
|
5589
5605
|
});
|
|
@@ -5595,9 +5611,8 @@ function LoadAction({
|
|
|
5595
5611
|
icon: faFolderOpen,
|
|
5596
5612
|
...otherProps,
|
|
5597
5613
|
onClick: combineEventHandlers(() => load(), onClick),
|
|
5598
|
-
disabled:
|
|
5614
|
+
disabled: disabled || formIsDisabled,
|
|
5599
5615
|
loading: loading || formIsLoading,
|
|
5600
|
-
enabledWhenLoading,
|
|
5601
5616
|
children: label
|
|
5602
5617
|
}
|
|
5603
5618
|
);
|
|
@@ -5627,6 +5642,7 @@ const NumericControl = forwardRef(function NumericControl2({
|
|
|
5627
5642
|
exclusiveMin,
|
|
5628
5643
|
exclusiveMax,
|
|
5629
5644
|
loading,
|
|
5645
|
+
showSpinner,
|
|
5630
5646
|
disabled,
|
|
5631
5647
|
readOnly,
|
|
5632
5648
|
endAdornment,
|
|
@@ -5656,6 +5672,7 @@ const NumericControl = forwardRef(function NumericControl2({
|
|
|
5656
5672
|
displayDisabled,
|
|
5657
5673
|
displayReadOnly,
|
|
5658
5674
|
displayStatusToDisplay,
|
|
5675
|
+
displayValidating,
|
|
5659
5676
|
issuesToDisplay,
|
|
5660
5677
|
autofocusRef,
|
|
5661
5678
|
handleFocus
|
|
@@ -5711,6 +5728,7 @@ const NumericControl = forwardRef(function NumericControl2({
|
|
|
5711
5728
|
exclusiveMin: exclusiveMin ?? (restrictions.exclusiveMin == null ? void 0 : formatNumericAsString(restrictions.exclusiveMin, schema)),
|
|
5712
5729
|
exclusiveMax: exclusiveMax ?? (restrictions.exclusiveMax == null ? void 0 : formatNumericAsString(restrictions.exclusiveMax, schema)),
|
|
5713
5730
|
loading: displayLoading || loading,
|
|
5731
|
+
showSpinner: displayValidating || showSpinner,
|
|
5714
5732
|
disabled: displayDisabled || disabled,
|
|
5715
5733
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
5716
5734
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
@@ -5760,7 +5778,6 @@ function PrintAction({
|
|
|
5760
5778
|
keybinds,
|
|
5761
5779
|
disabled,
|
|
5762
5780
|
loading,
|
|
5763
|
-
enabledWhenLoading,
|
|
5764
5781
|
onClick,
|
|
5765
5782
|
...otherProps
|
|
5766
5783
|
}) {
|
|
@@ -5770,11 +5787,10 @@ function PrintAction({
|
|
|
5770
5787
|
const printInProgress = usePrintInProgress();
|
|
5771
5788
|
const formIsDisabled = useFormIsDisabled();
|
|
5772
5789
|
const formIsLoading = useFormIsLoading();
|
|
5773
|
-
const shouldDisable = disabled || loading && !enabledWhenLoading || formIsDisabled || formIsLoading || printInProgress;
|
|
5774
5790
|
const formAppEl = useFormAppElement();
|
|
5775
5791
|
const formTitle = useFormTitle();
|
|
5776
5792
|
const print = usePrint();
|
|
5777
|
-
const printerHasDocumentTitle =
|
|
5793
|
+
const printerHasDocumentTitle = Boolean(usePrinterDocumentTitle());
|
|
5778
5794
|
const handlePrint = (evt) => {
|
|
5779
5795
|
evt.preventDefault();
|
|
5780
5796
|
void print(
|
|
@@ -5782,7 +5798,7 @@ function PrintAction({
|
|
|
5782
5798
|
);
|
|
5783
5799
|
};
|
|
5784
5800
|
useKeyboardShortcut(keybinds, handlePrint, {
|
|
5785
|
-
enabled: !
|
|
5801
|
+
enabled: !disabled && !loading && !formIsDisabled && !formIsLoading && !printInProgress,
|
|
5786
5802
|
target: formAppEl,
|
|
5787
5803
|
preventDefault: true
|
|
5788
5804
|
});
|
|
@@ -5800,7 +5816,7 @@ function PrintAction({
|
|
|
5800
5816
|
icon: faPrint,
|
|
5801
5817
|
...otherProps,
|
|
5802
5818
|
loading: loading || printInProgress,
|
|
5803
|
-
disabled:
|
|
5819
|
+
disabled: disabled || formIsDisabled || formIsLoading,
|
|
5804
5820
|
children: label
|
|
5805
5821
|
}
|
|
5806
5822
|
)
|
|
@@ -5830,6 +5846,7 @@ const RadioGroupControl = forwardRef(function RadioGroupControl2({
|
|
|
5830
5846
|
onTouchedStatusChange,
|
|
5831
5847
|
required,
|
|
5832
5848
|
loading,
|
|
5849
|
+
showSpinner,
|
|
5833
5850
|
disabled,
|
|
5834
5851
|
readOnly,
|
|
5835
5852
|
showClearButton = false,
|
|
@@ -5887,6 +5904,7 @@ const RadioGroupControl = forwardRef(function RadioGroupControl2({
|
|
|
5887
5904
|
displayDisabled,
|
|
5888
5905
|
displayReadOnly,
|
|
5889
5906
|
displayStatusToDisplay,
|
|
5907
|
+
displayValidating,
|
|
5890
5908
|
issuesToDisplay,
|
|
5891
5909
|
autofocusRef,
|
|
5892
5910
|
handleFocus
|
|
@@ -5930,6 +5948,7 @@ const RadioGroupControl = forwardRef(function RadioGroupControl2({
|
|
|
5930
5948
|
name: inputProps.name,
|
|
5931
5949
|
required: required ?? restrictions.required === true,
|
|
5932
5950
|
loading: displayLoading || loading,
|
|
5951
|
+
showSpinner: displayValidating || showSpinner,
|
|
5933
5952
|
disabled: displayDisabled || disabled,
|
|
5934
5953
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
5935
5954
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
@@ -6109,7 +6128,6 @@ function SaveAction({
|
|
|
6109
6128
|
saveAsLabel,
|
|
6110
6129
|
saveAsKeybinds,
|
|
6111
6130
|
loading,
|
|
6112
|
-
enabledWhenLoading,
|
|
6113
6131
|
disabled,
|
|
6114
6132
|
onClick,
|
|
6115
6133
|
variant = "subtle",
|
|
@@ -6150,15 +6168,15 @@ function SaveAction({
|
|
|
6150
6168
|
});
|
|
6151
6169
|
const formIsSaving = useFormIsSaving();
|
|
6152
6170
|
const formIsLoading = useFormIsLoading();
|
|
6153
|
-
const shouldDisable = disabled || loading && !enabledWhenLoading || formIsSaving || formIsLoading;
|
|
6154
6171
|
const formAppEl = useFormAppElement();
|
|
6172
|
+
const shortcutsEnabled = !disabled && !loading && !formIsSaving && !formIsLoading;
|
|
6155
6173
|
useKeyboardShortcut(keybinds, () => save({ overwrite: !disableOverwrite }), {
|
|
6156
|
-
enabled:
|
|
6174
|
+
enabled: shortcutsEnabled,
|
|
6157
6175
|
target: formAppEl,
|
|
6158
6176
|
preventDefault: true
|
|
6159
6177
|
});
|
|
6160
6178
|
useKeyboardShortcut(saveAsKeybinds, () => save(), {
|
|
6161
|
-
enabled:
|
|
6179
|
+
enabled: shortcutsEnabled,
|
|
6162
6180
|
target: formAppEl,
|
|
6163
6181
|
preventDefault: true
|
|
6164
6182
|
});
|
|
@@ -6174,9 +6192,8 @@ function SaveAction({
|
|
|
6174
6192
|
() => save({ overwrite: !disableOverwrite }),
|
|
6175
6193
|
onClick
|
|
6176
6194
|
),
|
|
6177
|
-
disabled:
|
|
6195
|
+
disabled: disabled || formIsLoading,
|
|
6178
6196
|
loading: loading || formIsSaving,
|
|
6179
|
-
enabledWhenLoading,
|
|
6180
6197
|
children: label
|
|
6181
6198
|
}
|
|
6182
6199
|
);
|
|
@@ -6191,11 +6208,19 @@ function SaveAction({
|
|
|
6191
6208
|
icon: faCaretDown,
|
|
6192
6209
|
...saveOptionsProps,
|
|
6193
6210
|
label: saveOptionsLabel,
|
|
6194
|
-
disabled:
|
|
6211
|
+
disabled: disabled || formIsLoading || saveOptionsProps?.disabled,
|
|
6195
6212
|
style: { minWidth: 20, ...saveOptionsProps?.style }
|
|
6196
6213
|
}
|
|
6197
6214
|
) }),
|
|
6198
|
-
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", ...dropdownMenuProps, children: /* @__PURE__ */ jsx(
|
|
6215
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", ...dropdownMenuProps, children: /* @__PURE__ */ jsx(
|
|
6216
|
+
DropdownMenuItem,
|
|
6217
|
+
{
|
|
6218
|
+
onClick: () => save(),
|
|
6219
|
+
disabled: disabled || formIsLoading,
|
|
6220
|
+
loading: loading || formIsSaving,
|
|
6221
|
+
children: saveAsLabel
|
|
6222
|
+
}
|
|
6223
|
+
) })
|
|
6199
6224
|
] })
|
|
6200
6225
|
] }) : saveButton;
|
|
6201
6226
|
}
|
|
@@ -6218,6 +6243,7 @@ const SelectControl = forwardRef(function SelectControl2({
|
|
|
6218
6243
|
onTouchedStatusChange,
|
|
6219
6244
|
required,
|
|
6220
6245
|
loading,
|
|
6246
|
+
showSpinner,
|
|
6221
6247
|
disabled,
|
|
6222
6248
|
readOnly,
|
|
6223
6249
|
showClearButton,
|
|
@@ -6284,6 +6310,7 @@ const SelectControl = forwardRef(function SelectControl2({
|
|
|
6284
6310
|
displayDisabled,
|
|
6285
6311
|
displayReadOnly,
|
|
6286
6312
|
displayStatusToDisplay,
|
|
6313
|
+
displayValidating,
|
|
6287
6314
|
issuesToDisplay,
|
|
6288
6315
|
autofocusRef,
|
|
6289
6316
|
handleFocus
|
|
@@ -6336,6 +6363,7 @@ const SelectControl = forwardRef(function SelectControl2({
|
|
|
6336
6363
|
name: inputProps.name,
|
|
6337
6364
|
required: required ?? restrictions.required === true,
|
|
6338
6365
|
loading: displayLoading || loading,
|
|
6366
|
+
showSpinner: displayValidating || showSpinner,
|
|
6339
6367
|
disabled: displayDisabled || disabled,
|
|
6340
6368
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
6341
6369
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
@@ -6380,6 +6408,7 @@ const SelectMultipleControl = forwardRef(function SelectMultipleControl2({
|
|
|
6380
6408
|
onTouchedStatusChange,
|
|
6381
6409
|
required,
|
|
6382
6410
|
loading,
|
|
6411
|
+
showSpinner,
|
|
6383
6412
|
disabled,
|
|
6384
6413
|
readOnly,
|
|
6385
6414
|
endAdornment,
|
|
@@ -6444,6 +6473,7 @@ const SelectMultipleControl = forwardRef(function SelectMultipleControl2({
|
|
|
6444
6473
|
displayDisabled,
|
|
6445
6474
|
displayReadOnly,
|
|
6446
6475
|
displayStatusToDisplay,
|
|
6476
|
+
displayValidating,
|
|
6447
6477
|
issuesToDisplay,
|
|
6448
6478
|
autofocusRef,
|
|
6449
6479
|
handleFocus
|
|
@@ -6490,6 +6520,7 @@ const SelectMultipleControl = forwardRef(function SelectMultipleControl2({
|
|
|
6490
6520
|
name: inputProps.name,
|
|
6491
6521
|
required: required ?? restrictions.required === true,
|
|
6492
6522
|
loading: displayLoading || loading,
|
|
6523
|
+
showSpinner: displayValidating || showSpinner,
|
|
6493
6524
|
disabled: displayDisabled || disabled,
|
|
6494
6525
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
6495
6526
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
@@ -6527,7 +6558,6 @@ function SubmitAction({
|
|
|
6527
6558
|
keybinds,
|
|
6528
6559
|
confirmWarnings = true,
|
|
6529
6560
|
loading,
|
|
6530
|
-
enabledWhenLoading,
|
|
6531
6561
|
disabled,
|
|
6532
6562
|
onClick,
|
|
6533
6563
|
dialogTitle,
|
|
@@ -6575,7 +6605,6 @@ function SubmitAction({
|
|
|
6575
6605
|
const formIsDisabled = useFormIsDisabled();
|
|
6576
6606
|
const formIsLoading = useFormIsLoading();
|
|
6577
6607
|
const formAppEl = useFormAppElement();
|
|
6578
|
-
const shouldDisable = disabled || loading && !enabledWhenLoading || formIsDisabled || formIsLoading || submitting;
|
|
6579
6608
|
const [submissionInfo, setSubmissionInfo] = useState(null);
|
|
6580
6609
|
const [checkedWarnings, setCheckedWarnings] = useState([]);
|
|
6581
6610
|
const allWarningsChecked = !submissionInfo?.warnings || submissionInfo.warnings.every(
|
|
@@ -6653,7 +6682,7 @@ function SubmitAction({
|
|
|
6653
6682
|
convertExternalIssuesTableRowIndicesToIds
|
|
6654
6683
|
});
|
|
6655
6684
|
useKeyboardShortcut(keybinds, handleAction, {
|
|
6656
|
-
enabled: !
|
|
6685
|
+
enabled: !disabled && !loading && !formIsDisabled && !formIsLoading && !submitting,
|
|
6657
6686
|
target: formAppEl,
|
|
6658
6687
|
preventDefault: true
|
|
6659
6688
|
});
|
|
@@ -6667,9 +6696,8 @@ function SubmitAction({
|
|
|
6667
6696
|
iconPlacement: "end",
|
|
6668
6697
|
...otherProps,
|
|
6669
6698
|
onClick: combineEventHandlers(handleAction, onClick),
|
|
6670
|
-
disabled:
|
|
6699
|
+
disabled: disabled || formIsDisabled || formIsLoading,
|
|
6671
6700
|
loading: loading || submitting,
|
|
6672
|
-
enabledWhenLoading,
|
|
6673
6701
|
children: label
|
|
6674
6702
|
}
|
|
6675
6703
|
) }),
|
|
@@ -7259,6 +7287,7 @@ const TextControl = forwardRef(function TextControl2({
|
|
|
7259
7287
|
maxLength,
|
|
7260
7288
|
pattern,
|
|
7261
7289
|
loading,
|
|
7290
|
+
showSpinner,
|
|
7262
7291
|
disabled,
|
|
7263
7292
|
readOnly,
|
|
7264
7293
|
endAdornment,
|
|
@@ -7294,6 +7323,7 @@ const TextControl = forwardRef(function TextControl2({
|
|
|
7294
7323
|
displayDisabled,
|
|
7295
7324
|
displayReadOnly,
|
|
7296
7325
|
displayStatusToDisplay,
|
|
7326
|
+
displayValidating,
|
|
7297
7327
|
issuesToDisplay,
|
|
7298
7328
|
autofocusRef,
|
|
7299
7329
|
handleFocus
|
|
@@ -7327,6 +7357,7 @@ const TextControl = forwardRef(function TextControl2({
|
|
|
7327
7357
|
maxLength: maxLength ?? (typeof restrictions.maxLength === "number" ? restrictions.maxLength : void 0),
|
|
7328
7358
|
pattern: pattern ?? (typeof restrictions.pattern === "string" ? restrictions.pattern : void 0),
|
|
7329
7359
|
loading: displayLoading || loading,
|
|
7360
|
+
showSpinner: displayValidating || showSpinner,
|
|
7330
7361
|
disabled: displayDisabled || disabled,
|
|
7331
7362
|
readOnly: displayReadOnly || readOnly || inputProps.readOnly,
|
|
7332
7363
|
status: displayStatusToControlStatus(displayStatusToDisplay),
|
|
@@ -7407,7 +7438,6 @@ function ValidateAction({
|
|
|
7407
7438
|
label,
|
|
7408
7439
|
keybinds,
|
|
7409
7440
|
loading,
|
|
7410
|
-
enabledWhenLoading,
|
|
7411
7441
|
disabled,
|
|
7412
7442
|
onClick,
|
|
7413
7443
|
...otherProps
|
|
@@ -7416,14 +7446,15 @@ function ValidateAction({
|
|
|
7416
7446
|
label ??= locale7.ValidateAction.label;
|
|
7417
7447
|
keybinds ??= locale7.ValidateAction.keybinds;
|
|
7418
7448
|
const { validate } = useFormValidator();
|
|
7419
|
-
const { validatingAutomatically, validatingManually
|
|
7420
|
-
const
|
|
7449
|
+
const { validatingAutomatically, validatingManually } = useFormIsValidating();
|
|
7450
|
+
const deferredValidatingAutomatically = useDeferredValue(
|
|
7451
|
+
validatingAutomatically
|
|
7452
|
+
);
|
|
7421
7453
|
const formIsDisabled = useFormIsDisabled();
|
|
7422
7454
|
const formIsLoading = useFormIsLoading();
|
|
7423
|
-
const shouldDisable = disabled || loading && !enabledWhenLoading || formIsDisabled || formIsLoading || validatingManually;
|
|
7424
7455
|
const formAppEl = useFormAppElement();
|
|
7425
7456
|
useKeyboardShortcut(keybinds, validate, {
|
|
7426
|
-
enabled: !
|
|
7457
|
+
enabled: !disabled && !loading && !formIsDisabled && !formIsLoading && !validatingManually,
|
|
7427
7458
|
target: formAppEl,
|
|
7428
7459
|
preventDefault: true
|
|
7429
7460
|
});
|
|
@@ -7435,9 +7466,9 @@ function ValidateAction({
|
|
|
7435
7466
|
vertical: true,
|
|
7436
7467
|
...otherProps,
|
|
7437
7468
|
onClick: combineEventHandlers(validate, onClick),
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7469
|
+
loading: loading || validatingManually,
|
|
7470
|
+
disabled: disabled || formIsDisabled || formIsLoading,
|
|
7471
|
+
showSpinner: deferredValidatingAutomatically,
|
|
7441
7472
|
children: label
|
|
7442
7473
|
}
|
|
7443
7474
|
);
|