@reviewpush/rp-treeselect 0.0.12 → 0.0.14

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@reviewpush/rp-treeselect",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "repository": "reviewpush/rp-treeselect",
5
5
  "main": "dist/rp-treeselect.cjs.js",
6
6
  "unpkg": "dist/rp-treeselect.umd.min.js",
@@ -10,21 +10,7 @@
10
10
  "dist"
11
11
  ],
12
12
  "scripts": {
13
- "dev": "node build/dev-server.js",
14
- "build-library": "node build/build-library.js",
15
- "build-docs": "rimraf gh-pages && mkdir gh-pages && node build/build-docs.js",
16
- "preview-docs": "http-server gh-pages",
17
- "gh-pages": "npm run build-docs && gh-pages --dist gh-pages --branch gh-pages --dotfiles",
18
- "cleanup-cov": "rimraf test/unit/coverage",
19
- "unit": "npm run cleanup-cov && karma start test/unit/karma.conf.js --watch",
20
- "testonly": "npm run cleanup-cov && karma start test/unit/karma.config.js --single-run",
21
- "test": "npm run testonly",
22
- "pretest": "npm run lint",
23
- "lint:js": "eslint --ext .js --ext .vue --cache --cache-location node_modules/.cache/eslint --rule 'no-console: 2' .",
24
- "lint:css": "stylelint '**/*.less'",
25
- "lint": "npm run lint:js && npm run lint:css",
26
- "verify-builds": "size-limit && node build/verify-builds.js",
27
- "finish": "npm test && npm run build-library && npm run verify-builds"
13
+ "build-library": "node build/build-library.js"
28
14
  },
29
15
  "pre-commit": "lint",
30
16
  "dependencies": {
@@ -43,7 +29,7 @@
43
29
  "@babel/plugin-transform-runtime": "^7.0.0",
44
30
  "@babel/preset-env": "^7.3.1",
45
31
  "@size-limit/preset-big-lib": "^2.0.2",
46
- "@vue/test-utils": "1.0.0-beta.16",
32
+ "@vue/compiler-sfc": "^3.4.21",
47
33
  "autoprefixer": "^9.4.6",
48
34
  "babel-eslint": "^10.0.1",
49
35
  "babel-loader": "^8.0.0",
@@ -54,7 +40,7 @@
54
40
  "codecov": "^3.0.0",
55
41
  "connect-history-api-fallback": "^1.5.0",
56
42
  "copy-webpack-plugin": "^5.0.3",
57
- "css-loader": "^3.0.0",
43
+ "css-loader": "^3.6.0",
58
44
  "entities": "^2.0.0",
59
45
  "eslint": "^6.1.0",
60
46
  "eslint-config-riophae": "^0.10.0",
@@ -67,6 +53,7 @@
67
53
  "eslint-plugin-vue": "^6.0.0",
68
54
  "eventsource-polyfill": "^0.9.6",
69
55
  "express": "^4.16.3",
56
+ "file-loader": "^6.2.0",
70
57
  "friendly-errors-webpack-plugin": "^1.7.0",
71
58
  "gh-pages": "^2.0.0",
72
59
  "html-webpack-plugin": "^3.1.0",
@@ -83,7 +70,7 @@
83
70
  "karma-webpack": "^4.0.2",
84
71
  "less": "^3.0.1",
85
72
  "less-loader": "^5.0.0",
86
- "mini-css-extract-plugin": "^0.8.0",
73
+ "mini-css-extract-plugin": "^0.8.2",
87
74
  "open": "^7.0.0",
88
75
  "optimize-css-assets-webpack-plugin": "^5.0.0",
89
76
  "ora": "^4.0.1",
@@ -105,12 +92,8 @@
105
92
  "stylelint-config-xo-space": "^0.13.0",
106
93
  "terser-webpack-plugin": "^2.1.0",
107
94
  "url-loader": "^2.0.1",
108
- "vodal": "^2.3.3",
109
- "vue": "^2.2.0",
110
- "vue-loader": "^15.6.0",
111
- "vue-style-loader": "^4.0.2",
112
- "vue-template-compiler": "^2.4.4",
113
- "vuex": "^3.0.1",
95
+ "vue": "^3.4.21",
96
+ "vue-loader": "^17.3.1",
114
97
  "webpack": "^4.6.0",
115
98
  "webpack-bundle-analyzer": "^3.0.2",
116
99
  "webpack-cdn-plugin": "^3.1.4",
@@ -121,7 +104,8 @@
121
104
  "yaku": "^0.19.3"
122
105
  },
