@mixd-id/web-scaffold 0.1.230406300 → 0.1.230406302

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.
Files changed (49) hide show
  1. package/docs/components/Header2.md +16 -0
  2. package/docs/components/TreeView.md +0 -0
  3. package/package.json +2 -2
  4. package/src/components/Carousel.vue +2 -3
  5. package/src/components/Checkbox.vue +1 -0
  6. package/src/components/ErrorText.vue +1 -1
  7. package/src/components/Slider.vue +104 -77
  8. package/src/components/TreeView.vue +20 -59
  9. package/src/components/TreeViewItem.vue +88 -102
  10. package/src/configs/icons-fa.json +12 -0
  11. package/src/index.js +67 -4
  12. package/src/stores/components.js +36 -0
  13. package/src/utils/helpers.js +3 -3
  14. package/src/utils/listpage1.js +2 -2
  15. package/src/utils/listview.js +2 -2
  16. package/src/utils/preset-selector.js +2 -5
  17. package/src/widgets/ArticleSetting.vue +15 -31
  18. package/src/widgets/BackgroundSetting.vue +132 -0
  19. package/src/widgets/BorderSetting.vue +201 -0
  20. package/src/widgets/ButtonSetting.vue +21 -92
  21. package/src/widgets/CarouselSetting.vue +62 -140
  22. package/src/widgets/ComponentPropertyLabel.vue +35 -0
  23. package/src/widgets/ComponentPropertySelector.vue +115 -0
  24. package/src/widgets/ComponentSetting2.vue +1 -3
  25. package/src/widgets/ComponentSetting3.vue +231 -0
  26. package/src/widgets/EffectSetting.vue +94 -0
  27. package/src/widgets/FiltersSetting.vue +88 -0
  28. package/src/widgets/FlexSetting.vue +182 -168
  29. package/src/widgets/GridSetting.vue +97 -260
  30. package/src/widgets/Header1Setting.vue +1 -1
  31. package/src/widgets/Header2.vue +59 -32
  32. package/src/widgets/Header2Setting.vue +108 -210
  33. package/src/widgets/ImageSetting.vue +42 -110
  34. package/src/widgets/LayoutSetting.vue +251 -0
  35. package/src/widgets/MarginPaddingSetting.vue +58 -0
  36. package/src/widgets/MarginSetting.vue +57 -35
  37. package/src/widgets/MenuEditor.vue +256 -0
  38. package/src/widgets/PaddingSetting.vue +53 -31
  39. package/src/widgets/ParagraphSetting.vue +7 -32
  40. package/src/widgets/SizingSetting.vue +306 -0
  41. package/src/widgets/SpacingSetting.vue +77 -0
  42. package/src/widgets/StyleSetting2.vue +90 -0
  43. package/src/widgets/SvgSetting.vue +82 -106
  44. package/src/widgets/TransitionSetting.vue +64 -0
  45. package/src/widgets/TypographySetting.vue +334 -0
  46. package/src/widgets/WebComponentSelector.vue +24 -8
  47. package/src/widgets/WebPageBuilder2.vue +589 -180
  48. package/src/widgets/WebPageBuilder3.vue +626 -0
  49. package/src/widgets/WebPagePreview.vue +295 -0
@@ -0,0 +1,16 @@
1
+ # Header 2
2
+
3
+ ### Properties
4
+ | Name | Type | Default | Description |
5
+ |--------------------------|--------|---------|----------------------------|
6
+ | `logo` | Array | [] | Responsive Array of Object |
7
+ | `logo[].url` | String | | Logo url |
8
+ | `icons` | Array | {} | Responsive Array of Object |
9
+ | `icons[].items` | Array | {} | Array of Object |
10
+ | `icons[].items[].icon` | String | | (required) icon value |
11
+ | `icons[].items[].target` | String | | (required) target value |
12
+ | `icons[].items[].text` | String | route | route, search |
13
+ | `menu[].items[].icon` | String | | svg, image |
14
+ | `menu[].items[].text` | String | | |
15
+ | `menu[].items[].target` | String | | |
16
+ | `menu[].items[].items` | Array | | |
File without changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406300",
4
+ "version": "0.1.230406302",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -45,7 +45,6 @@
45
45
  "cookie-parser": "^1.4.6",
46
46
  "cors": "^2.8.5",
