diff --git a/CHANGELOG.md b/CHANGELOG.md index fc62464202..c0443f0c3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,6 @@ for piece and page types, allowing "virtual piece types" on the back end that deal with many content types to give better hints to the UI. * Respect the `_aposAutopublish` property of a document if present, otherwise fall back to module configuration. - * For convenience in custom editor components, pass the new prop `type`, the original type of the document being copied or edited. * For better results in custom editor components, pass the prop `copyOfId`, which implies the custom editor should fetch the original itself by its means of choice. @@ -35,6 +34,7 @@ to props of their choosing. * Adds support for admin UI language configuration in the `@apostrophecms/i18n` module. The new options allow control over the default admin UI language and configures the list of languages, that any individual logged in user can choose from. See the [documentation](https://v3.docs.apostrophecms.org/reference/modules/i18n.html) for more details. * Adds `adminLocale` User field to allow users to set their preferred admin UI language, but only when the `@apostrophecms/i18n` is configured accordingly (see above). * Adds `@apostrophecms/settings` module and a "Personal Settings" feature. See the [documentation](https://v3.docs.apostrophecms.org/reference/modules/settings.html) for more details. +* Adds `$and` operator on `addContextOperation` `if` property in order to check multiple fields before showing or hiding a context operation. ### Fixes diff --git a/lib/check-if-conditions.js b/lib/check-if-conditions.js index 40743131a9..f98741d0bd 100644 --- a/lib/check-if-conditions.js +++ b/lib/check-if-conditions.js @@ -5,6 +5,10 @@ export default function checkIfConditions(doc, conditions) { return checkOrConditions(doc, value); } + if (key === '$and') { + return checkAndConditions(doc, value); + } + const isNotEqualCondition = typeof value === 'object' && !Array.isArray(value) && value !== null && @@ -24,6 +28,12 @@ function checkOrConditions(doc, conditions) { }); } +function checkAndConditions(doc, conditions) { + return conditions.every((condition) => { + return checkIfConditions(doc, condition); + }); +} + function getNestedPropValue(doc, key) { if (key.includes('.')) { const keys = key.split('.'); diff --git a/modules/@apostrophecms/doc-type/ui/apos/components/AposDocEditor.vue b/modules/@apostrophecms/doc-type/ui/apos/components/AposDocEditor.vue index 6262931dfd..352614144d 100644 --- a/modules/@apostrophecms/doc-type/ui/apos/components/AposDocEditor.vue +++ b/modules/@apostrophecms/doc-type/ui/apos/components/AposDocEditor.vue @@ -271,16 +271,6 @@ export default { }; } }, - currentFields() { - if (this.currentTab) { - const tabFields = this.tabs.find((item) => { - return item.name === this.currentTab; - }); - return this.filterOutParkedFields(tabFields.fields); - } else { - return []; - } - }, saveLabel() { if (this.restoreOnly) { return 'apostrophe:restore'; diff --git a/modules/@apostrophecms/modal/ui/apos/components/AposModalTabs.vue b/modules/@apostrophecms/modal/ui/apos/components/AposModalTabs.vue index 9f4111b166..2611428bbd 100644 --- a/modules/@apostrophecms/modal/ui/apos/components/AposModalTabs.vue +++ b/modules/@apostrophecms/modal/ui/apos/components/AposModalTabs.vue @@ -5,11 +5,11 @@ class="apos-modal-tabs__tab" v-for="tab in tabs" :key="tab.name" - v-show="tab.isVisible" + v-show="tab.isVisible !== false" >