Skip to content

Commit

Permalink
Merge pull request #4244 from apostrophecms/pro-4542-support-tab-with…
Browse files Browse the repository at this point in the history
…out-is-visible

Pro 4542 support tab without is visible
  • Loading branch information
haroun authored Aug 1, 2023
2 parents c0cb7b2 + 69b563b commit 7966868
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -492,6 +482,10 @@ export default {
},
getDefault() {
const doc = {};
if (this.readOnly || this.restoreOnly) {
return doc;
}
this.schema.forEach(field => {
if (field.name.startsWith('_')) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
>
<button
:id="tab.name" class="apos-modal-tabs__btn"
:aria-selected="tab.name === currentTab ? true : false"
:aria-selected="tab.name === current ? true : false"
@click="selectTab"
>
{{ $t(tab.label) }}
Expand Down Expand Up @@ -43,9 +43,6 @@ export default {
},
emits: [ 'select-tab' ],
computed: {
currentTab() {
return this.current || this.tabs.find(tab => tab.isVisible).name;
},
tabErrors() {
const errors = {};
for (const key in this.errors) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default {
return tabs;
},
firstVisibleTabName() {
const { name = null } = this.tabs.find(tab => tab.isVisible === true) || {};
const { name = null } = this.tabs.find(tab => tab.isVisible === true) || this.tabs[0] || {};

return name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ export default {
},
getDefault() {
const object = {};
if (this.readOnly) {
return object;
}
this.field.schema.forEach(field => {
if (field.name.startsWith('_')) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ export default {
},
getDefault() {
const widget = {};
if (this.readOnly) {
return widget;
}
this.schema.forEach(field => {
if (field.name.startsWith('_')) {
return;
Expand Down

0 comments on commit 7966868

Please sign in to comment.