udp-stencil-component-library 25.18.2-beta.7 → 25.18.2-beta.9
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/cjs/date-time-renderer_7.cjs.entry.js +2 -2
- package/dist/cjs/{enums-CgcTuQjC.js → enums-B3aaCQaV.js} +3 -3
- package/dist/cjs/{enums-CgcTuQjC.js.map → enums-B3aaCQaV.js.map} +1 -1
- package/dist/cjs/form-metadata-display_8.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/question-configs-renderer_4.cjs.entry.js +2 -2
- package/dist/cjs/stencil-library.cjs.js +1 -1
- package/dist/cjs/{udp-forms-builder-question-template-BMMpObLX.js → udp-forms-builder-question-template-BS5ijef_.js} +3 -3
- package/dist/cjs/{udp-forms-builder-question-template-BMMpObLX.js.map → udp-forms-builder-question-template-BS5ijef_.js.map} +1 -1
- package/dist/cjs/udp-forms-builder.cjs.entry.js +2 -2
- package/dist/cjs/udp-forms-follow-up-list-card.cjs.entry.js +1 -1
- package/dist/cjs/udp-forms-list-card.cjs.entry.js +1 -1
- package/dist/cjs/udp-forms-list.cjs.entry.js +1 -1
- package/dist/cjs/udp-forms-renderer.cjs.entry.js +592 -604
- package/dist/cjs/udp-forms-renderer.entry.cjs.js.map +1 -1
- package/dist/cjs/udp-forms-ui.cjs.entry.js +2 -5
- package/dist/cjs/udp-forms-ui.entry.cjs.js.map +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-ui/udp-forms-ui.js +1 -4
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-ui/udp-forms-ui.js.map +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils/comments-crud-utils.js +153 -0
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils/comments-crud-utils.js.map +1 -0
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils/repeated-section-utils.js +104 -0
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils/repeated-section-utils.js.map +1 -0
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/{udp-forms-renderer-utils.js → udp-forms-renderer-utils/utils.js} +48 -2
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils/utils.js.map +1 -0
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer.js +187 -310
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer.js.map +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/enums.js +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/enums.js.map +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-handler/UdpFormHandler.js +13 -13
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-handler/UdpFormHandler.js.map +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/FormSubmissionHandler.js +142 -0
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/FormSubmissionHandler.js.map +1 -0
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/FormSubmissionHandlerFactory.js +3 -10
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/FormSubmissionHandlerFactory.js.map +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/IFormSubmissionHandler.js.map +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/types.js.map +1 -1
- package/dist/components/enums.js +1 -1
- package/dist/components/enums.js.map +1 -1
- package/dist/components/udp-forms-renderer.js +593 -608
- package/dist/components/udp-forms-renderer.js.map +1 -1
- package/dist/components/udp-forms-ui2.js +1 -4
- package/dist/components/udp-forms-ui2.js.map +1 -1
- package/dist/docs.json +1 -1
- package/dist/esm/date-time-renderer_7.entry.js +2 -2
- package/dist/esm/{enums-DHT5wSnX.js → enums-D5dod6Ie.js} +3 -3
- package/dist/esm/{enums-DHT5wSnX.js.map → enums-D5dod6Ie.js.map} +1 -1
- package/dist/esm/form-metadata-display_8.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/question-configs-renderer_4.entry.js +2 -2
- package/dist/esm/stencil-library.js +1 -1
- package/dist/esm/{udp-forms-builder-question-template-D6ADNZEG.js → udp-forms-builder-question-template-BsYOju9V.js} +3 -3
- package/dist/esm/{udp-forms-builder-question-template-D6ADNZEG.js.map → udp-forms-builder-question-template-BsYOju9V.js.map} +1 -1
- package/dist/esm/udp-forms-builder.entry.js +2 -2
- package/dist/esm/udp-forms-follow-up-list-card.entry.js +1 -1
- package/dist/esm/udp-forms-list-card.entry.js +1 -1
- package/dist/esm/udp-forms-list.entry.js +1 -1
- package/dist/esm/udp-forms-renderer.entry.js +592 -604
- package/dist/esm/udp-forms-renderer.entry.js.map +1 -1
- package/dist/esm/udp-forms-ui.entry.js +2 -5
- package/dist/esm/udp-forms-ui.entry.js.map +1 -1
- package/dist/stencil-library/date-time-renderer_7.entry.js +1 -1
- package/dist/stencil-library/enums-D5dod6Ie.js +2 -0
- package/dist/stencil-library/{enums-DHT5wSnX.js.map → enums-D5dod6Ie.js.map} +1 -1
- package/dist/stencil-library/form-metadata-display_8.entry.js +1 -1
- package/dist/stencil-library/question-configs-renderer_4.entry.js +1 -1
- package/dist/stencil-library/stencil-library.esm.js +1 -1
- package/dist/stencil-library/{udp-forms-builder-question-template-D6ADNZEG.js → udp-forms-builder-question-template-BsYOju9V.js} +2 -2
- package/dist/stencil-library/{udp-forms-builder-question-template-D6ADNZEG.js.map → udp-forms-builder-question-template-BsYOju9V.js.map} +1 -1
- package/dist/stencil-library/udp-forms-builder.entry.js +1 -1
- package/dist/stencil-library/udp-forms-follow-up-list-card.entry.js +1 -1
- package/dist/stencil-library/udp-forms-follow-up-list-card.entry.js.map +1 -1
- package/dist/stencil-library/udp-forms-list-card.entry.js +1 -1
- package/dist/stencil-library/udp-forms-list-card.entry.js.map +1 -1
- package/dist/stencil-library/udp-forms-list.entry.js +1 -1
- package/dist/stencil-library/udp-forms-renderer.entry.esm.js.map +1 -1
- package/dist/stencil-library/udp-forms-renderer.entry.js +1 -1
- package/dist/stencil-library/udp-forms-renderer.entry.js.map +1 -1
- package/dist/stencil-library/udp-forms-ui.entry.esm.js.map +1 -1
- package/dist/stencil-library/udp-forms-ui.entry.js +1 -1
- package/dist/stencil-library/udp-forms-ui.entry.js.map +1 -1
- package/dist/types/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils/comments-crud-utils.d.ts +31 -0
- package/dist/types/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils/repeated-section-utils.d.ts +17 -0
- package/dist/types/components/forms/udp-forms/udp-forms-renderer/{udp-forms-renderer-utils.d.ts → udp-forms-renderer-utils/utils.d.ts} +4 -0
- package/dist/types/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer.d.ts +6 -10
- package/dist/types/components/forms/udp-forms/udp-forms-utils/enums.d.ts +1 -1
- package/dist/types/components/forms/udp-forms/udp-forms-utils/form-handler/UdpFormHandler.d.ts +5 -6
- package/dist/types/components/forms/udp-forms/udp-forms-utils/form-submission-handler/FormSubmissionHandler.d.ts +42 -0
- package/dist/types/components/forms/udp-forms/udp-forms-utils/form-submission-handler/FormSubmissionHandlerFactory.d.ts +1 -1
- package/dist/types/components/forms/udp-forms/udp-forms-utils/form-submission-handler/IFormSubmissionHandler.d.ts +44 -5
- package/dist/types/components/forms/udp-forms/udp-forms-utils/types.d.ts +16 -0
- package/package.json +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils.js.map +0 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/PrivateFormSubmissionHandler.js +0 -264
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/PrivateFormSubmissionHandler.js.map +0 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/PublicFormSubmissionHandler.js +0 -63
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/PublicFormSubmissionHandler.js.map +0 -1
- package/dist/stencil-library/enums-DHT5wSnX.js +0 -2
- package/dist/types/components/forms/udp-forms/udp-forms-utils/form-submission-handler/PrivateFormSubmissionHandler.d.ts +0 -131
- package/dist/types/components/forms/udp-forms/udp-forms-utils/form-submission-handler/PublicFormSubmissionHandler.d.ts +0 -15
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-CGCOXUJE.js');
|
|
4
|
-
var enums = require('./enums-
|
|
4
|
+
var enums = require('./enums-B3aaCQaV.js');
|
|
5
5
|
var utils = require('./utils-Bp02BX38.js');
|
|
6
6
|
var iconUtils = require('./iconUtils-BuDk48Xh.js');
|
|
7
7
|
require('./iconMapping-CkHR1LGY.js');
|
|
@@ -136,10 +136,8 @@ const UdpFormsUi = class {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
watchIsSaving(newValue, oldValue) {
|
|
139
|
-
console.log('isSaving watcher triggered:', { oldValue, newValue, saveErrorMessage: this.saveErrorMessage });
|
|
140
139
|
// When isSaving changes from true to false (save completed successfully)
|
|
141
140
|
if (oldValue === true && newValue === false && !this.saveErrorMessage) {
|
|
142
|
-
console.log('Setting showSavedMessage to true');
|
|
143
141
|
this.showSavedMessage = true;
|
|
144
142
|
// Clear any existing timeout
|
|
145
143
|
if (this.savedMessageTimeoutId) {
|
|
@@ -147,7 +145,6 @@ const UdpFormsUi = class {
|
|
|
147
145
|
}
|
|
148
146
|
// Hide the "Saved" message after 5 seconds
|
|
149
147
|
this.savedMessageTimeoutId = setTimeout(() => {
|
|
150
|
-
console.log('Hiding saved message after 5 seconds');
|
|
151
148
|
this.showSavedMessage = false;
|
|
152
149
|
}, 5000);
|
|
153
150
|
}
|
|
@@ -227,7 +224,7 @@ const UdpFormsUi = class {
|
|
|
227
224
|
}, question: question, questionNumber: num, value: (_g = (_f = (_e = (_d = this.currentValues) === null || _d === void 0 ? void 0 : _d[sectionKey]) === null || _e === void 0 ? void 0 : _e[question.name]) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : '', disabled: this.disabled, readonly: this.readonly, key: question.questionIdentifierKey, currentValues: this.currentValues, clientUserInfo: this.clientUserInfo, udpFormSubmission: this.udpFormSubmission })));
|
|
228
225
|
}))))));
|
|
229
226
|
}), ((_r = this.udpFormSubmission) === null || _r === void 0 ? void 0 : _r.status) != enums.UdpFormsSubmissionStatusEnum.Submitted && (index.h("div", { class: "footer" }, index.h("input", { disabled: this.isLoading || this.disabled || this.readonly, type: "submit", value: "Submit", class: "submit", id: "udpRecord-udp-forms-renderer-Submit", onClick: () => {
|
|
230
|
-
console.log('Submit button clicked');
|
|
227
|
+
// console.log('Submit button clicked');
|
|
231
228
|
// Let the form handle the submit naturally
|
|
232
229
|
} })))))) : (
|
|
233
230
|
//if the form has been submit, display success message with a button to trigger the action associated to the form
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"udp-forms-ui.entry.cjs.js","sources":["src/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-ui/udp-forms-ui.css?tag=udp-forms-ui&encapsulation=shadow","src/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-ui/udp-forms-ui.tsx"],"sourcesContent":[".background {\n background-color: var(--gray-01);\n height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n}\n\n.item {\n padding-bottom: var(--spacing-02);\n /* margin-bottom: var(--spacing-05); */\n}\n\n.items {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-05);\n padding-top: var(--spacing-02);\n padding-bottom: var(--spacing-02);\n}\n\n.footer {\n display: flex;\n flex-direction: row-reverse;\n}\n\n.submit {\n background-color: var(--primary-color);\n box-sizing: border-box;\n border: none;\n color: white;\n padding: 8px 24px;\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n transition: background-color 0.3s ease;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n text-decoration: none;\n min-width: 48px;\n min-height: 24px;\n /* Default size */\n}\n\n.submit:disabled {\n background-color: var(--gray-05);\n cursor: default;\n}\n\n.submit-card {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n/* .form-section-content */\n.form-section-content {\n margin-bottom: var(--spacing-05);\n background-color: white;\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: var(--spacing-05);\n}\n\n.form-container {\n padding-top: var(--spacing-05);\n padding-bottom: var(--spacing-05);\n min-height: 100px;\n}\n\n.form-section-block {\n margin-bottom: var(--spacing-05);\n}\n\n.form-section-header {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n background-color: var(--primary-color, #000);\n color: var(--primary-contrast-text, #FFF);\n padding: var(--spacing-04, 16px) var(--spacing-05, 24px);\n align-items: center;\n min-height: var(--spacing-10, 60px);\n}\n\n.form-section-text {\n margin-bottom: var(--spacing-03);\n}\n\n.center-div {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n\n.finish-button {\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n/* .header */\n.form-renderer-header {\n padding: var(--spacing-05) var(--spacing-05);\n background-color: var(--primary-color-dark, #000);\n color: var(--primary-contrast-text, #FFF);\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.header-content {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: var(--spacing-03);\n}\n\n.header-text {\n flex: 1;\n min-width: 0;\n /* Allow text to shrink */\n}\n\n/* Save button visibility - JavaScript controlled */\n.header-save-button {\n display: block;\n /* Always available, component controls its own visibility */\n}\n\n.floating-save-button {\n display: block;\n /* Always available, component controls its own visibility */\n}\n\n.error-banner {\n background-color: #fdecea;\n border: 1px solid #f5c6cb;\n color: #a94442;\n padding: 12px;\n margin-bottom: 12px;\n border-radius: 4px;\n}\n\n\n/*\n * Save button visibility is now controlled by JavaScript-based overlap detection\n * in the udp-save-draft-button component. This provides real-time detection of\n * overlaps with form content, accounting for menu drawers and dynamic layouts.\n *\n * The component automatically switches between floating and inline modes based on\n * actual element positions and available space, not viewport breakpoints.\n */\n\n/* Mobile layout adjustments */\n@media (max-width: 768px) {\n .header-content {\n flex-direction: column;\n align-items: stretch;\n gap: var(--spacing-02);\n }\n\n .header-text {\n margin-bottom: var(--spacing-02);\n }\n}\n\n/* Small height screens: Always use header button */\n@media (max-height: 600px) {\n .header-save-button {\n display: block;\n }\n\n .floating-save-button {\n display: none;\n }\n}\n\n.auto-save-status {\n margin-top: var(--spacing-02);\n padding: var(--spacing-01) 0;\n font-size: 12px;\n opacity: 0.8;\n}","import { Component, h, Prop, State, Element, Watch, Event, EventEmitter } from '@stencil/core';\nimport { Guid, UdpFormQuestion } from '../../udp-forms-utils/types';\nimport { UdpFormsFieldTypeEnum, UdpFormsSubmissionStatusEnum } from '../../udp-forms-utils/enums';\nimport { fontOverrideMapping, overrideFont } from '../../udp-forms-utils/utils';\nimport { getIconFromName } from '../../../../data-display/icons/iconUtils';\nimport { UdpFormSubmission } from '../../udp-forms-utils/classes/UdpFormSubmission';\nimport { UdpForm } from '../../udp-forms-utils/classes/UdpForm';\n\n\n@Component({\n tag: 'udp-forms-ui',\n styleUrl: 'udp-forms-ui.css',\n shadow: true,\n})\nexport class UdpFormsUi {\n @Prop() udpForm: UdpForm;\n @Prop() currentValues: { [name: string]: any } = {};\n @Prop() udpFormSubmission: UdpFormSubmission\n @Prop() submitSuccessful: boolean = false;\n @Prop() isLoading: boolean = false;\n @Prop() isSaving: boolean = false;\n @Prop() saveErrorMessage: string | null = null;\n @Prop() showAutoSaveStatus: boolean = false;\n @Prop() disabled: boolean = false;\n @Prop() readonly: boolean = false;\n @Prop() handleSubmit: (values: any) => Promise<void>;\n @Prop() handleChange: (values: { [name: string]: any }) => void;\n @Prop() handleSave: (values: { [name: string]: any }) => Promise<void>;\n @Prop() handleAction: (actionId: Guid, params: Object) => void;\n @Prop() handleFinish: () => void;\n @Prop() clientUserInfo: { id: string | null; displayName: string | null; email: string | null } = {\n id: null,\n displayName: null,\n email: null,\n }; \n @Prop() isSubmitted: boolean = false;\n @Prop() dynamicSections: any[];\n @Prop() duplicateRepeatableSection: any;\n @Prop() deleteRepeatableSection: any;\n @Prop() isShowManualSaveIcon: boolean = false;\n @Prop() performBackgroundSaveAndUpdateLocalSubmissionState: (values: { [name: string]: any }) => Promise<void>;\n\n @State() showSavedMessage: boolean = false;\n\n @Event() formDirtyChange: EventEmitter<boolean>;\n\n @Element() el: HTMLElement;\n\n\n @State() isDialogOpen: boolean = false;\n @State() dialogAction: () => void;\n @State() dialogMessage: string = 'Are you sure you want to delete this section? This section contains links to follow-up forms. Deleting it will remove those links.';\n \n\n private savedMessageTimeoutId: any;\n\n private titleId: string = 'udp-forms-title';\n private descriptionId: string = 'udp-forms-description';\n\n componentDidLoad() {\n this.overrideStyles();\n }\n\n componentDidUpdate() {\n this.overrideStyles();\n }\n\n disconnectedCallback() {\n // Clean up timeout when component is destroyed\n if (this.savedMessageTimeoutId) {\n clearTimeout(this.savedMessageTimeoutId);\n }\n }\n\n @Watch('isSaving')\n watchIsSaving(newValue: boolean, oldValue: boolean) {\n console.log('isSaving watcher triggered:', { oldValue, newValue, saveErrorMessage: this.saveErrorMessage });\n\n // When isSaving changes from true to false (save completed successfully)\n if (oldValue === true && newValue === false && !this.saveErrorMessage) {\n console.log('Setting showSavedMessage to true');\n this.showSavedMessage = true;\n\n // Clear any existing timeout\n if (this.savedMessageTimeoutId) {\n clearTimeout(this.savedMessageTimeoutId);\n }\n\n // Hide the \"Saved\" message after 5 seconds\n this.savedMessageTimeoutId = setTimeout(() => {\n console.log('Hiding saved message after 5 seconds');\n this.showSavedMessage = false;\n }, 5000);\n }\n }\n\n overrideStyles() {\n const shadowRoot = (this as any).el?.shadowRoot;\n shadowRoot?.querySelectorAll('unity-typography').forEach(element => {\n const styleOverride =\n element.id === this.titleId ? this.udpForm?.styleOverrides?.titleText : element.id === this.descriptionId ? this.udpForm?.styleOverrides?.paragraphText : ({} as any);\n\n if (styleOverride?.fontFamily && fontOverrideMapping[styleOverride.fontFamily]) {\n overrideFont(element, fontOverrideMapping[styleOverride.fontFamily]);\n }\n if (styleOverride?.variant) {\n element.setAttribute('variant', styleOverride.variant);\n }\n });\n }\n\n private isSectionContainsFollowUpFormLink(sectionKey: string): boolean {\n const sectionObject = this.udpFormSubmission.data.submissionResponseData[sectionKey]\n\n for (const [_key, questionObject] of Object.entries(sectionObject) as any) {\n if (questionObject?.metadata && questionObject.metadata?.followUpFormSubmissionId) {\n return true;\n }\n }\n\n return false;\n }\n\n render() {\n if (this.isLoading) {\n return (\n <udp-linear-loader />\n );\n }\n\n if (!this.udpForm) {\n return (\n <div class=\"error-banner\">\n <unity-typography variant=\"body2\">Error Loading Form</unity-typography>\n </div>\n );\n }\n\n let questionNumber = 1;\n\n const sectionSet = new Set();\n this.udpForm.formQuestions.forEach(fq => sectionSet.add(fq.section));\n // const orderedSectionNumbers = [...sectionSet].sort((a: number, b: number) => a - b);\n\n const hiddenQuestionTypes = [UdpFormsFieldTypeEnum.Hidden, UdpFormsFieldTypeEnum.Paragraph];\n\n const backgroundOverrides: { backgroundImage?: string | null; backgroundColor?: string | null } = {};\n if (this.udpForm?.styleOverrides?.background?.backgroundImage) {\n // uncomment when we want to allow background images\n //backgroundOverrides.backgroundImage = `url(${this.udpForm?.styleOverrides?.background?.backgroundImage})`;\n } else if (this.udpForm?.styleOverrides?.background?.backgroundColor) {\n backgroundOverrides.backgroundColor = this.udpForm?.styleOverrides?.background?.backgroundColor;\n }\n return (\n <div class={'background'} style={backgroundOverrides}>\n <udp-container maxWidth=\"md\">\n <div class=\"form-container\">\n {!this.submitSuccessful ? (\n \n <stencil-form\n handleSubmit={this.handleSubmit}\n initialValues={this.currentValues}\n handleChange={this.handleChange}\n onDirtyChange={event => this.formDirtyChange.emit(event.detail)}\n >\n {this.readonly && \n (<div class=\"error-banner\">\n <unity-typography variant=\"body2\">View Only Mode. The contents of this form cannot be changed.</unity-typography>\n </div>)}\n <fluent-dialog\n open={this.isDialogOpen}\n message={this.dialogMessage}\n labelOne={'Confirm'}\n labelTwo={'Cancel'}\n actionOne={() => this.dialogAction()}\n actionTwo={() => (this.isDialogOpen = false)}\n />\n {/********** QUESTIONS *********/}\n <div>\n {/* <div class=\"header\" style={this.udpForm?.styleOverrides?.headerBackgroundColor ? { backgroundColor: this.udpForm?.styleOverrides?.headerBackgroundColor } : ''}> */}\n <div class=\"form-section-block\">\n <div\n class=\"form-renderer-header\"\n style={{\n ...(this.udpForm?.styleOverrides?.headerBackgroundColor && {\n backgroundColor: this.udpForm.styleOverrides.headerBackgroundColor,\n }),\n }}\n >\n <unity-typography id={this.titleId} variant={'h6'} color=\"inherit\">\n {this.udpForm.name}\n </unity-typography>\n\n {/* Auto-save status indicator for authenticated users */}\n {this.showAutoSaveStatus && (\n <div class=\"auto-save-status\">\n {/* {this.isSaving && (\n <unity-typography variant=\"body\" color=\"primary\">\n Saving...\n </unity-typography>\n )} */}\n {this.saveErrorMessage && (\n <unity-typography variant=\"body\" color=\"secondary\">\n {this.saveErrorMessage}\n </unity-typography>\n )}\n </div>\n )}\n {this.isShowManualSaveIcon && (\n <udp-save-draft-button\n isVisible={this.isShowManualSaveIcon}\n isSaving={this.isSaving}\n // saveErrorMessage={this.saveErrorMessage}\n showSavedMessage={this.showSavedMessage}\n handleSave={this.handleSave}\n />\n )}\n </div>\n\n <div class=\"form-section-content\">\n <div class=\"items\">\n <div class=\"form-section-text\">\n <unity-typography id={this.descriptionId} variant={this.udpForm?.styleOverrides?.paragraphText?.variant ?? 'body'} color=\"inherit\">\n {this.udpForm.description}\n </unity-typography>\n </div>\n </div>\n </div>\n </div>\n {/* Save Button - moves between header and floating based on space */}\n {this.dynamicSections.map((section, sIndex) => {\n return (\n <div class=\"form-section-block\">\n <div class=\"form-section-header\">\n <div class=\"form-section-header-title\">\n <unity-typography variant=\"h6\" color=\"inherit\">\n {`${section.title}${section.sectionPositionSuffix > 1 ? ` (${section.sectionPositionSuffix})` : ''}`}\n </unity-typography>\n </div>\n <div class=\"form-section-header-actions\">\n {/* // Only show the add button if the section is repeatable and is the last in the repeat group */}\n {section.sectionProperties.isRepeatable && this.dynamicSections.filter(s => s.id === section.id).length === section.sectionPositionSuffix && !this.readonly && (\n <stencil-icon-button icon={getIconFromName('add')} tooltip=\"Repeat This Section\" onClick={() => this.duplicateRepeatableSection(sIndex)} />\n )}\n {/* // show the delete button if the section is repeatable and not the original section */}\n {!section.isOriginalSection && !this.readonly && (\n <stencil-icon-button \n icon={getIconFromName('subtract')} \n tooltip=\"Delete This Repeated Section\" \n onClick={\n () => {\n // e.stopPropagation();\n if (this.isSectionContainsFollowUpFormLink(`${section.name}_${section.sectionPositionSuffix}`)) {\n this.dialogAction = async () => {\n this.deleteRepeatableSection(sIndex)\n await this.performBackgroundSaveAndUpdateLocalSubmissionState(this.udpFormSubmission.data.submissionResponseData);\n this.isDialogOpen = false;\n }; \n } else {\n this.deleteRepeatableSection(sIndex)\n }\n \n this.isDialogOpen = true;\n }} />\n )}\n </div>\n </div>\n\n <div class=\"form-section-content\">\n <div class=\"items\">\n <div class=\"form-section-text\">\n <unity-typography variant=\"body\" color=\"inherit\">\n {section.sectionText}\n </unity-typography>\n </div>\n\n <div>\n {section.formQuestions.map((question: UdpFormQuestion) => {\n const isHidden = hiddenQuestionTypes.includes(question.fieldTypeId);\n const num: number = questionNumber;\n if (!isHidden) questionNumber++;\n\n const sectionKey = section.sectionPositionSuffix > 1 ? `${section.name}_${section.sectionPositionSuffix}` : `${section.name}`\n\n return (\n <div class=\"item\">\n <udp-question\n styleOverrides={{\n helperText: this.udpForm.styleOverrides?.helperText,\n paragraphText: this.udpForm.styleOverrides?.paragraphText,\n questionText: this.udpForm.styleOverrides?.questionText,\n }}\n question={question}\n questionNumber={num}\n value={this.currentValues?.[sectionKey]?.[question.name]?.value ?? ''}\n disabled={this.disabled}\n readonly={this.readonly}\n key={question.questionIdentifierKey}\n currentValues={this.currentValues}\n clientUserInfo={this.clientUserInfo}\n udpFormSubmission={this.udpFormSubmission}\n />\n </div>\n );\n })}\n </div>\n </div>\n </div>\n </div>\n );\n })}\n {this.udpFormSubmission?.status != UdpFormsSubmissionStatusEnum.Submitted && ( \n <div class=\"footer\">\n <input\n disabled={this.isLoading || this.disabled || this.readonly}\n type=\"submit\"\n value=\"Submit\"\n class=\"submit\"\n id=\"udpRecord-udp-forms-renderer-Submit\"\n onClick={() => {\n console.log('Submit button clicked');\n // Let the form handle the submit naturally\n }}\n />\n </div>\n )}\n </div>\n </stencil-form>\n ) : (\n //if the form has been submit, display success message with a button to trigger the action associated to the form\n <div class=\"center-div\">\n <udp-ambient-card>\n <div class=\"submit-card\">\n <unity-typography>Thank you for your submission.</unity-typography>\n {/* // No action configured for now. */}\n {/* <div class=\"finish-button\">\n <custom-button onClick={this.handleFinish}>Back</custom-button>\n </div> */}\n </div>\n </udp-ambient-card>\n </div>\n )}\n </div>\n </udp-container>\n </div>\n );\n }\n}\n"],"names":["fontOverrideMapping","overrideFont","h","UdpFormsFieldTypeEnum","getIconFromName","UdpFormsSubmissionStatusEnum"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,aAAa,GAAG,o4EAAo4E;;MCc74E,UAAU,GAAA,MAAA;AALvB,IAAA,WAAA,CAAA,OAAA,EAAA;;;AAOU,QAAA,IAAa,CAAA,aAAA,GAA4B,EAAE;AAE3C,QAAA,IAAgB,CAAA,gBAAA,GAAY,KAAK;AACjC,QAAA,IAAS,CAAA,SAAA,GAAY,KAAK;AAC1B,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AACzB,QAAA,IAAgB,CAAA,gBAAA,GAAkB,IAAI;AACtC,QAAA,IAAkB,CAAA,kBAAA,GAAY,KAAK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C,QAAQ,EAC1D,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,QAAQ,EACd,KAAK,EAAC,QAAQ,EACd,EAAE,EAAC,qCAAqC,EACxC,OAAO,EAAE,MAAK;AACZ,gBAAA,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC;;aAErC,EAAA,CACD,CACE,CACP,CACG,CACO;;AAGf,QAAAA,OAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,YAAY,EAAA,EACrBA,OAAA,CAAA,kBAAA,EAAA,IAAA,EACEA,OAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,aAAa,EAAA,EACtBA,OAAmE,CAAA,kBAAA,EAAA,IAAA,EAAA,gCAAA,CAAA,CAK/D,CACW,CACf,CACP,CACG,CACQ,CACZ;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"udp-forms-ui.entry.cjs.js","sources":["src/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-ui/udp-forms-ui.css?tag=udp-forms-ui&encapsulation=shadow","src/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-ui/udp-forms-ui.tsx"],"sourcesContent":[".background {\n background-color: var(--gray-01);\n height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n}\n\n.item {\n padding-bottom: var(--spacing-02);\n /* margin-bottom: var(--spacing-05); */\n}\n\n.items {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-05);\n padding-top: var(--spacing-02);\n padding-bottom: var(--spacing-02);\n}\n\n.footer {\n display: flex;\n flex-direction: row-reverse;\n}\n\n.submit {\n background-color: var(--primary-color);\n box-sizing: border-box;\n border: none;\n color: white;\n padding: 8px 24px;\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n transition: background-color 0.3s ease;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n text-decoration: none;\n min-width: 48px;\n min-height: 24px;\n /* Default size */\n}\n\n.submit:disabled {\n background-color: var(--gray-05);\n cursor: default;\n}\n\n.submit-card {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n/* .form-section-content */\n.form-section-content {\n margin-bottom: var(--spacing-05);\n background-color: white;\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: var(--spacing-05);\n}\n\n.form-container {\n padding-top: var(--spacing-05);\n padding-bottom: var(--spacing-05);\n min-height: 100px;\n}\n\n.form-section-block {\n margin-bottom: var(--spacing-05);\n}\n\n.form-section-header {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n background-color: var(--primary-color, #000);\n color: var(--primary-contrast-text, #FFF);\n padding: var(--spacing-04, 16px) var(--spacing-05, 24px);\n align-items: center;\n min-height: var(--spacing-10, 60px);\n}\n\n.form-section-text {\n margin-bottom: var(--spacing-03);\n}\n\n.center-div {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n\n.finish-button {\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n/* .header */\n.form-renderer-header {\n padding: var(--spacing-05) var(--spacing-05);\n background-color: var(--primary-color-dark, #000);\n color: var(--primary-contrast-text, #FFF);\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.header-content {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: var(--spacing-03);\n}\n\n.header-text {\n flex: 1;\n min-width: 0;\n /* Allow text to shrink */\n}\n\n/* Save button visibility - JavaScript controlled */\n.header-save-button {\n display: block;\n /* Always available, component controls its own visibility */\n}\n\n.floating-save-button {\n display: block;\n /* Always available, component controls its own visibility */\n}\n\n.error-banner {\n background-color: #fdecea;\n border: 1px solid #f5c6cb;\n color: #a94442;\n padding: 12px;\n margin-bottom: 12px;\n border-radius: 4px;\n}\n\n\n/*\n * Save button visibility is now controlled by JavaScript-based overlap detection\n * in the udp-save-draft-button component. This provides real-time detection of\n * overlaps with form content, accounting for menu drawers and dynamic layouts.\n *\n * The component automatically switches between floating and inline modes based on\n * actual element positions and available space, not viewport breakpoints.\n */\n\n/* Mobile layout adjustments */\n@media (max-width: 768px) {\n .header-content {\n flex-direction: column;\n align-items: stretch;\n gap: var(--spacing-02);\n }\n\n .header-text {\n margin-bottom: var(--spacing-02);\n }\n}\n\n/* Small height screens: Always use header button */\n@media (max-height: 600px) {\n .header-save-button {\n display: block;\n }\n\n .floating-save-button {\n display: none;\n }\n}\n\n.auto-save-status {\n margin-top: var(--spacing-02);\n padding: var(--spacing-01) 0;\n font-size: 12px;\n opacity: 0.8;\n}","import { Component, h, Prop, State, Element, Watch, Event, EventEmitter } from '@stencil/core';\nimport { Guid, UdpFormQuestion } from '../../udp-forms-utils/types';\nimport { UdpFormsFieldTypeEnum, UdpFormsSubmissionStatusEnum } from '../../udp-forms-utils/enums';\nimport { fontOverrideMapping, overrideFont } from '../../udp-forms-utils/utils';\nimport { getIconFromName } from '../../../../data-display/icons/iconUtils';\nimport { UdpFormSubmission } from '../../udp-forms-utils/classes/UdpFormSubmission';\nimport { UdpForm } from '../../udp-forms-utils/classes/UdpForm';\n\n\n@Component({\n tag: 'udp-forms-ui',\n styleUrl: 'udp-forms-ui.css',\n shadow: true,\n})\nexport class UdpFormsUi {\n @Prop() udpForm: UdpForm;\n @Prop() currentValues: { [name: string]: any } = {};\n @Prop() udpFormSubmission: UdpFormSubmission\n @Prop() submitSuccessful: boolean = false;\n @Prop() isLoading: boolean = false;\n @Prop() isSaving: boolean = false;\n @Prop() saveErrorMessage: string | null = null;\n @Prop() showAutoSaveStatus: boolean = false;\n @Prop() disabled: boolean = false;\n @Prop() readonly: boolean = false;\n @Prop() handleSubmit: (values: any) => Promise<void>;\n @Prop() handleChange: (values: { [name: string]: any }) => void;\n @Prop() handleSave: (values: { [name: string]: any }) => Promise<void>;\n @Prop() handleAction: (actionId: Guid, params: Object) => void;\n @Prop() handleFinish: () => void;\n @Prop() clientUserInfo: { id: string | null; displayName: string | null; email: string | null } = {\n id: null,\n displayName: null,\n email: null,\n }; \n @Prop() isSubmitted: boolean = false;\n @Prop() dynamicSections: any[];\n @Prop() duplicateRepeatableSection: any;\n @Prop() deleteRepeatableSection: any;\n @Prop() isShowManualSaveIcon: boolean = false;\n @Prop() performBackgroundSaveAndUpdateLocalSubmissionState: (values: { [name: string]: any }) => Promise<void>;\n\n @State() showSavedMessage: boolean = false;\n\n @Event() formDirtyChange: EventEmitter<boolean>;\n\n @Element() el: HTMLElement;\n\n\n @State() isDialogOpen: boolean = false;\n @State() dialogAction: () => void;\n @State() dialogMessage: string = 'Are you sure you want to delete this section? This section contains links to follow-up forms. Deleting it will remove those links.';\n \n\n private savedMessageTimeoutId: any;\n\n private titleId: string = 'udp-forms-title';\n private descriptionId: string = 'udp-forms-description';\n\n componentDidLoad() {\n this.overrideStyles();\n }\n\n componentDidUpdate() {\n this.overrideStyles();\n }\n\n disconnectedCallback() {\n // Clean up timeout when component is destroyed\n if (this.savedMessageTimeoutId) {\n clearTimeout(this.savedMessageTimeoutId);\n }\n }\n\n @Watch('isSaving')\n watchIsSaving(newValue: boolean, oldValue: boolean) {\n // When isSaving changes from true to false (save completed successfully)\n if (oldValue === true && newValue === false && !this.saveErrorMessage) {\n this.showSavedMessage = true;\n\n // Clear any existing timeout\n if (this.savedMessageTimeoutId) {\n clearTimeout(this.savedMessageTimeoutId);\n }\n\n // Hide the \"Saved\" message after 5 seconds\n this.savedMessageTimeoutId = setTimeout(() => {\n this.showSavedMessage = false;\n }, 5000);\n }\n }\n\n overrideStyles() {\n const shadowRoot = (this as any).el?.shadowRoot;\n shadowRoot?.querySelectorAll('unity-typography').forEach(element => {\n const styleOverride =\n element.id === this.titleId ? this.udpForm?.styleOverrides?.titleText : element.id === this.descriptionId ? this.udpForm?.styleOverrides?.paragraphText : ({} as any);\n\n if (styleOverride?.fontFamily && fontOverrideMapping[styleOverride.fontFamily]) {\n overrideFont(element, fontOverrideMapping[styleOverride.fontFamily]);\n }\n if (styleOverride?.variant) {\n element.setAttribute('variant', styleOverride.variant);\n }\n });\n }\n\n private isSectionContainsFollowUpFormLink(sectionKey: string): boolean {\n const sectionObject = this.udpFormSubmission.data.submissionResponseData[sectionKey]\n\n for (const [_key, questionObject] of Object.entries(sectionObject) as any) {\n if (questionObject?.metadata && questionObject.metadata?.followUpFormSubmissionId) {\n return true;\n }\n }\n\n return false;\n }\n\n render() {\n if (this.isLoading) {\n return (\n <udp-linear-loader />\n );\n }\n\n if (!this.udpForm) {\n return (\n <div class=\"error-banner\">\n <unity-typography variant=\"body2\">Error Loading Form</unity-typography>\n </div>\n );\n }\n\n let questionNumber = 1;\n\n const sectionSet = new Set();\n this.udpForm.formQuestions.forEach(fq => sectionSet.add(fq.section));\n // const orderedSectionNumbers = [...sectionSet].sort((a: number, b: number) => a - b);\n\n const hiddenQuestionTypes = [UdpFormsFieldTypeEnum.Hidden, UdpFormsFieldTypeEnum.Paragraph];\n\n const backgroundOverrides: { backgroundImage?: string | null; backgroundColor?: string | null } = {};\n if (this.udpForm?.styleOverrides?.background?.backgroundImage) {\n // uncomment when we want to allow background images\n //backgroundOverrides.backgroundImage = `url(${this.udpForm?.styleOverrides?.background?.backgroundImage})`;\n } else if (this.udpForm?.styleOverrides?.background?.backgroundColor) {\n backgroundOverrides.backgroundColor = this.udpForm?.styleOverrides?.background?.backgroundColor;\n }\n return (\n <div class={'background'} style={backgroundOverrides}>\n <udp-container maxWidth=\"md\">\n <div class=\"form-container\">\n {!this.submitSuccessful ? (\n \n <stencil-form\n handleSubmit={this.handleSubmit}\n initialValues={this.currentValues}\n handleChange={this.handleChange}\n onDirtyChange={event => this.formDirtyChange.emit(event.detail)}\n >\n {this.readonly && \n (<div class=\"error-banner\">\n <unity-typography variant=\"body2\">View Only Mode. The contents of this form cannot be changed.</unity-typography>\n </div>)}\n <fluent-dialog\n open={this.isDialogOpen}\n message={this.dialogMessage}\n labelOne={'Confirm'}\n labelTwo={'Cancel'}\n actionOne={() => this.dialogAction()}\n actionTwo={() => (this.isDialogOpen = false)}\n />\n {/********** QUESTIONS *********/}\n <div>\n {/* <div class=\"header\" style={this.udpForm?.styleOverrides?.headerBackgroundColor ? { backgroundColor: this.udpForm?.styleOverrides?.headerBackgroundColor } : ''}> */}\n <div class=\"form-section-block\">\n <div\n class=\"form-renderer-header\"\n style={{\n ...(this.udpForm?.styleOverrides?.headerBackgroundColor && {\n backgroundColor: this.udpForm.styleOverrides.headerBackgroundColor,\n }),\n }}\n >\n <unity-typography id={this.titleId} variant={'h6'} color=\"inherit\">\n {this.udpForm.name}\n </unity-typography>\n\n {/* Auto-save status indicator for authenticated users */}\n {this.showAutoSaveStatus && (\n <div class=\"auto-save-status\">\n {/* {this.isSaving && (\n <unity-typography variant=\"body\" color=\"primary\">\n Saving...\n </unity-typography>\n )} */}\n {this.saveErrorMessage && (\n <unity-typography variant=\"body\" color=\"secondary\">\n {this.saveErrorMessage}\n </unity-typography>\n )}\n </div>\n )}\n {this.isShowManualSaveIcon && (\n <udp-save-draft-button\n isVisible={this.isShowManualSaveIcon}\n isSaving={this.isSaving}\n // saveErrorMessage={this.saveErrorMessage}\n showSavedMessage={this.showSavedMessage}\n handleSave={this.handleSave}\n />\n )}\n </div>\n\n <div class=\"form-section-content\">\n <div class=\"items\">\n <div class=\"form-section-text\">\n <unity-typography id={this.descriptionId} variant={this.udpForm?.styleOverrides?.paragraphText?.variant ?? 'body'} color=\"inherit\">\n {this.udpForm.description}\n </unity-typography>\n </div>\n </div>\n </div>\n </div>\n {/* Save Button - moves between header and floating based on space */}\n {this.dynamicSections.map((section, sIndex) => {\n return (\n <div class=\"form-section-block\">\n <div class=\"form-section-header\">\n <div class=\"form-section-header-title\">\n <unity-typography variant=\"h6\" color=\"inherit\">\n {`${section.title}${section.sectionPositionSuffix > 1 ? ` (${section.sectionPositionSuffix})` : ''}`}\n </unity-typography>\n </div>\n <div class=\"form-section-header-actions\">\n {/* // Only show the add button if the section is repeatable and is the last in the repeat group */}\n {section.sectionProperties.isRepeatable && this.dynamicSections.filter(s => s.id === section.id).length === section.sectionPositionSuffix && !this.readonly && (\n <stencil-icon-button icon={getIconFromName('add')} tooltip=\"Repeat This Section\" onClick={() => this.duplicateRepeatableSection(sIndex)} />\n )}\n {/* // show the delete button if the section is repeatable and not the original section */}\n {!section.isOriginalSection && !this.readonly && (\n <stencil-icon-button \n icon={getIconFromName('subtract')} \n tooltip=\"Delete This Repeated Section\" \n onClick={\n () => {\n // e.stopPropagation();\n if (this.isSectionContainsFollowUpFormLink(`${section.name}_${section.sectionPositionSuffix}`)) {\n this.dialogAction = async () => {\n this.deleteRepeatableSection(sIndex)\n await this.performBackgroundSaveAndUpdateLocalSubmissionState(this.udpFormSubmission.data.submissionResponseData);\n this.isDialogOpen = false;\n }; \n } else {\n this.deleteRepeatableSection(sIndex)\n }\n \n this.isDialogOpen = true;\n }} />\n )}\n </div>\n </div>\n\n <div class=\"form-section-content\">\n <div class=\"items\">\n <div class=\"form-section-text\">\n <unity-typography variant=\"body\" color=\"inherit\">\n {section.sectionText}\n </unity-typography>\n </div>\n\n <div>\n {section.formQuestions.map((question: UdpFormQuestion) => {\n const isHidden = hiddenQuestionTypes.includes(question.fieldTypeId);\n const num: number = questionNumber;\n if (!isHidden) questionNumber++;\n\n const sectionKey = section.sectionPositionSuffix > 1 ? `${section.name}_${section.sectionPositionSuffix}` : `${section.name}`\n\n return (\n <div class=\"item\">\n <udp-question\n styleOverrides={{\n helperText: this.udpForm.styleOverrides?.helperText,\n paragraphText: this.udpForm.styleOverrides?.paragraphText,\n questionText: this.udpForm.styleOverrides?.questionText,\n }}\n question={question}\n questionNumber={num}\n value={this.currentValues?.[sectionKey]?.[question.name]?.value ?? ''}\n disabled={this.disabled}\n readonly={this.readonly}\n key={question.questionIdentifierKey}\n currentValues={this.currentValues}\n clientUserInfo={this.clientUserInfo}\n udpFormSubmission={this.udpFormSubmission}\n />\n </div>\n );\n })}\n </div>\n </div>\n </div>\n </div>\n );\n })}\n {this.udpFormSubmission?.status != UdpFormsSubmissionStatusEnum.Submitted && ( \n <div class=\"footer\">\n <input\n disabled={this.isLoading || this.disabled || this.readonly}\n type=\"submit\"\n value=\"Submit\"\n class=\"submit\"\n id=\"udpRecord-udp-forms-renderer-Submit\"\n onClick={() => {\n // console.log('Submit button clicked');\n // Let the form handle the submit naturally\n }}\n />\n </div>\n )}\n </div>\n </stencil-form>\n ) : (\n //if the form has been submit, display success message with a button to trigger the action associated to the form\n <div class=\"center-div\">\n <udp-ambient-card>\n <div class=\"submit-card\">\n <unity-typography>Thank you for your submission.</unity-typography>\n {/* // No action configured for now. */}\n {/* <div class=\"finish-button\">\n <custom-button onClick={this.handleFinish}>Back</custom-button>\n </div> */}\n </div>\n </udp-ambient-card>\n </div>\n )}\n </div>\n </udp-container>\n </div>\n );\n }\n}\n"],"names":["fontOverrideMapping","overrideFont","h","UdpFormsFieldTypeEnum","getIconFromName","UdpFormsSubmissionStatusEnum"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,aAAa,GAAG,o4EAAo4E;;MCc74E,UAAU,GAAA,MAAA;AALvB,IAAA,WAAA,CAAA,OAAA,EAAA;;;AAOU,QAAA,IAAa,CAAA,aAAA,GAA4B,EAAE;AAE3C,QAAA,IAAgB,CAAA,gBAAA,GAAY,KAAK;AACjC,QAAA,IAAS,CAAA,SAAA,GAAY,KAAK;AAC1B,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AACzB,QAAA,IAAgB,CAAA,gBAAA,GAAkB,IAAI;AACtC,QAAA,IAAkB,CAAA,kBAAA,GAAY,KAAK;AACnC,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AACzB,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;QAMzB,IAAA,CAAA,cAAc,GAA4E;AAChG,YAAA,EAAE,EAAE,IAAI;AACR,YAAA,WAAW,EAAE,IAAI;AACjB,YAAA,KAAK,EAAE,IAAI;SACZ;AACO,QAAA,IAAW,CAAA,WAAA,GAAY,KAAK;AAI5B,QAAA,IAAoB,CAAA,o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|
}
|
|
40
40
|
watchIsSaving(newValue, oldValue) {
|
|
41
|
-
console.log('isSaving watcher triggered:', { oldValue, newValue, saveErrorMessage: this.saveErrorMessage });
|
|
42
41
|
// When isSaving changes from true to false (save completed successfully)
|
|
43
42
|
if (oldValue === true && newValue === false && !this.saveErrorMessage) {
|
|
44
|
-
console.log('Setting showSavedMessage to true');
|
|
45
43
|
this.showSavedMessage = true;
|
|
46
44
|
// Clear any existing timeout
|
|
47
45
|
if (this.savedMessageTimeoutId) {
|
|
@@ -49,7 +47,6 @@ export class UdpFormsUi {
|
|
|
49
47
|
}
|
|
50
48
|
// Hide the "Saved" message after 5 seconds
|
|
51
49
|
this.savedMessageTimeoutId = setTimeout(() => {
|
|
52
|
-
console.log('Hiding saved message after 5 seconds');
|
|
53
50
|
this.showSavedMessage = false;
|
|
54
51
|
}, 5000);
|
|
55
52
|
}
|
|
@@ -132,7 +129,7 @@ export class UdpFormsUi {
|
|
|
132
129
|
}, question: question, questionNumber: num, value: (_g = (_f = (_e = (_d = this.currentValues) === null || _d === void 0 ? void 0 : _d[sectionKey]) === null || _e === void 0 ? void 0 : _e[question.name]) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : '', disabled: this.disabled, readonly: this.readonly, key: question.questionIdentifierKey, currentValues: this.currentValues, clientUserInfo: this.clientUserInfo, udpFormSubmission: this.udpFormSubmission })));
|
|
133
130
|
}))))));
|
|
134
131
|
}), ((_r = this.udpFormSubmission) === null || _r === void 0 ? void 0 : _r.status) != UdpFormsSubmissionStatusEnum.Submitted && (h("div", { class: "footer" }, h("input", { disabled: this.isLoading || this.disabled || this.readonly, type: "submit", value: "Submit", class: "submit", id: "udpRecord-udp-forms-renderer-Submit", onClick: () => {
|
|
135
|
-
console.log('Submit button clicked');
|
|
132
|
+
// console.log('Submit button clicked');
|
|
136
133
|
// Let the form handle the submit naturally
|
|
137
134
|
} })))))) : (
|
|
138
135
|
//if the form has been submit, display success message with a button to trigger the action associated to the form
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"udp-forms-ui.js","sourceRoot":"","sources":["../../../../../../src/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-ui/udp-forms-ui.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAE/F,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAU3E,MAAM,OAAO,UAAU;IALvB;QAOU,kBAAa,GAA4B,EAAE,CAAC;QAE5C,qBAAgB,GAAY,KAAK,CAAC;QAClC,cAAS,GAAY,KAAK,CAAC;QAC3B,aAAQ,GAAY,KAAK,CAAC;QAC1B,qBAAgB,GAAkB,IAAI,CAAC;QACvC,uBAAkB,GAAY,KAAK,CAAC;QACpC,aAAQ,GAAY,KAAK,CAAC;QAC1B,aAAQ,GAAY,KAAK,CAAC;QAM1B,mBAAc,GAA4E;YAChG,EAAE,EAAE,IAAI;YACR,WAAW,EAAE,IAAI;YACjB,KAAK,EAAE,IAAI;SACZ,CAAC;QACM,gBAAW,GAAY,KAAK,CAAC;QAI7B,yBAAoB,GAAY,KAAK,CAAC;QAGrC,qBAAgB,GAAY,KAAK,CAAC;QAOlC,iBAAY,GAAY,KAAK,CAAC;QAE9B,kBAAa,GAAW,oIAAoI,CAAC;QAK9J,YAAO,GAAW,iBAAiB,CAAC;QACpC,kBAAa,GAAW,uBAAuB,CAAC;KAkSzD;IAhSC,gBAAgB;QACd,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAED,kBAAkB;QAChB,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAED,oBAAoB;QA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,CAAC;gBACF,iHAAiH;gBACjH,WAAK,KAAK,EAAC,YAAY;oBACrB;wBACE,WAAK,KAAK,EAAC,aAAa;4BACtB,6DAAmE,CAK/D,CACW,CACf,CACP,CACG,CACQ,CACZ,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Element, Watch, Event, EventEmitter } from '@stencil/core';\nimport { Guid, UdpFormQuestion } from '../../udp-forms-utils/types';\nimport { UdpFormsFieldTypeEnum, UdpFormsSubmissionStatusEnum } from '../../udp-forms-utils/enums';\nimport { fontOverrideMapping, overrideFont } from '../../udp-forms-utils/utils';\nimport { getIconFromName } from '../../../../data-display/icons/iconUtils';\nimport { UdpFormSubmission } from '../../udp-forms-utils/classes/UdpFormSubmission';\nimport { UdpForm } from '../../udp-forms-utils/classes/UdpForm';\n\n\n@Component({\n tag: 'udp-forms-ui',\n styleUrl: 'udp-forms-ui.css',\n shadow: true,\n})\nexport class UdpFormsUi {\n @Prop() udpForm: UdpForm;\n @Prop() currentValues: { [name: string]: any } = {};\n @Prop() udpFormSubmission: UdpFormSubmission\n @Prop() submitSuccessful: boolean = false;\n @Prop() isLoading: boolean = false;\n @Prop() isSaving: boolean = false;\n @Prop() saveErrorMessage: string | null = null;\n @Prop() showAutoSaveStatus: boolean = false;\n @Prop() disabled: boolean = false;\n @Prop() readonly: boolean = false;\n @Prop() handleSubmit: (values: any) => Promise<void>;\n @Prop() handleChange: (values: { [name: string]: any }) => void;\n @Prop() handleSave: (values: { [name: string]: any }) => Promise<void>;\n @Prop() handleAction: (actionId: Guid, params: Object) => void;\n @Prop() handleFinish: () => void;\n @Prop() clientUserInfo: { id: string | null; displayName: string | null; email: string | null } = {\n id: null,\n displayName: null,\n email: null,\n }; \n @Prop() isSubmitted: boolean = false;\n @Prop() dynamicSections: any[];\n @Prop() duplicateRepeatableSection: any;\n @Prop() deleteRepeatableSection: any;\n @Prop() isShowManualSaveIcon: boolean = false;\n @Prop() performBackgroundSaveAndUpdateLocalSubmissionState: (values: { [name: string]: any }) => Promise<void>;\n\n @State() showSavedMessage: boolean = false;\n\n @Event() formDirtyChange: EventEmitter<boolean>;\n\n @Element() el: HTMLElement;\n\n\n @State() isDialogOpen: boolean = false;\n @State() dialogAction: () => void;\n @State() dialogMessage: string = 'Are you sure you want to delete this section? This section contains links to follow-up forms. Deleting it will remove those links.';\n \n\n private savedMessageTimeoutId: any;\n\n private titleId: string = 'udp-forms-title';\n private descriptionId: string = 'udp-forms-description';\n\n componentDidLoad() {\n this.overrideStyles();\n }\n\n componentDidUpdate() {\n this.overrideStyles();\n }\n\n disconnectedCallback() {\n // Clean up timeout when component is destroyed\n if (this.savedMessageTimeoutId) {\n clearTimeout(this.savedMessageTimeoutId);\n }\n }\n\n @Watch('isSaving')\n watchIsSaving(newValue: boolean, oldValue: boolean) {\n console.log('isSaving watcher triggered:', { oldValue, newValue, saveErrorMessage: this.saveErrorMessage });\n\n // When isSaving changes from true to false (save completed successfully)\n if (oldValue === true && newValue === false && !this.saveErrorMessage) {\n console.log('Setting showSavedMessage to true');\n this.showSavedMessage = true;\n\n // Clear any existing timeout\n if (this.savedMessageTimeoutId) {\n clearTimeout(this.savedMessageTimeoutId);\n }\n\n // Hide the \"Saved\" message after 5 seconds\n this.savedMessageTimeoutId = setTimeout(() => {\n console.log('Hiding saved message after 5 seconds');\n this.showSavedMessage = false;\n }, 5000);\n }\n }\n\n overrideStyles() {\n const shadowRoot = (this as any).el?.shadowRoot;\n shadowRoot?.querySelectorAll('unity-typography').forEach(element => {\n const styleOverride =\n element.id === this.titleId ? this.udpForm?.styleOverrides?.titleText : element.id === this.descriptionId ? this.udpForm?.styleOverrides?.paragraphText : ({} as any);\n\n if (styleOverride?.fontFamily && fontOverrideMapping[styleOverride.fontFamily]) {\n overrideFont(element, fontOverrideMapping[styleOverride.fontFamily]);\n }\n if (styleOverride?.variant) {\n element.setAttribute('variant', styleOverride.variant);\n }\n });\n }\n\n private isSectionContainsFollowUpFormLink(sectionKey: string): boolean {\n const sectionObject = this.udpFormSubmission.data.submissionResponseData[sectionKey]\n\n for (const [_key, questionObject] of Object.entries(sectionObject) as any) {\n if (questionObject?.metadata && questionObject.metadata?.followUpFormSubmissionId) {\n return true;\n }\n }\n\n return false;\n }\n\n render() {\n if (this.isLoading) {\n return (\n <udp-linear-loader />\n );\n }\n\n if (!this.udpForm) {\n return (\n <div class=\"error-banner\">\n <unity-typography variant=\"body2\">Error Loading Form</unity-typography>\n </div>\n );\n }\n\n let questionNumber = 1;\n\n const sectionSet = new Set();\n this.udpForm.formQuestions.forEach(fq => sectionSet.add(fq.section));\n // const orderedSectionNumbers = [...sectionSet].sort((a: number, b: number) => a - b);\n\n const hiddenQuestionTypes = [UdpFormsFieldTypeEnum.Hidden, UdpFormsFieldTypeEnum.Paragraph];\n\n const backgroundOverrides: { backgroundImage?: string | null; backgroundColor?: string | null } = {};\n if (this.udpForm?.styleOverrides?.background?.backgroundImage) {\n // uncomment when we want to allow background images\n //backgroundOverrides.backgroundImage = `url(${this.udpForm?.styleOverrides?.background?.backgroundImage})`;\n } else if (this.udpForm?.styleOverrides?.background?.backgroundColor) {\n backgroundOverrides.backgroundColor = this.udpForm?.styleOverrides?.background?.backgroundColor;\n }\n return (\n <div class={'background'} style={backgroundOverrides}>\n <udp-container maxWidth=\"md\">\n <div class=\"form-container\">\n {!this.submitSuccessful ? (\n \n <stencil-form\n handleSubmit={this.handleSubmit}\n initialValues={this.currentValues}\n handleChange={this.handleChange}\n onDirtyChange={event => this.formDirtyChange.emit(event.detail)}\n >\n {this.readonly && \n (<div class=\"error-banner\">\n <unity-typography variant=\"body2\">View Only Mode. The contents of this form cannot be changed.</unity-typography>\n </div>)}\n <fluent-dialog\n open={this.isDialogOpen}\n message={this.dialogMessage}\n labelOne={'Confirm'}\n labelTwo={'Cancel'}\n actionOne={() => this.dialogAction()}\n actionTwo={() => (this.isDialogOpen = false)}\n />\n {/********** QUESTIONS *********/}\n <div>\n {/* <div class=\"header\" style={this.udpForm?.styleOverrides?.headerBackgroundColor ? { backgroundColor: this.udpForm?.styleOverrides?.headerBackgroundColor } : ''}> */}\n <div class=\"form-section-block\">\n <div\n class=\"form-renderer-header\"\n style={{\n ...(this.udpForm?.styleOverrides?.headerBackgroundColor && {\n backgroundColor: this.udpForm.styleOverrides.headerBackgroundColor,\n }),\n }}\n >\n <unity-typography id={this.titleId} variant={'h6'} color=\"inherit\">\n {this.udpForm.name}\n </unity-typography>\n\n {/* Auto-save status indicator for authenticated users */}\n {this.showAutoSaveStatus && (\n <div class=\"auto-save-status\">\n {/* {this.isSaving && (\n <unity-typography variant=\"body\" color=\"primary\">\n Saving...\n </unity-typography>\n )} */}\n {this.saveErrorMessage && (\n <unity-typography variant=\"body\" color=\"secondary\">\n {this.saveErrorMessage}\n </unity-typography>\n )}\n </div>\n )}\n {this.isShowManualSaveIcon && (\n <udp-save-draft-button\n isVisible={this.isShowManualSaveIcon}\n isSaving={this.isSaving}\n // saveErrorMessage={this.saveErrorMessage}\n showSavedMessage={this.showSavedMessage}\n handleSave={this.handleSave}\n />\n )}\n </div>\n\n <div class=\"form-section-content\">\n <div class=\"items\">\n <div class=\"form-section-text\">\n <unity-typography id={this.descriptionId} variant={this.udpForm?.styleOverrides?.paragraphText?.variant ?? 'body'} color=\"inherit\">\n {this.udpForm.description}\n </unity-typography>\n </div>\n </div>\n </div>\n </div>\n {/* Save Button - moves between header and floating based on space */}\n {this.dynamicSections.map((section, sIndex) => {\n return (\n <div class=\"form-section-block\">\n <div class=\"form-section-header\">\n <div class=\"form-section-header-title\">\n <unity-typography variant=\"h6\" color=\"inherit\">\n {`${section.title}${section.sectionPositionSuffix > 1 ? ` (${section.sectionPositionSuffix})` : ''}`}\n </unity-typography>\n </div>\n <div class=\"form-section-header-actions\">\n {/* // Only show the add button if the section is repeatable and is the last in the repeat group */}\n {section.sectionProperties.isRepeatable && this.dynamicSections.filter(s => s.id === section.id).length === section.sectionPositionSuffix && !this.readonly && (\n <stencil-icon-button icon={getIconFromName('add')} tooltip=\"Repeat This Section\" onClick={() => this.duplicateRepeatableSection(sIndex)} />\n )}\n {/* // show the delete button if the section is repeatable and not the original section */}\n {!section.isOriginalSection && !this.readonly && (\n <stencil-icon-button \n icon={getIconFromName('subtract')} \n tooltip=\"Delete This Repeated Section\" \n onClick={\n () => {\n // e.stopPropagation();\n if (this.isSectionContainsFollowUpFormLink(`${section.name}_${section.sectionPositionSuffix}`)) {\n this.dialogAction = async () => {\n this.deleteRepeatableSection(sIndex)\n await this.performBackgroundSaveAndUpdateLocalSubmissionState(this.udpFormSubmission.data.submissionResponseData);\n this.isDialogOpen = false;\n }; \n } else {\n this.deleteRepeatableSection(sIndex)\n }\n \n this.isDialogOpen = true;\n }} />\n )}\n </div>\n </div>\n\n <div class=\"form-section-content\">\n <div class=\"items\">\n <div class=\"form-section-text\">\n <unity-typography variant=\"body\" color=\"inherit\">\n {section.sectionText}\n </unity-typography>\n </div>\n\n <div>\n {section.formQuestions.map((question: UdpFormQuestion) => {\n const isHidden = hiddenQuestionTypes.includes(question.fieldTypeId);\n const num: number = questionNumber;\n if (!isHidden) questionNumber++;\n\n const sectionKey = section.sectionPositionSuffix > 1 ? `${section.name}_${section.sectionPositionSuffix}` : `${section.name}`\n\n return (\n <div class=\"item\">\n <udp-question\n styleOverrides={{\n helperText: this.udpForm.styleOverrides?.helperText,\n paragraphText: this.udpForm.styleOverrides?.paragraphText,\n questionText: this.udpForm.styleOverrides?.questionText,\n }}\n question={question}\n questionNumber={num}\n value={this.currentValues?.[sectionKey]?.[question.name]?.value ?? ''}\n disabled={this.disabled}\n readonly={this.readonly}\n key={question.questionIdentifierKey}\n currentValues={this.currentValues}\n clientUserInfo={this.clientUserInfo}\n udpFormSubmission={this.udpFormSubmission}\n />\n </div>\n );\n })}\n </div>\n </div>\n </div>\n </div>\n );\n })}\n {this.udpFormSubmission?.status != UdpFormsSubmissionStatusEnum.Submitted && ( \n <div class=\"footer\">\n <input\n disabled={this.isLoading || this.disabled || this.readonly}\n type=\"submit\"\n value=\"Submit\"\n class=\"submit\"\n id=\"udpRecord-udp-forms-renderer-Submit\"\n onClick={() => {\n console.log('Submit button clicked');\n // Let the form handle the submit naturally\n }}\n />\n </div>\n )}\n </div>\n </stencil-form>\n ) : (\n //if the form has been submit, display success message with a button to trigger the action associated to the form\n <div class=\"center-div\">\n <udp-ambient-card>\n <div class=\"submit-card\">\n <unity-typography>Thank you for your submission.</unity-typography>\n {/* // No action configured for now. */}\n {/* <div class=\"finish-button\">\n <custom-button onClick={this.handleFinish}>Back</custom-button>\n </div> */}\n </div>\n </udp-ambient-card>\n </div>\n )}\n </div>\n </udp-container>\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"udp-forms-ui.js","sourceRoot":"","sources":["../../../../../../src/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-ui/udp-forms-ui.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAgB,M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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Element, Watch, Event, EventEmitter } from '@stencil/core';\nimport { Guid, UdpFormQuestion } from '../../udp-forms-utils/types';\nimport { UdpFormsFieldTypeEnum, UdpFormsSubmissionStatusEnum } from '../../udp-forms-utils/enums';\nimport { fontOverrideMapping, overrideFont } from '../../udp-forms-utils/utils';\nimport { getIconFromName } from '../../../../data-display/icons/iconUtils';\nimport { UdpFormSubmission } from '../../udp-forms-utils/classes/UdpFormSubmission';\nimport { UdpForm } from '../../udp-forms-utils/classes/UdpForm';\n\n\n@Component({\n tag: 'udp-forms-ui',\n styleUrl: 'udp-forms-ui.css',\n shadow: true,\n})\nexport class UdpFormsUi {\n @Prop() udpForm: UdpForm;\n @Prop() currentValues: { [name: string]: any } = {};\n @Prop() udpFormSubmission: UdpFormSubmission\n @Prop() submitSuccessful: boolean = false;\n @Prop() isLoading: boolean = false;\n @Prop() isSaving: boolean = false;\n @Prop() saveErrorMessage: string | null = null;\n @Prop() showAutoSaveStatus: boolean = false;\n @Prop() disabled: boolean = false;\n @Prop() readonly: boolean = false;\n @Prop() handleSubmit: (values: any) => Promise<void>;\n @Prop() handleChange: (values: { [name: string]: any }) => void;\n @Prop() handleSave: (values: { [name: string]: any }) => Promise<void>;\n @Prop() handleAction: (actionId: Guid, params: Object) => void;\n @Prop() handleFinish: () => void;\n @Prop() clientUserInfo: { id: string | null; displayName: string | null; email: string | null } = {\n id: null,\n displayName: null,\n email: null,\n }; \n @Prop() isSubmitted: boolean = false;\n @Prop() dynamicSections: any[];\n @Prop() duplicateRepeatableSection: any;\n @Prop() deleteRepeatableSection: any;\n @Prop() isShowManualSaveIcon: boolean = false;\n @Prop() performBackgroundSaveAndUpdateLocalSubmissionState: (values: { [name: string]: any }) => Promise<void>;\n\n @State() showSavedMessage: boolean = false;\n\n @Event() formDirtyChange: EventEmitter<boolean>;\n\n @Element() el: HTMLElement;\n\n\n @State() isDialogOpen: boolean = false;\n @State() dialogAction: () => void;\n @State() dialogMessage: string = 'Are you sure you want to delete this section? This section contains links to follow-up forms. Deleting it will remove those links.';\n \n\n private savedMessageTimeoutId: any;\n\n private titleId: string = 'udp-forms-title';\n private descriptionId: string = 'udp-forms-description';\n\n componentDidLoad() {\n this.overrideStyles();\n }\n\n componentDidUpdate() {\n this.overrideStyles();\n }\n\n disconnectedCallback() {\n // Clean up timeout when component is destroyed\n if (this.savedMessageTimeoutId) {\n clearTimeout(this.savedMessageTimeoutId);\n }\n }\n\n @Watch('isSaving')\n watchIsSaving(newValue: boolean, oldValue: boolean) {\n // When isSaving changes from true to false (save completed successfully)\n if (oldValue === true && newValue === false && !this.saveErrorMessage) {\n this.showSavedMessage = true;\n\n // Clear any existing timeout\n if (this.savedMessageTimeoutId) {\n clearTimeout(this.savedMessageTimeoutId);\n }\n\n // Hide the \"Saved\" message after 5 seconds\n this.savedMessageTimeoutId = setTimeout(() => {\n this.showSavedMessage = false;\n }, 5000);\n }\n }\n\n overrideStyles() {\n const shadowRoot = (this as any).el?.shadowRoot;\n shadowRoot?.querySelectorAll('unity-typography').forEach(element => {\n const styleOverride =\n element.id === this.titleId ? this.udpForm?.styleOverrides?.titleText : element.id === this.descriptionId ? this.udpForm?.styleOverrides?.paragraphText : ({} as any);\n\n if (styleOverride?.fontFamily && fontOverrideMapping[styleOverride.fontFamily]) {\n overrideFont(element, fontOverrideMapping[styleOverride.fontFamily]);\n }\n if (styleOverride?.variant) {\n element.setAttribute('variant', styleOverride.variant);\n }\n });\n }\n\n private isSectionContainsFollowUpFormLink(sectionKey: string): boolean {\n const sectionObject = this.udpFormSubmission.data.submissionResponseData[sectionKey]\n\n for (const [_key, questionObject] of Object.entries(sectionObject) as any) {\n if (questionObject?.metadata && questionObject.metadata?.followUpFormSubmissionId) {\n return true;\n }\n }\n\n return false;\n }\n\n render() {\n if (this.isLoading) {\n return (\n <udp-linear-loader />\n );\n }\n\n if (!this.udpForm) {\n return (\n <div class=\"error-banner\">\n <unity-typography variant=\"body2\">Error Loading Form</unity-typography>\n </div>\n );\n }\n\n let questionNumber = 1;\n\n const sectionSet = new Set();\n this.udpForm.formQuestions.forEach(fq => sectionSet.add(fq.section));\n // const orderedSectionNumbers = [...sectionSet].sort((a: number, b: number) => a - b);\n\n const hiddenQuestionTypes = [UdpFormsFieldTypeEnum.Hidden, UdpFormsFieldTypeEnum.Paragraph];\n\n const backgroundOverrides: { backgroundImage?: string | null; backgroundColor?: string | null } = {};\n if (this.udpForm?.styleOverrides?.background?.backgroundImage) {\n // uncomment when we want to allow background images\n //backgroundOverrides.backgroundImage = `url(${this.udpForm?.styleOverrides?.background?.backgroundImage})`;\n } else if (this.udpForm?.styleOverrides?.background?.backgroundColor) {\n backgroundOverrides.backgroundColor = this.udpForm?.styleOverrides?.background?.backgroundColor;\n }\n return (\n <div class={'background'} style={backgroundOverrides}>\n <udp-container maxWidth=\"md\">\n <div class=\"form-container\">\n {!this.submitSuccessful ? (\n \n <stencil-form\n handleSubmit={this.handleSubmit}\n initialValues={this.currentValues}\n handleChange={this.handleChange}\n onDirtyChange={event => this.formDirtyChange.emit(event.detail)}\n >\n {this.readonly && \n (<div class=\"error-banner\">\n <unity-typography variant=\"body2\">View Only Mode. The contents of this form cannot be changed.</unity-typography>\n </div>)}\n <fluent-dialog\n open={this.isDialogOpen}\n message={this.dialogMessage}\n labelOne={'Confirm'}\n labelTwo={'Cancel'}\n actionOne={() => this.dialogAction()}\n actionTwo={() => (this.isDialogOpen = false)}\n />\n {/********** QUESTIONS *********/}\n <div>\n {/* <div class=\"header\" style={this.udpForm?.styleOverrides?.headerBackgroundColor ? { backgroundColor: this.udpForm?.styleOverrides?.headerBackgroundColor } : ''}> */}\n <div class=\"form-section-block\">\n <div\n class=\"form-renderer-header\"\n style={{\n ...(this.udpForm?.styleOverrides?.headerBackgroundColor && {\n backgroundColor: this.udpForm.styleOverrides.headerBackgroundColor,\n }),\n }}\n >\n <unity-typography id={this.titleId} variant={'h6'} color=\"inherit\">\n {this.udpForm.name}\n </unity-typography>\n\n {/* Auto-save status indicator for authenticated users */}\n {this.showAutoSaveStatus && (\n <div class=\"auto-save-status\">\n {/* {this.isSaving && (\n <unity-typography variant=\"body\" color=\"primary\">\n Saving...\n </unity-typography>\n )} */}\n {this.saveErrorMessage && (\n <unity-typography variant=\"body\" color=\"secondary\">\n {this.saveErrorMessage}\n </unity-typography>\n )}\n </div>\n )}\n {this.isShowManualSaveIcon && (\n <udp-save-draft-button\n isVisible={this.isShowManualSaveIcon}\n isSaving={this.isSaving}\n // saveErrorMessage={this.saveErrorMessage}\n showSavedMessage={this.showSavedMessage}\n handleSave={this.handleSave}\n />\n )}\n </div>\n\n <div class=\"form-section-content\">\n <div class=\"items\">\n <div class=\"form-section-text\">\n <unity-typography id={this.descriptionId} variant={this.udpForm?.styleOverrides?.paragraphText?.variant ?? 'body'} color=\"inherit\">\n {this.udpForm.description}\n </unity-typography>\n </div>\n </div>\n </div>\n </div>\n {/* Save Button - moves between header and floating based on space */}\n {this.dynamicSections.map((section, sIndex) => {\n return (\n <div class=\"form-section-block\">\n <div class=\"form-section-header\">\n <div class=\"form-section-header-title\">\n <unity-typography variant=\"h6\" color=\"inherit\">\n {`${section.title}${section.sectionPositionSuffix > 1 ? ` (${section.sectionPositionSuffix})` : ''}`}\n </unity-typography>\n </div>\n <div class=\"form-section-header-actions\">\n {/* // Only show the add button if the section is repeatable and is the last in the repeat group */}\n {section.sectionProperties.isRepeatable && this.dynamicSections.filter(s => s.id === section.id).length === section.sectionPositionSuffix && !this.readonly && (\n <stencil-icon-button icon={getIconFromName('add')} tooltip=\"Repeat This Section\" onClick={() => this.duplicateRepeatableSection(sIndex)} />\n )}\n {/* // show the delete button if the section is repeatable and not the original section */}\n {!section.isOriginalSection && !this.readonly && (\n <stencil-icon-button \n icon={getIconFromName('subtract')} \n tooltip=\"Delete This Repeated Section\" \n onClick={\n () => {\n // e.stopPropagation();\n if (this.isSectionContainsFollowUpFormLink(`${section.name}_${section.sectionPositionSuffix}`)) {\n this.dialogAction = async () => {\n this.deleteRepeatableSection(sIndex)\n await this.performBackgroundSaveAndUpdateLocalSubmissionState(this.udpFormSubmission.data.submissionResponseData);\n this.isDialogOpen = false;\n }; \n } else {\n this.deleteRepeatableSection(sIndex)\n }\n \n this.isDialogOpen = true;\n }} />\n )}\n </div>\n </div>\n\n <div class=\"form-section-content\">\n <div class=\"items\">\n <div class=\"form-section-text\">\n <unity-typography variant=\"body\" color=\"inherit\">\n {section.sectionText}\n </unity-typography>\n </div>\n\n <div>\n {section.formQuestions.map((question: UdpFormQuestion) => {\n const isHidden = hiddenQuestionTypes.includes(question.fieldTypeId);\n const num: number = questionNumber;\n if (!isHidden) questionNumber++;\n\n const sectionKey = section.sectionPositionSuffix > 1 ? `${section.name}_${section.sectionPositionSuffix}` : `${section.name}`\n\n return (\n <div class=\"item\">\n <udp-question\n styleOverrides={{\n helperText: this.udpForm.styleOverrides?.helperText,\n paragraphText: this.udpForm.styleOverrides?.paragraphText,\n questionText: this.udpForm.styleOverrides?.questionText,\n }}\n question={question}\n questionNumber={num}\n value={this.currentValues?.[sectionKey]?.[question.name]?.value ?? ''}\n disabled={this.disabled}\n readonly={this.readonly}\n key={question.questionIdentifierKey}\n currentValues={this.currentValues}\n clientUserInfo={this.clientUserInfo}\n udpFormSubmission={this.udpFormSubmission}\n />\n </div>\n );\n })}\n </div>\n </div>\n </div>\n </div>\n );\n })}\n {this.udpFormSubmission?.status != UdpFormsSubmissionStatusEnum.Submitted && ( \n <div class=\"footer\">\n <input\n disabled={this.isLoading || this.disabled || this.readonly}\n type=\"submit\"\n value=\"Submit\"\n class=\"submit\"\n id=\"udpRecord-udp-forms-renderer-Submit\"\n onClick={() => {\n // console.log('Submit button clicked');\n // Let the form handle the submit naturally\n }}\n />\n </div>\n )}\n </div>\n </stencil-form>\n ) : (\n //if the form has been submit, display success message with a button to trigger the action associated to the form\n <div class=\"center-div\">\n <udp-ambient-card>\n <div class=\"submit-card\">\n <unity-typography>Thank you for your submission.</unity-typography>\n {/* // No action configured for now. */}\n {/* <div class=\"finish-button\">\n <custom-button onClick={this.handleFinish}>Back</custom-button>\n </div> */}\n </div>\n </udp-ambient-card>\n </div>\n )}\n </div>\n </udp-container>\n </div>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from "uuid";
|
|
2
|
+
/**
|
|
3
|
+
* Pure comment CRUD logic.
|
|
4
|
+
*
|
|
5
|
+
* - Updates submissionResponseData structure for comments/draftComments.
|
|
6
|
+
* - Does NOT perform any network calls.
|
|
7
|
+
* - Returns persistence intent for caller.
|
|
8
|
+
*/
|
|
9
|
+
export function applyQuestionCommentCrud(params) {
|
|
10
|
+
var _a, _b, _c, _d, _e;
|
|
11
|
+
const { actionType, questionIdentifierKey, commentId, currentSubmissionResponseData, clientUserInfo } = params;
|
|
12
|
+
const parts = (questionIdentifierKey || '').split('.');
|
|
13
|
+
const sectionKey = parts[0] || '';
|
|
14
|
+
const questionKey = parts[1] || '';
|
|
15
|
+
// Defensive: if malformed key, do nothing.
|
|
16
|
+
if (!sectionKey || !questionKey) {
|
|
17
|
+
return {
|
|
18
|
+
sectionKey,
|
|
19
|
+
questionKey,
|
|
20
|
+
nextSubmissionResponseData: currentSubmissionResponseData || {},
|
|
21
|
+
didMutate: false,
|
|
22
|
+
shouldPersist: false,
|
|
23
|
+
persistIntent: 'none',
|
|
24
|
+
commentId,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const next = structuredClone(currentSubmissionResponseData || {});
|
|
28
|
+
// ensure structure exists WITHOUT overwriting existing data
|
|
29
|
+
if (!next[sectionKey])
|
|
30
|
+
next[sectionKey] = {};
|
|
31
|
+
if (!next[sectionKey][questionKey]) {
|
|
32
|
+
// create defaults but do not clobber any existing saved shape from submissionResponseData
|
|
33
|
+
next[sectionKey][questionKey] = {
|
|
34
|
+
value: '',
|
|
35
|
+
comments: [],
|
|
36
|
+
draftComments: [],
|
|
37
|
+
metadata: {},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// ensure arrays/objects exist so later code can safely push/filter
|
|
42
|
+
next[sectionKey][questionKey].comments = (_a = next[sectionKey][questionKey].comments) !== null && _a !== void 0 ? _a : [];
|
|
43
|
+
next[sectionKey][questionKey].draftComments = (_b = next[sectionKey][questionKey].draftComments) !== null && _b !== void 0 ? _b : [];
|
|
44
|
+
next[sectionKey][questionKey].metadata = (_c = next[sectionKey][questionKey].metadata) !== null && _c !== void 0 ? _c : {};
|
|
45
|
+
}
|
|
46
|
+
// normalize draftComments to array if needed (back-compat)
|
|
47
|
+
const maybeDraft = next[sectionKey][questionKey].draftComments;
|
|
48
|
+
if (maybeDraft && !Array.isArray(maybeDraft)) {
|
|
49
|
+
next[sectionKey][questionKey].draftComments = [maybeDraft];
|
|
50
|
+
}
|
|
51
|
+
else if (!maybeDraft) {
|
|
52
|
+
next[sectionKey][questionKey].draftComments = [];
|
|
53
|
+
}
|
|
54
|
+
const commentsArr = next[sectionKey][questionKey].comments || [];
|
|
55
|
+
const draftsArr = next[sectionKey][questionKey].draftComments || [];
|
|
56
|
+
let didMutate = false;
|
|
57
|
+
switch (actionType) {
|
|
58
|
+
case 'add': {
|
|
59
|
+
const newDraft = {
|
|
60
|
+
value: '',
|
|
61
|
+
commentId: uuidv4(),
|
|
62
|
+
isTempComment: true,
|
|
63
|
+
timestamp: null,
|
|
64
|
+
};
|
|
65
|
+
// put new draft first so activeDraft === draftComments[0] matches UX
|
|
66
|
+
next[sectionKey][questionKey].draftComments = [newDraft, ...draftsArr];
|
|
67
|
+
didMutate = true;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
case 'save': {
|
|
71
|
+
const draftIdx = draftsArr.findIndex((d) => d.commentId === commentId);
|
|
72
|
+
if (draftIdx === -1) {
|
|
73
|
+
return {
|
|
74
|
+
sectionKey,
|
|
75
|
+
questionKey,
|
|
76
|
+
nextSubmissionResponseData: next,
|
|
77
|
+
didMutate: false,
|
|
78
|
+
shouldPersist: false,
|
|
79
|
+
persistIntent: 'none',
|
|
80
|
+
commentId,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const draft = draftsArr[draftIdx];
|
|
84
|
+
const saveTimestamp = draft.timestamp || new Date().toISOString();
|
|
85
|
+
const savedComment = Object.assign(Object.assign({}, draft), { timestamp: saveTimestamp, editedTimestamp: new Date().toISOString(), userId: clientUserInfo === null || clientUserInfo === void 0 ? void 0 : clientUserInfo.id, userDisplayName: clientUserInfo === null || clientUserInfo === void 0 ? void 0 : clientUserInfo.displayName, isDraftComment: false });
|
|
86
|
+
const existingIdx = commentsArr.findIndex((c) => c.commentId === commentId);
|
|
87
|
+
if (existingIdx !== -1) {
|
|
88
|
+
const newComments = [...commentsArr];
|
|
89
|
+
newComments[existingIdx] = Object.assign({}, savedComment);
|
|
90
|
+
next[sectionKey][questionKey].comments = newComments;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
next[sectionKey][questionKey].comments = [...commentsArr, savedComment];
|
|
94
|
+
}
|
|
95
|
+
next[sectionKey][questionKey].draftComments = draftsArr.filter((d) => d.commentId !== commentId);
|
|
96
|
+
didMutate = true;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
case 'edit': {
|
|
100
|
+
const saved = commentsArr.find((c) => c.commentId === commentId);
|
|
101
|
+
if (!saved) {
|
|
102
|
+
return {
|
|
103
|
+
sectionKey,
|
|
104
|
+
questionKey,
|
|
105
|
+
nextSubmissionResponseData: next,
|
|
106
|
+
didMutate: false,
|
|
107
|
+
shouldPersist: false,
|
|
108
|
+
persistIntent: 'none',
|
|
109
|
+
commentId,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const draftFromSaved = Object.assign(Object.assign({}, saved), { isDraftComment: true, timestamp: null });
|
|
113
|
+
next[sectionKey][questionKey].draftComments = [draftFromSaved, ...draftsArr];
|
|
114
|
+
next[sectionKey][questionKey].comments = commentsArr;
|
|
115
|
+
didMutate = true;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
case 'delete': {
|
|
119
|
+
next[sectionKey][questionKey].comments = commentsArr.map((c) => {
|
|
120
|
+
if (c.commentId === commentId) {
|
|
121
|
+
return Object.assign(Object.assign({}, c), { isDeleted: true, value: '', editedTimestamp: new Date().toISOString() });
|
|
122
|
+
}
|
|
123
|
+
return c;
|
|
124
|
+
});
|
|
125
|
+
didMutate = true;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case 'editClose': {
|
|
129
|
+
next[sectionKey][questionKey].draftComments = draftsArr.filter((d) => d.commentId !== commentId);
|
|
130
|
+
didMutate = true;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const shouldPersist = actionType === 'save' || actionType === 'delete';
|
|
135
|
+
// For the dedicated comments API we only ever need the saved comment value.
|
|
136
|
+
let valueToPersist;
|
|
137
|
+
if (actionType === 'save') {
|
|
138
|
+
const saved = (((_e = (_d = next === null || next === void 0 ? void 0 : next[sectionKey]) === null || _d === void 0 ? void 0 : _d[questionKey]) === null || _e === void 0 ? void 0 : _e.comments) || []).find((c) => c.commentId === commentId);
|
|
139
|
+
valueToPersist = saved === null || saved === void 0 ? void 0 : saved.value;
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
sectionKey,
|
|
143
|
+
questionKey,
|
|
144
|
+
nextSubmissionResponseData: next,
|
|
145
|
+
didMutate,
|
|
146
|
+
shouldPersist,
|
|
147
|
+
// Caller decides if this becomes public-add vs private-update.
|
|
148
|
+
persistIntent: 'none',
|
|
149
|
+
commentId,
|
|
150
|
+
valueToPersist,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=comments-crud-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments-crud-utils.js","sourceRoot":"","sources":["../../../../../../src/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils/comments-crud-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AA8BpC;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAA8B;;IACrE,MAAM,EAAE,UAAU,EAAE,qBAAqB,EAAE,SAAS,EAAE,6BAA6B,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IAE/G,MAAM,KAAK,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAClC,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAEnC,2CAA2C;IAC3C,IAAI,CAAC,UAAU,IAAI,CAAC,WAAW,EAAE,CAAC;QAChC,OAAO;YACL,UAAU;YACV,WAAW;YACX,0BAA0B,EAAE,6BAA6B,IAAI,EAAE;YAC/D,SAAS,EAAE,KAAK;YAChB,aAAa,EAAE,KAAK;YACpB,aAAa,EAAE,MAAM;YACrB,SAAS;SACV,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,eAAe,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC;IAElE,4DAA4D;IAC5D,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;QAAE,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;IAE7C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC;QACnC,0FAA0F;QAC1F,IAAI,CAAC,UAAU,CAAC,CAAC,WAA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C,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;QAC9G,cAAc,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAC;IAChC,CAAC;IAED,OAAO;QACL,UAAU;QACV,WAAW;QACX,0BAA0B,EAAE,IAAI;QAChC,SAAS;QACT,aAAa;QACb,+DAA+D;QAC/D,aAAa,EAAE,MAAM;QACrB,SAAS;QACT,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["import { v4 as uuidv4 } from 'uuid';\n\nexport type QuestionCommentActionType = 'add' | 'save' | 'edit' | 'delete' | 'editClose';\n\nexport type QuestionIdentifierKey = string; // \"section.question\" (repeatable section keys are already embedded in section key)\n\nexport interface CommentUserInfo {\n id: string | null;\n displayName: string | null;\n}\n\nexport interface ApplyCommentCrudParams {\n actionType: QuestionCommentActionType;\n questionIdentifierKey: QuestionIdentifierKey;\n commentId: string;\n currentSubmissionResponseData: Record<string, any>;\n clientUserInfo: CommentUserInfo;\n}\n\nexport interface ApplyCommentCrudResult {\n sectionKey: string;\n questionKey: string;\n nextSubmissionResponseData: Record<string, any>;\n didMutate: boolean;\n shouldPersist: boolean;\n persistIntent: 'public-add' | 'private-update' | 'none';\n commentId: string;\n valueToPersist?: string;\n}\n\n/**\n * Pure comment CRUD logic.\n *\n * - Updates submissionResponseData structure for comments/draftComments.\n * - Does NOT perform any network calls.\n * - Returns persistence intent for caller.\n */\nexport function applyQuestionCommentCrud(params: ApplyCommentCrudParams): ApplyCommentCrudResult {\n const { actionType, questionIdentifierKey, commentId, currentSubmissionResponseData, clientUserInfo } = params;\n\n const parts = (questionIdentifierKey || '').split('.');\n const sectionKey = parts[0] || '';\n const questionKey = parts[1] || '';\n\n // Defensive: if malformed key, do nothing.\n if (!sectionKey || !questionKey) {\n return {\n sectionKey,\n questionKey,\n nextSubmissionResponseData: currentSubmissionResponseData || {},\n didMutate: false,\n shouldPersist: false,\n persistIntent: 'none',\n commentId,\n };\n }\n\n const next = structuredClone(currentSubmissionResponseData || {});\n\n // ensure structure exists WITHOUT overwriting existing data\n if (!next[sectionKey]) next[sectionKey] = {};\n\n if (!next[sectionKey][questionKey]) {\n // create defaults but do not clobber any existing saved shape from submissionResponseData\n next[sectionKey][questionKey] = {\n value: '',\n comments: [],\n draftComments: [],\n metadata: {},\n };\n } else {\n // ensure arrays/objects exist so later code can safely push/filter\n next[sectionKey][questionKey].comments = next[sectionKey][questionKey].comments ?? [];\n next[sectionKey][questionKey].draftComments = next[sectionKey][questionKey].draftComments ?? [];\n next[sectionKey][questionKey].metadata = next[sectionKey][questionKey].metadata ?? {};\n }\n\n // normalize draftComments to array if needed (back-compat)\n const maybeDraft = next[sectionKey][questionKey].draftComments;\n if (maybeDraft && !Array.isArray(maybeDraft)) {\n next[sectionKey][questionKey].draftComments = [maybeDraft];\n } else if (!maybeDraft) {\n next[sectionKey][questionKey].draftComments = [];\n }\n\n const commentsArr = next[sectionKey][questionKey].comments || [];\n const draftsArr = next[sectionKey][questionKey].draftComments || [];\n\n let didMutate = false;\n\n switch (actionType) {\n case 'add': {\n const newDraft = {\n value: '',\n commentId: uuidv4(),\n isTempComment: true,\n timestamp: null,\n };\n // put new draft first so activeDraft === draftComments[0] matches UX\n next[sectionKey][questionKey].draftComments = [newDraft, ...draftsArr];\n didMutate = true;\n break;\n }\n\n case 'save': {\n const draftIdx = draftsArr.findIndex((d: any) => d.commentId === commentId);\n if (draftIdx === -1) {\n return {\n sectionKey,\n questionKey,\n nextSubmissionResponseData: next,\n didMutate: false,\n shouldPersist: false,\n persistIntent: 'none',\n commentId,\n };\n }\n\n const draft = draftsArr[draftIdx];\n const saveTimestamp = draft.timestamp || new Date().toISOString();\n\n const savedComment = {\n ...draft,\n timestamp: saveTimestamp,\n editedTimestamp: new Date().toISOString(),\n userId: clientUserInfo?.id,\n userDisplayName: clientUserInfo?.displayName,\n isDraftComment: false,\n };\n\n const existingIdx = commentsArr.findIndex((c: any) => c.commentId === commentId);\n if (existingIdx !== -1) {\n const newComments = [...commentsArr];\n newComments[existingIdx] = { ...savedComment };\n next[sectionKey][questionKey].comments = newComments;\n } else {\n next[sectionKey][questionKey].comments = [...commentsArr, savedComment];\n }\n\n next[sectionKey][questionKey].draftComments = draftsArr.filter((d: any) => d.commentId !== commentId);\n didMutate = true;\n break;\n }\n\n case 'edit': {\n const saved = commentsArr.find((c: any) => c.commentId === commentId);\n if (!saved) {\n return {\n sectionKey,\n questionKey,\n nextSubmissionResponseData: next,\n didMutate: false,\n shouldPersist: false,\n persistIntent: 'none',\n commentId,\n };\n }\n const draftFromSaved = { ...saved, isDraftComment: true, timestamp: null };\n next[sectionKey][questionKey].draftComments = [draftFromSaved, ...draftsArr];\n next[sectionKey][questionKey].comments = commentsArr;\n didMutate = true;\n break;\n }\n\n case 'delete': {\n next[sectionKey][questionKey].comments = commentsArr.map((c: any) => {\n if (c.commentId === commentId) {\n return {\n ...c,\n isDeleted: true,\n value: '',\n editedTimestamp: new Date().toISOString(),\n };\n }\n return c;\n });\n didMutate = true;\n break;\n }\n\n case 'editClose': {\n next[sectionKey][questionKey].draftComments = draftsArr.filter((d: any) => d.commentId !== commentId);\n didMutate = true;\n break;\n }\n }\n\n const shouldPersist = actionType === 'save' || actionType === 'delete';\n\n // For the dedicated comments API we only ever need the saved comment value.\n let valueToPersist: string | undefined;\n if (actionType === 'save') {\n const saved = (next?.[sectionKey]?.[questionKey]?.comments || []).find((c: any) => c.commentId === commentId);\n valueToPersist = saved?.value;\n }\n\n return {\n sectionKey,\n questionKey,\n nextSubmissionResponseData: next,\n didMutate,\n shouldPersist,\n // Caller decides if this becomes public-add vs private-update.\n persistIntent: 'none',\n commentId,\n valueToPersist,\n };\n}\n"]}
|