Skip to content

Commit

Permalink
fix: do not create a simple label in datetime components
Browse files Browse the repository at this point in the history
Closes #1268
  • Loading branch information
Skaiir committed Oct 4, 2024
1 parent a86d4f4 commit 9cb6c1a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export function getPropertiesPanelHeaderProvider(options = {}) {
if (headerlessTypes.includes(type)) {
return '';
}
if (type === 'datetime') {
return field.dateLabel || field.timeLabel;
}
if (type === 'text') {
return textToLabel(field.text);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ describe('core/FieldFactory', function () {
'Date time',
testCreate({
type: 'datetime',
label: 'Date time',
keyed: true,
defaults: {
subtype: 'date',
Expand Down
11 changes: 4 additions & 7 deletions packages/form-js-viewer/src/core/FieldFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,12 @@ export class FieldFactory {
throw new Error(`binding path '${[...parentPath, ...path.split('.')].join('.')}' is already claimed`);
}

const labelAttrs =
applyDefaults && config.label
? {
label: config.label,
}
: {};
// currently using a hard coded solution while we evaluate refactoring
// cf. https://github.com/bpmn-io/form-js/issues/1291
const shouldApplyLabel = applyDefaults && !(config.type === 'datetime') && config.label;

const field = config.create({
...labelAttrs,
...(shouldApplyLabel ? { label: config.label } : {}),
...attrs,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,6 @@ describe('Datetime', function () {
// assume
const { config } = Datetime;
expect(config.type).to.eql('datetime');
expect(config.label).to.eql('Date time');
expect(config.group).to.eql('basic-input');
expect(config.keyed).to.be.true;

Expand Down

0 comments on commit 9cb6c1a

Please sign in to comment.