@mixd-id/web-scaffold 0.1.240411076 → 0.1.240411078

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.240411076",
4
+ "version": "0.1.240411078",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -5,7 +5,7 @@
5
5
  class="flex-1 flex flex-row">
6
6
 
7
7
  <div v-if="computedPresetMode === 'sidebar' && sidebar.open"
8
- class="relative flex flex-col border-r-[1px] border-text-50"
8
+ class="relative flex flex-col border-x-[1px] border-text-50"
9
9
  :style="sidebarStyle">
10
10
 
11
11
  <PresetBar :config="cConfig"
@@ -31,12 +31,12 @@
31
31
 
32
32
  <div v-if="preset" class="flex-1 flex flex-col relative">
33
33
 
34
- <div class="flex-1 flex flex-col" :class="containerClass">
34
+ <div class="flex-1 flex flex-col gap-2" :class="containerClass">
35
35
  <slot name="head"
36
36
  :preset="preset"
37
37
  :presetSelector="$refs.presetSelector"
38
38
  :compPrefix="compPrefix">
39
- <div class="flex flex-col md:flex-row gap-3 md:items-start overflow-hidden p-3 md:p-0 bg-base-400 md:panel-none border-b-[1px] border-text-50 md:border-none"
39
+ <div class="flex flex-col md:flex-row gap-3 md:items-start overflow-hidden p-3 md:p-0 panel-400 md:panel-none border-b-[1px] border-text-50 md:border-none"
40
40
  :class="headerClass">
41
41
 
42
42
  <div class="flex md:flex-1 flex-row items-start gap-3">
@@ -52,7 +52,7 @@
52
52
  <svg width="13" height="13" class="fill-text group-hover:fill-primary relative top-[-1px]" xmlns="http://www.w3.org/2000/svg" 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 246.6l-127.1 128C176.4 380.9 168.2 384 160 384s-16.38-3.125-22.63-9.375l-127.1-128C.2244 237.5-2.516 223.7 2.438 211.8S19.07 192 32 192h255.1c12.94 0 24.62 7.781 29.58 19.75S319.8 237.5 310.6 246.6z"/></svg>
53
53
  </div>
54
54
  </div>
55
- <ContextMenu ref="contextMenu" class="bg-base-400 mt-4">
55
+ <ContextMenu ref="contextMenu" class="panel-400 mt-4">
56
56
  <div class="flex flex-col min-w-[300px] divide-y divide-text-50">
57
57
 
58
58
  <div class="flex flex-col gap-1 bg-base-300">
@@ -87,14 +87,14 @@
87
87
  <slot name="toolbar"></slot>
88
88
  </div>
89
89
 
90
- <div class="flex flex-row gap-2" v-if="Boolean(toolbar)">
90
+ <div class="flex flex-row gap-2 gap-1" v-if="Boolean(toolbar)">
91
91
  <Textbox v-if="canSearch"
92
92
  class="flex-1 md:w-[240px] bg-base-400 border-text-50"
93
93
  placeholder="Search..."
94
94
  clearable="1"
95
95
  maxlength="100"
96
96
  v-model="preset.search"
97
- @clear="clearSearch"
97
+ @clear="delete preset.search; load()"
98
98
  @keyup.enter="load">
99
99
  <template #start>
100
100
  <div class="p-2 pr-0">
@@ -132,11 +132,11 @@
132
132
  <svg class="animate-spin" width="36" height="36" 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>
133
133
  </div>
134
134
 
135
- <div v-else-if="presetView === 'table' || pivotEnabled" class="flex-1 flex flex-col" :class="pivotEnabled ? 'p-3 bg-base-400 md:p-0' : ''">
135
+ <div v-else-if="presetView === 'table' || pivotEnabled" class="flex-1 flex flex-col" :class="pivotEnabled ? 'p-3 panel-400 md:p-0' : ''">
136
136
  <VirtualTable
137
137
  ref="table"
138
138
  :columns="columns"
139
- class="flex-1"
139
+ class="flex-1 bg-base-400"
140
140
  :items="dataItems"
141
141
  :enumCache="enumCache"
