diff --git a/package.json b/package.json index 3eaab989d6..ca21fde0d5 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "bugs": "https://github.com/neos/neos-ui/issues", "homepage": "https://github.com/neos/neos-ui/blob/master/README.md", "license": "GNU GPLv3", - "version": "8.3.2", + "version": "8.3.3", "private": true, "resolutions": { "moment": "^2.20.1", diff --git a/packages/debug-reason-for-rendering/package.json b/packages/debug-reason-for-rendering/package.json index 39bacba7f5..e1f3056153 100644 --- a/packages/debug-reason-for-rendering/package.json +++ b/packages/debug-reason-for-rendering/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/debug-reason-for-rendering", - "version": "8.3.2", + "version": "8.3.3", "description": "React Performance Optimization Utility - Why does a component re-render?", "repository": "neos/neos-ui", "bugs": "https://github.com/neos/neos-ui/issues", diff --git a/packages/jest-preset-neos-ui/package.json b/packages/jest-preset-neos-ui/package.json index 2bc4720e2f..2ffc6ff325 100644 --- a/packages/jest-preset-neos-ui/package.json +++ b/packages/jest-preset-neos-ui/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/jest-preset-neos-ui", - "version": "8.3.2", + "version": "8.3.3", "description": "The jest preset for all packages of the neos-ui mono-repo.", "main": "jest-preset.json", "private": true, diff --git a/packages/neos-ts-interfaces/package.json b/packages/neos-ts-interfaces/package.json index 3f2db5459f..5748ebc762 100644 --- a/packages/neos-ts-interfaces/package.json +++ b/packages/neos-ts-interfaces/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ts-interfaces", - "version": "8.3.2", + "version": "8.3.3", "description": "Neos domain-related TypeScript interfaces", "private": true, "main": "src/index.ts", diff --git a/packages/neos-ui-backend-connector/package.json b/packages/neos-ui-backend-connector/package.json index 2c360e1bbc..ba812a0e5f 100644 --- a/packages/neos-ui-backend-connector/package.json +++ b/packages/neos-ui-backend-connector/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-backend-connector", - "version": "8.3.2", + "version": "8.3.3", "description": "Endoints and fetch cals to the Neos CMS backend", "private": true, "main": "./src/index.ts", diff --git a/packages/neos-ui-build/package.json b/packages/neos-ui-build/package.json index 34b2054888..4f0a8b7c4b 100644 --- a/packages/neos-ui-build/package.json +++ b/packages/neos-ui-build/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-build", - "version": "8.3.2", + "version": "8.3.3", "description": "Bob der Baumeister", "private": true } diff --git a/packages/neos-ui-ckeditor5-bindings/package.json b/packages/neos-ui-ckeditor5-bindings/package.json index ac7d75d455..3101763903 100644 --- a/packages/neos-ui-ckeditor5-bindings/package.json +++ b/packages/neos-ui-ckeditor5-bindings/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-ckeditor5-bindings", - "version": "8.3.2", + "version": "8.3.3", "description": "Prepare CKEditor5 for the Neos CMS UI", "private": true, "main": "./src/manifest.js", diff --git a/packages/neos-ui-constants/package.json b/packages/neos-ui-constants/package.json index ebdd93ee7a..0df3833042 100644 --- a/packages/neos-ui-constants/package.json +++ b/packages/neos-ui-constants/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-constants", - "version": "8.3.2", + "version": "8.3.3", "description": "Container package to store Neos CMS UI constants", "private": true, "main": "./src/index.js", diff --git a/packages/neos-ui-containers/package.json b/packages/neos-ui-containers/package.json index ff491474a3..407b946891 100644 --- a/packages/neos-ui-containers/package.json +++ b/packages/neos-ui-containers/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-containers", - "version": "8.3.2", + "version": "8.3.3", "description": "Smart components for Neos CMS UI.", "private": true, "main": "./src/index.js", diff --git a/packages/neos-ui-contentrepository/package.json b/packages/neos-ui-contentrepository/package.json index 2f03b777d1..6114bce267 100644 --- a/packages/neos-ui-contentrepository/package.json +++ b/packages/neos-ui-contentrepository/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-contentrepository", - "version": "8.3.2", + "version": "8.3.3", "description": "Bindings for the Neos ContentRepository", "private": true, "main": "./src/manifest.js", diff --git a/packages/neos-ui-decorators/package.json b/packages/neos-ui-decorators/package.json index 3ee20560e8..aa294d8430 100644 --- a/packages/neos-ui-decorators/package.json +++ b/packages/neos-ui-decorators/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-decorators", - "version": "8.3.2", + "version": "8.3.3", "description": "Decorators for Neos CMS UI.", "private": true, "main": "./src/index.ts", diff --git a/packages/neos-ui-editors/package.json b/packages/neos-ui-editors/package.json index 89cca2a648..406d7d58e2 100644 --- a/packages/neos-ui-editors/package.json +++ b/packages/neos-ui-editors/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-editors", - "version": "8.3.2", + "version": "8.3.3", "description": "Neos CMS UI Editors for use in the inspector.", "main": "src/manifest.js", "private": true, diff --git a/packages/neos-ui-extensibility-webpack-adapter/package.json b/packages/neos-ui-extensibility-webpack-adapter/package.json index 11b1c17a26..8a15e457d6 100644 --- a/packages/neos-ui-extensibility-webpack-adapter/package.json +++ b/packages/neos-ui-extensibility-webpack-adapter/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-extensibility-webpack-adapter", - "version": "8.3.2", + "version": "8.3.3", "description": "Minimal configuration, highly opinionated Webpack 4 + Babel plugin build stack for the Neos CMS UI", "repository": "neos/neos-ui", "bugs": "https://github.com/neos/neos-ui/issues", diff --git a/packages/neos-ui-extensibility/package.json b/packages/neos-ui-extensibility/package.json index 367cf59766..abea3438c3 100644 --- a/packages/neos-ui-extensibility/package.json +++ b/packages/neos-ui-extensibility/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-extensibility", - "version": "8.3.2", + "version": "8.3.3", "description": "Core of the extensibility mechanisms for the Neos UI", "repository": "neos/neos-ui", "bugs": "https://github.com/neos/neos-ui/issues", diff --git a/packages/neos-ui-guest-frame/package.json b/packages/neos-ui-guest-frame/package.json index cbfdd20266..821c03caed 100644 --- a/packages/neos-ui-guest-frame/package.json +++ b/packages/neos-ui-guest-frame/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-guest-frame", - "version": "8.3.2", + "version": "8.3.3", "description": "Guest frame initialization bindings", "private": true, "main": "./src/manifest.js", diff --git a/packages/neos-ui-i18n/package.json b/packages/neos-ui-i18n/package.json index fadbe22e5a..30aff8acca 100644 --- a/packages/neos-ui-i18n/package.json +++ b/packages/neos-ui-i18n/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-i18n", - "version": "8.3.2", + "version": "8.3.3", "description": "I18n utilities and components for Neos CMS UI.", "private": true, "main": "./src/index.tsx", diff --git a/packages/neos-ui-inspector/package.json b/packages/neos-ui-inspector/package.json index afc12c5ecc..11782c3e06 100644 --- a/packages/neos-ui-inspector/package.json +++ b/packages/neos-ui-inspector/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-inspector", - "version": "8.3.2", + "version": "8.3.3", "description": "Components for integrating views and editors into the Neos CMS UI inspector.", "private": true, "main": "./src/index.js", diff --git a/packages/neos-ui-redux-store/package.json b/packages/neos-ui-redux-store/package.json index 0e91025c62..e0b4f40ec7 100644 --- a/packages/neos-ui-redux-store/package.json +++ b/packages/neos-ui-redux-store/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-redux-store", - "version": "8.3.2", + "version": "8.3.3", "description": "Redux store implementation for the Neos CMS UI", "private": true, "main": "./src/index.ts", diff --git a/packages/neos-ui-sagas/package.json b/packages/neos-ui-sagas/package.json index ca94be98ba..3cc35cdc54 100644 --- a/packages/neos-ui-sagas/package.json +++ b/packages/neos-ui-sagas/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-sagas", - "version": "8.3.2", + "version": "8.3.3", "description": "Redux Sagas implementation for the Neos CMS UI", "private": true, "main": "src/index.js", diff --git a/packages/neos-ui-validators/package.json b/packages/neos-ui-validators/package.json index b2e336f7b6..2c135198bd 100644 --- a/packages/neos-ui-validators/package.json +++ b/packages/neos-ui-validators/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-validators", - "version": "8.3.2", + "version": "8.3.3", "description": "Validators for Neos CMS UI.", "private": true, "main": "./src/index.ts", diff --git a/packages/neos-ui-views/package.json b/packages/neos-ui-views/package.json index bf999e6d7f..7915dc9a87 100644 --- a/packages/neos-ui-views/package.json +++ b/packages/neos-ui-views/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui-views", - "version": "8.3.2", + "version": "8.3.3", "description": "Neos CMS UI Views for use in the inspector.", "main": "./src/index.js", "private": true, diff --git a/packages/neos-ui/package.json b/packages/neos-ui/package.json index e886227687..d1b8dc8e32 100644 --- a/packages/neos-ui/package.json +++ b/packages/neos-ui/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/neos-ui", - "version": "8.3.2", + "version": "8.3.3", "description": "Neos CMS UI written in ReactJS and a ton of other fun technology.", "private": true, "devDependencies": { diff --git a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelector.js b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelector.js index 084874e4eb..4ec9816566 100644 --- a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelector.js +++ b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelector.js @@ -2,7 +2,7 @@ import React, {PureComponent} from 'react'; import PropTypes from 'prop-types'; import SelectBox from '@neos-project/react-ui-components/src/SelectBox/'; import style from './style.module.css'; -import {$get, $transform} from 'plow-js'; +import {$transform} from 'plow-js'; import mapValues from 'lodash.mapvalues'; import sortBy from 'lodash.sortby'; import {neos} from '@neos-project/neos-ui-decorators'; @@ -48,9 +48,11 @@ export default class DimensionSelector extends PureComponent { (presetConfiguration, presetName) => { return $transform( { - label: $get('label'), + label: presetConfiguration?.label, value: presetName, - disallowed: $get('disallowed') + disallowed: presetConfiguration?.disallowed, + existing: presetConfiguration?.existing, + url: presetConfiguration?.url }, presetConfiguration ); diff --git a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelectorOption.js b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelectorOption.js index e580931b2f..ea8e0402f6 100644 --- a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelectorOption.js +++ b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelectorOption.js @@ -1,25 +1,51 @@ import React, {PureComponent} from 'react'; import PropTypes from 'prop-types'; import style from './style.module.css'; -// eslint-disable-next-line camelcase +import SelectBox_Option_SingleLineLink from '@neos-project/react-ui-components/src/SelectBox_Option_SingleLineLink/index'; import SelectBox_Option_SingleLine from '@neos-project/react-ui-components/src/SelectBox_Option_SingleLine/index'; +import mergeClassNames from 'classnames'; export default class DimensionSelectorOption extends PureComponent { static propTypes = { option: PropTypes.shape({ label: PropTypes.string.isRequired, - disallowed: PropTypes.bool + disallowed: PropTypes.bool, + existing: PropTypes.bool, + url: PropTypes.string }) }; render() { const {option} = this.props; + const className = mergeClassNames({ + [style.lighter]: !option.existing, + [style.strikethrough]: option.disallowed + }); + + if (option.existing) { + const linkOptions = { + className: style.whiteLink, + href: option.url, + target: '_blank', + rel: 'noopener noreferrer', + onClick: (event) => event.preventDefault() + } + + return ( + + ); + } + return ( - // eslint-disable-next-line camelcase ); diff --git a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/index.js b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/index.js index 1c71e90942..3ecf7ac612 100644 --- a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/index.js +++ b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/index.js @@ -33,7 +33,9 @@ SelectedPreset.propTypes = { @connect($transform({ contentDimensions: selectors.CR.ContentDimensions.byName, allowedPresets: selectors.CR.ContentDimensions.allowedPresets, - activePresets: selectors.CR.ContentDimensions.activePresets + activePresets: selectors.CR.ContentDimensions.activePresets, + getNodeByContextPath: selectors.CR.Nodes.nodeByContextPath, + documentNode: selectors.CR.Nodes.documentNodeSelector }), { selectPreset: actions.CR.ContentDimensions.selectPreset, setAllowed: actions.CR.ContentDimensions.setAllowed @@ -255,15 +257,58 @@ export default class DimensionSwitcher extends PureComponent { return null; } + getExistingDimensions() { + const allowed = this.props.allowedPresets + const currentDocumentNode = this.props.getNodeByContextPath(this.props.documentNode.contextPath) + const dimensionsWithVariants = currentDocumentNode?.otherNodeVariants; + if (!dimensionsWithVariants) { + return [currentDocumentNode.dimensions] + } + + const existingDimensions = {}; + Object.keys(allowed).forEach((dimensionName) => { + const dimensionValues = allowed[dimensionName]; + + existingDimensions[dimensionName] = []; + Array.from(dimensionValues).forEach((dimensionValue) => { + const result = [...dimensionsWithVariants, currentDocumentNode.dimensions].find((dimension) => { + return dimension[dimensionName] === dimensionValue; + }); + if (result) { + existingDimensions[dimensionName].push(dimensionValue); + } + }); + }); + + return existingDimensions; + } + presetsForDimension(dimensionName) { const {contentDimensions, allowedPresets, i18nRegistry} = this.props; const dimensionConfiguration = $get(dimensionName, contentDimensions); + const existingDimensions = this.getExistingDimensions(); return mapValues(dimensionConfiguration.presets, (presetConfiguration, presetName) => { + // if we do not know which dimensions exist, show all as existing + let existing = existingDimensions.length === 1 && existingDimensions[0] === undefined; + for (const value of presetConfiguration.values) { + if (existingDimensions[dimensionName]?.includes(value)) { + existing = true; + } + } + + const uri = new URL(window.location.href); + const contextPathWithoutDimensions = this.props.documentNode.contextPath.split(';')[0]; + const uriDimension = ';' + dimensionName + '=' + presetConfiguration.values.join(',') + uri.searchParams.set('node', contextPathWithoutDimensions + uriDimension); + const url = uri.toString(); + return Object.assign({}, presetConfiguration, { label: i18nRegistry.translate(presetConfiguration.label), - disallowed: !(allowedPresets[dimensionName] && allowedPresets[dimensionName].includes(presetName)) + disallowed: !(allowedPresets[dimensionName] && allowedPresets[dimensionName].includes(presetName)), + existing, + url }); }); } diff --git a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/style.module.css b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/style.module.css index d3a87a2db3..3ca0316d25 100644 --- a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/style.module.css +++ b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/style.module.css @@ -60,8 +60,16 @@ } } -.dimmed { - filter: opacity(50%); +.strikethrough { + text-decoration: line-through; +} + +.lighter { + filter: opacity(75%); +} + +.whiteLink { + color: white; } .selectPreset + .selectPreset { diff --git a/packages/positional-array-sorter/package.json b/packages/positional-array-sorter/package.json index f6bf7d59ae..83f87b3d97 100644 --- a/packages/positional-array-sorter/package.json +++ b/packages/positional-array-sorter/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/positional-array-sorter", - "version": "8.3.2", + "version": "8.3.3", "description": "Flexible array sorter that sorts an array according to a 'position' meta data.", "repository": "neos/neos-ui", "bugs": "https://github.com/neos/neos-ui/issues", diff --git a/packages/react-proptypes/package.json b/packages/react-proptypes/package.json index 0c82958dc0..b6a91ca7c1 100644 --- a/packages/react-proptypes/package.json +++ b/packages/react-proptypes/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/react-proptypes", - "version": "8.3.2", + "version": "8.3.3", "description": "Neos CMS specific proptypes for react", "private": true, "main": "./src/index.js", diff --git a/packages/react-ui-components/package.json b/packages/react-ui-components/package.json index e6b544b07a..3630f270a9 100644 --- a/packages/react-ui-components/package.json +++ b/packages/react-ui-components/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/react-ui-components", - "version": "8.3.2", + "version": "8.3.3", "description": "The UI components which power the Neos backend application.", "repository": "neos/neos-ui", "bugs": "https://github.com/neos/neos-ui/issues", diff --git a/packages/react-ui-components/src/SelectBox_Option_SingleLineLink/index.js b/packages/react-ui-components/src/SelectBox_Option_SingleLineLink/index.js new file mode 100644 index 0000000000..555e6811d6 --- /dev/null +++ b/packages/react-ui-components/src/SelectBox_Option_SingleLineLink/index.js @@ -0,0 +1,4 @@ +/* eslint-disable camelcase, react/jsx-pascal-case */ +import SelectBox_Option_SingleLineLink from './selectBox_Option_SingleLineLink'; + +export default SelectBox_Option_SingleLineLink; diff --git a/packages/react-ui-components/src/SelectBox_Option_SingleLineLink/selectBox_Option_SingleLineLink.js b/packages/react-ui-components/src/SelectBox_Option_SingleLineLink/selectBox_Option_SingleLineLink.js new file mode 100644 index 0000000000..e822fa58d3 --- /dev/null +++ b/packages/react-ui-components/src/SelectBox_Option_SingleLineLink/selectBox_Option_SingleLineLink.js @@ -0,0 +1,39 @@ +/* eslint-disable camelcase, react/jsx-pascal-case */ +import React, {PureComponent} from 'react'; +import PropTypes from 'prop-types'; +import ListPreviewElement from '../ListPreviewElement'; +import mergeClassNames from 'classnames'; + +class SelectBox_Option_SingleLineLink extends PureComponent { + static propTypes = { + option: PropTypes.shape({ + label: PropTypes.string.isRequired, + icon: PropTypes.string, + disabled: PropTypes.bool + }).isRequired, + + disabled: PropTypes.bool, + + className: PropTypes.string + } + + render() { + const {option, className, disabled, icon, linkOptions} = this.props; + + const isDisabled = disabled || option.disabled; + + const finalClassNames = mergeClassNames({ + [className]: className + }); + + const previewElementIcon = option.icon ? option.icon : (icon ? icon : null); + + return ( + + {option.label} + + ); + } +} + +export default SelectBox_Option_SingleLineLink; diff --git a/packages/utils-helpers/package.json b/packages/utils-helpers/package.json index 4c0421a233..fc08887046 100644 --- a/packages/utils-helpers/package.json +++ b/packages/utils-helpers/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/utils-helpers", - "version": "8.3.2", + "version": "8.3.3", "description": "Helper functions for Neos CMS UI.", "private": true, "main": "./src/index.ts", diff --git a/packages/utils-logger/package.json b/packages/utils-logger/package.json index a5d485990f..65fe9987a3 100644 --- a/packages/utils-logger/package.json +++ b/packages/utils-logger/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/utils-logger", - "version": "8.3.2", + "version": "8.3.3", "description": "Logger implementation for Neos CMS UI.", "private": true, "main": "./src/index.ts", diff --git a/packages/utils-redux/package.json b/packages/utils-redux/package.json index c3f25e5fff..6f2fea7c4c 100644 --- a/packages/utils-redux/package.json +++ b/packages/utils-redux/package.json @@ -1,6 +1,6 @@ { "name": "@neos-project/utils-redux", - "version": "8.3.2", + "version": "8.3.3", "description": "Neos CMS UI Redux Helper utilitites", "private": true, "main": "./src/index.ts",