@formio/js 5.0.0-dev.5703.20a26ed → 5.0.0-dev.5704.50db01f
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/Changelog.md +36 -0
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.form.js +55 -35
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -0
- package/dist/formio.full.js +61 -41
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -0
- package/dist/formio.js +1 -1
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +25 -5
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -0
- package/lib/cjs/CDN.js +1 -2
- package/lib/cjs/Form.d.ts +2 -2
- package/lib/cjs/Form.js +11 -5
- package/lib/cjs/PDF.js +1 -1
- package/lib/cjs/PDFBuilder.js +2 -1
- package/lib/cjs/Webform.js +6 -4
- package/lib/cjs/WebformBuilder.js +13 -3
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +1 -1
- package/lib/cjs/components/_classes/component/Component.js +7 -6
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +43 -25
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +2 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.js +5 -1
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +3 -0
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +56 -29
- package/lib/cjs/components/address/Address.d.ts +6 -0
- package/lib/cjs/components/address/Address.js +7 -1
- package/lib/cjs/components/currency/Currency.d.ts +2 -0
- package/lib/cjs/components/datagrid/DataGrid.d.ts +0 -1
- package/lib/cjs/components/datagrid/DataGrid.js +2 -9
- package/lib/cjs/components/datagrid/fixtures/comp11.d.ts +50 -0
- package/lib/cjs/components/datagrid/fixtures/comp11.js +55 -0
- package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
- package/lib/cjs/components/datamap/DataMap.js +1 -1
- package/lib/cjs/components/day/Day.d.ts +3 -4
- package/lib/cjs/components/day/Day.js +31 -10
- package/lib/cjs/components/editgrid/EditGrid.js +2 -5
- package/lib/cjs/components/editgrid/fixtures/comp17.d.ts +80 -0
- package/lib/cjs/components/editgrid/fixtures/comp17.js +99 -0
- package/lib/cjs/components/editgrid/fixtures/index.d.ts +8 -7
- package/lib/cjs/components/editgrid/fixtures/index.js +3 -1
- package/lib/cjs/components/file/File.d.ts +2 -2
- package/lib/cjs/components/file/File.js +13 -2
- package/lib/cjs/components/file/editForm/File.edit.display.js +1 -1
- package/lib/cjs/components/form/editForm/Form.edit.form.js +1 -1
- package/lib/cjs/components/form/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/form/fixtures/index.js +3 -1
- package/lib/cjs/components/form/fixtures/nestedWizardForm.d.ts +771 -0
- package/lib/cjs/components/form/fixtures/nestedWizardForm.js +765 -0
- package/lib/cjs/components/number/Number.d.ts +17 -2
- package/lib/cjs/components/number/Number.js +26 -6
- package/lib/cjs/components/number/fixtures/comp10.d.ts +18 -0
- package/lib/cjs/components/number/fixtures/comp10.js +21 -0
- package/lib/cjs/components/number/fixtures/comp9.d.ts +18 -0
- package/lib/cjs/components/number/fixtures/comp9.js +21 -0
- package/lib/cjs/components/number/fixtures/index.d.ts +3 -1
- package/lib/cjs/components/number/fixtures/index.js +5 -1
- package/lib/cjs/components/panel/Panel.d.ts +1 -0
- package/lib/cjs/components/panel/Panel.js +1 -0
- package/lib/cjs/components/radio/Radio.d.ts +2 -18
- package/lib/cjs/components/radio/Radio.js +29 -27
- package/lib/cjs/components/radio/fixtures/comp12.d.ts +29 -0
- package/lib/cjs/components/radio/fixtures/comp12.js +36 -0
- package/lib/cjs/components/radio/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/radio/fixtures/index.js +3 -1
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +6 -0
- package/lib/cjs/components/recaptcha/ReCaptcha.js +6 -0
- package/lib/cjs/components/select/Select.d.ts +38 -0
- package/lib/cjs/components/select/Select.js +13 -3
- package/lib/cjs/components/select/fixtures/comp25.d.ts +59 -0
- package/lib/cjs/components/select/fixtures/comp25.js +66 -0
- package/lib/cjs/components/select/fixtures/comp26.d.ts +44 -0
- package/lib/cjs/components/select/fixtures/comp26.js +59 -0
- package/lib/cjs/components/select/fixtures/index.d.ts +3 -1
- package/lib/cjs/components/select/fixtures/index.js +5 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +0 -22
- package/lib/cjs/components/selectboxes/SelectBoxes.js +12 -9
- package/lib/cjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/cjs/components/tags/Tags.js +3 -3
- package/lib/cjs/components/time/Time.d.ts +2 -2
- package/lib/cjs/components/time/Time.form.js +2 -2
- package/lib/cjs/components/time/Time.js +3 -7
- package/lib/cjs/components/time/fixtures/comp4.d.ts +166 -0
- package/lib/cjs/components/time/fixtures/comp4.js +171 -0
- package/lib/cjs/components/time/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/time/fixtures/index.js +3 -1
- package/lib/cjs/templates/Templates.js +1 -1
- package/lib/cjs/translations/en.d.ts +1 -0
- package/lib/cjs/translations/en.js +1 -0
- package/lib/cjs/utils/utils.d.ts +9 -1
- package/lib/cjs/utils/utils.js +14 -13
- package/lib/mjs/CDN.js +1 -2
- package/lib/mjs/Form.d.ts +2 -2
- package/lib/mjs/Form.js +11 -5
- package/lib/mjs/PDF.js +1 -1
- package/lib/mjs/PDFBuilder.js +1 -1
- package/lib/mjs/Webform.js +10 -4
- package/lib/mjs/WebformBuilder.js +12 -3
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +1 -1
- package/lib/mjs/components/_classes/component/Component.js +4 -3
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +43 -25
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +2 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.js +5 -1
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +3 -0
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +57 -29
- package/lib/mjs/components/address/Address.d.ts +6 -0
- package/lib/mjs/components/address/Address.js +10 -1
- package/lib/mjs/components/currency/Currency.d.ts +2 -0
- package/lib/mjs/components/datagrid/DataGrid.d.ts +0 -1
- package/lib/mjs/components/datagrid/DataGrid.js +2 -9
- package/lib/mjs/components/datagrid/fixtures/comp11.d.ts +50 -0
- package/lib/mjs/components/datagrid/fixtures/comp11.js +53 -0
- package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
- package/lib/mjs/components/datamap/DataMap.js +1 -1
- package/lib/mjs/components/day/Day.d.ts +3 -4
- package/lib/mjs/components/day/Day.js +30 -10
- package/lib/mjs/components/editgrid/EditGrid.js +2 -5
- package/lib/mjs/components/editgrid/fixtures/comp17.d.ts +80 -0
- package/lib/mjs/components/editgrid/fixtures/comp17.js +97 -0
- package/lib/mjs/components/editgrid/fixtures/index.d.ts +8 -7
- package/lib/mjs/components/editgrid/fixtures/index.js +2 -1
- package/lib/mjs/components/file/File.d.ts +2 -2
- package/lib/mjs/components/file/File.js +13 -2
- package/lib/mjs/components/file/editForm/File.edit.display.js +1 -1
- package/lib/mjs/components/form/editForm/Form.edit.form.js +1 -1
- package/lib/mjs/components/form/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/form/fixtures/index.js +2 -1
- package/lib/mjs/components/form/fixtures/nestedWizardForm.d.ts +771 -0
- package/lib/mjs/components/form/fixtures/nestedWizardForm.js +763 -0
- package/lib/mjs/components/number/Number.d.ts +17 -2
- package/lib/mjs/components/number/Number.js +25 -5
- package/lib/mjs/components/number/fixtures/comp10.d.ts +18 -0
- package/lib/mjs/components/number/fixtures/comp10.js +19 -0
- package/lib/mjs/components/number/fixtures/comp9.d.ts +18 -0
- package/lib/mjs/components/number/fixtures/comp9.js +19 -0
- package/lib/mjs/components/number/fixtures/index.d.ts +3 -1
- package/lib/mjs/components/number/fixtures/index.js +3 -1
- package/lib/mjs/components/panel/Panel.d.ts +1 -0
- package/lib/mjs/components/panel/Panel.js +1 -0
- package/lib/mjs/components/radio/Radio.d.ts +2 -18
- package/lib/mjs/components/radio/Radio.js +32 -30
- package/lib/mjs/components/radio/fixtures/comp12.d.ts +29 -0
- package/lib/mjs/components/radio/fixtures/comp12.js +34 -0
- package/lib/mjs/components/radio/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/radio/fixtures/index.js +2 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +6 -0
- package/lib/mjs/components/recaptcha/ReCaptcha.js +9 -0
- package/lib/mjs/components/select/Select.d.ts +38 -0
- package/lib/mjs/components/select/Select.js +16 -4
- package/lib/mjs/components/select/fixtures/comp25.d.ts +59 -0
- package/lib/mjs/components/select/fixtures/comp25.js +64 -0
- package/lib/mjs/components/select/fixtures/comp26.d.ts +44 -0
- package/lib/mjs/components/select/fixtures/comp26.js +57 -0
- package/lib/mjs/components/select/fixtures/index.d.ts +3 -1
- package/lib/mjs/components/select/fixtures/index.js +3 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +0 -22
- package/lib/mjs/components/selectboxes/SelectBoxes.js +16 -9
- package/lib/mjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/mjs/components/tags/Tags.js +3 -3
- package/lib/mjs/components/time/Time.d.ts +2 -2
- package/lib/mjs/components/time/Time.form.js +2 -2
- package/lib/mjs/components/time/Time.js +3 -13
- package/lib/mjs/components/time/fixtures/comp4.d.ts +166 -0
- package/lib/mjs/components/time/fixtures/comp4.js +169 -0
- package/lib/mjs/components/time/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/time/fixtures/index.js +2 -1
- package/lib/mjs/templates/Templates.js +1 -1
- package/lib/mjs/translations/en.d.ts +1 -0
- package/lib/mjs/translations/en.js +1 -0
- package/lib/mjs/utils/utils.d.ts +9 -1
- package/lib/mjs/utils/utils.js +14 -2
- package/package.json +4 -4
|
@@ -493,6 +493,7 @@ export default class NestedComponent extends Field {
|
|
|
493
493
|
header: 'single',
|
|
494
494
|
collapsed: this.collapsed,
|
|
495
495
|
[this.nestedKey]: 'single',
|
|
496
|
+
messageContainer: 'single-scope',
|
|
496
497
|
});
|
|
497
498
|
let childPromise = Promise.resolve();
|
|
498
499
|
if (this.refs[this.nestedKey]) {
|
|
@@ -677,8 +678,11 @@ export default class NestedComponent extends Field {
|
|
|
677
678
|
isValid(data, dirty) {
|
|
678
679
|
return this.getComponents().reduce((valid, comp) => comp.isValid(data, dirty) && valid, super.isValid(data, dirty));
|
|
679
680
|
}
|
|
680
|
-
validationProcessor({ scope, data, row, instance }, flags) {
|
|
681
|
+
validationProcessor({ scope, data, row, instance, component }, flags) {
|
|
681
682
|
const { dirty } = flags;
|
|
683
|
+
if (this.root.hasExtraPages && this.page !== this.root.page) {
|
|
684
|
+
instance = this.getComponent(component.path);
|
|
685
|
+
}
|
|
682
686
|
if (!instance) {
|
|
683
687
|
return;
|
|
684
688
|
}
|
|
@@ -12,6 +12,9 @@ export default class NestedArrayComponent extends NestedDataComponent {
|
|
|
12
12
|
hasAddButton(): any;
|
|
13
13
|
getComponent(path: any, fn: any, originalPath: any): any;
|
|
14
14
|
everyComponent(fn: any, rowIndex: any, options?: {}): void;
|
|
15
|
+
_getEmailTableHeader(options: any): string;
|
|
16
|
+
_getEmailTableBody(options: any): string;
|
|
15
17
|
getComponents(rowIndex: any): any;
|
|
18
|
+
removeSubmissionMetadataRow(index: any): void;
|
|
16
19
|
}
|
|
17
20
|
import NestedDataComponent from '../nesteddata/NestedDataComponent';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
import _ from 'lodash';
|
|
3
|
-
import { componentValueTypes, getStringFromComponentPath } from '../../../utils/utils';
|
|
3
|
+
import { componentValueTypes, getStringFromComponentPath, isLayoutComponent } from '../../../utils/utils';
|
|
4
4
|
import Component from '../component/Component';
|
|
5
5
|
import NestedDataComponent from '../nesteddata/NestedDataComponent';
|
|
6
6
|
export default class NestedArrayComponent extends NestedDataComponent {
|
|
@@ -145,38 +145,60 @@ export default class NestedArrayComponent extends NestedDataComponent {
|
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
+
_getEmailTableHeader(options) {
|
|
149
|
+
let row = '';
|
|
150
|
+
const getHeaderCell = (component) => {
|
|
151
|
+
if (!component.isInputComponent || !component.visible || component.skipInEmail) {
|
|
152
|
+
return '';
|
|
153
|
+
}
|
|
154
|
+
const label = component.label || component.key;
|
|
155
|
+
return `<th style="padding: 5px 10px;">${label}</th>`;
|
|
156
|
+
};
|
|
157
|
+
const components = this.getComponents(0);
|
|
158
|
+
for (const component of components) {
|
|
159
|
+
if (component.isInputComponent) {
|
|
160
|
+
row += getHeaderCell(component);
|
|
161
|
+
}
|
|
162
|
+
else if (isLayoutComponent(component) && typeof component.everyComponent === 'function') {
|
|
163
|
+
component.everyComponent((comp) => {
|
|
164
|
+
row += getHeaderCell(comp);
|
|
165
|
+
}, options);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return `<thead><tr>${row}</tr></thead>`;
|
|
169
|
+
}
|
|
170
|
+
_getEmailTableBody(options) {
|
|
171
|
+
const getBodyCell = (component) => {
|
|
172
|
+
if (!component.isInputComponent || !component.visible || component.skipInEmail) {
|
|
173
|
+
return '';
|
|
174
|
+
}
|
|
175
|
+
return `<td style="padding: 5px 10px;">${component.getView(component.dataValue, options)}</td>`;
|
|
176
|
+
};
|
|
177
|
+
const rows = [];
|
|
178
|
+
for (const { components } of this.iteratableRows) {
|
|
179
|
+
let row = '';
|
|
180
|
+
for (const component of components) {
|
|
181
|
+
if (component.isInputComponent) {
|
|
182
|
+
row += getBodyCell(component);
|
|
183
|
+
}
|
|
184
|
+
else if (isLayoutComponent(component) && typeof component.everyComponent === 'function') {
|
|
185
|
+
component.everyComponent((comp) => {
|
|
186
|
+
row += getBodyCell(comp);
|
|
187
|
+
}, options);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
rows.push(`<tr>${row}</tr>`);
|
|
191
|
+
}
|
|
192
|
+
return `<tbody>${rows.join('')}</tbody>`;
|
|
193
|
+
}
|
|
148
194
|
getValueAsString(value, options) {
|
|
149
195
|
if (options?.email) {
|
|
150
|
-
|
|
196
|
+
return `
|
|
151
197
|
<table border="1" style="width:100%">
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
`);
|
|
155
|
-
this.component.components?.forEach((component) => {
|
|
156
|
-
const label = component.label || component.key;
|
|
157
|
-
result += `<th style="padding: 5px 10px;">${label}</th>`;
|
|
158
|
-
});
|
|
159
|
-
result += (`
|
|
160
|
-
</tr>
|
|
161
|
-
</thead>
|
|
162
|
-
<tbody>
|
|
163
|
-
`);
|
|
164
|
-
this.iteratableRows.forEach(({ components }) => {
|
|
165
|
-
result += '<tr>';
|
|
166
|
-
_.each(components, (component) => {
|
|
167
|
-
result += '<td style="padding:5px 10px;">';
|
|
168
|
-
if (component.isInputComponent && component.visible && !component.skipInEmail) {
|
|
169
|
-
result += component.getView(component.dataValue, options);
|
|
170
|
-
}
|
|
171
|
-
result += '</td>';
|
|
172
|
-
});
|
|
173
|
-
result += '</tr>';
|
|
174
|
-
});
|
|
175
|
-
result += (`
|
|
176
|
-
</tbody>
|
|
198
|
+
${this._getEmailTableHeader(options)}
|
|
199
|
+
${this._getEmailTableBody(options)}
|
|
177
200
|
</table>
|
|
178
|
-
|
|
179
|
-
return result;
|
|
201
|
+
`;
|
|
180
202
|
}
|
|
181
203
|
if (!value || !value.length) {
|
|
182
204
|
return '';
|
|
@@ -192,4 +214,10 @@ export default class NestedArrayComponent extends NestedDataComponent {
|
|
|
192
214
|
}
|
|
193
215
|
return super.getComponents();
|
|
194
216
|
}
|
|
217
|
+
removeSubmissionMetadataRow(index) {
|
|
218
|
+
const componentMetadata = _.get(this.root, `submission.metadata.selectData.${this.path}`, null);
|
|
219
|
+
if (_.isArray(componentMetadata)) {
|
|
220
|
+
componentMetadata.splice(index, 1);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
195
223
|
}
|
|
@@ -11,6 +11,12 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
11
11
|
weight: number;
|
|
12
12
|
schema: any;
|
|
13
13
|
};
|
|
14
|
+
static get serverConditionSettings(): {
|
|
15
|
+
operators: string[];
|
|
16
|
+
};
|
|
17
|
+
static get conditionOperatorsSettings(): {
|
|
18
|
+
operators: string[];
|
|
19
|
+
};
|
|
14
20
|
static get modeSwitcherRef(): string;
|
|
15
21
|
static get removeValueIconRef(): string;
|
|
16
22
|
static get searchInputRef(): string;
|
|
@@ -91,6 +91,15 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
91
91
|
schema: AddressComponent.schema(),
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
+
static get serverConditionSettings() {
|
|
95
|
+
return AddressComponent.conditionOperatorsSettings;
|
|
96
|
+
}
|
|
97
|
+
static get conditionOperatorsSettings() {
|
|
98
|
+
return {
|
|
99
|
+
...super.conditionOperatorsSettings,
|
|
100
|
+
operators: ['isEmpty', 'isNotEmpty'],
|
|
101
|
+
};
|
|
102
|
+
}
|
|
94
103
|
mergeSchema(component = {}) {
|
|
95
104
|
let { defaultSchema } = this;
|
|
96
105
|
if (component.components) {
|
|
@@ -181,7 +190,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
181
190
|
return (this.manualModeEnabled && this.dataValue) ? this.dataValue.address : this.dataValue;
|
|
182
191
|
}
|
|
183
192
|
set address(value) {
|
|
184
|
-
if (this.manualModeEnabled && !this.isMultiple) {
|
|
193
|
+
if (this.manualModeEnabled && !this.isMultiple && !_.isEqual(value, this.emptyValue)) {
|
|
185
194
|
this.dataValue.address = value;
|
|
186
195
|
}
|
|
187
196
|
else {
|
|
@@ -2,6 +2,8 @@ export default class CurrencyComponent extends NumberComponent {
|
|
|
2
2
|
constructor(component: any, options: any, data: any);
|
|
3
3
|
currencyPrefix: any;
|
|
4
4
|
currencySuffix: any;
|
|
5
|
+
parseNumber(value: any): number;
|
|
6
|
+
parseValue(value: any): string | null;
|
|
5
7
|
addZerosAndFormatValue(value: any): any;
|
|
6
8
|
stripPrefixSuffix(value: any): any;
|
|
7
9
|
}
|
|
@@ -260,13 +260,6 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
|
260
260
|
return hasHeader || ((col.label || col.title) && !col.hideLabel);
|
|
261
261
|
}, false);
|
|
262
262
|
}
|
|
263
|
-
loadRefs(element, refs) {
|
|
264
|
-
super.loadRefs(element, refs);
|
|
265
|
-
if (refs['messageContainer'] === 'single') {
|
|
266
|
-
const container = _.last(element.querySelectorAll(`[${this._referenceAttributeName}=messageContainer]`));
|
|
267
|
-
this.refs['messageContainer'] = container || this.refs['messageContainer'];
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
263
|
attach(element) {
|
|
271
264
|
this.loadRefs(element, {
|
|
272
265
|
[`${this.datagridKey}-row`]: 'multiple',
|
|
@@ -275,7 +268,6 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
|
275
268
|
[`${this.datagridKey}-removeRow`]: 'multiple',
|
|
276
269
|
[`${this.datagridKey}-group-header`]: 'multiple',
|
|
277
270
|
[this.datagridKey]: 'multiple',
|
|
278
|
-
'messageContainer': 'single'
|
|
279
271
|
});
|
|
280
272
|
if (this.allowReorder) {
|
|
281
273
|
this.refs[`${this.datagridKey}-row`].forEach((row, index) => {
|
|
@@ -440,10 +432,11 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
|
440
432
|
}
|
|
441
433
|
removeRow(index) {
|
|
442
434
|
const makeEmpty = index === 0 && this.rows.length === 1;
|
|
443
|
-
const flags = { isReordered: !makeEmpty, resetValue: makeEmpty };
|
|
435
|
+
const flags = { isReordered: !makeEmpty, resetValue: makeEmpty, modified: true };
|
|
444
436
|
this.splice(index, flags);
|
|
445
437
|
this.emit('dataGridDeleteRow', { index });
|
|
446
438
|
const [row] = this.rows.splice(index, 1);
|
|
439
|
+
this.removeSubmissionMetadataRow(index);
|
|
447
440
|
this.removeRowComponents(row);
|
|
448
441
|
this.updateRowsComponents(index);
|
|
449
442
|
this.setValue(this.dataValue, flags);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let title: string;
|
|
3
|
+
let name: string;
|
|
4
|
+
let path: string;
|
|
5
|
+
let type: string;
|
|
6
|
+
let display: string;
|
|
7
|
+
let components: ({
|
|
8
|
+
label: string;
|
|
9
|
+
reorder: boolean;
|
|
10
|
+
addAnotherPosition: string;
|
|
11
|
+
layoutFixed: boolean;
|
|
12
|
+
enableRowGroups: boolean;
|
|
13
|
+
initEmpty: boolean;
|
|
14
|
+
tableView: boolean;
|
|
15
|
+
key: string;
|
|
16
|
+
type: string;
|
|
17
|
+
input: boolean;
|
|
18
|
+
components: {
|
|
19
|
+
label: string;
|
|
20
|
+
widget: string;
|
|
21
|
+
tableView: boolean;
|
|
22
|
+
data: {
|
|
23
|
+
values: {
|
|
24
|
+
label: string;
|
|
25
|
+
value: string;
|
|
26
|
+
}[];
|
|
27
|
+
};
|
|
28
|
+
validateWhenHidden: boolean;
|
|
29
|
+
key: string;
|
|
30
|
+
type: string;
|
|
31
|
+
input: boolean;
|
|
32
|
+
defaultValue: string;
|
|
33
|
+
}[];
|
|
34
|
+
disableOnInvalid?: undefined;
|
|
35
|
+
} | {
|
|
36
|
+
type: string;
|
|
37
|
+
label: string;
|
|
38
|
+
key: string;
|
|
39
|
+
disableOnInvalid: boolean;
|
|
40
|
+
input: boolean;
|
|
41
|
+
tableView: boolean;
|
|
42
|
+
reorder?: undefined;
|
|
43
|
+
addAnotherPosition?: undefined;
|
|
44
|
+
layoutFixed?: undefined;
|
|
45
|
+
enableRowGroups?: undefined;
|
|
46
|
+
initEmpty?: undefined;
|
|
47
|
+
components?: undefined;
|
|
48
|
+
})[];
|
|
49
|
+
}
|
|
50
|
+
export default _default;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
title: 'Select in Data Grid',
|
|
3
|
+
name: 'selectInDataGrid',
|
|
4
|
+
path: 'selectInDataGrid',
|
|
5
|
+
type: 'form',
|
|
6
|
+
display: 'form',
|
|
7
|
+
components: [
|
|
8
|
+
{
|
|
9
|
+
label: 'Data Grid',
|
|
10
|
+
reorder: false,
|
|
11
|
+
addAnotherPosition: 'bottom',
|
|
12
|
+
layoutFixed: false,
|
|
13
|
+
enableRowGroups: false,
|
|
14
|
+
initEmpty: false,
|
|
15
|
+
tableView: false,
|
|
16
|
+
key: 'dataGrid',
|
|
17
|
+
type: 'datagrid',
|
|
18
|
+
input: true,
|
|
19
|
+
components: [
|
|
20
|
+
{
|
|
21
|
+
label: 'Select',
|
|
22
|
+
widget: 'choicesjs',
|
|
23
|
+
tableView: true,
|
|
24
|
+
data: {
|
|
25
|
+
values: [
|
|
26
|
+
{
|
|
27
|
+
label: 'Individual',
|
|
28
|
+
value: 'individual'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: 'Entity',
|
|
32
|
+
value: 'entity'
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
validateWhenHidden: false,
|
|
37
|
+
key: 'select',
|
|
38
|
+
type: 'select',
|
|
39
|
+
input: true,
|
|
40
|
+
defaultValue: 'entity'
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: 'button',
|
|
46
|
+
label: 'Submit',
|
|
47
|
+
key: 'submit',
|
|
48
|
+
disableOnInvalid: true,
|
|
49
|
+
input: true,
|
|
50
|
+
tableView: false
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
};
|
|
@@ -8,6 +8,7 @@ import comp7 from './comp7';
|
|
|
8
8
|
import comp8 from './comp8';
|
|
9
9
|
import comp9 from './comp9';
|
|
10
10
|
import comp10 from './comp10';
|
|
11
|
+
import comp11 from './comp11';
|
|
11
12
|
import withCollapsibleRowGroups from './comp-with-collapsible-groups';
|
|
12
13
|
import withConditionalFieldsAndValidations from './comp-with-conditional-components-and-validations';
|
|
13
14
|
import withDefValue from './comp-with-def-value';
|
|
@@ -18,4 +19,4 @@ import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
|
|
18
19
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
|
19
20
|
import withCheckboxes from './comp-with-checkboxes';
|
|
20
21
|
import withReorder from './comp-with-reorder';
|
|
21
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
|
|
22
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
|
|
@@ -8,6 +8,7 @@ import comp7 from './comp7';
|
|
|
8
8
|
import comp8 from './comp8';
|
|
9
9
|
import comp9 from './comp9';
|
|
10
10
|
import comp10 from './comp10';
|
|
11
|
+
import comp11 from './comp11';
|
|
11
12
|
import withDefValue from './comp-with-def-value';
|
|
12
13
|
import withRowGroupsAndDefValue from './comp-row-groups-with-def-value';
|
|
13
14
|
import modalWithRequiredFields from './comp-modal-with-required-fields';
|
|
@@ -18,4 +19,4 @@ import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
|
|
18
19
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
|
19
20
|
import withCheckboxes from './comp-with-checkboxes';
|
|
20
21
|
import withReorder from './comp-with-reorder';
|
|
21
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
|
|
22
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
|
|
@@ -236,7 +236,7 @@ export default class DataMapComponent extends DataGridComponent {
|
|
|
236
236
|
delete dataValue[key];
|
|
237
237
|
const comp = components[this.valueKey];
|
|
238
238
|
comp.component.key = newKey;
|
|
239
|
-
comp.path = Components.
|
|
239
|
+
comp.path = Components.getComponentPath(comp);
|
|
240
240
|
key = newKey;
|
|
241
241
|
});
|
|
242
242
|
const valueComponent = _.clone(this.component.valueComponent);
|
|
@@ -17,9 +17,9 @@ export default class DayComponent extends Field {
|
|
|
17
17
|
constructor(component: any, options: any, data: any);
|
|
18
18
|
/**
|
|
19
19
|
* The empty value for day component.
|
|
20
|
-
* @returns {'
|
|
20
|
+
* @returns {''} - The empty value of the day component.
|
|
21
21
|
*/
|
|
22
|
-
get emptyValue(): "
|
|
22
|
+
get emptyValue(): "";
|
|
23
23
|
get valueMask(): RegExp;
|
|
24
24
|
get dayRequired(): any;
|
|
25
25
|
get showDay(): boolean;
|
|
@@ -130,8 +130,7 @@ export default class DayComponent extends Field {
|
|
|
130
130
|
* @returns {string|null} - The string value of the date.
|
|
131
131
|
*/
|
|
132
132
|
getValueAsString(value: any): string | null;
|
|
133
|
-
focus(field: any): void;
|
|
134
133
|
isPartialDay(value: any): boolean;
|
|
135
|
-
getValidationFormat():
|
|
134
|
+
getValidationFormat(): string;
|
|
136
135
|
}
|
|
137
136
|
import Field from '../_classes/field/Field';
|
|
@@ -25,7 +25,8 @@ export default class DayComponent extends Field {
|
|
|
25
25
|
required: false
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
dayFirst: false
|
|
28
|
+
dayFirst: false,
|
|
29
|
+
defaultValue: ''
|
|
29
30
|
}, ...extend);
|
|
30
31
|
}
|
|
31
32
|
static get builderInfo() {
|
|
@@ -62,10 +63,10 @@ export default class DayComponent extends Field {
|
|
|
62
63
|
}
|
|
63
64
|
/**
|
|
64
65
|
* The empty value for day component.
|
|
65
|
-
* @returns {'
|
|
66
|
+
* @returns {''} - The empty value of the day component.
|
|
66
67
|
*/
|
|
67
68
|
get emptyValue() {
|
|
68
|
-
return '
|
|
69
|
+
return '';
|
|
69
70
|
}
|
|
70
71
|
get valueMask() {
|
|
71
72
|
return /^\d{2}\/\d{2}\/\d{4}$/;
|
|
@@ -341,15 +342,21 @@ export default class DayComponent extends Field {
|
|
|
341
342
|
const valueParts = value.split('/');
|
|
342
343
|
const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
|
343
344
|
const defaultValue = this.component.defaultValue ? this.component.defaultValue.split('/') : '';
|
|
344
|
-
const getNextPart = (shouldTake, defaultValue) =>
|
|
345
|
+
const getNextPart = (shouldTake, defaultValue) => {
|
|
346
|
+
// Only push the part if it's not an empty string
|
|
347
|
+
const part = shouldTake ? valueParts.shift() : defaultValue;
|
|
348
|
+
if (part !== '') {
|
|
349
|
+
dateParts.push(part);
|
|
350
|
+
}
|
|
351
|
+
};
|
|
345
352
|
if (this.dayFirst) {
|
|
346
|
-
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '
|
|
353
|
+
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '');
|
|
347
354
|
}
|
|
348
|
-
getNextPart(this.showMonth, defaultValue ? defaultValue[MONTH] : '
|
|
355
|
+
getNextPart(this.showMonth, defaultValue ? defaultValue[MONTH] : '');
|
|
349
356
|
if (!this.dayFirst) {
|
|
350
|
-
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '
|
|
357
|
+
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '');
|
|
351
358
|
}
|
|
352
|
-
getNextPart(this.showYear, defaultValue ? defaultValue[YEAR] : '
|
|
359
|
+
getNextPart(this.showYear, defaultValue ? defaultValue[YEAR] : '');
|
|
353
360
|
return dateParts.join('/');
|
|
354
361
|
}
|
|
355
362
|
/**
|
|
@@ -361,7 +368,7 @@ export default class DayComponent extends Field {
|
|
|
361
368
|
setValueAt(index, value) {
|
|
362
369
|
// temporary solution to avoid input reset
|
|
363
370
|
// on invalid date.
|
|
364
|
-
if (
|
|
371
|
+
if (value === 'Invalid date') {
|
|
365
372
|
return null;
|
|
366
373
|
}
|
|
367
374
|
const parts = value.split('/');
|
|
@@ -554,9 +561,22 @@ export default class DayComponent extends Field {
|
|
|
554
561
|
}
|
|
555
562
|
const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
|
556
563
|
const values = value.split('/');
|
|
564
|
+
if (values.length < 3) {
|
|
565
|
+
return true;
|
|
566
|
+
}
|
|
557
567
|
return (values[DAY] === '00' || values[MONTH] === '00' || values[YEAR] === '0000');
|
|
558
568
|
}
|
|
559
569
|
getValidationFormat() {
|
|
560
|
-
|
|
570
|
+
let validationFormat = this.dayFirst ? 'DD-MM-YYYY' : 'MM-DD-YYYY';
|
|
571
|
+
if (this.fields?.day?.hide) {
|
|
572
|
+
validationFormat = validationFormat.replace('DD-', '');
|
|
573
|
+
}
|
|
574
|
+
if (this.fields?.month?.hide) {
|
|
575
|
+
validationFormat = validationFormat.replace('MM-', '');
|
|
576
|
+
}
|
|
577
|
+
if (this.fields?.year?.hide) {
|
|
578
|
+
validationFormat = validationFormat.replace('-YYYY', '');
|
|
579
|
+
}
|
|
580
|
+
return validationFormat;
|
|
561
581
|
}
|
|
562
582
|
}
|
|
@@ -484,11 +484,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
484
484
|
else {
|
|
485
485
|
this.removeClass(this.refs.component, `formio-component-${this.component.type}-row-open`);
|
|
486
486
|
}
|
|
487
|
-
|
|
488
|
-
this.loadRefs(element, {
|
|
489
|
-
messageContainer: 'single-scope',
|
|
490
|
-
});
|
|
491
|
-
return superAttach;
|
|
487
|
+
return super.attach(element);
|
|
492
488
|
}
|
|
493
489
|
flattenRowDataValue(dataValue) {
|
|
494
490
|
const flattened = {};
|
|
@@ -889,6 +885,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
889
885
|
}
|
|
890
886
|
this.clearErrors(rowIndex);
|
|
891
887
|
this.baseRemoveRow(rowIndex);
|
|
888
|
+
this.removeSubmissionMetadataRow(rowIndex);
|
|
892
889
|
this.splice(rowIndex);
|
|
893
890
|
this.emit('editGridDeleteRow', {
|
|
894
891
|
index: rowIndex
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let type: string;
|
|
3
|
+
let display: string;
|
|
4
|
+
let components: ({
|
|
5
|
+
label: string;
|
|
6
|
+
tableView: boolean;
|
|
7
|
+
rowDrafts: boolean;
|
|
8
|
+
key: string;
|
|
9
|
+
type: string;
|
|
10
|
+
input: boolean;
|
|
11
|
+
components: {
|
|
12
|
+
collapsible: boolean;
|
|
13
|
+
key: string;
|
|
14
|
+
type: string;
|
|
15
|
+
label: string;
|
|
16
|
+
input: boolean;
|
|
17
|
+
tableView: boolean;
|
|
18
|
+
components: {
|
|
19
|
+
label: string;
|
|
20
|
+
columns: ({
|
|
21
|
+
components: {
|
|
22
|
+
label: string;
|
|
23
|
+
optionsLabelPosition: string;
|
|
24
|
+
inline: boolean;
|
|
25
|
+
tableView: boolean;
|
|
26
|
+
values: {
|
|
27
|
+
label: string;
|
|
28
|
+
value: string;
|
|
29
|
+
shortcut: string;
|
|
30
|
+
}[];
|
|
31
|
+
key: string;
|
|
32
|
+
type: string;
|
|
33
|
+
input: boolean;
|
|
34
|
+
}[];
|
|
35
|
+
width: number;
|
|
36
|
+
offset: number;
|
|
37
|
+
push: number;
|
|
38
|
+
pull: number;
|
|
39
|
+
size: string;
|
|
40
|
+
currentWidth: number;
|
|
41
|
+
} | {
|
|
42
|
+
components: {
|
|
43
|
+
label: string;
|
|
44
|
+
applyMaskOn: string;
|
|
45
|
+
autoExpand: boolean;
|
|
46
|
+
tableView: boolean;
|
|
47
|
+
key: string;
|
|
48
|
+
conditional: {
|
|
49
|
+
show: boolean;
|
|
50
|
+
conjunction: string;
|
|
51
|
+
};
|
|
52
|
+
type: string;
|
|
53
|
+
input: boolean;
|
|
54
|
+
}[];
|
|
55
|
+
width: number;
|
|
56
|
+
offset: number;
|
|
57
|
+
push: number;
|
|
58
|
+
pull: number;
|
|
59
|
+
size: string;
|
|
60
|
+
currentWidth: number;
|
|
61
|
+
})[];
|
|
62
|
+
key: string;
|
|
63
|
+
type: string;
|
|
64
|
+
input: boolean;
|
|
65
|
+
tableView: boolean;
|
|
66
|
+
}[];
|
|
67
|
+
}[];
|
|
68
|
+
disableOnInvalid?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
type: string;
|
|
71
|
+
label: string;
|
|
72
|
+
key: string;
|
|
73
|
+
disableOnInvalid: boolean;
|
|
74
|
+
input: boolean;
|
|
75
|
+
tableView: boolean;
|
|
76
|
+
rowDrafts?: undefined;
|
|
77
|
+
components?: undefined;
|
|
78
|
+
})[];
|
|
79
|
+
}
|
|
80
|
+
export default _default;
|