optimized-react-component-library-xyz123 0.1.102 → 0.1.104
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/NewHelpMethodsStandard/ApplicationContentSlice/applicationContentSlice.d.ts +87 -0
- package/dist/NewHelpMethodsStandard/ApplicationContentSlice/applicationContentSlice.js +75 -0
- package/dist/NewHelpMethodsStandard/CookieHandler/cookieHandler.d.ts +12 -0
- package/dist/NewHelpMethodsStandard/CookieHandler/cookieHandler.js +42 -0
- package/dist/NewHelpMethodsStandard/CreateApiDataObject/CreateApiDataObject.d.ts +3 -0
- package/dist/NewHelpMethodsStandard/CreateApiDataObject/CreateApiDataObject.js +44 -0
- package/dist/NewHelpMethodsStandard/CreateApiDataObject/CreateApiDataObject.types.d.ts +8 -0
- package/dist/NewHelpMethodsStandard/CreateApiDataObject/CreateApiDataObject.types.js +1 -0
- package/dist/NewHelpMethodsStandard/CreateApiDataObject/index.d.ts +2 -0
- package/dist/NewHelpMethodsStandard/CreateApiDataObject/index.js +1 -0
- package/dist/NewHelpMethodsStandard/DoCategoriesAndQuestionsVisible/DoCategoriesAndQuestionsVisible.d.ts +3 -0
- package/dist/NewHelpMethodsStandard/DoCategoriesAndQuestionsVisible/DoCategoriesAndQuestionsVisible.js +11 -0
- package/dist/NewHelpMethodsStandard/DoCategoriesAndQuestionsVisible/index.d.ts +1 -0
- package/dist/NewHelpMethodsStandard/DoCategoriesAndQuestionsVisible/index.js +1 -0
- package/dist/NewHelpMethodsStandard/FocusElement/focusElement.d.ts +7 -0
- package/dist/NewHelpMethodsStandard/FocusElement/focusElement.js +16 -0
- package/dist/NewHelpMethodsStandard/GetIdsGroupCheckValidationTypes/getIdsGroupCheckValidationTypes.d.ts +5 -0
- package/dist/NewHelpMethodsStandard/GetIdsGroupCheckValidationTypes/getIdsGroupCheckValidationTypes.js +14 -0
- package/dist/NewHelpMethodsStandard/GroupQuestionByStepPreviewPage/GroupQuestionByStepPreviewPage.d.ts +3 -0
- package/dist/NewHelpMethodsStandard/GroupQuestionByStepPreviewPage/GroupQuestionByStepPreviewPage.js +12 -0
- package/dist/NewHelpMethodsStandard/GroupQuestionByStepPreviewPage/index.d.ts +1 -0
- package/dist/NewHelpMethodsStandard/GroupQuestionByStepPreviewPage/index.js +1 -0
- package/dist/NewHelpMethodsStandard/GroupQuestionsByStepCategoryGroup/GroupQuestionsByStepCategoryGroup.d.ts +3 -0
- package/dist/NewHelpMethodsStandard/GroupQuestionsByStepCategoryGroup/GroupQuestionsByStepCategoryGroup.js +61 -0
- package/dist/NewHelpMethodsStandard/GroupQuestionsByStepCategoryGroup/index.d.ts +1 -0
- package/dist/NewHelpMethodsStandard/GroupQuestionsByStepCategoryGroup/index.js +1 -0
- package/dist/NewHelpMethodsStandard/InputElements.types.d.ts +51 -0
- package/dist/NewHelpMethodsStandard/InputElements.types.js +12 -0
- package/dist/NewHelpMethodsStandard/IsDependsOnOtherQuestionTrue/IsDependsOnOtherQuestionTrue.d.ts +2 -0
- package/dist/NewHelpMethodsStandard/IsDependsOnOtherQuestionTrue/IsDependsOnOtherQuestionTrue.js +13 -0
- package/dist/NewHelpMethodsStandard/IsDependsOnOtherQuestionTrue/index.d.ts +1 -0
- package/dist/NewHelpMethodsStandard/IsDependsOnOtherQuestionTrue/index.js +1 -0
- package/dist/NewHelpMethodsStandard/QuestionHasValidationError/QuestionHasValidationError.d.ts +2 -0
- package/dist/NewHelpMethodsStandard/QuestionHasValidationError/QuestionHasValidationError.js +58 -0
- package/dist/NewHelpMethodsStandard/QuestionHasValidationError/QuestionHasValidationError.types.d.ts +5 -0
- package/dist/NewHelpMethodsStandard/QuestionHasValidationError/QuestionHasValidationError.types.js +1 -0
- package/dist/NewHelpMethodsStandard/QuestionHasValidationError/index.d.ts +1 -0
- package/dist/NewHelpMethodsStandard/QuestionHasValidationError/index.js +1 -0
- package/dist/NewHelpMethodsStandard/QuestionSlice/questionSlice.d.ts +138 -0
- package/dist/NewHelpMethodsStandard/QuestionSlice/questionSlice.js +166 -0
- package/dist/NewHelpMethodsStandard/ScriptHandler/scriptHandler.d.ts +7 -0
- package/dist/NewHelpMethodsStandard/ScriptHandler/scriptHandler.js +34 -0
- package/dist/NewHelpMethodsStandard/ValidationCheckAllVisibleQuestion/ValidationCheckAllVisibleQuestion.d.ts +2 -0
- package/dist/NewHelpMethodsStandard/ValidationCheckAllVisibleQuestion/ValidationCheckAllVisibleQuestion.js +17 -0
- package/dist/NewHelpMethodsStandard/ValidationCheckAllVisibleQuestion/index.d.ts +1 -0
- package/dist/NewHelpMethodsStandard/ValidationCheckAllVisibleQuestion/index.js +1 -0
- package/dist/NewHelpMethodsStandard/index.d.ts +15 -0
- package/dist/NewHelpMethodsStandard/index.js +15 -0
- package/dist/NewHelpMethodsStandard/useFormStatusModal/useFormStatusModal.d.ts +8 -0
- package/dist/NewHelpMethodsStandard/useFormStatusModal/useFormStatusModal.js +23 -0
- package/dist/NewHelpMethodsStandard/usePTSPageTitle/usePTSPageTitle.d.ts +1 -0
- package/dist/NewHelpMethodsStandard/usePTSPageTitle/usePTSPageTitle.js +19 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/AddFilesStandard.d.ts +5 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/AddFilesStandard.js +170 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/AddFilesStandard.types.d.ts +11 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/AddFilesStandard.types.js +1 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/ClipboardFilesStandard.d.ts +2 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/ClipboardFilesStandard.js +48 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/DropFilesStandard.d.ts +3 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/DropFilesStandard.js +16 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/ExploreFilesStandard.d.ts +3 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/ExploreFilesStandard.js +28 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/IndicatorStandard.d.ts +3 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/IndicatorStandard.js +15 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/ScreenReaderErrors.d.ts +7 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/ScreenReaderErrors.js +25 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/SelectedFilesStandard.d.ts +3 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/SelectedFilesStandard.js +71 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/index.d.ts +1 -0
- package/dist/NewInputComponentStandard/AddFilesStandard/index.js +1 -0
- package/dist/NewInputComponentStandard/FilesUploadStandard/FilesUploadStandard.d.ts +5 -0
- package/dist/NewInputComponentStandard/FilesUploadStandard/FilesUploadStandard.js +243 -0
- package/dist/NewInputComponentStandard/FilesUploadStandard/FilesUploadStandard.types.d.ts +21 -0
- package/dist/NewInputComponentStandard/FilesUploadStandard/FilesUploadStandard.types.js +1 -0
- package/dist/NewInputComponentStandard/FilesUploadStandard/index.d.ts +1 -0
- package/dist/NewInputComponentStandard/FilesUploadStandard/index.js +1 -0
- package/dist/NewInputComponentStandard/InputElements.types.d.ts +50 -0
- package/dist/NewInputComponentStandard/InputElements.types.js +12 -0
- package/dist/NewInputComponentStandard/MultipleCheckboxesStandard/MultipleCheckboxesStandard.d.ts +5 -0
- package/dist/NewInputComponentStandard/MultipleCheckboxesStandard/MultipleCheckboxesStandard.js +35 -0
- package/dist/NewInputComponentStandard/MultipleCheckboxesStandard/MultiplesCheckboxesStandard.types.d.ts +7 -0
- package/dist/NewInputComponentStandard/MultipleCheckboxesStandard/MultiplesCheckboxesStandard.types.js +1 -0
- package/dist/NewInputComponentStandard/MultipleCheckboxesStandard/index.d.ts +1 -0
- package/dist/NewInputComponentStandard/MultipleCheckboxesStandard/index.js +1 -0
- package/dist/NewInputComponentStandard/RadioMultipleStandard/RadioMultipleStandard.d.ts +5 -0
- package/dist/NewInputComponentStandard/RadioMultipleStandard/RadioMultipleStandard.js +19 -0
- package/dist/NewInputComponentStandard/RadioMultipleStandard/RadioMultipleStandard.types.d.ts +6 -0
- package/dist/NewInputComponentStandard/RadioMultipleStandard/RadioMultipleStandard.types.js +1 -0
- package/dist/NewInputComponentStandard/RadioMultipleStandard/index.d.ts +1 -0
- package/dist/NewInputComponentStandard/RadioMultipleStandard/index.js +1 -0
- package/dist/NewInputComponentStandard/TextAreaStandard/TextAreaStandard.d.ts +5 -0
- package/dist/NewInputComponentStandard/TextAreaStandard/TextAreaStandard.js +27 -0
- package/dist/NewInputComponentStandard/TextAreaStandard/TextAreaStandard.types.d.ts +7 -0
- package/dist/NewInputComponentStandard/TextAreaStandard/TextAreaStandard.types.js +1 -0
- package/dist/NewInputComponentStandard/TextAreaStandard/index.d.ts +1 -0
- package/dist/NewInputComponentStandard/TextAreaStandard/index.js +1 -0
- package/dist/NewInputComponentStandard/TextFieldStandard/TextFieldStandard.d.ts +4 -0
- package/dist/NewInputComponentStandard/TextFieldStandard/TextFieldStandard.js +19 -0
- package/dist/NewInputComponentStandard/TextFieldStandard/TextFieldStandard.types.d.ts +7 -0
- package/dist/NewInputComponentStandard/TextFieldStandard/TextFieldStandard.types.js +1 -0
- package/dist/NewInputComponentStandard/TextFieldStandard/index.d.ts +1 -0
- package/dist/NewInputComponentStandard/TextFieldStandard/index.js +1 -0
- package/dist/NewInputComponentStandard/index.d.ts +6 -0
- package/dist/NewInputComponentStandard/index.js +6 -0
- package/dist/NewRenderFormComponentStandard/RenderQuestion/RenderQuestion.d.ts +2 -0
- package/dist/NewRenderFormComponentStandard/RenderQuestion/RenderQuestion.js +7 -0
- package/dist/NewRenderFormComponentStandard/RenderQuestion/index.d.ts +1 -0
- package/dist/NewRenderFormComponentStandard/RenderQuestion/index.js +1 -0
- package/dist/NewRenderFormComponentStandard/RenderQuestionGroup/RenderQuestionGroup.d.ts +2 -0
- package/dist/NewRenderFormComponentStandard/RenderQuestionGroup/RenderQuestionGroup.js +27 -0
- package/dist/NewRenderFormComponentStandard/RenderQuestionGroup/index.d.ts +1 -0
- package/dist/NewRenderFormComponentStandard/RenderQuestionGroup/index.js +1 -0
- package/dist/NewRenderFormComponentStandard/index.d.ts +2 -0
- package/dist/NewRenderFormComponentStandard/index.js +2 -0
- package/dist/NewTextComponentStandard/CookieBanner/CookieBanner.d.ts +4 -0
- package/dist/NewTextComponentStandard/CookieBanner/CookieBanner.js +21 -0
- package/dist/NewTextComponentStandard/CookieBanner/CookieBanner.types.d.ts +8 -0
- package/dist/NewTextComponentStandard/CookieBanner/CookieBanner.types.js +1 -0
- package/dist/NewTextComponentStandard/EditPreviewLinkStandard/EditPreviewLinkStandard.d.ts +5 -0
- package/dist/NewTextComponentStandard/EditPreviewLinkStandard/EditPreviewLinkStandard.js +9 -0
- package/dist/NewTextComponentStandard/EditPreviewLinkStandard/EditPreviewLinkStandard.types.d.ts +6 -0
- package/dist/NewTextComponentStandard/EditPreviewLinkStandard/EditPreviewLinkStandard.types.js +1 -0
- package/dist/NewTextComponentStandard/EditPreviewLinkStandard/index.d.ts +1 -0
- package/dist/NewTextComponentStandard/EditPreviewLinkStandard/index.js +1 -0
- package/dist/NewTextComponentStandard/FooterStandard/FooterStandard.d.ts +5 -0
- package/dist/NewTextComponentStandard/FooterStandard/FooterStandard.js +22 -0
- package/dist/NewTextComponentStandard/FooterStandard/FooterStandard.types.d.ts +3 -0
- package/dist/NewTextComponentStandard/FooterStandard/FooterStandard.types.js +1 -0
- package/dist/NewTextComponentStandard/FooterStandard/index.d.ts +1 -0
- package/dist/NewTextComponentStandard/FooterStandard/index.js +1 -0
- package/dist/NewTextComponentStandard/FooterStandard/logoWhiteSvg.d.ts +4 -0
- package/dist/NewTextComponentStandard/FooterStandard/logoWhiteSvg.js +5 -0
- package/dist/NewTextComponentStandard/HeaderStandard/HeaderStandard.d.ts +5 -0
- package/dist/NewTextComponentStandard/HeaderStandard/HeaderStandard.js +24 -0
- package/dist/NewTextComponentStandard/HeaderStandard/HeaderStandard.types.d.ts +5 -0
- package/dist/NewTextComponentStandard/HeaderStandard/HeaderStandard.types.js +1 -0
- package/dist/NewTextComponentStandard/HeaderStandard/Icons.d.ts +14 -0
- package/dist/NewTextComponentStandard/HeaderStandard/Icons.js +8 -0
- package/dist/NewTextComponentStandard/HeaderStandard/index.d.ts +1 -0
- package/dist/NewTextComponentStandard/HeaderStandard/index.js +1 -0
- package/dist/NewTextComponentStandard/InfoOnlyStandard/InfoOnlyStandard.d.ts +5 -0
- package/dist/NewTextComponentStandard/InfoOnlyStandard/InfoOnlyStandard.js +24 -0
- package/dist/NewTextComponentStandard/InfoOnlyStandard/InfoOnlyStandard.types.d.ts +11 -0
- package/dist/NewTextComponentStandard/InfoOnlyStandard/InfoOnlyStandard.types.js +1 -0
- package/dist/NewTextComponentStandard/InfoOnlyStandard/index.d.ts +1 -0
- package/dist/NewTextComponentStandard/InfoOnlyStandard/index.js +1 -0
- package/dist/NewTextComponentStandard/InputElements.types.d.ts +60 -0
- package/dist/NewTextComponentStandard/InputElements.types.js +22 -0
- package/dist/NewTextComponentStandard/ModalStandard/ModalStandard.d.ts +5 -0
- package/dist/NewTextComponentStandard/ModalStandard/ModalStandard.js +19 -0
- package/dist/NewTextComponentStandard/ModalStandard/ModalStandard.types.d.ts +4 -0
- package/dist/NewTextComponentStandard/ModalStandard/ModalStandard.types.js +1 -0
- package/dist/NewTextComponentStandard/ModalStandard/index.d.ts +1 -0
- package/dist/NewTextComponentStandard/ModalStandard/index.js +1 -0
- package/dist/NewTextComponentStandard/PrincipleOfPublicityStandard/PrincipleOfPublicityStandard.d.ts +4 -0
- package/dist/NewTextComponentStandard/PrincipleOfPublicityStandard/PrincipleOfPublicityStandard.js +47 -0
- package/dist/NewTextComponentStandard/PrincipleOfPublicityStandard/PrincipleOfPublicityStandard.types.d.ts +3 -0
- package/dist/NewTextComponentStandard/PrincipleOfPublicityStandard/PrincipleOfPublicityStandard.types.js +1 -0
- package/dist/NewTextComponentStandard/PrincipleOfPublicityStandard/index.d.ts +1 -0
- package/dist/NewTextComponentStandard/PrincipleOfPublicityStandard/index.js +1 -0
- package/dist/NewTextComponentStandard/ServiceHeadlineAndBodyStandard/ServiceHeadlineAndBodyStandard.d.ts +5 -0
- package/dist/NewTextComponentStandard/ServiceHeadlineAndBodyStandard/ServiceHeadlineAndBodyStandard.js +7 -0
- package/dist/NewTextComponentStandard/ServiceHeadlineAndBodyStandard/ServiceHeadlineAndBodyStandard.types.d.ts +5 -0
- package/dist/NewTextComponentStandard/ServiceHeadlineAndBodyStandard/ServiceHeadlineAndBodyStandard.types.js +1 -0
- package/dist/NewTextComponentStandard/ServiceHeadlineAndBodyStandard/index.d.ts +1 -0
- package/dist/NewTextComponentStandard/ServiceHeadlineAndBodyStandard/index.js +1 -0
- package/dist/NewTextComponentStandard/SkipLinkStandard/SkipLinkStandard.d.ts +4 -0
- package/dist/NewTextComponentStandard/SkipLinkStandard/SkipLinkStandard.js +16 -0
- package/dist/NewTextComponentStandard/SkipLinkStandard/index.d.ts +1 -0
- package/dist/NewTextComponentStandard/SkipLinkStandard/index.js +1 -0
- package/dist/NewTextComponentStandard/StepperButtonsStandard/StepperButtonsStandard.d.ts +5 -0
- package/dist/NewTextComponentStandard/StepperButtonsStandard/StepperButtonsStandard.js +7 -0
- package/dist/NewTextComponentStandard/StepperButtonsStandard/StepperButtonsStandard.types.d.ts +8 -0
- package/dist/NewTextComponentStandard/StepperButtonsStandard/StepperButtonsStandard.types.js +1 -0
- package/dist/NewTextComponentStandard/StepperButtonsStandard/index.d.ts +1 -0
- package/dist/NewTextComponentStandard/StepperButtonsStandard/index.js +1 -0
- package/dist/NewTextComponentStandard/StepperStandard/StepperStandard.d.ts +5 -0
- package/dist/NewTextComponentStandard/StepperStandard/StepperStandard.js +14 -0
- package/dist/NewTextComponentStandard/StepperStandard/StepperStandard.types.d.ts +5 -0
- package/dist/NewTextComponentStandard/StepperStandard/StepperStandard.types.js +1 -0
- package/dist/NewTextComponentStandard/StepperStandard/index.d.ts +1 -0
- package/dist/NewTextComponentStandard/StepperStandard/index.js +1 -0
- package/dist/NewTextComponentStandard/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.d.ts +5 -0
- package/dist/NewTextComponentStandard/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.js +9 -0
- package/dist/NewTextComponentStandard/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.types.d.ts +5 -0
- package/dist/NewTextComponentStandard/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.types.js +1 -0
- package/dist/NewTextComponentStandard/TextHeadlineAndBodyStandard/index.d.ts +1 -0
- package/dist/NewTextComponentStandard/TextHeadlineAndBodyStandard/index.js +1 -0
- package/dist/NewTextComponentStandard/ValidationErrorSummaryList/ValidationErrorSummaryList.d.ts +4 -0
- package/dist/NewTextComponentStandard/ValidationErrorSummaryList/ValidationErrorSummaryList.js +61 -0
- package/dist/NewTextComponentStandard/ValidationErrorSummaryList/ValidationErrorSummaryList.types.d.ts +10 -0
- package/dist/NewTextComponentStandard/ValidationErrorSummaryList/ValidationErrorSummaryList.types.js +1 -0
- package/dist/NewTextComponentStandard/ValidationErrorSummaryList/index.d.ts +1 -0
- package/dist/NewTextComponentStandard/ValidationErrorSummaryList/index.js +1 -0
- package/dist/NewTextComponentStandard/index.d.ts +13 -0
- package/dist/NewTextComponentStandard/index.js +13 -0
- package/dist/NewTypesStandard/InitialState/InitialState.d.ts +4 -0
- package/dist/NewTypesStandard/InitialState/InitialState.js +79 -0
- package/dist/NewTypesStandard/InitialState/InitialState.types.d.ts +14 -0
- package/dist/NewTypesStandard/InitialState/InitialState.types.js +1 -0
- package/dist/NewTypesStandard/InitialState/index.d.ts +2 -0
- package/dist/NewTypesStandard/InitialState/index.js +1 -0
- package/dist/NewTypesStandard/TypesStandard.types.d.ts +107 -0
- package/dist/NewTypesStandard/TypesStandard.types.js +1 -0
- package/dist/NewTypesStandard/index.d.ts +3 -0
- package/dist/NewTypesStandard/index.js +1 -0
- package/dist/index.d.ts +5 -330
- package/dist/index.js +6 -2837
- package/dist/tabortN/303/244rKlarFilesUpload/FilesUpload.d.ts +18 -0
- package/dist/tabortN/303/244rKlarFilesUpload/FilesUpload.js +133 -0
- package/dist/tabortN/303/244rKlarFilesUpload/FilesUpload.types.d.ts +11 -0
- package/dist/tabortN/303/244rKlarFilesUpload/FilesUpload.types.js +1 -0
- package/dist/tabortN/303/244rKlarFilesUpload/index.d.ts +2 -0
- package/dist/tabortN/303/244rKlarFilesUpload/index.js +2 -0
- package/package.json +75 -74
- package/src/css/darkMode.css +0 -49
- package/src/css/styles.css +419 -164
- package/dist/index.css +0 -15
- package/dist/index.d.mts +0 -330
- package/dist/index.mjs +0 -2771
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
/** ----- Typer ----- */
|
|
3
|
+
export interface LanguageEntry {
|
|
4
|
+
language: string;
|
|
5
|
+
backButton: string;
|
|
6
|
+
forwardButton: string;
|
|
7
|
+
sendButton: string;
|
|
8
|
+
}
|
|
9
|
+
export interface LanguageSupportConfig {
|
|
10
|
+
activatedLanguage: string;
|
|
11
|
+
languageSupport: LanguageEntry[];
|
|
12
|
+
}
|
|
13
|
+
export interface LanguageState {
|
|
14
|
+
activatedLanguage: string;
|
|
15
|
+
languageSupport: LanguageEntry[];
|
|
16
|
+
languageSupportLoaded: boolean;
|
|
17
|
+
backButton: string;
|
|
18
|
+
forwardButton: string;
|
|
19
|
+
sendButton: string;
|
|
20
|
+
}
|
|
21
|
+
/** ----- Helpers ----- */
|
|
22
|
+
export declare const pickLang: (cfg: LanguageSupportConfig, lang: string) => LanguageEntry;
|
|
23
|
+
/** ----- Slice-fabrik (ingen app-specifik state/RootState här) ----- */
|
|
24
|
+
export declare const createLanguageSlice: (initialConfig: LanguageSupportConfig, options?: {
|
|
25
|
+
name?: string;
|
|
26
|
+
}) => import("@reduxjs/toolkit").Slice<LanguageState, {
|
|
27
|
+
setActivatedLanguage: (state: import("immer").WritableDraft<LanguageState>, action: PayloadAction<string>) => void;
|
|
28
|
+
setLabelsFromLanguageEntry: (state: import("immer").WritableDraft<LanguageState>, action: PayloadAction<Pick<LanguageEntry, "backButton" | "forwardButton" | "sendButton">>) => void;
|
|
29
|
+
replaceLanguageSupport: (state: import("immer").WritableDraft<LanguageState>, action: PayloadAction<LanguageSupportConfig>) => void;
|
|
30
|
+
}, string, string, import("@reduxjs/toolkit").SliceSelectors<LanguageState>>;
|
|
31
|
+
/** ----- Selector-fabrik (helt generisk, ingen RootState) ----- */
|
|
32
|
+
export declare const makeLanguageSelectors: <TState>(selectSlice: (state: TState) => LanguageState) => {
|
|
33
|
+
selectActivatedLanguage: (state: TState) => string;
|
|
34
|
+
selectLanguageSupportLoaded: (state: TState) => boolean;
|
|
35
|
+
selectLanguageSupport: (state: TState) => LanguageEntry[];
|
|
36
|
+
selectOverallContentState: (state: TState) => LanguageState;
|
|
37
|
+
selectOverallContentFromLanguageSupport: ((state: TState, activatedLanguage: string) => {
|
|
38
|
+
activatedLanguage: string;
|
|
39
|
+
languageSupport: LanguageEntry[];
|
|
40
|
+
languageSupportLoaded: boolean;
|
|
41
|
+
backButton: string;
|
|
42
|
+
forwardButton: string;
|
|
43
|
+
sendButton: string;
|
|
44
|
+
}) & {
|
|
45
|
+
clearCache: () => void;
|
|
46
|
+
resultsCount: () => number;
|
|
47
|
+
resetResultsCount: () => void;
|
|
48
|
+
} & {
|
|
49
|
+
resultFunc: (resultFuncArgs_0: LanguageState, resultFuncArgs_1: string) => {
|
|
50
|
+
activatedLanguage: string;
|
|
51
|
+
languageSupport: LanguageEntry[];
|
|
52
|
+
languageSupportLoaded: boolean;
|
|
53
|
+
backButton: string;
|
|
54
|
+
forwardButton: string;
|
|
55
|
+
sendButton: string;
|
|
56
|
+
};
|
|
57
|
+
memoizedResultFunc: ((resultFuncArgs_0: LanguageState, resultFuncArgs_1: string) => {
|
|
58
|
+
activatedLanguage: string;
|
|
59
|
+
languageSupport: LanguageEntry[];
|
|
60
|
+
languageSupportLoaded: boolean;
|
|
61
|
+
backButton: string;
|
|
62
|
+
forwardButton: string;
|
|
63
|
+
sendButton: string;
|
|
64
|
+
}) & {
|
|
65
|
+
clearCache: () => void;
|
|
66
|
+
resultsCount: () => number;
|
|
67
|
+
resetResultsCount: () => void;
|
|
68
|
+
};
|
|
69
|
+
lastResult: () => {
|
|
70
|
+
activatedLanguage: string;
|
|
71
|
+
languageSupport: LanguageEntry[];
|
|
72
|
+
languageSupportLoaded: boolean;
|
|
73
|
+
backButton: string;
|
|
74
|
+
forwardButton: string;
|
|
75
|
+
sendButton: string;
|
|
76
|
+
};
|
|
77
|
+
dependencies: [(state: TState) => LanguageState, (_: TState, activatedLanguage: string) => string];
|
|
78
|
+
recomputations: () => number;
|
|
79
|
+
resetRecomputations: () => void;
|
|
80
|
+
dependencyRecomputations: () => number;
|
|
81
|
+
resetDependencyRecomputations: () => void;
|
|
82
|
+
} & {
|
|
83
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
84
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
export type { PayloadAction } from '@reduxjs/toolkit';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// src/languageSlice.ts (i NPM-paketet)
|
|
2
|
+
import { createSlice, createSelector } from '@reduxjs/toolkit';
|
|
3
|
+
/** ----- Helpers ----- */
|
|
4
|
+
export const pickLang = (cfg, lang) => {
|
|
5
|
+
var _a;
|
|
6
|
+
return (_a = cfg.languageSupport.find((l) => l.language === lang)) !== null && _a !== void 0 ? _a : cfg.languageSupport[0];
|
|
7
|
+
};
|
|
8
|
+
/** ----- Slice-fabrik (ingen app-specifik state/RootState här) ----- */
|
|
9
|
+
export const createLanguageSlice = (initialConfig, options) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const name = (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : 'applicationContent';
|
|
12
|
+
const initialLang = pickLang(initialConfig, initialConfig.activatedLanguage);
|
|
13
|
+
const initialState = {
|
|
14
|
+
activatedLanguage: initialConfig.activatedLanguage,
|
|
15
|
+
languageSupport: initialConfig.languageSupport,
|
|
16
|
+
languageSupportLoaded: true,
|
|
17
|
+
backButton: initialLang.backButton,
|
|
18
|
+
forwardButton: initialLang.forwardButton,
|
|
19
|
+
sendButton: initialLang.sendButton,
|
|
20
|
+
};
|
|
21
|
+
const slice = createSlice({
|
|
22
|
+
name,
|
|
23
|
+
initialState,
|
|
24
|
+
reducers: {
|
|
25
|
+
setActivatedLanguage: (state, action) => {
|
|
26
|
+
state.activatedLanguage = action.payload;
|
|
27
|
+
const lang = pickLang({ activatedLanguage: state.activatedLanguage, languageSupport: state.languageSupport }, action.payload);
|
|
28
|
+
state.backButton = lang.backButton;
|
|
29
|
+
state.forwardButton = lang.forwardButton;
|
|
30
|
+
state.sendButton = lang.sendButton;
|
|
31
|
+
},
|
|
32
|
+
setLabelsFromLanguageEntry: (state, action) => {
|
|
33
|
+
state.backButton = action.payload.backButton;
|
|
34
|
+
state.forwardButton = action.payload.forwardButton;
|
|
35
|
+
state.sendButton = action.payload.sendButton;
|
|
36
|
+
},
|
|
37
|
+
replaceLanguageSupport: (state, action) => {
|
|
38
|
+
state.languageSupport = action.payload.languageSupport;
|
|
39
|
+
state.activatedLanguage = action.payload.activatedLanguage;
|
|
40
|
+
const lang = pickLang(action.payload, action.payload.activatedLanguage);
|
|
41
|
+
state.backButton = lang.backButton;
|
|
42
|
+
state.forwardButton = lang.forwardButton;
|
|
43
|
+
state.sendButton = lang.sendButton;
|
|
44
|
+
state.languageSupportLoaded = true;
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
return slice;
|
|
49
|
+
};
|
|
50
|
+
/** ----- Selector-fabrik (helt generisk, ingen RootState) ----- */
|
|
51
|
+
export const makeLanguageSelectors = (selectSlice) => {
|
|
52
|
+
const selectState = selectSlice;
|
|
53
|
+
const selectActivatedLanguage = (state) => selectState(state).activatedLanguage;
|
|
54
|
+
const selectLanguageSupportLoaded = (state) => selectState(state).languageSupportLoaded;
|
|
55
|
+
const selectLanguageSupport = (state) => selectState(state).languageSupport;
|
|
56
|
+
const selectOverallContentState = (state) => selectState(state);
|
|
57
|
+
const selectOverallContentFromLanguageSupport = createSelector([selectState, (_, activatedLanguage) => activatedLanguage], (applicationContent, activatedLanguage) => {
|
|
58
|
+
const match = applicationContent.languageSupport.find((l) => l.language === activatedLanguage);
|
|
59
|
+
if (!match)
|
|
60
|
+
return { ...applicationContent };
|
|
61
|
+
return {
|
|
62
|
+
...applicationContent,
|
|
63
|
+
backButton: match.backButton,
|
|
64
|
+
forwardButton: match.forwardButton,
|
|
65
|
+
sendButton: match.sendButton,
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
return {
|
|
69
|
+
selectActivatedLanguage,
|
|
70
|
+
selectLanguageSupportLoaded,
|
|
71
|
+
selectLanguageSupport,
|
|
72
|
+
selectOverallContentState,
|
|
73
|
+
selectOverallContentFromLanguageSupport,
|
|
74
|
+
};
|
|
75
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface CookieConsentConfig {
|
|
2
|
+
cookieName: string;
|
|
3
|
+
choiceKey: string;
|
|
4
|
+
expiryYears?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const createCookieConsent: (config: CookieConsentConfig) => {
|
|
7
|
+
acceptCookies: () => void;
|
|
8
|
+
rejectCookies: () => void;
|
|
9
|
+
areCookiesAccepted: () => boolean;
|
|
10
|
+
hasChoiceBeenMade: () => boolean;
|
|
11
|
+
clearChoiceFromSession: () => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const getCookie = (name) => {
|
|
2
|
+
const match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
|
|
3
|
+
return match ? match[2] : null;
|
|
4
|
+
};
|
|
5
|
+
const setCookie = (name, value, expirationDate) => {
|
|
6
|
+
let cookieString = `${name}=${value}; path=/; SameSite=Strict`;
|
|
7
|
+
if (expirationDate) {
|
|
8
|
+
cookieString += `; expires=${expirationDate.toUTCString()}`;
|
|
9
|
+
}
|
|
10
|
+
if (window.location.protocol === 'https:') {
|
|
11
|
+
cookieString += '; Secure';
|
|
12
|
+
}
|
|
13
|
+
document.cookie = cookieString;
|
|
14
|
+
};
|
|
15
|
+
const removeCookie = (name) => {
|
|
16
|
+
const pastDate = new Date(0);
|
|
17
|
+
setCookie(name, '', pastDate);
|
|
18
|
+
};
|
|
19
|
+
export const createCookieConsent = (config) => {
|
|
20
|
+
const { cookieName, choiceKey, expiryYears = 1 } = config;
|
|
21
|
+
const acceptCookies = () => {
|
|
22
|
+
const expires = new Date();
|
|
23
|
+
expires.setFullYear(expires.getFullYear() + expiryYears);
|
|
24
|
+
setCookie(cookieName, 'true', expires);
|
|
25
|
+
localStorage.setItem(cookieName, 'true');
|
|
26
|
+
};
|
|
27
|
+
const rejectCookies = () => {
|
|
28
|
+
removeCookie(cookieName);
|
|
29
|
+
localStorage.removeItem(cookieName);
|
|
30
|
+
sessionStorage.setItem(choiceKey, 'true');
|
|
31
|
+
};
|
|
32
|
+
const areCookiesAccepted = () => getCookie(cookieName) === 'true';
|
|
33
|
+
const hasChoiceBeenMade = () => sessionStorage.getItem(choiceKey) === 'true';
|
|
34
|
+
const clearChoiceFromSession = () => sessionStorage.removeItem(choiceKey);
|
|
35
|
+
return {
|
|
36
|
+
acceptCookies,
|
|
37
|
+
rejectCookies,
|
|
38
|
+
areCookiesAccepted,
|
|
39
|
+
hasChoiceBeenMade,
|
|
40
|
+
clearChoiceFromSession,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const normalize = (str) => {
|
|
2
|
+
return str.toString().toLowerCase().replace(/\s+/g, '');
|
|
3
|
+
};
|
|
4
|
+
function CreateApiDataObject(data, specialMappedQuestions, translatedAnswers) {
|
|
5
|
+
return data.reduce((acc, question) => {
|
|
6
|
+
var _a;
|
|
7
|
+
let translatedAnswer = question.answer;
|
|
8
|
+
if (question.answer &&
|
|
9
|
+
typeof question.answer === 'string' &&
|
|
10
|
+
Array.isArray(question.options) &&
|
|
11
|
+
question.mappingId &&
|
|
12
|
+
specialMappedQuestions.has(question.mappingId)) {
|
|
13
|
+
const answerNormalized = normalize(question.answer);
|
|
14
|
+
const matchingIds = question.options
|
|
15
|
+
.filter((option) => answerNormalized.includes(normalize(option.label)))
|
|
16
|
+
.map((option) => `^${option.id}^`);
|
|
17
|
+
if (matchingIds.length > 0) {
|
|
18
|
+
translatedAnswer = matchingIds.join(',');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const shouldTranslate = question.mappingId
|
|
23
|
+
? translatedAnswers[question.mappingId]
|
|
24
|
+
: undefined;
|
|
25
|
+
translatedAnswer = shouldTranslate
|
|
26
|
+
? shouldTranslate[question.answer] || question.answer
|
|
27
|
+
: question.answer;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
...acc,
|
|
31
|
+
...(question.mappingId &&
|
|
32
|
+
question.isDisplayed &&
|
|
33
|
+
question.answer && {
|
|
34
|
+
[question.mappingId]: translatedAnswer,
|
|
35
|
+
}),
|
|
36
|
+
...(question.questionType === 'AddFiles' &&
|
|
37
|
+
((_a = question.files) === null || _a === void 0 ? void 0 : _a.length) &&
|
|
38
|
+
question.files.length > 0 && {
|
|
39
|
+
files: question.files,
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
}, {});
|
|
43
|
+
}
|
|
44
|
+
export default CreateApiDataObject;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CreateApiDataObject';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import isDependsOnOtherQuestionTrue from '../IsDependsOnOtherQuestionTrue';
|
|
2
|
+
const doCategoriesAndQuestionsVisible = (questions, validationErrorsList) => {
|
|
3
|
+
const updatedQuestions = questions.map((question) => {
|
|
4
|
+
const hasLinkedConditions = question.dependsOnOtherQuestion && question.dependsOnOtherQuestion.length > 0;
|
|
5
|
+
const isVisible = hasLinkedConditions ? isDependsOnOtherQuestionTrue(questions, question) : true; // om inget länkat, visa frågan
|
|
6
|
+
const hasError = validationErrorsList.includes(question.id);
|
|
7
|
+
return { ...question, visible: isVisible, hasValidationError: hasError };
|
|
8
|
+
});
|
|
9
|
+
return updatedQuestions;
|
|
10
|
+
};
|
|
11
|
+
export default doCategoriesAndQuestionsVisible;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './DoCategoriesAndQuestionsVisible';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './DoCategoriesAndQuestionsVisible';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sätter fokus på ett element med givet id (eller HTMLElement),
|
|
3
|
+
* sätter tabindex="-1" om inte redan finns, och scrollar dit smidigt.
|
|
4
|
+
*
|
|
5
|
+
* @param target Elementets id (t.ex. 'main-content') eller själva elementet.
|
|
6
|
+
*/
|
|
7
|
+
export declare const focusElement: (target: string | HTMLElement | null) => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sätter fokus på ett element med givet id (eller HTMLElement),
|
|
3
|
+
* sätter tabindex="-1" om inte redan finns, och scrollar dit smidigt.
|
|
4
|
+
*
|
|
5
|
+
* @param target Elementets id (t.ex. 'main-content') eller själva elementet.
|
|
6
|
+
*/
|
|
7
|
+
export const focusElement = (target) => {
|
|
8
|
+
const element = typeof target === 'string' ? document.getElementById(target) : target;
|
|
9
|
+
if (!element)
|
|
10
|
+
return;
|
|
11
|
+
if (!element.hasAttribute('tabindex')) {
|
|
12
|
+
element.setAttribute('tabindex', '-1');
|
|
13
|
+
}
|
|
14
|
+
element.focus();
|
|
15
|
+
element.scrollIntoView({ behavior: 'smooth' });
|
|
16
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plockar ut alla id:n från validationType som börjar med "groupCheck-"
|
|
3
|
+
*/
|
|
4
|
+
const getIdsGroupCheckValidationTypes = (validationType) => {
|
|
5
|
+
if (!(validationType === null || validationType === void 0 ? void 0 : validationType.length))
|
|
6
|
+
return [];
|
|
7
|
+
const ids = validationType
|
|
8
|
+
.filter((t) => t.startsWith('groupCheck-'))
|
|
9
|
+
.flatMap((t) => t.split('-').slice(1))
|
|
10
|
+
.map((s) => Number(s))
|
|
11
|
+
.filter((n) => Number.isFinite(n));
|
|
12
|
+
return Array.from(new Set(ids));
|
|
13
|
+
};
|
|
14
|
+
export { getIdsGroupCheckValidationTypes };
|
package/dist/NewHelpMethodsStandard/GroupQuestionByStepPreviewPage/GroupQuestionByStepPreviewPage.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function groupQuestionByStepPreviewPage(steps, questions) {
|
|
2
|
+
return steps
|
|
3
|
+
.map(step => {
|
|
4
|
+
const filteredQuestions = questions.filter(q => q.step === step.step && q.isDisplayed);
|
|
5
|
+
return {
|
|
6
|
+
step,
|
|
7
|
+
questions: filteredQuestions,
|
|
8
|
+
};
|
|
9
|
+
})
|
|
10
|
+
.filter(group => group.questions.length > 0);
|
|
11
|
+
}
|
|
12
|
+
export default groupQuestionByStepPreviewPage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './GroupQuestionByStepPreviewPage';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './GroupQuestionByStepPreviewPage';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import doCategoriesAndQuestionsVisible from '../DoCategoriesAndQuestionsVisible';
|
|
2
|
+
function groupQuestionsByStepCategoryGroup(questions, steps, validationErrorsList) {
|
|
3
|
+
var _a, _b;
|
|
4
|
+
const formatedQuestions = doCategoriesAndQuestionsVisible(questions, validationErrorsList);
|
|
5
|
+
const result = [];
|
|
6
|
+
const stepsMap = new Map();
|
|
7
|
+
formatedQuestions.forEach((question) => {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
const step = (_a = question.step) !== null && _a !== void 0 ? _a : 0;
|
|
10
|
+
const category = ((_b = question.categoryLabel) === null || _b === void 0 ? void 0 : _b.trim()) || 'Okänd kategori';
|
|
11
|
+
const groupId = question.questionGroupId || 'unknown';
|
|
12
|
+
if (!stepsMap.has(step)) {
|
|
13
|
+
stepsMap.set(step, new Map());
|
|
14
|
+
}
|
|
15
|
+
const categoryMap = stepsMap.get(step);
|
|
16
|
+
if (!categoryMap.has(category)) {
|
|
17
|
+
categoryMap.set(category, new Map());
|
|
18
|
+
}
|
|
19
|
+
const groupMap = categoryMap.get(category);
|
|
20
|
+
if (!groupMap.has(groupId)) {
|
|
21
|
+
groupMap.set(groupId, []);
|
|
22
|
+
}
|
|
23
|
+
groupMap.get(groupId).push(question);
|
|
24
|
+
});
|
|
25
|
+
for (const [step, categoryMap] of Array.from(stepsMap.entries())) {
|
|
26
|
+
const categories = [];
|
|
27
|
+
for (const [category, groupMap] of Array.from(categoryMap.entries())) {
|
|
28
|
+
const questionGroups = [];
|
|
29
|
+
for (const [groupId, questions] of Array.from(groupMap.entries())) {
|
|
30
|
+
questionGroups.push({
|
|
31
|
+
questionGroupId: groupId,
|
|
32
|
+
questionGroupType: questions[0].questionGroupType,
|
|
33
|
+
questions,
|
|
34
|
+
legend: questions[0].categoryDescription,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const isVisible = questionGroups.some((group) => group.questions.some((question) => question.visible));
|
|
38
|
+
categories.push({
|
|
39
|
+
category,
|
|
40
|
+
visible: isVisible,
|
|
41
|
+
isDisplayed: isVisible,
|
|
42
|
+
questionGroups,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const stepHeadline = ((_a = steps.find((s) => s.step === step)) === null || _a === void 0 ? void 0 : _a.stepHeadline) || undefined;
|
|
46
|
+
const stepDescription = ((_b = steps.find((s) => s.step === step)) === null || _b === void 0 ? void 0 : _b.stepDescription) || undefined;
|
|
47
|
+
result.push({
|
|
48
|
+
step,
|
|
49
|
+
stepHeadline,
|
|
50
|
+
stepDescription,
|
|
51
|
+
categories,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
result.push({
|
|
55
|
+
step: steps.length,
|
|
56
|
+
stepHeadline: steps[steps.length - 1].stepHeadline,
|
|
57
|
+
stepDescription: steps[steps.length - 1].stepDescription,
|
|
58
|
+
});
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
export default groupQuestionsByStepCategoryGroup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './GroupQuestionsByStepCategoryGroup';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './GroupQuestionsByStepCategoryGroup';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface IQuestionObjectStandard {
|
|
2
|
+
Id?: number;
|
|
3
|
+
Order?: number;
|
|
4
|
+
Step?: number;
|
|
5
|
+
Category?: string;
|
|
6
|
+
CategoryOrder?: number;
|
|
7
|
+
CategoryDescription?: string;
|
|
8
|
+
CategoryMandatory?: boolean;
|
|
9
|
+
QuestionPreviewLabel?: string;
|
|
10
|
+
GroupId?: number;
|
|
11
|
+
Question?: string;
|
|
12
|
+
Answer?: string;
|
|
13
|
+
PlaceholderText?: string;
|
|
14
|
+
About?: string;
|
|
15
|
+
Mandatory?: boolean;
|
|
16
|
+
Dependent?: boolean;
|
|
17
|
+
DependentOnOrder?: number;
|
|
18
|
+
QuestionType?: string;
|
|
19
|
+
InputName?: string;
|
|
20
|
+
Options?: Array<any>;
|
|
21
|
+
isTouched?: boolean;
|
|
22
|
+
error?: boolean;
|
|
23
|
+
errorType?: Array<string>;
|
|
24
|
+
errorSpecificMessage?: string;
|
|
25
|
+
Files?: Array<any>;
|
|
26
|
+
MoreFields?: Array<string>;
|
|
27
|
+
questionArray?: Array<any>;
|
|
28
|
+
answerColumnArray?: Array<any>;
|
|
29
|
+
languageSupport?: Array<{}>;
|
|
30
|
+
Width?: string;
|
|
31
|
+
InputSize?: string;
|
|
32
|
+
CheckboxOrder?: number;
|
|
33
|
+
Details?: string;
|
|
34
|
+
Info?: string;
|
|
35
|
+
MaxLength?: number;
|
|
36
|
+
HideQuestion?: boolean;
|
|
37
|
+
InputType?: string;
|
|
38
|
+
autocomplete?: string;
|
|
39
|
+
HideMaxLength?: boolean;
|
|
40
|
+
isDisplayed?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare enum IQuestionTypeStandard {
|
|
43
|
+
TextFieldStandard = 0,
|
|
44
|
+
TextAreaStandard = 1,
|
|
45
|
+
SelectStandard = 2,
|
|
46
|
+
RadioStandard = 3,
|
|
47
|
+
CheckboxStandard = 4,
|
|
48
|
+
DatePickerStandard = 5,
|
|
49
|
+
FileUploadStandard = 6,
|
|
50
|
+
QuestionHasValidationError = 7
|
|
51
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//Todo: Ej implementerad i IQuestionObject
|
|
2
|
+
export var IQuestionTypeStandard;
|
|
3
|
+
(function (IQuestionTypeStandard) {
|
|
4
|
+
IQuestionTypeStandard[IQuestionTypeStandard["TextFieldStandard"] = 0] = "TextFieldStandard";
|
|
5
|
+
IQuestionTypeStandard[IQuestionTypeStandard["TextAreaStandard"] = 1] = "TextAreaStandard";
|
|
6
|
+
IQuestionTypeStandard[IQuestionTypeStandard["SelectStandard"] = 2] = "SelectStandard";
|
|
7
|
+
IQuestionTypeStandard[IQuestionTypeStandard["RadioStandard"] = 3] = "RadioStandard";
|
|
8
|
+
IQuestionTypeStandard[IQuestionTypeStandard["CheckboxStandard"] = 4] = "CheckboxStandard";
|
|
9
|
+
IQuestionTypeStandard[IQuestionTypeStandard["DatePickerStandard"] = 5] = "DatePickerStandard";
|
|
10
|
+
IQuestionTypeStandard[IQuestionTypeStandard["FileUploadStandard"] = 6] = "FileUploadStandard";
|
|
11
|
+
IQuestionTypeStandard[IQuestionTypeStandard["QuestionHasValidationError"] = 7] = "QuestionHasValidationError";
|
|
12
|
+
})(IQuestionTypeStandard || (IQuestionTypeStandard = {}));
|
package/dist/NewHelpMethodsStandard/IsDependsOnOtherQuestionTrue/IsDependsOnOtherQuestionTrue.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const isDependsOnOtherQuestionTrue = (data, question) => {
|
|
2
|
+
const isParentTrue = (questionId, questionArrayAnswerId, answer) => {
|
|
3
|
+
const parent = data.find((q) => q.id === questionId);
|
|
4
|
+
if (!parent)
|
|
5
|
+
return false;
|
|
6
|
+
return ((questionArrayAnswerId !== undefined && parent.questionArrayAnswerId === questionArrayAnswerId) ||
|
|
7
|
+
parent.answer === answer);
|
|
8
|
+
};
|
|
9
|
+
if (!question.dependsOnOtherQuestion || question.dependsOnOtherQuestion.length === 0)
|
|
10
|
+
return false;
|
|
11
|
+
return question.dependsOnOtherQuestion.some((conditions) => conditions.every((cond) => isParentTrue(cond.LinkedToQuestionId, cond.questionArrayAnswerId, cond.Answer)));
|
|
12
|
+
};
|
|
13
|
+
export default isDependsOnOtherQuestionTrue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './IsDependsOnOtherQuestionTrue';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './IsDependsOnOtherQuestionTrue';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { isValid, parseISO } from 'date-fns';
|
|
2
|
+
const questionHasValidationError = (questionObject, arrayOfQuestionObjects) => {
|
|
3
|
+
var _a, _b, _c, _d, _e;
|
|
4
|
+
let error = false;
|
|
5
|
+
if (questionObject.isQuestionMandatory) {
|
|
6
|
+
if (questionObject.isTouched === false) {
|
|
7
|
+
error = true;
|
|
8
|
+
}
|
|
9
|
+
if (questionObject.answer.trim() === '') {
|
|
10
|
+
error = true;
|
|
11
|
+
}
|
|
12
|
+
if (questionObject.answer === 'false' &&
|
|
13
|
+
((_a = questionObject.validationType) === null || _a === void 0 ? void 0 : _a.find((e) => e === 'mustBeTrue'))) {
|
|
14
|
+
error = true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (((_b = questionObject.validationType) === null || _b === void 0 ? void 0 : _b.find((e) => e === 'email')) &&
|
|
18
|
+
(questionObject.isQuestionMandatory || questionObject.answer !== '')) {
|
|
19
|
+
const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
20
|
+
if (!emailRegex.test(questionObject.answer)) {
|
|
21
|
+
error = true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (((_c = questionObject.validationType) === null || _c === void 0 ? void 0 : _c.find((e) => e === 'fourNumbers')) &&
|
|
25
|
+
(questionObject.isQuestionMandatory || questionObject.answer !== '')) {
|
|
26
|
+
const fourNumbersRegex = /^\d{4}$/.test(questionObject.answer);
|
|
27
|
+
if (!fourNumbersRegex) {
|
|
28
|
+
error = true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (((_d = questionObject.validationType) === null || _d === void 0 ? void 0 : _d.find((e) => e === 'isDateFormatValid')) &&
|
|
32
|
+
questionObject.answer !== '') {
|
|
33
|
+
const regex = /^\d{4}-\d{2}-\d{2}$/;
|
|
34
|
+
if (!regex.test(questionObject.answer)) {
|
|
35
|
+
error = true;
|
|
36
|
+
}
|
|
37
|
+
const isValidDate = (dateString) => {
|
|
38
|
+
const date = parseISO(dateString);
|
|
39
|
+
return isValid(date);
|
|
40
|
+
};
|
|
41
|
+
const validDate = isValidDate(questionObject.answer);
|
|
42
|
+
if (!validDate) {
|
|
43
|
+
error = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const groupCheckError = (_e = questionObject.validationType) === null || _e === void 0 ? void 0 : _e.find((e) => e.startsWith('groupCheck-'));
|
|
47
|
+
if (groupCheckError) {
|
|
48
|
+
const ids = groupCheckError.replace('groupCheck-', '').split('-');
|
|
49
|
+
const relatedAnswers = ids.map((id) => { var _a; return (_a = arrayOfQuestionObjects.find((q) => { var _a; return ((_a = q.id) === null || _a === void 0 ? void 0 : _a.toString()) === id; })) === null || _a === void 0 ? void 0 : _a.answer; });
|
|
50
|
+
const currentAnswer = questionObject.answer;
|
|
51
|
+
const allAnswers = [...relatedAnswers, currentAnswer];
|
|
52
|
+
if (allAnswers.every((ans) => ans === '')) {
|
|
53
|
+
error = true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return error;
|
|
57
|
+
};
|
|
58
|
+
export default questionHasValidationError;
|
package/dist/NewHelpMethodsStandard/QuestionHasValidationError/QuestionHasValidationError.types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './QuestionHasValidationError';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './QuestionHasValidationError';
|