@mixd-id/web-scaffold 0.1.240411001 → 0.1.240411003

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.240411001",
4
+ "version": "0.1.240411003",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -211,6 +211,17 @@ const plugin = Plugin(function({ addBase, addUtilities, config, theme }) {
211
211
  transform: 'translate3d(0, 10px, 0)'
212
212
  },
213
213
 
214
+ '.popout-enter-active, .popout-leave-active': {
215
+ transition: 'all 300ms cubic-bezier(0.25, 1, 0.5, 1)',
216
+ transform: 'scale(1)',
217
+ opacity: '1'
218
+ },
219
+
220
+ '.popout-enter-from, .popout-leave-to': {
221
+ transform: 'scale(0)',
222
+ opacity: '0'
223
+ },
224
+
214
225
  '.slideleft-enter-active, .slideleft-leave-active': {
215
226
  transition: 'all 300ms cubic-bezier(0.25, 1, 0.5, 1)',
216
227
  transform: 'translate3d(0, 0, 0)'
@@ -431,6 +431,42 @@ const queueForLater = (params) => {
431
431
  return instance.queue
432
432
  }
433
433
 
434
+ const queueForLaterWithKey = (params) => {
435
+
436
+ const instance = {
437
+ delay: 1200,
438
+ ...params,
439
+
440
+ items: {},
441
+ timeoutId: {},
442
+
443
+ run: (key) => {
444
+ const items = instance.items[key].splice(0, instance.items[key].length);
445
+ //console.log('run', key, items)
446
+ typeof instance.pop === 'function' ? instance.pop(items) : null;
447
+ instance.timeoutId[key] = false
448
+ },
449
+
450
+ queue(key, item) {
451
+ if(!instance.items[key]){
452
+ instance.items[key] = []
453
+ }
454
+
455
+ if(Array.isArray(item))
456
+ instance.items[key].push(...item)
457
+ else
458
+ instance.items[key].push(item)
459
+
460
+ //console.log('queue', key, item, instance.items[key])
461
+
462
+ if(!instance.timeoutId[key])
463
+ instance.timeoutId[key] = window.setTimeout(() => instance.run(key), instance.delay);
464
+ }
465
+ }
466
+
467
+ return instance.queue
468
+ }
469
+
434
470
  const transactionWithRetry = async (sequelize, callback, opt = {}) => {
435
471
  const { maxRetries = 99, delay = 1000, rollback = false } = opt
436
472
 
@@ -480,10 +516,22 @@ const arrayPush = (arr, items, opt = { update:true }) => {
480
516
  opt.key = items[0] && items[0].uid ? 'uid' : 'id'
481
517
  }
482
518
 
519
+ if(!Array.isArray(opt.key)){
520
+ opt.key = [ opt.key ]
521
+ }
522
+
483
523
  for(let item of items){
484
524
  if(!item) continue
485
525
 
486
- const index = arr.findIndex((_) => _[opt.key] === item[opt.key])
526
+ const index = arr.findIndex((_) => {
527
+ for(let key of opt.key){
528
+ if(_[key] !== item[key]){
529
+ return false
530
+ }
531
+ }
532
+ return true
533
+ })
534
+
487
535
  if(index >= 0){
488
536
  if(opt.update !== false){
489
537
  Object.assign(arr[index], item)
@@ -582,6 +630,7 @@ export {
582
630
  strVars,
583
631
  invokeAfterIdle,
584
632
  queueForLater,
633
+ queueForLaterWithKey,
585
634
  transactionWithRetry,
586
635
  groupBy,
587
636
  arrayPush,
@@ -11,6 +11,7 @@
11
11
  <div v-for="item in items" class="flex gap-4" :class="computedItemClass">
12
12
  <div>
13
13
  <Image :src="imageUrl(item.imageUrl)"
14
+ @click="previewImage(imageUrl(item.imageUrl))"
14
15
  :class="`object-contain ${item.sizeClass} rounded-xl`"
15
16
  edit-selectable="false" />
16
17
  </div>
@@ -29,6 +30,8 @@ import {componentMixin} from "../mixin/component";
29
30
 
30
31
  export default{
31
32
 
33
+ inject: [ 'previewImage' ],
34
+
32
35
  mixins: [ componentMixin ],
33
36
 
34
37
  props:{