SEVERAL updates and refactor for new Webpack and Vue loader compatibility. #696.

This commit is contained in:
mateuswetah 2022-04-04 17:37:43 -03:00
parent 5bc9ce4bb9
commit 62dc76e9a2
57 changed files with 10484 additions and 245 deletions

View File

@ -24,6 +24,7 @@ module.exports = {
'vue/prop-name-casing': 'off', 'vue/prop-name-casing': 'off',
'vue/no-confusing-v-for-v-if': 'off', 'vue/no-confusing-v-for-v-if': 'off',
'vue/no-use-v-if-with-v-for': 'off', 'vue/no-use-v-if-with-v-for': 'off',
'vue/multi-word-component-names': 'off',
'vue/require-default-prop': 'off' // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-default-prop.md 'vue/require-default-prop': 'off' // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-default-prop.md
}, },
globals: { globals: {

10268
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,7 @@
"webpack-bundle-analyzer": "^4.5.0", "webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.9.2", "webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.7.4", "webpack-dev-server": "^4.7.4",
"webpack-merge": "^5.8.0" "webpack-merge": "^5.8.0",
"circular-dependency-plugin": "5.2.2"
} }
} }

View File

@ -254,13 +254,13 @@ export default {
}, },
beforeDestroy() { beforeDestroy() {
if (this.closedByForm) { if (this.closedByForm) {
this.editedFilter.saved = true; this.$emit('onUpdateSavedState', true);
} else { } else {
this.oldForm.saved = this.form.saved; this.oldForm.saved = this.form.saved;
if (JSON.stringify(this.form) != JSON.stringify(this.oldForm)) if (JSON.stringify(this.form) != JSON.stringify(this.oldForm))
this.editedFilter.saved = false; this.$emit('onUpdateSavedState', false);
else else
this.editedFilter.saved = true; this.$emit('onUpdateSavedState', true);
} }
}, },
methods: { methods: {

View File

@ -381,7 +381,7 @@
v-if="item != undefined && item.id != undefined" v-if="item != undefined && item.id != undefined"
:item="item" :item="item"
:is-editable="true" :is-editable="true"
:is-loading.sync="isLoadingAttachments" :is-loading="isLoadingAttachments"
@isLoadingAttachments="(isLoading) => isLoadingAttachments = isLoading" @isLoadingAttachments="(isLoading) => isLoadingAttachments = isLoading"
@onDeleteAttachment="deleteAttachment($event)"/> @onDeleteAttachment="deleteAttachment($event)"/>
</div> </div>
@ -965,6 +965,27 @@ export default {
ItemMetadatumErrorsTooltip ItemMetadatumErrorsTooltip
}, },
mixins: [ formHooks ], mixins: [ formHooks ],
beforeRouteLeave ( to, from, next ) {
if (this.item.status == 'auto-draft') {
this.$buefy.modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_item_not_saved'),
onConfirm: () => {
next();
},
},
trapFocus: true,
customClass: 'tainacan-modal',
closeButtonAriaLabel: this.$i18n.get('close')
});
} else {
next()
}
},
data(){ data(){
return { return {
swiper: {}, swiper: {},
@ -1222,27 +1243,6 @@ export default {
if (typeof this.swiper.destroy == 'function') if (typeof this.swiper.destroy == 'function')
this.swiper.destroy(); this.swiper.destroy();
}, },
beforeRouteLeave ( to, from, next ) {
if (this.item.status == 'auto-draft') {
this.$buefy.modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_item_not_saved'),
onConfirm: () => {
next();
},
},
trapFocus: true,
customClass: 'tainacan-modal',
closeButtonAriaLabel: this.$i18n.get('close')
});
} else {
next()
}
},
methods: { methods: {
...mapActions('item', [ ...mapActions('item', [
'sendItem', 'sendItem',

View File

@ -440,15 +440,13 @@
if ( (metadatum.metadata_type_object && metadatum.metadata_type_object.form_component) || metadatum.edit_form == '') { if ( (metadatum.metadata_type_object && metadatum.metadata_type_object.form_component) || metadatum.edit_form == '') {
let repository = this.form.repository_level; let repository = this.form.repository_level;
if (repository && repository === 'yes')
this.isRepositoryLevel = true;
this.fillExtraFormData(this.form); this.fillExtraFormData(this.form);
this.isUpdating = true; this.isUpdating = true;
this.updateMetadatum({ this.updateMetadatum({
collectionId: this.collectionId, collectionId: this.collectionId,
metadatumId: metadatum.id, metadatumId: metadatum.id,
isRepositoryLevel: this.isRepositoryLevel, isRepositoryLevel: this.isRepositoryLevel || (repository && repository === 'yes'),
index: this.index, index: this.index,
options: this.form, options: this.form,
includeOptionsAsHtml: true includeOptionsAsHtml: true
@ -485,12 +483,14 @@
formObj[key] = value; formObj[key] = value;
} }
let repository = formObj['repository_level'];
this.fillExtraFormData(formObj); this.fillExtraFormData(formObj);
this.isUpdating = true; this.isUpdating = true;
this.updateMetadatum({ this.updateMetadatum({
collectionId: this.collectionId, collectionId: this.collectionId,
metadatumId: metadatum.id, metadatumId: metadatum.id,
isRepositoryLevel: this.isRepositoryLevel, isRepositoryLevel: this.isRepositoryLevel || (repository && repository === 'yes'),
index: this.index, index: this.index,
options: formObj, options: formObj,
includeOptionsAsHtml: true includeOptionsAsHtml: true

View File

@ -245,30 +245,6 @@
TermsList TermsList
}, },
mixins: [ wpAjax, formHooks ], mixins: [ wpAjax, formHooks ],
data(){
return {
taxonomyId: String,
tabIndex: 0,
taxonomy: null,
isLoadingTaxonomy: false,
isUpdatingSlug: false,
isEditingTerm: false,
form: {
name: String,
status: String,
description: String,
slug: String,
allowInsert: String,
enabledPostTypes: Array
},
wpPostTypes: tainacan_plugin.wp_post_types,
editFormErrors: {},
formErrorMessage: '',
entityName: 'taxonomy',
updatedAt: undefined,
shouldReloadTermsList: false
}
},
beforeRouteLeave( to, from, next ) { beforeRouteLeave( to, from, next ) {
let formNotSaved = false; let formNotSaved = false;
@ -323,6 +299,30 @@
next(); next();
} }
}, },
data(){
return {
taxonomyId: String,
tabIndex: 0,
taxonomy: null,
isLoadingTaxonomy: false,
isUpdatingSlug: false,
isEditingTerm: false,
form: {
name: String,
status: String,
description: String,
slug: String,
allowInsert: String,
enabledPostTypes: Array
},
wpPostTypes: tainacan_plugin.wp_post_types,
editFormErrors: {},
formErrorMessage: '',
entityName: 'taxonomy',
updatedAt: undefined,
shouldReloadTermsList: false
}
},
mounted(){ mounted(){
if (this.$route.query.tab == 'terms') if (this.$route.query.tab == 'terms')

View File

@ -232,7 +232,7 @@
name: 'TermEditionForm', name: 'TermEditionForm',
mixins: [ formHooks ], mixins: [ formHooks ],
props: { props: {
form: Object, originalForm: Object,
taxonomyId: '', taxonomyId: '',
isModal: false isModal: false
}, },
@ -250,9 +250,13 @@
entityName: 'term', entityName: 'term',
isLoading: false, isLoading: false,
parentTermSearchQuery: '', parentTermSearchQuery: '',
parentTermSearchOffset: 0 parentTermSearchOffset: 0,
form: {}
} }
}, },
created() {
this.form = JSON.parse(JSON.stringify(this.originalForm));
},
mounted() { mounted() {
// Fills hook forms with it's real values // Fills hook forms with it's real values

View File

@ -43,6 +43,7 @@
:is-modal="false" :is-modal="false"
:filter="filter" :filter="filter"
:selected="selected" :selected="selected"
@input="(newSelected) => selected = newSelected"
:metadatum-id="metadatumId" :metadatum-id="metadatumId"
:collection-id="collectionId" :collection-id="collectionId"
:metadatum_type="metadatumType" :metadatum_type="metadatumType"

View File

@ -47,7 +47,7 @@
:query="query" :query="query"
:is-using-elastic-search="isUsingElasticSearch" :is-using-elastic-search="isUsingElasticSearch"
:is-repository-level="isRepositoryLevel" :is-repository-level="isRepositoryLevel"
:is-loading-items.sync="isLoadingItems" :is-loading-items="isLoadingItems"
:current-collection-id="$eventBusSearch.collectionId" :current-collection-id="$eventBusSearch.collectionId"
@input="onInput" @input="onInput"
@updateParentCollapse="onFilterUpdateParentCollapse" @updateParentCollapse="onFilterUpdateParentCollapse"
@ -95,14 +95,14 @@
expandAll: true, expandAll: true,
isLoadingItems: true, isLoadingItems: true,
filtersAsModal: Boolean, filtersAsModal: Boolean,
isMobileScreen: false, isMobileScreen: false
focusedElement: false
}, },
data() { data() {
return { return {
isUsingElasticSearch: tainacan_plugin.wp_elasticpress == "1" ? true : false, isUsingElasticSearch: tainacan_plugin.wp_elasticpress == "1" ? true : false,
displayFilter: false, displayFilter: false,
singleCollapseOpen: this.expandAll singleCollapseOpen: this.expandAll,
focusedElement: false
} }
}, },
computed: { computed: {

View File

@ -51,6 +51,7 @@
:filter="filter" :filter="filter"
:taxonomy_id="taxonomyId" :taxonomy_id="taxonomyId"
:selected="selected" :selected="selected"
@input="(newSelected) => selected = newSelected"
:metadatum-id="metadatumId" :metadatum-id="metadatumId"
:taxonomy="taxonomy" :taxonomy="taxonomy"
:collection-id="collectionId" :collection-id="collectionId"

View File

@ -5,7 +5,7 @@
class="table-container"> class="table-container">
<b-loading <b-loading
is-full-page="false" is-full-page="false"
:active.sync="isLoading" /> :active="isLoading" />
<div <div
v-if="attachments.length > 0" v-if="attachments.length > 0"
class="table-wrapper"> class="table-wrapper">
@ -159,7 +159,6 @@
return last > this.totalAttachments ? this.totalAttachments : last; return last > this.totalAttachments ? this.totalAttachments : last;
}, },
loadAttachments() { loadAttachments() {
this.isLoading = true;
this.$emit('isLoadingAttachments', true); this.$emit('isLoadingAttachments', true);
this.fetchAttachments({ this.fetchAttachments({
@ -170,12 +169,10 @@
thumbnailId: this.item.thumbnail_id thumbnailId: this.item.thumbnail_id
}) })
.then((response) => { .then((response) => {
this.isLoading = false;
this.$emit('isLoadingAttachments', false); this.$emit('isLoadingAttachments', false);
this.totalAttachments = response.total; this.totalAttachments = response.total;
}) })
.catch((error) => { .catch((error) => {
this.isLoading = false;
this.$emit('isLoadingAttachments', false); this.$emit('isLoadingAttachments', false);
this.$console.error(error); this.$console.error(error);
}) })

View File

@ -58,7 +58,7 @@ import { mapActions } from 'vuex';
import CustomDialog from '../other/custom-dialog.vue'; import CustomDialog from '../other/custom-dialog.vue';
export default { export default {
name: 'RecursiveTermItem', name: 'BasicTermItem',
props: { props: {
term: Object, term: Object,
index: Number, index: Number,
@ -88,8 +88,7 @@ export default {
'deleteTerm' 'deleteTerm'
]), ]),
editTerm() { editTerm() {
this.term.opened = !this.term.opened; this.$emit('onUpdateTermOpenedState', !this.term.opened);
this.$eventBusTermsList.onEditTerm(this.term); this.$eventBusTermsList.onEditTerm(this.term);
}, },
tryToRemoveTerm() { tryToRemoveTerm() {
@ -138,11 +137,11 @@ export default {
}, },
eventOnTermEditionSaved() { eventOnTermEditionSaved() {
this.isEditingTerm = false; this.isEditingTerm = false;
this.term.opened = false; this.$emit('onUpdateTermOpenedState', false);
}, },
eventOnTermEditionCanceled() { eventOnTermEditionCanceled() {
this.isEditingTerm = false; this.isEditingTerm = false;
this.term.opened = false; this.$emit('onUpdateTermOpenedState', false);
} }
} }
} }

View File

@ -1557,7 +1557,6 @@ export default {
title: this.$i18n.get('label_warning'), title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_remove_item_from_trash'), message: this.$i18n.get('info_warning_remove_item_from_trash'),
onConfirm: () => { onConfirm: () => {
this.isLoading = true;
this.$emit('updateIsLoading', this.isLoading); this.$emit('updateIsLoading', this.isLoading);
this.createEditGroup({ this.createEditGroup({
@ -1589,7 +1588,6 @@ export default {
title: this.$i18n.get('label_warning'), title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_item_delete') : this.$i18n.get('info_warning_item_trash'), message: this.isOnTrash ? this.$i18n.get('info_warning_item_delete') : this.$i18n.get('info_warning_item_trash'),
onConfirm: () => { onConfirm: () => {
this.isLoading = true;
this.$emit('updateIsLoading', this.isLoading); this.$emit('updateIsLoading', this.isLoading);
this.deleteItem({ this.deleteItem({
@ -1615,7 +1613,6 @@ export default {
title: this.$i18n.get('label_warning'), title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_selected_items_remove_from_trash'), message: this.$i18n.get('info_warning_selected_items_remove_from_trash'),
onConfirm: () => { onConfirm: () => {
this.isLoading = true;
this.$emit('updateIsLoading', this.isLoading); this.$emit('updateIsLoading', this.isLoading);
this.createEditGroup({ this.createEditGroup({
@ -1648,7 +1645,6 @@ export default {
title: this.$i18n.get('label_warning'), title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_selected_items_delete') : this.$i18n.get('info_warning_selected_items_trash'), message: this.isOnTrash ? this.$i18n.get('info_warning_selected_items_delete') : this.$i18n.get('info_warning_selected_items_trash'),
onConfirm: () => { onConfirm: () => {
this.isLoading = true;
this.$emit('updateIsLoading', this.isLoading); this.$emit('updateIsLoading', this.isLoading);
this.createEditGroup({ this.createEditGroup({

View File

@ -266,7 +266,7 @@ export default {
item.isCustom = false; item.isCustom = false;
this.activeMetadatumList.forEach((metadatum) => { this.activeMetadatumList.forEach((metadatum) => {
if ( if (
metadatum.exposer_mapping.hasOwnProperty(metadatumMapper.slug) && Object.prototype.hasOwnProperty.call(metadatum.exposer_mapping, metadatumMapper.slug) &&
metadatum.exposer_mapping[metadatumMapper.slug] == item.slug metadatum.exposer_mapping[metadatumMapper.slug] == item.slug
) { ) {
item.selected = metadatum.id; item.selected = metadatum.id;
@ -277,7 +277,7 @@ export default {
} }
this.activeMetadatumList.forEach((metadatum) => { this.activeMetadatumList.forEach((metadatum) => {
if ( if (
metadatum.exposer_mapping.hasOwnProperty(metadatumMapper.slug) && Object.prototype.hasOwnProperty.call(metadatum.exposer_mapping, metadatumMapper.slug) &&
typeof metadatum.exposer_mapping[metadatumMapper.slug] == 'object' typeof metadatum.exposer_mapping[metadatumMapper.slug] == 'object'
) { ) {
this.newMapperMetadataList.push(Object.assign({},metadatum.exposer_mapping[metadatumMapper.slug])); this.newMapperMetadataList.push(Object.assign({},metadatum.exposer_mapping[metadatumMapper.slug]));

View File

@ -113,7 +113,8 @@
:index="childIndex" :index="childIndex"
:taxonomy-id="taxonomyId" :taxonomy-id="taxonomyId"
:order="order" :order="order"
:current-user-can-edit-taxonomy="currentUserCanEditTaxonomy"/> :current-user-can-edit-taxonomy="currentUserCanEditTaxonomy"
@onUpdateTermOpenedState="(state) => childTerm.opened = state"/>
</div> </div>
</transition-group> </transition-group>
<a <a
@ -128,14 +129,10 @@
<script> <script>
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import RecursiveTermItem from './recursive-term-item.vue';
import CustomDialog from '../other/custom-dialog.vue'; import CustomDialog from '../other/custom-dialog.vue';
export default { export default {
name: 'RecursiveTermItem', name: 'RecursiveTermItem',
components: {
RecursiveTermItem,
},
props: { props: {
term: Object, term: Object,
index: Number, index: Number,
@ -217,7 +214,7 @@ export default {
}, },
editTerm() { editTerm() {
this.term.opened = !this.term.opened; this.$emit('onUpdateTermOpenedState', !this.term.opened);
this.$eventBusTermsList.onEditTerm(this.term); this.$eventBusTermsList.onEditTerm(this.term);
@ -316,11 +313,11 @@ export default {
} }
this.isEditingTerm = false; this.isEditingTerm = false;
this.term.opened = false; this.$emit('onUpdateTermOpenedState', false);
}, },
eventOnTermEditionCanceled() { eventOnTermEditionCanceled() {
this.isEditingTerm = false; this.isEditingTerm = false;
this.term.opened = false; this.$emit('onUpdateTermOpenedState', false);
} }
} }
} }

View File

@ -97,7 +97,8 @@
:index="index" :index="index"
:taxonomy-id="taxonomyId" :taxonomy-id="taxonomyId"
:order="order" :order="order"
:current-user-can-edit-taxonomy="currentUserCanEditTaxonomy"/> :current-user-can-edit-taxonomy="currentUserCanEditTaxonomy"
@onUpdateTermOpenedState="(state) => term.opened = state"/>
</div> </div>
</template> </template>
<a <a
@ -119,7 +120,8 @@
:index="index" :index="index"
:taxonomy-id="taxonomyId" :taxonomy-id="taxonomyId"
:order="order" :order="order"
:current-user-can-edit-taxonomy="currentUserCanEditTaxonomy"/> :current-user-can-edit-taxonomy="currentUserCanEditTaxonomy"
@onUpdateTermOpenedState="(state) => term.opened = state"/>
</div> </div>
</template> </template>
<a <a
@ -139,7 +141,7 @@
@onEditionFinished="onTermEditionFinished($event)" @onEditionFinished="onTermEditionFinished($event)"
@onEditionCanceled="onTermEditionCanceled($event)" @onEditionCanceled="onTermEditionCanceled($event)"
@onErrorFound="formWithErrors = editTerm.id" @onErrorFound="formWithErrors = editTerm.id"
:form="editTerm"/> :original-form="editTerm"/>
</div> </div>
</div> </div>
<!-- Empty state image --> <!-- Empty state image -->
@ -175,14 +177,12 @@
<script> <script>
import { mapActions, mapGetters } from 'vuex'; import { mapActions, mapGetters } from 'vuex';
import TermEditionForm from '../edition/term-edition-form.vue'; import TermEditionForm from '../edition/term-edition-form.vue';
import RecursiveTermItem from './recursive-term-item.vue'
import BasicTermItem from './basic-term-item.vue' import BasicTermItem from './basic-term-item.vue'
import t from 't'; import t from 't';
export default { export default {
name: 'TermsList', name: 'TermsList',
components: { components: {
RecursiveTermItem,
BasicTermItem, BasicTermItem,
TermEditionForm TermEditionForm
}, },

View File

@ -175,12 +175,12 @@
} }
}, },
created() { created() {
eventBusItemMetadata.$on('hasRemovedItemMetadataGroup', () => this.$nextTick(() => this.isRemovingGroup = false)); eventBusItemMetadata.$on('hasRemovedItemMetadataGroup', () => { this.$nextTick(() => this.isRemovingGroup = false) });
eventBusItemMetadata.$on('focusPreviousChildMetadatum', this.focusPreviousChildMetadatum); eventBusItemMetadata.$on('focusPreviousChildMetadatum', this.focusPreviousChildMetadatum);
eventBusItemMetadata.$on('focusNextChildMetadatum', this.focusNextChildMetadatum); eventBusItemMetadata.$on('focusNextChildMetadatum', this.focusNextChildMetadatum);
}, },
beforeDestroy() { beforeDestroy() {
eventBusItemMetadata.$off('hasRemovedItemMetadataGroup', () => this.$nextTick(() => this.isRemovingGroup = false)); eventBusItemMetadata.$off('hasRemovedItemMetadataGroup', () => { this.$nextTick(() => this.isRemovingGroup = false) });
eventBusItemMetadata.$off('focusPreviousChildMetadatum', this.focusPreviousChildMetadatum); eventBusItemMetadata.$off('focusPreviousChildMetadatum', this.focusPreviousChildMetadatum);
eventBusItemMetadata.$off('focusNextChildMetadatum', this.focusNextChildMetadatum); eventBusItemMetadata.$off('focusNextChildMetadatum', this.focusNextChildMetadatum);
}, },

View File

@ -60,7 +60,7 @@
:close-button-aria-label="$i18n.get('close')"> :close-button-aria-label="$i18n.get('close')">
<term-edition-form <term-edition-form
:taxonomy-id="taxonomyId" :taxonomy-id="taxonomyId"
:form="{ id: 'new', name: newTermName ? newTermName : '' }" :original-form="{ id: 'new', name: newTermName ? newTermName : '' }"
:is-modal="true" :is-modal="true"
@onEditionFinished="($event) => addRecentlyCreatedTerm($event.term)" @onEditionFinished="($event) => addRecentlyCreatedTerm($event.term)"
@onEditionCanceled="() => $console.log('Editing canceled')" @onEditionCanceled="() => $console.log('Editing canceled')"
@ -72,7 +72,7 @@
<term-creation-panel <term-creation-panel
v-if="isTermCreationPanelOpen" v-if="isTermCreationPanelOpen"
:taxonomy-id="taxonomyId" :taxonomy-id="taxonomyId"
:form="{ id: 'new', name: newTermName ? newTermName : '' }" :original-form="{ id: 'new', name: newTermName ? newTermName : '' }"
@onEditionFinished="($event) => addTermToBeCreated($event)" @onEditionFinished="($event) => addTermToBeCreated($event)"
@onEditionCanceled="() => isTermCreationPanelOpen = false" @onEditionCanceled="() => isTermCreationPanelOpen = false"
@onErrorFound="($event) => $console.log('Form with errors: ' + $event)" /> @onErrorFound="($event) => $console.log('Form with errors: ' + $event)" />

View File

@ -9,7 +9,7 @@
ref="availableExportersModal"> ref="availableExportersModal">
<div style="width: auto"> <div style="width: auto">
<header class="tainacan-modal-title"> <header class="tainacan-modal-title">
<h2>{{ this.$i18n.get('exporters') }}</h2> <h2>{{ $i18n.get('exporters') }}</h2>
<hr> <hr>
</header> </header>

View File

@ -11,7 +11,7 @@
class="tainacan-modal-content" class="tainacan-modal-content"
style="width: auto"> style="width: auto">
<header class="tainacan-modal-title"> <header class="tainacan-modal-title">
<h2>{{ this.$i18n.get('importers') }}</h2> <h2>{{ $i18n.get('importers') }}</h2>
<hr> <hr>
</header> </header>
<section class="tainacan-form"> <section class="tainacan-form">

View File

@ -11,7 +11,7 @@
class="tainacan-modal-content" class="tainacan-modal-content"
style="width: auto"> style="width: auto">
<header class="tainacan-modal-title"> <header class="tainacan-modal-title">
<h2>{{ this.$i18n.get('collections') }}</h2> <h2>{{ $i18n.get('collections') }}</h2>
<hr> <hr>
</header> </header>
<section class="tainacan-form"> <section class="tainacan-form">

View File

@ -95,7 +95,7 @@
v-if="$userCaps.hasCapability('tnc_rep_edit_users') && !$adminOptions.hidePrimaryMenuCapabilitiesButton"> v-if="$userCaps.hasCapability('tnc_rep_edit_users') && !$adminOptions.hidePrimaryMenuCapabilitiesButton">
<router-link <router-link
tag="a" tag="a"
:to="this.$routerHelper.getCapabilitiesPath()" :to="$routerHelper.getCapabilitiesPath()"
:class="activeRoute == 'CapabilitiesPage' ? 'is-active':''"> :class="activeRoute == 'CapabilitiesPage' ? 'is-active':''">
<span class="icon"> <span class="icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-capability"/> <i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-capability"/>

View File

@ -63,7 +63,7 @@
:key="key"> :key="key">
<label class="b-checkbox checkbox"> <label class="b-checkbox checkbox">
<input <input
v-model="selected" @input="$emit('input', $event.target.value)"
:value="option.id ? (isNaN(Number(option.id)) ? option.id : Number(option.id)) : (isNaN(Number(option.value)) ? option.value : Number(option.value))" :value="option.id ? (isNaN(Number(option.id)) ? option.id : Number(option.id)) : (isNaN(Number(option.value)) ? option.value : Number(option.value))"
type="checkbox"> type="checkbox">
<span class="check" /> <span class="check" />
@ -123,7 +123,7 @@
:key="key"> :key="key">
<label class="b-checkbox checkbox"> <label class="b-checkbox checkbox">
<input <input
v-model="selected" @input="$emit('input', $event.target.value)"
:value="option.value" :value="option.value"
type="checkbox"> type="checkbox">
<span class="check" /> <span class="check" />
@ -187,7 +187,7 @@
:key="index"> :key="index">
<label class="b-checkbox checkbox"> <label class="b-checkbox checkbox">
<input <input
v-model="selected" @input="$emit('input', $event.target.value)"
:value="(isNaN(Number(option.value)) ? option.value : Number(option.value))" :value="(isNaN(Number(option.value)) ? option.value : Number(option.value))"
type="checkbox"> type="checkbox">
<span class="check" /> <span class="check" />
@ -266,7 +266,7 @@
attached attached
closable closable
:class="isModal ? '' : 'is-small'" :class="isModal ? '' : 'is-small'"
@close="selected instanceof Array ? selected.splice(index, 1) : selected = ''"> @close="selected instanceof Array ? $emit('input', JSON.parse(JSON.stringify(selected)).splice(index, 1)) : $emit('input', '')">
<span v-html="(isTaxonomy || metadatum_type === 'Tainacan\\Metadata_Types\\Relationship') ? selectedTagsName[term] : term" /> <span v-html="(isTaxonomy || metadatum_type === 'Tainacan\\Metadata_Types\\Relationship') ? selectedTagsName[term] : term" />
</b-tag> </b-tag>
</div> </div>

View File

@ -71,7 +71,7 @@
class="b-checkbox checkbox"> class="b-checkbox checkbox">
<input <input
:disabled="(Array.isArray(selected) && selected.indexOf((isNaN(Number(option.value)) ? option.value : Number(option.value))) < 0) && maxMultipleValues !== undefined && maxMultipleValues - 1 < selected.length" :disabled="(Array.isArray(selected) && selected.indexOf((isNaN(Number(option.value)) ? option.value : Number(option.value))) < 0) && maxMultipleValues !== undefined && maxMultipleValues - 1 < selected.length"
v-model="selected" @input="$emit('input', $event.target.value)"
:value="option.id ? (isNaN(Number(option.id)) ? option.id : Number(option.id)) : (isNaN(Number(option.value)) ? option.value : Number(option.value))" :value="option.id ? (isNaN(Number(option.id)) ? option.id : Number(option.id)) : (isNaN(Number(option.value)) ? option.value : Number(option.value))"
type="checkbox"> type="checkbox">
<span class="check" /> <span class="check" />
@ -83,7 +83,8 @@
</label> </label>
<b-radio <b-radio
v-else v-else
v-model="selected" :value="selected"
@input="$emit('input', $event.target.value)"
:native-value="option.id ? (isNaN(Number(option.id)) ? option.id : Number(option.value)) : (isNaN(Number(option.value)) ? option.value : Number(option.value))"> :native-value="option.id ? (isNaN(Number(option.id)) ? option.id : Number(option.value)) : (isNaN(Number(option.value)) ? option.value : Number(option.value))">
<span <span
class="checkbox-label-text" class="checkbox-label-text"
@ -140,7 +141,7 @@
<label class="b-checkbox checkbox"> <label class="b-checkbox checkbox">
<input <input
:disabled="(Array.isArray(selected) && selected.indexOf((isNaN(Number(option.value)) ? option.value : Number(option.value))) < 0) && maxMultipleValues !== undefined && maxMultipleValues - 1 < selected.length" :disabled="(Array.isArray(selected) && selected.indexOf((isNaN(Number(option.value)) ? option.value : Number(option.value))) < 0) && maxMultipleValues !== undefined && maxMultipleValues - 1 < selected.length"
v-model="selected" @input="$emit('input', $event.target.value)"
:value="option.value" :value="option.value"
type="checkbox"> type="checkbox">
<span class="check" /> <span class="check" />
@ -195,7 +196,7 @@
:class="{ 'is-disabled': (Array.isArray(selected) && selected.indexOf((isNaN(Number(option.value)) ? option.value : Number(option.value))) < 0) && maxMultipleValues !== undefined && maxMultipleValues - 1 < selected.length }"> :class="{ 'is-disabled': (Array.isArray(selected) && selected.indexOf((isNaN(Number(option.value)) ? option.value : Number(option.value))) < 0) && maxMultipleValues !== undefined && maxMultipleValues - 1 < selected.length }">
<input <input
:disabled="(Array.isArray(selected) && selected.indexOf((isNaN(Number(option.value)) ? option.value : Number(option.value))) < 0) && maxMultipleValues !== undefined && maxMultipleValues - 1 < selected.length" :disabled="(Array.isArray(selected) && selected.indexOf((isNaN(Number(option.value)) ? option.value : Number(option.value))) < 0) && maxMultipleValues !== undefined && maxMultipleValues - 1 < selected.length"
v-model="selected" @input="$emit('input', $event.target.value)"
:value="(isNaN(Number(option.value)) ? option.value : Number(option.value))" :value="(isNaN(Number(option.value)) ? option.value : Number(option.value))"
type="checkbox"> type="checkbox">
<span class="check" /> <span class="check" />
@ -205,7 +206,8 @@
</label> </label>
<b-radio <b-radio
v-else v-else
v-model="selected" :value="selected"
@input="$emit('input', $event.target.value)"
:native-value="(isNaN(Number(option.value)) ? option.value : Number(option.value))"> :native-value="(isNaN(Number(option.value)) ? option.value : Number(option.value))">
{{ `${option.label}` }} {{ `${option.label}` }}
</b-radio> </b-radio>
@ -281,7 +283,7 @@
attached attached
closable closable
class="is-small" class="is-small"
@close="selected instanceof Array ? selected.splice(index, 1) : selected = ''"> @close="selected instanceof Array ? $emit('input', JSON.parse(JSON.stringify(selected)).splice(index, 1)) : $emit('input', '')">
<span v-html="(isTaxonomy || metadatum_type === 'Tainacan\\Metadata_Types\\Relationship') ? selectedTagsName[term] : term" /> <span v-html="(isTaxonomy || metadatum_type === 'Tainacan\\Metadata_Types\\Relationship') ? selectedTagsName[term] : term" />
</b-tag> </b-tag>
</div> </div>

View File

@ -41,7 +41,7 @@
</li> </li>
<li <li
:key="index" :key="index"
v-for="(bgProcess, index) of getAllProcesses"> v-for="(bgProcess, index) of bgProcesses">
<div class="process-item"> <div class="process-item">
<div <div
@click="toggleDetails(index)" @click="toggleDetails(index)"
@ -166,23 +166,16 @@ export default {
dateFormat: '' dateFormat: ''
} }
}, },
computed: {
getAllProcesses(){
if (this.updatedProcesses.length !== 0) {
for (let updatedProcess of this.updatedProcesses) {
let updatedProcessIndex = this.bgProcesses.findIndex((aProcess) => aProcess.ID == updatedProcess.ID);
if (updatedProcessIndex >= 0) {
this.$set(this.bgProcesses, updatedProcessIndex, updatedProcess);
}
}
}
return this.bgProcesses;
}
},
watch: { watch: {
bgProcesses(newBG) { bgProcesses(newBG) {
this.hasAnyProcessExecuting = newBG.some((element) => element.done <= 0); this.hasAnyProcessExecuting = newBG.some((element) => element.done <= 0);
if (this.updatedProcesses.length !== 0) {
for (let updatedProcess of this.updatedProcesses) {
let updatedProcessIndex = this.bgProcesses.findIndex((aProcess) => aProcess.ID == updatedProcess.ID);
if (updatedProcessIndex >= 0)
this.$set(this.bgProcesses, updatedProcessIndex, updatedProcess);
}
}
} }
}, },
created() { created() {

View File

@ -328,8 +328,8 @@
for (let meta in metaquery) { for (let meta in metaquery) {
if ( if (
this.metaqueryOperatorsRegular.hasOwnProperty(metaquery[meta]['compare']) || Object.prototype.hasOwnProperty.call(this.metaqueryOperatorsRegular, metaquery[meta]['compare']) ||
this.metaqueryOperatorsForInterval.hasOwnProperty(metaquery[meta]['compare']) Object.prototype.hasOwnProperty.call(this.metaqueryOperatorsForInterval, metaquery[meta]['compare'])
) )
this.$set(this.advancedSearchQuery.metaquery, `${meta}`, metaquery[meta]); this.$set(this.advancedSearchQuery.metaquery, `${meta}`, metaquery[meta]);
} }
@ -349,7 +349,7 @@
let taxquery = this.$route.query.taxquery; let taxquery = this.$route.query.taxquery;
for (let tax in taxquery) { for (let tax in taxquery) {
if ( this.taxqueryOperators.hasOwnProperty(taxquery[tax]['operator']) ) if ( Object.prototype.hasOwnProperty.call(this.taxqueryOperators, taxquery[tax]['operator']) )
this.$set(this.advancedSearchQuery.taxquery, `${tax}`, taxquery[tax]); this.$set(this.advancedSearchQuery.taxquery, `${tax}`, taxquery[tax]);
} }
@ -522,7 +522,7 @@
if ( Object.keys(this.advancedSearchQuery.taxquery).length > 1 ) if ( Object.keys(this.advancedSearchQuery.taxquery).length > 1 )
this.$set(this.advancedSearchQuery.taxquery, 'relation', 'AND'); this.$set(this.advancedSearchQuery.taxquery, 'relation', 'AND');
else if (this.advancedSearchQuery.taxquery.hasOwnProperty('relation')) else if ( Object.prototype.hasOwnProperty.call(this.advancedSearchQuery.taxquery, 'relation') )
delete this.advancedSearchQuery.taxquery.relation; delete this.advancedSearchQuery.taxquery.relation;
// Convert date values to a format (ISO_8601) that will match in database // Convert date values to a format (ISO_8601) that will match in database
@ -540,10 +540,10 @@
if ( Object.keys(this.advancedSearchQuery.metaquery).length > 1 ) if ( Object.keys(this.advancedSearchQuery.metaquery).length > 1 )
this.$set(this.advancedSearchQuery.metaquery, 'relation', 'AND'); this.$set(this.advancedSearchQuery.metaquery, 'relation', 'AND');
else if (this.advancedSearchQuery.metaquery.hasOwnProperty('relation')) else if ( Object.prototype.hasOwnProperty.call(this.advancedSearchQuery.metaquery, 'relation') )
delete this.advancedSearchQuery.metaquery.relation; delete this.advancedSearchQuery.metaquery.relation;
if (this.advancedSearchQuery.hasOwnProperty('relation') && Object.keys(this.advancedSearchQuery).length <= 3) if ( Object.prototype.hasOwnProperty.call(this.advancedSearchQuery, 'relation') && Object.keys(this.advancedSearchQuery).length <= 3)
delete this.advancedSearchQuery.relation; delete this.advancedSearchQuery.relation;
if (Object.keys(this.advancedSearchQuery.metaquery).length > 0) { if (Object.keys(this.advancedSearchQuery.metaquery).length > 0) {

View File

@ -394,9 +394,8 @@
*/ */
this.prepareFilters(); this.prepareFilters();
}); });
if (this.isUsingElasticSearch) { if (this.isUsingElasticSearch)
this.$eventBusSearch.$on('isLoadingItems', this.updateIsLoadingItems); this.$eventBusSearch.$on('isLoadingItems', this.updateIsLoadingItems);
}
}, },
beforeDestroy() { beforeDestroy() {
// Cancels previous collection name Request // Cancels previous collection name Request
@ -496,7 +495,7 @@
} }
}, },
updateIsLoadingItems(isLoadingItems) { updateIsLoadingItems(isLoadingItems) {
this.isLoadingItems = isLoadingItems this.$emit('updateIsLoadingItemsState', isLoadingItems);
} }
} }
} }

View File

@ -69,6 +69,9 @@ import FilterTaxonomyTaginput from '../components/filter-types/taxonomy/Taginput
// Term edition form must be imported here so that it is not necessary on item-submission bundle // Term edition form must be imported here so that it is not necessary on item-submission bundle
import TermEditionForm from '../components/edition/term-edition-form.vue'; import TermEditionForm from '../components/edition/term-edition-form.vue';
// Term Recursive item component needs to be imported here, otherwise would cause ciruclar dependency
import RecursiveTermItem from '../components/lists/recursive-term-item.vue';
import FormFilterNumeric from '../components/filter-types/numeric/FormNumeric.vue'; import FormFilterNumeric from '../components/filter-types/numeric/FormNumeric.vue';
import FormFilterNumericInterval from '../components/filter-types/numeric-interval/FormNumericInterval.vue'; import FormFilterNumericInterval from '../components/filter-types/numeric-interval/FormNumericInterval.vue';
import FormFilterNumericListInterval from '../components/filter-types/numeric-list-interval/FormNumericListInterval.vue'; import FormFilterNumericListInterval from '../components/filter-types/numeric-list-interval/FormNumericListInterval.vue';
@ -103,7 +106,7 @@ import {
export default (element) => { export default (element) => {
// Vue Dev Tools! // Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development'; Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanAdminPage() { function renderTainacanAdminPage() {
@ -244,6 +247,7 @@ export default (element) => {
Vue.component('tainacan-filter-item', TainacanFiltersList); Vue.component('tainacan-filter-item', TainacanFiltersList);
/* Others */ /* Others */
Vue.component('recursive-term-item', RecursiveTermItem);
Vue.component('help-button', HelpButton); Vue.component('help-button', HelpButton);
Vue.component('draggable', draggable); Vue.component('draggable', draggable);
Vue.component('tainacan-title', TainacanTitle); Vue.component('tainacan-title', TainacanTitle);

View File

@ -17,7 +17,7 @@ import capability from './modules/capability';
import report from './modules/report'; import report from './modules/report';
// Vue Dev Tools! // Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development'; Vue.config.devtools = TAINACAN_ENV === 'development';
Vue.use(Vuex); Vue.use(Vuex);
export default new Vuex.Store({ export default new Vuex.Store({
@ -28,7 +28,7 @@ export default new Vuex.Store({
on the state tree for detecting inappropriate mutations, and it can be quite expensive when you make on the state tree for detecting inappropriate mutations, and it can be quite expensive when you make
large amount of mutations to the state. Make sure to turn it off in production to avoid the performance cost. large amount of mutations to the state. Make sure to turn it off in production to avoid the performance cost.
*/ */
strict: process.env.NODE_ENV !== 'production', strict: TAINACAN_ENV !== 'production',
modules: { modules: {
item, item,
collection, collection,

View File

@ -7,7 +7,7 @@
}"> }">
<tainacan-title <tainacan-title
v-if="!isItemLevel" v-if="!isItemLevel"
:bread-crumb-items="[{ path: '', label: this.$i18n.get('activities') }]"/> :bread-crumb-items="[{ path: '', label: $i18n.get('activities') }]"/>
<div :class="{ 'above-subheader': isRepositoryLevel }"> <div :class="{ 'above-subheader': isRepositoryLevel }">
<div <div

View File

@ -5,7 +5,7 @@
'page-container': isRepositoryLevel 'page-container': isRepositoryLevel
}"> }">
<tainacan-title <tainacan-title
:bread-crumb-items="[{ path: '', label: this.$i18n.get('capabilities') }]"/> :bread-crumb-items="[{ path: '', label: $i18n.get('capabilities') }]"/>
<div class="sub-header"> <div class="sub-header">
<b-field <b-field

View File

@ -2,7 +2,7 @@
<div class="repository-level-page page-container"> <div class="repository-level-page page-container">
<b-loading :active.sync="isLoading"/> <b-loading :active.sync="isLoading"/>
<tainacan-title <tainacan-title
:bread-crumb-items="[{ path: '', label: this.$i18n.get('collections') }]"/> :bread-crumb-items="[{ path: '', label: $i18n.get('collections') }]"/>
<div class="sub-header"> <div class="sub-header">
<!-- New Collection button --> <!-- New Collection button -->

View File

@ -1,6 +1,6 @@
<template> <template>
<div :class="{ 'repository-level-page page-container': isRepositoryLevel }"> <div :class="{ 'repository-level-page page-container': isRepositoryLevel }">
<tainacan-title :bread-crumb-items="[{ path: '', label: this.$i18n.get('filters') }]"/> <tainacan-title :bread-crumb-items="[{ path: '', label: $i18n.get('filters') }]"/>
<template v-if="isRepositoryLevel"> <template v-if="isRepositoryLevel">
<p>{{ $i18n.get('info_repository_filters_inheritance') }}</p> <p>{{ $i18n.get('info_repository_filters_inheritance') }}</p>
@ -179,6 +179,7 @@
@onEditionFinished="onEditionFinished()" @onEditionFinished="onEditionFinished()"
@onEditionCanceled="onEditionCanceled()" @onEditionCanceled="onEditionCanceled()"
@onErrorFound="formWithErrors = filter.id" @onErrorFound="formWithErrors = filter.id"
@onUpdateSavedState="(state) => editForms[openedFilterId].saved = state"
:index="index" :index="index"
:original-filter="filter" :original-filter="filter"
:edited-filter="editForms[openedFilterId]"/> :edited-filter="editForms[openedFilterId]"/>
@ -327,7 +328,7 @@
class="tainacan-modal-content" class="tainacan-modal-content"
style="width: auto"> style="width: auto">
<header class="tainacan-modal-title"> <header class="tainacan-modal-title">
<h2>{{ this.$i18n.get('label_available_filter_types') }}</h2> <h2>{{ $i18n.get('label_available_filter_types') }}</h2>
<hr> <hr>
</header> </header>
<section class="tainacan-form"> <section class="tainacan-form">
@ -404,6 +405,33 @@ export default {
components: { components: {
FilterEditionForm FilterEditionForm
}, },
beforeRouteLeave ( to, from, next ) {
let hasUnsavedForms = false;
for (let editForm in this.editForms) {
if (!this.editForms[editForm].saved)
hasUnsavedForms = true;
}
if ((this.openedFilterId != '' && this.openedFilterId != undefined) || hasUnsavedForms ) {
this.$buefy.modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_filters_not_saved'),
onConfirm: () => {
this.onEditionCanceled();
next();
},
},
trapFocus: true,
customClass: 'tainacan-modal',
closeButtonAriaLabel: this.$i18n.get('close')
});
} else {
next()
}
},
data(){ data(){
return { return {
isRepositoryLevel: false, isRepositoryLevel: false,
@ -457,33 +485,6 @@ export default {
immediate: true immediate: true
} }
}, },
beforeRouteLeave ( to, from, next ) {
let hasUnsavedForms = false;
for (let editForm in this.editForms) {
if (!this.editForms[editForm].saved)
hasUnsavedForms = true;
}
if ((this.openedFilterId != '' && this.openedFilterId != undefined) || hasUnsavedForms ) {
this.$buefy.modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_filters_not_saved'),
onConfirm: () => {
this.onEditionCanceled();
next();
},
},
trapFocus: true,
customClass: 'tainacan-modal',
closeButtonAriaLabel: this.$i18n.get('close')
});
} else {
next()
}
},
created() { created() {
this.isRepositoryLevel = (this.$route.params.collectionId === undefined); this.isRepositoryLevel = (this.$route.params.collectionId === undefined);
}, },

View File

@ -10,7 +10,7 @@
<!-- PAGE TITLE --------------------- --> <!-- PAGE TITLE --------------------- -->
<tainacan-title <tainacan-title
v-if="!$adminOptions.hideItemsListPageTitle" v-if="!$adminOptions.hideItemsListPageTitle"
:bread-crumb-items="[{ path: '', label: this.$i18n.get('items') }]"/> :bread-crumb-items="[{ path: '', label: $i18n.get('items') }]"/>
<!-- SEARCH CONTROL ------------------------- --> <!-- SEARCH CONTROL ------------------------- -->
<div <div
@ -443,6 +443,7 @@
:close-button-aria-label="$i18n.get('close')"> :close-button-aria-label="$i18n.get('close')">
<filters-items-list <filters-items-list
:is-loading-items="isLoadingItems" :is-loading-items="isLoadingItems"
@updateIsLoadingItemsState="(state) => isLoadingItems = state"
autofocus="true" autofocus="true"
tabindex="-1" tabindex="-1"
aria-modal aria-modal

View File

@ -3,7 +3,7 @@
:class="{ 'repository-level-page page-container': isRepositoryLevel }" :class="{ 'repository-level-page page-container': isRepositoryLevel }"
style="padding-bottom: 0;"> style="padding-bottom: 0;">
<tainacan-title <tainacan-title
:bread-crumb-items="[{ path: '', label: this.$i18n.get('metadata') }]"/> :bread-crumb-items="[{ path: '', label: $i18n.get('metadata') }]"/>
<template v-if="isRepositoryLevel"> <template v-if="isRepositoryLevel">
<p>{{ $i18n.get('info_repository_metadata_inheritance') }}</p> <p>{{ $i18n.get('info_repository_metadata_inheritance') }}</p>
@ -259,7 +259,7 @@
<child-metadata-list <child-metadata-list
v-if="metadatum.metadata_type_object && metadatum.metadata_type_object.component == 'tainacan-compound'" v-if="metadatum.metadata_type_object && metadatum.metadata_type_object.component == 'tainacan-compound'"
:parent.sync="metadatum" :parent.sync="activeMetadatumList[index]"
:metadata-name-filter-string="metadataNameFilterString" :metadata-name-filter-string="metadataNameFilterString"
:metadata-type-filter-options="metadataTypeFilterOptions" :metadata-type-filter-options="metadataTypeFilterOptions"
:has-some-metadata-type-filter-applied="hasSomeMetadataTypeFilterApplied" :has-some-metadata-type-filter-applied="hasSomeMetadataTypeFilterApplied"

View File

@ -2,7 +2,7 @@
<div> <div>
<div class="repository-level-page page-container"> <div class="repository-level-page page-container">
<tainacan-title <tainacan-title
:bread-crumb-items="[{ path: '', label: this.$i18n.get('taxonomies') }]"/> :bread-crumb-items="[{ path: '', label: $i18n.get('taxonomies') }]"/>
<div class="sub-header"> <div class="sub-header">
<!-- New Taxonomy Button ---- --> <!-- New Taxonomy Button ---- -->

View File

@ -253,7 +253,7 @@
<attachments-list <attachments-list
v-if="item != undefined && item.id != undefined" v-if="item != undefined && item.id != undefined"
:item="item" :item="item"
:is-loading.sync="isLoadingAttachments" :is-loading="isLoadingAttachments"
@isLoadingAttachments="(isLoading) => isLoadingAttachments = isLoading" /> @isLoadingAttachments="(isLoading) => isLoadingAttachments = isLoading" />
</b-tab-item> </b-tab-item>

View File

@ -6,7 +6,7 @@ import VueBlurHash from 'vue-blurhash';
export default (element) => { export default (element) => {
// Vue Dev Tools! // Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development'; Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanCollectionsCarouselBlocks() { function renderTainacanCollectionsCarouselBlocks() {
@ -66,7 +66,7 @@ export default (element) => {
tainacanApiRoot: this.tainacanApiRoot, tainacanApiRoot: this.tainacanApiRoot,
tainacanBaseUrl: this.tainacanBaseUrl, tainacanBaseUrl: this.tainacanBaseUrl,
className: this.className, className: this.className,
style: this.style customStyle: this.style
} }
}); });
}, },

View File

@ -1,6 +1,6 @@
<template> <template>
<div <div
:style="style" :style="customStyle"
:class="className + ' has-mounted'"> :class="className + ' has-mounted'">
<div <div
:class="'tainacan-carousel ' + (arrowsPosition ? ' has-arrows-' + arrowsPosition : '') + (largeArrows ? ' has-large-arrows' : '') " :class="'tainacan-carousel ' + (arrowsPosition ? ' has-arrows-' + arrowsPosition : '') + (largeArrows ? ' has-large-arrows' : '') "
@ -177,7 +177,7 @@ export default {
tainacanApiRoot: String, tainacanApiRoot: String,
tainacanBaseUrl: String, tainacanBaseUrl: String,
className: String, className: String,
style: String customStyle: String
}, },
data() { data() {
return { return {

View File

@ -7,7 +7,7 @@ import VueBlurHash from 'vue-blurhash';
export default (element) => { export default (element) => {
// Vue Dev Tools! // Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development'; Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanItemCarouselBlocks() { function renderTainacanItemCarouselBlocks() {
@ -78,7 +78,7 @@ export default (element) => {
tainacanApiRoot: this.tainacanApiRoot, tainacanApiRoot: this.tainacanApiRoot,
tainacanBaseUrl: this.tainacanBaseUrl, tainacanBaseUrl: this.tainacanBaseUrl,
className: this.className, className: this.className,
style: this.style customStyle: this.style
} }
}); });
}, },

View File

@ -1,6 +1,6 @@
<template> <template>
<div <div
:style="style" :style="customStyle"
:class="className + ' has-mounted'"> :class="className + ' has-mounted'">
<div v-if="showCollectionHeader"> <div v-if="showCollectionHeader">
<div <div
@ -186,7 +186,7 @@ export default {
tainacanApiRoot: String, tainacanApiRoot: String,
tainacanBaseUrl: String, tainacanBaseUrl: String,
className: String, className: String,
style: String customStyle: String
}, },
data() { data() {
return { return {

View File

@ -6,7 +6,7 @@ import VueBlurHash from 'vue-blurhash';
export default (element) => { export default (element) => {
// Vue Dev Tools! // Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development'; Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanTermsCarouselBlocks() { function renderTainacanTermsCarouselBlocks() {
@ -66,7 +66,7 @@ export default (element) => {
tainacanBaseUrl: this.tainacanBaseUrl, tainacanBaseUrl: this.tainacanBaseUrl,
className: this.className, className: this.className,
taxonomyId: this.taxonomyId, taxonomyId: this.taxonomyId,
style: this.style customStyle: this.style
} }
}); });
}, },
@ -88,7 +88,7 @@ export default (element) => {
this.showTermThumbnail = this.$el.attributes['show-term-thumbnail'] != undefined ? this.$el.attributes['show-term-thumbnail'].value == 'true' : false; this.showTermThumbnail = this.$el.attributes['show-term-thumbnail'] != undefined ? this.$el.attributes['show-term-thumbnail'].value == 'true' : false;
this.tainacanApiRoot = this.$el.attributes['tainacan-api-root'] != undefined ? this.$el.attributes['tainacan-api-root'].value : undefined; this.tainacanApiRoot = this.$el.attributes['tainacan-api-root'] != undefined ? this.$el.attributes['tainacan-api-root'].value : undefined;
this.tainacanBaseUrl = this.$el.attributes['tainacan-base-url'] != undefined ? this.$el.attributes['tainacan-base-url'].value : undefined; this.tainacanBaseUrl = this.$el.attributes['tainacan-base-url'] != undefined ? this.$el.attributes['tainacan-base-url'].value : undefined;
this.style = this.$el.attributes.style != undefined ? this.$el.attributes.style.value : undefined; this.customStyle = this.$el.attributes.style != undefined ? this.$el.attributes.style.value : undefined;
}, },
methods: { methods: {
__(text, domain) { __(text, domain) {

View File

@ -1,6 +1,6 @@
<template> <template>
<div <div
:style="style" :style="customStyle"
:class="className + ' has-mounted'"> :class="className + ' has-mounted'">
<div <div
@ -157,7 +157,7 @@ export default {
tainacanBaseUrl: String, tainacanBaseUrl: String,
className: String, className: String,
taxonomyId: String, taxonomyId: String,
style: String customStyle: String
}, },
data() { data() {
return { return {

View File

@ -6,7 +6,7 @@ import VueBlurHash from 'vue-blurhash';
export default (element) => { export default (element) => {
// Vue Dev Tools! // Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development'; Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanDynamicItemsBlocks() { function renderTainacanDynamicItemsBlocks() {
@ -83,7 +83,7 @@ export default (element) => {
tainacanApiRoot: this.tainacanApiRoot, tainacanApiRoot: this.tainacanApiRoot,
tainacanBaseUrl: this.tainacanBaseUrl, tainacanBaseUrl: this.tainacanBaseUrl,
className: this.className, className: this.className,
style: this.style customStyle: this.style
} }
}); });
}, },

View File

@ -1,6 +1,6 @@
<template> <template>
<div <div
:style="style" :style="customStyle"
:class="className + ' has-mounted'"> :class="className + ' has-mounted'">
<div v-if="showCollectionHeader"> <div v-if="showCollectionHeader">
<div <div
@ -130,7 +130,7 @@
<button <button
:style="{ marginLeft: paged <= 1 ? 'auto' : '0' }" :style="{ marginLeft: paged <= 1 ? 'auto' : '0' }"
class="next-button" class="next-button"
v-if="paged < totalItems/maxItemsNumber && items.length < totalItems" v-if="paged < totalItems/localMaxItemsNumber && items.length < totalItems"
@click="paged++; fetchItems()" @click="paged++; fetchItems()"
:label="$root.__('Next page', 'tainacan')"> :label="$root.__('Next page', 'tainacan')">
<span class="icon"> <span class="icon">
@ -160,7 +160,7 @@
:class="'items-layout-' + layout + (!showName ? ' items-list-without-margin' : '') + (maxColumnsCount ? ' max-columns-count-' + maxColumnsCount : '')"> :class="'items-layout-' + layout + (!showName ? ' items-list-without-margin' : '') + (maxColumnsCount ? ' max-columns-count-' + maxColumnsCount : '')">
<li <li
:key="item" :key="item"
v-for="item in Number(maxItemsNumber)" v-for="item in Number(localMaxItemsNumber)"
class="item-list-item skeleton" class="item-list-item skeleton"
:style="{ :style="{
marginBottom: layout == 'grid' ? (showName ? gridMargin + 12 : gridMargin) + 'px' : '', marginBottom: layout == 'grid' ? (showName ? gridMargin + 12 : gridMargin) + 'px' : '',
@ -307,7 +307,7 @@ export default {
tainacanApiRoot: String, tainacanApiRoot: String,
tainacanBaseUrl: String, tainacanBaseUrl: String,
className: String, className: String,
style: String customStyle: String
}, },
data() { data() {
return { return {
@ -332,6 +332,7 @@ export default {
this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_blocks.nonce; this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_blocks.nonce;
this.localOrder = this.order; this.localOrder = this.order;
this.localMaxItemsNumber = this.maxItemsNumber;
if (this.showCollectionHeader) if (this.showCollectionHeader)
this.fetchCollectionForHeader(); this.fetchCollectionForHeader();
@ -370,9 +371,9 @@ export default {
} else if (this.loadStrategy == 'selection') { } else if (this.loadStrategy == 'selection') {
this.maxItemsNumber = this.selectedItems.length; this.localMaxItemsNumber = this.selectedItems.length;
let endpoint = '/collection/' + this.collectionId + '/items?' + qs.stringify({ postin: this.selectedItems, perpage: this.maxItemsNumber }) + '&fetch_only=title,url,thumbnail'; let endpoint = '/collection/' + this.collectionId + '/items?' + qs.stringify({ postin: this.selectedItems, perpage: this.localMaxItemsNumber }) + '&fetch_only=title,url,thumbnail';
this.tainacanAxios.get(endpoint, { cancelToken: this.itemsRequestSource.token }) this.tainacanAxios.get(endpoint, { cancelToken: this.itemsRequestSource.token })
.then(response => { .then(response => {
@ -395,8 +396,8 @@ export default {
let queryObject = qs.parse(query); let queryObject = qs.parse(query);
// Set up max items to be shown // Set up max items to be shown
if (this.maxItemsNumber != undefined && Number(this.maxItemsNumber) > 0) if (this.localMaxItemsNumber != undefined && Number(this.localMaxItemsNumber) > 0)
queryObject.perpage = this.maxItemsNumber; queryObject.perpage = this.localMaxItemsNumber;
else if (queryObject.perpage != undefined && queryObject.perpage > 0) else if (queryObject.perpage != undefined && queryObject.perpage > 0)
this.localMaxItemsNumber = queryObject.perpage; this.localMaxItemsNumber = queryObject.perpage;
else { else {

View File

@ -371,6 +371,7 @@
:close-button-aria-label="$i18n.get('close')"> :close-button-aria-label="$i18n.get('close')">
<filters-items-list <filters-items-list
:is-loading-items="isLoadingItems" :is-loading-items="isLoadingItems"
@updateIsLoadingItemsState="(state) => isLoadingItems = state"
:autofocus="filtersAsModal" :autofocus="filtersAsModal"
:tabindex="filtersAsModal ? -1 : 0" :tabindex="filtersAsModal ? -1 : 0"
:aria-modal="filtersAsModal" :aria-modal="filtersAsModal"

View File

@ -70,7 +70,7 @@ import {
export default (element) => { export default (element) => {
// Vue Dev Tools! // Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development'; Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanItemsListComponent() { function renderTainacanItemsListComponent() {

View File

@ -5,7 +5,7 @@ import FacetsListThemeUnit from './facet-unit.vue';
export default (element) => { export default (element) => {
// Vue Dev Tools! // Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development'; Vue.config.devtools = TAINACAN_ENV === 'development';
Vue.component('facets-list-theme-unit', FacetsListThemeUnit); Vue.component('facets-list-theme-unit', FacetsListThemeUnit);
function renderTainacanFacetsListBlock() { function renderTainacanFacetsListBlock() {
@ -75,7 +75,7 @@ export default (element) => {
tainacanBaseUrl: this.tainacanBaseUrl, tainacanBaseUrl: this.tainacanBaseUrl,
tainacanSiteUrl: this.tainacanSiteUrl, tainacanSiteUrl: this.tainacanSiteUrl,
className: this.className, className: this.className,
style: this.style customStyle: this.style
} }
}); });
}, },

View File

@ -1,6 +1,6 @@
<template> <template>
<div <div
:style="style" :style="customStyle"
:class="className + ' has-mounted'"> :class="className + ' has-mounted'">
<div <div
v-if="showSearchBar" v-if="showSearchBar"
@ -194,7 +194,7 @@ export default {
tainacanBaseUrl: String, tainacanBaseUrl: String,
tainacanSiteUrl: String, tainacanSiteUrl: String,
className: String, className: String,
style: String customStyle: String
}, },
data() { data() {
return { return {
@ -211,7 +211,8 @@ export default {
tainacanAxios: undefined, tainacanAxios: undefined,
offset: undefined, offset: undefined,
totalFacets: 0, totalFacets: 0,
lastTerm: undefined lastTerm: undefined,
localParentTermId: ''
} }
}, },
computed: { computed: {
@ -229,6 +230,7 @@ export default {
this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_blocks.nonce; this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_blocks.nonce;
this.offset = 0; this.offset = 0;
this.localParentTermId = this.parentTermId;
this.fetchFacets(); this.fetchFacets();
this.applySearchString = debounce(this.applySearchString, 750); this.applySearchString = debounce(this.applySearchString, 750);
@ -301,11 +303,11 @@ export default {
queryObject.last_term = this.lastTerm; queryObject.last_term = this.lastTerm;
// Set up parentTerm for taxonomies // Set up parentTerm for taxonomies
if (this.parentTermId !== undefined && this.parentTermId !== null && this.parentTermId !== '' && this.isMetadatumTypeTaxonomy) if (this.localParentTermId !== undefined && this.localParentTermId !== null && this.localParentTermId !== '' && this.isMetadatumTypeTaxonomy)
queryObject.parent = this.parentTermId; queryObject.parent = this.localParentTermId;
else { else {
delete queryObject.parent; delete queryObject.parent;
this.parentTermId = null; this.localParentTermId = null;
} }
// Parameter fo tech entity object with image and url // Parameter fo tech entity object with image and url

View File

@ -113,7 +113,7 @@
name: 'TermEditionForm', name: 'TermEditionForm',
mixins: [ formHooks ], mixins: [ formHooks ],
props: { props: {
form: Object, originalForm: Object,
taxonomyId: '' taxonomyId: ''
}, },
data() { data() {
@ -128,11 +128,14 @@
entityName: 'term', entityName: 'term',
isLoading: false, isLoading: false,
parentTermSearchQuery: '', parentTermSearchQuery: '',
parentTermSearchOffset: 0 parentTermSearchOffset: 0,
form: {}
} }
}, },
created() {
this.form = JSON.parse(JSON.stringify(this.originalForm));
},
mounted() { mounted() {
this.hasParent = this.form.parent != undefined && this.form.parent > 0; this.hasParent = this.form.parent != undefined && this.form.parent > 0;
this.initialParentId = this.form.parent; this.initialParentId = this.form.parent;
@ -175,9 +178,8 @@
}, },
clearErrors(attributes) { clearErrors(attributes) {
if (attributes instanceof Object) { if (attributes instanceof Object) {
for(let attribute in attributes){ for (let attribute in attributes)
this.formErrors[attribute] = undefined; this.formErrors[attribute] = undefined;
}
} else { } else {
this.formErrors[attributes] = undefined; this.formErrors[attributes] = undefined;
} }

View File

@ -50,7 +50,7 @@ export default (element) => {
function renderItemSubmissionForm() { function renderItemSubmissionForm() {
// Vue Dev Tools! // Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development'; Vue.config.devtools = TAINACAN_ENV === 'development';
// Gets the div with the content of the block // Gets the div with the content of the block
let blockElement = element ? element : document.getElementById('tainacan-item-submission-form'); let blockElement = element ? element : document.getElementById('tainacan-item-submission-form');

View File

@ -31,7 +31,7 @@ import ptBrLocaleConfig from 'apexcharts/dist/locales/pt-br.json';
export default (element) => { export default (element) => {
// Vue Dev Tools! // Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development'; Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanReportsPage() { function renderTainacanReportsPage() {

View File

@ -11,7 +11,7 @@ import RolesPage from '../roles.vue';
export default (element) => { export default (element) => {
// Vue Dev Tools! // Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development'; Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanRolePage() { function renderTainacanRolePage() {

View File

@ -86,6 +86,9 @@ module.exports = {
hints: false hints: false
}, },
plugins: [ plugins: [
new webpack.DefinePlugin({
'TAINACAN_ENV': JSON.stringify(process.env.NODE_ENV)
}),
new VueLoaderPlugin({ new VueLoaderPlugin({
prettify: false prettify: false
}), }),

View File

@ -2,6 +2,7 @@ const { merge } = require('webpack-merge');
const common = require('./webpack.common.js'); const common = require('./webpack.common.js');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const CircularDependencyPlugin = require('circular-dependency-plugin');
module.exports = merge(common, { module.exports = merge(common, {
mode: 'development', mode: 'development',
@ -10,6 +11,18 @@ module.exports = merge(common, {
new BundleAnalyzerPlugin({ new BundleAnalyzerPlugin({
openAnalyzer: false, openAnalyzer: false,
analyzerMode: 'static' analyzerMode: 'static'
}),
new CircularDependencyPlugin({
// exclude detection of files based on a RegExp
exclude: /a\.js|node_modules/,
// include specific files based on a RegExp
// add errors to webpack instead of warnings
failOnError: true,
// allow import cycles that include an asyncronous import,
// e.g. via import(/* webpackMode: "weak" */ './file.js')
allowAsyncCycles: true,
// set the current working directory for displaying module paths
cwd: process.cwd(),
}) })
], ],
resolve: { resolve: {

View File

@ -4,8 +4,6 @@ const TerserPlugin = require('terser-webpack-plugin');
const terserPlugin = new TerserPlugin({ const terserPlugin = new TerserPlugin({
parallel: true, parallel: true,
sourceMap: false,
cache: true,
extractComments: false, extractComments: false,
terserOptions: { terserOptions: {
output: { output: {
@ -19,7 +17,7 @@ const terserPlugin = new TerserPlugin({
module.exports = merge(common, { module.exports = merge(common, {
mode: 'production', mode: 'production',
devtool: '', devtool: undefined,
optimization: { optimization: {
minimize: true, minimize: true,
minimizer: [terserPlugin] minimizer: [terserPlugin]