@ostack.tech/ui-kform 0.16.0 → 0.16.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/ostack-ui-kform.js
CHANGED
|
@@ -2,14 +2,14 @@ import { locale } from "./locales/en-GB.js";
|
|
|
2
2
|
import { locale as locale$1 } from "./locales/en-US.js";
|
|
3
3
|
import { locale as locale$2 } from "./locales/fr-FR.js";
|
|
4
4
|
import { locale as locale$3 } from "./locales/pt-PT.js";
|
|
5
|
-
import { Alert, AlertDialog, AlertDialogAction, AlertDialogBody, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, Button, ButtonGroup, Card, CardBody, CardHeader, CardTitle, Checkbox, CheckboxGroup, CloseButton, Code, Container, ControlAddon, DataTable, DataTableCell, DataTableContent, DataTablePagination, DataTableRow, DataTableRowsPerPage, DateInput, DateRangeInput, DescriptionList, DescriptionListItem, Dialog, DialogBody, DialogContent, DialogHeader, DialogTitle, DialogTrigger, DocumentTitle, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EMPTY_STORE, ErrorBoundary, Feedback, FeedbackList, FeedbackPopover, FeedbackProvider, Field, Icon, IconButton, Input, Layer, Link, LocalizationProvider as LocalizationProvider$1, MenuList, MenuListItem, NATIVE_CONTROLS, NumericInput, Option, OptionsGroup, Popover, PopoverContent, PopoverTrigger, PrefixProvider, PrinterTrigger, Radio, RadioGroup, Root, Select, Slot, Spinner, Stack, Step, StepContent, StepList, Stepper, StepperFinishTrigger, StepperNextTrigger, StepperPreviousTrigger, Tab, TabContent, TabList, Tabs, TextArea, Tooltip, VisuallyHidden, boolDataAttr, combineAriaIds, combineEventHandlers, computed, controlStatusToAccent, cx, parseChildren, setBoolDataAttr, useAlertDialog, useCombinedRef, useConstant, useControllableState, useCssVars, useDataTableApiRef, useDataTableColumnLabel, useDateTransformer, useErrorReporter, useIntersectionObserver, useIsInRoot, useIsInTableCell, useKeyboardShortcut, useLatestRef, useMeasure, useMediaBreakpointUp, useOnLabelChange, usePrefix as usePrefix$1, usePrevious, usePrint, usePrintClassNames, usePrintInProgress, usePrinterDocumentTitle, usePrinting, useResponsiveValues,
|
|
5
|
+
import { Alert, AlertDialog, AlertDialogAction, AlertDialogBody, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, Button, ButtonGroup, Card, CardBody, CardHeader, CardTitle, Checkbox, CheckboxGroup, CloseButton, Code, Container, ControlAddon, DataTable, DataTableCell, DataTableContent, DataTablePagination, DataTableRow, DataTableRowsPerPage, DateInput, DateRangeInput, DescriptionList, DescriptionListItem, Dialog, DialogBody, DialogContent, DialogHeader, DialogTitle, DialogTrigger, DocumentTitle, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EMPTY_STORE, ErrorBoundary, Feedback, FeedbackList, FeedbackPopover, FeedbackProvider, Field, Icon, IconButton, Input, Layer, Link, LocalizationProvider as LocalizationProvider$1, MenuList, MenuListItem, NATIVE_CONTROLS, NumericInput, Option, OptionsGroup, Popover, PopoverContent, PopoverTrigger, PrefixProvider, PrinterTrigger, Radio, RadioGroup, Root, Select, Slot, Spinner, Stack, Step, StepContent, StepList, Stepper, StepperFinishTrigger, StepperNextTrigger, StepperPreviousTrigger, Tab, TabContent, TabList, Tabs, TextArea, Tooltip, VisuallyHidden, boolDataAttr, combineAriaIds, combineEventHandlers, computed, controlStatusToAccent, cx, parseChildren, setBoolDataAttr, useAlertDialog, useCombinedRef, useConstant, useControllableState, useCssVars, useDataTableApiRef, useDataTableColumnLabel, useDateTransformer, useErrorReporter, useIntersectionObserver, useIsInRoot, useIsInTableCell, useKeyboardShortcut, useLatestRef, useMeasure, useMediaBreakpointUp, useOnLabelChange, usePrefix as usePrefix$1, usePrevious, usePrint, usePrintClassNames, usePrintInProgress, usePrinterDocumentTitle, usePrinting, useResponsiveValues, useScrollPosition, useSpacing, useStartPrintingTask, useToastManager, warnOnce } from "@ostack.tech/ui";
|
|
6
6
|
import { DEV } from "esm-env";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { AtPathError, CurrentPath, FormContext, FormattedValue, InvalidPathError, equals, formatNumericAsString, formatTemporalAsString, toFileList, useController, useCurrentPath, useFileInput, useForm, useFormContext, useFormController, useFormManager, useFormattedValue, useFormatter, useInput, useIssuesTracker, useListableInput, useNumericInput, useResolvedPath, useTemporalInput } from "@ostack.tech/kform-react";
|
|
9
|
-
import { Children, Fragment as Fragment$1, Suspense, createContext, isValidElement, startTransition, useCallback, useContext, useDeferredValue, useEffect, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
9
|
+
import { Children, Fragment as Fragment$1, Suspense, createContext, isValidElement, startTransition, useCallback, useContext, useDeferredValue, useEffect, useEffectEvent, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
10
10
|
import { createStore, useStore } from "zustand";
|
|
11
11
|
import { useShallow } from "zustand/react/shallow";
|
|
12
|
-
import { AbsolutePath, AbsolutePathFragment, Path, PathMultimap, PromiseCancellationException, ValidationFailure, arrayToTable, compareSchemaPaths,
|
|
12
|
+
import { AbsolutePath, AbsolutePathFragment, Path, PathMultimap, PromiseCancellationException, ValidationFailure, arrayToTable, compareSchemaPaths, isComputedSchema, isKtList, isTable, nullableSchemaInnerSchema, sliceTableRows, tableIdsToArray, tableRowsToArray, tableSize } from "@ostack.tech/kform";
|
|
13
13
|
import { subscribeWithSelector } from "zustand/middleware";
|
|
14
14
|
import { shallow } from "zustand/shallow";
|
|
15
15
|
import { fileOpen, fileSave, supported } from "browser-fs-access";
|
|
@@ -835,8 +835,8 @@ function FormApp({ enableErrorReporting, reportError, errorReportingUrl, errorRe
|
|
|
835
835
|
confirmUnloadWhenDirty,
|
|
836
836
|
confirmUnloadMessage,
|
|
837
837
|
onSubmit,
|
|
838
|
-
onInvalidSubmit: (issues, event) => {
|
|
839
|
-
|
|
838
|
+
onInvalidSubmit: async (issues, event) => {
|
|
839
|
+
await startIssuesNavigation({ validate: false });
|
|
840
840
|
onInvalidSubmit?.(issues, event);
|
|
841
841
|
},
|
|
842
842
|
onSuccessfulSubmit,
|
|
@@ -1332,7 +1332,7 @@ function AnnexRegistrar({ path, title, subtitle, description, issuesPanelLabel,
|
|
|
1332
1332
|
const store = useAnnexesContext();
|
|
1333
1333
|
const printing = usePrinting();
|
|
1334
1334
|
const finishPrintingTask = useStartPrintingTask();
|
|
1335
|
-
const [isNull = true, controller] = useFormattedValue(path.append(AbsolutePathFragment.RecursiveWildcard), {
|
|
1335
|
+
const [isNull = true, controller] = useFormattedValue(typeof itemTitle === "function" || typeof title === "function" || typeof subtitle === "function" || typeof documentTitle === "function" ? path.append(AbsolutePathFragment.RecursiveWildcard) : path, {
|
|
1336
1336
|
enabled: !useFormIsLoading(),
|
|
1337
1337
|
onInitialized: finishPrintingTask,
|
|
1338
1338
|
format: useCallback((value) => value === null, [])
|
|
@@ -1400,7 +1400,7 @@ function RepetitiveAnnexRegistrar({ path, maxAnnexes, ...annexProps }) {
|
|
|
1400
1400
|
const [rowIds, controller] = useFormattedValue(path.parent(), {
|
|
1401
1401
|
enabled: !useFormIsLoading(),
|
|
1402
1402
|
onInitialized: finishPrintingTask,
|
|
1403
|
-
format: useCallback((value) => value
|
|
1403
|
+
format: useCallback((value) => value ? tableIdsToArray(value) : [], [])
|
|
1404
1404
|
});
|
|
1405
1405
|
const schema = controller.useSchema();
|
|
1406
1406
|
const absolutePath = controller.usePath();
|
|
@@ -3137,6 +3137,70 @@ function DateRangeControl({ startPath, endPath, startIssueMessages, endIssueMess
|
|
|
3137
3137
|
}), inlineIssues] });
|
|
3138
3138
|
}
|
|
3139
3139
|
//#endregion
|
|
3140
|
+
//#region src/components/FileControl/FileControlDownloadAddon.tsx
|
|
3141
|
+
/** Control addon used to download a file. */
|
|
3142
|
+
function FileControlDownloadAddon({ file, label }) {
|
|
3143
|
+
const { printHidden } = usePrintClassNames();
|
|
3144
|
+
const dataURL = useMemo(() => URL.createObjectURL(file), [file]);
|
|
3145
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
3146
|
+
content: label,
|
|
3147
|
+
children: /* @__PURE__ */ jsx(ControlAddon, {
|
|
3148
|
+
as: "a",
|
|
3149
|
+
className: printHidden,
|
|
3150
|
+
href: dataURL,
|
|
3151
|
+
download: file.name,
|
|
3152
|
+
children: /* @__PURE__ */ jsx(Icon, { icon: faDownload })
|
|
3153
|
+
})
|
|
3154
|
+
});
|
|
3155
|
+
}
|
|
3156
|
+
//#endregion
|
|
3157
|
+
//#region src/components/FileControl/FileControlViewAddon.tsx
|
|
3158
|
+
/** Control addon used to view a file. */
|
|
3159
|
+
function FileControlViewAddon({ file, viewLabel, downloadLabel, fallbackText }) {
|
|
3160
|
+
const prefix = usePrefix();
|
|
3161
|
+
const { printHidden } = usePrintClassNames();
|
|
3162
|
+
const dataURL = useMemo(() => URL.createObjectURL(file), [file]);
|
|
3163
|
+
return /* @__PURE__ */ jsxs(Dialog, { children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
3164
|
+
content: viewLabel,
|
|
3165
|
+
children: /* @__PURE__ */ jsx(DialogTrigger, { children: /* @__PURE__ */ jsx(ControlAddon, {
|
|
3166
|
+
as: "button",
|
|
3167
|
+
className: printHidden,
|
|
3168
|
+
children: /* @__PURE__ */ jsx(Icon, { icon: faFileLines })
|
|
3169
|
+
}) })
|
|
3170
|
+
}), /* @__PURE__ */ jsxs(DialogContent, {
|
|
3171
|
+
variant: "subtle",
|
|
3172
|
+
className: prefix("file-control__viewer-dialog"),
|
|
3173
|
+
"aria-describedby": void 0,
|
|
3174
|
+
children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, {
|
|
3175
|
+
className: prefix("file-control__viewer-dialog-title"),
|
|
3176
|
+
children: file.name
|
|
3177
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
3178
|
+
variant: "ghost",
|
|
3179
|
+
className: prefix("file-control__viewer-download"),
|
|
3180
|
+
asChild: true,
|
|
3181
|
+
icon: faDownload,
|
|
3182
|
+
label: downloadLabel,
|
|
3183
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
3184
|
+
href: dataURL,
|
|
3185
|
+
download: file.name
|
|
3186
|
+
})
|
|
3187
|
+
})] }), /* @__PURE__ */ jsx(DialogBody, {
|
|
3188
|
+
className: prefix("file-control__viewer-dialog-body"),
|
|
3189
|
+
children: /* @__PURE__ */ jsx("object", {
|
|
3190
|
+
className: prefix("file-control__viewer-object"),
|
|
3191
|
+
type: file.type || void 0,
|
|
3192
|
+
data: dataURL,
|
|
3193
|
+
"aria-label": file.name,
|
|
3194
|
+
children: /* @__PURE__ */ jsx(Alert, {
|
|
3195
|
+
className: prefix("file-control__viewer-fallback"),
|
|
3196
|
+
severity: "warning",
|
|
3197
|
+
children: fallbackText
|
|
3198
|
+
})
|
|
3199
|
+
})
|
|
3200
|
+
})]
|
|
3201
|
+
})] });
|
|
3202
|
+
}
|
|
3203
|
+
//#endregion
|
|
3140
3204
|
//#region src/components/FileControl/FileControl.tsx
|
|
3141
3205
|
/**
|
|
3142
3206
|
* The file control component is a KForm form control for values with (typically
|
|
@@ -3164,13 +3228,11 @@ function DateRangeControl({ startPath, endPath, startIssueMessages, endIssueMess
|
|
|
3164
3228
|
* ```
|
|
3165
3229
|
*/
|
|
3166
3230
|
function FileControl({ path, issueMessages, issuesPanelLabel, displayIssues = true, preventAutoFocus, apiRef, issueMessagesProps, fileInteraction = "view", viewFileButtonLabel, downloadFileButtonLabel, fallbackText, formManager, onInitialized, onFormManagerEvent, onValueChange, onValidationStatusChange, onDisplayStatusChange, onDirtyStatusChange, onTouchedStatusChange, required, accept, loading, showSpinner, disabled, readOnly, showClearButton, clearDescription, endAdornment, onChange, onKeyDown, onFocus, onBlurToOutside, debug, clearButtonProps, ref, ...otherProps }) {
|
|
3167
|
-
const prefix = usePrefix();
|
|
3168
3231
|
const [locale] = useLocale();
|
|
3169
3232
|
clearDescription ??= locale.FileControl.clearDescription;
|
|
3170
3233
|
viewFileButtonLabel ??= locale.FileControl.viewFileButtonLabel;
|
|
3171
3234
|
downloadFileButtonLabel ??= locale.FileControl.downloadFileButtonLabel;
|
|
3172
3235
|
fallbackText ??= locale.FileControl.fallbackText;
|
|
3173
|
-
const { printHidden } = usePrintClassNames();
|
|
3174
3236
|
const latestFile = useRef(null);
|
|
3175
3237
|
const [file, setFile] = useState(null);
|
|
3176
3238
|
const controller = useFileInput(path, {
|
|
@@ -3200,7 +3262,7 @@ function FileControl({ path, issueMessages, issuesPanelLabel, displayIssues = tr
|
|
|
3200
3262
|
preventAutoFocus,
|
|
3201
3263
|
apiRef
|
|
3202
3264
|
});
|
|
3203
|
-
showClearButton ??= nullable ?
|
|
3265
|
+
showClearButton ??= nullable ? file !== null : false;
|
|
3204
3266
|
const isClearing = useRef(false);
|
|
3205
3267
|
const handleClearButtonClick = useCallback(() => {
|
|
3206
3268
|
isClearing.current = true;
|
|
@@ -3216,7 +3278,6 @@ function FileControl({ path, issueMessages, issuesPanelLabel, displayIssues = tr
|
|
|
3216
3278
|
const handleKeyDown = useCallback((evt) => {
|
|
3217
3279
|
if (evt.code === "Delete" || evt.code === "Backspace") clearButtonRef.current?.click();
|
|
3218
3280
|
}, []);
|
|
3219
|
-
const dataURL = useMemo(() => fileInteraction !== "none" && file ? URL.createObjectURL(file) : null, [file, fileInteraction]);
|
|
3220
3281
|
const { inlineIssues, popoverIssues } = useControlIssues({
|
|
3221
3282
|
issuesToDisplay: { [absolutePath.toString()]: issuesToDisplay },
|
|
3222
3283
|
issueMessages: { [absolutePath.toString()]: issueMessages },
|
|
@@ -3248,54 +3309,15 @@ function FileControl({ path, issueMessages, issuesPanelLabel, displayIssues = tr
|
|
|
3248
3309
|
endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3249
3310
|
popoverIssues,
|
|
3250
3311
|
endAdornment,
|
|
3251
|
-
fileInteraction === "view" && file && /* @__PURE__ */
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
className: prefix("file-control__viewer-dialog"),
|
|
3261
|
-
"aria-describedby": void 0,
|
|
3262
|
-
children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, {
|
|
3263
|
-
className: prefix("file-control__viewer-dialog-title"),
|
|
3264
|
-
children: file.name
|
|
3265
|
-
}), /* @__PURE__ */ jsx(IconButton, {
|
|
3266
|
-
variant: "ghost",
|
|
3267
|
-
className: prefix("file-control__viewer-download"),
|
|
3268
|
-
asChild: true,
|
|
3269
|
-
icon: faDownload,
|
|
3270
|
-
label: downloadFileButtonLabel,
|
|
3271
|
-
children: /* @__PURE__ */ jsx("a", {
|
|
3272
|
-
href: dataURL,
|
|
3273
|
-
download: file.name
|
|
3274
|
-
})
|
|
3275
|
-
})] }), /* @__PURE__ */ jsx(DialogBody, {
|
|
3276
|
-
className: prefix("file-control__viewer-dialog-body"),
|
|
3277
|
-
children: /* @__PURE__ */ jsx("object", {
|
|
3278
|
-
className: prefix("file-control__viewer-object"),
|
|
3279
|
-
type: file.type || void 0,
|
|
3280
|
-
data: dataURL,
|
|
3281
|
-
"aria-label": file.name,
|
|
3282
|
-
children: /* @__PURE__ */ jsx(Alert, {
|
|
3283
|
-
className: prefix("file-control__viewer-fallback"),
|
|
3284
|
-
severity: "warning",
|
|
3285
|
-
children: fallbackText
|
|
3286
|
-
})
|
|
3287
|
-
})
|
|
3288
|
-
})]
|
|
3289
|
-
})] }),
|
|
3290
|
-
fileInteraction === "download" && file && /* @__PURE__ */ jsx(Tooltip, {
|
|
3291
|
-
content: downloadFileButtonLabel,
|
|
3292
|
-
children: /* @__PURE__ */ jsx(ControlAddon, {
|
|
3293
|
-
as: "a",
|
|
3294
|
-
className: printHidden,
|
|
3295
|
-
href: dataURL,
|
|
3296
|
-
download: file.name,
|
|
3297
|
-
children: /* @__PURE__ */ jsx(Icon, { icon: faDownload })
|
|
3298
|
-
})
|
|
3312
|
+
fileInteraction === "view" && file && /* @__PURE__ */ jsx(FileControlViewAddon, {
|
|
3313
|
+
file,
|
|
3314
|
+
viewLabel: viewFileButtonLabel,
|
|
3315
|
+
downloadLabel: downloadFileButtonLabel,
|
|
3316
|
+
fallbackText
|
|
3317
|
+
}),
|
|
3318
|
+
fileInteraction === "download" && file && /* @__PURE__ */ jsx(FileControlDownloadAddon, {
|
|
3319
|
+
file,
|
|
3320
|
+
label: downloadFileButtonLabel
|
|
3299
3321
|
}),
|
|
3300
3322
|
(DEV || false) && showDebugInfo && /* @__PURE__ */ jsx(DebugInfo, {
|
|
3301
3323
|
path: absolutePath,
|
|
@@ -3568,7 +3590,7 @@ function FormPageRegistrar({ path, title, documentTitle, code, issuesPanelLabel
|
|
|
3568
3590
|
const store = useFormPagesContext();
|
|
3569
3591
|
const printing = usePrinting();
|
|
3570
3592
|
const finishPrintingTask = useStartPrintingTask();
|
|
3571
|
-
const controller = useController(path.append(AbsolutePathFragment.RecursiveWildcard), {
|
|
3593
|
+
const controller = useController(typeof title === "function" || typeof documentTitle === "function" ? path.append(AbsolutePathFragment.RecursiveWildcard) : path, {
|
|
3572
3594
|
enabled: !useFormIsLoading(),
|
|
3573
3595
|
onInitialized: finishPrintingTask
|
|
3574
3596
|
});
|
|
@@ -4075,7 +4097,11 @@ function FormStepList({ className, ...otherProps }) {
|
|
|
4075
4097
|
function FormStepRegistrar({ index, path, title, documentTitle, issuesPanelLabel }) {
|
|
4076
4098
|
const store = useFormStepperContext();
|
|
4077
4099
|
const printing = usePrinting();
|
|
4078
|
-
const
|
|
4100
|
+
const finishPrintingTask = useStartPrintingTask();
|
|
4101
|
+
const controller = useController(typeof title === "function" || typeof documentTitle === "function" ? path.append(AbsolutePathFragment.RecursiveWildcard) : path, {
|
|
4102
|
+
enabled: !useFormIsLoading(),
|
|
4103
|
+
onInitialized: finishPrintingTask
|
|
4104
|
+
});
|
|
4079
4105
|
const absolutePath = controller.usePath();
|
|
4080
4106
|
const exists = controller.useState((state) => state.initialized && state.exists);
|
|
4081
4107
|
const value = controller.useValue();
|
|
@@ -4608,14 +4634,15 @@ function IssuesPanel({ defaultOpen = false, open: controlledOpen, onOpenChange,
|
|
|
4608
4634
|
const [currentPagePath, setCurrentPagePath] = useIssuesPanelPath();
|
|
4609
4635
|
const currentPageController = useController(currentPagePath ?? AbsolutePath.ROOT, { enabled: open && !formIsLoading && currentPagePath !== null });
|
|
4610
4636
|
const prevIssuesTrackerResultInfoLength = usePrevious(issuesTrackerResult.info?.length);
|
|
4637
|
+
const handleNewIssues = useEffectEvent(() => {
|
|
4638
|
+
setCurrentPagePath(latestInteraction);
|
|
4639
|
+
});
|
|
4611
4640
|
useEffect(() => {
|
|
4612
|
-
if (prevIssuesTrackerResultInfoLength === 0 && issuesTrackerResult.initialized && issuesTrackerResult.info.length > 0)
|
|
4641
|
+
if (prevIssuesTrackerResultInfoLength === 0 && issuesTrackerResult.initialized && issuesTrackerResult.info.length > 0) handleNewIssues();
|
|
4613
4642
|
}, [
|
|
4614
4643
|
issuesTrackerResult.info?.length,
|
|
4615
4644
|
issuesTrackerResult.initialized,
|
|
4616
|
-
|
|
4617
|
-
prevIssuesTrackerResultInfoLength,
|
|
4618
|
-
setCurrentPagePath
|
|
4645
|
+
prevIssuesTrackerResultInfoLength
|
|
4619
4646
|
]);
|
|
4620
4647
|
const currentPageIndex = useMemo(() => currentPagePath ? info?.findIndex(({ path }) => currentPagePath.equals(path)) ?? -1 : -1, [currentPagePath, info]);
|
|
4621
4648
|
const lastExistingPageIndex = useRef(null);
|
|
@@ -4655,7 +4682,7 @@ function IssuesPanel({ defaultOpen = false, open: controlledOpen, onOpenChange,
|
|
|
4655
4682
|
onOpenChange
|
|
4656
4683
|
});
|
|
4657
4684
|
const [starting, setStarting] = useState(false);
|
|
4658
|
-
|
|
4685
|
+
useEffect(() => {
|
|
4659
4686
|
if (issuesTrackerResult.initialized && starting) {
|
|
4660
4687
|
if (issuesTrackerResult.info.length > 0) goToPath(mostRelevantIssuePath(issuesTrackerResult.info, latestInteraction, formSchema, latestRef.current.issuesOrderCompareFn));
|
|
4661
4688
|
setStarting(false);
|
|
@@ -5870,12 +5897,10 @@ function SubmitAction({ onSubmit, onInvalidSubmit, onSuccessfulSubmit, onFailedS
|
|
|
5870
5897
|
}
|
|
5871
5898
|
};
|
|
5872
5899
|
const preventCloseAutoFocus = useRef(false);
|
|
5873
|
-
const handleInvalidSubmit = (issues, event) => {
|
|
5900
|
+
const handleInvalidSubmit = async (issues, event) => {
|
|
5874
5901
|
preventCloseAutoFocus.current = true;
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
onInvalidSubmit?.(issues, event);
|
|
5878
|
-
});
|
|
5902
|
+
await startIssuesNavigation({ validate: false });
|
|
5903
|
+
onInvalidSubmit?.(issues, event);
|
|
5879
5904
|
};
|
|
5880
5905
|
const handleCloseAutoFocus = (event) => {
|
|
5881
5906
|
if (preventCloseAutoFocus.current) event.preventDefault();
|
|
@@ -6241,14 +6266,9 @@ function TableControl({ path, issueMessages, issuesPanelLabel, displayIssues = t
|
|
|
6241
6266
|
dataTableApiRef.current?.goTo(index, scrollOptions);
|
|
6242
6267
|
}, [dataTableApiRef]);
|
|
6243
6268
|
const goToId = useCallback((id, scrollOptions) => {
|
|
6244
|
-
const
|
|
6245
|
-
if (
|
|
6246
|
-
|
|
6247
|
-
const idx = indexOfTableId(value, id);
|
|
6248
|
-
if (idx !== -1) dataTableApiRef.current?.goTo(idx, scrollOptions);
|
|
6249
|
-
}
|
|
6250
|
-
});
|
|
6251
|
-
}, [controller, dataTableApiRef]);
|
|
6269
|
+
const idx = ids?.indexOf(id) ?? -1;
|
|
6270
|
+
if (idx !== -1) dataTableApiRef.current?.goTo(idx, scrollOptions);
|
|
6271
|
+
}, [dataTableApiRef, ids]);
|
|
6252
6272
|
const { displayDisabled, displayReadOnly, issuesToDisplay, autofocusRef, handleFocus } = useRegisterControl({
|
|
6253
6273
|
controller,
|
|
6254
6274
|
issuesPanelLabel,
|
|
@@ -6267,17 +6287,18 @@ function TableControl({ path, issueMessages, issuesPanelLabel, displayIssues = t
|
|
|
6267
6287
|
goToIndex
|
|
6268
6288
|
]);
|
|
6269
6289
|
useOnPathFocus(useCallback((focusedPath) => {
|
|
6270
|
-
if (exists && focusedPath && absolutePath.resolve(AbsolutePath.DESCENDANTS).contains(focusedPath)) {
|
|
6290
|
+
if (exists && ids && focusedPath && absolutePath.resolve(AbsolutePath.DESCENDANTS).contains(focusedPath)) {
|
|
6271
6291
|
const rowId = focusedPath.fragments[absolutePath.size];
|
|
6272
|
-
if (rowId instanceof AbsolutePathFragment.Id) goToId(+rowId.id, {
|
|
6292
|
+
if (rowId instanceof AbsolutePathFragment.Id) queueMicrotask(() => goToId(+rowId.id, {
|
|
6273
6293
|
align: "center",
|
|
6274
6294
|
behavior: "smooth"
|
|
6275
|
-
});
|
|
6295
|
+
}));
|
|
6276
6296
|
}
|
|
6277
6297
|
}, [
|
|
6278
6298
|
absolutePath,
|
|
6279
6299
|
exists,
|
|
6280
|
-
goToId
|
|
6300
|
+
goToId,
|
|
6301
|
+
ids
|
|
6281
6302
|
]));
|
|
6282
6303
|
let columns = columnsProp;
|
|
6283
6304
|
if (!columns) {
|
|
@@ -6589,7 +6610,7 @@ function TableControlContent({ scrollableProps, ...otherProps }) {
|
|
|
6589
6610
|
const deferredDisplayStatus = useDeferredValue(controller.useDisplayStatus());
|
|
6590
6611
|
const handleContainerOnBlur = useCallback(() => {
|
|
6591
6612
|
const { initialized, exists, touched } = controller.getState();
|
|
6592
|
-
if (initialized && exists && touched) controller.setTouched();
|
|
6613
|
+
if (initialized && exists && !touched) controller.setTouched();
|
|
6593
6614
|
}, [controller]);
|
|
6594
6615
|
return /* @__PURE__ */ jsxs(Fragment, { children: [(DEV || false) && debug && /* @__PURE__ */ jsx(DebugInfo, {
|
|
6595
6616
|
path: absolutePath,
|