Поправки

This commit is contained in:
Book Pauk
2021-11-16 15:41:51 +07:00
parent adc8cd7243
commit c534edfeb5
2 changed files with 35 additions and 40 deletions

View File

@@ -33,7 +33,6 @@
style="width: 230px" style="width: 230px"
dropdown-icon="la la-angle-down la-sm" dropdown-icon="la la-angle-down la-sm"
rounded outlined dense emit-value map-options display-value-sanitize options-sanitize rounded outlined dense emit-value map-options display-value-sanitize options-sanitize
@input="rootLinkInput"
@popup-show="onSelectPopupShow" @popup-hide="onSelectPopupHide" @popup-show="onSelectPopupShow" @popup-hide="onSelectPopupHide"
> >
<template #prepend> <template #prepend>
@@ -64,7 +63,6 @@
dropdown-icon="la la-angle-down la-sm" dropdown-icon="la la-angle-down la-sm"
rounded outlined dense emit-value map-options hide-selected display-value-sanitize options-sanitize rounded outlined dense emit-value map-options hide-selected display-value-sanitize options-sanitize
@popup-show="onSelectPopupShow" @popup-hide="onSelectPopupHide" @popup-show="onSelectPopupShow" @popup-hide="onSelectPopupHide"
@input="selectedLinkInput"
> >
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%"> <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
Закладки Закладки
@@ -149,7 +147,6 @@
style="width: 50px" style="width: 50px"
dropdown-icon="la la-angle-down la-sm" dropdown-icon="la la-angle-down la-sm"
outlined dense emit-value map-options hide-selected display-value-sanitize options-sanitize outlined dense emit-value map-options hide-selected display-value-sanitize options-sanitize
@input="defaultRootLinkInput"
> >
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%"> <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
Предустановленные ссылки Предустановленные ссылки
@@ -238,13 +235,13 @@ const componentOptions = {
BookmarkSettings BookmarkSettings
}, },
watch: { watch: {
libs: function() { libs() {
this.loadLibs(); this.loadLibs();
}, },
defaultRootLink: function() { defaultRootLink() {
this.updateBookmarkLink(); this.updateBookmarkLink();
}, },
bookUrl: function(newValue) { bookUrl(newValue) {
const value = lu.addProtocol(newValue); const value = lu.addProtocol(newValue);
const subst = this.makeProxySubst(value, true); const subst = this.makeProxySubst(value, true);
if (value != subst) { if (value != subst) {
@@ -253,7 +250,7 @@ const componentOptions = {
}); });
} }
}, },
bookmarkLink: function(newValue) { bookmarkLink(newValue) {
const value = lu.addProtocol(newValue); const value = lu.addProtocol(newValue);
const subst = this.makeProxySubst(value, true); const subst = this.makeProxySubst(value, true);
if (value != subst) { if (value != subst) {
@@ -262,15 +259,21 @@ const componentOptions = {
}); });
} }
}, },
closeAfterSubmit: function(newValue) { closeAfterSubmit(newValue) {
this.commitProp('closeAfterSubmit', newValue); this.commitProp('closeAfterSubmit', newValue);
}, },
openInFrameOnEnter: function(newValue) { openInFrameOnEnter(newValue) {
this.commitProp('openInFrameOnEnter', newValue); this.commitProp('openInFrameOnEnter', newValue);
}, },
openInFrameOnAdd: function(newValue) { openInFrameOnAdd(newValue) {
this.commitProp('openInFrameOnAdd', newValue); this.commitProp('openInFrameOnAdd', newValue);
}, },
rootLink() {
this.rootLinkInput();
},
selectedLink() {
this.selectedLinkInput();
},
} }
}; };
class ExternalLibs { class ExternalLibs {
@@ -323,29 +326,6 @@ class ExternalLibs {
} }
mounted() { mounted() {
//Поправка метода toggleOption компонента select фреймворка quasar, необходимо другое поведение
//$emit('input'.. вызывается всегда
this.toggleOption = function(opt, keepOpen) {
if (this.editable !== true || opt === void 0 || this.isOptionDisabled(opt) === true) {
return;
}
const optValue = this.getOptionValue(opt);
if (this.multiple !== true) {
if (keepOpen !== true) {
this.updateInputValue(this.fillInput === true ? this.getOptionLabel(opt) : '', true, true);
this.hidePopup();
}
this.$refs.target !== void 0 && this.$refs.target.focus();
this.$emit('input', this.emitValue === true ? optValue : opt);
}
};
this.$refs.rootLink.toggleOption = this.toggleOption;
this.$refs.selectedLink.toggleOption = this.toggleOption;
(async() => { (async() => {
//подождем this.mode //подождем this.mode
let i = 0; let i = 0;
@@ -692,9 +672,9 @@ class ExternalLibs {
this.addBookmarkMode = mode; this.addBookmarkMode = mode;
this.addBookmarkVisible = true; this.addBookmarkVisible = true;
this.$nextTick(() => { this.$nextTick(async() => {
await this.$refs.dialogAddBookmark.waitShown();
this.$refs.bookmarkLink.focus(); this.$refs.bookmarkLink.focus();
this.$refs.defaultRootLink.toggleOption = this.toggleOption;
}); });
} }
@@ -709,10 +689,6 @@ class ExternalLibs {
} }
} }
defaultRootLinkInput() {
this.updateBookmarkLink();
}
bookmarkLinkKeyDown(event) { bookmarkLinkKeyDown(event) {
if (event.key == 'Enter') { if (event.key == 'Enter') {
this.$refs.bookmarkDesc.focus(); this.$refs.bookmarkDesc.focus();

View File

@@ -1,5 +1,5 @@
<template> <template>
<q-dialog v-model="active" no-route-dismiss> <q-dialog v-model="active" no-route-dismiss @show="onShow" @hide="onHide">
<div class="column bg-white no-wrap"> <div class="column bg-white no-wrap">
<div class="header row"> <div class="header row">
<div class="caption col row items-center q-ml-md"> <div class="caption col row items-center q-ml-md">
@@ -26,12 +26,15 @@
<script> <script>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
import vueComponent from '../vueComponent.js'; import vueComponent from '../vueComponent.js';
import * as utils from '../../share/utils';
class Dialog { class Dialog {
_props = { _props = {
modelValue: Boolean, modelValue: Boolean,
}; };
shown = false;
get active() { get active() {
return this.modelValue; return this.modelValue;
} }
@@ -39,6 +42,22 @@ class Dialog {
set active(value) { set active(value) {
this.$emit('update:modelValue', value); this.$emit('update:modelValue', value);
} }
onShow() {
this.shown = true;
}
onHide() {
this.shown = false;
}
async waitShown() {
let i = 100;
while (!this.shown && i > 0) {
await utils.sleep(10);
i--;
}
}
} }
export default vueComponent(Dialog); export default vueComponent(Dialog);