@ostack.tech/ui-kform 0.4.1 → 0.5.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/chunks/{en-DlhP9NuN.js → en-DdEhXMHn.js} +6 -2
- package/dist/chunks/en-DdEhXMHn.js.map +1 -0
- package/dist/locales/en-GB.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/fr.js +5 -1
- package/dist/locales/fr.js.map +1 -1
- package/dist/locales/pt.js +5 -1
- package/dist/locales/pt.js.map +1 -1
- package/dist/ostack-ui-kform.css +37 -9
- package/dist/ostack-ui-kform.css.map +1 -1
- package/dist/ostack-ui-kform.js +322 -134
- package/dist/ostack-ui-kform.js.map +1 -1
- package/dist/types/components/Annexes/Annex.d.ts +2 -0
- package/dist/types/components/Annexes/Annexes.d.ts +1 -1
- package/dist/types/components/FormApp/FormApp.d.ts +6 -2
- package/dist/types/components/FormApp/FormAppContext.d.ts +5 -1
- package/dist/types/components/FormApp/index.d.ts +1 -1
- package/dist/types/components/LoadAction/LoadAction.d.ts +1 -1
- package/dist/types/components/PrintAction/PrintAction.d.ts +40 -0
- package/dist/types/components/PrintAction/index.d.ts +1 -0
- package/dist/types/components/SaveAction/SaveAction.d.ts +1 -1
- package/dist/types/components/SubmitAction/SubmitAction.d.ts +1 -1
- package/dist/types/components/TableControl/TableControl.d.ts +1 -1
- package/dist/types/components/TableControl/TableControlAddRowTrigger.d.ts +6 -0
- package/dist/types/components/TableControl/TableControlColumn.d.ts +3 -1
- package/dist/types/components/ValidateAction/ValidateAction.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/providers/LocalizationProvider/LocalizationObject.d.ts +3 -1
- package/dist/types/utils/useFormSaver.d.ts +19 -3
- package/package.json +3 -2
- package/scss/components/Annexes/_Annexes.scss +20 -0
- package/scss/components/FormPages/_FormPages.scss +10 -1
- package/dist/chunks/en-DlhP9NuN.js.map +0 -1
|
@@ -36,6 +36,8 @@ export interface AnnexProps extends AnnexObject, Omit<ComponentPropsWithoutRef<t
|
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
38
|
issueMessages?: Record<string, IssueMessagesByCode>;
|
|
39
|
+
/** Properties to pass to the container element. */
|
|
40
|
+
containerProps?: ComponentPropsWithRef<"div">;
|
|
39
41
|
/** Properties to pass to the `ErrorBoundary` component. */
|
|
40
42
|
errorBoundaryProps?: ComponentPropsWithRef<typeof ErrorBoundary>;
|
|
41
43
|
children?: ReactNode;
|
|
@@ -2,7 +2,7 @@ import { AbsolutePath, Path } from '@ostack.tech/kform';
|
|
|
2
2
|
import { Tabs } from '@ostack.tech/ui';
|
|
3
3
|
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
4
4
|
/** Properties of the annexes component. */
|
|
5
|
-
export interface AnnexesProps extends Omit<ComponentPropsWithoutRef<typeof Tabs>, "defaultValue" | "value" | "onValueChange"> {
|
|
5
|
+
export interface AnnexesProps extends Omit<ComponentPropsWithoutRef<typeof Tabs>, "defaultValue" | "value" | "onValueChange" | "showAllTabsWhilePrinting"> {
|
|
6
6
|
/** Base path for all declared annexes. */
|
|
7
7
|
path?: string | Path;
|
|
8
8
|
/**
|
|
@@ -11,9 +11,11 @@ export type IssuesDisplayMode = "inline" | "panel";
|
|
|
11
11
|
export type FormAppProps<T = any> = Pick<ComponentPropsWithoutRef<typeof Root>, "enableErrorReporting" | "reportError" | "errorReportingUrl" | "errorReportingMethod" | "encodeErrorReport" | "encodedErrorReportMimeType" | "errorReportingOptions" | "baseDocumentTitle" | "documentTitleBaseSeparator" | "documentTitleBreadcrumbsSeparator" | "portalsContainer" | "tooltipsDelayDuration" | "tooltipsSkipDelayDuration" | "disableTooltipsHoverableContent" | "toastsLabel" | "toastsDuration" | "toastsSwipeDirection" | "toastsSwipeThreshold" | "toastViewportHotkey" | "toastViewportLabel" | "toastViewportProps" | "errorBoundaryProps"> & FormOptions<T> & Omit<ComponentPropsWithoutRef<"form">, "onSubmit" | "onReset"> & {
|
|
12
12
|
/** Schema of the form. */
|
|
13
13
|
schema: Schema<T> | SchemaKt;
|
|
14
|
+
/** Title of the form. */
|
|
15
|
+
formTitle?: string;
|
|
14
16
|
/**
|
|
15
17
|
* Label to use in the issues panel when displaying issues associated with
|
|
16
|
-
* the form app.
|
|
18
|
+
* the form app. Defaults to the `formTitle`.
|
|
17
19
|
*/
|
|
18
20
|
issuesPanelLabel?: ReactNode;
|
|
19
21
|
/** Whether to disable the whole form. */
|
|
@@ -146,9 +148,11 @@ export type FormAppApi<T = unknown> = Controller<T> & {
|
|
|
146
148
|
export declare const FormApp: import('react').ForwardRefExoticComponent<Pick<Omit<import('@ostack.tech/ui').RootProps & import('react').RefAttributes<HTMLDivElement>, "ref">, "reportError" | "errorReportingUrl" | "errorReportingMethod" | "encodeErrorReport" | "encodedErrorReportMimeType" | "errorReportingOptions" | "baseDocumentTitle" | "enableErrorReporting" | "documentTitleBaseSeparator" | "documentTitleBreadcrumbsSeparator" | "portalsContainer" | "tooltipsDelayDuration" | "tooltipsSkipDelayDuration" | "disableTooltipsHoverableContent" | "toastsLabel" | "toastsDuration" | "toastsSwipeDirection" | "toastsSwipeThreshold" | "toastViewportHotkey" | "toastViewportLabel" | "toastViewportProps" | "errorBoundaryProps"> & Omit<import('@ostack.tech/kform-react').ControllerOptions<any, import('@ostack.tech/kform-react').FormControllerState<any>>, "formManager"> & import('@ostack.tech/kform-react').FormOwnOptions<any, unknown> & Omit<Omit<import('react').DetailedHTMLProps<import('react').FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref">, "onReset" | "onSubmit"> & {
|
|
147
149
|
/** Schema of the form. */
|
|
148
150
|
schema: SchemaKt | Schema<any>;
|
|
151
|
+
/** Title of the form. */
|
|
152
|
+
formTitle?: string;
|
|
149
153
|
/**
|
|
150
154
|
* Label to use in the issues panel when displaying issues associated with
|
|
151
|
-
* the form app.
|
|
155
|
+
* the form app. Defaults to the `formTitle`.
|
|
152
156
|
*/
|
|
153
157
|
issuesPanelLabel?: ReactNode;
|
|
154
158
|
/** Whether to disable the whole form. */
|
|
@@ -5,6 +5,7 @@ import { IssueMessagesByCode, IssueMessageValue } from '../IssueMessages';
|
|
|
5
5
|
import { IssuesDisplayMode } from './FormApp.tsx';
|
|
6
6
|
/** Value of the form app context. */
|
|
7
7
|
export interface FormAppContextValue<T = unknown> {
|
|
8
|
+
formTitle?: string;
|
|
8
9
|
disabled: boolean;
|
|
9
10
|
readOnly: boolean;
|
|
10
11
|
issuesDisplayMode: IssuesDisplayMode;
|
|
@@ -71,7 +72,8 @@ export interface UseCreateFormAppContextOptions<T> extends Omit<FormAppContextVa
|
|
|
71
72
|
onPathFocus?: (path: AbsolutePath) => void;
|
|
72
73
|
}
|
|
73
74
|
/** Hook which creates the form app context. */
|
|
74
|
-
export declare function useCreateFormAppContext<T>({ controller, disabled, readOnly, issuesDisplayMode, displayIssueCodes, formAppElement, onPathFocus, }: UseCreateFormAppContextOptions<T>): {
|
|
75
|
+
export declare function useCreateFormAppContext<T>({ formTitle, controller, disabled, readOnly, issuesDisplayMode, displayIssueCodes, formAppElement, onPathFocus, }: UseCreateFormAppContextOptions<T>): {
|
|
76
|
+
formTitle: string | undefined;
|
|
75
77
|
disabled: boolean;
|
|
76
78
|
readOnly: boolean;
|
|
77
79
|
issuesDisplayMode: IssuesDisplayMode;
|
|
@@ -89,6 +91,8 @@ export declare function useCreateFormAppContext<T>({ controller, disabled, readO
|
|
|
89
91
|
};
|
|
90
92
|
/** Returns the context of the form app. */
|
|
91
93
|
export declare function useFormAppContext<T = unknown>(): FormAppContextValue<T>;
|
|
94
|
+
/** Returns the title of the form, if provided to the `FormApp` component. */
|
|
95
|
+
export declare function useFormTitle(): string | undefined;
|
|
92
96
|
/** Returns a boolean representing whether the form is disabled. */
|
|
93
97
|
export declare function useFormIsDisabled(): boolean;
|
|
94
98
|
/** Returns a boolean representing whether the form is read-only. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './FormApp.tsx';
|
|
2
|
-
export { useActiveIssuesPanelBreadcrumb, useDisplayIssueCodesInIssueMessages, useFocus, useFormAppElement, useFormIsDisabled, useFormIsReadOnly, useIsRegistered, useIssuesDisplayMode, useOnPathFocus, useRegisterController, useRegisteredIssueMessage, useRegisterIssueMessages, useRegisterLabel, useSetBottomPanelHeight, useSetLeftSidebarWidth, useSetTopBarHeight, useStartIssuesNavigation, } from './FormAppContext.ts';
|
|
2
|
+
export { useActiveIssuesPanelBreadcrumb, useDisplayIssueCodesInIssueMessages, useFocus, useFormAppElement, useFormIsDisabled, useFormIsReadOnly, useFormTitle, useIsRegistered, useIssuesDisplayMode, useOnPathFocus, useRegisterController, useRegisteredIssueMessage, useRegisterIssueMessages, useRegisterLabel, useSetBottomPanelHeight, useSetLeftSidebarWidth, useSetTopBarHeight, useStartIssuesNavigation, } from './FormAppContext.ts';
|
|
3
3
|
export * from './FormAppIssueMessages.tsx';
|
|
4
4
|
export * from './FormAppStatus.tsx';
|
|
@@ -19,4 +19,4 @@ export interface LoadActionProps<T = unknown> extends Omit<ButtonProps, "childre
|
|
|
19
19
|
keybinds?: string | string[] | null;
|
|
20
20
|
}
|
|
21
21
|
/** Action used to load a form from a file. */
|
|
22
|
-
export declare function LoadAction<T = unknown>({ label, keybinds, loading, disabled, onClick, decode, path, extensions, mimeTypes, description, startIn, id, setPristineOnLoad, validateOnLoad, successMessage, errorMessage, ...otherProps }: LoadActionProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function LoadAction<T = unknown>({ label, keybinds, loading, enabledWhenLoading, disabled, onClick, decode, path, extensions, mimeTypes, description, startIn, id, setPristineOnLoad, validateOnLoad, successMessage, errorMessage, ...otherProps }: LoadActionProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ButtonProps } from '@ostack.tech/ui';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
/** Properties of the print action. */
|
|
4
|
+
export interface PrintActionProps extends Omit<ButtonProps, "children"> {
|
|
5
|
+
/** Action's label. */
|
|
6
|
+
label?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Keybinds for triggering the action. Set to `null` to disable the keyboard
|
|
9
|
+
* shortcut.
|
|
10
|
+
*
|
|
11
|
+
* Keyboard handling is built on top of the
|
|
12
|
+
* [`tinykeys`](https://jamiebuilds.github.io/tinykeys) library. For
|
|
13
|
+
* information on keybinding syntax, read the [`tinykeys`
|
|
14
|
+
* documentation](https://github.com/jamiebuilds/tinykeys).
|
|
15
|
+
*
|
|
16
|
+
* Defaults to the keybinds defined by the current locale.
|
|
17
|
+
*/
|
|
18
|
+
keybinds?: string | string[] | null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Action used to print the form application. Requires the `<FormApp>` component
|
|
22
|
+
* to be wrapped in a `<Printer>` component, and for the `<PrinterContent>` to
|
|
23
|
+
* wrap all annexes/pages/form controls.
|
|
24
|
+
*
|
|
25
|
+
* This typically looks something like:
|
|
26
|
+
*
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <Printer>
|
|
29
|
+
* <FormApp>
|
|
30
|
+
* <TopBar>
|
|
31
|
+
* …
|
|
32
|
+
* <PrintAction />…
|
|
33
|
+
* </TopBar>
|
|
34
|
+
*
|
|
35
|
+
* <PrinterContent>…</PrinterContent>
|
|
36
|
+
* </FormApp>
|
|
37
|
+
* </Printer>;
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function PrintAction({ label, keybinds, disabled, loading, enabledWhenLoading, onClick, ...otherProps }: PrintActionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PrintAction.tsx';
|
|
@@ -48,4 +48,4 @@ export interface SaveActionProps<T = unknown> extends Omit<ButtonProps, "childre
|
|
|
48
48
|
dropdownMenuProps?: ComponentPropsWithRef<typeof DropdownMenuContent>;
|
|
49
49
|
}
|
|
50
50
|
/** Action used to save the form to a file. */
|
|
51
|
-
export declare function SaveAction<T = unknown>({ label, keybinds, disableOverwrite, saveOptionsLabel, saveAsLabel, saveAsKeybinds, loading, disabled, onClick, variant, color, path, encode, fileName, extensions, description, mimeTypes, startIn, excludeAcceptAllOption, id, successMessage, errorMessage, saveOptionsProps, dropdownMenuProps, ...otherProps }: SaveActionProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
export declare function SaveAction<T = unknown>({ label, keybinds, disableOverwrite, saveOptionsLabel, saveAsLabel, saveAsKeybinds, loading, enabledWhenLoading, disabled, onClick, variant, color, path, encode, fileName, extensions, description, mimeTypes, startIn, excludeAcceptAllOption, id, successMessage, errorMessage, saveOptionsProps, dropdownMenuProps, ...otherProps }: SaveActionProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -93,4 +93,4 @@ export interface SubmitActionProps<T = unknown, TSubmitResult = unknown> extends
|
|
|
93
93
|
confirmWarningsCheckboxProps?: Omit<ComponentPropsWithRef<typeof Checkbox>, "checked" | "onCheckedChange" | "children">;
|
|
94
94
|
}
|
|
95
95
|
/** Action used to submit the form. */
|
|
96
|
-
export declare function SubmitAction<T = unknown, TSubmitResult = unknown>({ onSubmit, onInvalidSubmit, onSuccessfulSubmit, onFailedSubmit, setTouchedOnSubmit, validateOnSubmit, setPristineOnSuccessfulSubmit, convertExternalIssuesTableRowIndicesToIds, label, keybinds, confirmWarnings, loading, disabled, onClick, dialogTitle, dialogDescription, dialogBody, confirmWarningsCheckboxLabel, dialogOkText, dialogCancelText, successMessage, errorMessage, dialogContentProps, dialogHeaderProps, dialogTitleProps, dialogBodyProps, dialogDescriptionProps, dialogFooterProps, dialogOkButtonProps, dialogCancelButtonProps, confirmWarningsAlertProps, confirmWarningsCheckboxProps, ...otherProps }: SubmitActionProps<T, TSubmitResult>): import("react/jsx-runtime").JSX.Element;
|
|
96
|
+
export declare function SubmitAction<T = unknown, TSubmitResult = unknown>({ onSubmit, onInvalidSubmit, onSuccessfulSubmit, onFailedSubmit, setTouchedOnSubmit, validateOnSubmit, setPristineOnSuccessfulSubmit, convertExternalIssuesTableRowIndicesToIds, label, keybinds, confirmWarnings, loading, enabledWhenLoading, disabled, onClick, dialogTitle, dialogDescription, dialogBody, confirmWarningsCheckboxLabel, dialogOkText, dialogCancelText, successMessage, errorMessage, dialogContentProps, dialogHeaderProps, dialogTitleProps, dialogBodyProps, dialogDescriptionProps, dialogFooterProps, dialogOkButtonProps, dialogCancelButtonProps, confirmWarningsAlertProps, confirmWarningsCheckboxProps, ...otherProps }: SubmitActionProps<T, TSubmitResult>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,7 @@ import { IssueMessages, IssueMessagesByCode } from '../IssueMessages';
|
|
|
6
6
|
import { TableControlApi } from './TableControlApi.ts';
|
|
7
7
|
import { TableControlColumn, TableControlColumns } from './TableControlColumn.tsx';
|
|
8
8
|
/** Properties of the table control component. */
|
|
9
|
-
export interface TableControlProps<T = unknown, TTable extends Table<T> | null = Table<T> | null> extends Omit<ComponentPropsWithoutRef<typeof DataTable>, "columns" | "rows" | "getRows" | "rowKey" | "loading" | "defaultFilter" | "filter" | "onFilterChange" | "defaultSortBy" | "sortBy" | "defaultSortDirection" | "sortDirection" | "onSort" | "showSelectionColumn" | "defaultSelectedRows" | "selectedRows" | "onSelectedRowsChange" | "apiRef">, Omit<ControllerOptions<TTable>, "enabled"> {
|
|
9
|
+
export interface TableControlProps<T = unknown, TTable extends Table<T> | null = Table<T> | null> extends Omit<ComponentPropsWithoutRef<typeof DataTable>, "columns" | "rows" | "getRows" | "rowKey" | "loading" | "defaultFilter" | "filter" | "onFilterChange" | "defaultSortBy" | "sortBy" | "defaultSortDirection" | "sortDirection" | "onSort" | "showSelectionColumn" | "defaultSelectedRows" | "selectedRows" | "onSelectedRowsChange" | "showAllRowsWhilePrinting" | "apiRef">, Omit<ControllerOptions<TTable>, "enabled"> {
|
|
10
10
|
/** Control's path. */
|
|
11
11
|
path?: string | Path;
|
|
12
12
|
/**
|
|
@@ -15,6 +15,12 @@ export interface TableControlAddRowTriggerProps extends ComponentPropsWithoutRef
|
|
|
15
15
|
* @default false
|
|
16
16
|
*/
|
|
17
17
|
showWhenReadOnly?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether to show the trigger when it is being printed.
|
|
20
|
+
*
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
showWhilePrinting?: boolean;
|
|
18
24
|
}
|
|
19
25
|
/**
|
|
20
26
|
* Trigger used to add a new row to a table control.
|
|
@@ -10,6 +10,8 @@ export interface TableControlStatus {
|
|
|
10
10
|
disabled: boolean;
|
|
11
11
|
/** Whether the table control is read-only. */
|
|
12
12
|
readOnly: boolean;
|
|
13
|
+
/** Whether the table is being printed. */
|
|
14
|
+
printing: boolean;
|
|
13
15
|
}
|
|
14
16
|
/** Controller of a table row. */
|
|
15
17
|
export type TableControlRowController<T = unknown> = Controller<T> & {
|
|
@@ -38,7 +40,7 @@ export declare function tableControlIndexColumn<T = unknown, TValue = any>(overr
|
|
|
38
40
|
* Its configuration can be overriden to show other actions, for example, an
|
|
39
41
|
* edit button:
|
|
40
42
|
*
|
|
41
|
-
* ```
|
|
43
|
+
* ```tsx
|
|
42
44
|
* tableControlActionsColumn({
|
|
43
45
|
* width: 100,
|
|
44
46
|
* render: () => (
|
|
@@ -18,4 +18,4 @@ export interface ValidateActionProps extends Omit<ButtonProps, "children"> {
|
|
|
18
18
|
keybinds?: string | string[] | null;
|
|
19
19
|
}
|
|
20
20
|
/** Action used to validate the form. */
|
|
21
|
-
export declare function ValidateAction({ label, keybinds, loading, disabled, onClick, ...otherProps }: ValidateActionProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function ValidateAction({ label, keybinds, loading, enabledWhenLoading, disabled, onClick, ...otherProps }: ValidateActionProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export * from './components/IssuesPopover';
|
|
|
16
16
|
export * from './components/LoadAction';
|
|
17
17
|
export * from './components/NumericControl';
|
|
18
18
|
export * from './components/PathLink';
|
|
19
|
+
export * from './components/PrintAction';
|
|
19
20
|
export * from './components/RadioGroupControl';
|
|
20
21
|
export * from './components/SaveAction';
|
|
21
22
|
export * from './components/SelectControl';
|
|
@@ -8,6 +8,7 @@ import { IssueMessagesProps } from '../../components/IssueMessages';
|
|
|
8
8
|
import { IssuesPanelProps } from '../../components/IssuesPanel';
|
|
9
9
|
import { IssuesPopoverProps } from '../../components/IssuesPopover';
|
|
10
10
|
import { LoadActionProps } from '../../components/LoadAction';
|
|
11
|
+
import { PrintActionProps } from '../../components/PrintAction';
|
|
11
12
|
import { SaveActionProps } from '../../components/SaveAction';
|
|
12
13
|
import { SubmitActionProps } from '../../components/SubmitAction';
|
|
13
14
|
import { TableControlAddRowTriggerProps, TableControlRemoveRowTriggerProps } from '../../components/TableControl';
|
|
@@ -18,7 +19,7 @@ export interface LocalizationObject {
|
|
|
18
19
|
AnnexesManager: Pick<AnnexesManagerProps, "aria-label" | "menuButtonText" | "addAnnexText" | "removeAnnexButtonLabel" | "removeAnnexKeyboardHint" | "removeAnnexConfirmDialogTitle" | "removeAnnexConfirmDialogMessage" | "removeAnnexConfirmDialogOkText" | "removeAnnexConfirmDialogCancelText">;
|
|
19
20
|
DateRangeControl: Pick<DateRangeControlProps, "issuesPanelStartLabelSuffix" | "issuesPanelEndLabelSuffix">;
|
|
20
21
|
FileControl: Pick<FileControlProps, "viewFileButtonLabel" | "downloadFileButtonLabel" | "fallbackText">;
|
|
21
|
-
FormApp: Pick<FormAppProps, "issuesPanelLabel" | "issueMessages" | "confirmUnloadMessage">;
|
|
22
|
+
FormApp: Pick<FormAppProps, "formTitle" | "issuesPanelLabel" | "issueMessages" | "confirmUnloadMessage">;
|
|
22
23
|
FormPage: Pick<FormPageProps, "helperButtonLabel">;
|
|
23
24
|
FormPagesNavigation: Pick<FormPagesNavigationProps, "aria-label">;
|
|
24
25
|
IssueMessages: Pick<IssueMessagesProps, "unknownErrorMessage" | "unknownWarningMessage">;
|
|
@@ -26,6 +27,7 @@ export interface LocalizationObject {
|
|
|
26
27
|
IssuesPopover: Pick<IssuesPopoverProps, "label">;
|
|
27
28
|
LoadAction: Pick<LoadActionProps, "label" | "keybinds" | "successMessage" | "errorMessage">;
|
|
28
29
|
SaveAction: Pick<SaveActionProps, "label" | "keybinds" | "saveOptionsLabel" | "saveAsLabel" | "saveAsKeybinds" | "successMessage" | "errorMessage">;
|
|
30
|
+
PrintAction: Pick<PrintActionProps, "label" | "keybinds">;
|
|
29
31
|
SubmitAction: Pick<SubmitActionProps, "label" | "keybinds" | "dialogTitle" | "dialogDescription" | "dialogBody" | "dialogOkText" | "dialogCancelText" | "confirmWarningsCheckboxLabel" | "successMessage" | "errorMessage">;
|
|
30
32
|
TableControlAddRowTrigger: Pick<TableControlAddRowTriggerProps, "defaultButtonText">;
|
|
31
33
|
TableControlRemoveRowTrigger: Pick<TableControlRemoveRowTriggerProps, "defaultButtonLabel" | "confirmDialogTitle" | "confirmDialogMessage" | "confirmDialogOkText" | "confirmDialogCancelText">;
|
|
@@ -39,11 +39,27 @@ export interface FormSaverOptions<T = unknown> {
|
|
|
39
39
|
* before invoking the save.
|
|
40
40
|
*/
|
|
41
41
|
fileName?: string | ((formValue: T) => string | PromiseLike<string>);
|
|
42
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Acceptable file extensions. Extensions should include the leading dot.
|
|
44
|
+
*
|
|
45
|
+
* _E.g._ `[".json", ".txt"]`
|
|
46
|
+
*
|
|
47
|
+
* @default [""]
|
|
48
|
+
*/
|
|
43
49
|
extensions?: string[];
|
|
44
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Acceptable MIME types.
|
|
52
|
+
*
|
|
53
|
+
* _E.g._ `["application/json", "text/plain"]`
|
|
54
|
+
*
|
|
55
|
+
* @default [ ]
|
|
56
|
+
*/
|
|
45
57
|
mimeTypes?: string[];
|
|
46
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Suggested file description.
|
|
60
|
+
*
|
|
61
|
+
* @default ""
|
|
62
|
+
*/
|
|
47
63
|
description?: string;
|
|
48
64
|
/** Directory to present when starting to save. */
|
|
49
65
|
startIn?: WellKnownDirectory | FileSystemHandle;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ostack.tech/ui-kform",
|
|
3
3
|
"description": "Integration of ostack/UI with ostack/KForm.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"homepage": "https://ui.ostack.tech/",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Opensoft",
|
|
@@ -52,12 +52,13 @@
|
|
|
52
52
|
"@fortawesome/free-solid-svg-icons": "^6.2.0 || ^7.0.0",
|
|
53
53
|
"@ostack.tech/kform": "~0.31.0",
|
|
54
54
|
"@ostack.tech/kform-react": "~0.31.0",
|
|
55
|
-
"@ostack.tech/ui": "~0.
|
|
55
|
+
"@ostack.tech/ui": "~0.5.0",
|
|
56
56
|
"@types/react": "^18.0.0 || ^19.0.0",
|
|
57
57
|
"@types/react-dom": "^18.0.0 || ^19.0.0",
|
|
58
58
|
"date-fns": "^4.1.0",
|
|
59
59
|
"react": "^18.0.0 || ^19.0.0",
|
|
60
60
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
61
|
+
"react-to-print": "^3.0.0",
|
|
61
62
|
"zustand": "^5.0.0"
|
|
62
63
|
},
|
|
63
64
|
"peerDependenciesMeta": {
|
|
@@ -224,6 +224,10 @@
|
|
|
224
224
|
);
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
+
&__annex-container {
|
|
228
|
+
break-before: page;
|
|
229
|
+
}
|
|
230
|
+
|
|
227
231
|
&__annex {
|
|
228
232
|
min-height: calc(
|
|
229
233
|
var(--#{$prefix}form-app-min-height) - var(
|
|
@@ -231,4 +235,20 @@
|
|
|
231
235
|
) - var(--#{$prefix}bottom-panel-height)
|
|
232
236
|
);
|
|
233
237
|
}
|
|
238
|
+
|
|
239
|
+
&__annex-label {
|
|
240
|
+
display: flex;
|
|
241
|
+
align-items: baseline;
|
|
242
|
+
|
|
243
|
+
.#{$prefix}annexes__tab-title {
|
|
244
|
+
font-size: var(--#{ostack-ui.$prefix}font-size-md);
|
|
245
|
+
}
|
|
246
|
+
.#{$prefix}annexes__tab-subtitle {
|
|
247
|
+
&:not(:first-child)::before {
|
|
248
|
+
content: "\00a0—\00a0";
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
font-size: var(--#{ostack-ui.$prefix}font-size-sm);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
234
254
|
}
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
justify-content: stretch;
|
|
11
11
|
height: 100%;
|
|
12
12
|
|
|
13
|
+
@media print {
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
// Sidebar layout
|
|
14
18
|
&__navigation[data-navigation-mode="sidebar"] {
|
|
15
19
|
flex-shrink: 0;
|
|
@@ -167,6 +171,10 @@
|
|
|
167
171
|
)
|
|
168
172
|
);
|
|
169
173
|
background-color: var(--#{ostack-ui.$prefix}background-color);
|
|
174
|
+
|
|
175
|
+
@media print {
|
|
176
|
+
min-height: 0;
|
|
177
|
+
}
|
|
170
178
|
}
|
|
171
179
|
|
|
172
180
|
&__page-header {
|
|
@@ -241,6 +249,7 @@
|
|
|
241
249
|
font-size: ostack-ui.$font-size-md;
|
|
242
250
|
line-height: ostack-ui.$line-height-md;
|
|
243
251
|
font-weight: ostack-ui.$font-weight-bold;
|
|
252
|
+
break-after: avoid;
|
|
244
253
|
|
|
245
254
|
&:not(:last-child) {
|
|
246
255
|
margin-right: ostack-ui.spacing(4);
|
|
@@ -280,7 +289,7 @@
|
|
|
280
289
|
|
|
281
290
|
@include ostack-ui.media-breakpoint-up(sm) {
|
|
282
291
|
padding-bottom: calc(
|
|
283
|
-
var(--#{$prefix}bottom-panel-height) + ostack-ui.spacing(4)
|
|
292
|
+
var(--#{$prefix}bottom-panel-height, 0px) + ostack-ui.spacing(4)
|
|
284
293
|
);
|
|
285
294
|
margin-bottom: calc(var(--#{$prefix}bottom-panel-height) * -1);
|
|
286
295
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"en-DlhP9NuN.js","sources":["../../src/locales/en.tsx"],"sourcesContent":["import type { LocalizationObject } from \"../providers/LocalizationProvider\";\n\n/** `en` locale (partial). */\nexport const en: Omit<LocalizationObject, \"languageTag\" | \"baseLocale\"> = {\n AnnexesManager: {\n \"aria-label\": \"Form annexes\",\n menuButtonText: \"Annexes\",\n addAnnexText: \"Add annex\",\n removeAnnexButtonLabel: \"Remove annex\",\n removeAnnexKeyboardHint: \"Press the “Delete” key to remove the annex\",\n removeAnnexConfirmDialogTitle: \"Remove annex\",\n removeAnnexConfirmDialogMessage: (annexName) => (\n <>Are you sure you want to remove annex {annexName}?</>\n ),\n removeAnnexConfirmDialogOkText: \"Remove\",\n },\n DateRangeControl: {\n issuesPanelStartLabelSuffix: \" (start date)\",\n issuesPanelEndLabelSuffix: \" (end date)\",\n },\n FileControl: {\n viewFileButtonLabel: \"View file\",\n downloadFileButtonLabel: \"Download file\",\n fallbackText: (\n <>\n The selected file cannot be viewed in this browser.\n <br />\n Please use the button above to download the file. You can then open it\n using an external application.\n </>\n ),\n },\n FormApp: {\n issuesPanelLabel: \"Form\",\n issueMessages: {\n \"/**\": {\n valueMissing: \"Field is required.\",\n valueDisallowed: \"Indicated value is not allowed.\",\n rangeUnderflow: \"Value is under the minimum allowed.\",\n rangeOverflow: \"Value exceeds the maximum allowed.\",\n lengthMismatch: (_data, { typeInfo: { name, restrictions } }) =>\n name === \"String\" &&\n typeof restrictions.minLength === \"number\" &&\n restrictions.minLength === restrictions.maxLength\n ? `Value must have ${restrictions.minLength} character${\n restrictions.minLength === 1 ? \"\" : \"s\"\n }.`\n : \"Value has an invalid length.\",\n tooShort: (_data, { typeInfo: { name, restrictions } }) =>\n name === \"String\" && typeof restrictions.minLength === \"number\"\n ? `Value must not have under ${restrictions.minLength} character${\n restrictions.minLength === 1 ? \"\" : \"s\"\n }.`\n : \"Value is too short.\",\n tooLong: (_data, { typeInfo: { name, restrictions } }) =>\n name === \"String\" && typeof restrictions.maxLength === \"number\"\n ? `Value must not have over ${restrictions.maxLength} character${\n restrictions.maxLength === 1 ? \"\" : \"s\"\n }.`\n : \"Value is too long.\",\n sizeMismatch: (_data, { typeInfo: { restrictions } }) =>\n typeof restrictions.minSize === \"number\" &&\n restrictions.minSize === restrictions.maxSize\n ? `Field must have ${restrictions.minSize} item${\n restrictions.minSize === 1 ? \"\" : \"s\"\n }.`\n : \"Field has an invalid number of items.\",\n tooSmall: (_data, { typeInfo: { restrictions } }) =>\n typeof restrictions.minLength === \"number\"\n ? `Field must not have under ${restrictions.minLength} item${\n restrictions.minLength === 1 ? \"\" : \"s\"\n }.`\n : \"Field does not have enough items.\",\n tooLarge: (_data, { typeInfo: { restrictions } }) =>\n typeof restrictions.maxLength === \"number\"\n ? `Field must not have over ${restrictions.maxLength} item${\n restrictions.maxLength === 1 ? \"\" : \"s\"\n }.`\n : \"Number of items of field exceeds allowed limit.\",\n scaleMismatch: (_data, { typeInfo: { restrictions } }) =>\n typeof restrictions.scale === \"number\"\n ? `Value must have ${restrictions.scale} decimal place${\n restrictions.scale === 1 ? \"\" : \"s\"\n }.`\n : \"Value has invalid number of decimal places.\",\n patternMismatch: \"Value does not follow required pattern.\",\n emailPatternMismatch: \"Invalid email address.\",\n fileTypeMismatch: (_data, { typeInfo: { restrictions } }) =>\n Array.isArray(restrictions.acceptedFileTypes)\n ? `Only the following file types are allowed: ${restrictions.acceptedFileTypes.join(\", \")}.`\n : \"Indicated file’s type is not allowed.\",\n itemsRepeated: ({ firstIndex, secondIndex }) =>\n firstIndex != null && secondIndex != null\n ? `Items ${+firstIndex + 1} and ${+secondIndex + 1} are repeated.`\n : \"Field contains repeated items.\",\n computedValueMismatch: \"Value differs from the computed value.\",\n validationFailed: (data) =>\n process.env.NODE_ENV !== \"production\"\n ? data.exception\n : \"Something went wrong validating this field. \" +\n \"Please try again later.\",\n },\n },\n confirmUnloadMessage:\n \"Are you sure you want to leave the page? \" +\n \"Changes you made to the form may not have been saved.\",\n },\n FormPagesNavigation: {\n \"aria-label\": \"Form pages\",\n },\n FormPage: {\n helperButtonLabel: \"Show help\",\n },\n IssueMessages: {\n unknownErrorMessage: \"Field with unknown error.\",\n unknownWarningMessage: \"Field with unknown warning.\",\n },\n IssuesPanel: {\n errorsLabel: (errors) =>\n errors === undefined ? (\n \"Errors\"\n ) : (\n <>\n {errors} {errors === 1 ? \"Error\" : \"Errors\"}\n </>\n ),\n warningsLabel: (warnings) =>\n warnings === undefined ? (\n \"Warnings\"\n ) : (\n <>\n {warnings} {warnings === 1 ? \"Warning\" : \"Warnings\"}\n </>\n ),\n focusButtonLabel: \"Focus field\",\n previousIssueButtonLabel: \"Previous field with issues\",\n nextIssueButtonLabel: \"Next field with issues\",\n firstIssueButtonLabel: \"First field with issues\",\n lastIssueButtonLabel: \"Last field with issues\",\n paginationLabel: (currentPage, totalPages) =>\n `Field with issues ${currentPage} of ${totalPages}.`,\n noIssuesMessage: \"No issues to report.\",\n resolvedTitle: \"Resolved\",\n resolvedMessage:\n \"Issues have been resolved. \" +\n \"Please advance to the next field with issues.\",\n },\n IssuesPopover: {\n label: \"Show issues\",\n },\n LoadAction: {\n label: \"Load\",\n keybinds: \"$mod+O\",\n successMessage: (file) => `File “${file.name}” loaded successfully.`,\n errorMessage: (file) =>\n file\n ? `Unable to load file “${file.name}”. ` +\n \"Please confirm that the indicated file is a valid file of the form.\"\n : \"Unable to load the indicated file. Please confirm that you have \" +\n \"the appropriate permissions to perform the operation.\",\n },\n SaveAction: {\n label: \"Save\",\n keybinds: \"$mod+S\",\n saveOptionsLabel: \"Save options\",\n saveAsLabel: \"Save as…\",\n saveAsKeybinds: \"$mod+Shift+S\",\n successMessage: (fileHandle) =>\n `File “${fileHandle.name}” saved successfully.`,\n errorMessage: (fileHandle) =>\n fileHandle\n ? `Unable to save file “${fileHandle.name}”. ` +\n \"Please confirm that you have the appropriate permissions to \" +\n \"perform the operation.\"\n : \"Unable to save the indicated file. Please confirm that you have \" +\n \"the appropriate permissions to perform the operation.\",\n },\n SubmitAction: {\n label: \"Submit\",\n keybinds: \"$mod+Enter\",\n dialogTitle: \"Submit form\",\n dialogDescription:\n \"Please confirm that you wish to proceed with the form submission.\",\n dialogCancelText: \"Cancel\",\n confirmWarningsCheckboxLabel:\n \"I declare that I have been informed of the warnings generated by the \" +\n \"data in this form and that I wish to proceed without changing said \" +\n \"data.\",\n successMessage: \"Form submitted successfully.\",\n errorMessage:\n \"Something went wrong while submitting the form. Please try again later.\",\n },\n TableControlAddRowTrigger: {\n defaultButtonText: \"Add row\",\n },\n TableControlRemoveRowTrigger: {\n defaultButtonLabel: \"Remove row\",\n confirmDialogTitle: \"Remove row\",\n confirmDialogMessage: (index) => (\n <>Are you sure you want to remove line #{index + 1}?</>\n ),\n confirmDialogOkText: \"Remove\",\n },\n ValidateAction: {\n label: \"Validate\",\n keybinds: \"F7\",\n },\n};\n"],"names":[],"mappings":";AAGO,MAAM,KAA6D;AAAA,EACxE,gBAAgB;AAAA,IACd,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,cAAc;AAAA,IACd,wBAAwB;AAAA,IACxB,yBAAyB;AAAA,IACzB,+BAA+B;AAAA,IAC/B,iCAAiC,CAAC,cAChC,qBAAA,UAAA,EAAE,UAAA;AAAA,MAAA;AAAA,MAAuC;AAAA,MAAU;AAAA,IAAA,GAAC;AAAA,IAEtD,gCAAgC;AAAA,EAAA;AAAA,EAElC,kBAAkB;AAAA,IAChB,6BAA6B;AAAA,IAC7B,2BAA2B;AAAA,EAAA;AAAA,EAE7B,aAAa;AAAA,IACX,qBAAqB;AAAA,IACrB,yBAAyB;AAAA,IACzB,cACE,qBAAA,UAAA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