renusify 1.4.1 → 1.4.3
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/chart/worldMap.vue +1110 -0
- package/components/codeEditor/highlightCss.vue +10 -112
- package/components/codeEditor/highlightHtml.vue +17 -162
- package/components/codeEditor/highlightJs.vue +14 -243
- package/components/codeEditor/index.vue +25 -3
- package/components/codeEditor/mixin.js +172 -0
- package/components/cropper/index.vue +2 -1
- package/components/form/json/index.vue +113 -65
- package/components/img/index.vue +5 -4
- package/components/index.js +1 -0
- package/components/modal/index.vue +57 -11
- package/components/modal/style.scss +13 -11
- package/components/searchBox/index.vue +1 -1
- package/components/slider/index.vue +39 -15
- package/components/table/index.vue +13 -13
- package/directive/drag/index.js +5 -5
- package/directive/sortable/index.js +3 -3
- package/directive/title/index.js +2 -3
- package/directive/touch/index.js +2 -4
- package/package.json +1 -1
- package/tools/helper.js +1 -42
|
@@ -9,6 +9,14 @@
|
|
|
9
9
|
>
|
|
10
10
|
<r-icon v-html="$r.icons.copy"></r-icon>
|
|
11
11
|
</r-btn>
|
|
12
|
+
<r-btn
|
|
13
|
+
class="image-copy"
|
|
14
|
+
icon
|
|
15
|
+
text
|
|
16
|
+
@click.prevent="pretty"
|
|
17
|
+
>
|
|
18
|
+
P
|
|
19
|
+
</r-btn>
|
|
12
20
|
<r-btn v-if="show === 'code' && runnable" text @click="show = 'run'">
|
|
13
21
|
run
|
|
14
22
|
<r-icon v-html="$r.icons.play" exact></r-icon>
|
|
@@ -31,7 +39,7 @@
|
|
|
31
39
|
<div v-show="show !== 'run'" ref="codeView" class="code-wrapper">
|
|
32
40
|
<div v-show="templateShow">
|
|
33
41
|
<span class="color-green"><template></span>
|
|
34
|
-
<highlight-html v-model="temp"></highlight-html>
|
|
42
|
+
<highlight-html ref="h-html" v-model="temp"></highlight-html>
|
|
35
43
|
<span class="color-green"></template></span>
|
|
36
44
|
<br/>
|
|
37
45
|
</div>
|
|
@@ -39,14 +47,14 @@
|
|
|
39
47
|
<span class="color-orange"
|
|
40
48
|
><script><br/>export default {</span
|
|
41
49
|
>
|
|
42
|
-
<highlight-script v-model="scr"></highlight-script>
|
|
50
|
+
<highlight-script ref="h-js" v-model="scr"></highlight-script>
|
|
43
51
|
<span class="color-orange">}<br/><script></span>
|
|
44
52
|
</div>
|
|
45
53
|
<div v-show="styleShow">
|
|
46
54
|
<span class="color-orange"
|
|
47
55
|
><style lang<span class="color-green">="css"</span>></span
|
|
48
56
|
>
|
|
49
|
-
<highlight-css v-model="sty"></highlight-css>
|
|
57
|
+
<highlight-css ref="h-css" v-model="sty"></highlight-css>
|
|
50
58
|
<span class="color-orange"><style></span>
|
|
51
59
|
</div>
|
|
52
60
|
</div>
|
|
@@ -97,6 +105,15 @@ export default {
|
|
|
97
105
|
this.get_code("codeSlot");
|
|
98
106
|
},
|
|
99
107
|
watch: {
|
|
108
|
+
template: function (n) {
|
|
109
|
+
this.temp = n
|
|
110
|
+
},
|
|
111
|
+
script: function (n) {
|
|
112
|
+
this.scr = n
|
|
113
|
+
},
|
|
114
|
+
style: function (n) {
|
|
115
|
+
this.sty = n
|
|
116
|
+
},
|
|
100
117
|
temp: function () {
|
|
101
118
|
this.$emit("update:template", this.temp);
|
|
102
119
|
},
|
|
@@ -108,6 +125,11 @@ export default {
|
|
|
108
125
|
},
|
|
109
126
|
},
|
|
110
127
|
methods: {
|
|
128
|
+
pretty() {
|
|
129
|
+
this.temp = this.$refs["h-html"].pretty_html(this.temp)
|
|
130
|
+
this.scr = this.$refs["h-js"].pretty_js(this.scr)
|
|
131
|
+
this.sty = this.$refs["h-css"].pretty_js(this.sty)
|
|
132
|
+
},
|
|
111
133
|
toHTML(htmlString) {
|
|
112
134
|
let div = document.createElement("div");
|
|
113
135
|
div.innerHTML = htmlString;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
methods: {
|
|
3
|
+
pretty_html(text) {
|
|
4
|
+
text = text.replace(/ +(?= )/g, '');
|
|
5
|
+
text = text.replace(/[\r|\n|\t]/g, '');
|
|
6
|
+
let r = ''
|
|
7
|
+
text = text.split('<')
|
|
8
|
+
let numopen = 0
|
|
9
|
+
text.forEach((line) => {
|
|
10
|
+
if (line) {
|
|
11
|
+
const end = line.startsWith('/')
|
|
12
|
+
if (end) {
|
|
13
|
+
numopen -= 1
|
|
14
|
+
}
|
|
15
|
+
r += '\t'.repeat(numopen) + '<' + line + '\n'
|
|
16
|
+
if (!end) {
|
|
17
|
+
numopen += 1
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
return r
|
|
22
|
+
},
|
|
23
|
+
pretty_js(text) {
|
|
24
|
+
text = text.replace(/ +(?= )/g, '');
|
|
25
|
+
text = text.replace(/[\r|\n|\t]/g, '');
|
|
26
|
+
text = text.replace(/([,|;|{|(|\[])+[\s]/g, '$1');
|
|
27
|
+
let r = ''
|
|
28
|
+
text = text.split('')
|
|
29
|
+
let numopen = 0
|
|
30
|
+
const textLength = text.length
|
|
31
|
+
let inBracket = 0
|
|
32
|
+
let inprantez = 0
|
|
33
|
+
for (let i = 0; i < textLength; i++) {
|
|
34
|
+
const c = text[i]
|
|
35
|
+
const last = i > 0 ? text[i - 1] : ''
|
|
36
|
+
const next = i < textLength - 1 ? text[i + 1] : ''
|
|
37
|
+
|
|
38
|
+
if (c === '(') {
|
|
39
|
+
inprantez += 1
|
|
40
|
+
}
|
|
41
|
+
if (c === ')') {
|
|
42
|
+
inprantez -= 1
|
|
43
|
+
}
|
|
44
|
+
if (c === '[') {
|
|
45
|
+
inBracket += 1
|
|
46
|
+
}
|
|
47
|
+
if (c === ']') {
|
|
48
|
+
inBracket -= 1
|
|
49
|
+
}
|
|
50
|
+
if (c === '}') {
|
|
51
|
+
numopen -= 1
|
|
52
|
+
}
|
|
53
|
+
r += c
|
|
54
|
+
if (c === '}' && next !== ',' && next !== ';' && next !== '}' && next !== ')') {
|
|
55
|
+
r += '\n' + '\t'.repeat(numopen)
|
|
56
|
+
}
|
|
57
|
+
if (c === ',' && (!inprantez && !inBracket) && next !== '}') {
|
|
58
|
+
r += '\n' + '\t'.repeat(numopen)
|
|
59
|
+
}
|
|
60
|
+
if (c === ';' && next !== '}') {
|
|
61
|
+
r += '\n' + '\t'.repeat(numopen)
|
|
62
|
+
}
|
|
63
|
+
if (next === '}' && c !== '{') {
|
|
64
|
+
r += '\n' + '\t'.repeat(numopen - 1)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (c === '{') {
|
|
68
|
+
numopen += 1
|
|
69
|
+
if (next !== '}') {
|
|
70
|
+
r += '\n' + '\t'.repeat(numopen)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
r = r.replace(/\t /g, '\t');
|
|
75
|
+
r = r.replace(/^\s*\n/gm, '');
|
|
76
|
+
return r
|
|
77
|
+
},
|
|
78
|
+
setTab(event) {
|
|
79
|
+
if (event.key === "'" || event.key === '"' || event.key === '`') {
|
|
80
|
+
const end = event.target.selectionEnd;
|
|
81
|
+
event.preventDefault()
|
|
82
|
+
document.execCommand('insertText', false, event.key.repeat(2));
|
|
83
|
+
event.target.selectionEnd = end + 1;
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
if (event.key === "{") {
|
|
87
|
+
const end = event.target.selectionEnd;
|
|
88
|
+
event.preventDefault()
|
|
89
|
+
document.execCommand('insertText', false, '{}');
|
|
90
|
+
event.target.selectionEnd = end + 1;
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
if (event.key === "(") {
|
|
94
|
+
const end = event.target.selectionEnd;
|
|
95
|
+
event.preventDefault()
|
|
96
|
+
document.execCommand('insertText', false, '()');
|
|
97
|
+
event.target.selectionEnd = end + 1;
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
if (event.key === "[") {
|
|
101
|
+
const end = event.target.selectionEnd;
|
|
102
|
+
event.preventDefault()
|
|
103
|
+
document.execCommand('insertText', false, '[]');
|
|
104
|
+
event.target.selectionEnd = end + 1;
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
if (event.keyCode === 9) {
|
|
108
|
+
event.preventDefault()
|
|
109
|
+
document.execCommand('insertText', false, '\t');
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
if (event.keyCode === 13) {
|
|
113
|
+
event.preventDefault()
|
|
114
|
+
let n = event.target.value.substr(0, event.target.selectionStart).split('\n')
|
|
115
|
+
n = n[n.length - 1].split('')
|
|
116
|
+
let w = ''
|
|
117
|
+
for (let i = 0; i < n.length; i++) {
|
|
118
|
+
if (n[i] === ' ') {
|
|
119
|
+
w += ' '
|
|
120
|
+
} else {
|
|
121
|
+
break
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
document.execCommand('insertText', false, '\n' + w);
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return true
|
|
129
|
+
},
|
|
130
|
+
re_quote(res) {
|
|
131
|
+
let regex = /"([^"]*)"/g;
|
|
132
|
+
res = res.replace(regex, '<span class="color-green code-editor-span">"$1"</span>');
|
|
133
|
+
regex = /'([^']*)'/g;
|
|
134
|
+
return res.replace(regex, "<span class=\"color-green code-editor-span\">'$1'</span>");
|
|
135
|
+
},
|
|
136
|
+
re_special(res, regex = /([{}\[\]])/g, color = "color-orange") {
|
|
137
|
+
return res.replace(regex, '<span class="' + color + ' code-editor-span">$1</span>')
|
|
138
|
+
},
|
|
139
|
+
re_number(res) {
|
|
140
|
+
return res.replace(/\b([0-9.]+)\b/g, '<span class="color-blue code-editor-span">$1</span>')
|
|
141
|
+
},
|
|
142
|
+
re_words(res, words) {
|
|
143
|
+
words.forEach((word) => {
|
|
144
|
+
res = res.replace(new RegExp("\\b(" + word + ")\\b", 'g'), '<span class="color-orange code-editor-span">$1</span>')
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
return res;
|
|
148
|
+
},
|
|
149
|
+
re_comment(res) {
|
|
150
|
+
//eslint-disable-next-line
|
|
151
|
+
let regex = /(\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*)$/gm;
|
|
152
|
+
return res.replace(regex, '<span class="color-comment code-editor-span">$1</span>')
|
|
153
|
+
},
|
|
154
|
+
re_func(res) {
|
|
155
|
+
//function like Date()
|
|
156
|
+
let regex = /([$a-zA-Z-0-9_\s]+)(?=\()/g;
|
|
157
|
+
res = res.replace(regex, '<span class="color-func2 code-editor-span">$1</span>')
|
|
158
|
+
|
|
159
|
+
// Object keys
|
|
160
|
+
regex = /([a-zA-Z-0-9_]+)(?=:)/g;
|
|
161
|
+
res = res.replace(regex, '<span class="color-purple code-editor-span">$1</span>')
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
//function like $r $d()
|
|
165
|
+
regex = /(\$([a-zA-z0-9]*)[.|(])/g;
|
|
166
|
+
res = res.replace(regex, '<span class="color-func code-editor-span">$1</span>')
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
return res;
|
|
170
|
+
},
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -61,6 +61,7 @@ export default {
|
|
|
61
61
|
getBlob: Boolean,
|
|
62
62
|
selectImg: {type: Boolean, default: true},
|
|
63
63
|
},
|
|
64
|
+
emits: ['cropped', 'original'],
|
|
64
65
|
data() {
|
|
65
66
|
return {
|
|
66
67
|
show: false,
|
|
@@ -172,7 +173,7 @@ export default {
|
|
|
172
173
|
that.crop(e.target.result);
|
|
173
174
|
};
|
|
174
175
|
|
|
175
|
-
this.$emit("
|
|
176
|
+
this.$emit("original", e.target.files[0]);
|
|
176
177
|
reader.readAsDataURL(e.target.files[0]);
|
|
177
178
|
},
|
|
178
179
|
getDataURL() {
|
|
@@ -52,23 +52,29 @@
|
|
|
52
52
|
<r-btn @click.prevent="add" class="ms-1 color-success" rounded>{{ $t('add', 'renusify') }}</r-btn>
|
|
53
53
|
</div>
|
|
54
54
|
</div>
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
<div v-else :class="{'state-error':error}" class="json-highlight ltr">
|
|
56
|
+
<textarea
|
|
57
|
+
v-model="lazyValue"
|
|
58
|
+
autocapitalize="off"
|
|
59
|
+
autocomplete="off"
|
|
60
|
+
autocorrect="off"
|
|
61
|
+
class="ltr w-full"
|
|
62
|
+
spellcheck="false"
|
|
63
|
+
:rows="modelValue?Object.keys(modelValue).length+5:5"
|
|
64
|
+
@keydown="setTab"
|
|
65
|
+
></textarea>
|
|
66
|
+
<div class="text-preview" v-html="build"></div>
|
|
67
|
+
</div>
|
|
64
68
|
</div>
|
|
65
69
|
</template>
|
|
66
70
|
<script>
|
|
67
71
|
import JsonView from "./JsonView";
|
|
72
|
+
import mixin from 'renusify/components/codeEditor/mixin'
|
|
68
73
|
|
|
69
74
|
export default {
|
|
70
75
|
name: 'r-json',
|
|
71
76
|
components: {JsonView},
|
|
77
|
+
mixins: [mixin],
|
|
72
78
|
props: {
|
|
73
79
|
label: String,
|
|
74
80
|
keyLabel: {type: String, default: 'key'},
|
|
@@ -93,14 +99,49 @@ export default {
|
|
|
93
99
|
emits: ['update:modelValue'],
|
|
94
100
|
data() {
|
|
95
101
|
return {
|
|
102
|
+
lazyValue: '',
|
|
96
103
|
modeForm: true,
|
|
97
104
|
error: false,
|
|
98
105
|
show: false,
|
|
99
|
-
info: {}
|
|
100
|
-
color: `rgb(${this.$helper.randomInt(0, 255)},${this.$helper.randomInt(0, 255)},${this.$helper.randomInt(0, 255)})`
|
|
106
|
+
info: {}
|
|
101
107
|
}
|
|
102
108
|
},
|
|
109
|
+
watch: {
|
|
110
|
+
modeForm: function () {
|
|
111
|
+
this.lazyValue = JSON.stringify(this.modelValue || {}, null, 4)
|
|
112
|
+
},
|
|
113
|
+
modelValue: function () {
|
|
114
|
+
try {
|
|
115
|
+
this.error = false
|
|
116
|
+
if (JSON.stringify(JSON.parse(this.lazyValue)) !== JSON.stringify(this.modelValue)) {
|
|
117
|
+
this.lazyValue = JSON.stringify(this.modelValue || {}, null, 4)
|
|
118
|
+
}
|
|
119
|
+
} catch (er) {
|
|
120
|
+
this.error = true
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
},
|
|
124
|
+
lazyValue: function () {
|
|
125
|
+
try {
|
|
126
|
+
this.error = false
|
|
127
|
+
this.$emit('update:modelValue', JSON.parse(this.lazyValue))
|
|
128
|
+
} catch (er) {
|
|
129
|
+
this.error = true
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
},
|
|
103
133
|
computed: {
|
|
134
|
+
build() {
|
|
135
|
+
if (!this.lazyValue) {
|
|
136
|
+
return "";
|
|
137
|
+
}
|
|
138
|
+
let res = this.lazyValue
|
|
139
|
+
res = this.re_quote(res);
|
|
140
|
+
res = this.re_words(res, [true, false, null]);
|
|
141
|
+
res = this.re_number(res);
|
|
142
|
+
res = this.re_special(res, /([{},:\[\]])/g, 'color-orange');
|
|
143
|
+
return res;
|
|
144
|
+
},
|
|
104
145
|
is_array() {
|
|
105
146
|
if (this.baseArray) {
|
|
106
147
|
return true
|
|
@@ -109,51 +150,6 @@ export default {
|
|
|
109
150
|
}
|
|
110
151
|
},
|
|
111
152
|
methods: {
|
|
112
|
-
setTab(event) {
|
|
113
|
-
if (event.key === '"') {
|
|
114
|
-
const end = event.target.selectionEnd;
|
|
115
|
-
event.preventDefault()
|
|
116
|
-
document.execCommand('insertText', false, event.key.repeat(2));
|
|
117
|
-
event.target.selectionEnd = end + 1;
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
if (event.key === "{") {
|
|
121
|
-
const end = event.target.selectionEnd;
|
|
122
|
-
event.preventDefault()
|
|
123
|
-
document.execCommand('insertText', false, '{}');
|
|
124
|
-
event.target.selectionEnd = end + 1;
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
if (event.key === "[") {
|
|
128
|
-
const end = event.target.selectionEnd;
|
|
129
|
-
event.preventDefault()
|
|
130
|
-
document.execCommand('insertText', false, '[]');
|
|
131
|
-
event.target.selectionEnd = end + 1;
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
if (event.keyCode === 9) {
|
|
135
|
-
event.preventDefault()
|
|
136
|
-
document.execCommand('insertText', false, ' '.repeat(4));
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
if (event.keyCode === 13) {
|
|
140
|
-
event.preventDefault()
|
|
141
|
-
let n = event.target.value.substr(0, event.target.selectionStart).split('\n')
|
|
142
|
-
n = n[n.length - 1].split('')
|
|
143
|
-
let w = ''
|
|
144
|
-
for (let i = 0; i < n.length; i++) {
|
|
145
|
-
if (n[i] === ' ') {
|
|
146
|
-
w += ' '
|
|
147
|
-
} else {
|
|
148
|
-
break
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
document.execCommand('insertText', false, '\n' + w);
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
return true
|
|
156
|
-
},
|
|
157
153
|
open() {
|
|
158
154
|
if (this.template) {
|
|
159
155
|
let d = this.modelValue
|
|
@@ -169,15 +165,7 @@ export default {
|
|
|
169
165
|
this.show = true
|
|
170
166
|
}
|
|
171
167
|
},
|
|
172
|
-
|
|
173
|
-
try {
|
|
174
|
-
this.error = false
|
|
175
|
-
e = JSON.parse(e.target.value)
|
|
176
|
-
this.$emit('update:modelValue', e)
|
|
177
|
-
} catch (er) {
|
|
178
|
-
this.error = true
|
|
179
|
-
}
|
|
180
|
-
},
|
|
168
|
+
|
|
181
169
|
emit(e) {
|
|
182
170
|
this.$emit('update:modelValue', e)
|
|
183
171
|
},
|
|
@@ -228,5 +216,65 @@ export default {
|
|
|
228
216
|
.state-error {
|
|
229
217
|
border: 1px solid var(--color-error);
|
|
230
218
|
}
|
|
219
|
+
|
|
220
|
+
.json-highlight {
|
|
221
|
+
position: relative;
|
|
222
|
+
margin: -12px 0;
|
|
223
|
+
|
|
224
|
+
.text-preview {
|
|
225
|
+
white-space: pre-wrap;
|
|
226
|
+
word-break: keep-all;
|
|
227
|
+
overflow-wrap: break-word;
|
|
228
|
+
min-height: 40px;
|
|
229
|
+
font-size: 14px;
|
|
230
|
+
letter-spacing: 2px;
|
|
231
|
+
line-height: 20px;
|
|
232
|
+
margin: 0;
|
|
233
|
+
border: 0;
|
|
234
|
+
padding: 12px;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
textarea {
|
|
238
|
+
&::selection {
|
|
239
|
+
background-color: var(--color-two);
|
|
240
|
+
-webkit-text-fill-color: var(--color-two-text);
|
|
241
|
+
color: var(--color-two-text);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
padding: 12px;
|
|
245
|
+
margin: 0;
|
|
246
|
+
border: 0;
|
|
247
|
+
font-size: 14px;
|
|
248
|
+
letter-spacing: 2px;
|
|
249
|
+
line-height: 20px;
|
|
250
|
+
-webkit-font-smoothing: antialiased;
|
|
251
|
+
-webkit-text-fill-color: transparent;
|
|
252
|
+
outline: none;
|
|
253
|
+
width: 100%;
|
|
254
|
+
height: 100%;
|
|
255
|
+
min-height: 40px;
|
|
256
|
+
white-space: pre-wrap;
|
|
257
|
+
word-break: keep-all;
|
|
258
|
+
overflow-wrap: break-word;
|
|
259
|
+
position: absolute;
|
|
260
|
+
top: 0;
|
|
261
|
+
left: 0;
|
|
262
|
+
resize: none;
|
|
263
|
+
overflow: hidden;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.color-orange {
|
|
267
|
+
color: orange;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.color-green {
|
|
271
|
+
color: #0cde27;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
.color-blue {
|
|
276
|
+
color: #7ad5ff;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
231
279
|
}
|
|
232
280
|
</style>
|
package/components/img/index.vue
CHANGED
|
@@ -135,12 +135,13 @@ export default {
|
|
|
135
135
|
}
|
|
136
136
|
if (wPH) {
|
|
137
137
|
if (res['width'] !== 0 && res['height'] === 0) {
|
|
138
|
-
res['height'] = res['width'] / wPH
|
|
138
|
+
res['height'] = parseInt(res['width'] / wPH)
|
|
139
139
|
}
|
|
140
140
|
if (res['width'] === 0 && res['height'] !== 0) {
|
|
141
|
-
res['width'] = res['height'] * wPH
|
|
141
|
+
res['width'] = parseInt(res['height'] * wPH)
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
+
|
|
144
145
|
if (res['width'] !== 0 || res['height'] !== 0) {
|
|
145
146
|
return this.size = res
|
|
146
147
|
}
|
|
@@ -149,10 +150,10 @@ export default {
|
|
|
149
150
|
let cs = window.getComputedStyle(this.$refs.rImg.parentElement)
|
|
150
151
|
let paddingX = parseFloat(cs.paddingLeft) + parseFloat(cs.paddingRight);
|
|
151
152
|
let borderX = parseFloat(cs.borderLeftWidth) + parseFloat(cs.borderRightWidth);
|
|
152
|
-
let w =
|
|
153
|
+
let w = parseInt(parseFloat(cs.getPropertyValue('width')) - paddingX - borderX);
|
|
153
154
|
return this.size = {
|
|
154
155
|
width: w,
|
|
155
|
-
height: wPH ? w / wPH : 0
|
|
156
|
+
height: parseInt(wPH ? w / wPH : 0)
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
return false
|
package/components/index.js
CHANGED
|
@@ -23,6 +23,7 @@ const list = {
|
|
|
23
23
|
},
|
|
24
24
|
'r-card': {'p': 'card/index.vue', 'c': [], 'd': ['ripple']},
|
|
25
25
|
'r-chart': {'p': 'chart/chart.vue', 'c': [], 'd': []},
|
|
26
|
+
'r-world-map': {'p': 'chart/worldMap.vue', 'c': ['r-float'], 'd': []},
|
|
26
27
|
'r-chat': {
|
|
27
28
|
'p': 'chat/index.vue',
|
|
28
29
|
'c': ['r-btn', 'r-icon', 'r-progress-circle', 'r-img'],
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<teleport :to="`.${$r.prefix}app`">
|
|
3
3
|
<transition :name="animate">
|
|
4
|
-
<div v-
|
|
4
|
+
<div v-if="modelValue" :class="{
|
|
5
5
|
[`${$r.prefix}modal`]:true,
|
|
6
6
|
'h-end': bottom,
|
|
7
7
|
'modal-no-overlay': noOverlay,
|
|
8
8
|
'animate-modal-vibrate': run_animate,
|
|
9
|
-
}"
|
|
10
|
-
|
|
9
|
+
}" v-bind="$attrs" @click.self="close"
|
|
10
|
+
>
|
|
11
11
|
<div class="modal-container" :style="{'max-width':maxWidth,'max-height':maxHeight}" :class="{
|
|
12
12
|
'modal-bottom':bottom,
|
|
13
13
|
[color]:color,
|
|
14
|
-
['animate-modal-' +animate]:animate,
|
|
15
14
|
'modal-full-width':fullWidth,
|
|
16
15
|
'modal-full-height':fullHeight,
|
|
17
16
|
'modal-mini':minWidth,
|
|
@@ -54,30 +53,57 @@ export default {
|
|
|
54
53
|
minWidth: {type: Boolean, default: true},
|
|
55
54
|
flat: Boolean,
|
|
56
55
|
closable: Boolean,
|
|
56
|
+
routeHistory: String,
|
|
57
57
|
closebtn: {type: Boolean, default: true},
|
|
58
58
|
color: String,
|
|
59
59
|
animate: {
|
|
60
60
|
type: String,
|
|
61
|
-
default: '
|
|
61
|
+
default: 'scale'
|
|
62
62
|
}
|
|
63
|
-
|
|
64
63
|
},
|
|
65
|
-
emits:['update:modelValue'],
|
|
64
|
+
emits: ['update:modelValue'],
|
|
66
65
|
data() {
|
|
67
66
|
return {
|
|
68
67
|
state: null,
|
|
69
68
|
run_animate: false
|
|
70
69
|
}
|
|
71
70
|
},
|
|
71
|
+
created() {
|
|
72
|
+
if (this.routeHistory) {
|
|
73
|
+
const h = this.$route.hash.replace('#', '').split('&')
|
|
74
|
+
if (h.includes(this.routeHistory)) {
|
|
75
|
+
this.$emit('update:modelValue', true)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
72
79
|
watch: {
|
|
80
|
+
'$route': function (n) {
|
|
81
|
+
let h = []
|
|
82
|
+
if (this.$route.hash) {
|
|
83
|
+
h = this.$route.hash.replace('#', '').split('&')
|
|
84
|
+
}
|
|
85
|
+
if (!h.includes(this.routeHistory)) {
|
|
86
|
+
this.$emit('update:modelValue', false)
|
|
87
|
+
} else {
|
|
88
|
+
this.$emit('update:modelValue', true)
|
|
89
|
+
}
|
|
90
|
+
},
|
|
73
91
|
modelValue: {
|
|
74
92
|
// immediate: true, watch at created component
|
|
75
93
|
handler: function (newVal, oldVal) {
|
|
76
94
|
if (newVal === true) {
|
|
77
95
|
document.documentElement.style.overflow = 'hidden'
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
96
|
+
if (this.routeHistory) {
|
|
97
|
+
const routeHashs = this.$route.hash.replace('#', '').split('&')
|
|
98
|
+
if (!routeHashs.includes(this.routeHistory)) {
|
|
99
|
+
let h = ''
|
|
100
|
+
if (this.$route.hash) {
|
|
101
|
+
h = this.$route.hash + '&' + this.routeHistory
|
|
102
|
+
} else {
|
|
103
|
+
h = '#' + this.routeHistory
|
|
104
|
+
}
|
|
105
|
+
this.$router.push({path: this.$route.fullPath, hash: h})
|
|
106
|
+
}
|
|
81
107
|
}
|
|
82
108
|
} else {
|
|
83
109
|
document.documentElement.style.overflow = null
|
|
@@ -88,7 +114,27 @@ export default {
|
|
|
88
114
|
methods: {
|
|
89
115
|
close(force = false) {
|
|
90
116
|
if (this.closable || force === true) {
|
|
91
|
-
|
|
117
|
+
if (this.routeHistory) {
|
|
118
|
+
if (history.state.back) {
|
|
119
|
+
this.$router.back()
|
|
120
|
+
} else {
|
|
121
|
+
let h = ''
|
|
122
|
+
if (this.$route.hash) {
|
|
123
|
+
h = this.$route.hash.replace('#', '').split('&')
|
|
124
|
+
h.splice(h.indexOf(this.routeHistory), 1)
|
|
125
|
+
let s = ''
|
|
126
|
+
let first = true
|
|
127
|
+
h.forEach((item) => {
|
|
128
|
+
if (item) {
|
|
129
|
+
s += (first ? '#' : '&') + item
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
h = s
|
|
133
|
+
}
|
|
134
|
+
this.$router.replace({'path': this.$route.fullPath, hash: h})
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
this.$emit('update:modelValue', false)
|
|
92
138
|
} else {
|
|
93
139
|
this.run_animate = true
|
|
94
140
|
setTimeout(() => {
|
|
@@ -4,19 +4,21 @@
|
|
|
4
4
|
align-items: center;
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
display: flex;
|
|
7
|
-
left:
|
|
8
|
-
|
|
7
|
+
left: -50%;
|
|
8
|
+
top: -50%;
|
|
9
|
+
width: 200%;
|
|
10
|
+
height: 200%;
|
|
9
11
|
justify-content: center;
|
|
10
12
|
position: fixed;
|
|
11
13
|
z-index: map_get($z-index, 'important');
|
|
12
14
|
outline: none;
|
|
13
|
-
bottom: 0;
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
&:not(.modal-no-overlay) {
|
|
18
|
+
background-color: var(--color-overlay);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.modal-content {
|
|
20
22
|
border: 1px solid var(--color-border);
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -43,8 +45,8 @@
|
|
|
43
45
|
|
|
44
46
|
.modal-container {
|
|
45
47
|
width: 95%;
|
|
46
|
-
max-width:
|
|
47
|
-
max-height:
|
|
48
|
+
max-width: 100vw;
|
|
49
|
+
max-height: 90vh;
|
|
48
50
|
z-index: map_get($z-index, 'important');
|
|
49
51
|
}
|
|
50
52
|
|
|
@@ -59,7 +61,7 @@
|
|
|
59
61
|
@include media-breakpoint-up('md') {
|
|
60
62
|
.modal-container {
|
|
61
63
|
width: 75%;
|
|
62
|
-
max-width:
|
|
64
|
+
max-width: 75vw;
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
|
|
@@ -73,7 +75,7 @@
|
|
|
73
75
|
|
|
74
76
|
.modal-full-width {
|
|
75
77
|
width: 100%;
|
|
76
|
-
max-width:
|
|
78
|
+
max-width: 100vw !important;
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
.modal-full-height {
|