@sprucelabs/heartwood-view-controllers 118.3.0 → 118.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -392,6 +392,13 @@ export default class FormViewController extends AbstractViewController {
|
|
|
392
392
|
}
|
|
393
393
|
addSection(section) {
|
|
394
394
|
const { atIndex } = section, sec = __rest(section, ["atIndex"]);
|
|
395
|
+
if (sec.id && this.hasSection(sec.id)) {
|
|
396
|
+
throw new SchemaError({
|
|
397
|
+
code: 'INVALID_PARAMETERS',
|
|
398
|
+
friendlyMessage: `You can't add a section with the id ${sec.id} because it already exists!`,
|
|
399
|
+
parameters: ['sectionIdOrIdx'],
|
|
400
|
+
});
|
|
401
|
+
}
|
|
395
402
|
if (typeof atIndex === 'number') {
|
|
396
403
|
this.model.sections.splice(atIndex, 0, Object.assign({}, sec));
|
|
397
404
|
}
|
|
@@ -364,6 +364,13 @@ class FormViewController extends Abstract_vc_1.default {
|
|
|
364
364
|
}
|
|
365
365
|
addSection(section) {
|
|
366
366
|
const { atIndex, ...sec } = section;
|
|
367
|
+
if (sec.id && this.hasSection(sec.id)) {
|
|
368
|
+
throw new schema_1.SchemaError({
|
|
369
|
+
code: 'INVALID_PARAMETERS',
|
|
370
|
+
friendlyMessage: `You can't add a section with the id ${sec.id} because it already exists!`,
|
|
371
|
+
parameters: ['sectionIdOrIdx'],
|
|
372
|
+
});
|
|
373
|
+
}
|
|
367
374
|
if (typeof atIndex === 'number') {
|
|
368
375
|
this.model.sections.splice(atIndex, 0, { ...sec });
|
|
369
376
|
}
|
package/package.json
CHANGED