@oneblink/apps-react 13.0.0-beta.12 → 13.0.0-beta.13
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/OneBlinkFormBase.js +7 -8
- package/dist/OneBlinkFormBase.js.map +1 -1
- package/dist/OneBlinkReadOnlyForm.d.ts +2 -1
- package/dist/OneBlinkReadOnlyForm.js +2 -1
- package/dist/OneBlinkReadOnlyForm.js.map +1 -1
- package/dist/form-elements/FormElementForm.js +7 -1
- package/dist/form-elements/FormElementForm.js.map +1 -1
- package/dist/hooks/useFormValidation.d.ts +1 -1
- package/dist/hooks/useFormValidation.js.map +1 -1
- package/dist/services/dynamic-elements.d.ts +7 -0
- package/dist/services/dynamic-elements.js +16 -2
- package/dist/services/dynamic-elements.js.map +1 -1
- package/dist/services/form-validation/getApproverEditableFormElementIds.js.map +1 -1
- package/dist/services/form-validation/validateSubmission.js +5 -3
- package/dist/services/form-validation/validateSubmission.js.map +1 -1
- package/dist/utils/read-only-form-elements.d.ts +22 -0
- package/dist/utils/read-only-form-elements.js +70 -0
- package/dist/utils/read-only-form-elements.js.map +1 -1
- package/package.json +1 -1
package/dist/OneBlinkFormBase.js
CHANGED
|
@@ -46,6 +46,7 @@ import { useUserProfileForInjectablesOutsideContext } from './hooks/useUserProfi
|
|
|
46
46
|
import { ValidationIconConfigurationContext } from './hooks/useValidationIconConfiguration';
|
|
47
47
|
import { Clickable } from './components/Clickable';
|
|
48
48
|
import { EditableFormElementIdsContext } from './hooks/useEditableFormElementIds';
|
|
49
|
+
import { expandEditableFormElementIds } from './utils/read-only-form-elements';
|
|
49
50
|
import { useRegisterFormSubmissionAttempt } from './hooks/useFormSubmissionAttempt';
|
|
50
51
|
import { useRegisterFormIsDirty, useRegisterAllowFormNavigation, FormMarkDirtyContextProvider, } from './hooks/useFormIsDirty';
|
|
51
52
|
var AttachmentUploadStatus;
|
|
@@ -160,6 +161,7 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
|
160
161
|
const pagesWithDynamicElements = React.useMemo(() => {
|
|
161
162
|
return injectDynamicElements(pages);
|
|
162
163
|
}, [pages]);
|
|
164
|
+
const expandedEditableFormElementIds = React.useMemo(() => expandEditableFormElementIds(editableFormElementIds, pagesWithDynamicElements), [editableFormElementIds, pagesWithDynamicElements]);
|
|
163
165
|
// #endregion
|
|
164
166
|
//
|
|
165
167
|
//
|
|
@@ -289,8 +291,8 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
|
289
291
|
const [isShowingValidationErrorsCard, setIsShowingValidationErrorsCard] = React.useState(false);
|
|
290
292
|
const { validate } = useFormValidation(pages, definition.approvalSteps);
|
|
291
293
|
const recaptchaType = React.useMemo(() => captchaType !== null && captchaType !== void 0 ? captchaType : 'CHECKBOX', [captchaType]);
|
|
292
|
-
const formElementsValidation = React.useMemo(() => !isReadOnly ||
|
|
293
|
-
? validate(submission, formElementsConditionallyShown, executedLookups !== null && executedLookups !== void 0 ? executedLookups : {}, recaptchaType, isOffline, audience,
|
|
294
|
+
const formElementsValidation = React.useMemo(() => !isReadOnly || expandedEditableFormElementIds !== undefined
|
|
295
|
+
? validate(submission, formElementsConditionallyShown, executedLookups !== null && executedLookups !== void 0 ? executedLookups : {}, recaptchaType, isOffline, audience, expandedEditableFormElementIds)
|
|
294
296
|
: undefined, [
|
|
295
297
|
isReadOnly,
|
|
296
298
|
validate,
|
|
@@ -300,7 +302,7 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
|
300
302
|
recaptchaType,
|
|
301
303
|
isOffline,
|
|
302
304
|
audience,
|
|
303
|
-
|
|
305
|
+
expandedEditableFormElementIds,
|
|
304
306
|
]);
|
|
305
307
|
React.useEffect(() => {
|
|
306
308
|
if (!formElementsValidation) {
|
|
@@ -750,10 +752,7 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
|
750
752
|
else {
|
|
751
753
|
handleSubmit(e, false);
|
|
752
754
|
}
|
|
753
|
-
}, [
|
|
754
|
-
handleSubmit,
|
|
755
|
-
hostAttemptPhase,
|
|
756
|
-
]);
|
|
755
|
+
}, [handleSubmit, hostAttemptPhase]);
|
|
757
756
|
// #endregion
|
|
758
757
|
//
|
|
759
758
|
//
|
|
@@ -923,7 +922,7 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
|
923
922
|
'is-active': isStepsHeaderActive,
|
|
924
923
|
}), onClick: toggleStepsNavigation }), _jsxs("div", { className: "steps", children: [_jsx("div", { className: clsx('steps-content', {
|
|
925
924
|
'is-single-step': !isShowingMultiplePages,
|
|
926
|
-
}), children: _jsx(InjectPagesContext.Provider, { value: handlePagesLookupResult, children: _jsx(GoogleMapsApiKeyContext.Provider, { value: googleMapsApiKey, children: _jsx(AbnLookupAuthenticationGuidContext.Provider, { value: abnLookupAuthenticationGuid, children: _jsx(ValidationIconConfigurationContext.Provider, { value: validationIcon, children: _jsx(CaptchaContext.Provider, { value: captchaContextValue, children: _jsx(AttachmentBlobsProvider, { children: _jsx(FormIsReadOnlyContext.Provider, { value: isReadOnly, children: _jsx(EditableFormElementIdsContext.Provider, { value:
|
|
925
|
+
}), children: _jsx(InjectPagesContext.Provider, { value: handlePagesLookupResult, children: _jsx(GoogleMapsApiKeyContext.Provider, { value: googleMapsApiKey, children: _jsx(AbnLookupAuthenticationGuidContext.Provider, { value: abnLookupAuthenticationGuid, children: _jsx(ValidationIconConfigurationContext.Provider, { value: validationIcon, children: _jsx(CaptchaContext.Provider, { value: captchaContextValue, children: _jsx(AttachmentBlobsProvider, { children: _jsx(FormIsReadOnlyContext.Provider, { value: isReadOnly, children: _jsx(EditableFormElementIdsContext.Provider, { value: expandedEditableFormElementIds, children: _jsx(FormAudienceContext.Provider, { value: audience, children: _jsx(TaskContext.Provider, { value: taskContextValue, children: _jsx(OnUploadAttachmentContext.Provider, { value: onUploadAttachment, children: visiblePages.map((pageElement) => (_jsx(PageFormElements, { isActive: pageElement.id ===
|
|
927
926
|
currentPage.id, formId: definition.id, formElementsConditionallyShown: formElementsConditionallyShown, formElementsValidation: formElementsValidation, displayValidationMessages: hasAttemptedSubmit ||
|
|
928
927
|
isDisplayingCurrentPageError, pageElement: pageElement, onChange: handleChange, model: submission, setFormSubmission: setFormSubmission, sectionState: sectionState }, pageElement.id))) }) }) }) }) }) }) }) }) }) }) }) }), isShowingMultiplePages && (_jsxs("div", { className: "steps-actions", children: [_jsx("div", { className: "steps-action", children: _jsxs("button", { type: "button", onClick: goToPreviousPage, disabled: isFirstVisiblePage, className: "button is-light cypress-pages-previous", children: [_jsx("span", { className: "icon", children: _jsx(MaterialIcon, { children: "keyboard_arrow_left" }) }), _jsx("span", { children: "Back" })] }) }), _jsx("div", { className: "step-progress-mobile cypress-steps-mobile", children: visiblePages.map((page, index) => (_jsx("div", { className: clsx('step-progress-mobile-dot', {
|
|
929
928
|
'is-active': currentPage.id === page.id,
|