@ostack.tech/ui-kform 0.5.0 → 0.6.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/locales/en-GB.js +4 -4
- package/dist/locales/en-GB.js.map +1 -1
- package/dist/locales/en-US.js +4 -4
- package/dist/locales/en-US.js.map +1 -1
- package/dist/locales/{fr.js → fr-FR.js} +5 -5
- package/dist/locales/fr-FR.js.map +1 -0
- package/dist/locales/{pt.js → pt-PT.js} +5 -5
- package/dist/locales/pt-PT.js.map +1 -0
- package/dist/ostack-ui-kform.css +0 -12
- package/dist/ostack-ui-kform.css.map +1 -1
- package/dist/ostack-ui-kform.js +155 -122
- package/dist/ostack-ui-kform.js.map +1 -1
- package/dist/types/components/PrintAction/PrintAction.d.ts +6 -5
- package/dist/types/locales/en-GB.d.ts +1 -1
- package/dist/types/locales/en-US.d.ts +1 -1
- package/dist/types/locales/{fr.d.ts → fr-FR.d.ts} +2 -2
- package/dist/types/locales/index.d.ts +4 -4
- package/dist/types/locales/{pt.d.ts → pt-PT.d.ts} +2 -2
- package/package.json +2 -2
- package/scss/index.scss +0 -1
- package/dist/locales/fr.js.map +0 -1
- package/dist/locales/pt.js.map +0 -1
- package/scss/components/TableControl/_TableControl.scss +0 -21
package/dist/ostack-ui-kform.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
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, Input, Dialog, Tooltip, DialogTrigger, ControlAddon, Icon, DialogContent, DialogHeader, DialogTitle, DialogBody, Alert, Stack, Popover, PopoverTrigger, PopoverContent, useMeasure, Container, Select, MenuListItem, MenuList,
|
|
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
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";
|
|
5
5
|
import { createContext, useContext, useCallback, useMemo, useRef, useEffect, forwardRef, useState, useImperativeHandle, startTransition, Suspense, useDeferredValue, Children, isValidElement, createElement, memo } from "react";
|
|
@@ -9,10 +9,10 @@ import { useShallow } from "zustand/react/shallow";
|
|
|
9
9
|
import { shallow } from "zustand/shallow";
|
|
10
10
|
import { supported, fileOpen, fileSave } from "browser-fs-access";
|
|
11
11
|
import { addDays, min, max, parseISO, format } from "date-fns";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
import { locale } from "./locales/en-GB.js";
|
|
13
|
+
import { locale as locale2 } from "./locales/en-US.js";
|
|
14
|
+
import { locale as locale3, locale as locale4 } from "./locales/fr-FR.js";
|
|
15
|
+
import { locale as locale5, locale as locale6 } from "./locales/pt-PT.js";
|
|
16
16
|
import { faChevronUp, faChevronDown, faTrash, faFileLines, faDownload, faCircleQuestion, faArrowsToDot, faAnglesLeft, faAngleLeft, faAngleRight, faAnglesRight, faCircleCheck, faCircleExclamation, faTriangleExclamation, faFolderOpen, faPrint, faFloppyDisk, faCaretDown, faArrowRight, faPlus } from "@fortawesome/free-solid-svg-icons";
|
|
17
17
|
import { faCircleCheck as faCircleCheck$1 } from "@fortawesome/free-regular-svg-icons";
|
|
18
18
|
const DEFAULT_PREFIX_SUFFIX = "kform-";
|
|
@@ -100,18 +100,18 @@ function LocalizationProvider({
|
|
|
100
100
|
onLocaleChange,
|
|
101
101
|
children
|
|
102
102
|
}) {
|
|
103
|
-
const [
|
|
103
|
+
const [locale7, setLocale] = useControllableState(
|
|
104
104
|
defaultLocale,
|
|
105
105
|
controlledLocale
|
|
106
106
|
);
|
|
107
|
-
return
|
|
107
|
+
return locale7 === void 0 ? children : /* @__PURE__ */ jsx(
|
|
108
108
|
LocalizationContext.Provider,
|
|
109
109
|
{
|
|
110
110
|
value: {
|
|
111
|
-
locale,
|
|
111
|
+
locale: locale7,
|
|
112
112
|
setLocale: combineEventHandlers(setLocale, onLocaleChange)
|
|
113
113
|
},
|
|
114
|
-
children: /* @__PURE__ */ jsx(LocalizationProvider$1, { locale:
|
|
114
|
+
children: /* @__PURE__ */ jsx(LocalizationProvider$1, { locale: locale7.baseLocale, children })
|
|
115
115
|
}
|
|
116
116
|
);
|
|
117
117
|
}
|
|
@@ -842,15 +842,15 @@ const FormApp = forwardRef(function FormApp2({
|
|
|
842
842
|
);
|
|
843
843
|
}
|
|
844
844
|
const contextLocale = useContext(LocalizationContext)?.locale;
|
|
845
|
-
const
|
|
846
|
-
if (
|
|
845
|
+
const locale7 = controlledLocale ?? defaultLocale ?? contextLocale;
|
|
846
|
+
if (locale7 == null) {
|
|
847
847
|
throw new Error(
|
|
848
848
|
"FormApp: No locale has been provided. Either provide a `defaultLocale`/`locale` property or wrap the component in a `LocalizationProvider`."
|
|
849
849
|
);
|
|
850
850
|
}
|
|
851
|
-
formTitle ??=
|
|
852
|
-
issuesPanelLabel ??=
|
|
853
|
-
confirmUnloadMessage ??=
|
|
851
|
+
formTitle ??= locale7.FormApp.formTitle;
|
|
852
|
+
issuesPanelLabel ??= locale7.FormApp.issuesPanelLabel ?? formTitle;
|
|
853
|
+
confirmUnloadMessage ??= locale7.FormApp.confirmUnloadMessage;
|
|
854
854
|
const controller = useForm(schema, {
|
|
855
855
|
initialValue,
|
|
856
856
|
externalContexts,
|
|
@@ -949,7 +949,7 @@ const FormApp = forwardRef(function FormApp2({
|
|
|
949
949
|
children: /* @__PURE__ */ jsx(
|
|
950
950
|
FormAppIssueMessages,
|
|
951
951
|
{
|
|
952
|
-
issueMessages:
|
|
952
|
+
issueMessages: locale7.FormApp.issueMessages,
|
|
953
953
|
priority: -1,
|
|
954
954
|
children: /* @__PURE__ */ jsxs(FormAppIssueMessages, { issueMessages, children: [
|
|
955
955
|
/* @__PURE__ */ jsx(FormAppAutoFocus, {}),
|
|
@@ -1403,7 +1403,7 @@ function useFormLoader({
|
|
|
1403
1403
|
successMessage,
|
|
1404
1404
|
errorMessage
|
|
1405
1405
|
} = {}) {
|
|
1406
|
-
const [
|
|
1406
|
+
const [locale7] = useLocale();
|
|
1407
1407
|
const formManager = useFormManager();
|
|
1408
1408
|
const { _setState } = useFormController();
|
|
1409
1409
|
const { addToast } = useToastManager();
|
|
@@ -1426,10 +1426,10 @@ function useFormLoader({
|
|
|
1426
1426
|
throw new Error("No `decode` function was provided.");
|
|
1427
1427
|
}
|
|
1428
1428
|
if (successMessage2 === void 0) {
|
|
1429
|
-
successMessage2 =
|
|
1429
|
+
successMessage2 = locale7.LoadAction.successMessage;
|
|
1430
1430
|
}
|
|
1431
1431
|
if (errorMessage2 === void 0) {
|
|
1432
|
-
errorMessage2 =
|
|
1432
|
+
errorMessage2 = locale7.LoadAction.errorMessage;
|
|
1433
1433
|
}
|
|
1434
1434
|
const validationModeIsAuto = formManager.autoValidationStatus !== "inactive";
|
|
1435
1435
|
let file = null;
|
|
@@ -1504,7 +1504,7 @@ function useFormLoader({
|
|
|
1504
1504
|
_setState,
|
|
1505
1505
|
formManager,
|
|
1506
1506
|
startIssuesNavigation,
|
|
1507
|
-
|
|
1507
|
+
locale7.LoadAction,
|
|
1508
1508
|
addToast,
|
|
1509
1509
|
decode,
|
|
1510
1510
|
path,
|
|
@@ -1901,9 +1901,9 @@ function IssueMessage({
|
|
|
1901
1901
|
unknownWarningMessage,
|
|
1902
1902
|
issueCodeProps
|
|
1903
1903
|
}) {
|
|
1904
|
-
const [
|
|
1905
|
-
unknownErrorMessage ??=
|
|
1906
|
-
unknownWarningMessage ??=
|
|
1904
|
+
const [locale7] = useLocale();
|
|
1905
|
+
unknownErrorMessage ??= locale7.IssueMessages.unknownErrorMessage;
|
|
1906
|
+
unknownWarningMessage ??= locale7.IssueMessages.unknownWarningMessage;
|
|
1907
1907
|
let message = useRegisteredIssueMessage(path, issue.code);
|
|
1908
1908
|
const unknownIssue = message == null;
|
|
1909
1909
|
if (unknownIssue) {
|
|
@@ -2000,8 +2000,8 @@ const IssuesPopover = forwardRef(function IssuesPopover2({
|
|
|
2000
2000
|
label,
|
|
2001
2001
|
...otherProps
|
|
2002
2002
|
}, forwardedRef) {
|
|
2003
|
-
const [
|
|
2004
|
-
label ??=
|
|
2003
|
+
const [locale7] = useLocale();
|
|
2004
|
+
label ??= locale7.IssuesPopover.label;
|
|
2005
2005
|
const absolutePath = useResolvedPath(path);
|
|
2006
2006
|
const [open, setOpen] = useControllableState(defaultOpen, controlledOpen);
|
|
2007
2007
|
const isInControlField = useIsInControlField();
|
|
@@ -2465,16 +2465,16 @@ const AnnexesManager = forwardRef(function AnnexManager2({
|
|
|
2465
2465
|
...otherProps
|
|
2466
2466
|
}, forwardedRef) {
|
|
2467
2467
|
const prefix = usePrefix();
|
|
2468
|
-
const [
|
|
2469
|
-
ariaLabel ??=
|
|
2470
|
-
menuButtonText ??=
|
|
2471
|
-
addAnnexText ??=
|
|
2472
|
-
removeAnnexButtonLabel ??=
|
|
2473
|
-
removeAnnexKeyboardHint ??=
|
|
2474
|
-
removeAnnexConfirmDialogTitle ??=
|
|
2475
|
-
removeAnnexConfirmDialogMessage ??=
|
|
2476
|
-
removeAnnexConfirmDialogOkText ??=
|
|
2477
|
-
removeAnnexConfirmDialogCancelText ??=
|
|
2468
|
+
const [locale7] = useLocale();
|
|
2469
|
+
ariaLabel ??= locale7.AnnexesManager["aria-label"];
|
|
2470
|
+
menuButtonText ??= locale7.AnnexesManager.menuButtonText;
|
|
2471
|
+
addAnnexText ??= locale7.AnnexesManager.addAnnexText;
|
|
2472
|
+
removeAnnexButtonLabel ??= locale7.AnnexesManager.removeAnnexButtonLabel;
|
|
2473
|
+
removeAnnexKeyboardHint ??= locale7.AnnexesManager.removeAnnexKeyboardHint;
|
|
2474
|
+
removeAnnexConfirmDialogTitle ??= locale7.AnnexesManager.removeAnnexConfirmDialogTitle;
|
|
2475
|
+
removeAnnexConfirmDialogMessage ??= locale7.AnnexesManager.removeAnnexConfirmDialogMessage;
|
|
2476
|
+
removeAnnexConfirmDialogOkText ??= locale7.AnnexesManager.removeAnnexConfirmDialogOkText;
|
|
2477
|
+
removeAnnexConfirmDialogCancelText ??= locale7.AnnexesManager.removeAnnexConfirmDialogCancelText;
|
|
2478
2478
|
const store = useAnnexesContext();
|
|
2479
2479
|
const issuesDisplayMode = useIssuesDisplayMode();
|
|
2480
2480
|
const tablessStates = useStore(
|
|
@@ -3194,9 +3194,9 @@ const DateRangeControl = forwardRef(function DateRangeControl2({
|
|
|
3194
3194
|
endAdornment,
|
|
3195
3195
|
...otherProps
|
|
3196
3196
|
}, forwardedRef) {
|
|
3197
|
-
const [
|
|
3198
|
-
issuesPanelStartLabelSuffix ??=
|
|
3199
|
-
issuesPanelEndLabelSuffix ??=
|
|
3197
|
+
const [locale7] = useLocale();
|
|
3198
|
+
issuesPanelStartLabelSuffix ??= locale7.DateRangeControl.issuesPanelStartLabelSuffix;
|
|
3199
|
+
issuesPanelEndLabelSuffix ??= locale7.DateRangeControl.issuesPanelEndLabelSuffix;
|
|
3200
3200
|
const { format: format2, parse } = useTemporalStringTransformer({
|
|
3201
3201
|
locale: dateFnsLocale,
|
|
3202
3202
|
shortFormat,
|
|
@@ -3414,10 +3414,11 @@ const FileControl = forwardRef(function FileControl2({
|
|
|
3414
3414
|
...otherProps
|
|
3415
3415
|
}, forwardedRef) {
|
|
3416
3416
|
const prefix = usePrefix();
|
|
3417
|
-
const [
|
|
3418
|
-
viewFileButtonLabel ??=
|
|
3419
|
-
downloadFileButtonLabel ??=
|
|
3420
|
-
fallbackText ??=
|
|
3417
|
+
const [locale7] = useLocale();
|
|
3418
|
+
viewFileButtonLabel ??= locale7.FileControl.viewFileButtonLabel;
|
|
3419
|
+
downloadFileButtonLabel ??= locale7.FileControl.downloadFileButtonLabel;
|
|
3420
|
+
fallbackText ??= locale7.FileControl.fallbackText;
|
|
3421
|
+
const { printHidden } = usePrintClassNames();
|
|
3421
3422
|
const latestFileList = useRef(null);
|
|
3422
3423
|
const [file, setFile] = useState(null);
|
|
3423
3424
|
const controller = useFileInput(
|
|
@@ -3531,7 +3532,7 @@ const FileControl = forwardRef(function FileControl2({
|
|
|
3531
3532
|
popoverIssues,
|
|
3532
3533
|
endAdornment,
|
|
3533
3534
|
fileInteraction === "view" && file && /* @__PURE__ */ jsxs(Dialog, { children: [
|
|
3534
|
-
/* @__PURE__ */ jsx(Tooltip, { content: viewFileButtonLabel, children: /* @__PURE__ */ jsx(DialogTrigger, { children: /* @__PURE__ */ jsx(ControlAddon, { asChild: true, children: /* @__PURE__ */ jsx("button", { type: "button", children: /* @__PURE__ */ jsx(Icon, { fixedWidth: true, icon: faFileLines }) }) }) }) }),
|
|
3535
|
+
/* @__PURE__ */ jsx(Tooltip, { content: viewFileButtonLabel, children: /* @__PURE__ */ jsx(DialogTrigger, { children: /* @__PURE__ */ jsx(ControlAddon, { asChild: true, children: /* @__PURE__ */ jsx("button", { type: "button", className: printHidden, children: /* @__PURE__ */ jsx(Icon, { fixedWidth: true, icon: faFileLines }) }) }) }) }),
|
|
3535
3536
|
/* @__PURE__ */ jsxs(
|
|
3536
3537
|
DialogContent,
|
|
3537
3538
|
{
|
|
@@ -3586,7 +3587,15 @@ const FileControl = forwardRef(function FileControl2({
|
|
|
3586
3587
|
}
|
|
3587
3588
|
)
|
|
3588
3589
|
] }),
|
|
3589
|
-
fileInteraction === "download" && file && /* @__PURE__ */ jsx(Tooltip, { content: downloadFileButtonLabel, children: /* @__PURE__ */ jsx(ControlAddon, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
3590
|
+
fileInteraction === "download" && file && /* @__PURE__ */ jsx(Tooltip, { content: downloadFileButtonLabel, children: /* @__PURE__ */ jsx(ControlAddon, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
3591
|
+
"a",
|
|
3592
|
+
{
|
|
3593
|
+
className: printHidden,
|
|
3594
|
+
href: dataURL,
|
|
3595
|
+
download: file.name,
|
|
3596
|
+
children: /* @__PURE__ */ jsx(Icon, { icon: faDownload })
|
|
3597
|
+
}
|
|
3598
|
+
) }) })
|
|
3590
3599
|
] }),
|
|
3591
3600
|
...otherProps,
|
|
3592
3601
|
ref: combinedInputRef
|
|
@@ -3898,8 +3907,8 @@ const FormPage = forwardRef(
|
|
|
3898
3907
|
...otherProps
|
|
3899
3908
|
}, forwardedRef) {
|
|
3900
3909
|
const prefix = usePrefix();
|
|
3901
|
-
const [
|
|
3902
|
-
helperButtonLabel ??=
|
|
3910
|
+
const [locale7] = useLocale();
|
|
3911
|
+
helperButtonLabel ??= locale7.FormPage.helperButtonLabel;
|
|
3903
3912
|
const printing = usePrinting();
|
|
3904
3913
|
const store = useFormPagesContext();
|
|
3905
3914
|
const pagePath = useResolvedPath(path);
|
|
@@ -4000,6 +4009,7 @@ function FormPageRegistrar({
|
|
|
4000
4009
|
issuesPanelLabel
|
|
4001
4010
|
}) {
|
|
4002
4011
|
const store = useFormPagesContext();
|
|
4012
|
+
const printing = usePrinting();
|
|
4003
4013
|
const finishPrintingTask = useStartPrintingTask();
|
|
4004
4014
|
const controller = useController(
|
|
4005
4015
|
path.append(AbsolutePathFragment.RecursiveWildcard),
|
|
@@ -4009,15 +4019,17 @@ function FormPageRegistrar({
|
|
|
4009
4019
|
const exists = controller.useState(
|
|
4010
4020
|
(state) => state.initialized && state.exists
|
|
4011
4021
|
);
|
|
4012
|
-
const
|
|
4022
|
+
const value = controller.useValue();
|
|
4023
|
+
const deferredValue = useDeferredValue(value);
|
|
4024
|
+
const relevantValue = printing ? value : deferredValue;
|
|
4013
4025
|
const deferredIssuesToDisplay = useDeferredValue(
|
|
4014
4026
|
controller.useState((state) => state.touched ? state.issues : [], {
|
|
4015
4027
|
equalityFn: shallow
|
|
4016
4028
|
})
|
|
4017
4029
|
);
|
|
4018
4030
|
const deferredDisplayStatus = useDeferredValue(controller.useDisplayStatus());
|
|
4019
|
-
const actualTitle = typeof title === "function" ?
|
|
4020
|
-
const actualDocumentTitle = typeof documentTitle === "function" ?
|
|
4031
|
+
const actualTitle = typeof title === "function" ? relevantValue === void 0 ? null : title(relevantValue) : title;
|
|
4032
|
+
const actualDocumentTitle = typeof documentTitle === "function" ? relevantValue === void 0 ? null : documentTitle(relevantValue) : documentTitle === void 0 ? actualTitle === null || typeof actualTitle === "string" ? actualTitle : void 0 : documentTitle;
|
|
4021
4033
|
useEffect(() => {
|
|
4022
4034
|
const { registerPageState } = store.getState().actions;
|
|
4023
4035
|
registerPageState(absolutePath, {
|
|
@@ -4355,8 +4367,8 @@ const FormPagesNavigation = forwardRef(function FormPagesNavigation2({
|
|
|
4355
4367
|
...otherProps
|
|
4356
4368
|
}, forwardedRef) {
|
|
4357
4369
|
const prefix = usePrefix();
|
|
4358
|
-
const [
|
|
4359
|
-
ariaLabel ??=
|
|
4370
|
+
const [locale7] = useLocale();
|
|
4371
|
+
ariaLabel ??= locale7.FormPagesNavigation["aria-label"];
|
|
4360
4372
|
const { printHidden } = usePrintClassNames();
|
|
4361
4373
|
const isLargeScreen = useMediaBreakpointUp("sm");
|
|
4362
4374
|
return /* @__PURE__ */ jsx(
|
|
@@ -4638,15 +4650,18 @@ function FormStepRegistrar({
|
|
|
4638
4650
|
issuesPanelLabel
|
|
4639
4651
|
}) {
|
|
4640
4652
|
const store = useFormStepperContext();
|
|
4653
|
+
const printing = usePrinting();
|
|
4641
4654
|
const controller = useController(path, { enabled: !useFormIsLoading() });
|
|
4642
4655
|
const absolutePath = controller.usePath();
|
|
4643
4656
|
const exists = controller.useState(
|
|
4644
4657
|
(state) => state.initialized && state.exists
|
|
4645
4658
|
);
|
|
4646
|
-
const
|
|
4659
|
+
const value = controller.useValue();
|
|
4660
|
+
const deferredValue = useDeferredValue(value);
|
|
4661
|
+
const relevantValue = printing ? value : deferredValue;
|
|
4647
4662
|
const deferredDisplayStatus = useDeferredValue(controller.useDisplayStatus());
|
|
4648
|
-
const actualTitle = typeof title === "function" ?
|
|
4649
|
-
const actualDocumentTitle = typeof documentTitle === "function" ?
|
|
4663
|
+
const actualTitle = typeof title === "function" ? relevantValue === void 0 ? null : title(relevantValue) : title;
|
|
4664
|
+
const actualDocumentTitle = typeof documentTitle === "function" ? relevantValue === void 0 ? null : documentTitle(relevantValue) : documentTitle === void 0 ? actualTitle === null || typeof actualTitle === "string" ? actualTitle : void 0 : documentTitle;
|
|
4650
4665
|
useEffect(() => {
|
|
4651
4666
|
const { registerStepState } = store.getState().actions;
|
|
4652
4667
|
registerStepState(absolutePath, {
|
|
@@ -5264,18 +5279,18 @@ const IssuesPanel = forwardRef(function ValidationPanel({
|
|
|
5264
5279
|
}, forwardedRef) {
|
|
5265
5280
|
const prefix = usePrefix();
|
|
5266
5281
|
const printing = usePrinting();
|
|
5267
|
-
const [
|
|
5268
|
-
errorsLabel ??=
|
|
5269
|
-
warningsLabel ??=
|
|
5270
|
-
focusButtonLabel ??=
|
|
5271
|
-
previousIssueButtonLabel ??=
|
|
5272
|
-
nextIssueButtonLabel ??=
|
|
5273
|
-
firstIssueButtonLabel ??=
|
|
5274
|
-
lastIssueButtonLabel ??=
|
|
5275
|
-
paginationLabel ??=
|
|
5276
|
-
noIssuesMessage ??=
|
|
5277
|
-
resolvedTitle ??=
|
|
5278
|
-
resolvedMessage ??=
|
|
5282
|
+
const [locale7] = useLocale();
|
|
5283
|
+
errorsLabel ??= locale7.IssuesPanel.errorsLabel;
|
|
5284
|
+
warningsLabel ??= locale7.IssuesPanel.warningsLabel;
|
|
5285
|
+
focusButtonLabel ??= locale7.IssuesPanel.focusButtonLabel;
|
|
5286
|
+
previousIssueButtonLabel ??= locale7.IssuesPanel.previousIssueButtonLabel;
|
|
5287
|
+
nextIssueButtonLabel ??= locale7.IssuesPanel.nextIssueButtonLabel;
|
|
5288
|
+
firstIssueButtonLabel ??= locale7.IssuesPanel.firstIssueButtonLabel;
|
|
5289
|
+
lastIssueButtonLabel ??= locale7.IssuesPanel.lastIssueButtonLabel;
|
|
5290
|
+
paginationLabel ??= locale7.IssuesPanel.paginationLabel;
|
|
5291
|
+
noIssuesMessage ??= locale7.IssuesPanel.noIssuesMessage;
|
|
5292
|
+
resolvedTitle ??= locale7.IssuesPanel.resolvedTitle;
|
|
5293
|
+
resolvedMessage ??= locale7.IssuesPanel.resolvedMessage;
|
|
5279
5294
|
const [open, setOpen] = useControllableState(defaultOpen, controlledOpen);
|
|
5280
5295
|
const formIsLoading = useFormIsLoading();
|
|
5281
5296
|
const issuesTrackerResult = useIssuesTracker(AbsolutePath.MATCH_ALL, {
|
|
@@ -5547,9 +5562,9 @@ function LoadAction({
|
|
|
5547
5562
|
errorMessage,
|
|
5548
5563
|
...otherProps
|
|
5549
5564
|
}) {
|
|
5550
|
-
const [
|
|
5551
|
-
label ??=
|
|
5552
|
-
keybinds ??=
|
|
5565
|
+
const [locale7] = useLocale();
|
|
5566
|
+
label ??= locale7.LoadAction.label;
|
|
5567
|
+
keybinds ??= locale7.LoadAction.keybinds;
|
|
5553
5568
|
const { load } = useFormLoader({
|
|
5554
5569
|
decode,
|
|
5555
5570
|
path,
|
|
@@ -5749,9 +5764,9 @@ function PrintAction({
|
|
|
5749
5764
|
onClick,
|
|
5750
5765
|
...otherProps
|
|
5751
5766
|
}) {
|
|
5752
|
-
const [
|
|
5753
|
-
label ??=
|
|
5754
|
-
keybinds ??=
|
|
5767
|
+
const [locale7] = useLocale();
|
|
5768
|
+
label ??= locale7.PrintAction.label;
|
|
5769
|
+
keybinds ??= locale7.PrintAction.keybinds;
|
|
5755
5770
|
const printInProgress = usePrintInProgress();
|
|
5756
5771
|
const formIsDisabled = useFormIsDisabled();
|
|
5757
5772
|
const formIsLoading = useFormIsLoading();
|
|
@@ -5759,30 +5774,42 @@ function PrintAction({
|
|
|
5759
5774
|
const formAppEl = useFormAppElement();
|
|
5760
5775
|
const formTitle = useFormTitle();
|
|
5761
5776
|
const print = usePrint();
|
|
5777
|
+
const printerHasDocumentTitle = !!usePrinterDocumentTitle();
|
|
5762
5778
|
const handlePrint = (evt) => {
|
|
5763
5779
|
evt.preventDefault();
|
|
5764
|
-
void print(
|
|
5780
|
+
void print(
|
|
5781
|
+
printerHasDocumentTitle ? void 0 : { documentTitle: defaultDocumentTitle(formTitle) }
|
|
5782
|
+
);
|
|
5765
5783
|
};
|
|
5766
5784
|
useKeyboardShortcut(keybinds, handlePrint, {
|
|
5767
5785
|
enabled: !shouldDisable,
|
|
5768
5786
|
target: formAppEl,
|
|
5769
5787
|
preventDefault: true
|
|
5770
5788
|
});
|
|
5771
|
-
return /* @__PURE__ */ jsx(
|
|
5772
|
-
|
|
5789
|
+
return /* @__PURE__ */ jsx(
|
|
5790
|
+
PrinterTrigger,
|
|
5773
5791
|
{
|
|
5774
|
-
vertical: true,
|
|
5775
|
-
variant: "subtle",
|
|
5776
|
-
icon: faPrint,
|
|
5777
5792
|
onClick: combineEventHandlers(onClick, handlePrint, {
|
|
5778
5793
|
checkDefaultPrevented: true
|
|
5779
5794
|
}),
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5795
|
+
children: /* @__PURE__ */ jsx(
|
|
5796
|
+
Button,
|
|
5797
|
+
{
|
|
5798
|
+
vertical: true,
|
|
5799
|
+
variant: "subtle",
|
|
5800
|
+
icon: faPrint,
|
|
5801
|
+
...otherProps,
|
|
5802
|
+
loading: loading || printInProgress,
|
|
5803
|
+
disabled: shouldDisable,
|
|
5804
|
+
children: label
|
|
5805
|
+
}
|
|
5806
|
+
)
|
|
5784
5807
|
}
|
|
5785
|
-
)
|
|
5808
|
+
);
|
|
5809
|
+
}
|
|
5810
|
+
function defaultDocumentTitle(formTitle) {
|
|
5811
|
+
const date = format(/* @__PURE__ */ new Date(), "yyyy-MM-dd");
|
|
5812
|
+
return [formTitle, date].filter(Boolean).join(" ");
|
|
5786
5813
|
}
|
|
5787
5814
|
const RadioGroupControl = forwardRef(function RadioGroupControl2({
|
|
5788
5815
|
path,
|
|
@@ -5940,7 +5967,7 @@ function useFormSaver({
|
|
|
5940
5967
|
successMessage,
|
|
5941
5968
|
errorMessage
|
|
5942
5969
|
} = {}) {
|
|
5943
|
-
const [
|
|
5970
|
+
const [locale7] = useLocale();
|
|
5944
5971
|
const formManager = useFormManager();
|
|
5945
5972
|
const { getState, _setState } = useFormController();
|
|
5946
5973
|
const { addToast } = useToastManager();
|
|
@@ -5965,10 +5992,10 @@ function useFormSaver({
|
|
|
5965
5992
|
throw new Error("No `encode` function was provided.");
|
|
5966
5993
|
}
|
|
5967
5994
|
if (successMessage2 === void 0) {
|
|
5968
|
-
successMessage2 =
|
|
5995
|
+
successMessage2 = locale7.SaveAction.successMessage;
|
|
5969
5996
|
}
|
|
5970
5997
|
if (errorMessage2 === void 0) {
|
|
5971
|
-
errorMessage2 =
|
|
5998
|
+
errorMessage2 = locale7.SaveAction.errorMessage;
|
|
5972
5999
|
}
|
|
5973
6000
|
_setState({ saving: true });
|
|
5974
6001
|
let fileHandle = getState().latestFileHandles?.[id2] ?? null;
|
|
@@ -6057,8 +6084,8 @@ function useFormSaver({
|
|
|
6057
6084
|
formTitle,
|
|
6058
6085
|
getState,
|
|
6059
6086
|
id,
|
|
6060
|
-
|
|
6061
|
-
|
|
6087
|
+
locale7.SaveAction.errorMessage,
|
|
6088
|
+
locale7.SaveAction.successMessage,
|
|
6062
6089
|
mimeTypes,
|
|
6063
6090
|
overwrite,
|
|
6064
6091
|
path,
|
|
@@ -6102,12 +6129,12 @@ function SaveAction({
|
|
|
6102
6129
|
dropdownMenuProps,
|
|
6103
6130
|
...otherProps
|
|
6104
6131
|
}) {
|
|
6105
|
-
const [
|
|
6106
|
-
label ??=
|
|
6107
|
-
keybinds ??=
|
|
6108
|
-
saveOptionsLabel ??=
|
|
6109
|
-
saveAsLabel ??=
|
|
6110
|
-
saveAsKeybinds ??=
|
|
6132
|
+
const [locale7] = useLocale();
|
|
6133
|
+
label ??= locale7.SaveAction.label;
|
|
6134
|
+
keybinds ??= locale7.SaveAction.keybinds;
|
|
6135
|
+
saveOptionsLabel ??= locale7.SaveAction.saveOptionsLabel;
|
|
6136
|
+
saveAsLabel ??= locale7.SaveAction.saveAsLabel;
|
|
6137
|
+
saveAsKeybinds ??= locale7.SaveAction.saveAsKeybinds;
|
|
6111
6138
|
const { save, supportsFileSystemAPIs } = useFormSaver({
|
|
6112
6139
|
path,
|
|
6113
6140
|
encode,
|
|
@@ -6524,20 +6551,20 @@ function SubmitAction({
|
|
|
6524
6551
|
...otherProps
|
|
6525
6552
|
}) {
|
|
6526
6553
|
const prefix = usePrefix();
|
|
6527
|
-
const [
|
|
6528
|
-
label ??=
|
|
6529
|
-
keybinds ??=
|
|
6530
|
-
dialogTitle ??=
|
|
6531
|
-
dialogDescription ??=
|
|
6532
|
-
dialogBody ??=
|
|
6533
|
-
confirmWarningsCheckboxLabel ??=
|
|
6534
|
-
dialogOkText ??=
|
|
6535
|
-
dialogCancelText ??=
|
|
6554
|
+
const [locale7] = useLocale();
|
|
6555
|
+
label ??= locale7.SubmitAction.label;
|
|
6556
|
+
keybinds ??= locale7.SubmitAction.keybinds;
|
|
6557
|
+
dialogTitle ??= locale7.SubmitAction.dialogTitle;
|
|
6558
|
+
dialogDescription ??= locale7.SubmitAction.dialogDescription;
|
|
6559
|
+
dialogBody ??= locale7.SubmitAction.dialogBody;
|
|
6560
|
+
confirmWarningsCheckboxLabel ??= locale7.SubmitAction.confirmWarningsCheckboxLabel;
|
|
6561
|
+
dialogOkText ??= locale7.SubmitAction.dialogOkText ?? label;
|
|
6562
|
+
dialogCancelText ??= locale7.SubmitAction.dialogCancelText;
|
|
6536
6563
|
if (successMessage === void 0) {
|
|
6537
|
-
successMessage =
|
|
6564
|
+
successMessage = locale7.SubmitAction.successMessage;
|
|
6538
6565
|
}
|
|
6539
6566
|
if (errorMessage === void 0) {
|
|
6540
|
-
errorMessage =
|
|
6567
|
+
errorMessage = locale7.SubmitAction.errorMessage;
|
|
6541
6568
|
}
|
|
6542
6569
|
const [confirmingSubmission, setConfirmingSubmission] = useState(false);
|
|
6543
6570
|
const startIssuesNavigation = useStartIssuesNavigation();
|
|
@@ -7040,9 +7067,9 @@ const TableControlAddRowTrigger = forwardRef(function TableControlAddRowTrigger2
|
|
|
7040
7067
|
...otherProps
|
|
7041
7068
|
}, forwardedRef) {
|
|
7042
7069
|
const prefix = usePrefix();
|
|
7043
|
-
const [
|
|
7044
|
-
defaultButtonText ??=
|
|
7045
|
-
const
|
|
7070
|
+
const [locale7] = useLocale();
|
|
7071
|
+
defaultButtonText ??= locale7.TableControlAddRowTrigger.defaultButtonText;
|
|
7072
|
+
const { printHidden } = usePrintClassNames();
|
|
7046
7073
|
const { controller, size, maxRows } = useTableControlContext();
|
|
7047
7074
|
const controlIsDisabled = useFormIsDisabled();
|
|
7048
7075
|
const controlIsReadOnly = useFormIsReadOnly();
|
|
@@ -7056,10 +7083,14 @@ const TableControlAddRowTrigger = forwardRef(function TableControlAddRowTrigger2
|
|
|
7056
7083
|
({ initialized, exists }) => !initialized || !exists || controlIsDisabled || disabled || controlIsReadOnly || maxRows != null && size >= maxRows
|
|
7057
7084
|
);
|
|
7058
7085
|
const As = Slot;
|
|
7059
|
-
return (showWhenReadOnly || !controlIsReadOnly) &&
|
|
7086
|
+
return (showWhenReadOnly || !controlIsReadOnly) && /* @__PURE__ */ jsx(
|
|
7060
7087
|
As,
|
|
7061
7088
|
{
|
|
7062
|
-
className: cx(
|
|
7089
|
+
className: cx(
|
|
7090
|
+
prefix("table-control__add-row-trigger"),
|
|
7091
|
+
showWhilePrinting || printHidden,
|
|
7092
|
+
className
|
|
7093
|
+
),
|
|
7063
7094
|
disabled: shouldDisable,
|
|
7064
7095
|
onClick: combineEventHandlers(onClick, handleClick, {
|
|
7065
7096
|
checkDefaultPrevented: true
|
|
@@ -7088,12 +7119,12 @@ const TableControlRemoveRowTrigger = forwardRef(function TableControlRemoveRowTr
|
|
|
7088
7119
|
children,
|
|
7089
7120
|
...otherProps
|
|
7090
7121
|
}, forwardedRef) {
|
|
7091
|
-
const [
|
|
7092
|
-
defaultButtonLabel ??=
|
|
7093
|
-
confirmDialogTitle ??=
|
|
7094
|
-
confirmDialogMessage ??=
|
|
7095
|
-
confirmDialogOkText ??=
|
|
7096
|
-
confirmDialogCancelText ??=
|
|
7122
|
+
const [locale7] = useLocale();
|
|
7123
|
+
defaultButtonLabel ??= locale7.TableControlRemoveRowTrigger.defaultButtonLabel;
|
|
7124
|
+
confirmDialogTitle ??= locale7.TableControlRemoveRowTrigger.confirmDialogTitle;
|
|
7125
|
+
confirmDialogMessage ??= locale7.TableControlRemoveRowTrigger.confirmDialogMessage;
|
|
7126
|
+
confirmDialogOkText ??= locale7.TableControlRemoveRowTrigger.confirmDialogOkText;
|
|
7127
|
+
confirmDialogCancelText ??= locale7.TableControlRemoveRowTrigger.confirmDialogCancelText;
|
|
7097
7128
|
const { confirm } = useAlertDialog();
|
|
7098
7129
|
const { controller } = useTableControlContext();
|
|
7099
7130
|
const controlIsDisabled = useFormIsDisabled();
|
|
@@ -7379,9 +7410,9 @@ function ValidateAction({
|
|
|
7379
7410
|
onClick,
|
|
7380
7411
|
...otherProps
|
|
7381
7412
|
}) {
|
|
7382
|
-
const [
|
|
7383
|
-
label ??=
|
|
7384
|
-
keybinds ??=
|
|
7413
|
+
const [locale7] = useLocale();
|
|
7414
|
+
label ??= locale7.ValidateAction.label;
|
|
7415
|
+
keybinds ??= locale7.ValidateAction.keybinds;
|
|
7385
7416
|
const { validate } = useFormValidator();
|
|
7386
7417
|
const { validatingAutomatically, validatingManually, validating } = useFormIsValidating();
|
|
7387
7418
|
const deferredValidating = useDeferredValue(validating);
|
|
@@ -7464,10 +7495,12 @@ export {
|
|
|
7464
7495
|
ValidateAction,
|
|
7465
7496
|
displayStatusToColor,
|
|
7466
7497
|
displayStatusToControlStatus,
|
|
7467
|
-
enGB,
|
|
7468
|
-
enUS,
|
|
7469
|
-
fr,
|
|
7470
|
-
|
|
7498
|
+
locale as enGB,
|
|
7499
|
+
locale2 as enUS,
|
|
7500
|
+
locale3 as fr,
|
|
7501
|
+
locale4 as frFR,
|
|
7502
|
+
locale5 as pt,
|
|
7503
|
+
locale6 as ptPT,
|
|
7471
7504
|
setDefaultPrefixSuffix,
|
|
7472
7505
|
tableControlActionsColumn,
|
|
7473
7506
|
tableControlIndexColumn,
|