diff --git a/packages/form-js-editor/src/features/properties-panel/PropertiesPanelHeaderProvider.js b/packages/form-js-editor/src/features/properties-panel/PropertiesPanelHeaderProvider.js index ba38b0cf6..47a4eeefb 100644 --- a/packages/form-js-editor/src/features/properties-panel/PropertiesPanelHeaderProvider.js +++ b/packages/form-js-editor/src/features/properties-panel/PropertiesPanelHeaderProvider.js @@ -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); } 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 df130c740..e658e90e4 100644 --- a/packages/form-js-editor/test/spec/core/FieldFactory.spec.js +++ b/packages/form-js-editor/test/spec/core/FieldFactory.spec.js @@ -120,7 +120,6 @@ describe('core/FieldFactory', function () { 'Date time', testCreate({ type: 'datetime', - label: 'Date time', keyed: true, defaults: { subtype: 'date', diff --git a/packages/form-js-viewer/src/core/FieldFactory.js b/packages/form-js-viewer/src/core/FieldFactory.js index 499b3a914..42f94899d 100644 --- a/packages/form-js-viewer/src/core/FieldFactory.js +++ b/packages/form-js-viewer/src/core/FieldFactory.js @@ -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, }); diff --git a/packages/form-js-viewer/test/spec/render/components/form-fields/Datetime.spec.js b/packages/form-js-viewer/test/spec/render/components/form-fields/Datetime.spec.js index 0f05ce213..bd7d40d68 100644 --- a/packages/form-js-viewer/test/spec/render/components/form-fields/Datetime.spec.js +++ b/packages/form-js-viewer/test/spec/render/components/form-fields/Datetime.spec.js @@ -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;