diff --git a/CHANGELOG.md b/CHANGELOG.md index d1dac178..aa8ec526 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,8 +47,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p * `changeExpanded` event is removed from element events, use `changeElementState` event instead; * When exporting the diagram the expanded state is serialized only with `elementState` while using `isExpanded` property when importing the diagram for backward compatibility. - Introduce `ElementTemplate.supports` property for templates to tell its capabilities such as ability to expand/collapse or resized by user. -- Deprecate `DefaultLinkTemplate` and `DefaultLink` and alias them to `StandardLinkTemplate` and `StandardRelation`: - * Change CSS class for default link template from `reactodia-default-link` to `reactodia-standard-link`. +- Use consistent naming for standard element and link templates: + * Deprecate `DefaultLinkTemplate` and `DefaultLink` and alias them to `StandardLinkTemplate` and `StandardRelation`; + * Change CSS class for standard element template from `reactodia-standard-template` to `reactodia-standard-element`; + * Change CSS class for default link template from `reactodia-default-link` to `reactodia-standard-link`; + * Change translation groups from `standard_template` / `default_link_template` to `standard_element` / `standard_link`. - Move "expand/collapse on double click" global element behavior to `StandardEntity` and `ClassicEntity` implementation only. - Add `setTemplateProperty()` utility function to easily set or unset template state property. - Change `MetadataProvider.{createEntity, createRelation}` to return result object with initial template state in addition to the data to customize the created cells (i.e. new elements can be expanded or collapsed). diff --git a/examples/classicWorkspace.tsx b/examples/classicWorkspace.tsx index 99ad28b3..b6fa667a 100644 --- a/examples/classicWorkspace.tsx +++ b/examples/classicWorkspace.tsx @@ -55,11 +55,11 @@ function ClassicWorkspaceExample() { } return undefined; }, - linkTemplateResolver: (linkType, link) => { + linkTemplateResolver: linkType => { if (linkType === 'http://www.w3.org/2000/01/rdf-schema#subClassOf') { return Reactodia.DefaultLinkTemplate; } - return OntologyLinkTemplates(linkType, link); + return OntologyLinkTemplates(linkType); }, }} toolbar={{ diff --git a/i18n/i18n.schema.json b/i18n/i18n.schema.json index af07e03f..260a2937 100644 --- a/i18n/i18n.schema.json +++ b/i18n/i18n.schema.json @@ -116,18 +116,6 @@ "iri_blank": { "$ref": "#/$defs/Value" } } }, - "default_link_template": { - "$ref": "#/$defs/Group", - "additionalProperties": false, - "properties": { - "group_source.title": { "$ref": "#/$defs/Value" }, - "group_source.value": { "$ref": "#/$defs/Value" }, - "group_target.title": { "$ref": "#/$defs/Value" }, - "group_target.value": { "$ref": "#/$defs/Value" }, - "label.title": { "$ref": "#/$defs/Value" }, - "property.title": { "$ref": "#/$defs/Value" } - } - }, "default_workspace": { "$ref": "#/$defs/Group", "additionalProperties": false, @@ -309,7 +297,7 @@ "zoom_to_fit.title": { "$ref": "#/$defs/Value" } } }, - "standard_template": { + "standard_element": { "$ref": "#/$defs/Group", "additionalProperties": false, "properties": { @@ -329,6 +317,18 @@ "ungroup.title": { "$ref": "#/$defs/Value" } } }, + "standard_link": { + "$ref": "#/$defs/Group", + "additionalProperties": false, + "properties": { + "group_source.title": { "$ref": "#/$defs/Value" }, + "group_source.value": { "$ref": "#/$defs/Value" }, + "group_target.title": { "$ref": "#/$defs/Value" }, + "group_target.value": { "$ref": "#/$defs/Value" }, + "label.title": { "$ref": "#/$defs/Value" }, + "property.title": { "$ref": "#/$defs/Value" } + } + }, "toolbar": { "$ref": "#/$defs/Group", "additionalProperties": false, diff --git a/i18n/translations/en.reactodia-translation.json b/i18n/translations/en.reactodia-translation.json index f2825a62..afded461 100644 --- a/i18n/translations/en.reactodia-translation.json +++ b/i18n/translations/en.reactodia-translation.json @@ -84,14 +84,6 @@ "iri": "<{{value}}>", "iri_blank": "(blank node)" }, - "default_link_template": { - "group_source.title": "{{value}} source elements", - "group_source.value": "{{value}}", - "group_target.title": "{{value}} target elements", - "group_target.value": "{{value}}", - "label.title": "{{relation}} {{relationIri}}", - "property.title": "{{property}} {{propertyIri}}" - }, "default_workspace": { "search_section_entities.label": "Entities", "search_section_entities.title": "Entity lookup", @@ -217,7 +209,7 @@ "remove.title_single": "Remove an element from the diagram", "zoom_to_fit.title": "Zoom to fit selected elements into view" }, - "standard_template": { + "standard_element": { "blank_node": "(blank node)", "default_type": "Thing", "delete.label": "Delete", @@ -233,6 +225,14 @@ "property.title": "{{property}} {{propertyIri}}", "ungroup.title": "Ungroup an entity" }, + "standard_link": { + "group_source.title": "{{value}} source elements", + "group_source.value": "{{value}}", + "group_target.title": "{{value}} target elements", + "group_target.value": "{{value}}", + "label.title": "{{relation}} {{relationIri}}", + "property.title": "{{property}} {{propertyIri}}" + }, "toolbar": { "menu_toggle.title": "Open menu" }, diff --git a/src/legacy-styles.tsx b/src/legacy-styles.tsx index 2074cbf4..994013a7 100644 --- a/src/legacy-styles.tsx +++ b/src/legacy-styles.tsx @@ -1,5 +1,5 @@ +import type { LinkTypeIri } from './data/model'; import type { TypeStyleResolver, LinkTemplate } from './diagram/customization'; -import type { TypedLinkResolver } from './widgets/canvas'; const classIcon = require('@images/semantic/class.svg') as string; const objectPropertyIcon = require('@images/semantic/objectProperty.svg') as string; @@ -98,7 +98,9 @@ export function makeLinkStyleShowIri(Reactodia: typeof import('./workspace')): L * * @deprecated These link templates will be removed in later versions */ -export function makeOntologyLinkTemplates(Reactodia: typeof import('./workspace')): TypedLinkResolver { +export function makeOntologyLinkTemplates( + Reactodia: typeof import('./workspace') +): (linkType: LinkTypeIri | undefined) => LinkTemplate | undefined { const LINK_SUB_CLASS_OF: LinkTemplate = { ...Reactodia.StandardLinkTemplate, markerTarget: { diff --git a/src/templates/classicTemplate.tsx b/src/templates/classicTemplate.tsx index cd14f267..21389ba6 100644 --- a/src/templates/classicTemplate.tsx +++ b/src/templates/classicTemplate.tsx @@ -67,7 +67,7 @@ export function ClassicEntity(props: ClassicEntityProps) { const typesLabel = types.length > 0 ? model.locale.formatEntityTypeList(data, model.language) - : t.text('standard_template.default_type'); + : t.text('standard_element.default_type'); const label = model.locale.formatEntityLabel(data, model.language); const imageUrl = model.locale.selectEntityImageUrl(data); @@ -83,7 +83,7 @@ export function ClassicEntity(props: ClassicEntityProps) {