Skip to content

Commit

Permalink
chore: rename isNew to isNewField
Browse files Browse the repository at this point in the history
Related to #1291
  • Loading branch information
Skaiir committed Oct 14, 2024
1 parent faf25ff commit 05738d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/form-js-editor/test/spec/core/FieldFactory.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/form-js-viewer/src/core/FieldFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -65,7 +65,7 @@ export class FieldFactory {
...(config.label ? { label: config.label } : {}),
...attrs,
},
isNew,
isNewField,
);

this._ensureId(field);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down

0 comments on commit 05738d9

Please sign in to comment.