@mixd-id/web-scaffold 0.1.230406311 → 0.1.230406313

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 (62) hide show
  1. package/package.json +1 -1
  2. package/src/App.vue +9 -1
  3. package/src/components/Carousel.vue +3 -3
  4. package/src/components/ColorPicker2.vue +1 -1
  5. package/src/components/Image.vue +5 -3
  6. package/src/components/List.vue +48 -13
  7. package/src/components/Modal.vue +2 -2
  8. package/src/components/Text.vue +34 -0
  9. package/src/components/Textbox.vue +1 -1
  10. package/src/components/VirtualTable.vue +124 -95
  11. package/src/index.js +22 -38
  12. package/src/main.js +0 -9
  13. package/src/mixin/component.js +2 -1
  14. package/src/utils/preset-selector.js +53 -24
  15. package/src/utils/preset-selector.mjs +21 -1
  16. package/src/utils/wss.js +6 -1
  17. package/src/utils/wss.mjs +2 -2
  18. package/src/widgets/PresetBar.vue +6 -0
  19. package/src/widgets/WebPageBuilder3.vue +3 -218
  20. package/src/widgets/WebPageBuilder4/BackgroundColorSetting.vue +54 -0
  21. package/src/widgets/WebPageBuilder4/BackgroundPositionSetting.vue +75 -0
  22. package/src/widgets/WebPageBuilder4/BackgroundRepeatSetting.vue +72 -0
  23. package/src/widgets/WebPageBuilder4/BackgroundSizeSetting.vue +72 -0
  24. package/src/widgets/WebPageBuilder4/BlurSetting.vue +72 -0
  25. package/src/widgets/WebPageBuilder4/BorderColorSetting.vue +64 -0
  26. package/src/widgets/WebPageBuilder4/BorderRadiusSetting.vue +75 -0
  27. package/src/widgets/WebPageBuilder4/BorderSizeSetting.vue +69 -0
  28. package/src/widgets/WebPageBuilder4/BorderStyleSetting.vue +72 -0
  29. package/src/widgets/WebPageBuilder4/BoxShadowSetting.vue +73 -0
  30. package/src/widgets/WebPageBuilder4/ButtonSetting.vue +65 -0
  31. package/src/widgets/WebPageBuilder4/CarouselSetting.vue +178 -0
  32. package/src/widgets/WebPageBuilder4/DisplaySetting.vue +76 -0
  33. package/src/widgets/WebPageBuilder4/FlexAlignSetting.vue +71 -0
  34. package/src/widgets/WebPageBuilder4/FlexDirectionSetting.vue +70 -0
  35. package/src/widgets/WebPageBuilder4/FlexJustifySetting.vue +74 -0
  36. package/src/widgets/WebPageBuilder4/FlexPropertySetting.vue +71 -0
  37. package/src/widgets/WebPageBuilder4/FlexSetting.vue +96 -0
  38. package/src/widgets/WebPageBuilder4/FlexWrapSetting.vue +69 -0
  39. package/src/widgets/WebPageBuilder4/GapSetting.vue +75 -0
  40. package/src/widgets/WebPageBuilder4/GrayscaleSetting.vue +68 -0
  41. package/src/widgets/WebPageBuilder4/GridSetting.vue +166 -0
  42. package/src/widgets/WebPageBuilder4/HeightSetting.vue +95 -0
  43. package/src/widgets/WebPageBuilder4/ImageSetting.vue +102 -0
  44. package/src/widgets/WebPageBuilder4/MarginSetting.vue +64 -0
  45. package/src/widgets/WebPageBuilder4/MaxHeightSetting.vue +82 -0
  46. package/src/widgets/WebPageBuilder4/MaxWidthSetting.vue +90 -0
  47. package/src/widgets/WebPageBuilder4/MinHeightSetting.vue +81 -0
  48. package/src/widgets/WebPageBuilder4/MinWidthSetting.vue +101 -0
  49. package/src/widgets/WebPageBuilder4/MultiValueSetting.vue +155 -0
  50. package/src/widgets/WebPageBuilder4/OpacitySetting.vue +77 -0
  51. package/src/widgets/WebPageBuilder4/OverflowSetting.vue +81 -0
  52. package/src/widgets/WebPageBuilder4/PaddingSetting.vue +53 -0
  53. package/src/widgets/WebPageBuilder4/PositionSetting.vue +191 -0
  54. package/src/widgets/WebPageBuilder4/PropertySetting.vue +176 -0
  55. package/src/widgets/WebPageBuilder4/TextSetting.vue +72 -0
  56. package/src/widgets/WebPageBuilder4/TreeView.vue +43 -0
  57. package/src/widgets/WebPageBuilder4/TreeViewItem.vue +298 -0
  58. package/src/widgets/WebPageBuilder4/WebPageComponentSelector.vue +141 -0
  59. package/src/widgets/WebPageBuilder4/WebPagePropertySelector.vue +172 -0
  60. package/src/widgets/WebPageBuilder4/WidthSetting.vue +105 -0
  61. package/src/widgets/WebPageBuilder4/ZIndexSetting.vue +72 -0
  62. package/src/widgets/WebPageBuilder4.vue +798 -0
