diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml new file mode 100644 index 0000000000..ab65e6faa4 --- /dev/null +++ b/.github/workflows/config.yml @@ -0,0 +1,131 @@ +# name: Build & Test + +# on: push + +# env: +# NODE_VERSION: 18.x + +# jobs: +# test: +# runs-on: ubuntu-latest +# steps: +# - run: echo "Triggered by ${{ github.event_name }} event." + +# - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} +# uses: actions/checkout@v3 + +# - name: Set up Node.js ${{ env.NODE_VERSION }} +# uses: actions/setup-node@v3 +# with: +# node-version: ${{ env.NODE_VERSION }} +# cache: 'npm' + +# - name: Cache node modules +# uses: actions/cache@v3 +# with: +# path: node_modules +# key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} +# restore-keys: | +# ${{ runner.os }}-node- + +# - name: Installing dependencies +# if: steps.cache.outputs.cache-hit != 'true' +# uses: borales/actions-yarn@v4 +# with: +# cmd: install --frozen-lockfile + +# - name: Lint +# uses: borales/actions-yarn@v4 +# with: +# cmd: lint + +# - name: Build +# uses: borales/actions-yarn@v4 +# with: +# cmd: build + +# - name: Test +# uses: borales/actions-yarn@v4 +# with: +# cmd: test + +name: Build & Test + +on: push + +env: + NODE_VERSION: 18.x + +jobs: + setup: + runs-on: ubuntu-latest + steps: + - run: echo "Triggered by ${{ github.event_name }} event." + + - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} + uses: actions/checkout@v3 + + - name: Set up Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + cache: 'npm' + + - name: Cache node modules + uses: actions/cache@v3 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Installing dependencies + if: steps.cache.outputs.cache-hit != 'true' + uses: borales/actions-yarn@v4 + with: + cmd: install --frozen-lockfile + + - name: Lint + uses: borales/actions-yarn@v4 + with: + cmd: lint + + build: + needs: setup + runs-on: ubuntu-latest + steps: + - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} + uses: actions/checkout@v3 + + - name: Restore node modules from cache + uses: actions/cache@v3 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Build + uses: borales/actions-yarn@v4 + with: + cmd: build + + test: + needs: setup + runs-on: ubuntu-latest + steps: + - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} + uses: actions/checkout@v3 + + - name: Restore node modules from cache + uses: actions/cache@v3 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Test + uses: borales/actions-yarn@v4 + with: + cmd: test \ No newline at end of file diff --git a/Changelog.md b/Changelog.md index 1217765d59..286a98346c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -22,6 +22,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - FIO-7207: changed tooltip and removed 'Hide label' option from the list of layout components - FIO-7074: fixed an issue where setting submission on wizard does not update data - FIO-7082: Moved Wizard Breadcrumbs Type to form settings + - FIO-7224: Fixed issues with layout components when Condensed mode is enabled + - FIO-4833: Removes Hide Label setting from Well, Columns, Tabs and Table components since they do not render a label + - FIO-5910: allow manual input for w and W date formats + - FIO-6370: Fixes issues with PasswordStrength Addon settings + - FIO-7146: formiojs-circleci-to-ghactions ## 5.0.0-rc.26 ### Changed diff --git a/src/Embed.js b/src/Embed.js index ad25434a47..97908a1f34 100644 --- a/src/Embed.js +++ b/src/Embed.js @@ -142,7 +142,7 @@ export class Formio { } // eslint-disable-next-line max-statements - static async init(element, builder = false) { + static async init(element, options = {}, builder = false) { Formio.cdn = new CDN(Formio.config.cdn); Formio.config.libs = Formio.config.libs || { uswds: { @@ -160,10 +160,19 @@ export class Formio { const id = Formio.config.id || `formio-${Math.random().toString(36).substring(7)}`; // Create a new wrapper and add the element inside of a new wrapper. - const wrapper = Formio.createElement('div', { + let wrapper = Formio.createElement('div', { 'id': `"${id}-wrapper"` }); element.parentNode.insertBefore(wrapper, element); + + // If we include the libraries, then we will attempt to run this in shadow dom. + if (Formio.config.includeLibs && (typeof wrapper.attachShadow === 'function') && !Formio.config.premium) { + wrapper = wrapper.attachShadow({ + mode: 'open' + }); + options.shadowRoot = wrapper; + } + element.parentNode.removeChild(element); wrapper.appendChild(element); @@ -246,7 +255,7 @@ export class Formio { } static async createForm(element, form, options) { - const wrapper = await Formio.init(element); + const wrapper = await Formio.init(element, options); return Formio.FormioClass.createForm(element, form, { ...options, ...{ noLoader: true } @@ -278,7 +287,7 @@ export class Formio { } static async builder(element, form, options) { - const wrapper = await Formio.init(element, true); + const wrapper = await Formio.init(element, options, true); return Formio.FormioClass.builder(element, form, options).then((instance) => { Formio.debug('Builder created', instance); Formio.debug('Removing loader'); diff --git a/src/WebformBuilder.js b/src/WebformBuilder.js index b7df181d86..461e4559bd 100644 --- a/src/WebformBuilder.js +++ b/src/WebformBuilder.js @@ -1588,8 +1588,15 @@ export default class WebformBuilder extends Component { } } + // If the edit form has any nested form inside, we get a partial data (nested form's data) in the + // event.data property + let editFormData; + if (event.changed.instance && event.changed.instance.root && event.changed.instance.root.id !== this.editForm.id) { + editFormData = this.editForm.data; + } + // Update the component. - this.updateComponent(event.data.componentJson || event.data, event.changed); + this.updateComponent(event.data.componentJson || editFormData || event.data, event.changed); } }); diff --git a/src/addons/index.js b/src/addons/index.js index 1555897676..fb579eb0c7 100644 --- a/src/addons/index.js +++ b/src/addons/index.js @@ -7,7 +7,11 @@ export const editForms = [ key: 'settings', display: 'form', input: true, - components, + components: components.map((comp) => { + comp.tableView = false; + return comp; + }), + tableView: false, defaultValue: { data: defaultSettings }, diff --git a/src/components/_classes/component/Component.js b/src/components/_classes/component/Component.js index 3fa7232550..c64abaa4eb 100644 --- a/src/components/_classes/component/Component.js +++ b/src/components/_classes/component/Component.js @@ -768,7 +768,7 @@ export default class Component extends Element { let contentMargin = ''; if (this.component.hideLabel) { - const margin = this.labelWidth + this.labelMargin; + const margin = isCondensed ? 0 : this.labelWidth + this.labelMargin; contentMargin = isRightPosition ? `margin-right: ${margin}%` : ''; contentMargin = isLeftPosition ? `margin-left: ${margin}%` : ''; } diff --git a/src/components/_classes/component/editForm/Component.edit.addons.js b/src/components/_classes/component/editForm/Component.edit.addons.js index b3ac3f7da1..7d63552572 100644 --- a/src/components/_classes/component/editForm/Component.edit.addons.js +++ b/src/components/_classes/component/editForm/Component.edit.addons.js @@ -10,6 +10,33 @@ export default [ input: true, key: 'addons', label: 'Addons', + templates: { + // eslint-disable-next-line quotes + header: `