123
106
  "peerDependencies": {
124
- "vue": "^3.4.21"
107
+ "vue": "^3.4.21",
108
+ "vue-loader": "^17.3.1"
125
109
  },
126
110
  "keywords": [
127
111
  "vue",
@@ -1,14 +1,11 @@
1
1
  <script>
2
- import { inject, createApp } from 'vue'
2
+ import { provide, 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
- setup() {
9
- const instance = inject('instance')
10
- return { instance }
11
- },
8
+ props: [ 'instance' ],
12
9
 
13
10
  watch: {
14
11
  'instance.menu.isOpen'(newValue) {
@@ -30,7 +27,10 @@
30
27
  },
31
28
 
32
29
  mounted() {
33
- const { instance } = this
30
+ const { instance } = this.$props
31
+
32
+ console.log('PROVIDING')
33
+ provide('instance', instance)
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.$props
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.$props
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.$props
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.$props
103
103
  const $control = instance.getControl()
104
104
  const $portalTarget = this.$el
105
105
  const controlRect = $control.getBoundingClientRect()
@@ -117,15 +117,17 @@
117
117
  },
118
118
 
119
119
  render() {
120
- const { instance } = this
121
- const portalTargetClass = [ 'rp-treeselect__portal-target', instance.wrapperClass ]
122
- const portalTargetStyle = { zIndex: instance.zIndex }
123
-
124
- return (
125
- <div class={portalTargetClass} style={portalTargetStyle} data-instance-id={instance.getInstanceId()}>
126
- <Menu ref="menu" />
127
- </div>
128
- )
120
+ const { instance } = this.$props
121
+ if (instance) {
122
+ const portalTargetClass = [ 'rp-treeselect__portal-target', instance.wrapperClass ]
123
+ const portalTargetStyle = { zIndex: instance.zIndex }
124
+
125
+ return (
126
+ <div class={portalTargetClass} style={portalTargetStyle} data-instance-id={instance.getInstanceId()}>
127
+ <Menu ref="menu" />
128
+ </div>
129
+ )
130
+ }
129
131
  },
130
132
 
131
133
  destroyed() {
@@ -137,13 +139,17 @@
137
139
 
138
140
  export default {
139
141
  name: 'rp-treeselect--menu-portal',
142
+ setup() {
143
+ const instance = inject('instance')
144
+ return { instance }
145
+ },
140
146
 
141
147
  created() {
142
148
  this.portalTarget = null
143
149
  },
144
150
 
145
151
  mounted() {
146
- this.setup()
152
+ this.setupPortal()
147
153
  },
148
154
 
149
155
  destroyed() {
@@ -151,18 +157,12 @@
151
157
  },
152
158
 
153
159
  methods: {
154
- setup() {
160
+ setupPortal() {
155
161
  const el = document.createElement('div')
156
162
  el.setAttribute('id', `menu-target-${this._uid}`)
157
163
  document.body.appendChild(el)
158
164
 
159
-
160
- const targetApp = {
161
- parent: this,
162
- ...PortalTarget,
163
- }
164
-
165
- this.portalTarget = createApp(targetApp)
165
+ this.portalTarget = createApp(PortalTarget, { instance: this.instance })
166
166
  this.portalTarget.mount(`#menu-target-${this._uid}`)
167
167
  },
168
168
 
@@ -907,6 +907,7 @@
907
907
  },
908
908
 
909
909
  mounted() {
910
+ console.log('TREESELECT')
910
911
  if (this.autoFocus) this.focusInput()
911
912
  if (!this.options && !this.async && this.autoLoadRootOptions) this.loadRootOptions()
912
913
  if (this.alwaysOpen) this.openMenu()