diff --git a/packages/form-js-editor/src/features/properties-panel/Util.js b/packages/form-js-editor/src/features/properties-panel/Util.js index 46e00da4f..a3b0a6477 100644 --- a/packages/form-js-editor/src/features/properties-panel/Util.js +++ b/packages/form-js-editor/src/features/properties-panel/Util.js @@ -59,7 +59,7 @@ export function isProhibitedPath(path) { return path.split('.').some((segment) => prohibitedSegments.includes(segment)); } -export const LABELED_NON_INPUTS = ['button', 'group', 'dynamiclist', 'iframe', 'table']; +export const LABELED_NON_INPUTS = ['button', 'group', 'dynamiclist', 'iframe', 'table', 'documentPreview']; export const INPUTS = [ 'checkbox', diff --git a/packages/form-js-editor/src/features/properties-panel/entries/LabelEntry.js b/packages/form-js-editor/src/features/properties-panel/entries/LabelEntry.js index e6ad46fde..3e26771e4 100644 --- a/packages/form-js-editor/src/features/properties-panel/entries/LabelEntry.js +++ b/packages/form-js-editor/src/features/properties-panel/entries/LabelEntry.js @@ -156,6 +156,7 @@ function getLabelText(type) { case 'table': return 'Table label'; case 'iframe': + case 'documentPreview': return 'Title'; default: return 'Field label'; diff --git a/packages/form-js-editor/src/features/properties-panel/entries/TitleEntry.js b/packages/form-js-editor/src/features/properties-panel/entries/TitleEntry.js deleted file mode 100644 index 304d00e9b..000000000 --- a/packages/form-js-editor/src/features/properties-panel/entries/TitleEntry.js +++ /dev/null @@ -1,51 +0,0 @@ -import { get } from 'min-dash'; - -import { useService, useVariables } from '../hooks'; - -import { FeelTemplatingEntry, isFeelEntryEdited } from '@bpmn-io/properties-panel'; - -export function TitleEntry(props) { - const { editField, field } = props; - - const entries = []; - - entries.push({ - id: 'title', - component: Title, - editField: editField, - field: field, - isEdited: isFeelEntryEdited, - isDefaultVisible: (field) => field.type === 'documentPreview', - }); - - return entries; -} - -function Title(props) { - const { editField, field, id } = props; - - const debounce = useService('debounce'); - - const variables = useVariables().map((name) => ({ name })); - - const path = ['title']; - - const getValue = () => { - return get(field, path, ''); - }; - - const setValue = (value) => { - return editField(field, path, value); - }; - - return FeelTemplatingEntry({ - debounce, - element: field, - getValue, - id, - label: 'Title', - singleLine: true, - setValue, - variables, - }); -} diff --git a/packages/form-js-editor/src/features/properties-panel/entries/index.js b/packages/form-js-editor/src/features/properties-panel/entries/index.js index a1d9f75d3..d2b962a82 100644 --- a/packages/form-js-editor/src/features/properties-panel/entries/index.js +++ b/packages/form-js-editor/src/features/properties-panel/entries/index.js @@ -42,7 +42,6 @@ export { StaticColumnsSourceEntry } from './StaticColumnsSourceEntry'; export { VersionTagEntry } from './VersionTagEntry'; export { AcceptEntry } from './AcceptEntry'; export { MultipleEntry } from './MultipleEntry'; -export { TitleEntry } from './TitleEntry'; export { DocumentsDataSourceEntry } from './DocumentsDataSource'; export { EndpointKeyEntry } from './EndpointKey'; export { MaxHeightEntry } from './MaxHeightEntry'; diff --git a/packages/form-js-editor/src/features/properties-panel/groups/GeneralGroup.js b/packages/form-js-editor/src/features/properties-panel/groups/GeneralGroup.js index ec4bcfe24..f4879dbfd 100644 --- a/packages/form-js-editor/src/features/properties-panel/groups/GeneralGroup.js +++ b/packages/form-js-editor/src/features/properties-panel/groups/GeneralGroup.js @@ -26,7 +26,6 @@ import { VersionTagEntry, AcceptEntry, MultipleEntry, - TitleEntry, DocumentsDataSourceEntry, EndpointKeyEntry, } from '../entries'; @@ -36,7 +35,6 @@ export function GeneralGroup(field, editField, getService) { ...IdEntry({ field, editField }), ...VersionTagEntry({ field, editField }), ...LabelEntry({ field, editField }), - ...TitleEntry({ field, editField }), ...DescriptionEntry({ field, editField }), ...KeyEntry({ field, editField, getService }), ...PathEntry({ field, editField, getService }), diff --git a/packages/form-js-viewer/test/spec/documentPreview.json b/packages/form-js-viewer/test/spec/documentPreview.json index b42f9d7f7..df018a67c 100644 --- a/packages/form-js-viewer/test/spec/documentPreview.json +++ b/packages/form-js-viewer/test/spec/documentPreview.json @@ -1,7 +1,7 @@ { "components": [ { - "title": "Case {{case_id}} documents", + "label": "Case {{case_id}} documents", "type": "documentPreview", "id": "Field_0wy8tws", "dataSource": "=my_documents", diff --git a/packages/form-json-schema/src/defs/component.json b/packages/form-json-schema/src/defs/component.json index 9230d4482..6d057ba68 100644 --- a/packages/form-json-schema/src/defs/component.json +++ b/packages/form-json-schema/src/defs/component.json @@ -273,11 +273,6 @@ "description": "Allow multiple files to be selected.", "type": ["boolean", "string"] }, - "title": { - "$id": "#/component/title", - "description": "The title displayed on top of the document preview component.", - "type": "string" - }, "maxHeight": { "$id": "#/component/maxHeight", "description": "The maximum height of a document item in the document preview component.", diff --git a/packages/form-json-schema/src/defs/rules/rules-allowed-properties.json b/packages/form-json-schema/src/defs/rules/rules-allowed-properties.json index bf351a1f5..fe0b45c17 100644 --- a/packages/form-json-schema/src/defs/rules/rules-allowed-properties.json +++ b/packages/form-json-schema/src/defs/rules/rules-allowed-properties.json @@ -465,7 +465,6 @@ }, "then": { "properties": { - "title": false, "endpointKey": false, "maxHeight": false } diff --git a/packages/form-json-schema/test/fixtures/documentPreview.js b/packages/form-json-schema/test/fixtures/documentPreview.js index d733aa4e1..5e7ae343e 100644 --- a/packages/form-json-schema/test/fixtures/documentPreview.js +++ b/packages/form-json-schema/test/fixtures/documentPreview.js @@ -4,7 +4,7 @@ export const form = { { type: 'documentPreview', dataSource: '=someSource', - title: 'My documents', + label: 'My documents', endpointKey: '=someEndpointKey', maxHeight: 100, }, diff --git a/packages/form-json-schema/test/fixtures/title-not-allowed.js b/packages/form-json-schema/test/fixtures/title-not-allowed.js deleted file mode 100644 index 9ceaeb89d..000000000 --- a/packages/form-json-schema/test/fixtures/title-not-allowed.js +++ /dev/null @@ -1,27 +0,0 @@ -export const form = { - type: 'default', - components: [ - { - type: 'textfield', - key: 'textfield_g35o3e', - title: 'My title', - }, - ], -}; - -export const errors = [ - { - instancePath: '/components/0/title', - keyword: 'false schema', - message: 'boolean schema is false', - params: {}, - schemaPath: '#/properties/components/items/allOf/1/allOf/23/then/properties/title/false schema', - }, - { - instancePath: '/components/0', - schemaPath: '#/properties/components/items/allOf/1/allOf/23/if', - keyword: 'if', - params: { failingKeyword: 'then' }, - message: 'must match "then" schema', - }, -]; diff --git a/packages/form-json-schema/test/spec/validation.spec.js b/packages/form-json-schema/test/spec/validation.spec.js index ab1a556f3..1e487b08f 100644 --- a/packages/form-json-schema/test/spec/validation.spec.js +++ b/packages/form-json-schema/test/spec/validation.spec.js @@ -183,8 +183,6 @@ describe('validation', function () { testForm('documentPreview'); - testForm('title-not-allowed'); - testForm('maxHeight-not-allowed'); testForm('endpointKey-not-allowed');