@authing/vue-ui-components 3.0.22 → 3.0.24
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/components/AuthingGuard/index.js +8 -0
- package/{src/components/AuthingGuard.vue → components/AuthingGuard/src/index.vue} +28 -39
- package/components/Guard/index.js +8 -0
- package/{src/components/Guard.vue → components/Guard/src/index.vue} +22 -17
- package/components/index.js +25 -0
- package/lib/index.min.css +1 -2
- package/lib/index.min.js +482 -1
- package/package.json +58 -39
- package/.eslintignore +0 -2
- package/configs/rollup.config.base.js +0 -77
- package/configs/rollup.config.browser.js +0 -15
- package/configs/rollup.config.es.js +0 -16
- package/configs/rollup.config.umd.js +0 -15
- package/src/components/index.d.ts +0 -0
- package/src/components/index.js +0 -7
- package/src/icons.js +0 -18
- package/src/index.js +0 -79
- package/src/mixins/CoupledChild.js +0 -49
- package/src/mixins/CoupledParent.js +0 -172
- package/src/mixins/DisableScroll.js +0 -25
- package/src/mixins/DisabledChild.js +0 -25
- package/src/mixins/DisabledParent.js +0 -35
- package/vue.config.js +0 -33
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authing/vue-ui-components",
|
|
3
3
|
"description": "Authing Vue UI components",
|
|
4
|
-
"
|
|
4
|
+
"files": [
|
|
5
|
+
"lib",
|
|
6
|
+
"components"
|
|
7
|
+
],
|
|
8
|
+
"version": "3.0.24",
|
|
5
9
|
"keywords": [
|
|
6
10
|
"vue",
|
|
7
11
|
"vuejs",
|
|
@@ -10,12 +14,13 @@
|
|
|
10
14
|
"license": "MIT",
|
|
11
15
|
"main": "lib/index.min.js",
|
|
12
16
|
"scripts": {
|
|
17
|
+
"clean": "rimraf ./lib",
|
|
13
18
|
"demo:serve": "vue-cli-service serve",
|
|
14
19
|
"demo:build": "vue-cli-service build",
|
|
15
20
|
"demo:lint": "vue-cli-service lint",
|
|
16
21
|
"lint": "eslint --ext .js,.vue src/",
|
|
17
22
|
"dev": "nodemon --exec 'npm run build:es' --watch src -e js,vue,styl",
|
|
18
|
-
"build:lib": "
|
|
23
|
+
"build:lib": "npm run clean && rollup -c config/rollup.config.js --environment NODE_ENV:production",
|
|
19
24
|
"build:browser": "rollup --config configs/rollup.config.browser.js",
|
|
20
25
|
"build:es": "rollup --config configs/rollup.config.es.js",
|
|
21
26
|
"build:umd": "rollup --config configs/rollup.config.umd.js"
|
|
@@ -24,50 +29,64 @@
|
|
|
24
29
|
"type": "git",
|
|
25
30
|
"url": ""
|
|
26
31
|
},
|
|
27
|
-
"bugs": {
|
|
28
|
-
"url": ""
|
|
29
|
-
},
|
|
30
32
|
"homepage": "",
|
|
31
33
|
"publishConfig": {
|
|
32
34
|
"access": "public",
|
|
33
35
|
"registry": "https://registry.npmjs.org"
|
|
34
36
|
},
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"@authing/native-js-ui-components": "^3.0.
|
|
38
|
+
"@authing/native-js-ui-components": "^3.0.24"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
|
-
"@babel/core": "^7.
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
41
|
+
"@babel/core": "^7.0.0",
|
|
42
|
+
"@rollup/plugin-alias": "^3.1.8",
|
|
43
|
+
"@rollup/plugin-babel": "^5.3.1",
|
|
44
|
+
"@rollup/plugin-commonjs": "^21.0.1",
|
|
45
|
+
"@rollup/plugin-image": "^2.1.1",
|
|
46
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
47
|
+
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
48
|
+
"@types/html-minifier": "^4.0.1",
|
|
49
|
+
"@types/jest": "^26.0.23",
|
|
50
|
+
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
51
|
+
"@typescript-eslint/parser": "^4.33.0",
|
|
52
|
+
"@vue/babel-preset-jsx": "^1.2.4",
|
|
53
|
+
"@vue/compiler-sfc": "^3.2.20",
|
|
54
|
+
"@vue/test-utils": "^2.0.0-rc.6",
|
|
55
|
+
"autoprefixer": "^9.8.8",
|
|
56
|
+
"babel-jest": "^26.x",
|
|
57
|
+
"clean-css": "^5.2.4",
|
|
58
|
+
"esbuild": "^0.12.5",
|
|
59
|
+
"eslint": "^7.32.0",
|
|
60
|
+
"eslint-plugin-vue": "^7.20.0",
|
|
61
|
+
"jest": "26.6.3",
|
|
62
|
+
"jest-serializer-vue": "^2.0.2",
|
|
63
|
+
"jest-transform-stub": "^2.0.0",
|
|
64
|
+
"node-sass": "^6.0.1",
|
|
65
|
+
"postcss": "^8.3.11",
|
|
66
|
+
"postcss-import": "^14.0.2",
|
|
67
|
+
"postcss-minify": "^1.1.0",
|
|
68
|
+
"postcss-preset-env": "^6.7.0",
|
|
69
|
+
"pre-commit": "^1.2.2",
|
|
70
|
+
"rimraf": "^3.0.2",
|
|
71
|
+
"rollup": "^2.59.0",
|
|
72
|
+
"rollup-plugin-babel": "^4.4.0",
|
|
73
|
+
"rollup-plugin-browsersync": "^1.3.3",
|
|
74
|
+
"rollup-plugin-commonjs": "^10.1.0",
|
|
75
|
+
"rollup-plugin-copy": "^3.4.0",
|
|
76
|
+
"rollup-plugin-css-only": "^3.1.0",
|
|
77
|
+
"rollup-plugin-esbuild": "^4.6.0",
|
|
78
|
+
"rollup-plugin-filesize": "^9.1.1",
|
|
79
|
+
"rollup-plugin-html2": "^3.1.0",
|
|
80
|
+
"rollup-plugin-polyfill-node": "^0.7.0",
|
|
81
|
+
"rollup-plugin-postcss": "^4.0.1",
|
|
82
|
+
"rollup-plugin-progress": "^1.1.2",
|
|
83
|
+
"rollup-plugin-replace": "^2.2.0",
|
|
84
|
+
"rollup-plugin-scss": "3",
|
|
85
|
+
"rollup-plugin-vue": "^6.0.0",
|
|
86
|
+
"ts-jest": "26.5.6",
|
|
87
|
+
"typescript": "^4.4.4",
|
|
88
|
+
"vue": "^3.2.20",
|
|
89
|
+
"vue-jest": "^5.0.0-alpha.10"
|
|
71
90
|
},
|
|
72
91
|
"peerDependencies": {
|
|
73
92
|
"vue": "^2.5.13"
|
|
@@ -79,5 +98,5 @@
|
|
|
79
98
|
"> 10%",
|
|
80
99
|
"last 2 versions"
|
|
81
100
|
],
|
|
82
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "a2a2d111572c2a9db1e6b8fc6d6c4212ad095d7e"
|
|
83
102
|
}
|
package/.eslintignore
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import babel from "rollup-plugin-babel";
|
|
2
|
-
import resolve from "rollup-plugin-node-resolve";
|
|
3
|
-
import vue from "rollup-plugin-vue";
|
|
4
|
-
import cjs from "rollup-plugin-commonjs";
|
|
5
|
-
import replace from "rollup-plugin-replace";
|
|
6
|
-
import requireContext from "rollup-plugin-require-context";
|
|
7
|
-
import { string } from "rollup-plugin-string";
|
|
8
|
-
import fs from "fs";
|
|
9
|
-
import CleanCSS from "clean-css";
|
|
10
|
-
import autoprefixer from "autoprefixer";
|
|
11
|
-
import css from "rollup-plugin-css-only";
|
|
12
|
-
const postcss = require("rollup-plugin-postcss");
|
|
13
|
-
|
|
14
|
-
const config = require("../package.json");
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
input: "src/components/index.js",
|
|
18
|
-
plugins: [
|
|
19
|
-
resolve({
|
|
20
|
-
jsnext: true,
|
|
21
|
-
main: true,
|
|
22
|
-
browser: true,
|
|
23
|
-
}),
|
|
24
|
-
string({
|
|
25
|
-
include: "**/*.svg",
|
|
26
|
-
}),
|
|
27
|
-
vue({
|
|
28
|
-
css: false,
|
|
29
|
-
style: {
|
|
30
|
-
postcssPlugins: [autoprefixer],
|
|
31
|
-
},
|
|
32
|
-
}),
|
|
33
|
-
postcss({
|
|
34
|
-
extract: true,
|
|
35
|
-
}),
|
|
36
|
-
css({
|
|
37
|
-
output: (styles) => {
|
|
38
|
-
fs.writeFileSync("lib/index.min.css", new CleanCSS().minify(styles).styles);
|
|
39
|
-
},
|
|
40
|
-
}),
|
|
41
|
-
babel({
|
|
42
|
-
exclude: "node_modules/**",
|
|
43
|
-
runtimeHelpers: true,
|
|
44
|
-
}),
|
|
45
|
-
cjs({
|
|
46
|
-
namedExports: {
|
|
47
|
-
"@authing/native-js-ui-components": [
|
|
48
|
-
"AuthingGuard",
|
|
49
|
-
"Guard",
|
|
50
|
-
"GuardEventsCamelToKebabMap",
|
|
51
|
-
"GuardMode",
|
|
52
|
-
"GuardScenes",
|
|
53
|
-
"LoginMethods",
|
|
54
|
-
"RegisterMethods",
|
|
55
|
-
],
|
|
56
|
-
"../native-js/lib/index.min.js": [
|
|
57
|
-
"AuthingGuard",
|
|
58
|
-
"Guard",
|
|
59
|
-
"GuardEventsCamelToKebabMap",
|
|
60
|
-
"GuardMode",
|
|
61
|
-
"GuardScenes",
|
|
62
|
-
"LoginMethods",
|
|
63
|
-
"RegisterMethods",
|
|
64
|
-
"getAuthClient",
|
|
65
|
-
"initAuthClient",
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
requireContext(),
|
|
70
|
-
// replace({
|
|
71
|
-
// VERSION: JSON.stringify(config.version),
|
|
72
|
-
// }),
|
|
73
|
-
],
|
|
74
|
-
watch: {
|
|
75
|
-
include: "src/**",
|
|
76
|
-
},
|
|
77
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import base from './rollup.config.base'
|
|
2
|
-
import { terser } from 'rollup-plugin-terser'
|
|
3
|
-
|
|
4
|
-
const config = Object.assign({}, base, {
|
|
5
|
-
output: {
|
|
6
|
-
exports: 'named',
|
|
7
|
-
name: 'VueUi',
|
|
8
|
-
file: 'dist/vue-ui.min.js',
|
|
9
|
-
format: 'iife',
|
|
10
|
-
},
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
config.plugins.push(terser())
|
|
14
|
-
|
|
15
|
-
export default config
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import base from './rollup.config.base'
|
|
2
|
-
|
|
3
|
-
const config = Object.assign({}, base, {
|
|
4
|
-
output: {
|
|
5
|
-
name: 'vue-ui',
|
|
6
|
-
file: 'dist/vue-ui.esm.js',
|
|
7
|
-
format: 'es',
|
|
8
|
-
},
|
|
9
|
-
external: [
|
|
10
|
-
'focus-visible',
|
|
11
|
-
'v-tooltip',
|
|
12
|
-
'vue-resize',
|
|
13
|
-
],
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
export default config
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import base from './rollup.config.base'
|
|
2
|
-
import { terser } from 'rollup-plugin-terser'
|
|
3
|
-
|
|
4
|
-
const config = Object.assign({}, base, {
|
|
5
|
-
output: {
|
|
6
|
-
exports: 'named',
|
|
7
|
-
name: 'AuthingVueUIComponents',
|
|
8
|
-
file: 'lib/index.min.js',
|
|
9
|
-
format: 'umd',
|
|
10
|
-
},
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
config.plugins.push(terser())
|
|
14
|
-
|
|
15
|
-
export default config
|
|
File without changes
|
package/src/components/index.js
DELETED
package/src/icons.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const icons = require.context('../node_modules/material-design-icons/sprites/svg-sprite', true, /svg-sprite-(\w+)-symbol\.svg$/)
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
install (Vue) {
|
|
5
|
-
const iconsWrapper = document.createElement('div')
|
|
6
|
-
iconsWrapper.style.display = 'none'
|
|
7
|
-
// Load all the SVG symbols
|
|
8
|
-
icons.keys().forEach(key => {
|
|
9
|
-
const result = icons(key)
|
|
10
|
-
iconsWrapper.innerHTML += result
|
|
11
|
-
})
|
|
12
|
-
document.body.insertBefore(iconsWrapper, document.body.firstChild)
|
|
13
|
-
},
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function generateHtmlIcon (icon) {
|
|
17
|
-
return `<div class="vue-ui-icon"><svg><use xlink:href="#ic_${icon}_24px"></use></svg></div>`
|
|
18
|
-
}
|
package/src/index.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import VueIcons from './icons'
|
|
2
|
-
import VTooltip from 'v-tooltip'
|
|
3
|
-
import VueResize from 'vue-resize'
|
|
4
|
-
import 'focus-visible'
|
|
5
|
-
|
|
6
|
-
import 'vue-resize/dist/vue-resize.css'
|
|
7
|
-
import 'v-tooltip/dist/v-tooltip.css'
|
|
8
|
-
|
|
9
|
-
// Exported mixins
|
|
10
|
-
export { default as CoupledChild } from './mixins/CoupledChild'
|
|
11
|
-
export { default as CoupledParent } from './mixins/CoupledParent'
|
|
12
|
-
export { default as DisabledChild } from './mixins/DisabledChild'
|
|
13
|
-
export { default as DisableScroll } from './mixins/DisableScroll'
|
|
14
|
-
|
|
15
|
-
// Exported utils
|
|
16
|
-
export { generateHtmlIcon } from './icons'
|
|
17
|
-
|
|
18
|
-
// Require all the components that start with 'BaseXXX.vue'
|
|
19
|
-
const components = require.context('./components', true, /[a-z0-9]+\.vue$/)
|
|
20
|
-
|
|
21
|
-
export function install (Vue, options = {}) {
|
|
22
|
-
Vue.use(VueIcons)
|
|
23
|
-
|
|
24
|
-
Vue.use(VTooltip, mergeOptions({
|
|
25
|
-
boundariesElement: document.body,
|
|
26
|
-
themes: {
|
|
27
|
-
tooltip: {
|
|
28
|
-
delay: {
|
|
29
|
-
show: 1000,
|
|
30
|
-
hide: 800,
|
|
31
|
-
},
|
|
32
|
-
instantMove: true,
|
|
33
|
-
},
|
|
34
|
-
dropdown: {
|
|
35
|
-
handleResize: false,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
}, options.vtooltip))
|
|
39
|
-
|
|
40
|
-
Vue.use(VueResize)
|
|
41
|
-
|
|
42
|
-
// To extract the component name
|
|
43
|
-
const nameReg = /([a-z0-9]+)\./i
|
|
44
|
-
// Registration
|
|
45
|
-
components.keys().forEach(key => {
|
|
46
|
-
const name = key.match(nameReg)[1]
|
|
47
|
-
Vue.component(name, components(key))
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const plugin = {
|
|
52
|
-
// eslint-disable-next-line no-undef
|
|
53
|
-
version: VERSION,
|
|
54
|
-
install,
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export default plugin
|
|
58
|
-
|
|
59
|
-
function mergeOptions (to, from) {
|
|
60
|
-
for (const key in from) {
|
|
61
|
-
if (to[key] && from[key] && typeof to[key] === 'object' && typeof from[key] === 'object') {
|
|
62
|
-
mergeOptions(to[key], from[key])
|
|
63
|
-
} else {
|
|
64
|
-
to[key] = from[key]
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return to
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Auto-install
|
|
71
|
-
let GlobalVue = null
|
|
72
|
-
if (typeof window !== 'undefined') {
|
|
73
|
-
GlobalVue = window.Vue
|
|
74
|
-
} else if (typeof global !== 'undefined') {
|
|
75
|
-
GlobalVue = global.Vue
|
|
76
|
-
}
|
|
77
|
-
if (GlobalVue) {
|
|
78
|
-
GlobalVue.use(plugin)
|
|
79
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* (Use with the CoupleParent mixin)
|
|
3
|
-
* This mixin should be used on children components of a component implementing the CoupledParent mixin.
|
|
4
|
-
* @param {string} name Name of the injection
|
|
5
|
-
*/
|
|
6
|
-
export default function (name) {
|
|
7
|
-
// @vue/component
|
|
8
|
-
return {
|
|
9
|
-
inject: [
|
|
10
|
-
name,
|
|
11
|
-
],
|
|
12
|
-
|
|
13
|
-
computed: {
|
|
14
|
-
active () {
|
|
15
|
-
return this[name].activeChild === this.$_couplingProxy
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
created () {
|
|
20
|
-
const proxy = this.$_couplingProxy = {}
|
|
21
|
-
for (const key in this.$data) {
|
|
22
|
-
if (key.charAt(0) === '$' || key.charAt(0) === '_') continue
|
|
23
|
-
Object.defineProperty(proxy, key, {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
configurable: false,
|
|
26
|
-
get: () => this.$data[key],
|
|
27
|
-
})
|
|
28
|
-
}
|
|
29
|
-
for (const key in this.$props) {
|
|
30
|
-
if (key.charAt(0) === '$' || key.charAt(0) === '_') continue
|
|
31
|
-
Object.defineProperty(proxy, key, {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
configurable: false,
|
|
34
|
-
get: () => this.$props[key],
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
Object.defineProperty(proxy, '$slots', {
|
|
38
|
-
enumerable: false,
|
|
39
|
-
configurable: false,
|
|
40
|
-
get: () => this.$slots,
|
|
41
|
-
})
|
|
42
|
-
this[name].$_addCoupledChild(proxy)
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
beforeDestroy () {
|
|
46
|
-
this[name].$_removeCoupledChild(this.$_couplingProxy)
|
|
47
|
-
},
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* (Use with the CoupledChild mixin)
|
|
3
|
-
* Mixin allowing the automatic collection of children while preserving the virtual dom children order at all times.
|
|
4
|
-
* Useful for creating tabs-style component, when we need to replicate the order of the children to display
|
|
5
|
-
* a group of button (tab strip).
|
|
6
|
-
* @param {string} name Name of the injection
|
|
7
|
-
*/
|
|
8
|
-
export default function (name) {
|
|
9
|
-
// @vue/component
|
|
10
|
-
return {
|
|
11
|
-
provide () {
|
|
12
|
-
const proxy = {}
|
|
13
|
-
Object.defineProperty(proxy, 'activeChild', {
|
|
14
|
-
get: () => this.activeChild,
|
|
15
|
-
})
|
|
16
|
-
proxy.$_addCoupledChild = this.$_addCoupledChild.bind(this)
|
|
17
|
-
proxy.$_removeCoupledChild = this.$_removeCoupledChild.bind(this)
|
|
18
|
-
return {
|
|
19
|
-
[name]: proxy,
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
props: {
|
|
24
|
-
childIndex: {
|
|
25
|
-
default: 0,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
data () {
|
|
30
|
-
return {
|
|
31
|
-
children: [],
|
|
32
|
-
activeChildIndex: parseInt(this.childIndex) || 0,
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
computed: {
|
|
37
|
-
activeChild () {
|
|
38
|
-
if (this.activeChildIndex < this.children.length) {
|
|
39
|
-
return this.children[this.activeChildIndex]
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
watch: {
|
|
45
|
-
childIndex (val) {
|
|
46
|
-
this.activateChild(parseInt(val) || 0, true)
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
methods: {
|
|
51
|
-
/**
|
|
52
|
-
* Activates a child.
|
|
53
|
-
* @param {number} index Index of child to activate
|
|
54
|
-
* @param {boolean} external Indicates if the activation comes from an external source (like props)
|
|
55
|
-
*/
|
|
56
|
-
activateChild (index, external = false) {
|
|
57
|
-
const oldIndex = this.activeChildIndex
|
|
58
|
-
if (index < 0) {
|
|
59
|
-
index = 0
|
|
60
|
-
} else if (index >= this.children.length) {
|
|
61
|
-
index = this.children.length - 1
|
|
62
|
-
}
|
|
63
|
-
this.activeChildIndex = index
|
|
64
|
-
this.$emit('update:childIndex', index)
|
|
65
|
-
this.childActivated(index, oldIndex, external)
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Hook called when a child is activated.
|
|
70
|
-
* @param {number} index Index of the activated child
|
|
71
|
-
* @param {number} oldIndex Index of the previously activated child
|
|
72
|
-
* @param {boolean} external Indicates if the activation comes from an external source (like props)
|
|
73
|
-
*/
|
|
74
|
-
childActivated (index, oldIndex, external) {
|
|
75
|
-
// Override this in component
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Add a child component while preserving its order in the children list.
|
|
80
|
-
* @param {object} proxyVm Vue instance
|
|
81
|
-
*/
|
|
82
|
-
$_addCoupledChild (proxyVm) {
|
|
83
|
-
// Guard
|
|
84
|
-
if (this.$slots && this.$slots.default) {
|
|
85
|
-
// We need to wait for the instances creation
|
|
86
|
-
this.$nextTick(() => {
|
|
87
|
-
// We need to get the components in the slot
|
|
88
|
-
const childComponents = this.$slots.default.reduce((list, vnode) => {
|
|
89
|
-
const coupledChild = findCoupledChild(vnode)
|
|
90
|
-
if (coupledChild) {
|
|
91
|
-
list.push(coupledChild.$_couplingProxy)
|
|
92
|
-
}
|
|
93
|
-
return list
|
|
94
|
-
}, [])
|
|
95
|
-
// List has the child component in the right order
|
|
96
|
-
// We can now register the child component in the right place
|
|
97
|
-
const index = childComponents.indexOf(proxyVm)
|
|
98
|
-
// Add child
|
|
99
|
-
if (index !== -1) {
|
|
100
|
-
this.children.splice(index, 0, proxyVm)
|
|
101
|
-
// Hook
|
|
102
|
-
this.$_updateChildren('add', index, proxyVm)
|
|
103
|
-
}
|
|
104
|
-
})
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Removes a child component. Automatically activates the next remaining component.
|
|
110
|
-
* @param {object} proxyVm Vue instance
|
|
111
|
-
*/
|
|
112
|
-
$_removeCoupledChild (proxyVm) {
|
|
113
|
-
const index = this.children.indexOf(proxyVm)
|
|
114
|
-
// Remove child
|
|
115
|
-
if (index !== -1) {
|
|
116
|
-
this.children.splice(index, 1)
|
|
117
|
-
}
|
|
118
|
-
// Hook
|
|
119
|
-
this.$_updateChildren('remove', index, proxyVm)
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Hook called when an operation is processed. It will intelligently activate a child if needed.
|
|
124
|
-
* @param {string} operation Name of the operation. Can be 'add' or 'remove'
|
|
125
|
-
* @param {number} index Index of the related child.
|
|
126
|
-
* @param {object} proxyVm Related child Vue instance
|
|
127
|
-
*/
|
|
128
|
-
$_updateChildren (operation, index, proxyVm) {
|
|
129
|
-
if (operation === 'add') {
|
|
130
|
-
// If the child was added before the currently active one,
|
|
131
|
-
// we need to move the selection to the right
|
|
132
|
-
if (index <= this.activeChildIndex) {
|
|
133
|
-
this.activateChild(this.activeChildIndex + 1)
|
|
134
|
-
}
|
|
135
|
-
// Default when there is only one child
|
|
136
|
-
if (this.children.length === 1) {
|
|
137
|
-
this.activateChild(0)
|
|
138
|
-
}
|
|
139
|
-
} else if (operation === 'remove') {
|
|
140
|
-
// If we remove a child before the currently active one,
|
|
141
|
-
// we need to move the selection to the left
|
|
142
|
-
if (index <= this.activeChildIndex) {
|
|
143
|
-
this.activateChild(this.activeChildIndex - 1)
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function findCoupledChild (vnode) {
|
|
152
|
-
const vm = vnode.child
|
|
153
|
-
if (vm) {
|
|
154
|
-
if (vm.$_couplingProxy) {
|
|
155
|
-
return vm
|
|
156
|
-
} else {
|
|
157
|
-
return findCoupledChildInChildren([...vm.$children])
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// Breadth-first search
|
|
163
|
-
function findCoupledChildInChildren (queue) {
|
|
164
|
-
let child
|
|
165
|
-
while ((child = queue.shift())) {
|
|
166
|
-
if (child.$_couplingProxy) {
|
|
167
|
-
return child
|
|
168
|
-
} else {
|
|
169
|
-
queue.push(...child.$children)
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
let count = 0
|
|
2
|
-
|
|
3
|
-
function getScrollingElements () {
|
|
4
|
-
return document.querySelectorAll('.vue-ui-disable-scroll, body')
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function updateScroll () {
|
|
8
|
-
if (count === 0) {
|
|
9
|
-
getScrollingElements().forEach(el => el.classList.remove('vue-ui-no-scroll'))
|
|
10
|
-
} else if (count === 1) {
|
|
11
|
-
getScrollingElements().forEach(el => el.classList.add('vue-ui-no-scroll'))
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
mounted () {
|
|
17
|
-
count++
|
|
18
|
-
updateScroll()
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
beforeDestroy () {
|
|
22
|
-
count--
|
|
23
|
-
updateScroll()
|
|
24
|
-
},
|
|
25
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* (Use with the DisabledParent mixin)
|
|
3
|
-
* This mixin should be implemented on all components that can be disabled.
|
|
4
|
-
*/
|
|
5
|
-
// @vue/component
|
|
6
|
-
export default {
|
|
7
|
-
inject: {
|
|
8
|
-
VueDisableMixin: {
|
|
9
|
-
default: null,
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
props: {
|
|
14
|
-
disabled: {
|
|
15
|
-
type: Boolean,
|
|
16
|
-
default: false,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
computed: {
|
|
21
|
-
finalDisabled () {
|
|
22
|
-
return this.disabled || (this.VueDisableMixin && this.VueDisableMixin.data.value)
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
}
|