@micromerce/formbuilder-react 1.0.654 → 1.0.658
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/assets/icons/error/Error.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +10 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/ControlWrapper/ControlWrapper.d.ts +11 -0
- package/dist/components/ControlWrapper/index.d.ts +1 -0
- package/dist/components/DateRangeGroup/DateRangeGroup.d.ts +10 -0
- package/dist/components/DateRangeGroup/DateRangeGroup.styles.d.ts +3 -0
- package/dist/components/DateRangeGroup/components/CalendarModal.d.ts +14 -0
- package/dist/components/DateRangeGroup/index.d.ts +1 -0
- package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +14 -0
- package/dist/components/FileUploader/FileUploader.d.ts +9 -0
- package/dist/components/FileUploader/index.d.ts +1 -0
- package/dist/components/FormBuilder/FormBuilder.d.ts +25 -0
- package/dist/components/FormBuilder/index.d.ts +1 -0
- package/dist/components/FormBuilder/utils/extractFormControlValues/extractFormControlValues.d.ts +6 -0
- package/dist/components/FormBuilder/utils/extractFormControlValues/index.d.ts +1 -0
- package/dist/components/FormBuilder/utils/jsonToUrlEncoded/index.d.ts +1 -0
- package/dist/components/FormBuilder/utils/jsonToUrlEncoded/jsonToUrlEncoded.d.ts +5 -0
- package/dist/components/FormFooter/FormFooter.d.ts +15 -0
- package/dist/components/FormFooter/components/Switch.d.ts +1 -0
- package/dist/components/FormFooter/index.d.ts +1 -0
- package/dist/components/FormGroup/FormGroup.d.ts +15 -0
- package/dist/components/FormGroup/index.d.ts +1 -0
- package/dist/components/FormList/FormList.d.ts +11 -0
- package/dist/components/FormList/index.d.ts +1 -0
- package/dist/components/GeneralFormGroup/GeneralFormGroup.d.ts +5 -0
- package/dist/components/GeneralFormGroup/index.d.ts +1 -0
- package/dist/components/Group/Group.d.ts +12 -0
- package/dist/components/Group/index.d.ts +1 -0
- package/dist/components/Input/Input.d.ts +14 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/Input/input.styles.d.ts +9 -0
- package/dist/components/InputFreeSolo/InputFreeSolo.d.ts +10 -0
- package/dist/components/InputFreeSolo/index.d.ts +1 -0
- package/dist/components/MrnInput/MrnInput.d.ts +11 -0
- package/dist/components/MrnInput/hooks/useMrn.d.ts +21 -0
- package/dist/components/MrnInput/index.d.ts +1 -0
- package/dist/components/MrnInput/services/fetchMrn.d.ts +3 -0
- package/dist/components/MrnInput/ui-helper/Link/Link.d.ts +3 -0
- package/dist/components/MrnInput/utils/mrnUtils/mrnUtils.d.ts +8 -0
- package/dist/components/MrnInput/utils/resolveMrnLinks/resolveMrnLink.d.ts +2 -0
- package/dist/components/MrnInput/utils/resolveNestedQueryLink/resolveNestedQueryLink.d.ts +2 -0
- package/dist/components/MrnInput/utils/urlSearchParam/urlSearchParam.d.ts +1 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +17 -0
- package/dist/components/MultiSelect/index.d.ts +1 -0
- package/dist/components/MultiSelect/utils/extractSelectedOptionValues/extractSelectedOptionValues.d.ts +24 -0
- package/dist/components/MultiSelect/utils/extractSelectedOptionValues/index.d.ts +1 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +12 -0
- package/dist/components/PasswordInput/index.d.ts +1 -0
- package/dist/components/QueryControl/QueryControl.d.ts +13 -0
- package/dist/components/QueryControl/data/defaultControls.d.ts +9 -0
- package/dist/components/QueryControl/index.d.ts +1 -0
- package/dist/components/QueryControl/ui-helper/Wrapper/QueryControlWrapper.d.ts +8 -0
- package/dist/components/QueryControl/ui-helper/Wrapper/QueryControlWrapper.styles.d.ts +6 -0
- package/dist/components/QueryControl/ui-helper/Wrapper/index.d.ts +1 -0
- package/dist/components/QueryControl/utils/allControlsHidden/allControlsHidden.d.ts +3 -0
- package/dist/components/QueryControl/utils/allControlsHidden/index.d.ts +1 -0
- package/dist/components/QueryControl/utils/getMatchingControls.d.ts +9 -0
- package/dist/components/QueryControl/utils/hasExpertControl/hasExpertControl.d.ts +3 -0
- package/dist/components/QueryControl/utils/hasExpertControl/index.d.ts +1 -0
- package/dist/components/QueryControl/utils/hideGroup/hideGroup.d.ts +3 -0
- package/dist/components/QueryControl/utils/hideGroup/index.d.ts +1 -0
- package/dist/components/Select/Select.d.ts +12 -0
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Select/utils/getSelectedOption.d.ts +3 -0
- package/dist/components/Textarea/Textarea.d.ts +10 -0
- package/dist/components/Textarea/Textarea.types.d.ts +12 -0
- package/dist/components/Textarea/aiWrapper/aiAction.d.ts +12 -0
- package/dist/components/Textarea/aiWrapper/aiLayout.d.ts +10 -0
- package/dist/components/Textarea/aiWrapper/index.d.ts +11 -0
- package/dist/components/Textarea/aiWrapper/useAi.d.ts +21 -0
- package/dist/components/Textarea/editors/Default.d.ts +13 -0
- package/dist/components/Textarea/editors/Html.d.ts +10 -0
- package/dist/components/Textarea/editors/Json.d.ts +10 -0
- package/dist/components/Textarea/editors/Markdown.d.ts +10 -0
- package/dist/components/Textarea/editors/Richtext.d.ts +12 -0
- package/dist/components/Textarea/index.d.ts +1 -0
- package/dist/components/addressGroup/AddressGroup.d.ts +12 -0
- package/dist/components/addressGroup/index.d.ts +1 -0
- package/dist/components/addressGroup/utils/Countries.d.ts +3 -0
- package/dist/components/states/error/index.d.ts +5 -0
- package/dist/context/FormData.d.ts +33 -0
- package/dist/hooks/useDependent/enhanced/useInputDependent/useInputDependent.d.ts +12 -0
- package/dist/hooks/useDependent/enhanced/useOptionsGenerator/useOptionsGenerator.d.ts +15 -0
- package/dist/hooks/useDependent/useDependent.d.ts +11 -0
- package/dist/hooks/useValueGenerator/useValueGenerator.d.ts +18 -0
- package/dist/index.d.ts +17 -0
- package/dist/styles/Hidden.styles.d.ts +7 -0
- package/dist/styles/Skeleton.d.ts +7 -0
- package/dist/styles/Textfield.styles.d.ts +5 -0
- package/dist/testutils.d.ts +14 -0
- package/dist/types/controlProps.d.ts +70 -0
- package/dist/types/index.d.ts +166 -0
- package/dist/ui/menu/hooks/useMenu.d.ts +13 -0
- package/dist/ui/menu/index.d.ts +13 -0
- package/dist/ui/menu/test/createControl.d.ts +15 -0
- package/dist/ui/menu/utils/detemineSubmenuTabs/index.d.ts +14 -0
- package/dist/ui-helper/HeaderCollapseButton/index.d.ts +7 -0
- package/dist/ui-helper/notifications/Error.d.ts +6 -0
- package/dist/ui-helper/notifications/images/background.d.ts +2 -0
- package/dist/ui-helper/notifications/images/spinner.d.ts +2 -0
- package/dist/ui-helper/notifications/images/under-improvement.d.ts +2 -0
- package/dist/utils/findFormControlError/index.d.ts +4 -0
- package/dist/utils/hasGroupRequiredFieldsWithValues/index.d.ts +6 -0
- package/package.json +6 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DetailedHTMLProps, TextareaHTMLAttributes } from "react";
|
|
2
|
+
import { OnChangeValueType, TextareaFormControl } from "../../../types";
|
|
3
|
+
export interface IProps extends DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement> {
|
|
4
|
+
control?: TextareaFormControl;
|
|
5
|
+
value?: string;
|
|
6
|
+
onChange?: (newProperties: OnChangeValueType) => void;
|
|
7
|
+
id?: string;
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
textColor?: string;
|
|
10
|
+
errorClass?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const DefaultEditor: ({ value, onChange, id, readOnly, control, errorClass, textColor, }: IProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default DefaultEditor;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { OnChangeValueType } from "../../../types";
|
|
3
|
+
interface IHtmlEditorProps {
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (newProperties: OnChangeValueType) => void;
|
|
6
|
+
id: string;
|
|
7
|
+
readOnly: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const HtmlEditor: React.FC<IHtmlEditorProps>;
|
|
10
|
+
export default HtmlEditor;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { OnChangeValueType } from "../../../types";
|
|
3
|
+
interface ICodeEditorProps {
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (newProperties: OnChangeValueType) => void;
|
|
6
|
+
id: string;
|
|
7
|
+
readOnly: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const CodeEditor: React.FC<ICodeEditorProps>;
|
|
10
|
+
export default CodeEditor;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { OnChangeValueType } from "../../../types";
|
|
3
|
+
interface IMarkdownEditorProps {
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (newProperties: OnChangeValueType) => void;
|
|
6
|
+
id: string;
|
|
7
|
+
readOnly: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const MarkdownEditor: React.FC<IMarkdownEditorProps>;
|
|
10
|
+
export default MarkdownEditor;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "react-quill/dist/quill.snow.css";
|
|
3
|
+
import { OnChangeValueType } from "../../../types";
|
|
4
|
+
import "./Richtext.css";
|
|
5
|
+
interface IRichTextEditorProps {
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (newProperties: OnChangeValueType) => void;
|
|
8
|
+
id: string;
|
|
9
|
+
readOnly: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const RichTextEditor: React.FC<IRichTextEditorProps>;
|
|
12
|
+
export default RichTextEditor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Textarea";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { controlProps } from "../../types/controlProps";
|
|
2
|
+
import { GroupFormControl } from "../../types/index";
|
|
3
|
+
export interface IProps {
|
|
4
|
+
id: string;
|
|
5
|
+
control: GroupFormControl;
|
|
6
|
+
objectPathId?: string;
|
|
7
|
+
groupIsRequired?: boolean;
|
|
8
|
+
isInGroup?: boolean;
|
|
9
|
+
controlProps?: controlProps;
|
|
10
|
+
}
|
|
11
|
+
declare const AddressGroup: ({ ...props }: IProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default AddressGroup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./AddressGroup";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { FC } from "react";
|
|
2
|
+
import type { PostMessageProps, PostMessageResponse } from "../types";
|
|
3
|
+
import { FileUploaderConfig, FormControl, FormControls, resolveUrl } from "../types";
|
|
4
|
+
interface ContextProps {
|
|
5
|
+
formControls: FormControls;
|
|
6
|
+
fileUploaderConfig: FileUploaderConfig;
|
|
7
|
+
hasExpertMode: boolean;
|
|
8
|
+
isExpertMode: boolean;
|
|
9
|
+
enableExpertMode: () => void;
|
|
10
|
+
toggleExpertMode: () => void;
|
|
11
|
+
resolveUrl: resolveUrl;
|
|
12
|
+
updateControl: (id: string, control: FormControl) => void;
|
|
13
|
+
addListItem: (listName: string) => void;
|
|
14
|
+
addFileUploaderConfig: (endpoints: FileUploaderConfig) => void;
|
|
15
|
+
moveListItemUp: (listName: string, index: number) => void;
|
|
16
|
+
moveListItemDown: (listName: string, index: number) => void;
|
|
17
|
+
removeListItem: (listName: string, index: number) => void;
|
|
18
|
+
getControlByObjectPath: (path: string) => FormControl;
|
|
19
|
+
toggleRerendered: boolean;
|
|
20
|
+
postGenAiMessage?: ({ message, profile, }: PostMessageProps) => Promise<PostMessageResponse>;
|
|
21
|
+
}
|
|
22
|
+
export declare const FormDataContext: React.Context<Partial<ContextProps>>;
|
|
23
|
+
export declare const getControlByPath: (formControls: FormControls, path: string) => FormControl;
|
|
24
|
+
export interface ProviderProps {
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
controls: FormControls;
|
|
27
|
+
fileUploaderConfig?: FileUploaderConfig;
|
|
28
|
+
resolveUrl?: resolveUrl;
|
|
29
|
+
postGenAiMessage?: ({ message, profile, }: PostMessageProps) => Promise<PostMessageResponse>;
|
|
30
|
+
}
|
|
31
|
+
export declare const getEnhancedControls: (controls: FormControls) => FormControls;
|
|
32
|
+
export declare const FormDataProvider: FC<ProviderProps>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ControlCommons, OnChangeValueType } from "../../../../types";
|
|
2
|
+
interface IUseInputDependentProps {
|
|
3
|
+
onChangeValue: (newProperties: OnChangeValueType, customizer?: (...args: any) => any) => void;
|
|
4
|
+
query: string;
|
|
5
|
+
objectPathId: string;
|
|
6
|
+
value: string;
|
|
7
|
+
hasEdited?: ControlCommons["hasEdited"];
|
|
8
|
+
}
|
|
9
|
+
declare const useInputDependent: ({ onChangeValue, query, objectPathId, value, hasEdited, }: IUseInputDependentProps) => {
|
|
10
|
+
textColor: string;
|
|
11
|
+
};
|
|
12
|
+
export default useInputDependent;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SelectFormControlOption } from "../../../../types";
|
|
2
|
+
interface IUseOptionsGeneratorProps {
|
|
3
|
+
query: string;
|
|
4
|
+
controlKey: string;
|
|
5
|
+
objectPathId: string;
|
|
6
|
+
options: SelectFormControlOption[];
|
|
7
|
+
}
|
|
8
|
+
declare const useOptionsGenerator: ({ query, controlKey, objectPathId, options, }: IUseOptionsGeneratorProps) => {
|
|
9
|
+
options: SelectFormControlOption[];
|
|
10
|
+
mrnEntriesLoaded?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
options: any;
|
|
13
|
+
mrnEntriesLoaded: boolean;
|
|
14
|
+
};
|
|
15
|
+
export default useOptionsGenerator;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface IUseDependentProps {
|
|
2
|
+
query: string | null;
|
|
3
|
+
objectPathId: string | null;
|
|
4
|
+
}
|
|
5
|
+
declare const useDependent: ({ query, objectPathId }: IUseDependentProps) => {
|
|
6
|
+
dependentControls: string[];
|
|
7
|
+
resolvedQuery: string;
|
|
8
|
+
isDisabled: boolean;
|
|
9
|
+
mrnEntriesLoaded: boolean;
|
|
10
|
+
};
|
|
11
|
+
export default useDependent;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FormControls } from "../../types";
|
|
2
|
+
interface IUseValueGeneratorProps {
|
|
3
|
+
query: string | null;
|
|
4
|
+
objectPathId: string | null;
|
|
5
|
+
}
|
|
6
|
+
interface IUseValueGeneratorWithContextProps extends IUseValueGeneratorProps {
|
|
7
|
+
formControls: FormControls;
|
|
8
|
+
}
|
|
9
|
+
declare const useValueGenerator: ({ query, formControls, objectPathId, }: IUseValueGeneratorWithContextProps) => {
|
|
10
|
+
value: any;
|
|
11
|
+
hasQuery: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare const useValueGeneratorWithContext: ({ query, objectPathId, }: IUseValueGeneratorProps) => {
|
|
14
|
+
value: any;
|
|
15
|
+
hasQuery: boolean;
|
|
16
|
+
};
|
|
17
|
+
export { useValueGenerator, useValueGeneratorWithContext };
|
|
18
|
+
export default useValueGeneratorWithContext;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import FormBuilder from "./components/FormBuilder/";
|
|
2
|
+
import Select from "./components/Select/";
|
|
3
|
+
import MultiSelect from "./components/MultiSelect/";
|
|
4
|
+
import Checkbox from "./components/Checkbox/";
|
|
5
|
+
import ControlWrapper from "./components/ControlWrapper/";
|
|
6
|
+
import FormFooter from "./components/FormFooter/";
|
|
7
|
+
import Input from "./components/Input/";
|
|
8
|
+
import InputFreeSolo from "./components/InputFreeSolo/";
|
|
9
|
+
import FormList from "./components/FormList/";
|
|
10
|
+
import FormGroup from "./components/FormGroup/";
|
|
11
|
+
import MrnInput from "./components/MrnInput/";
|
|
12
|
+
import PasswordInput from "./components/PasswordInput/";
|
|
13
|
+
import Textarea from "./components/Textarea/";
|
|
14
|
+
import { useValueGenerator } from "./hooks/useValueGenerator/useValueGenerator";
|
|
15
|
+
import "../src/styles/index.css";
|
|
16
|
+
export { FormBuilder, Select, MultiSelect, Checkbox, ControlWrapper, FormFooter, Input, InputFreeSolo, FormList, FormGroup, MrnInput, PasswordInput, Textarea, useValueGenerator };
|
|
17
|
+
export default FormBuilder;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface StyledVisibilityContainerProps {
|
|
2
|
+
visible: boolean;
|
|
3
|
+
error?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const StyledVisibilityContainer: import("styled-components").StyledComponent<"div", any, StyledVisibilityContainerProps, never>;
|
|
6
|
+
export declare const StyledVisibilityContainerProgress: import("styled-components").StyledComponent<"progress", any, StyledVisibilityContainerProps, never>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TextFieldProps } from "@mui/material";
|
|
2
|
+
declare const StyledTextField: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
variant?: import("@mui/material").TextFieldVariants;
|
|
4
|
+
} & Omit<import("@mui/material").FilledTextFieldProps | import("@mui/material").OutlinedTextFieldProps | import("@mui/material").StandardTextFieldProps, "variant"> & (import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & TextFieldProps), {}, {}>;
|
|
5
|
+
export default StyledTextField;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { FC, ReactElement } from "react";
|
|
2
|
+
import { RenderOptions } from "@testing-library/react";
|
|
3
|
+
import { FileUploaderConfig, FormControls, resolveUrl } from "./types";
|
|
4
|
+
interface IProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
controls?: FormControls;
|
|
7
|
+
fileUploaderConfig?: FileUploaderConfig;
|
|
8
|
+
resolveUrl?: resolveUrl;
|
|
9
|
+
}
|
|
10
|
+
export declare const TestWrapper: FC<IProps>;
|
|
11
|
+
declare const customRender: (ui: ReactElement, options?: Omit<RenderOptions, "wrapper">) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
|
|
12
|
+
export declare const renderViaFormBuilder: (controls: FormControls, fileUploaderConfig?: FileUploaderConfig, resolveUrl?: resolveUrl, options?: RenderOptions) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
|
|
13
|
+
export * from "@testing-library/react";
|
|
14
|
+
export { customRender as render };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { SxProps } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export type controlProps = {
|
|
4
|
+
formProps?: {
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
};
|
|
7
|
+
inputProps?: {
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
mrnProps?: {
|
|
11
|
+
disableMrnLink?: boolean;
|
|
12
|
+
};
|
|
13
|
+
selectProps?: {
|
|
14
|
+
sx?: SxProps;
|
|
15
|
+
textField?: {
|
|
16
|
+
sx?: SxProps;
|
|
17
|
+
};
|
|
18
|
+
listBox?: {
|
|
19
|
+
sx?: SxProps;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
footerProps?: {
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
container?: {
|
|
25
|
+
style?: React.CSSProperties;
|
|
26
|
+
};
|
|
27
|
+
submitButtonContainer?: {
|
|
28
|
+
style?: React.CSSProperties;
|
|
29
|
+
};
|
|
30
|
+
submitButton?: {
|
|
31
|
+
sx?: SxProps;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
addressProps?: {
|
|
35
|
+
style?: React.CSSProperties;
|
|
36
|
+
label?: {
|
|
37
|
+
style?: React.CSSProperties;
|
|
38
|
+
};
|
|
39
|
+
container?: {
|
|
40
|
+
style?: React.CSSProperties;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
controlWrapperProps?: {
|
|
44
|
+
style?: React.CSSProperties;
|
|
45
|
+
label?: {
|
|
46
|
+
style?: React.CSSProperties;
|
|
47
|
+
};
|
|
48
|
+
container?: {
|
|
49
|
+
style?: React.CSSProperties;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
groupProps?: {
|
|
53
|
+
style?: React.CSSProperties;
|
|
54
|
+
label?: {
|
|
55
|
+
style?: React.CSSProperties;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
listProps?: {
|
|
59
|
+
style?: React.CSSProperties;
|
|
60
|
+
addButton?: {
|
|
61
|
+
sx?: SxProps;
|
|
62
|
+
};
|
|
63
|
+
label?: {
|
|
64
|
+
style?: React.CSSProperties;
|
|
65
|
+
};
|
|
66
|
+
container?: {
|
|
67
|
+
style?: React.CSSProperties;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
export type CaseSensitivity<T extends string> = string extends T ? string : T extends `${infer F1}${infer F2}${infer R}` ? `${Uppercase<F1> | Lowercase<F1>}${Uppercase<F2> | Lowercase<F2>}${CaseSensitivity<R>}` : T extends `${infer F}${infer R}` ? `${Uppercase<F> | Lowercase<F>}${CaseSensitivity<R>}` : "";
|
|
2
|
+
export interface ControlCommons {
|
|
3
|
+
key?: string;
|
|
4
|
+
displayName?: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
mrnEntries?: {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
};
|
|
9
|
+
hasChanged?: boolean;
|
|
10
|
+
error?: {
|
|
11
|
+
message: string;
|
|
12
|
+
};
|
|
13
|
+
required?: boolean;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
hasEdited?: "edited" | "not-edited" | undefined;
|
|
16
|
+
"custom-attributes"?: CustomAttributes;
|
|
17
|
+
}
|
|
18
|
+
export type FormVisibility = "hidden" | "visible" | "expert" | {
|
|
19
|
+
hideOnCondition: string;
|
|
20
|
+
};
|
|
21
|
+
export type GenAiPrompt = {
|
|
22
|
+
displayValue: string;
|
|
23
|
+
promptTemplate: string;
|
|
24
|
+
profile?: string;
|
|
25
|
+
};
|
|
26
|
+
export type GenAiPrompts = GenAiPrompt[];
|
|
27
|
+
export interface CustomAttributes {
|
|
28
|
+
media?: string;
|
|
29
|
+
"mrn-ref"?: string;
|
|
30
|
+
"mrn-ref-display-field"?: string;
|
|
31
|
+
"mrn-ref-params"?: string;
|
|
32
|
+
"mrn-ref-mrn-field"?: string;
|
|
33
|
+
options?: InputFreeSoloOptions[];
|
|
34
|
+
mrnPreview?: {
|
|
35
|
+
displayField?: string;
|
|
36
|
+
linkDisabled?: boolean;
|
|
37
|
+
};
|
|
38
|
+
submenu?: {
|
|
39
|
+
icon?: string;
|
|
40
|
+
};
|
|
41
|
+
mrnSources?: MrnInputMultipleServices[];
|
|
42
|
+
defaultValue?: string;
|
|
43
|
+
defaultCollapseThreshold?: string;
|
|
44
|
+
visibility?: {
|
|
45
|
+
form?: FormVisibility;
|
|
46
|
+
detailView?: "hidden" | "visible";
|
|
47
|
+
table?: "hidden" | "visible";
|
|
48
|
+
};
|
|
49
|
+
editor?: "richtext" | "markdown" | "code" | "plate";
|
|
50
|
+
viewer?: "html" | "markdown";
|
|
51
|
+
tags?: string | string[];
|
|
52
|
+
genAiPrompts?: GenAiPrompts;
|
|
53
|
+
tooltip?: string;
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
}
|
|
56
|
+
export type MrnInputMultipleServices = {
|
|
57
|
+
name: string;
|
|
58
|
+
mrn: string;
|
|
59
|
+
query: string;
|
|
60
|
+
mrnField: string;
|
|
61
|
+
displayField: string;
|
|
62
|
+
[key: string]: any;
|
|
63
|
+
};
|
|
64
|
+
export interface GroupFormControl extends ControlCommons {
|
|
65
|
+
control: "group";
|
|
66
|
+
controls: FormControls;
|
|
67
|
+
}
|
|
68
|
+
export interface InputFormControl extends ControlCommons {
|
|
69
|
+
control: "input";
|
|
70
|
+
type: "plain" | "html" | "hex" | "color" | "mrn" | "url" | "date" | "time" | "datetime" | "number" | "email" | "password" | "geolocation";
|
|
71
|
+
placeholder?: string;
|
|
72
|
+
pattern?: string;
|
|
73
|
+
minLength?: number;
|
|
74
|
+
maxLength?: number;
|
|
75
|
+
step?: number;
|
|
76
|
+
}
|
|
77
|
+
export interface InputFreeSoloOptions {
|
|
78
|
+
value: string;
|
|
79
|
+
text?: string;
|
|
80
|
+
tooltip?: string;
|
|
81
|
+
default?: "true" | "false" | undefined;
|
|
82
|
+
}
|
|
83
|
+
export interface TextareaFormControl extends ControlCommons {
|
|
84
|
+
control: "textarea";
|
|
85
|
+
type: "plain" | "html" | "json";
|
|
86
|
+
}
|
|
87
|
+
export interface CheckboxFormControl extends ControlCommons {
|
|
88
|
+
control: "checkbox";
|
|
89
|
+
selected?: boolean;
|
|
90
|
+
}
|
|
91
|
+
export interface SelectFormControlOption extends Omit<ControlCommons, "displayName"> {
|
|
92
|
+
value: string;
|
|
93
|
+
text: string;
|
|
94
|
+
phone?: string;
|
|
95
|
+
selected?: boolean;
|
|
96
|
+
}
|
|
97
|
+
export interface SelectFormControl extends ControlCommons {
|
|
98
|
+
control: "select";
|
|
99
|
+
options?: SelectFormControlOption[];
|
|
100
|
+
multiple?: boolean;
|
|
101
|
+
}
|
|
102
|
+
export interface MrnInputServiceSelection {
|
|
103
|
+
}
|
|
104
|
+
export interface MultiSelectFormControl extends Omit<SelectFormControl, "value"> {
|
|
105
|
+
value?: string | string[];
|
|
106
|
+
}
|
|
107
|
+
export interface ListFormControl extends ControlCommons {
|
|
108
|
+
control: "list";
|
|
109
|
+
items?: FormControls[];
|
|
110
|
+
required?: boolean;
|
|
111
|
+
template: FormControls;
|
|
112
|
+
}
|
|
113
|
+
export type Control = "input" | "textarea" | "checkbox" | "select" | "list";
|
|
114
|
+
export type ControlType = "plain" | "html" | "hex" | "color" | "mrn" | "url" | "date" | "time" | "datetime" | "number" | "email" | "password" | "geolocation" | "json";
|
|
115
|
+
export type FormControl = InputFormControl | TextareaFormControl | CheckboxFormControl | SelectFormControl | MultiSelectFormControl | ListFormControl | GroupFormControl;
|
|
116
|
+
export interface FormControls {
|
|
117
|
+
[key: string]: FormControl;
|
|
118
|
+
}
|
|
119
|
+
type fileUploaderEndpoint = {
|
|
120
|
+
url: string;
|
|
121
|
+
name: string;
|
|
122
|
+
};
|
|
123
|
+
export type FileUploaderConfig = {
|
|
124
|
+
info?: string;
|
|
125
|
+
endpoints?: fileUploaderEndpoint[];
|
|
126
|
+
language?: string;
|
|
127
|
+
previewUrl?: (url: string) => Promise<any>;
|
|
128
|
+
authorizationHeader?: (url: string, method: string) => string;
|
|
129
|
+
};
|
|
130
|
+
export interface FormBuilderConfigLink {
|
|
131
|
+
href: string;
|
|
132
|
+
rel: string;
|
|
133
|
+
text: string;
|
|
134
|
+
}
|
|
135
|
+
export interface FormBuilderConfig {
|
|
136
|
+
method: "POST" | "GET";
|
|
137
|
+
links: FormBuilderConfigLink[];
|
|
138
|
+
error?: {
|
|
139
|
+
message: string;
|
|
140
|
+
};
|
|
141
|
+
items: FormControls;
|
|
142
|
+
}
|
|
143
|
+
export type OnChangeValueType = {
|
|
144
|
+
value?: string | string[] | number;
|
|
145
|
+
[key: string]: any;
|
|
146
|
+
};
|
|
147
|
+
export interface resolveUrl {
|
|
148
|
+
(mrn: string, params: string, opts: any): Promise<any>;
|
|
149
|
+
}
|
|
150
|
+
export type MessageType = string;
|
|
151
|
+
export type MessageStatus = "error" | "success";
|
|
152
|
+
export interface PostMessageProps {
|
|
153
|
+
message: MessageType;
|
|
154
|
+
profile: string;
|
|
155
|
+
}
|
|
156
|
+
export type PostMessageResponse = {
|
|
157
|
+
message: MessageType;
|
|
158
|
+
model: string;
|
|
159
|
+
usage: {
|
|
160
|
+
answer: string;
|
|
161
|
+
prompt: string;
|
|
162
|
+
total: string;
|
|
163
|
+
};
|
|
164
|
+
status: MessageStatus;
|
|
165
|
+
};
|
|
166
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MenuItem } from "..";
|
|
2
|
+
import type { FormControls } from "../../../types";
|
|
3
|
+
import type { controlGroups } from "../utils/detemineSubmenuTabs";
|
|
4
|
+
export declare const updateMenuIndexOnSubmit: (hasSubmenuAndError: boolean, cb: () => void) => void;
|
|
5
|
+
declare const useMenu: (formControls: FormControls, formSubmitted: boolean, isExpertMode: boolean) => {
|
|
6
|
+
activeFormControls: FormControls;
|
|
7
|
+
activeMenuItemIndex: number;
|
|
8
|
+
controlGroups: controlGroups;
|
|
9
|
+
hasSubmenu: boolean;
|
|
10
|
+
menuItems: MenuItem[];
|
|
11
|
+
setActiveMenuItemIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
12
|
+
};
|
|
13
|
+
export default useMenu;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type MenuItem = {
|
|
3
|
+
name: string;
|
|
4
|
+
icon: string;
|
|
5
|
+
};
|
|
6
|
+
interface IMenuProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
menuItems: MenuItem[];
|
|
9
|
+
activeMenuItemIndex: number;
|
|
10
|
+
onActiveMenuItemIndex: (key: number) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const Menu: ({ children, menuItems, activeMenuItemIndex, onActiveMenuItemIndex, }: IMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default Menu;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FormControl, FormVisibility } from "../../../types";
|
|
2
|
+
type createControl = {
|
|
3
|
+
displayName: string;
|
|
4
|
+
isGroup: boolean;
|
|
5
|
+
submenu?: {
|
|
6
|
+
icon?: string;
|
|
7
|
+
};
|
|
8
|
+
visibility?: "hidden" | "expert";
|
|
9
|
+
groupChildVisibility?: FormVisibility;
|
|
10
|
+
error?: {
|
|
11
|
+
message: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
declare const createControl: ({ displayName, isGroup, submenu, visibility, groupChildVisibility, error, }: createControl) => FormControl;
|
|
15
|
+
export default createControl;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MenuItem } from "../..";
|
|
2
|
+
import type { FormControls } from "../../../../types";
|
|
3
|
+
export type controlGroups = {
|
|
4
|
+
[key: string]: FormControls;
|
|
5
|
+
};
|
|
6
|
+
export declare const INFORMATION_TAB_KEY = "0";
|
|
7
|
+
export declare const INFO_MENU_ITEM: MenuItem;
|
|
8
|
+
export declare const hasControlWithSubmenu: (controls: FormControls, isExpertMode: boolean) => boolean;
|
|
9
|
+
export declare const determineMenuTabIndexWithControlError: (controlGroups: controlGroups) => number;
|
|
10
|
+
declare const determineSubmenuTabs: (controls: FormControls, isExpertMode: boolean) => FormControls | {
|
|
11
|
+
controlGroups: controlGroups;
|
|
12
|
+
menuItems: MenuItem[];
|
|
13
|
+
};
|
|
14
|
+
export default determineSubmenuTabs;
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromerce/formbuilder-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.658",
|
|
4
4
|
"description": "creates a form based on configuration",
|
|
5
5
|
"main": "dist/formbuilder.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"directories": {
|
|
8
8
|
"lib": "dist"
|
|
9
9
|
},
|
|
10
|
+
"exports": {
|
|
11
|
+
"./*": "./dist/*"
|
|
12
|
+
},
|
|
10
13
|
"files": [
|
|
11
14
|
"dist"
|
|
12
15
|
],
|
|
@@ -15,12 +18,13 @@
|
|
|
15
18
|
"storybook": "npm run lint; start-storybook -p 6006",
|
|
16
19
|
"build-storybook": "npm run lint; build-storybook -o ./docs/storybook",
|
|
17
20
|
"watch": "npm run lint && webpack watch --config webpack.dev.js",
|
|
18
|
-
"build": "npm run lint && npm run test && webpack build --config webpack.prod.js",
|
|
21
|
+
"build": "npm run lint && npm run test && tsc --declaration --emitDeclarationOnly && webpack build --config webpack.prod.js",
|
|
19
22
|
"build:analyze": "webpack build --analyze --config webpack.prod.js",
|
|
20
23
|
"lint": "eslint src/",
|
|
21
24
|
"clean": "rimraf dist",
|
|
22
25
|
"copy-component-styles": "copyfiles -u 1 ./src/components/**/*.module.scss ./dist",
|
|
23
26
|
"copy-global-styles": "copyfiles -u 1 ./src/styles/**/*.module.scss ./dist",
|
|
27
|
+
"build-typedef": "tsc --declaration --emitDeclarationOnly",
|
|
24
28
|
"build-tsc": "npm run clean && npm run copy-component-styles && npm run copy-global-styles && tsc -p tsconfig.json",
|
|
25
29
|
"format": "npx prettier --write 'src/**/*.{js,jsx,ts,tsx,json}'"
|
|
26
30
|
},
|