142
142
  :freeze-left="freezeLeft"
@@ -179,7 +179,7 @@
179
179
  :config="cConfig">
180
180
  <template #item="{ item }">
181
181
  <slot name="gridItem" :item="item" :enumCache="enumCache" :getEnumText="getEnumText">
182
- <div class="flex flex-row bg-base-400 rounded-lg overflow-hidden md:rounded-lg overflow-hidden p-3 gap-3">
182
+ <div class="flex flex-row panel-400 rounded-lg overflow-hidden md:rounded-lg overflow-hidden p-3 gap-3">
183
183
  <div>
184
184
  <Image :src="item.imageUrl" class="bg-text-50 w-[64px] h-[64px] rounded-lg" />
185
185
  </div>
@@ -215,7 +215,7 @@
215
215
  <VirtualTable v-else-if="presetView === 'table'"
216
216
  ref="table"
217
217
  :columns="preset.columns"
218
- class="flex-1 bg-base-400"
218
+ class="flex-1 panel-400"
219
219
  :items="data.extItems"
220
220
  :enumCache="enumCache"
221
221
  @scroll-end="loadExtNext">
@@ -242,7 +242,7 @@
242
242
  :config="cConfig">
243
243
  <template #item="{ item }">
244
244
  <slot name="gridItem" :item="item" :getEnumText="getEnumText">
245
- <div class="flex flex-row bg-base-400 rounded-lg md:rounded-lg overflow-hidden p-3 gap-3">
245
+ <div class="flex flex-row panel-400 rounded-lg overflow-hidden md:rounded-lg overflow-hidden p-3 gap-3">
246
246
  <div>
247
247
  <Image :src="item.imageUrl" class="bg-text-50 w-[64px] h-[64px] rounded-lg" />
248
248
  </div>
@@ -355,21 +355,6 @@ export default{
355
355
 
356
356
  },
357
357
 
