소스 검색

Поправки

Book Pauk 3 년 전
부모
커밋
c534edfeb5
2개의 변경된 파일35개의 추가작업 그리고 40개의 파일을 삭제
  1. 15 39
      client/components/ExternalLibs/ExternalLibs.vue
  2. 20 1
      client/components/share/Dialog.vue

+ 15 - 39
client/components/ExternalLibs/ExternalLibs.vue

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

+ 20 - 1
client/components/share/Dialog.vue

@@ -1,5 +1,5 @@
 <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="header row">
                 <div class="caption col row items-center q-ml-md">
@@ -26,12 +26,15 @@
 <script>
 //-----------------------------------------------------------------------------
 import vueComponent from '../vueComponent.js';
+import * as utils from '../../share/utils';
 
 class Dialog {
     _props = {
         modelValue: Boolean,
     };
 
+    shown = false;
+
     get active() {
         return this.modelValue;
     }
@@ -39,6 +42,22 @@ class Dialog {
     set active(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);