@authing/vue-ui-components 3.1.31 → 4.0.0
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/LICENSE +21 -0
- package/components/Guard/src/index.vue +4 -25
- package/components/index.js +3 -3
- package/lib/index.min.css +1 -1
- package/lib/index.min.js +6 -167
- package/package.json +4 -3
- package/components/AuthingGuard/index.js +0 -8
- package/components/AuthingGuard/src/index.vue +0 -150
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"lib",
|
|
6
6
|
"components"
|
|
7
7
|
],
|
|
8
|
-
"version": "
|
|
8
|
+
"version": "4.0.0",
|
|
9
9
|
"keywords": [
|
|
10
10
|
"vue",
|
|
11
11
|
"vuejs",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"registry": "https://registry.npmjs.org"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@authing/native-js-ui-components": "
|
|
38
|
+
"@authing/native-js-ui-components": "4.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@babel/core": "^7.0.0",
|
|
@@ -97,5 +97,6 @@
|
|
|
97
97
|
"browserslist": [
|
|
98
98
|
"> 10%",
|
|
99
99
|
"last 2 versions"
|
|
100
|
-
]
|
|
100
|
+
],
|
|
101
|
+
"gitHead": "44b6d3f22978d3e56895a8aeb580d2f5dcac89d8"
|
|
101
102
|
}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div id="authing_guard_container" />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
import { AuthingGuard as NativeAuthingGuard, GuardEventsCamelToKebabMap } from "@authing/native-js-ui-components";
|
|
7
|
-
|
|
8
|
-
import "@authing/native-js-ui-components/lib/index.min.css";
|
|
9
|
-
|
|
10
|
-
const callbackEvent = ["before-login", "before-register"];
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
name: "AuthingGuard",
|
|
14
|
-
props: {
|
|
15
|
-
appId: {
|
|
16
|
-
type: String,
|
|
17
|
-
required: true,
|
|
18
|
-
},
|
|
19
|
-
tenantId: {
|
|
20
|
-
type: String,
|
|
21
|
-
required: false,
|
|
22
|
-
},
|
|
23
|
-
config: {
|
|
24
|
-
type: Object,
|
|
25
|
-
required: false,
|
|
26
|
-
},
|
|
27
|
-
visible: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: false,
|
|
30
|
-
},
|
|
31
|
-
mode: {
|
|
32
|
-
type: String,
|
|
33
|
-
required: false, // normal(全屏) modal(弹窗)
|
|
34
|
-
},
|
|
35
|
-
autoRegister: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
required: false,
|
|
38
|
-
},
|
|
39
|
-
isSSO: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
required: false,
|
|
42
|
-
},
|
|
43
|
-
clickCloseable: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: true,
|
|
46
|
-
required: false,
|
|
47
|
-
},
|
|
48
|
-
escCloseable: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
default: true,
|
|
51
|
-
required: false,
|
|
52
|
-
},
|
|
53
|
-
onBeforeLogin: {
|
|
54
|
-
type: Function,
|
|
55
|
-
required: false,
|
|
56
|
-
},
|
|
57
|
-
onBeforeRegister: {
|
|
58
|
-
type: Function,
|
|
59
|
-
required: false,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
data() {
|
|
63
|
-
return {
|
|
64
|
-
localVisible: false,
|
|
65
|
-
guardInstance: null,
|
|
66
|
-
guarConfig: {},
|
|
67
|
-
};
|
|
68
|
-
},
|
|
69
|
-
watch: {
|
|
70
|
-
visible: {
|
|
71
|
-
immediate: true,
|
|
72
|
-
handler(val) {
|
|
73
|
-
if (val !== this.localVisible) {
|
|
74
|
-
this.localVisible = val;
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
localVisible: {
|
|
79
|
-
handler(val) {
|
|
80
|
-
if (val !== this.visible) {
|
|
81
|
-
this.$emit("visible", val);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (val) {
|
|
85
|
-
this.show();
|
|
86
|
-
} else {
|
|
87
|
-
this.hide();
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
computed: {
|
|
93
|
-
mergeConfig: function () {
|
|
94
|
-
return {
|
|
95
|
-
...this.config,
|
|
96
|
-
appId: this.appId,
|
|
97
|
-
mode: this.mode ?? this.config?.mode,
|
|
98
|
-
autoRegister: this.autoRegister ?? this.config?.autoRegister,
|
|
99
|
-
isSSO: this.isSSO ?? this.config?.isSSO,
|
|
100
|
-
clickCloseable: this.clickCloseable ?? this.config?.clickCloseable,
|
|
101
|
-
escCloseable: this.escCloseable ?? this.config?.escCloseable,
|
|
102
|
-
};
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
mounted() {
|
|
106
|
-
this.guardInstance = new NativeAuthingGuard(this.appId, this.mergeConfig, this.tenantId);
|
|
107
|
-
|
|
108
|
-
const evts = Object.values(GuardEventsCamelToKebabMap);
|
|
109
|
-
const kebabToCamelMap = Object.entries(GuardEventsCamelToKebabMap).reduce((acc, [camel, kebab]) => {
|
|
110
|
-
return Object.assign({}, acc, {
|
|
111
|
-
[kebab]: camel,
|
|
112
|
-
});
|
|
113
|
-
}, {});
|
|
114
|
-
|
|
115
|
-
const listeners = evts.reduce((acc, evtName) => {
|
|
116
|
-
return Object.assign({}, acc, {
|
|
117
|
-
[evtName]: (...rest) => {
|
|
118
|
-
if (evtName === "close") {
|
|
119
|
-
this.localVisible = false;
|
|
120
|
-
}
|
|
121
|
-
if (!callbackEvent.includes(evtName)) {
|
|
122
|
-
this.$emit(evtName, ...rest);
|
|
123
|
-
} else {
|
|
124
|
-
const camelEvtName = kebabToCamelMap[evtName];
|
|
125
|
-
|
|
126
|
-
if (this[camelEvtName]) {
|
|
127
|
-
return this[camelEvtName](...rest);
|
|
128
|
-
}
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
}, {});
|
|
134
|
-
|
|
135
|
-
evts.forEach((evtName) => this.guardInstance.on(evtName, listeners[evtName]));
|
|
136
|
-
|
|
137
|
-
if (this.localVisible) {
|
|
138
|
-
this.guardInstance.show();
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
methods: {
|
|
142
|
-
show() {
|
|
143
|
-
this.guardInstance.show();
|
|
144
|
-
},
|
|
145
|
-
hide() {
|
|
146
|
-
this.guardInstance.hide();
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
</script>
|