Skip to content

Commit

Permalink
Merge branch 'hotfix/1.29.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
olovy committed Mar 17, 2023
2 parents b9e36d5 + 982e4c1 commit 93bddb9
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 6 deletions.
2 changes: 1 addition & 1 deletion vue-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-client",
"version": "1.29.3",
"version": "1.29.4",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
6 changes: 6 additions & 0 deletions vue-client/src/components/inspector/field.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export default {
type: Boolean,
default: false,
},
isFirstField: {
type: Boolean,
default: false,
},
oldValue: {
type: [Array, String, Object],
default: null,
Expand Down Expand Up @@ -902,6 +906,7 @@ export default {
<item-bylang
v-if="getDatatype(firstInValueAsArray) == 'language'"
:is-locked="locked"
:is-first-field="isFirstField"
:field-value="valueAsArray"
:field-key="fieldKey"
:parent-path="path"
Expand Down Expand Up @@ -1012,6 +1017,7 @@ export default {
<item-bylang
v-if="getDatatype(firstInValueAsArray) == 'language'"
:is-locked="locked"
:is-first-field="isFirstField"
:field-value="valueAsArray"
:field-key="fieldKey"
:parent-path="path"
Expand Down
14 changes: 11 additions & 3 deletions vue-client/src/components/inspector/item-bylang.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export default {
type: Boolean,
default: true,
},
isFirstField: {
type: Boolean,
default: false,
},
diff: {
type: Object,
default: null,
Expand All @@ -44,7 +48,7 @@ export default {
entries: {
handler: debounce(function debounceUpdate(val) {
this.update(val);
}, 1000),
}, 400),
deep: true,
},
cache() {
Expand Down Expand Up @@ -132,7 +136,7 @@ export default {
setTimeout(() => {
this.toLangMap(tag, val);
this.updateLangCache(tag);
}, 1000);
}, 400);
},
readyForSave(value) {
this.$store.dispatch('setInspectorStatusValue', { property: 'readyForSave', value: value });
Expand Down Expand Up @@ -163,9 +167,12 @@ export default {
});
}
// Update prop
if (this.path.includes('ByLang')) {
return;
}
const newData = this.dataForm(viewObjects);
const oldData = cloneDeep(get(this.inspector.data, this.path));
if (!isEqual(oldData, newData) && !isEmpty(newData)) {
if (!isEqual(oldData, newData)) {
this.$store.dispatch('updateInspectorData', {
changeList: [
{
Expand Down Expand Up @@ -316,6 +323,7 @@ export default {
:tag="entry.tag"
:id="entry.id"
:is-locked="isLocked"
:is-first-field="isFirstField"
:remove-is-allowed="removeIsAllowed"
:uri="uriFor(entry.tag)"
:label="getLabelFromCache(entry.tag)"
Expand Down
3 changes: 2 additions & 1 deletion vue-client/src/components/inspector/item-local.vue
Original file line number Diff line number Diff line change
Expand Up @@ -572,12 +572,13 @@ export default {
<ul class="ItemLocal-list js-itemLocalFields" v-show="expanded">
<field
v-show="k !== '_uid'"
v-for="(v, k) in filteredItem"
v-for="(v, k, i) in filteredItem"
:parent-path="getPath"
:entity-type="item['@type']"
:is-inner="true"
:is-locked="isLocked"
:is-removable="false"
:is-first-field="i===0"
:parent-key="fieldKey"
:parent-index="index"
:parent-accepted-types="acceptedTypes"
Expand Down
48 changes: 48 additions & 0 deletions vue-client/src/components/inspector/language-entry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export default {
type: Boolean,
default: true,
},
isFirstField: {
type: Boolean,
default: false,
},
removeIsAllowed: {
type: Boolean,
default: false,
Expand Down Expand Up @@ -60,6 +64,7 @@ export default {
'settings',
'resources',
'supportedTags',
'status',
]),
isByLang() {
return this.itemPath.includes('ByLang');
Expand Down Expand Up @@ -93,6 +98,19 @@ export default {
if (this.diff == null) return false;
return this.diff.modified.some(m => isEqual(m.path, this.exactPath));
},
shouldFocus() {
const lastAdded = this.inspector.status.lastAdded;
if (lastAdded === this.exactPath || (this.isFirstField && this.itemPath.startsWith(lastAdded))) {
return true;
}
return false;
},
isLastAdded() {
if (this.inspector.status.lastAdded === this.exactPath) {
return true;
}
return false;
},
},
components: {
PreviewCard,
Expand All @@ -116,6 +134,22 @@ export default {
AutoSize.update(textarea);
});
},
addFocus() {
this.$refs.textarea.focus({ preventScroll: true }); // Prevent scroll as we will handle this ourselves
},
highLightLastAdded() {
if (this.isLastAdded === true) {
const element = this.$el;
// FIXME: the highlighting is not visible
element.classList.add('is-lastAdded');
setTimeout(() => {
element.classList.remove('is-lastAdded');
if (this.isLastAdded) {
this.$store.dispatch('setInspectorStatusValue', { property: 'lastAdded', value: '' });
}
}, 1000);
}
},
},
mounted() {
if (this.tag !== 'none') {
Expand All @@ -128,7 +162,11 @@ export default {
this.$nextTick(() => {
if (!this.isLocked) {
this.highLightLastAdded();
this.initializeTextarea();
if (!this.status.isNew && this.shouldFocus) {
this.addFocus();
}
}
});
},
Expand Down Expand Up @@ -448,5 +486,15 @@ export default {
&-popover > .trigger {
max-width: 100%;
}
&.is-lastAdded {
background-color: @form-add;
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation-name: pulse;
animation-name: pulse;
}
}
</style>
8 changes: 8 additions & 0 deletions vue-client/src/components/mixins/language-mixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ export default {
} else {
updateVal = [].concat(updateVal, '');
}
this.$store.dispatch('setInspectorStatusValue', {
property: 'lastAdded',
value: `${this.getPropPath()}[${updateVal.length - 1}]`,
});
this.$store.dispatch('updateInspectorData', {
changeList: [
{
Expand All @@ -254,6 +258,10 @@ export default {
addToHistory: true,
});
} else {
this.$store.dispatch('setInspectorStatusValue', {
property: 'lastAdded',
value: `${this.getPropPath()}[0]`,
});
this.$store.dispatch('updateInspectorData', {
changeList: [
{
Expand Down
2 changes: 1 addition & 1 deletion vue-client/src/views/Inspector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ export default {
}
setTimeout(() => {
this.justEmbellished = false;
}, 1500);
}, 5000);
},
async preSaveHook(obj) {
await checkAutoShelfControlNumber(obj, this.settings, this.user);
Expand Down

0 comments on commit 93bddb9

Please sign in to comment.