renusify 1.2.5 → 1.3.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/components/bar/toolbar/menuMob.vue +13 -13
- package/components/calendar/month.vue +2 -2
- package/components/calendar/year.vue +2 -2
- package/components/chat/chatInput.vue +3 -3
- package/components/codeEditor/highlightCss.vue +54 -1
- package/components/codeEditor/highlightHtml.vue +69 -1
- package/components/codeEditor/highlightJs.vue +54 -1
- package/components/codeEditor/index.vue +4 -4
- package/components/form/address_ir.vue +1 -1
- package/components/form/colorPicker/index.vue +3 -3
- package/components/form/datePicker/month.vue +1 -1
- package/components/form/datePicker/year.vue +1 -1
- package/components/form/group-input.vue +17 -10
- package/components/form/json/JsonView.vue +21 -41
- package/components/form/json/index.vue +119 -63
- package/components/formCreator/index.vue +7 -1
- package/components/index.js +1 -1
- package/components/tabs/index.vue +1 -1
- package/package.json +1 -1
|
@@ -15,24 +15,24 @@
|
|
|
15
15
|
</div>
|
|
16
16
|
</template>
|
|
17
17
|
<script>
|
|
18
|
-
|
|
18
|
+
import MenuChilds from "./menuChilds";
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
export default {
|
|
21
|
+
name: 'menu-mobile',
|
|
22
|
+
components: {MenuChilds},
|
|
23
|
+
props: {
|
|
24
|
+
logo: String,
|
|
25
|
+
logoW: Number,
|
|
26
|
+
logoH: Number,
|
|
27
|
+
menu: Array,
|
|
28
|
+
modelValue: Boolean
|
|
29
|
+
},
|
|
30
|
+
data() {
|
|
31
31
|
return {}
|
|
32
32
|
},
|
|
33
33
|
methods: {
|
|
34
34
|
close() {
|
|
35
|
-
|
|
35
|
+
this.$emit('update:modelValue', false)
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
locale: String,
|
|
22
22
|
year: Number
|
|
23
23
|
},
|
|
24
|
-
emits:['update:
|
|
24
|
+
emits: ['update:modelValue'],
|
|
25
25
|
data() {
|
|
26
26
|
return {
|
|
27
27
|
p: 0
|
|
@@ -35,7 +35,7 @@ export default {
|
|
|
35
35
|
},
|
|
36
36
|
methods: {
|
|
37
37
|
emit(n) {
|
|
38
|
-
this.$emit('update:
|
|
38
|
+
this.$emit('update:modelValue', n)
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -62,7 +62,7 @@ export default {
|
|
|
62
62
|
uploadLink: String,
|
|
63
63
|
canFile: Boolean,
|
|
64
64
|
},
|
|
65
|
-
emits:['update:
|
|
65
|
+
emits: ['update:modelValue'],
|
|
66
66
|
data() {
|
|
67
67
|
return {
|
|
68
68
|
text: '',
|
|
@@ -97,14 +97,14 @@ export default {
|
|
|
97
97
|
},
|
|
98
98
|
send() {
|
|
99
99
|
if (this.text) {
|
|
100
|
-
this.$emit('update:
|
|
100
|
+
this.$emit('update:modelValue', {type: "text", content: this.text})
|
|
101
101
|
this.$refs.input.innerText = ''
|
|
102
102
|
this.text = ''
|
|
103
103
|
this.$refs.input.focus()
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
emit() {
|
|
107
|
-
this.$emit('update:
|
|
107
|
+
this.$emit('update:modelValue', {type: "file", content: this.text, link: this.fileLink})
|
|
108
108
|
this.$refs.input.innerText = ''
|
|
109
109
|
this.text = ''
|
|
110
110
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
autocomplete="off"
|
|
7
7
|
autocorrect="off"
|
|
8
8
|
spellcheck="false"
|
|
9
|
+
@keydown="setTab"
|
|
9
10
|
></textarea>
|
|
10
11
|
<div class="text-preview" v-html="build"></div>
|
|
11
12
|
</div>
|
|
@@ -29,7 +30,7 @@ export default {
|
|
|
29
30
|
this.d = this.modelValue;
|
|
30
31
|
},
|
|
31
32
|
d: function () {
|
|
32
|
-
this.$emit("update:
|
|
33
|
+
this.$emit("update:modelValue", this.d);
|
|
33
34
|
},
|
|
34
35
|
},
|
|
35
36
|
computed: {
|
|
@@ -66,6 +67,58 @@ export default {
|
|
|
66
67
|
},
|
|
67
68
|
},
|
|
68
69
|
methods: {
|
|
70
|
+
setTab(event) {
|
|
71
|
+
if (event.key === "'" || event.key === '"') {
|
|
72
|
+
const end = event.target.selectionEnd;
|
|
73
|
+
event.preventDefault()
|
|
74
|
+
document.execCommand('insertText', false, event.key.repeat(2));
|
|
75
|
+
event.target.selectionEnd = end + 1;
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
if (event.key === "{") {
|
|
79
|
+
const end = event.target.selectionEnd;
|
|
80
|
+
event.preventDefault()
|
|
81
|
+
document.execCommand('insertText', false, '{}');
|
|
82
|
+
event.target.selectionEnd = end + 1;
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
if (event.key === "(") {
|
|
86
|
+
const end = event.target.selectionEnd;
|
|
87
|
+
event.preventDefault()
|
|
88
|
+
document.execCommand('insertText', false, '()');
|
|
89
|
+
event.target.selectionEnd = end + 1;
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
if (event.key === "[") {
|
|
93
|
+
const end = event.target.selectionEnd;
|
|
94
|
+
event.preventDefault()
|
|
95
|
+
document.execCommand('insertText', false, '[]');
|
|
96
|
+
event.target.selectionEnd = end + 1;
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
if (event.keyCode === 9) {
|
|
100
|
+
event.preventDefault()
|
|
101
|
+
document.execCommand('insertText', false, ' '.repeat(4));
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
if (event.keyCode === 13) {
|
|
105
|
+
event.preventDefault()
|
|
106
|
+
let n = event.target.value.substr(0, event.target.selectionStart).split('\n')
|
|
107
|
+
n = n[n.length - 1].split('')
|
|
108
|
+
let w = ''
|
|
109
|
+
for (let i = 0; i < n.length; i++) {
|
|
110
|
+
if (n[i] === ' ') {
|
|
111
|
+
w += ' '
|
|
112
|
+
} else {
|
|
113
|
+
break
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
document.execCommand('insertText', false, '\n' + w);
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
return true
|
|
121
|
+
},
|
|
69
122
|
re_class(res) {
|
|
70
123
|
let regex = /\.-?[_a-zA-Z]+[_a-zA-Z0-9-]*\s*\{/g;
|
|
71
124
|
let matched = res.matchAll(regex);
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
autocomplete="off"
|
|
7
7
|
autocorrect="off"
|
|
8
8
|
spellcheck="false"
|
|
9
|
+
@keydown="setTab"
|
|
9
10
|
></textarea>
|
|
10
11
|
<div class="text-preview" v-html="build"></div>
|
|
11
12
|
</div>
|
|
@@ -22,6 +23,7 @@ export default {
|
|
|
22
23
|
d: this.modelValue,
|
|
23
24
|
runnable: false,
|
|
24
25
|
code: "",
|
|
26
|
+
openTag: null
|
|
25
27
|
};
|
|
26
28
|
},
|
|
27
29
|
watch: {
|
|
@@ -29,7 +31,7 @@ export default {
|
|
|
29
31
|
this.d = this.modelValue;
|
|
30
32
|
},
|
|
31
33
|
d: function () {
|
|
32
|
-
this.$emit("update:
|
|
34
|
+
this.$emit("update:modelValue", this.d);
|
|
33
35
|
},
|
|
34
36
|
},
|
|
35
37
|
computed: {
|
|
@@ -86,6 +88,72 @@ export default {
|
|
|
86
88
|
},
|
|
87
89
|
},
|
|
88
90
|
methods: {
|
|
91
|
+
setTab(event) {
|
|
92
|
+
if (event.key === "<") {
|
|
93
|
+
this.openTag = event.target.selectionEnd
|
|
94
|
+
return false
|
|
95
|
+
} else if (event.key === ">" && this.openTag !== null) {
|
|
96
|
+
const end = event.target.selectionEnd;
|
|
97
|
+
const sel = event.target.value.substring(this.openTag + 1, end).trim().split(' ')[0];
|
|
98
|
+
const t = `></${sel}>`
|
|
99
|
+
event.preventDefault()
|
|
100
|
+
document.execCommand('insertText', false, t);
|
|
101
|
+
event.target.selectionEnd = end + 1;
|
|
102
|
+
this.openTag = null
|
|
103
|
+
return false
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (event.key === "'" || event.key === '"' || event.key === '`') {
|
|
107
|
+
const end = event.target.selectionEnd;
|
|
108
|
+
event.preventDefault()
|
|
109
|
+
document.execCommand('insertText', false, event.key.repeat(2));
|
|
110
|
+
event.target.selectionEnd = end + 1;
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
if (event.key === "{") {
|
|
114
|
+
const end = event.target.selectionEnd;
|
|
115
|
+
event.preventDefault()
|
|
116
|
+
document.execCommand('insertText', false, '{}');
|
|
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
|
+
},
|
|
89
157
|
re_words(res) {
|
|
90
158
|
res = this.$helper.replacer(
|
|
91
159
|
res,
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
autocomplete="off"
|
|
7
7
|
autocorrect="off"
|
|
8
8
|
spellcheck="false"
|
|
9
|
+
@keydown="setTab"
|
|
9
10
|
></textarea>
|
|
10
11
|
<div class="text-preview" v-html="build"></div>
|
|
11
12
|
</div>
|
|
@@ -29,7 +30,7 @@ export default {
|
|
|
29
30
|
this.d = this.modelValue;
|
|
30
31
|
},
|
|
31
32
|
d: function () {
|
|
32
|
-
this.$emit("update:
|
|
33
|
+
this.$emit("update:modelValue", this.d);
|
|
33
34
|
},
|
|
34
35
|
},
|
|
35
36
|
computed: {
|
|
@@ -83,6 +84,58 @@ export default {
|
|
|
83
84
|
},
|
|
84
85
|
},
|
|
85
86
|
methods: {
|
|
87
|
+
setTab(event) {
|
|
88
|
+
if (event.key === "'" || event.key === '"' || event.key === '`') {
|
|
89
|
+
const end = event.target.selectionEnd;
|
|
90
|
+
event.preventDefault()
|
|
91
|
+
document.execCommand('insertText', false, event.key.repeat(2));
|
|
92
|
+
event.target.selectionEnd = end + 1;
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
if (event.key === "{") {
|
|
96
|
+
const end = event.target.selectionEnd;
|
|
97
|
+
event.preventDefault()
|
|
98
|
+
document.execCommand('insertText', false, '{}');
|
|
99
|
+
event.target.selectionEnd = end + 1;
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if (event.key === "(") {
|
|
103
|
+
const end = event.target.selectionEnd;
|
|
104
|
+
event.preventDefault()
|
|
105
|
+
document.execCommand('insertText', false, '()');
|
|
106
|
+
event.target.selectionEnd = end + 1;
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
if (event.key === "[") {
|
|
110
|
+
const end = event.target.selectionEnd;
|
|
111
|
+
event.preventDefault()
|
|
112
|
+
document.execCommand('insertText', false, '[]');
|
|
113
|
+
event.target.selectionEnd = end + 1;
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
if (event.keyCode === 9) {
|
|
117
|
+
event.preventDefault()
|
|
118
|
+
document.execCommand('insertText', false, ' '.repeat(4));
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
if (event.keyCode === 13) {
|
|
122
|
+
event.preventDefault()
|
|
123
|
+
let n = event.target.value.substr(0, event.target.selectionStart).split('\n')
|
|
124
|
+
n = n[n.length - 1].split('')
|
|
125
|
+
let w = ''
|
|
126
|
+
for (let i = 0; i < n.length; i++) {
|
|
127
|
+
if (n[i] === ' ') {
|
|
128
|
+
w += ' '
|
|
129
|
+
} else {
|
|
130
|
+
break
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
document.execCommand('insertText', false, '\n' + w);
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
return true
|
|
138
|
+
},
|
|
86
139
|
strToObj(str) {
|
|
87
140
|
str = this.$helper.replacer(str, " ", "");
|
|
88
141
|
str = this.$helper.replacer(str, "\n", "");
|
|
@@ -37,9 +37,7 @@
|
|
|
37
37
|
</div>
|
|
38
38
|
<div v-show="scriptShow">
|
|
39
39
|
<span class="color-orange"
|
|
40
|
-
><script>
|
|
41
|
-
<br/>
|
|
42
|
-
export default {</span
|
|
40
|
+
><script><br/>export default {</span
|
|
43
41
|
>
|
|
44
42
|
<highlight-script v-model="scr"></highlight-script>
|
|
45
43
|
<span class="color-orange">}<br/><script></span>
|
|
@@ -151,6 +149,7 @@ export default {
|
|
|
151
149
|
|
|
152
150
|
<style lang="scss">
|
|
153
151
|
@import "~renusify/style/include";
|
|
152
|
+
|
|
154
153
|
.#{$prefix}code-editor {
|
|
155
154
|
position: relative;
|
|
156
155
|
white-space: break-spaces;
|
|
@@ -212,6 +211,7 @@ export default {
|
|
|
212
211
|
|
|
213
212
|
.code-editor-highlight {
|
|
214
213
|
position: relative;
|
|
214
|
+
margin: -12px 0;
|
|
215
215
|
|
|
216
216
|
.text-preview {
|
|
217
217
|
white-space: pre-wrap;
|
|
@@ -223,7 +223,6 @@ export default {
|
|
|
223
223
|
line-height: 20px;
|
|
224
224
|
margin: 0;
|
|
225
225
|
border: 0;
|
|
226
|
-
|
|
227
226
|
padding: 12px;
|
|
228
227
|
}
|
|
229
228
|
|
|
@@ -253,6 +252,7 @@ export default {
|
|
|
253
252
|
top: 0;
|
|
254
253
|
left: 0;
|
|
255
254
|
resize: none;
|
|
255
|
+
overflow: hidden;
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
}
|
|
@@ -25,7 +25,7 @@ export default {
|
|
|
25
25
|
modelValue: String,
|
|
26
26
|
format: {type: String, default: 'rgba'}
|
|
27
27
|
},
|
|
28
|
-
emits:['update:
|
|
28
|
+
emits: ['update:modelValue', 'close'],
|
|
29
29
|
data() {
|
|
30
30
|
return {
|
|
31
31
|
open: false
|
|
@@ -34,7 +34,7 @@ export default {
|
|
|
34
34
|
methods: {
|
|
35
35
|
clear() {
|
|
36
36
|
this.open = false
|
|
37
|
-
this.$emit('update:
|
|
37
|
+
this.$emit('update:modelValue', null)
|
|
38
38
|
this.$emit('close', true)
|
|
39
39
|
},
|
|
40
40
|
close() {
|
|
@@ -46,7 +46,7 @@ export default {
|
|
|
46
46
|
if (this.format === 'rgba') {
|
|
47
47
|
r = e.rgba
|
|
48
48
|
}
|
|
49
|
-
this.$emit('update:
|
|
49
|
+
this.$emit('update:modelValue', r)
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -3,19 +3,16 @@
|
|
|
3
3
|
:model-value="modelValue"
|
|
4
4
|
hide>
|
|
5
5
|
<div class="w-full">
|
|
6
|
+
<span v-if="label" class="color-primary-text">{{ label }}</span>
|
|
6
7
|
<div class="group-holder" v-for="(item,i) in modelValue" :key="i">
|
|
7
8
|
<div class="group-slot">
|
|
8
9
|
<slot :item="item" :index="i" :disableDel="disDel">
|
|
9
|
-
<div class="d-flex flex-wrap pt-5">
|
|
10
|
+
<div v-if="template" class="d-flex flex-wrap pt-5 v-start">
|
|
10
11
|
<template v-for="(v,k) in item" :key="i+'-'+k">
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<r-switch-input v-else-if="typeof v==='boolean'" class="flex-grow-0 me-1" :label="t(k)"
|
|
16
|
-
v-model="item[k]"></r-switch-input>
|
|
17
|
-
</template>
|
|
18
|
-
</div>
|
|
12
|
+
<component :is="template[k]['type']" v-model="item[k]" :label="t(k)"
|
|
13
|
+
class="flex-grow-0 me-1" v-bind="template[k]['props']"></component>
|
|
14
|
+
</template>
|
|
15
|
+
</div>
|
|
19
16
|
</slot>
|
|
20
17
|
</div>
|
|
21
18
|
<div class="group-action">
|
|
@@ -85,7 +82,17 @@ export default {
|
|
|
85
82
|
add() {
|
|
86
83
|
if (this.show_add) {
|
|
87
84
|
let a = this.modelValue || []
|
|
88
|
-
|
|
85
|
+
let b = {}
|
|
86
|
+
if (this.template) {
|
|
87
|
+
for (let k in this.template) {
|
|
88
|
+
let d = this.template[k]['default'] !== undefined ? this.template[k]['default'] : null
|
|
89
|
+
if (typeof d === 'object') {
|
|
90
|
+
d = this.$helper.clearProxy(d)
|
|
91
|
+
}
|
|
92
|
+
b[k] = d
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
a.push(b)
|
|
89
96
|
this.$emit('add', true)
|
|
90
97
|
this.$emit('update:modelValue', a)
|
|
91
98
|
}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="`${$r.prefix}json-view d-flex v-
|
|
2
|
+
<div :class="`${$r.prefix}json-view d-flex v-end flex-wrap`"
|
|
3
3
|
v-for="(value,key) in modelValue"
|
|
4
4
|
:key="key">
|
|
5
|
-
<div class="
|
|
5
|
+
<div class="d-flex v-center me-1">
|
|
6
6
|
<r-btn v-if="!disableDel" icon class="color-error-text" text @click="del(key)">
|
|
7
7
|
<r-icon v-html="$r.icons.delete"></r-icon>
|
|
8
8
|
</r-btn>
|
|
9
|
-
<
|
|
10
|
-
<r-text-input :tile="tile" :readonly="disableEditKey" :model-value="key"
|
|
11
|
-
@update:model-value="emitkey(key,$event)"></r-text-input>
|
|
12
|
-
:
|
|
13
|
-
</template>
|
|
9
|
+
<div v-if="typeof value==='object'">{{ key }}</div>
|
|
14
10
|
</div>
|
|
15
11
|
<div v-if="typeof value==='object'" class="flex-grow-1 w-full ps-10">
|
|
16
12
|
<r-json-input :tile="tile"
|
|
@@ -18,20 +14,21 @@
|
|
|
18
14
|
@update:model-value="emit(key,$event)"
|
|
19
15
|
:disableAdd="disableAdd||template!==undefined"
|
|
20
16
|
:disableDel="disableDel||template!==undefined"
|
|
21
|
-
|
|
22
|
-
:keyWidth="keyWidth"
|
|
23
|
-
:valueWidth="valueWidth"
|
|
17
|
+
disableEditKey
|
|
24
18
|
></r-json-input>
|
|
25
19
|
</div>
|
|
26
|
-
<div v-else class="mb-1
|
|
20
|
+
<div v-else class="mb-1 flex-grow-1">
|
|
27
21
|
<r-text-input v-if="typeof value==='string'"
|
|
28
22
|
:tile="tile"
|
|
23
|
+
:label="!is_array?key:''"
|
|
29
24
|
:model-value="value" @update:model-value="emit(key,$event)"></r-text-input>
|
|
30
25
|
<r-number-input v-else-if="typeof value==='number'"
|
|
31
26
|
:tile="tile"
|
|
27
|
+
:label="!is_array?key:''"
|
|
32
28
|
:model-value="value" @update:model-value="emit(key,$event)"></r-number-input>
|
|
33
29
|
<r-switch-input v-else-if="typeof value==='boolean'"
|
|
34
30
|
:tile="tile"
|
|
31
|
+
:label="!is_array?key:''"
|
|
35
32
|
:model-value="value" @update:model-value="emit(key,$event)"></r-switch-input>
|
|
36
33
|
|
|
37
34
|
</div>
|
|
@@ -44,19 +41,11 @@ export default {
|
|
|
44
41
|
props: {
|
|
45
42
|
modelValue: Object,
|
|
46
43
|
template: Object,
|
|
47
|
-
disableEditKey: Boolean,
|
|
48
44
|
disableAdd: Boolean,
|
|
49
45
|
disableDel: Boolean,
|
|
50
|
-
tile: Boolean
|
|
51
|
-
keyWidth: {
|
|
52
|
-
type: String,
|
|
53
|
-
default: '140px'
|
|
54
|
-
}, valueWidth: {
|
|
55
|
-
type: String,
|
|
56
|
-
default: '300px'
|
|
57
|
-
}
|
|
46
|
+
tile: Boolean
|
|
58
47
|
},
|
|
59
|
-
emits: ['update:
|
|
48
|
+
emits: ['update:modelValue'],
|
|
60
49
|
data() {
|
|
61
50
|
return {
|
|
62
51
|
time_id: null
|
|
@@ -75,34 +64,25 @@ export default {
|
|
|
75
64
|
} else {
|
|
76
65
|
delete o[key]
|
|
77
66
|
}
|
|
78
|
-
this.$emit('update:
|
|
79
|
-
},
|
|
80
|
-
emitkey(oldKey, newKey) {
|
|
81
|
-
clearTimeout(this.time_id)
|
|
82
|
-
let o = this.modelValue
|
|
83
|
-
let n = {};
|
|
84
|
-
|
|
85
|
-
Object.keys(o).forEach(key => {
|
|
86
|
-
if (key === oldKey) {
|
|
87
|
-
let newPair = {[newKey]: o[oldKey]};
|
|
88
|
-
n = {...n, ...newPair}
|
|
89
|
-
} else {
|
|
90
|
-
n = {...n, [key]: o[key]}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
this.time_id = setTimeout(() => {
|
|
94
|
-
this.$emit('update:model-value', n)
|
|
95
|
-
}, 1000)
|
|
67
|
+
this.$emit('update:modelValue', o)
|
|
96
68
|
},
|
|
97
69
|
emit(k, v) {
|
|
98
70
|
let d = this.modelValue
|
|
99
71
|
d[k] = v
|
|
100
|
-
this.$emit('update:
|
|
72
|
+
this.$emit('update:modelValue', d)
|
|
101
73
|
}
|
|
102
74
|
}
|
|
103
75
|
}
|
|
104
76
|
</script>
|
|
105
77
|
<style lang="scss">
|
|
106
|
-
@import "
|
|
78
|
+
@import "~renusify/style/include";
|
|
107
79
|
|
|
80
|
+
.#{$prefix}json-view {
|
|
81
|
+
@include rtl() {
|
|
82
|
+
border-right: 1px solid var(--color-border);
|
|
83
|
+
}
|
|
84
|
+
@include ltr() {
|
|
85
|
+
border-left: 1px solid var(--color-border);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
108
88
|
</style>
|
|
@@ -1,42 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="`${$r.prefix}json`">
|
|
3
|
-
<div v-
|
|
4
|
-
|
|
5
|
-
<div
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</div>
|
|
32
|
-
<div v-else-if="show" class="d-flex v-baseline">
|
|
33
|
-
<r-text-input
|
|
34
|
-
v-if="!is_array"
|
|
35
|
-
v-model="info.key"
|
|
36
|
-
:tile="tile"
|
|
37
|
-
class="w-30 pe-1"
|
|
38
|
-
:label="keyLabel"></r-text-input>
|
|
39
|
-
<div class="w-20" v-if="!valueType">
|
|
2
|
+
<div :class="`${$r.prefix}json-input`">
|
|
3
|
+
<div class="d-flex v-center">
|
|
4
|
+
<r-btn v-if="!disableEditKey" class="me-1 mb-1" icon @click="modeForm=!modeForm">{}</r-btn>
|
|
5
|
+
<div v-if="label">{{ label }}</div>
|
|
6
|
+
</div>
|
|
7
|
+
<div v-if="modeForm">
|
|
8
|
+
<json-view :model-value="modelValue"
|
|
9
|
+
@update:model-value="emit"
|
|
10
|
+
:template="template"
|
|
11
|
+
:disableAdd="disableAdd"
|
|
12
|
+
:disableDel="disableDel"
|
|
13
|
+
:tile="tile"
|
|
14
|
+
></json-view>
|
|
15
|
+
<r-btn
|
|
16
|
+
v-if="!show &&!disableAdd"
|
|
17
|
+
class="my-3 ms-1"
|
|
18
|
+
icon
|
|
19
|
+
size="small"
|
|
20
|
+
@click.prevent="open">
|
|
21
|
+
<r-icon v-html="$r.icons.plus"></r-icon>
|
|
22
|
+
</r-btn>
|
|
23
|
+
<div v-else-if="show" class="d-flex v-baseline">
|
|
24
|
+
<r-text-input
|
|
25
|
+
v-if="!is_array"
|
|
26
|
+
v-model="info.key"
|
|
27
|
+
:label="keyLabel"
|
|
28
|
+
:tile="tile"
|
|
29
|
+
class="w-30 pe-1"></r-text-input>
|
|
30
|
+
<div class="w-20" v-if="!valueType">
|
|
40
31
|
<r-select-input v-model="info.type"
|
|
41
32
|
:tile="tile"
|
|
42
33
|
class="me-1"
|
|
@@ -50,21 +41,24 @@
|
|
|
50
41
|
:tile="tile"
|
|
51
42
|
:label="valueLabel"
|
|
52
43
|
v-model="info.value"></r-text-input>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
<div class="display-5 d-flex v-end pb-2" :style="{'color':color}" :class="{
|
|
63
|
-
'mt-5':Object.values(modelValue||[]).length>0,
|
|
64
|
-
'mt-2':Object.values(modelValue||[]).length===0
|
|
65
|
-
}">{{ !is_array ? '}' : ']' }}
|
|
44
|
+
<r-number-input v-else-if="val_type==='number'"
|
|
45
|
+
:tile="tile"
|
|
46
|
+
:label="$t('value','renusify')" v-model="info.value"></r-number-input>
|
|
47
|
+
<r-switch-input v-else-if="val_type==='boolean'"
|
|
48
|
+
:tile="tile"
|
|
49
|
+
:label="$t('value','renusify')" v-model="info.value"></r-switch-input>
|
|
50
|
+
<r-btn @click.prevent="add" class="ms-1 color-success" rounded>{{ $t('add', 'renusify') }}</r-btn>
|
|
66
51
|
</div>
|
|
67
52
|
</div>
|
|
53
|
+
<textarea v-else :class="{'state-error':error}"
|
|
54
|
+
:rows="Object.keys(modelValue).length+5"
|
|
55
|
+
autocapitalize="off"
|
|
56
|
+
autocomplete="off"
|
|
57
|
+
autocorrect="off"
|
|
58
|
+
class="ltr w-full"
|
|
59
|
+
spellcheck="false"
|
|
60
|
+
@input="emitt"
|
|
61
|
+
@keydown="setTab">{{ JSON.stringify(modelValue, null, 4) }}</textarea>
|
|
68
62
|
</div>
|
|
69
63
|
</template>
|
|
70
64
|
<script>
|
|
@@ -80,14 +74,6 @@ export default {
|
|
|
80
74
|
modelValue: {
|
|
81
75
|
type: Object, Array
|
|
82
76
|
},
|
|
83
|
-
keyWidth: {
|
|
84
|
-
type: String,
|
|
85
|
-
default: '140px'
|
|
86
|
-
},
|
|
87
|
-
valueWidth: {
|
|
88
|
-
type: String,
|
|
89
|
-
default: '300px'
|
|
90
|
-
},
|
|
91
77
|
valueType: {
|
|
92
78
|
type: String,
|
|
93
79
|
validator: function (value) {
|
|
@@ -101,9 +87,11 @@ export default {
|
|
|
101
87
|
disableEditKey: Boolean,
|
|
102
88
|
disableDel: Boolean
|
|
103
89
|
},
|
|
104
|
-
emits:['update:modelValue'],
|
|
90
|
+
emits: ['update:modelValue'],
|
|
105
91
|
data() {
|
|
106
92
|
return {
|
|
93
|
+
modeForm: true,
|
|
94
|
+
error: false,
|
|
107
95
|
show: false,
|
|
108
96
|
info: {},
|
|
109
97
|
color: `rgb(${this.$helper.randomInt(0, 255)},${this.$helper.randomInt(0, 255)},${this.$helper.randomInt(0, 255)})`
|
|
@@ -124,6 +112,51 @@ export default {
|
|
|
124
112
|
}
|
|
125
113
|
},
|
|
126
114
|
methods: {
|
|
115
|
+
setTab(event) {
|
|
116
|
+
if (event.key === '"') {
|
|
117
|
+
const end = event.target.selectionEnd;
|
|
118
|
+
event.preventDefault()
|
|
119
|
+
document.execCommand('insertText', false, event.key.repeat(2));
|
|
120
|
+
event.target.selectionEnd = end + 1;
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
if (event.key === "{") {
|
|
124
|
+
const end = event.target.selectionEnd;
|
|
125
|
+
event.preventDefault()
|
|
126
|
+
document.execCommand('insertText', false, '{}');
|
|
127
|
+
event.target.selectionEnd = end + 1;
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
if (event.key === "[") {
|
|
131
|
+
const end = event.target.selectionEnd;
|
|
132
|
+
event.preventDefault()
|
|
133
|
+
document.execCommand('insertText', false, '[]');
|
|
134
|
+
event.target.selectionEnd = end + 1;
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
if (event.keyCode === 9) {
|
|
138
|
+
event.preventDefault()
|
|
139
|
+
document.execCommand('insertText', false, ' '.repeat(4));
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
if (event.keyCode === 13) {
|
|
143
|
+
event.preventDefault()
|
|
144
|
+
let n = event.target.value.substr(0, event.target.selectionStart).split('\n')
|
|
145
|
+
n = n[n.length - 1].split('')
|
|
146
|
+
let w = ''
|
|
147
|
+
for (let i = 0; i < n.length; i++) {
|
|
148
|
+
if (n[i] === ' ') {
|
|
149
|
+
w += ' '
|
|
150
|
+
} else {
|
|
151
|
+
break
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
document.execCommand('insertText', false, '\n' + w);
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
return true
|
|
159
|
+
},
|
|
127
160
|
open() {
|
|
128
161
|
if (this.template) {
|
|
129
162
|
let d = this.modelValue
|
|
@@ -131,13 +164,22 @@ export default {
|
|
|
131
164
|
d = []
|
|
132
165
|
}
|
|
133
166
|
d.push(Object.assign({}, {}, this.template))
|
|
134
|
-
this.$emit('update:
|
|
167
|
+
this.$emit('update:modelValue', d)
|
|
135
168
|
} else {
|
|
136
169
|
this.show = true
|
|
137
170
|
}
|
|
138
171
|
},
|
|
172
|
+
emitt(e) {
|
|
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
|
+
},
|
|
139
181
|
emit(e) {
|
|
140
|
-
this.$emit('update:
|
|
182
|
+
this.$emit('update:modelValue', e)
|
|
141
183
|
},
|
|
142
184
|
add() {
|
|
143
185
|
let d = this.modelValue
|
|
@@ -169,8 +211,22 @@ export default {
|
|
|
169
211
|
}
|
|
170
212
|
this.show = false
|
|
171
213
|
this.info = {}
|
|
172
|
-
this.$emit('update:
|
|
214
|
+
this.$emit('update:modelValue', d)
|
|
173
215
|
}
|
|
174
216
|
}
|
|
175
217
|
}
|
|
176
218
|
</script>
|
|
219
|
+
<style lang="scss">
|
|
220
|
+
@import "~renusify/style/include";
|
|
221
|
+
|
|
222
|
+
.#{$prefix}json-input {
|
|
223
|
+
textarea {
|
|
224
|
+
outline: none;
|
|
225
|
+
border: 1px solid var(--color-border);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.state-error {
|
|
229
|
+
border: 1px solid var(--color-error);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
</style>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<r-col v-if="item['formInput']!==false&&iff(options[key])"
|
|
9
9
|
:class="options[key]['r-col']?options[key]['r-col']:'col-12'">
|
|
10
10
|
<component
|
|
11
|
-
:is="
|
|
11
|
+
:is="buildName(item['type'])"
|
|
12
12
|
:label="$t(key)"
|
|
13
13
|
v-model="editedItem[key]"
|
|
14
14
|
v-bind="getAttr(options[key])"
|
|
@@ -99,6 +99,12 @@ export default {
|
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
101
|
methods: {
|
|
102
|
+
buildName(name) {
|
|
103
|
+
if (name.startsWith('r-')) {
|
|
104
|
+
return name
|
|
105
|
+
}
|
|
106
|
+
return 'r-' + name
|
|
107
|
+
},
|
|
102
108
|
iff(data) {
|
|
103
109
|
const that = this
|
|
104
110
|
|
package/components/index.js
CHANGED
|
@@ -87,7 +87,7 @@ const list = {
|
|
|
87
87
|
'r-checkbox-input': {'p': 'form/checkbox.vue', 'c': ['r-input', 'r-icon'], 'd': []},
|
|
88
88
|
'r-group-input': {
|
|
89
89
|
'p': 'form/group-input.vue',
|
|
90
|
-
'c': ['r-
|
|
90
|
+
'c': ['r-btn', 'r-icon'],
|
|
91
91
|
'd': []
|
|
92
92
|
},
|
|
93
93
|
'r-input': {'p': 'form/input.vue', 'c': ['r-icon'], 'd': []},
|