@reviewpush/rp-treeselect 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { inject, createApp } from 'vue'
|
|
3
3
|
import { watchSize, setupResizeAndScrollEventListeners, find } from '../utils'
|
|
4
4
|
import Menu from './Menu'
|
|
5
5
|
|
|
6
6
|
const PortalTarget = {
|
|
7
7
|
name: 'rp-treeselect--portal-target',
|
|
8
|
-
|
|
8
|
+
setup() {
|
|
9
|
+
const instance = inject('instance')
|
|
10
|
+
return { instance }
|
|
11
|
+
},
|
|
9
12
|
|
|
10
13
|
watch: {
|
|
11
14
|
'instance.menu.isOpen'(newValue) {
|
|
@@ -27,10 +30,7 @@
|
|
|
27
30
|
},
|
|
28
31
|
|
|
29
32
|
mounted() {
|
|
30
|
-
const { instance } = this
|
|
31
|
-
|
|
32
|
-
console.log('PROVIDING')
|
|
33
|
-
provide('instance', instance)
|
|
33
|
+
const { instance } = this
|
|
34
34
|
|
|
35
35
|
if (instance.menu.isOpen) this.setupHandlers()
|
|
36
36
|
},
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
|
|
51
51
|
setupControlResizeAndScrollEventListeners() {
|
|
52
|
-
const { instance } = this
|
|
52
|
+
const { instance } = this
|
|
53
53
|
const $control = instance.getControl()
|
|
54
54
|
|
|
55
55
|
// istanbul ignore next
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
|
|
63
63
|
setupControlSizeWatcher() {
|
|
64
|
-
const { instance } = this
|
|
64
|
+
const { instance } = this
|
|
65
65
|
const $control = instance.getControl()
|
|
66
66
|
|
|
67
67
|
// istanbul ignore next
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
},
|
|
91
91
|
|
|
92
92
|
updateWidth() {
|
|
93
|
-
const { instance } = this
|
|
93
|
+
const { instance } = this
|
|
94
94
|
const $portalTarget = this.$el
|
|
95
95
|
const $control = instance.getControl()
|
|
96
96
|
const controlRect = $control.getBoundingClientRect()
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
},
|
|
100
100
|
|
|
101
101
|
updateMenuContainerOffset() {
|
|
102
|
-
const { instance } = this
|
|
102
|
+
const { instance } = this
|
|
103
103
|
const $control = instance.getControl()
|
|
104
104
|
const $portalTarget = this.$el
|
|
105
105
|
const controlRect = $control.getBoundingClientRect()
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
},
|
|
118
118
|
|
|
119
119
|
render() {
|
|
120
|
-
const { instance } = this
|
|
120
|
+
const { instance } = this
|
|
121
121
|
if (instance) {
|
|
122
122
|
const portalTargetClass = [ 'rp-treeselect__portal-target', instance.wrapperClass ]
|
|
123
123
|
const portalTargetStyle = { zIndex: instance.zIndex }
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
el.setAttribute('id', `menu-target-${this._uid}`)
|
|
163
163
|
document.body.appendChild(el)
|
|
164
164
|
|
|
165
|
-
this.portalTarget = createApp(PortalTarget
|
|
165
|
+
this.portalTarget = createApp(PortalTarget)
|
|
166
166
|
this.portalTarget.mount(`#menu-target-${this._uid}`)
|
|
167
167
|
},
|
|
168
168
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import fuzzysearch from 'fuzzysearch'
|
|
3
|
-
import { provide } from 'vue'
|
|
3
|
+
import { provide, ref, inject } from 'vue'
|
|
4
4
|
import {
|
|
5
5
|
warning,
|
|
6
6
|
onLeftClick, scrollIntoView,
|
|
@@ -643,6 +643,19 @@
|
|
|
643
643
|
},
|
|
644
644
|
},
|
|
645
645
|
|
|
646
|
+
setup() {
|
|
647
|
+
const instance = ref({})
|
|
648
|
+
const setInstance = inst => instance.value = inst
|
|
649
|
+
|
|
650
|
+
provide('instance', instance)
|
|
651
|
+
provide('setInstance', setInstance)
|
|
652
|
+
|
|
653
|
+
return {
|
|
654
|
+
instance,
|
|
655
|
+
setInstance,
|
|
656
|
+
}
|
|
657
|
+
},
|
|
658
|
+
|
|
646
659
|
data() {
|
|
647
660
|
return {
|
|
648
661
|
trigger: {
|
|
@@ -902,12 +915,10 @@
|
|
|
902
915
|
created() {
|
|
903
916
|
this.verifyProps()
|
|
904
917
|
this.resetFlags()
|
|
905
|
-
|
|
906
|
-
provide('instance', this)
|
|
918
|
+
this.setInstance(this)
|
|
907
919
|
},
|
|
908
920
|
|
|
909
921
|
mounted() {
|
|
910
|
-
console.log('TREESELECT')
|
|
911
922
|
if (this.autoFocus) this.focusInput()
|
|
912
923
|
if (!this.options && !this.async && this.autoLoadRootOptions) this.loadRootOptions()
|
|
913
924
|
if (this.alwaysOpen) this.openMenu()
|