@oneblink/apps-react 13.4.0-beta.6 → 13.5.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/OneBlinkFormBase.js +6 -2
- package/dist/OneBlinkFormBase.js.map +1 -1
- package/dist/apps/services/api/drafts.js +5 -2
- package/dist/apps/services/api/drafts.js.map +1 -1
- package/dist/apps/services/prepareSubmissionData.d.ts +14 -0
- package/dist/apps/services/prepareSubmissionData.js +27 -0
- package/dist/apps/services/prepareSubmissionData.js.map +1 -1
- package/dist/components/renderer/OneBlinkFormElements.js +2 -2
- package/dist/components/renderer/OneBlinkFormElements.js.map +1 -1
- package/dist/form-elements/FormElementLookupButton.js +7 -2
- package/dist/form-elements/FormElementLookupButton.js.map +1 -1
- package/dist/form-elements/FormElementRepeatableSet.js +17 -7
- package/dist/form-elements/FormElementRepeatableSet.js.map +1 -1
- package/dist/form-elements/FormElementSection.js +2 -1
- package/dist/form-elements/FormElementSection.js.map +1 -1
- package/dist/hooks/useConditionalLogic.js +3 -1
- package/dist/hooks/useConditionalLogic.js.map +1 -1
- package/dist/hooks/useFormElementOptions.js +13 -2
- package/dist/hooks/useFormElementOptions.js.map +1 -1
- package/dist/hooks/useFormSubmissionModelContext.d.ts +19 -1
- package/dist/hooks/useFormSubmissionModelContext.js +60 -14
- package/dist/hooks/useFormSubmissionModelContext.js.map +1 -1
- package/dist/hooks/useStructuralSharing.d.ts +9 -0
- package/dist/hooks/useStructuralSharing.js +20 -0
- package/dist/hooks/useStructuralSharing.js.map +1 -0
- package/dist/services/form-validation/validators.js +3 -0
- package/dist/services/form-validation/validators.js.map +1 -1
- package/dist/types/form.d.ts +4 -0
- package/dist/types/form.js.map +1 -1
- package/dist/utils/replaceEqualDeep.d.ts +14 -0
- package/dist/utils/replaceEqualDeep.js +58 -0
- package/dist/utils/replaceEqualDeep.js.map +1 -0
- package/package.json +5 -3
package/dist/OneBlinkFormBase.js
CHANGED
|
@@ -14,6 +14,7 @@ import cleanFormSubmissionModel from './services/cleanFormSubmissionModel';
|
|
|
14
14
|
import PageFormElements from './components/renderer/PageFormElements';
|
|
15
15
|
import useFormValidation from './hooks/useFormValidation';
|
|
16
16
|
import useConditionalLogic from './hooks/useConditionalLogic';
|
|
17
|
+
import useStructuralSharing from './hooks/useStructuralSharing';
|
|
17
18
|
import usePages from './hooks/usePages';
|
|
18
19
|
import useLookups from './hooks/useLookups';
|
|
19
20
|
import { FormDefinitionContext } from './hooks/useFormDefinition';
|
|
@@ -291,7 +292,7 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
|
291
292
|
const [isShowingValidationErrorsCard, setIsShowingValidationErrorsCard] = React.useState(false);
|
|
292
293
|
const { validate } = useFormValidation(pages, definition.approvalSteps);
|
|
293
294
|
const recaptchaType = React.useMemo(() => captchaType !== null && captchaType !== void 0 ? captchaType : 'CHECKBOX', [captchaType]);
|
|
294
|
-
const
|
|
295
|
+
const unsharedFormElementsValidation = React.useMemo(() => !isReadOnly || expandedEditableFormElementIds !== undefined
|
|
295
296
|
? validate(submission, formElementsConditionallyShown, executedLookups !== null && executedLookups !== void 0 ? executedLookups : {}, recaptchaType, isOffline, audience, expandedEditableFormElementIds)
|
|
296
297
|
: undefined, [
|
|
297
298
|
isReadOnly,
|
|
@@ -304,6 +305,7 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
|
304
305
|
audience,
|
|
305
306
|
expandedEditableFormElementIds,
|
|
306
307
|
]);
|
|
308
|
+
const formElementsValidation = useStructuralSharing(unsharedFormElementsValidation);
|
|
307
309
|
React.useEffect(() => {
|
|
308
310
|
if (!formElementsValidation) {
|
|
309
311
|
setIsShowingValidationErrorsCard(false);
|
|
@@ -924,7 +926,9 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
|
924
926
|
'is-single-step': !isShowingMultiplePages,
|
|
925
927
|
}), 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 ===
|
|
926
928
|
currentPage.id, formId: definition.id, formElementsConditionallyShown: formElementsConditionallyShown, formElementsValidation: formElementsValidation, displayValidationMessages: hasAttemptedSubmit ||
|
|
927
|
-
isDisplayingCurrentPageError
|
|
929
|
+
(isDisplayingCurrentPageError &&
|
|
930
|
+
pageElement.id ===
|
|
931
|
+
currentPage.id), 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', {
|
|
928
932
|
'is-active': currentPage.id === page.id,
|
|
929
933
|
'is-completed': currentPageIndex > index,
|
|
930
934
|
'has-background-danger': currentPage.id !== page.id &&
|