From 9a7cb45a099cf587f106e0a5e7640f2e383be472 Mon Sep 17 00:00:00 2001 From: mikekotikov Date: Fri, 4 Oct 2024 12:35:57 +0300 Subject: [PATCH 1/7] FIO-8690: migrate conditional logic --- .../_classes/component/Component.js | 116 ++++++++++++------ 1 file changed, 80 insertions(+), 36 deletions(-) diff --git a/src/components/_classes/component/Component.js b/src/components/_classes/component/Component.js index 1764fe5662..cf51f4c9e2 100644 --- a/src/components/_classes/component/Component.js +++ b/src/components/_classes/component/Component.js @@ -3,7 +3,7 @@ import { conformToMask } from '@formio/vanilla-text-mask'; import tippy from 'tippy.js'; import _ from 'lodash'; import isMobile from 'ismobilejs'; -import { processOne, processOneSync, validateProcessInfo } from '@formio/core/process'; +import { processOne, processOneSync, validateProcessInfo, conditionProcessInfo } from '@formio/core/process'; import { Formio } from '../../../Formio'; import * as FormioUtils from '../../../utils/utils'; @@ -227,7 +227,7 @@ export default class Component extends Element { * @param options */ /* eslint-disable no-unused-vars */ - static tableView(value, options) {} + static tableView(value, options) { } /* eslint-enable no-unused-vars */ /** @@ -867,9 +867,9 @@ export default class Component extends Element { labelIsHidden() { return !this.component.label || ((!this.isInDataGrid && this.component.hideLabel) || - (this.isInDataGrid && !this.component.dataGridLabel) || - this.options.floatingLabels || - this.options.inputsOnly) && !this.builderMode; + (this.isInDataGrid && !this.component.dataGridLabel) || + this.options.floatingLabels || + this.options.inputsOnly) && !this.builderMode; } transform(type, value) { @@ -1056,7 +1056,7 @@ export default class Component extends Element { settings.shadowRoot = this.root.shadowRoot; } - const widget = settings && Widgets[settings.type] ? new Widgets[settings.type](settings, this.component, this): null; + const widget = settings && Widgets[settings.type] ? new Widgets[settings.type](settings, this.component, this) : null; return widget; } @@ -1278,7 +1278,7 @@ export default class Component extends Element { const tooltipAttribute = tooltipEl.getAttribute('data-tooltip'); const tooltipDataTitle = tooltipEl.getAttribute('data-title'); const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute) - .replace(/(?:\r\n|\r|\n)/g, '
'); + .replace(/(?:\r\n|\r|\n)/g, '
'); return tippy(tooltipEl, { allowHTML: true, @@ -1733,7 +1733,7 @@ export default class Component extends Element { const handleCloseClick = (e) => { if (confirm) { confirm().then(() => close(e)) - .catch(() => {}); + .catch(() => { }); } else { close(e); @@ -1763,7 +1763,7 @@ export default class Component extends Element { * @returns {string} - The class name of this component. */ get className() { - let className = this.hasInput ? `${this.transform('class', 'form-group')} has-feedback `: ''; + let className = this.hasInput ? `${this.transform('class', 'form-group')} has-feedback ` : ''; className += `formio-component formio-component-${this.component.type} `; // TODO: find proper way to avoid overriding of default type-based component styles if (this.key && this.key !== 'form') { @@ -1957,7 +1957,7 @@ export default class Component extends Element { * @returns {string} - The error message configured for this component. */ errorMessage(type) { - return (this.component.errors && this.component.errors[type]) ? this.component.errors[type] : type; + return (this.component.errors && this.component.errors[type]) ? this.component.errors[type] : type; } /** @@ -2137,24 +2137,68 @@ export default class Component extends Element { * @param {any} row - The row data to check against. * @returns {boolean} - TRUE if the component is visible. */ - checkComponentConditions(data, flags, row) { + // checkComponentConditions(data, flags, row) { + // data = data || this.rootValue; + // flags = flags || {}; + // row = row || this.data; + + // if (!this.builderMode & !this.previewMode && this.fieldLogic(data, row)) { + // this.redraw(); + // } + + // // Check advanced conditions + // const visible = this.conditionallyVisible(data, row); + + // if (this.visible !== visible) { + // this.visible = visible; + // } + + // return visible; + // } + + async checkComponentConditions(data, flags, row) { data = data || this.rootValue; flags = flags || {}; + // const async = flags?.async row = row || this.data; if (!this.builderMode & !this.previewMode && this.fieldLogic(data, row)) { this.redraw(); } - // Check advanced conditions - const visible = this.conditionallyVisible(data, row); + let pathCorrect = this.path; - if (this.visible !== visible) { - this.visible = visible; + if (this.parent?.type !=='datagrid') { + pathCorrect = this.path.replace(/\[[0-9]+\]/g, ''); } - return visible; - } + // Check advanced conditions + const processContext = { + component: this.component, + data, + row, + value: this.validationValue, + path: pathCorrect || this.component.key, + instance: this, + scope: { errors: [] }, + form: this.root, + processors: [ + conditionProcessInfo + ] + }; + + processOneSync(processContext); + const componentPath = pathCorrect || this.component.key; + const componentCondition = processContext.scope?.conditionals?.find(x => x.path === componentPath) + const visible = !componentCondition?.conditionallyHidden; + + + if (this.visible !== visible) { + this.visible = visible; + } + + return visible + } /** * Checks conditions for this component and any sub components. @@ -2346,11 +2390,11 @@ export default class Component extends Element { value: _.clone(oldValue), data, row, - input: oldValue, + input: oldValue, component: newComponent, result, }, - 'value'); + 'value'); if (!_.isEqual(oldValue, newValue) && !(this.component.clearOnHide && !this.visible)) { this.setValue(newValue); @@ -2621,8 +2665,8 @@ export default class Component extends Element { 'ckeditor', isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', _.get(this.options, 'editors.ckeditor.src', - `${Formio.cdn.ckeditor}/ckeditor.js` - ), true) + `${Formio.cdn.ckeditor}/ckeditor.js` + ), true) .then(() => { if (!element.parentNode) { return Promise.reject(); @@ -2846,7 +2890,7 @@ export default class Component extends Element { getCustomDefaultValue(defaultValue) { if (this.component.customDefaultValue && !this.options.preview) { - defaultValue = this.evaluate( + defaultValue = this.evaluate( this.component.customDefaultValue, { value: '' }, 'value' @@ -3128,21 +3172,21 @@ export default class Component extends Element { } convertNumberOrBoolToString(value) { - if (typeof value === 'number' || typeof value === 'boolean' ) { + if (typeof value === 'number' || typeof value === 'boolean') { return value.toString(); } return value; } doValueCalculation(dataValue, data, row) { - return this.evaluate(this.component.calculateValue, { - value: dataValue, - data, - row: row || this.data, - submission: this.root?._submission || { - data: this.rootValue - } - }, 'value'); + return this.evaluate(this.component.calculateValue, { + value: dataValue, + data, + row: row || this.data, + submission: this.root?._submission || { + data: this.rootValue + } + }, 'value'); } /* eslint-disable max-statements */ @@ -3826,7 +3870,7 @@ export default class Component extends Element { getRelativePath(path) { const keyPart = `.${this.key}`; const thisPath = this.isInputComponent ? this.path - : this.path.slice(0).replace(keyPart, ''); + : this.path.slice(0).replace(keyPart, ''); return path.replace(thisPath, ''); } @@ -3992,7 +4036,7 @@ export default class Component extends Element { return formio; } - resetCaches() {} + resetCaches() { } get previewMode() { return false; @@ -4000,7 +4044,7 @@ export default class Component extends Element { } Component.externalLibraries = {}; -Component.requireLibrary = function(name, property, src, polling) { +Component.requireLibrary = function (name, property, src, polling) { if (!Component.externalLibraries.hasOwnProperty(name)) { Component.externalLibraries[name] = {}; Component.externalLibraries[name].ready = new Promise((resolve, reject) => { @@ -4011,7 +4055,7 @@ Component.requireLibrary = function(name, property, src, polling) { const callbackName = `${name}Callback`; if (!polling && !window[callbackName]) { - window[callbackName] = function() { + window[callbackName] = function () { this.resolve(); }.bind(Component.externalLibraries[name]); } @@ -4076,7 +4120,7 @@ Component.requireLibrary = function(name, property, src, polling) { return Component.externalLibraries[name].ready; }; -Component.libraryReady = function(name) { +Component.libraryReady = function (name) { if ( Component.externalLibraries.hasOwnProperty(name) && Component.externalLibraries[name].ready From 01aeae16373b24b0877744595437dd4f0880992f Mon Sep 17 00:00:00 2001 From: mikekotikov Date: Thu, 17 Oct 2024 18:32:06 +0300 Subject: [PATCH 2/7] FIO-8690: Delete previous checkComponentConditions logic --- src/components/_classes/component/Component.js | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/components/_classes/component/Component.js b/src/components/_classes/component/Component.js index be7187c344..f370ed61ab 100644 --- a/src/components/_classes/component/Component.js +++ b/src/components/_classes/component/Component.js @@ -2137,24 +2137,6 @@ export default class Component extends Element { * @param {any} row - The row data to check against. * @returns {boolean} - TRUE if the component is visible. */ - // checkComponentConditions(data, flags, row) { - // data = data || this.rootValue; - // flags = flags || {}; - // row = row || this.data; - - // if (!this.builderMode & !this.previewMode && this.fieldLogic(data, row)) { - // this.redraw(); - // } - - // // Check advanced conditions - // const visible = this.conditionallyVisible(data, row); - - // if (this.visible !== visible) { - // this.visible = visible; - // } - - // return visible; - // } async checkComponentConditions(data, flags, row) { data = data || this.rootValue; From 2782cf47f6cba8184d8b5580e0a571d3b7e9e380 Mon Sep 17 00:00:00 2001 From: mikekotikov Date: Fri, 25 Oct 2024 10:52:11 +0300 Subject: [PATCH 3/7] FIO-8690: Add changes --- .../_classes/component/Component.js | 9 +- test/unit/Webform.unit.js | 112 +++++++++++++++++- 2 files changed, 117 insertions(+), 4 deletions(-) diff --git a/src/components/_classes/component/Component.js b/src/components/_classes/component/Component.js index 080a8ef510..66ca103568 100644 --- a/src/components/_classes/component/Component.js +++ b/src/components/_classes/component/Component.js @@ -2169,12 +2169,17 @@ export default class Component extends Element { ] }; + let visible = true; + if (this.builderMode || this.previewMode || !this.hasCondition()) { + visible = !this.component.hidden; + } + else { processOneSync(processContext); const componentPath = pathCorrect || this.component.key; const componentCondition = processContext.scope?.conditionals?.find(x => x.path === componentPath) - const visible = !componentCondition?.conditionallyHidden; - + visible = !componentCondition?.conditionallyHidden; + } if (this.visible !== visible) { this.visible = visible; } diff --git a/test/unit/Webform.unit.js b/test/unit/Webform.unit.js index c67beebed3..0be63460fa 100644 --- a/test/unit/Webform.unit.js +++ b/test/unit/Webform.unit.js @@ -94,6 +94,114 @@ if (_.has(Formio, 'Components.setComponents')) { /* eslint-disable max-statements */ describe('Webform tests', function() { this.retries(3); + + + it('Should show field when condition is based on the values of select resource with object value', (done) => { + const element = document.createElement('div'); + const values = [ + { + _id: '656daabeebc67ecca1141569', + form: '656daab0ebc67ecca1141226', + data: { + number: 4, + notes: 'notes 4', + }, + project: '656daa20ebc67ecca1140e8d', + state: 'submitted', + created: '2023-12-04T10:32:30.821Z', + modified: '2023-12-06T14:25:00.886Z', + }, + { + _id: '656daabbebc67ecca11414a7', + form: '656daab0ebc67ecca1141226', + data: { + number: 3, + notes: 'notes 3', + }, + project: '656daa20ebc67ecca1140e8d', + state: 'submitted', + created: '2023-12-04T10:32:27.322Z', + modified: '2023-12-06T14:25:07.494Z', + }, + { + _id: '656daab8ebc67ecca11413e5', + form: '656daab0ebc67ecca1141226', + data: { + number: 2, + notes: 'notes 2', + }, + project: '656daa20ebc67ecca1140e8d', + state: 'submitted', + created: '2023-12-04T10:32:24.514Z', + modified: '2023-12-06T14:25:13.610Z', + }, + { + _id: '656daab5ebc67ecca1141322', + form: '656daab0ebc67ecca1141226', + data: { + number: 1, + notes: 'notes 1', + }, + project: '656daa20ebc67ecca1140e8d', + state: 'submitted', + created: '2023-12-04T10:32:21.205Z', + modified: '2023-12-06T14:25:20.930Z', + }, + ]; + const originalMakeRequest = Formio.makeRequest; + Formio.makeRequest = function() { + return new Promise(resolve => { + setTimeout(() => { + resolve(values); + }, 50); + }); + }; + + Formio.createForm(element, formWithObjectValueSelect) + .then(form => { + const numberComp = form.getComponent('number'); + assert.equal(numberComp.visible, false); + + const selectRef = form.getComponent('selectRef'); + selectRef.setValue(fastCloneDeep(values[3])); + const selectNoValuePropertyMult = form.getComponent('selectNoValueProperty'); + selectNoValuePropertyMult.setValue([fastCloneDeep(values[2])]); + const selectEntireObject = form.getComponent('selectEntireObject'); + selectEntireObject.setValue(fastCloneDeep(values[1].data)); + const selectEntireObjectMult = form.getComponent('selectEntireObjectMult'); + selectEntireObjectMult.setValue([fastCloneDeep(values[0].data)]); + + setTimeout(() => { + assert.equal(numberComp.visible, true); + selectRef.setValue(fastCloneDeep(values[2])); + setTimeout(() => { + assert.equal(numberComp.visible, false); + Formio.makeRequest = originalMakeRequest; + done(); + }, 600); + }, 600); + }) + .catch(done); + }); + + it('Should hide field if the checkbox based condition with string value is met', function(done) { + const formElement = document.createElement('div'); + const form = new Webform(formElement); + const formCopy = fastCloneDeep(formsWithNewSimpleConditions.form7); + + form.setForm(formCopy).then(() => { + const conditionalComponent = form.getComponent('textField'); + assert.equal(conditionalComponent.visible, true, 'Component should be conditionally visible'); + + form.setValue({ data: { checkbox: true } }); + + setTimeout(() => { + assert.equal(conditionalComponent.visible, false, 'Component should be conditionally hidden'); + done(); + }, 600); + }).catch((err) => done(err)); + }); + it('Should validate email input when it is simple conditionally visible', done => { const formElement = document.createElement('div'); Formio.createForm(formElement, formWithConditionalEmail) @@ -3310,8 +3418,8 @@ describe('Webform tests', function() { setTimeout(() => { assert.equal(conditionalComponent.visible, false, '(3) Component should be conditionally visible'); done(); - }, 300); - }, 300); + }, 500); + }, 500); }).catch((err) => done(err)); }); }); From a8d7237479fa83ee2cce6b77cbd2ef6168d825a2 Mon Sep 17 00:00:00 2001 From: mikekotikov Date: Tue, 29 Oct 2024 10:13:54 +0300 Subject: [PATCH 4/7] FIO-8690: Add fix to selection --- src/components/select/Select.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/select/Select.js b/src/components/select/Select.js index 972bfb3080..ab84fb0062 100644 --- a/src/components/select/Select.js +++ b/src/components/select/Select.js @@ -1487,8 +1487,24 @@ export default class SelectComponent extends ListComponent { } templateData[value] = this.templateData[value]; } + // if (this.path === 'dataGrid.select') { + // this.path = 'dataGrid[0].select' + // } + + let newPath = ''; + + if (this.parent.type === 'datagrid') { + const splitedData = this.path.split("."); + const compIndexToCheck = splitedData.length -2 + const lastComp = splitedData[compIndexToCheck]; + const isPaths = lastComp.match(/\[[0-9]+\]/g); + if(!isPaths) { + splitedData[compIndexToCheck] = `${splitedData[compIndexToCheck]}[0]` + } + newPath = splitedData.join("."); + } - _.set(submission.metadata.selectData, this.path, templateData); + _.set(submission.metadata.selectData, newPath? newPath: this.path, templateData); } } From c8483b5ea85c1cc33e8c7184eb0b80e01a2d04d8 Mon Sep 17 00:00:00 2001 From: mikekotikov Date: Wed, 30 Oct 2024 15:02:36 +0300 Subject: [PATCH 5/7] FIO-8690: Add fixes --- .../_classes/component/Component.js | 57 +++++++++---------- src/components/select/Select.js | 19 +------ 2 files changed, 29 insertions(+), 47 deletions(-) diff --git a/src/components/_classes/component/Component.js b/src/components/_classes/component/Component.js index 66ca103568..85548fea44 100644 --- a/src/components/_classes/component/Component.js +++ b/src/components/_classes/component/Component.js @@ -2138,7 +2138,7 @@ export default class Component extends Element { * @returns {boolean} - TRUE if the component is visible. */ - async checkComponentConditions(data, flags, row) { + checkComponentConditions(data, flags, row) { data = data || this.rootValue; flags = flags || {}; // const async = flags?.async @@ -2150,42 +2150,41 @@ export default class Component extends Element { let pathCorrect = this.path; - if (this.parent?.type !=='datagrid') { - pathCorrect = this.path.replace(/\[[0-9]+\]/g, ''); + if (this.parent?.type !== 'datagrid') { + pathCorrect = this.path.replace(/\[[0-9]+\]/g, ''); } - // Check advanced conditions - const processContext = { - component: this.component, - data, - row, - value: this.validationValue, - path: pathCorrect || this.component.key, - instance: this, - scope: { errors: [] }, - form: this.root, - processors: [ - conditionProcessInfo - ] - }; + // Check advanced conditions + const processContext = { + component: this.component, + data, + row, + value: this.validationValue, + path: pathCorrect || this.component.key, + instance: this, + scope: { errors: [] }, + form: this.root, + processors: [ + conditionProcessInfo + ] + }; - let visible = true; - if (this.builderMode || this.previewMode || !this.hasCondition()) { - visible = !this.component.hidden; - } - else { + let visible = true; + if (this.builderMode || this.previewMode || !this.hasCondition()) { + visible = !this.component.hidden; + } + else { processOneSync(processContext); const componentPath = pathCorrect || this.component.key; const componentCondition = processContext.scope?.conditionals?.find(x => x.path === componentPath) visible = !componentCondition?.conditionallyHidden; - - } - if (this.visible !== visible) { - this.visible = visible; - } - - return visible } + if (this.visible !== visible) { + this.visible = visible; + } + + return visible + } /** * Checks conditions for this component and any sub components. diff --git a/src/components/select/Select.js b/src/components/select/Select.js index ab84fb0062..76c6b52c1f 100644 --- a/src/components/select/Select.js +++ b/src/components/select/Select.js @@ -1487,24 +1487,7 @@ export default class SelectComponent extends ListComponent { } templateData[value] = this.templateData[value]; } - // if (this.path === 'dataGrid.select') { - // this.path = 'dataGrid[0].select' - // } - - let newPath = ''; - - if (this.parent.type === 'datagrid') { - const splitedData = this.path.split("."); - const compIndexToCheck = splitedData.length -2 - const lastComp = splitedData[compIndexToCheck]; - const isPaths = lastComp.match(/\[[0-9]+\]/g); - if(!isPaths) { - splitedData[compIndexToCheck] = `${splitedData[compIndexToCheck]}[0]` - } - newPath = splitedData.join("."); - } - - _.set(submission.metadata.selectData, newPath? newPath: this.path, templateData); + _.set(submission.metadata.selectData, this.path, templateData); } } From 83b48eb6dd2c18957243a5795f6e7e81346f09bd Mon Sep 17 00:00:00 2001 From: mikekotikov Date: Wed, 30 Oct 2024 18:05:55 +0300 Subject: [PATCH 6/7] FIO-8690: Add small fixes --- .../_classes/component/Component.js | 5 +- test/unit/Webform.unit.js | 108 ------------------ 2 files changed, 2 insertions(+), 111 deletions(-) diff --git a/src/components/_classes/component/Component.js b/src/components/_classes/component/Component.js index 85548fea44..a95020c519 100644 --- a/src/components/_classes/component/Component.js +++ b/src/components/_classes/component/Component.js @@ -2141,7 +2141,6 @@ export default class Component extends Element { checkComponentConditions(data, flags, row) { data = data || this.rootValue; flags = flags || {}; - // const async = flags?.async row = row || this.data; if (!this.builderMode & !this.previewMode && this.fieldLogic(data, row)) { @@ -2176,14 +2175,14 @@ export default class Component extends Element { else { processOneSync(processContext); const componentPath = pathCorrect || this.component.key; - const componentCondition = processContext.scope?.conditionals?.find(x => x.path === componentPath) + const componentCondition = processContext.scope?.conditionals?.find(x => x.path === componentPath); visible = !componentCondition?.conditionallyHidden; } if (this.visible !== visible) { this.visible = visible; } - return visible + return visible; } /** diff --git a/test/unit/Webform.unit.js b/test/unit/Webform.unit.js index 0be63460fa..53d7e1fde0 100644 --- a/test/unit/Webform.unit.js +++ b/test/unit/Webform.unit.js @@ -94,114 +94,6 @@ if (_.has(Formio, 'Components.setComponents')) { /* eslint-disable max-statements */ describe('Webform tests', function() { this.retries(3); - - - it('Should show field when condition is based on the values of select resource with object value', (done) => { - const element = document.createElement('div'); - const values = [ - { - _id: '656daabeebc67ecca1141569', - form: '656daab0ebc67ecca1141226', - data: { - number: 4, - notes: 'notes 4', - }, - project: '656daa20ebc67ecca1140e8d', - state: 'submitted', - created: '2023-12-04T10:32:30.821Z', - modified: '2023-12-06T14:25:00.886Z', - }, - { - _id: '656daabbebc67ecca11414a7', - form: '656daab0ebc67ecca1141226', - data: { - number: 3, - notes: 'notes 3', - }, - project: '656daa20ebc67ecca1140e8d', - state: 'submitted', - created: '2023-12-04T10:32:27.322Z', - modified: '2023-12-06T14:25:07.494Z', - }, - { - _id: '656daab8ebc67ecca11413e5', - form: '656daab0ebc67ecca1141226', - data: { - number: 2, - notes: 'notes 2', - }, - project: '656daa20ebc67ecca1140e8d', - state: 'submitted', - created: '2023-12-04T10:32:24.514Z', - modified: '2023-12-06T14:25:13.610Z', - }, - { - _id: '656daab5ebc67ecca1141322', - form: '656daab0ebc67ecca1141226', - data: { - number: 1, - notes: 'notes 1', - }, - project: '656daa20ebc67ecca1140e8d', - state: 'submitted', - created: '2023-12-04T10:32:21.205Z', - modified: '2023-12-06T14:25:20.930Z', - }, - ]; - const originalMakeRequest = Formio.makeRequest; - Formio.makeRequest = function() { - return new Promise(resolve => { - setTimeout(() => { - resolve(values); - }, 50); - }); - }; - - Formio.createForm(element, formWithObjectValueSelect) - .then(form => { - const numberComp = form.getComponent('number'); - assert.equal(numberComp.visible, false); - - const selectRef = form.getComponent('selectRef'); - selectRef.setValue(fastCloneDeep(values[3])); - const selectNoValuePropertyMult = form.getComponent('selectNoValueProperty'); - selectNoValuePropertyMult.setValue([fastCloneDeep(values[2])]); - const selectEntireObject = form.getComponent('selectEntireObject'); - selectEntireObject.setValue(fastCloneDeep(values[1].data)); - const selectEntireObjectMult = form.getComponent('selectEntireObjectMult'); - selectEntireObjectMult.setValue([fastCloneDeep(values[0].data)]); - - setTimeout(() => { - assert.equal(numberComp.visible, true); - selectRef.setValue(fastCloneDeep(values[2])); - setTimeout(() => { - assert.equal(numberComp.visible, false); - Formio.makeRequest = originalMakeRequest; - done(); - }, 600); - }, 600); - }) - .catch(done); - }); - - it('Should hide field if the checkbox based condition with string value is met', function(done) { - const formElement = document.createElement('div'); - const form = new Webform(formElement); - const formCopy = fastCloneDeep(formsWithNewSimpleConditions.form7); - - form.setForm(formCopy).then(() => { - const conditionalComponent = form.getComponent('textField'); - assert.equal(conditionalComponent.visible, true, 'Component should be conditionally visible'); - - form.setValue({ data: { checkbox: true } }); - - setTimeout(() => { - assert.equal(conditionalComponent.visible, false, 'Component should be conditionally hidden'); - done(); - }, 600); - }).catch((err) => done(err)); - }); - it('Should validate email input when it is simple conditionally visible', done => { const formElement = document.createElement('div'); Formio.createForm(formElement, formWithConditionalEmail) From 8d76627503355ee02595e4b5398169112fffcac6 Mon Sep 17 00:00:00 2001 From: mikekotikov Date: Mon, 4 Nov 2024 10:58:38 +0100 Subject: [PATCH 7/7] FIO-8690: update formio/core version to fix pipelines --- package.json | 2 +- yarn.lock | 46 +++++++++++++--------------------------------- 2 files changed, 14 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index dd333b3f62..1b6fccee5b 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "dependencies": { "@formio/bootstrap": "3.0.0-dev.98.17ba6ea", "@formio/choices.js": "^10.2.1", - "@formio/core": "v2.1.0-dev.174.9a3c6ec", + "@formio/core": "2.1.0-dev.183.b3387fc", "@formio/text-mask-addons": "^3.8.0-formio.3", "@formio/vanilla-text-mask": "^5.1.1-formio.1", "abortcontroller-polyfill": "^1.7.5", diff --git a/yarn.lock b/yarn.lock index 2ab2a0c002..506ca70e97 100644 --- a/yarn.lock +++ b/yarn.lock @@ -381,15 +381,15 @@ fuse.js "^6.6.2" redux "^4.2.0" -"@formio/core@v2.1.0-dev.174.9a3c6ec": - version "2.1.0-dev.174.9a3c6ec" - resolved "https://registry.yarnpkg.com/@formio/core/-/core-2.1.0-dev.174.9a3c6ec.tgz#f223b5ce4f374a9f4e922dada0af7c029320e035" - integrity sha512-QQK04dP0xBFa3vuhiOi+TUP8Zwqlg38qxzHgDmBwSlRO5XqQIObPJpSSnv2VA8H7fBWWiV2g7AErHBxugJW7Rw== +"@formio/core@2.1.0-dev.183.b3387fc": + version "2.1.0-dev.183.b3387fc" + resolved "https://registry.yarnpkg.com/@formio/core/-/core-2.1.0-dev.183.b3387fc.tgz#c10a87daff08018484e7d7e2b85dd88190f77253" + integrity sha512-aev1pLaLsmlNLYMo0zVyHD+jXWy7rjuA5jtphCcTVGqVza7p3rNDy22iwv0FvJR5e3ruWiUzo3nzqh6C2okURw== dependencies: browser-cookies "^1.2.0" core-js "^3.38.0" dayjs "^1.11.12" - dompurify "^3.1.6" + dompurify "^3.1.7" eventemitter3 "^5.0.0" fast-json-patch "^3.1.1" fetch-ponyfill "^7.1.0" @@ -2498,6 +2498,11 @@ dompurify@^3.1.6: resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.1.6.tgz#43c714a94c6a7b8801850f82e756685300a027e2" integrity sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ== +dompurify@^3.1.7: + version "3.1.7" + resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.1.7.tgz#711a8c96479fb6ced93453732c160c3c72418a6a" + integrity sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ== + downloadjs@^1.4.7: version "1.4.7" resolved "https://registry.npmjs.org/downloadjs/-/downloadjs-1.4.7.tgz#f69f96f940e0d0553dac291139865a3cd0101e3c" @@ -7319,7 +7324,7 @@ string-replace-loader@^3.1.0: loader-utils "^2.0.0" schema-utils "^3.0.0" -"string-width-cjs@npm:string-width@^4.2.0": +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0: version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -7337,15 +7342,6 @@ string-width@^1.0.1, string-width@^1.0.2: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^4.1.0, string-width@^4.2.0: - version "4.2.3" - resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - string-width@^5.0.1, string-width@^5.1.2: version "5.1.2" resolved "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" @@ -7406,7 +7402,7 @@ stringifier@^1.3.0: traverse "^0.6.6" type-name "^2.0.1" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -7427,13 +7423,6 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -8496,7 +8485,7 @@ workerpool@6.2.1: resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -8522,15 +8511,6 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"