From 05738d9f177c0fd3018e0fd7b58d53f3a3b90ef5 Mon Sep 17 00:00:00 2001 From: Skaiir Date: Mon, 14 Oct 2024 09:22:26 +0200 Subject: [PATCH] chore: rename `isNew` to `isNewField` Related to #1291 --- packages/form-js-editor/test/spec/core/FieldFactory.spec.js | 4 ++-- packages/form-js-viewer/src/core/FieldFactory.js | 4 ++-- .../src/render/components/form-fields/Datetime.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/form-js-editor/test/spec/core/FieldFactory.spec.js b/packages/form-js-editor/test/spec/core/FieldFactory.spec.js index 13acf42f9..c125aec2e 100644 --- a/packages/form-js-editor/test/spec/core/FieldFactory.spec.js +++ b/packages/form-js-editor/test/spec/core/FieldFactory.spec.js @@ -310,12 +310,12 @@ describe('core/FieldFactory', function () { // helpers ////////////// -function testCreate(options, isNew = true) { +function testCreate(options, isNewField = true) { const { type, label, keyed = false, initial = {}, expected = {} } = options; return inject(function (fieldFactory) { // when - const field = fieldFactory.create({ type, ...initial }, isNew); + const field = fieldFactory.create({ type, ...initial }, isNewField); // then expect(field.id).to.exist; diff --git a/packages/form-js-viewer/src/core/FieldFactory.js b/packages/form-js-viewer/src/core/FieldFactory.js index 09fc99660..9f4dd2dc3 100644 --- a/packages/form-js-viewer/src/core/FieldFactory.js +++ b/packages/form-js-viewer/src/core/FieldFactory.js @@ -13,7 +13,7 @@ export class FieldFactory { this._formFields = formFields; } - create(attrs, isNew = true) { + create(attrs, isNewField = true) { const { id, type, key, path, _parent } = attrs; const fieldDefinition = this._formFields.get(type); @@ -65,7 +65,7 @@ export class FieldFactory { ...(config.label ? { label: config.label } : {}), ...attrs, }, - isNew, + isNewField, ); this._ensureId(field); diff --git a/packages/form-js-viewer/src/render/components/form-fields/Datetime.js b/packages/form-js-viewer/src/render/components/form-fields/Datetime.js index dc619a157..a34b1ade9 100644 --- a/packages/form-js-viewer/src/render/components/form-fields/Datetime.js +++ b/packages/form-js-viewer/src/render/components/form-fields/Datetime.js @@ -214,11 +214,11 @@ Datetime.config = { group: 'basic-input', emptyValue: null, sanitizeValue: sanitizeDateTimePickerValue, - create: (options = {}, isNew) => { + create: (options = {}, isNewField) => { const defaults = {}; set(defaults, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE); - if (isNew) { + if (isNewField) { set(defaults, DATE_LABEL_PATH, 'Date'); }