358
- clearSearch(){
359
- delete this.preset.search;
360
-
361
- if('search' in this.$route.query){
362
- const query = { ...this.$route.query }
363
- delete query.search
364
- this.$router.push({
365
- ...this.$route,
366
- query
367
- })
368
- }
369
-
370
- this.load()
371
- },
372
-
373
358
  getEnumText(key, value){
374
359
 
375
360
  let enumText
@@ -400,22 +385,16 @@ export default{
400
385
 
401
386
  load(){
402
387
  if(this.computedSrc){
403
- if(!this.preset?.columns){
388
+ if(!this.preset.columns){
404
389
  this.preset.columns = JSON.parse(JSON.stringify(this.cConfig.columns))
405
390
  }
406
391
 
407
- let search = this.preset.search
408
- if(this.preset.search && this.preset.params?.searchPrefix){
409
- search = this.preset.params.searchPrefix + this.preset.search
410
- }
411
-
412
392
  this.readyState = 2
413
393
  return this.useSocket().send(this.computedSrc, {
414
394
  ...this.preset,
415
395
  id: undefined,
416
396
  uid: undefined,
417
397
  itemsPerPage: this.data.itemsPerPage,
418
- search
419
398
  })
420
399
  .then(data => {
421
400
  if(data?.items){
@@ -437,11 +416,6 @@ export default{
437
416
  !(this.preset.pivot ?? {}).enabled &&
438
417
  this.dataItems) {
439
418
 
440
- let search = this.preset.search
441
- if(this.preset.search && this.preset.params?.searchPrefix){
442
- search = this.preset.params.searchPrefix + this.preset.search
443
- }
444
-
445
419
  const afterItem = this.dataItems[this.dataItems.length - 1]
446
420
 
447
421
  this.readyState = 4
@@ -450,7 +424,6 @@ export default{
450
424
  id: undefined,
451
425
  uid: undefined,
452
426
  itemsPerPage: this.data.itemsPerPage,
453
- search,
454
427
  afterItem,
455
428
  })
456
429
  .then(data => {
@@ -479,10 +452,8 @@ export default{
479
452
  Object.assign(this.cConfig, defaultConfig)
480
453
  }
481
454
 
482
- if(this.$route.query?.search){
455
+ if(this.$route.query?.search)
483
456
  this.preset.search = this.$route.query.search
484
- delete this.preset.params.searchPrefix
485
- }
486
457
  }
487
458
  }
488
459
  else{
@@ -493,10 +464,8 @@ export default{
493
464
  }
494
465
  }
495
466
  else{
496
- if(this.defaultConfig){
497
- const defaultConfig = setupConfig(await this.defaultConfig())
498
- Object.assign(this.cConfig, defaultConfig)
499
- }
467
+ const defaultConfig = setupConfig(await this.defaultConfig())
468
+ Object.assign(this.cConfig, defaultConfig)
500
469
 
501
470
  return new Promise((resolve) => {
502
471
  const query = {}
@@ -568,11 +537,6 @@ export default{
568
537
  loadExt(){
569
538
  if(!this.extBar.open) return
570
539
 
571
- let search = this.preset.search
572
- if(this.preset.search && this.preset.params?.searchPrefix){
573
- search = this.preset.params.searchPrefix + this.preset.search
574
- }
575
-
576
540
  this.readyState = 3
577
541
  return this.useSocket().send(this.computedSrc, {
578
542
  ...this.preset,
@@ -582,8 +546,7 @@ export default{
582
546
  ...(this.preset.filters ?? []),
583
547
  ...(this.extBar.filters ?? [])
584
548
  ],
585
- pivot: null,
586
- search
549
+ pivot: null
587
550
  })
588
551
  .then((res) => {
589
552
  this.data.extItems = res.items
@@ -594,11 +557,6 @@ export default{
594
557
  loadExtNext(){
595
558
  if(!this.preset.filters) return
596
559
 
597
- let search = this.preset.search
598
- if(this.preset.search && this.preset.params?.searchPrefix){
599
- search = this.preset.params.searchPrefix + this.preset.search
600
- }
601
-
602
560
  return this.useSocket().send(this.computedSrc, {
603
561
  ...this.preset,
604
562
  id: undefined,
@@ -609,7 +567,6 @@ export default{
609
567
  ],
610
568
  pivot: null,
611
569
  afterItem: this.data.extItems[this.data.extItems.length - 1],
612
- search
613
570
  })
614
571
  .then(data => {
615
572
  this.data.extItems.push(...data.items)
@@ -691,18 +648,12 @@ export default{
691
648
  loadQueued(items){
692
649
  const key = items[0] && items[0].uid ? 'uid' : 'id'
693
650
 
694
- let search = this.preset.search
695
- if(this.preset.search && this.preset.params?.searchPrefix){
696
- search = this.preset.params.searchPrefix + this.preset.search
697
- }
698
-
699
651
  this.useSocket().send(this.computedSrc, {
700
652
  ...this.preset,
701
653
  id: undefined,
702
654
  uid: undefined,
703
655
  [key]: items.map(item => item[key]),
704
- _signal: true,
705
- search
656
+ _signal: true
706
657
  })
707
658
  .then(({ items:nextItems }) => {
708
659
 
@@ -1085,11 +1036,8 @@ export default{
1085
1036
  this.configSharedPresets.find(_ => _.uid === this.configParams.presetIdx)
1086
1037
 
1087
1038
  if(preset){
1088
- if(this.$route.query?.search){
1089
- preset.search = this.$route.query.search
1090
- if(preset.params)
1091
- delete preset.params.searchPrefix
1092
- }
1039
+ if(!preset.search) preset.search = ''
1040
+ preset.search = this.$route.query?.search ? this.$route.query.search : preset.search
1093
1041
  }
1094
1042
 
1095
1043
  return preset
@@ -52,7 +52,9 @@ export default{
52
52
 
53
53
  viewedColumns(){
54
54
  if(this.search)
55
- return this.columns.filter(column => column.label.toLowerCase().includes(this.search.toLowerCase()))
55
+ return this.columns.filter(column => `${column.label ?? ''}`.toLowerCase().includes(
56
+ `${this.search ?? ''}`.toLowerCase())
57
+ )
56
58
  return this.columns
57
59
  }
58
60