@mixd-id/web-scaffold 0.1.230406164 → 0.1.230406166
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 +1 -1
- package/src/components/Datepicker.vue +2 -1
- package/src/components/Image.vue +25 -52
- package/src/components/ListView.vue +3 -0
- package/src/components/Modal.vue +4 -4
- package/src/components/Textarea.vue +3 -1
- package/src/index.js +11 -0
- package/src/widgets/ComponentSetting.vue +20 -23
- package/src/widgets/HeaderSetting.vue +27 -18
package/package.json
CHANGED
|
@@ -266,6 +266,7 @@ export default{
|
|
|
266
266
|
.datepicker {
|
|
267
267
|
@apply min-h-[var(--h-cp)];
|
|
268
268
|
@apply flex items-center rounded-lg overflow-hidden cursor-pointer relative;
|
|
269
|
+
@apply border-[1px] border-text-200;
|
|
269
270
|
@apply cursor-pointer;
|
|
270
271
|
}
|
|
271
272
|
.datepicker:not(.readonly){
|
|
@@ -314,7 +315,7 @@ export default{
|
|
|
314
315
|
@apply flex flex-row gap-2;
|
|
315
316
|
}
|
|
316
317
|
.mode- select{
|
|
317
|
-
@apply
|
|
318
|
+
@apply rounded-lg;
|
|
318
319
|
@apply min-h-[var(--h-cp)];
|
|
319
320
|
}
|
|
320
321
|
.mode- select:first-child{
|
package/src/components/Image.vue
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="
|
|
2
|
+
<div :class="$style.comp" @click="onClick" @mousemove="onMouseMove" @mousedown="onMouseDown">
|
|
3
3
|
|
|
4
|
-
<slot v-if="
|
|
4
|
+
<slot v-if="status === 0" name="empty" :instance="this"></slot>
|
|
5
5
|
|
|
6
|
-
<slot v-else-if="
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
<slot v-else-if="status === 1" name="loading">
|
|
7
|
+
<div :class="$style.loading + (spinnerType === 'shimmer' ? ' ' + $style.shimmer : '')">
|
|
8
|
+
<svg v-if="spinnerType !== 'shimmer'" class="animate-spin aspect-square w-[15%] min-w-[14px] text-primary" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg>
|
|
9
|
+
</div>
|
|
10
|
+
</slot>
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
<img v-else-if="status === 2" :class="computedItemClass" :src="actualSrc" ref="img" />
|
|
12
13
|
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
<slot></slot>
|
|
14
|
+
<slot v-else-if="status === 3" name="error" :instance="this"></slot>
|
|
16
15
|
|
|
17
16
|
<input v-if="Boolean(editable)" class="hidden" type="file" accept="image/*" ref="file" @change="onChange"/>
|
|
18
17
|
|
|
@@ -68,22 +67,6 @@ export default{
|
|
|
68
67
|
|
|
69
68
|
computed:{
|
|
70
69
|
|
|
71
|
-
actualSrc(){
|
|
72
|
-
if(typeof window !== 'undefined'){
|
|
73
|
-
return this.mediaSrc[this.$screenPrefix.value]
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
compClass(){
|
|
78
|
-
return [
|
|
79
|
-
this.$style.comp,
|
|
80
|
-
this.status === 1 && this.spinnerType === 'shimmer' && !this.$slots['loading'] ?
|
|
81
|
-
this.$style.shimmer : ''
|
|
82
|
-
]
|
|
83
|
-
.filter(_=>_)
|
|
84
|
-
.join(' ')
|
|
85
|
-
},
|
|
86
|
-
|
|
87
70
|
computedItemClass(){
|
|
88
71
|
return [
|
|
89
72
|
this.$style.img,
|
|
@@ -99,14 +82,14 @@ export default{
|
|
|
99
82
|
return {
|
|
100
83
|
status: 0, // 0:empty, 1:loading, 2:image, 3:error
|
|
101
84
|
moved: false,
|
|
102
|
-
|
|
103
|
-
|
|
85
|
+
isVisible: false,
|
|
86
|
+
actualSrc: null,
|
|
104
87
|
}
|
|
105
88
|
},
|
|
106
89
|
|
|
107
90
|
mounted(){
|
|
108
91
|
this.$observe.once(this.$el, () => {
|
|
109
|
-
this.
|
|
92
|
+
this.isVisible = true
|
|
110
93
|
this.loadSrc()
|
|
111
94
|
})
|
|
112
95
|
|
|
@@ -126,10 +109,6 @@ export default{
|
|
|
126
109
|
this.$emit('change', null, null)
|
|
127
110
|
},
|
|
128
111
|
|
|
129
|
-
onResize(){
|
|
130
|
-
this.loadSrc()
|
|
131
|
-
},
|
|
132
|
-
|
|
133
112
|
onChange(e){
|
|
134
113
|
if(e.target.files.length > 0){
|
|
135
114
|
var reader = new FileReader();
|
|
@@ -140,6 +119,10 @@ export default{
|
|
|
140
119
|
}
|
|
141
120
|
},
|
|
142
121
|
|
|
122
|
+
onResize(){
|
|
123
|
+
this.loadSrc()
|
|
124
|
+
},
|
|
125
|
+
|
|
143
126
|
edit(){
|
|
144
127
|
if(this.$refs.file){
|
|
145
128
|
this.$refs.file.click()
|
|
@@ -148,19 +131,14 @@ export default{
|
|
|
148
131
|
|
|
149
132
|
async loadSrc(){
|
|
150
133
|
|
|
151
|
-
|
|
152
|
-
if(!this.visibled){
|
|
153
|
-
return
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if(this.$screenPrefix.value in this.mediaSrc){
|
|
134
|
+
if(!this.isVisible){
|
|
157
135
|
return
|
|
158
136
|
}
|
|
159
137
|
|
|
160
138
|
if(typeof this.src === 'string') {
|
|
161
139
|
|
|
162
140
|
if (this.src.startsWith('data:image')) {
|
|
163
|
-
this.
|
|
141
|
+
this.actualSrc = this.src
|
|
164
142
|
this.status = 2
|
|
165
143
|
}
|
|
166
144
|
else{
|
|
@@ -191,12 +169,12 @@ export default{
|
|
|
191
169
|
img.addEventListener('load', () => {
|
|
192
170
|
if(img.getAttribute('data-src') !== this.src) return
|
|
193
171
|
this.status = 2
|
|
194
|
-
this.
|
|
172
|
+
this.actualSrc = img.src
|
|
195
173
|
})
|
|
196
174
|
img.addEventListener('error', (err) => {
|
|
197
175
|
if(img.getAttribute('data-src') !== this.src) return
|
|
198
176
|
this.status = 3
|
|
199
|
-
this.
|
|
177
|
+
this.actualSrc = this.defaultSrc
|
|
200
178
|
})
|
|
201
179
|
img.src = imgSrc
|
|
202
180
|
img.setAttribute('data-src', this.src)
|
|
@@ -223,11 +201,11 @@ export default{
|
|
|
223
201
|
var img = new Image()
|
|
224
202
|
img.addEventListener('load', () => {
|
|
225
203
|
this.status = 2
|
|
226
|
-
this.
|
|
204
|
+
this.actualSrc = img.src
|
|
227
205
|
})
|
|
228
206
|
img.addEventListener('error', (err) => {
|
|
229
207
|
this.status = 3
|
|
230
|
-
this.
|
|
208
|
+
this.actualSrc = this.defaultSrc
|
|
231
209
|
})
|
|
232
210
|
img.src = imgSrc
|
|
233
211
|
this.status = 1
|
|
@@ -238,12 +216,12 @@ export default{
|
|
|
238
216
|
|
|
239
217
|
reader.addEventListener('load', () => {
|
|
240
218
|
this.status = 2
|
|
241
|
-
this.
|
|
219
|
+
this.actualSrc = reader.result
|
|
242
220
|
}, false)
|
|
243
221
|
|
|
244
222
|
reader.addEventListener('error', () => {
|
|
245
223
|
this.status = 3
|
|
246
|
-
this.
|
|
224
|
+
this.actualSrc = this.defaultSrc
|
|
247
225
|
})
|
|
248
226
|
|
|
249
227
|
reader.readAsDataURL(this.src)
|
|
@@ -269,15 +247,10 @@ export default{
|
|
|
269
247
|
|
|
270
248
|
watch:{
|
|
271
249
|
|
|
272
|
-
src(
|
|
273
|
-
this.mediaSrc = {}
|
|
250
|
+
src(){
|
|
274
251
|
this.loadSrc()
|
|
275
252
|
},
|
|
276
253
|
|
|
277
|
-
"isMobile.value"(to){
|
|
278
|
-
this.loadSrc()
|
|
279
|
-
}
|
|
280
|
-
|
|
281
254
|
}
|
|
282
255
|
}
|
|
283
256
|
|
package/src/components/Modal.vue
CHANGED
|
@@ -44,9 +44,9 @@ let modals = []
|
|
|
44
44
|
const registerModal = (modal) => {
|
|
45
45
|
if(modals.includes(modal)) return
|
|
46
46
|
|
|
47
|
-
modals.forEach((_) => {
|
|
47
|
+
/*modals.forEach((_) => {
|
|
48
48
|
_.isDisabled = 1
|
|
49
|
-
})
|
|
49
|
+
})*/
|
|
50
50
|
|
|
51
51
|
modals.push(modal)
|
|
52
52
|
}
|
|
@@ -54,8 +54,8 @@ const registerModal = (modal) => {
|
|
|
54
54
|
const unRegisterModal = (modal) => {
|
|
55
55
|
modals = modals.filter((_) => _ !== modal)
|
|
56
56
|
|
|
57
|
-
if(modals.length > 0)
|
|
58
|
-
modals[modals.length - 1].isDisabled = 0
|
|
57
|
+
/*if(modals.length > 0)
|
|
58
|
+
modals[modals.length - 1].isDisabled = 0*/
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
export default{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="computedClass">
|
|
3
3
|
<slot name="start"></slot>
|
|
4
|
-
<textarea
|
|
4
|
+
<textarea :maxlength="maxlength"
|
|
5
5
|
:placeholder="placeholder" :rows="rows" ref="input" @focus="isActive = true" @blur="onBlur" @input="onInput"
|
|
6
6
|
:value="modelValue" :readonly="Boolean(readonly)" />
|
|
7
7
|
<div v-if="state === -2 && !!(errors)">
|
|
@@ -57,6 +57,8 @@ export default{
|
|
|
57
57
|
|
|
58
58
|
rows: String,
|
|
59
59
|
|
|
60
|
+
maxlength: undefined,
|
|
61
|
+
|
|
60
62
|
},
|
|
61
63
|
|
|
62
64
|
watch:{
|
package/src/index.js
CHANGED
|
@@ -321,6 +321,8 @@ export default{
|
|
|
321
321
|
})
|
|
322
322
|
})
|
|
323
323
|
|
|
324
|
+
const privateVars = {}
|
|
325
|
+
|
|
324
326
|
app.config.globalProperties.uniqid = uniqid
|
|
325
327
|
app.config.globalProperties.$download = download
|
|
326
328
|
app.config.globalProperties.$preload = preload
|
|
@@ -332,6 +334,15 @@ export default{
|
|
|
332
334
|
app.config.globalProperties.warn = consoleWarn
|
|
333
335
|
app.config.globalProperties.info = consoleInfo
|
|
334
336
|
|
|
337
|
+
app.config.globalProperties.$isDev = () => import.meta.env.DEV
|
|
338
|
+
|
|
339
|
+
app.config.globalProperties.$isDebugMode = () => {
|
|
340
|
+
if(!('isDebugMode' in privateVars)){
|
|
341
|
+
privateVars.isDebugMode = location.search.indexOf('debug-mode') >= 0 || import.meta.env.DEV
|
|
342
|
+
}
|
|
343
|
+
return privateVars.isDebugMode
|
|
344
|
+
}
|
|
345
|
+
|
|
335
346
|
app.component('Ahref', defineAsyncComponent(() => import("./components/Ahref.vue")))
|
|
336
347
|
app.component('Alert', defineAsyncComponent(() => import("./components/Alert.vue")))
|
|
337
348
|
app.component('Article', defineAsyncComponent(() => import("./components/Article.vue")))
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
<div>
|
|
5
5
|
<strong class="text-text-400">Layout</strong>
|
|
6
|
-
<div class="
|
|
6
|
+
<div class="h-[1px] bg-text-100 mt-2 mb-4"></div>
|
|
7
|
+
<div class="grid grid-cols-4 gap-4">
|
|
7
8
|
|
|
8
9
|
<div class="col-span-2">
|
|
9
10
|
<label :class="$style.label">Aspect Ratio</label>
|
|
@@ -156,12 +157,11 @@
|
|
|
156
157
|
</div>
|
|
157
158
|
</div>
|
|
158
159
|
|
|
159
|
-
<div class="h-[1px] bg-text-100 my-4"></div>
|
|
160
|
-
|
|
161
160
|
<div v-for="(_, idx) in viewTypes"
|
|
162
161
|
v-show="viewType === _.value">
|
|
163
162
|
<strong class="text-text-400">Spacing</strong>
|
|
164
|
-
<div class="
|
|
163
|
+
<div class="h-[1px] bg-text-100 mt-2 mb-4"></div>
|
|
164
|
+
<div class="grid grid-cols-2 gap-4">
|
|
165
165
|
<div>
|
|
166
166
|
<label :class="$style.label">Padding</label>
|
|
167
167
|
<PaddingSetting v-model="padding[idx]"
|
|
@@ -179,13 +179,11 @@
|
|
|
179
179
|
</div>
|
|
180
180
|
</div>
|
|
181
181
|
|
|
182
|
-
<div class="h-[1px] bg-text-100 my-4"></div>
|
|
183
|
-
|
|
184
182
|
<div>
|
|
185
183
|
<strong class="text-text-400">Sizing</strong>
|
|
184
|
+
<div class="h-[1px] bg-text-100 mt-2 mb-4"></div>
|
|
186
185
|
<div v-for="(_, idx) in viewTypes"
|
|
187
|
-
v-show="viewType === _.value"
|
|
188
|
-
class="mt-4">
|
|
186
|
+
v-show="viewType === _.value">
|
|
189
187
|
<div class="grid grid-cols-2 gap-4">
|
|
190
188
|
|
|
191
189
|
<div class="col-span-2 mt-1 grid grid-cols-3 gap-4">
|
|
@@ -338,11 +336,10 @@
|
|
|
338
336
|
</div>
|
|
339
337
|
</div>
|
|
340
338
|
|
|
341
|
-
<div class="h-[1px] bg-text-100 my-4"></div>
|
|
342
|
-
|
|
343
339
|
<div>
|
|
344
340
|
<strong class="text-text-400">Grid</strong>
|
|
345
|
-
<div class="
|
|
341
|
+
<div class="h-[1px] bg-text-100 mt-2 mb-4"></div>
|
|
342
|
+
<div class="grid grid-cols-2 gap-4">
|
|
346
343
|
<div>
|
|
347
344
|
<label class="flex-1 text-text-400">Column Span</label>
|
|
348
345
|
<Dropdown v-for="(_viewType, index) in viewTypes"
|
|
@@ -367,11 +364,12 @@
|
|
|
367
364
|
</div>
|
|
368
365
|
</div>
|
|
369
366
|
|
|
370
|
-
<div class="h-[1px] bg-text-100 my-4"></div>
|
|
371
|
-
|
|
372
367
|
<div class="flex flex-col gap-4">
|
|
373
368
|
|
|
374
|
-
<
|
|
369
|
+
<div>
|
|
370
|
+
<strong class="flex-1 text-text-400">Background</strong>
|
|
371
|
+
<div class="h-[1px] bg-text-100 mt-2"></div>
|
|
372
|
+
</div>
|
|
375
373
|
|
|
376
374
|
<div class="flex flex-row gap-4">
|
|
377
375
|
<label class="flex-1 text-text-400">Color</label>
|
|
@@ -458,11 +456,12 @@
|
|
|
458
456
|
|
|
459
457
|
</div>
|
|
460
458
|
|
|
461
|
-
<div class="h-[1px] bg-text-100 my-4"></div>
|
|
462
|
-
|
|
463
459
|
<div class="flex flex-col gap-4">
|
|
464
460
|
|
|
465
|
-
<
|
|
461
|
+
<div>
|
|
462
|
+
<strong class="flex-1 text-text-400 mb-4">Border</strong>
|
|
463
|
+
<div class="h-[1px] bg-text-100 mt-2"></div>
|
|
464
|
+
</div>
|
|
466
465
|
|
|
467
466
|
<div class="flex flex-row items-center gap-4">
|
|
468
467
|
<label class="flex-1 text-text-400">Width</label>
|
|
@@ -527,12 +526,10 @@
|
|
|
527
526
|
|
|
528
527
|
</div>
|
|
529
528
|
|
|
530
|
-
<div class="h-[1px] bg-text-100 my-4"></div>
|
|
531
|
-
|
|
532
529
|
<div>
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
<div class="grid grid-cols-2 gap-4
|
|
530
|
+
<strong class="flex-1 text-text-400">Effects</strong>
|
|
531
|
+
<div class="h-[1px] bg-text-100 mt-2 mb-4"></div>
|
|
532
|
+
<div class="grid grid-cols-2 gap-4">
|
|
536
533
|
|
|
537
534
|
<div>
|
|
538
535
|
<label :class="$style.label">Opacity</label>
|
|
@@ -821,7 +818,7 @@ export default{
|
|
|
821
818
|
<style module>
|
|
822
819
|
|
|
823
820
|
.comp{
|
|
824
|
-
@apply flex flex-col gap-
|
|
821
|
+
@apply flex flex-col gap-6;
|
|
825
822
|
}
|
|
826
823
|
|
|
827
824
|
.label{
|
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
<div>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
<div class="flex flex-col gap-6">
|
|
3
|
+
|
|
4
|
+
<div v-if="viewType === ''" class="flex flex-col gap-4">
|
|
5
|
+
|
|
6
|
+
<div class="flex flex-col gap-1">
|
|
7
|
+
<label class="flex-1 text-text-400">Model</label>
|
|
8
|
+
<Dropdown v-model="item.props.variant"
|
|
9
|
+
@change="$emit('change')">
|
|
10
|
+
<option value="Header1">Model 1</option>
|
|
11
|
+
<option value="Header2">Model 2</option>
|
|
12
|
+
</Dropdown>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div>
|
|
16
|
+
<div class="flex flex-row gap-2">
|
|
17
|
+
<label class="text-text-400 flex-1">Logo</label>
|
|
18
|
+
<button type="button" class="text-primary" @click="$refs.image.edit()">Change</button>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="mt-1">
|
|
21
|
+
<div :class="$style.imageBg">
|
|
22
|
+
<Image ref="image" :src="logoSrc" class="w-[100px] min-h-[48px]" :editable="true" @click="$refs.image.edit()"
|
|
23
|
+
@change="setImage" />
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
</div>
|
|
16
29
|
|
|
17
30
|
<ComponentSetting :item="item"
|
|
18
31
|
:view-type="viewType"
|
|
@@ -70,10 +83,6 @@ export default{
|
|
|
70
83
|
|
|
71
84
|
<style module>
|
|
72
85
|
|
|
73
|
-
.comp{
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
86
|
.imageBg{
|
|
78
87
|
@apply p-2 bg-white;
|
|
79
88
|
background-image: radial-gradient(rgba(var(--primary-500)) 1px, transparent 1px);
|