@mixd-id/web-scaffold 0.1.230406310 → 0.1.230406312

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 (64) hide show
  1. package/package.json +1 -1
  2. package/src/App.vue +9 -1
  3. package/src/components/Button.vue +4 -4
  4. package/src/components/Carousel.vue +3 -3
  5. package/src/components/ColorPicker2.vue +1 -1
  6. package/src/components/Image.vue +5 -3
  7. package/src/components/ImagePreview.vue +2 -2
  8. package/src/components/Modal.vue +2 -2
  9. package/src/components/Text.vue +34 -0
  10. package/src/components/Textarea.vue +4 -0
  11. package/src/components/Textbox.vue +1 -1
  12. package/src/components/VirtualTable.vue +12 -2
  13. package/src/index.js +22 -38
  14. package/src/main.js +0 -9
  15. package/src/mixin/component.js +2 -1
  16. package/src/utils/helpers.js +2 -2
  17. package/src/utils/helpers.mjs +2 -2
  18. package/src/utils/preset-selector.js +4 -1
  19. package/src/utils/wss.js +6 -1
  20. package/src/utils/wss.mjs +2 -2
  21. package/src/widgets/WebPageBuilder3.vue +3 -218
  22. package/src/widgets/WebPageBuilder4/BackgroundColorSetting.vue +54 -0
  23. package/src/widgets/WebPageBuilder4/BackgroundPositionSetting.vue +75 -0
  24. package/src/widgets/WebPageBuilder4/BackgroundRepeatSetting.vue +72 -0
  25. package/src/widgets/WebPageBuilder4/BackgroundSizeSetting.vue +72 -0
  26. package/src/widgets/WebPageBuilder4/BlurSetting.vue +72 -0
  27. package/src/widgets/WebPageBuilder4/BorderColorSetting.vue +64 -0
  28. package/src/widgets/WebPageBuilder4/BorderRadiusSetting.vue +75 -0
  29. package/src/widgets/WebPageBuilder4/BorderSizeSetting.vue +69 -0
  30. package/src/widgets/WebPageBuilder4/BorderStyleSetting.vue +72 -0
  31. package/src/widgets/WebPageBuilder4/BoxShadowSetting.vue +73 -0
  32. package/src/widgets/WebPageBuilder4/ButtonSetting.vue +65 -0
  33. package/src/widgets/WebPageBuilder4/CarouselSetting.vue +178 -0
  34. package/src/widgets/WebPageBuilder4/DisplaySetting.vue +76 -0
  35. package/src/widgets/WebPageBuilder4/FlexAlignSetting.vue +71 -0
  36. package/src/widgets/WebPageBuilder4/FlexDirectionSetting.vue +70 -0
  37. package/src/widgets/WebPageBuilder4/FlexJustifySetting.vue +74 -0
  38. package/src/widgets/WebPageBuilder4/FlexPropertySetting.vue +71 -0
  39. package/src/widgets/WebPageBuilder4/FlexSetting.vue +96 -0
  40. package/src/widgets/WebPageBuilder4/FlexWrapSetting.vue +69 -0
  41. package/src/widgets/WebPageBuilder4/GapSetting.vue +75 -0
  42. package/src/widgets/WebPageBuilder4/GrayscaleSetting.vue +68 -0
  43. package/src/widgets/WebPageBuilder4/GridSetting.vue +166 -0
  44. package/src/widgets/WebPageBuilder4/HeightSetting.vue +95 -0
  45. package/src/widgets/WebPageBuilder4/ImageSetting.vue +102 -0
  46. package/src/widgets/WebPageBuilder4/MarginSetting.vue +64 -0
  47. package/src/widgets/WebPageBuilder4/MaxHeightSetting.vue +82 -0
  48. package/src/widgets/WebPageBuilder4/MaxWidthSetting.vue +90 -0
  49. package/src/widgets/WebPageBuilder4/MinHeightSetting.vue +81 -0
  50. package/src/widgets/WebPageBuilder4/MinWidthSetting.vue +101 -0
  51. package/src/widgets/WebPageBuilder4/MultiValueSetting.vue +155 -0
  52. package/src/widgets/WebPageBuilder4/OpacitySetting.vue +77 -0
  53. package/src/widgets/WebPageBuilder4/OverflowSetting.vue +81 -0
  54. package/src/widgets/WebPageBuilder4/PaddingSetting.vue +53 -0
  55. package/src/widgets/WebPageBuilder4/PositionSetting.vue +191 -0
  56. package/src/widgets/WebPageBuilder4/PropertySetting.vue +176 -0
  57. package/src/widgets/WebPageBuilder4/TextSetting.vue +72 -0
  58. package/src/widgets/WebPageBuilder4/TreeView.vue +43 -0
  59. package/src/widgets/WebPageBuilder4/TreeViewItem.vue +298 -0
  60. package/src/widgets/WebPageBuilder4/WebPageComponentSelector.vue +141 -0
  61. package/src/widgets/WebPageBuilder4/WebPagePropertySelector.vue +172 -0
  62. package/src/widgets/WebPageBuilder4/WidthSetting.vue +105 -0
  63. package/src/widgets/WebPageBuilder4/ZIndexSetting.vue +72 -0
  64. package/src/widgets/WebPageBuilder4.vue +798 -0
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.230406310",
4
+ "version": "0.1.230406312",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
package/src/App.vue CHANGED
@@ -4,6 +4,14 @@
4
4
 