@@ -2,14 +2,17 @@ const groupBy = require("lodash/groupBy");
2
2
  const dayjs = require("dayjs");
3
3
  const {Op, literal, fn, DataTypes} = require("sequelize");
4
4
  const {ftWildcard} = require("./helpers");
5
+ const util = require("util");
5
6
 
6
7
  const getValue = (filter, opt) => {
7
8
 
8
9
  const { columns, withoutKey = false } = opt
9
- const { key, operator } = filter
10
+ const { key, operator, fn } = filter
10
11
  const keyColumns = groupBy(columns, 'key')
11
12
  const type = ((keyColumns[key] ?? [])[0] ?? {}).type
12
13
 
14
+ console.log('fn', fn)
15
+
13
16
  let whereObj = {}
14
17
 
15
18
  switch(type){
@@ -213,17 +216,26 @@ const getValue = (filter, opt) => {
213
216
  break
214
217
 
215
218
  case '<=':
216
- withoutKey ?
217
- whereObj = {
218
- [Op.lte]: [
219
- dayjs(filter.value).format('YYYY-MM-DD 23:59:59'),
220
- ]
221
- } :
222
- whereObj[key] = {
223
- [Op.lte]: [
224
- dayjs(filter.value).format('YYYY-MM-DD 23:59:59'),
225
- ]
226
- }
219
+ switch(fn){
220
+
221
+ case 'format_hour':
222
+ //console.log('<=', filter.value)
223
+ break
224
+
225
+ default:
226
+ withoutKey ?
227
+ whereObj = {
228
+ [Op.lte]: [
229
+ dayjs(filter.value).format('YYYY-MM-DD 23:59:59'),
230
+ ]
231
+ } :
232
+ whereObj[key] = {
233
+ [Op.lte]: [
234
+ dayjs(filter.value).format('YYYY-MM-DD 23:59:59'),
235
+ ]
236
+ }
237
+ }
238
+
227
239
  break
228
240
 
229
241
  case '=':
@@ -257,17 +269,25 @@ const getValue = (filter, opt) => {
257
269
  break
258
270
 
259
271
  case '>=':
260
- withoutKey ?
261
- whereObj = {
262
- [Op.gte]: [
263
- dayjs(filter.value).format('YYYY-MM-DD 00:00:00'),
264
- ]
265
- } :
266
- whereObj[key] = {
267
- [Op.gte]: [
268
- dayjs(filter.value).format('YYYY-MM-DD 00:00:00'),
269
- ]
270
- }
272
+ switch(fn) {
273
+
274
+ case 'format_hour':
275
+ //console.log('>=', filter.value)
276
+ break
277
+
278
+ default:
279
+ withoutKey ?
280
+ whereObj = {
281
+ [Op.gte]: [
282
+ dayjs(filter.value).format('YYYY-MM-DD 00:00:00'),
283
+ ]
284
+ } :
285
+ whereObj[key] = {
286
+ [Op.gte]: [
287
+ dayjs(filter.value).format('YYYY-MM-DD 00:00:00'),
288
+ ]
289
+ }
290
+ }
271
291
  break
272
292
 
273
293
  }
@@ -724,6 +744,12 @@ const pivotToSequelizeWhere = async (pivot, opt) => {
724
744
  if(!sortExists) order.push([ fn('DATE_FORMAT', literal(`${model.name}.${field}`), '%Y'), 'asc' ])
725
745
  break
726
746
 
747
+ case 'hour':
748
+ attributes.push([ fn('DATE_FORMAT', literal(`${model.name}.${field}`), '%H:00-%H:59'), row.key ])
749
+ group.push([ fn('DATE_FORMAT', literal(`${model.name}.${field}`), '%H:00-%H:59'), row.key ])
750
+ if(!sortExists) order.push([ fn('DATE_FORMAT', literal(`${model.name}.${field}`), '%H:00-%H:59'), 'asc' ])
751
+ break
752
+
727
753
  default:
728
754
  attributes.push([ literal(`${model.name}.${field}`), row.key ])
729
755
  group.push(`${model.name}.${field}`)
@@ -995,7 +1021,10 @@ const presetToSequelizeList = async(preset, {
995
1021
  searchReplacements = syntaxSearchOpt.replacements
996
1022
  }
997
1023
  else{
998
- const match = (config.columns ?? []).filter(_ => (_.search && _.key)).map(_ => _.key)
1024
+ const match = (config.columns ?? [])
1025
+ .filter(_ => (_.search && _.key))
1026
+ .map(_ => typeof _.search === 'string' ? _.search : _.key)
1027
+
999
1028
  if(match !== null){
1000
1029
  const searchOpt = await searchToSequelizeWhere(search, {
1001
1030
  match
@@ -157,9 +157,29 @@ const generatePivotColumns = (preset, items) => {
157
157
 
158
158
  }
159
159
 
160
+ const generateTotalColumns = (preset, items) => {
161
+ if(!preset.pivot || !preset.pivot.enabled || !preset.pivot.useTotal || (items ?? []).length < 1) return
162
+
163
+ const totalItem = { _type:'totalRow' }
164
+
165
+ for(let item of items){
166
+ for(let key in item){
167
+ if(key.startsWith('_')){
168
+ if(!totalItem[key]){
169
+ totalItem[key] = 0
170
+ }
171
+ totalItem[key] += parseFloat(item[key])
172
+ }
173
+ }
174
+ }
175
+
176
+ items.push(totalItem)
177
+ }
178
+
160
179
  export {
161
180
  sortsFn,
162
181
  pickColumns,
163
182
  setupConfig,
164
- generatePivotColumns
183
+ generatePivotColumns,
184
+ generateTotalColumns
165
185
  }
package/src/utils/wss.js CHANGED
@@ -97,7 +97,12 @@ class WSS extends EventEmitter2{
97
97
  this._opt = opt
98
98
  this._instance = new WebSocket.Server(opt);
99
99
 
100
- this._client = redis.createClient()
100
+ this._client = redis.createClient({
101
+ socket: {
102
+ host: process.env.REDIS_HOST ?? '127.0.0.1',
103
+ port: process.env.REDIS_PORT ?? 6379
104
+ }
105
+ })
101
106
  this._client.connect().then()
102
107
 
103
108
  this._instance.on('connection', async (socket, req) => {
package/src/utils/wss.mjs CHANGED
@@ -128,8 +128,8 @@ class WSS extends EventEmitter2{
128
128
 
129
129
  if(this._opt.debug){
130
130
  status === 200 ?
131
- console.log(new Date().getTime() - t1, path, params, data) :
132
- console.error(new Date().getTime() - t1, path, params, data)
131
+ console.log(`${new Date().getTime() - t1}ms`, `l:${JSON.stringify(data ?? '').length}`, path, params, data) :
132
+ console.error(`${new Date().getTime() - t1}ms`, `l:${JSON.stringify(data ?? '').length}`, path, params, data)
133
133
  }
134
134
  }
135
135
  }
@@ -490,6 +490,7 @@
490
490
  v-model="item.aggregrate"
491
491
  class="px-1 appearance-none bg-base-300 rounded-md border-[1px] border-text-50 outline-none"
492
492
  @change="apply()">
493
+ <option value="hour">Hour</option>
493
494
  <option value="date">Date</option>
494
495
  <option value="month">Month</option>
495
496
  <option value="year">Year</option>
@@ -578,6 +579,11 @@
578
579
  <PresetBarPivotColumnEdit ref="presetBarPivotColumnEdit" />
579
580
  </div>
580
581
 
582
+ <div class="flex flex-row items-center gap-3">
583
+ <label>Total</label>
584
+ <Switch v-model="presetPivot.useTotal" />
585
+ </div>
586
+
581
587
  </div>
582
588
 
583
589
  </div>
@@ -1,222 +1,7 @@
1
1
  <template>
2
- <div :class="$style.comp" v-if="page">
3
-
4
- <div class="flex flex-row p-3 pr-5 bg-base-300 border-b-[1px] border-text-50">
5
- <div class="flex-1 flex flex-row gap-4 items-center">
6
-
7
- <button ref="close" class=" p-1"
8
- @click="close">
9
- <svg class="fill-text-300 hover:fill-red-500" width="18" height="18" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>
10
- </button>
11
-
12
- <h5 class="mr-5 w-[200px] text-ellipsis whitespace-nowrap overflow-hidden">
13
- {{ page.title }}
14
- </h5>
15
-
16
- </div>
17
-
18
- <div>
19
- <Button ref="saveBtn"
20
- class="w-[70px] rounded-full p-1"
21
- :state="canSave ? 1 : -1"
22
- @click="save">{{ $t('Save') }}</Button>
23
- </div>
24
- </div>
25
-
26
- <div class="flex-1 flex flex-row">
27
-
28
- <div class="flex flex-row bg-base-400 dark:bg-base-300 border-r-[1px] border-text-50"
29
- :style="section1Style">
30
-
31
- <div class="flex-1 overflow-y-auto">
32
- <div class="px-3 flex flex-col border-b-[1px] border-text-50 overflow-x-auto">
33
- <Tabs :items="tabItems"
34
- class="pt-1"
35
- v-model="config.leftbarTabIndex" />
36
- </div>
37
-
38
- <div v-if="config.leftbarTabIndex === 2" class="p-5">
39
- <div>
40
- <div class="flex flex-row gap-1 items-center cursor-pointer">
41
- <strong class="flex-1 text-text-400 line-clamp-1">{{ $t('Headers')}}</strong>
42
- <button type="button" class="text-primary flex flex-row items-center gap-1"
43
- @click="$refs.webPageComponentSelector.open(comp => addComponent(layout.headers, comp))">
44
- <svg width="16" height="16" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M376 232H216V72c0-4.42-3.58-8-8-8h-32c-4.42 0-8 3.58-8 8v160H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h160v160c0 4.42 3.58 8 8 8h32c4.42 0 8-3.58 8-8V280h160c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z"/></svg>
45
- {{ $t('Add')}}
46
- </button>
47
- </div>
48
-
49
- <div class="flex flex-col gap-10">
50
- <TreeView class="mt-2"
51
- :config="config"
52
- :items="layout.headers"
53
- :selected-item="currentItem"
54
- @change="">
55
- <template #default="{ item, index, parent, depth }">
56
- <div class="flex-1 flex flex-row gap-2">
57
- <div class="flex-1 text-ellipsis whitespace-nowrap overflow-hidden"
58
- :class="!item.props.enabled ? 'line-through' : ''"
59
- @click="config.selectedComponent = item.uid">
60
- {{ item.props.name ?? item.type }}
61
- </div>
62
- <button v-if="Array.isArray(item.items)"
63
- type="button"
64
- @click="$refs.webPageComponentSelector.open(comp => addComponent(item.items, comp))">
65
- <svg width="14" height="14" class="fill-text-300 hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M432 256C432 269.3 421.3 280 408 280h-160v160c0 13.25-10.75 24.01-24 24.01S200 453.3 200 440v-160h-160c-13.25 0-24-10.74-24-23.99C16 242.8 26.75 232 40 232h160v-160c0-13.25 10.75-23.99 24-23.99S248 58.75 248 72v160h160C421.3 232 432 242.8 432 256z"/></svg>
66
- </button>
67
- <button type="button" @click="parent ? parent.items.splice(index, 1) : layout.headers.splice(index, 1)">
68
- <svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z"/></svg>
69
- </button>
70
- </div>
71
- </template>
72
- </TreeView>
73
- </div>
74
- </div>
75
-
76
- <div>
77
- <div class="flex flex-row gap-1 items-center cursor-pointer">
78
- <strong class="flex-1 text-text-400 line-clamp-1">{{ $t('Footers')}}</strong>
79
- <button type="button" class="text-primary flex flex-row items-center gap-1"
80
- @click="$refs.webPageComponentSelector.open(comp => addComponent(layout.footers, comp))">
81
- <svg width="16" height="16" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M376 232H216V72c0-4.42-3.58-8-8-8h-32c-4.42 0-8 3.58-8 8v160H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h160v160c0 4.42 3.58 8 8 8h32c4.42 0 8-3.58 8-8V280h160c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z"/></svg>
82
- {{ $t('Add')}}
83
- </button>
84
- </div>
85
-
86
- <div class="flex flex-col gap-10">
87
- <TreeView class="mt-2"
88
- :config="config"
89
- :items="layout.footers"
90
- :selected-item="currentItem"
91
- @change="">
92
- <template #default="{ item, index, parent, depth }">
93
- <div class="flex-1 flex flex-row gap-2">
94
- <div class="flex-1 text-ellipsis whitespace-nowrap overflow-hidden"
95
- :class="!item.props.enabled ? 'line-through' : ''"
96
- @click="config.selectedComponent = item.uid">
97
- {{ item.props.name ?? item.type }}
98
- </div>
99
- <button v-if="Array.isArray(item.items)"
100
- type="button"
101
- @click="$refs.webPageComponentSelector.open(comp => addComponent(item.items, comp))">
102
- <svg width="14" height="14" class="fill-text-300 hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M432 256C432 269.3 421.3 280 408 280h-160v160c0 13.25-10.75 24.01-24 24.01S200 453.3 200 440v-160h-160c-13.25 0-24-10.74-24-23.99C16 242.8 26.75 232 40 232h160v-160c0-13.25 10.75-23.99 24-23.99S248 58.75 248 72v160h160C421.3 232 432 242.8 432 256z"/></svg>
103
- </button>
104
- <button type="button" @click="parent ? parent.items.splice(index, 1) : layout.footers.splice(index, 1)">
105
- <svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z"/></svg>
106
- </button>
107
- </div>
108
- </template>
109
- </TreeView>
110
- </div>
111
- </div>
112
-
113
- <div>
114
- <div class="flex flex-row gap-1 items-center cursor-pointer">
115
- <strong class="flex-1 text-text-400 line-clamp-1">{{ $t('Styles')}}</strong>
116
- <button type="button" class="text-primary flex flex-row items-center gap-1"
117
- @click="">
118
- <svg width="16" height="16" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M376 232H216V72c0-4.42-3.58-8-8-8h-32c-4.42 0-8 3.58-8 8v160H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h160v160c0 4.42 3.58 8 8 8h32c4.42 0 8-3.58 8-8V280h160c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z"/></svg>
119
- {{ $t('Add')}}
120
- </button>
121
- </div>
122
- <TreeView class="mt-2"
123
- :items="styles"
124
- :selected-item="currentItem"
125
- :config="config"
126
- @change="">
127
- <template #default="{ item, index, parent, depth }">
128
- <div class="flex-1 flex flex-row gap-2">
129
- <div class="flex-1 text-ellipsis whitespace-nowrap overflow-hidden"
130
- @click="config.selectedComponent = item.uid">
131
- {{ item.props.name ?? item.type }}
132
- </div>
133
- </div>
134
- </template>
135
- </TreeView>
136
- </div>
137
- </div>
138
-
139
- <div v-else-if="config.leftbarTabIndex === 3" class="p-5">
140
- <div class="flex flex-row gap-1 items-center cursor-pointer">
141
- <strong class="flex-1 text-text-400 line-clamp-1">{{ $t('Components')}}</strong>
142
- <button type="button" class="text-primary flex flex-row items-center gap-1"
143
- @click="$refs.webPageComponentSelector.open(comp => addComponent(page.components, comp))">
144
- <svg width="16" height="16" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M376 232H216V72c0-4.42-3.58-8-8-8h-32c-4.42 0-8 3.58-8 8v160H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h160v160c0 4.42 3.58 8 8 8h32c4.42 0 8-3.58 8-8V280h160c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z"/></svg>
145
- {{ $t('Add')}}
146
- </button>
147
- </div>
148
-
149
- <TreeView class="mt-2"
150
- :items="page.components"
151
- :selected-item="currentItem"
152
- :config="config"
153
- @change="">
154
- <template #default="{ item, index, parent, depth }">
155
- <div class="flex-1 flex flex-row gap-2">
156
- <div class="flex-1 text-ellipsis whitespace-nowrap overflow-hidden"
157
- :class="!item.props.enabled ? 'line-through' : ''"
158
- @click="config.selectedComponent = item.uid">
159
- {{ item.props.name ?? item.type }}
160
- </div>
161
- <button v-if="Array.isArray(item.items)"
162
- type="button"
163
- @click="$refs.webPageComponentSelector.open(comp => addComponent(item.items, comp))">
164
- <svg width="14" height="14" class="fill-text-300 hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M432 256C432 269.3 421.3 280 408 280h-160v160c0 13.25-10.75 24.01-24 24.01S200 453.3 200 440v-160h-160c-13.25 0-24-10.74-24-23.99C16 242.8 26.75 232 40 232h160v-160c0-13.25 10.75-23.99 24-23.99S248 58.75 248 72v160h160C421.3 232 432 242.8 432 256z"/></svg>
165
- </button>
166
- <button type="button" @click="parent ? parent.items.splice(index, 1) : page.components.splice(index, 1)">
167
- <svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z"/></svg>
168
- </button>
169
- </div>
170
- </template>
171
- </TreeView>
172
- </div>
173
-
174
- <WebComponentSelector ref="webPageComponentSelector"
175
- :components="components"
176
- dismissable="true"
177
- @dismiss="$refs.webPageComponentSelector.close()" />
178
- </div>
179
-
180
- <div :class="$style.resize1"
181
- @mousedown="(e) => $util.dragResize(e, resize1)"></div>
182
-
183
- </div>
184
-
185
- <div class="flex-1 flex flex-col bg-base-300 dark:bg-base-400 relative">
186
-
187
- <WebPagePreview :config="config"
188
- :page="page"
189
- class="flex-1"
190
- ref="preview"
191
- @message="onIframeMessage" />
192
-
193
- </div>
194
-
195
- <div v-if="currentItem" class="flex flex-row bg-base-400 dark:bg-base-300 border-l-[1px] border-text-50"
196
- :style="section3Style">
197
-
198
- <div :class="$style.resize3"
199
- @mousedown="(e) => $util.dragResize(e, resize3)"></div>
200
-
201
- <div class="flex-1 flex flex-col gap-6 overflow-y-auto">
202
-
203
- <StyleSetting2 v-if="currentItem.type.startsWith('style:')"
204
- :item="currentItem"
205
- :config="config"
206
- ref="settingComponent" />
207
-
208
- <ComponentSetting3 v-else
209
- :item="currentItem"
210
- :config="config"
211
- ref="settingComponent" />
212
-
213
- </div>
214
-
215
- </div>
216
-
217
- </div>
218
-
219
- </div>
2
+ <div>
3
+ <h1>Web Page Builder 3</h1>
4
+ </div>
220
5
  </template>
221
6
 
222
7
  <script>
@@ -0,0 +1,54 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+ <div class="flex flex-row items-center">
4
+ <label class="flex-1">Background Color</label>
5
+ <ColorPicker2 v-model="bgColors[index]" :prefix="viewType" />
6
+ </div>
7
+ </div>
8
+ </template>
9
+
10
+ <script>
11
+
12
+ export default{
13
+
14
+ inject: [ 'viewTypes' ],
15
+
16
+ props: {
17
+
18
+ index: {
19
+ type: Number,
20
+ required: true
21
+ },
22
+
23
+ value: {
24
+ type: Object,
25
+ required: true
26
+ },
27
+
28
+ viewType: {
29
+ type: String,
30
+ required: true
31
+ },
32
+
33
+ },
34
+
35
+ computed: {
36
+
37
+ bgColors(){
38
+ if(!Array.isArray(this.value.props.bgColors))
39
+ this.value.props.bgColors = this.viewTypes.map(_ => '')
40
+ return this.value.props.bgColors
41
+ }
42
+
43
+ }
44
+
45
+ }
46
+
47
+ </script>
48
+
49
+ <style module>
50
+
51
+ .comp{
52
+ }
53
+
54
+ </style>
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+ <div class="flex flex-row items-center">
4
+ <label class="flex-1">Background Position</label>
5
+ <Dropdown v-model="bgPosition[index]">
6
+ <option value="">Unset</option>
7
+ <option v-for="value in values" :value="`${viewType}${value[0]}`">
8
+ {{ value[1] }}
9
+ </option>
10
+ </Dropdown>
11
+ </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+
17
+ export default{
18
+
19
+ inject: [ 'viewTypes' ],
20
+
21
+ props: {
22
+
23
+ index: {
24
+ type: Number,
25
+ required: true
26
+ },
27
+
28
+ value: {
29
+ type: Object,
30
+ required: true
31
+ },
32
+
33
+ viewType: {
34
+ type: String,
35
+ required: true
36
+ },
37
+
38
+ },
39
+
40
+ computed: {
41
+
42
+ bgPosition(){
43
+ if(!Array.isArray(this.value.props.bgPosition))
44
+ this.value.props.bgPosition = this.viewTypes.map(_ => '')
45
+ return this.value.props.bgPosition
46
+ }
47
+
48
+ },
49
+
50
+ data(){
51
+ return {
52
+ values: [
53
+ [ 'bg-center', 'Center' ],
54
+ [ 'bg-top', 'Top' ],
55
+ [ 'bg-right', 'Right' ],
56
+ [ 'bg-bottom', 'Bottom' ],
57
+ [ 'bg-left', 'Left' ],
58
+ [ 'bg-top-right', 'Top Right' ],
59
+ [ 'bg-top-left', 'Top Left' ],
60
+ [ 'bg-bottom-right', 'Bottom Right' ],
61
+ [ 'bg-bottom-left', 'Bottom Left' ],
62
+ ]
63
+ }
64
+ }
65
+
66
+ }
67
+
68
+ </script>
69
+
70
+ <style module>
71
+
72
+ .comp{
73
+ }
74
+
75
+ </style>
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+ <div class="flex flex-row items-center">
4
+ <label class="flex-1">Background Repeat</label>
5
+ <Dropdown v-model="bgRepeat[index]">
6
+ <option value="">Unset</option>
7
+ <option v-for="value in values" :value="`${viewType}${value[0]}`">
8
+ {{ value[1] }}
9
+ </option>
10
+ </Dropdown>
11
+ </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+
17
+ export default{
18
+
19
+ inject: [ 'viewTypes' ],
20
+
21
+ props: {
22
+
23
+ index: {
24
+ type: Number,
25
+ required: true
26
+ },
27
+
28
+ value: {
29
+ type: Object,
30
+ required: true
31
+ },
32
+
33
+ viewType: {
34
+ type: String,
35
+ required: true
36
+ },
37
+
38
+ },
39
+
40
+ computed: {
41
+
42
+ bgRepeat(){
43
+ if(!Array.isArray(this.value.props.bgRepeat))
44
+ this.value.props.bgRepeat = this.viewTypes.map(_ => '')
45
+ return this.value.props.bgRepeat
46
+ }
47
+
48
+ },
49
+
50
+ data(){
51
+ return {
52
+ values: [
53
+ [ 'bg-repeat', 'Repeat' ],
54
+ [ 'bg-no-repeat', 'No Repeat' ],
55
+ [ 'bg-repeat-x', 'Repeat X' ],
56
+ [ 'bg-repeat-y', 'Repeat Y' ],
57
+ [ 'bg-repeat-round', 'Repeat Round' ],
58
+ [ 'bg-repeat-space', 'Repeat Space' ],
59
+ ]
60
+ }
61
+ }
62
+
63
+ }
64
+
65
+ </script>
66
+
67
+ <style module>
68
+
69
+ .comp{
70
+ }
71
+
72
+ </style>