47
47
  "crypto-js": "^4.2.0",
48
- "daisyui": "^2.19.0",
49
48
  "dayjs": "^1.11.2",
50
49
  "eventemitter2": "^6.4.7",
51
50
  "exceljs": "^4.3.0",
@@ -58,6 +57,7 @@
58
57
  "pinia": "^2.0.14",
59
58
  "prismjs": "^1.28.0",
60
59
  "redis": "^4.6.13",
60
+ "sequelize": "^6.37.3",
61
61
  "serve-static": "^1.15.0",
62
62
  "tailwindcss": "^3.2.4",
63
63
  "vue": "^3.2.25",
@@ -35,7 +35,6 @@
35
35
 
36
36
  <script>
37
37
 
38
- import {parseBoolean} from "../utils/helpers.mjs";
39
38
  import {componentMixin} from "../mixin/component";
40
39
 
41
40
  export default{
@@ -55,7 +54,7 @@ export default{
55
54
 
56
55
  autoPlay: [ Number, String ],
57
56
 
58
- useLegend: Boolean
57
+ useLegend: [ Boolean, Number ],
59
58
 
60
59
  },
61
60
 
@@ -161,7 +160,7 @@ export default{
161
160
  let index = this.index + 1
162
161
 
163
162
  if(index >= this.items.length)
164
- index = typeof useBack !== 'undefined' && useBack === true && parseBoolean(this.infinite) ? 0 : this.items.length - 1
163
+ index = useBack === true ? 0 : this.items.length - 1
165
164
 
166
165
  this.index = index
167
166
 
@@ -61,6 +61,7 @@ export default {
61
61
  return this.modelValue.includes(this.value)
62
62
  }
63
63
  else if(this.modelValue){
64
+ console.log(2, this.value, this.modelValue)
64
65
  return this.value === this.modelValue
65
66
  }
66
67
  else{
@@ -13,7 +13,7 @@
13
13
  </div>
14
14
  </div>
15
15
  </div>
16
- <div v-else-if="error.message" class="p-2 bg-base-500">{{ error.message }}</div>
16
+ <div v-else-if="error.message" class="p-2">{{ error.message }}</div>
17
17
  <div v-else>
18
18
 
19
19
  </div>
@@ -1,20 +1,24 @@
1
1
  <template>
2
2
  <div :class="$style.slider">
3
3
 
4
- <div ref="bar"></div>
4
+ <div ref="bar">
5
5
 
6
- <div ref="highlight" :style="{ left:hgLeft + 'px', right:hgRight + 'px' }"></div>
6
+ <div ref="highlight"></div>
7
7
 
8
- <div id="sliderLeft" v-if="mode === 'double'" ref="left" @mousedown.prevent.capture="onMouseDown" @touchstart.passive.capture="onMouseDown"
9
- :style="{ left:l1Left + 'px' }">
10
- <slot name="inner"></slot>
11
- </div>
8
+ <div v-show="mode === 'double'"
9
+ ref="left"
10
+ @mousedown.prevent.capture="onMouseDown"
11
+ @touchstart.passive.capture="onMouseDown">
12
+ <slot name="inner"></slot>
13
+ </div>
12
14
 
13
- <div id="sliderRight" ref="right" @mousedown.prevent.capture="onMouseDown" @touchstart.passive.capture="onMouseDown"
14
- :style="{ left:l2Left + 'px' }">
15
- <slot name="inner"></slot>
16
- </div>
15
+ <div ref="right"
16
+ @mousedown.prevent.capture="onMouseDown"
17
+ @touchstart.passive.capture="onMouseDown">
18
+ <slot name="inner"></slot>
19
+ </div>
17
20
 
21
+ </div>
18
22
  </div>
19
23
  </template>
20
24
 
@@ -24,6 +28,8 @@ export default{
24
28
 
25
29
  props:{
26
30
 
31
+ items: Array,
32
+
27
33
  modelValue:{
28
34
  type: [ String, Number ],
29
35
  default: ''
@@ -53,79 +59,59 @@ export default{
53
59
 
54
60
  computed:{
55
61
 
56
- l1Val(){
57
- if(this.isMounted){
58
- const [ from, to ] = this.modelValue.toString().split('-')
59
- return parseInt(from)
62
+ cItems(){
63
+
64
+ let items = []
65
+
66
+ if(this.items){
67
+ items = this.items
60
68
  }
61
- },
69
+ else{
70
+
71
+ for(let i = this.min ; i <= this.max ; i += this.step){
72
+ items.push(i)
73
+ }
74
+
75
+ if(items[items.length - 1] !== this.max)
76
+ items.push(this.max)
62
77
 
63
- l2Val(){
64
- if(this.isMounted){
65
- const [ from, to ] = this.modelValue.toString().split('-')
66
- return this.mode === 'double' ? (!isNaN(parseInt(to)) ? parseInt(to) : parseInt(from)) : parseInt(from)
67
78
  }
79
+
80
+ return items
81
+
68
82
  },
69
83
 
70
- l1Left(){
84
+ l1Val(){
71
85
  if(this.isMounted){
72
- const min = parseInt(this.min)
73
- const max = this.l2Val
74
- const l1Val = this.l1Val > max ? max : (this.l1Val < min ? min : this.l1Val)
75
- return (Math.round((l1Val - parseInt(this.min)) / parseInt(this.step))) * this.stepDistance
86
+ const [ from, to ] = this.modelValue.toString().split('-')
87
+ return parseInt(from)
76
88
  }
77
89
  },
78
90
 
79
- l2Left(){
80
- if(this.isMounted){
81
- const min = this.l1Val ? this.l1Val : parseInt(this.min)
82
- const max = parseInt(this.max)
83
- const l2Val = this.l2Val > max ? max : (this.l2Val < min ? min : this.l2Val)
84
-
85
- return (Math.round((l2Val - parseInt(this.min)) / parseInt(this.step))) * this.stepDistance
86
- }
91
+ l1Index(){
92
+ return this.cItems.indexOf(this.l1Val)
87
93
  },
88
94
 
89
- hgLeft(){
90
- if(this.isMounted){
91
- if (this.mode === 'double') {
92
- const min = parseInt(this.min)
93
- const max = this.l2Val
94
- const l1Val = this.l1Val > max ? max : (this.l1Val < min ? min : this.l1Val)
95
- return (Math.round((l1Val - parseInt(this.min)) / parseInt(this.step))) * this.stepDistance
96
- }
97
- else {
98
- return 0
99
- }
100
- }
95
+ l2Index(){
96
+ return this.cItems.indexOf(this.l2Val)
101
97
  },
102
98
 
103
- hgRight(){
99
+ l2Val(){
104
100
  if(this.isMounted){
105
- if(this.mode === 'double'){
106
- return this.rootWidth - (Math.round(this.l2Left + (this.$refs.right.clientWidth / 2)))
107
- }
108
- else{
109
- return this.rootWidth - (Math.round(this.l2Left + (this.$refs.right.clientWidth / 2)))
110
- }
101
+ const [ from, to ] = this.modelValue.toString().split('-')
102
+ return this.mode === 'double' ? (!isNaN(parseInt(to)) ? parseInt(to) : parseInt(from)) : parseInt(from)
111
103
  }
112
104
  },
113
105
 
114
- trackWidth(){
115
- if(this.isMounted)
116
- return this.rootWidth - this.$refs.right.clientWidth
117
- },
106
+
118
107
 
119
108
  stepDistance(){
120
109
  if(this.isMounted){
121
- const min = parseInt(this.min)
122
- const max = parseInt(this.max)
123
- const step = parseInt(this.step)
124
- const totalStep = (max - min) / step
125
- return this.trackWidth / totalStep
110
+ return this.$refs.bar.clientWidth / this.cItems.length
126
111
  }
127
112
  return 0
128
- }
113
+ },
114
+
129
115
 
130
116
  },
131
117
 
@@ -134,6 +120,11 @@ export default{
134
120
  isMounted: 0,
135
121
  rootWidth: 0,
136
122
  startValue: null, // Mouse down start value
123
+ startIndex: null,
124
+ l1LeftPx: '',
125
+ l2LeftPx: '',
126
+ hgLeftPx: '',
127
+ hgRightPx: '',
137
128
  }
138
129
  },
139
130
 
@@ -142,10 +133,30 @@ export default{
142
133
  mounted(){
143
134
  this.rootWidth = this.$el.clientWidth
144
135
  this.isMounted = 1
136
+ this.paint()
145
137
  },
146
138
 
147
139
  methods:{
148
140
 
141
+ paint(){
142
+ if(!this.isMounted) return
143
+
144
+ const barWidth = this.$refs.bar.clientWidth
145
+ const stepWidth = Math.round(barWidth / (this.cItems.length - 1))
146
+ const l1Left = Math.round(this.l1Index * stepWidth)
147
+
148
+ const buttonHalfWidth = this.$refs.right.clientWidth / 2
149
+
150
+ let l2Left = Math.round((this.l2Index * stepWidth) - buttonHalfWidth)
151
+ if(l2Left > barWidth - buttonHalfWidth)
152
+ l2Left = barWidth - buttonHalfWidth
153
+
154
+ this.l1LeftPx = l1Left + "px"
155
+ this.l2LeftPx = l2Left + "px"
156
+ this.hgLeftPx = 0
157
+ this.hgRightPx = (barWidth - l2Left - buttonHalfWidth) + "px"
158
+ },
159
+
149
160
  valueFromDistance(distance, startValue){
150
161
  const stepCount = Math.round(Math.abs(distance) / this.stepDistance)
151
162
  return startValue + (stepCount * this.step) * (distance > 0 ? 1 : -1)
@@ -183,8 +194,10 @@ export default{
183
194
  }
184
195
  }
185
196
  else{
186
- let value = this.valueFromDistance(distance, this.startValue)
187
- if(value !== this.modelValue && value >= parseInt(this.min) && value <= parseInt(this.max)){
197
+ const increment = Math.round(distance / this.stepDistance)
198
+ const nextIndex = this.startIndex + increment
199
+ const value = this.cItems[nextIndex]
200
+ if(value && value !== this.modelValue){
188
201
  this.$emit('update:modelValue', value)
189
202
  }
190
203
  }
@@ -225,15 +238,9 @@ export default{
225
238
  window.removeEventListener('touchmove', this.onMouseMove)
226
239
  window.removeEventListener('touchend', this.onMouseUp)
227
240
 
228
- this.$refs[this.current].style.left = ((this.current === 'left' ? this.l1Left : this.l2Left)) + "px"
229
-
230
- this.$refs.highlight.style.left = (this.hgLeft) + "px"
231
- this.$refs.highlight.style.right = (this.hgRight) + "px"
232
-
233
241
  if(this.modelValue !== this.startValue){
234
242
  this.$emit('change')
235
243
  }
236
-
237
244
  this.startValue = null
238
245
  },
239
246
 
@@ -241,14 +248,25 @@ export default{
241
248
 
242
249
  this.current = e.target === this.$refs.right ? 'right' : 'left'
243
250
  this.startX = typeof e.touches !== 'undefined' ? e.touches[0].clientX : e.clientX
244
- this.startLeft = parseInt(this.$refs[this.current].style.left)
245
251
  this.startValue = this.modelValue
252
+ this.startIndex = this.l2Index
246
253
 
247
254
  window.addEventListener('mousemove', this.onMouseMove)
248
255
  window.addEventListener('mouseup', this.onMouseUp)
249
256
  window.addEventListener('touchmove', this.onMouseMove)
250
257
  window.addEventListener('touchend', this.onMouseUp, { passive:true })
251
258
  }
259
+ },
260
+
261
+ watch: {
262
+
263
+ l2Index: {
264
+ handler(){
265
+ this.paint()
266
+ },
267
+ immediate: true
268
+ }
269
+
252
270
  }
253
271
 
254
272
  }
@@ -259,27 +277,28 @@ export default{
259
277
 
260
278
  .slider{
261
279
  @apply h-[var(--h-cp)];
262
- @apply relative;
263
280
  }
264
281
 
265
282
  .slider>div:nth-child(1){
266
- @apply absolute bg-text-50 rounded-lg;
283
+ @apply relative bg-text-50 rounded-lg;
267
284
  height: .5rem;
268
285
  top: 50%;
269
- left: .75rem;
270
- right: .75rem;
286
+ margin-left: 1.25rem;
287
+ margin-right: 1.25rem;
271
288
  transform: translate3d(0, -50%, 0);
272
289
  }
273
290
 
274
- .slider>div:nth-child(2){
291
+ .slider>div:nth-child(1)>div:nth-child(1){
275
292
  @apply absolute bg-primary rounded-lg;
276
293
  height: .5rem;
277
294
  top: 50%;
295
+ left: v-bind(hgLeftPx);
296
+ right: v-bind(hgRightPx);
278
297
  transform: translate3d(0, -50%, 0);
279
298
  }
280
299
 
281
- .slider>div:nth-child(3),
282
- .slider>div:nth-child(4){
300
+ .slider>div:nth-child(1)>div:nth-child(2),
301
+ .slider>div:nth-child(1)>div:nth-child(3){
283
302
  @apply absolute w-[2.5rem] h-[2.5rem] rounded-full bg-white shadow-sm border-[1px] border-text-200;
284
303
  @apply flex;
285
304
  top: 50%;
@@ -287,4 +306,12 @@ export default{
287
306
  touch-action: none;
288
307
  }
289
308
 
309
+ .slider>div:nth-child(1)>div:nth-child(2){
310
+ left: v-bind(l1LeftPx)
311
+ }
312
+
313
+ .slider>div:nth-child(1)>div:nth-child(3){
314
+ left: v-bind(l2LeftPx)
315
+ }
316
+
290
317
  </style>
@@ -1,17 +1,16 @@
1
1
  <template>
2
2
  <div :class="$style.comp">
3
3
 
4
- <TreeViewItem v-for="(item, index) in modelValue"
4
+ <TreeViewItem v-for="(item, index) in items"
5
5
  :item="item"
6
- :parent="modelValue"
7
- :selected-item="selectedItem"
8
- @moveup="moveUp(item)"
9
- @movedown="moveDown(item)"
10
- @change="$emit('change')"
11
- @remove="confirm({ title:$t('Remove this item?'), onConfirm: () => { modelValue.splice(index, 1);$emit('change') }})"
12
- @add="(items) => $emit('add', items)">
13
- <template #default="{ item, parent }">
14
- <slot :item="item" :parent="parent"></slot>
6
+ :selectedItem="selectedItem"
7
+ :index="index"
8
+ :parent="parent"
9
+ :config="config"
10
+ :depth="0"
11
+ @change="$emit('change')">
12
+ <template #default="{ item, parent, index, depth }">
13
+ <slot :item="item" :parent="parent" :index="index" :depth="depth"></slot>
15
14
  </template>
16
15
  </TreeViewItem>
17
16
 
@@ -27,67 +26,29 @@ export default{
27
26
 
28
27
  components: {TreeViewItem},
29
28
 
30
- emits: [ 'add', 'change', 'paste' ],
29
+ emits: [ 'change' ],
31
30
 
32
31
  inject: [ 'confirm', 'toast' ],
33
32
 
34
33
  props: {
35
34
 
36
- modelValue: Array,
35
+ items: Array,
37
36
 
38
- selectedItem: Object
37
+ selectedItem: Object,
39
38
 
40
- },
41
-
42
- methods: {
43
-
44
- copy(){
45
- if(this.selectedItem){
46
- copyToClipboard(JSON.stringify(this.selectedItem))
47
- .then(() => this.toast('Copied to clipboard'))
48
- }
49
- },
50
-
51
- paste(){
52
- getClipboardData().then(text => {
53
- try{
54
- const item = JSON.parse(text)
55
- this.$emit('paste', item)
56
- }
57
- catch(e){}
58
- })
59
- },
60
-
61
- moveDown(item){
62
- const idx = this.modelValue.indexOf(item)
63
- if(idx < this.modelValue.length - 1){
64
- this.modelValue.splice(idx + 1, 0, this.modelValue.splice(idx, 1)[0])
65
- this.$emit('change')
66
- }
67
- },
68
-
69
- moveUp(item){
70
- const idx = this.modelValue.indexOf(item)
71
- if(idx - 1 >= 0){
72
- this.modelValue.splice(idx - 1, 0, this.modelValue.splice(idx, 1)[0])
73
- this.$emit('change')
74
- }
75
- },
76
-
77
- add(){
78
- this.$emit('add', this.modelValue)
79
- },
80
-
81
- },
39
+ config: Object,
82
40
 
83
- mounted() {
84
- window.addEventListener('keydown', this.onKeyUp)
85
41
  },
86
42
 
87
- watch: {
43
+ computed: {
88
44
 
45
+ parent(){
46
+ return {
47
+ items: this.items
48
+ }
49
+ }
89
50
 
90
- }
51
+ },
91
52
 
92
53
  }
93
54