5
5
  <script>
6
6
 
7
+ export default {
8
+ name: 'App',
9
+
10
+ setup(){
11
+
12
+ }
13
+ }
14
+
7
15
  </script>
8
16
 
9
17
  <style>
@@ -14,4 +22,4 @@
14
22
  <style module>
15
23
 
16
24
 
17
- </style>
25
+ </style>
@@ -210,14 +210,14 @@ export default{
210
210
  }
211
211
 
212
212
  .button-secondary{
213
- @apply bg-primary-100 border-primary-100 text-primary-700 rounded-lg text-text;
214
- border: solid 1px rgb(var(--primary-100));
213
+ @apply bg-secondary-500 border-secondary-500 text-primary-700 rounded-lg text-white;
214
+ border: solid 1px rgb(var(--secondary-500));
215
215
  }
216
216
  .button-secondary:hover{
217
- @apply bg-primary-200 border-primary-200;
217
+ @apply bg-secondary-600 border-secondary-600;
218
218
  }
219
219
  .button-secondary:disabled{
220
- @apply bg-primary-100 top-0 left-0 cursor-not-allowed;
220
+ @apply bg-secondary-400 border-secondary-400 cursor-not-allowed;
221
221
  }
222
222
  .button-secondary *{
223
223
  @apply text-text-500 fill-white;
@@ -12,8 +12,7 @@
12
12
  </div>
13
13
 
14
14
  <div v-if="items && items.length > 1" :class="$style.carouselNext" @click="next(true)">
15
- <slot name="next">
16
- </slot>
15
+ <slot name="next"></slot>
17
16
  </div>
18
17
 
19
18
  <div v-if="items && items.length > 1" :class="$style.carouselPrev" @click="prev">
@@ -179,7 +178,8 @@ export default{
179
178
  },
180
179
 
181
180
  play(){
182
- this.timeoutId = window.setTimeout(() => { this.next(true); this.play() }, this.autoPlay)
181
+ if(this.autoPlay > 0)
182
+ this.timeoutId = window.setTimeout(() => { this.next(true); this.play() }, this.autoPlay)
183
183
  },
184
184
 
185
185
  stop(){
@@ -83,7 +83,7 @@ export default{
83
83
 
84
84
  select(color){
85
85
  if(this.mode === 'class'){
86
- this.$emit('update:modelValue', color ? this.keys[0][0] + color : '')
86
+ this.$emit('update:modelValue', color ? `${this.prefix}${this.keys[0][0]}` + color : '')
87
87
  }
88
88
  else{
89
89
  if(this.valueType === 'rgb'){
@@ -14,7 +14,7 @@
14
14
  </slot>
15
15
 
16
16
  <div v-else-if="status === 2 && actualSrc.indexOf('<svg') >= 0" v-html="actualSrc"></div>
17
- <img v-else-if="status === 2" :class="computedItemClass" :src="actualSrc" ref="img" />
17
+ <img v-else-if="status === 2" :class="computedItemClass" :src="actualSrc" ref="img" :alt="alt" />
18
18
 
19
19
  <slot v-else-if="status === 3" name="error" :instance="this"></slot>
20
20
 
@@ -45,6 +45,8 @@ export default{
45
45
 
46
46
  props:{
47
47
 
48
+ alt: String,
49
+
48
50
  eager: {
49
51
  type: [ Boolean, String ],
50
52
  default: false
@@ -207,9 +209,9 @@ export default{
207
209
  else if(Array.isArray(this.src)){
208
210
 
209
211
  const src = {}
210
- src['all'] = import.meta.env.VITE_IMAGE_HOST + '/' + this.src[0]
212
+ src['all'] = this.src[0]
211
213
  if(this.src[1]){
212
- src['md'] = import.meta.env.VITE_IMAGE_HOST + '/' + this.src[1]
214
+ src['md'] = this.src[1]
213
215
  }
214
216
 
215
217
  let imgSrc
@@ -4,10 +4,10 @@
4
4
  <div class="flex flex-row gap-4 justify-end items-center p-3 pr-6">
5
5
  <slot name="moreButtons"></slot>
6
6
  <a v-if="download" :href="imageUrl" target="_blank" download>
7
- <svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M480 352h-133.5l-45.25 45.25C289.2 409.3 273.1 416 256 416s-33.16-6.656-45.25-18.75L165.5 352H32c-17.67 0-32 14.33-32 32v96c0 17.67 14.33 32 32 32h448c17.67 0 32-14.33 32-32v-96C512 366.3 497.7 352 480 352zM432 456c-13.2 0-24-10.8-24-24c0-13.2 10.8-24 24-24s24 10.8 24 24C456 445.2 445.2 456 432 456zM233.4 374.6C239.6 380.9 247.8 384 256 384s16.38-3.125 22.62-9.375l128-128c12.49-12.5 12.49-32.75 0-45.25c-12.5-12.5-32.76-12.5-45.25 0L288 274.8V32c0-17.67-14.33-32-32-32C238.3 0 224 14.33 224 32v242.8L150.6 201.4c-12.49-12.5-32.75-12.5-45.25 0c-12.49 12.5-12.49 32.75 0 45.25L233.4 374.6z"/></svg>
7
+ <svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" class="fill-text" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M480 352h-133.5l-45.25 45.25C289.2 409.3 273.1 416 256 416s-33.16-6.656-45.25-18.75L165.5 352H32c-17.67 0-32 14.33-32 32v96c0 17.67 14.33 32 32 32h448c17.67 0 32-14.33 32-32v-96C512 366.3 497.7 352 480 352zM432 456c-13.2 0-24-10.8-24-24c0-13.2 10.8-24 24-24s24 10.8 24 24C456 445.2 445.2 456 432 456zM233.4 374.6C239.6 380.9 247.8 384 256 384s16.38-3.125 22.62-9.375l128-128c12.49-12.5 12.49-32.75 0-45.25c-12.5-12.5-32.76-12.5-45.25 0L288 274.8V32c0-17.67-14.33-32-32-32C238.3 0 224 14.33 224 32v242.8L150.6 201.4c-12.49-12.5-32.75-12.5-45.25 0c-12.49 12.5-12.49 32.75 0 45.25L233.4 374.6z"/></svg>
8
8
  </a>
9
9
  <button @click="close">
10
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 320 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/></svg>
10
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="fill-text" viewBox="0 0 320 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/></svg>
11
11
  </button>
12
12
  </div>
13
13
  <div class="flex items-center justify-center">
@@ -308,7 +308,7 @@ export default{
308
308
 
309
309
  .bW9k{
310
310
  @apply z-20 hidden w-[100vw] h-[100vh];
311
- @apply bg-white/50 backdrop-blur-md;
311
+ @apply bg-white/50 backdrop-blur-xl;
312
312
  position: fixed;
313
313
  top: 0;
314
314
  left: 0;
@@ -334,7 +334,7 @@ export default{
334
334
  background-color: rgba(255, 255, 255, .6)
335
335
  }
336
336
  html[data-theme='dark'] .modal{
337
- background-color: rgba(0, 0, 0, .3)
337
+ background-color: rgba(0, 0, 0, .6)
338
338
  }
339
339
 
340
340
  .modal.v-show{
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <component :is="tag" v-html="htmlText2[$device.mediaIndex]"></component>
3
+ </template>
4
+
5
+ <script>
6
+
7
+ import {componentMixin} from "../mixin/component";
8
+
9
+ export default{
10
+
11
+ mixins: [ componentMixin ],
12
+
13
+ props: {
14
+
15
+ tag: {
16
+ type: String,
17
+ default: 'div'
18
+ },
19
+
20
+ htmlText2: {
21
+ type: Array,
22
+ default: () => []
23
+ }
24
+
25
+ }
26
+
27
+ }
28
+
29
+ </script>
30
+
31
+ <style module>
32
+
33
+
34
+ </style>
@@ -117,6 +117,10 @@ export default{
117
117
 
118
118
  methods:{
119
119
 
120
+ focus(){
121
+ this.$refs.input.focus()
122
+ },
123
+
120
124
  select(){
121
125
  this.$refs.input.select()
122
126
  },
@@ -92,7 +92,7 @@ export default{
92
92
  switch(this.type){
93
93
 
94
94
  case 'number':
95
- const val = parseInt(this.modelValue)
95
+ const val = parseFloat(this.modelValue)
96
96
  return isNaN(val) ? '' : val.toLocaleString()
97
97
 
98
98
  default:
@@ -4,7 +4,7 @@
4
4
  <table :class="$style.table" ref="tableHead" :style="tableHeadStyle">
5
5
  <thead>
6
6
  <tr>
7
- <th v-for="column in visibleColumns" :style="thStyle(column)"
7
+ <th v-for="column in visibleColumns" :style="thStyle(column)" :class="thClass(column)"
8
8
  v-tooltip="`${column.label ? column.label : column.key}`">
9
9
  <slot v-if="$slots['col-' + column.key]" :name="'col-' + column.key" :column="column"></slot>
10
10
  <div v-else :class="headerColumnClass(column)">
@@ -64,7 +64,7 @@
64
64
  <table :class="$style.table">
65
65
  <tbody>
66
66
  <tr>
67
- <td v-for="column in columns" :style="thStyle(column)">
67
+ <td v-for="column in columns" :style="thStyle(column)" :class="thClass(column)">
68
68
  <slot v-if="$slots[column.key]" :name="column.key" :column="column" :item="items[0]"></slot>
69
69
  <slot v-else-if="$slots.default" name="default" :column="column" :item="items[0]"></slot>
70
70
  <div v-else :class="columnClass(column)" v-html="formatColumn(items[0] ?? {}, column)"></div>
@@ -246,6 +246,16 @@ export default{
246
246
  }
247
247
  },
248
248
 
249
+ thClass(column){
250
+ let classNames = []
251
+
252
+ if(column.align){
253
+ classNames.push(`text-${column.align}`)
254
+ }
255
+
256
+ return classNames.join(' ')
257
+ },
258
+
249
259
  async resize(){
250
260
 
251
261
  this.$nextTick(() => {
package/src/index.js CHANGED
@@ -10,13 +10,13 @@ const uniqid = (additionalKey = '') => {
10
10
  return 'u' + Math.random().toString(36).substr(2) + Date.now().toString(36)
11
11
  }
12
12
 
13
- const mediaBreakpoints = {
14
- 640: 'sm',
15
- 768: 'md',
16
- 1024: 'lg',
17
- 1280: 'xl',
18
- 1536: '2xl',
19
- }
13
+ const mediaBreakpoints = [
14
+ [ 640, 'sm:' ],
15
+ [ 768, 'md:' ],
16
+ [ 1024, 'lg:' ],
17
+ [ 1280, 'xl:' ],
18
+ [ 1536, '2xl:' ],
19
+ ]
20
20
 
21
21
  const download = (url, as) => {
22
22
  url = url + (url.indexOf('?') >= 0 ? '&' : '?') + 'nocache=' + new Date().getTime()
@@ -291,14 +291,18 @@ const util = {
291
291
 
292
292
  calculateMediaPrefix(width){
293
293
 
294
- let prefix = ''
295
- for(let breakpoint in mediaBreakpoints){
294
+ let media = ''
295
+ let mediaIndex = 0
296
+ for(let breakpointIdx in mediaBreakpoints){
297
+ const [ breakpoint, breakpointPrefix ] = mediaBreakpoints[breakpointIdx]
296
298
  if(width > breakpoint){
297
- prefix = mediaBreakpoints[breakpoint] ?? prefix
299
+ media = breakpointPrefix
300
+ mediaIndex = breakpointIdx
298
301
  }
302
+ else break
299
303
  }
300
304
 
301
- return prefix
305
+ return { media, mediaIndex }
302
306
  },
303
307
 
304
308
  uniqid
@@ -403,29 +407,9 @@ export default{
403
407
  app.config.globalProperties.timeLog = consoleTimeLog
404
408
  app.config.globalProperties.timeEnd = consoleTimeEnd
405
409
  app.config.globalProperties.$device = reactive({
406
-
407
- getValue: (arr) => {
408
- if(Array.isArray(arr)){
409
- let index = 0
410
- switch(app.config.globalProperties.$device){
411
- case 'md':
412
- index = 1
413
- break
414
- case 'lg':
415
- index = 2
416
- break
417
- }
418
-
419
- for(let i = index ; i >= 0 ; i--){
420
- if(arr && arr[i])
421
- return arr[i]
422
- }
423
- }
424
- },
425
-
426
410
  type: 'mobile',
427
411
  media: '',
428
-
412
+ mediaIndex: 0
429
413
  })
430
414
  app.config.globalProperties.$isDebugMode = () => {
431
415
  if(!('isDebugMode' in privateVars)){
@@ -477,18 +461,16 @@ export default{
477
461
  }
478
462
 
479
463
  const onWindowResize = throttle(() => {
480
-
481
464
  Object.assign(app.config.globalProperties.$device, {
482
465
  type: getDeviceType(),
483
- media: util.calculateMediaPrefix(document.documentElement.clientWidth)
466
+ ...util.calculateMediaPrefix(document.documentElement.clientWidth)
484
467
  })
485
468
 
486
469
  resizeEvents.forEach((fn) => fn())
487
- }, 1000, {leading: true})
470
+ }, 300, {leading: true})
488
471
  window.addEventListener('resize', onWindowResize)
489
472
 
490
473
  app.config.globalProperties.$addResizeListener = (el, fn) => {
491
-
492
474
  if (!resizeObserver) {
493
475
  resizeObserver = new ResizeObserver((entries) => {
494
476
  for (const entry of entries) {
@@ -515,8 +497,8 @@ export default{
515
497
  app.config.globalProperties.$onMounted = () => {
516
498
  Object.assign(app.config.globalProperties.$device, {
517
499
  type: getDeviceType(),
518
- media: util.calculateMediaPrefix(document.documentElement.clientWidth),
519
- touchSupported: isTouchSupported()
500
+ touchSupported: isTouchSupported(),
501
+ ...util.calculateMediaPrefix(document.documentElement.clientWidth)
520
502
  })
521
503
  }
522
504
  }
@@ -658,6 +640,7 @@ export default{
658
640
  app.component('WebPageBuilder', defineAsyncComponent(() => import("./widgets/WebPageBuilder.vue")))
659
641
  app.component('WebPageBuilder2', defineAsyncComponent(() => import("./widgets/WebPageBuilder2.vue")))
660
642
  app.component('WebPageBuilder3', defineAsyncComponent(() => import("./widgets/WebPageBuilder3.vue")))
643
+ app.component('WebPageBuilder4', defineAsyncComponent(() => import("./widgets/WebPageBuilder4.vue")))
661
644
  app.component('WebPagePreview', defineAsyncComponent(() => import("./widgets/WebPagePreview.vue")))
662
645
  app.component('WebComponentSelector', defineAsyncComponent(() => import("./widgets/WebComponentSelector.vue")))
663
646
  app.component('WebDatasourceSelector', defineAsyncComponent(() => import("./widgets/WebDatasourceSelector.vue")))
@@ -685,6 +668,7 @@ export default{
685
668
  app.component('TypographySetting', defineAsyncComponent(() => import("./widgets/TypographySetting.vue")))
686
669
  app.component('FiltersSetting', defineAsyncComponent(() => import("./widgets/FiltersSetting.vue")))
687
670
  app.component('MenuEditor', defineAsyncComponent(() => import("./widgets/MenuEditor.vue")))
671
+ app.component('Text', defineAsyncComponent(() => import("./components/Text.vue")))
688
672
  }
689
673
 
690
674
  }
package/src/main.js CHANGED
@@ -5,14 +5,6 @@ import { createRouter } from './router'
5
5
  import WebScaffold from './index'
6
6
  import './index.css'
7
7
 
8
- const AppScaffold = {
9
- install: (app, options) => {
10
- app.component('PropertyTable', defineAsyncComponent(() => import("./pages/playground/components/PropertyTable.vue")))
11
- app.component('Preview', defineAsyncComponent(() => import("./pages/playground/components/Preview.vue")))
12
- app.component('SourceCode', defineAsyncComponent(() => import("./pages/playground/components/SourceCode.vue")))
13
- }
14
- }
15
-
16
8
  export function createApp(){
17
9
 
18
10
  const app = createSSRApp(App)
@@ -22,7 +14,6 @@ export function createApp(){
22
14
  app.use(router)
23
15
  app.use(pinia)
24
16
  app.use(WebScaffold)
25
- app.use(AppScaffold)
26
17
 
27
18
  return { app, router, pinia }
28
19
  }
@@ -67,6 +67,7 @@ export const componentMixin = {
67
67
  },
68
68
 
69
69
  htmlText: String,
70
+ htmlText2: Array,
70
71
 
71
72
  editSelectable: {
72
73
  type: undefined,
@@ -119,7 +120,7 @@ export const componentMixin = {
119
120
  },
120
121
 
121
122
  componentClick(e){
122
- if(this.editMode !== 1) return
123
+ if(!this.editMode) return
123
124
 
124
125
  e.stopPropagation()
125
126
  e.preventDefault()
@@ -140,11 +140,11 @@ const strSlug = (title, separator) => {
140
140
  return title.replace(new RegExp('^[' + separator + '\\s]+|[' + separator + '\\s]+$', 'g'),'');
141
141
  }
142
142
 
143
- const strVars = (text, vars) => {
143
+ const strVars = (text, vars, opt = { emptyUndefined:true }) => {
144
144
 
145
145
  (text.match(/\{.*?(?=\})\}/gi) ?? []).forEach((match) => {
146
146
  const key = match.substring(1, match.length - 1)
147
- const value = vars[key] ?? ''
147
+ const value = vars[key] ?? (opt?.emptyUndefined ? '' : `{${key}}`)
148
148
  text = text.replace(match, value)
149
149
  })
150
150
 
@@ -84,11 +84,11 @@ const parseBoolean = function(exp){
84
84
  exp.toLowerCase() : exp)
85
85
  }
86
86
 
87
- const strVars = function(text, vars){
87
+ const strVars = function(text, vars, opt = { emptyUndefined:true }){
88
88
 
89
89
  (text.match(/\{.*?(?=\})\}/gi) ?? []).forEach((match) => {
90
90
  const key = match.substring(1, match.length - 1)
91
- const value = vars[key] ?? ''
91
+ const value = vars[key] ?? (opt?.emptyUndefined ? '' : `{${key}}`)
92
92
  text = text.replace(match, value)
93
93
  })
94
94
 
@@ -995,7 +995,10 @@ const presetToSequelizeList = async(preset, {
995
995
  searchReplacements = syntaxSearchOpt.replacements
996
996
  }
997
997
  else{
998
- const match = (config.columns ?? []).filter(_ => (_.search && _.key)).map(_ => _.key)
998
+ const match = (config.columns ?? [])
999
+ .filter(_ => (_.search && _.key))
1000
+ .map(_ => typeof _.search === 'string' ? _.search : _.key)
1001
+
999
1002
  if(match !== null){
1000
1003
  const searchOpt = await searchToSequelizeWhere(search, {
1001
1004
  match
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
  }