cisse-vue-ui 0.2.0 → 0.2.2

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.
@@ -346,6 +346,207 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
346
346
  };
347
347
  }
348
348
  });
349
+ const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
350
+ const injectLocal = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
351
+ var _getCurrentInstance;
352
+ const key = args[0];
353
+ const instance = (_getCurrentInstance = vue.getCurrentInstance()) === null || _getCurrentInstance === void 0 ? void 0 : _getCurrentInstance.proxy;
354
+ const owner = instance !== null && instance !== void 0 ? instance : vue.getCurrentScope();
355
+ if (owner == null && !vue.hasInjectionContext()) throw new Error("injectLocal must be called in setup");
356
+ if (owner && localProvidedStateMap.has(owner) && key in localProvidedStateMap.get(owner)) return localProvidedStateMap.get(owner)[key];
357
+ return vue.inject(...args);
358
+ };
359
+ const isClient = typeof window !== "undefined" && typeof document !== "undefined";
360
+ typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
361
+ const toString = Object.prototype.toString;
362
+ const isObject = (val) => toString.call(val) === "[object Object]";
363
+ function increaseWithUnit(target, delta) {
364
+ var _target$match;
365
+ if (typeof target === "number") return target + delta;
366
+ const value = ((_target$match = target.match(/^-?\d+\.?\d*/)) === null || _target$match === void 0 ? void 0 : _target$match[0]) || "";
367
+ const unit = target.slice(value.length);
368
+ const result = Number.parseFloat(value) + delta;
369
+ if (Number.isNaN(result)) return target;
370
+ return result + unit;
371
+ }
372
+ function pxValue(px) {
373
+ return px.endsWith("rem") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);
374
+ }
375
+ function toArray(value) {
376
+ return Array.isArray(value) ? value : [value];
377
+ }
378
+ function getLifeCycleTarget(target) {
379
+ return vue.getCurrentInstance();
380
+ }
381
+ function tryOnMounted(fn, sync = true, target) {
382
+ if (getLifeCycleTarget()) vue.onMounted(fn, target);
383
+ else if (sync) fn();
384
+ else vue.nextTick(fn);
385
+ }
386
+ function watchImmediate(source, cb, options) {
387
+ return vue.watch(source, cb, {
388
+ ...options,
389
+ immediate: true
390
+ });
391
+ }
392
+ const defaultWindow = isClient ? window : void 0;
393
+ function unrefElement(elRef) {
394
+ var _$el;
395
+ const plain = vue.toValue(elRef);
396
+ return (_$el = plain === null || plain === void 0 ? void 0 : plain.$el) !== null && _$el !== void 0 ? _$el : plain;
397
+ }
398
+ function useEventListener(...args) {
399
+ const register = (el, event, listener, options) => {
400
+ el.addEventListener(event, listener, options);
401
+ return () => el.removeEventListener(event, listener, options);
402
+ };
403
+ const firstParamTargets = vue.computed(() => {
404
+ const test = toArray(vue.toValue(args[0])).filter((e) => e != null);
405
+ return test.every((e) => typeof e !== "string") ? test : void 0;
406
+ });
407
+ return watchImmediate(() => {
408
+ var _firstParamTargets$va, _firstParamTargets$va2;
409
+ return [
410
+ (_firstParamTargets$va = (_firstParamTargets$va2 = firstParamTargets.value) === null || _firstParamTargets$va2 === void 0 ? void 0 : _firstParamTargets$va2.map((e) => unrefElement(e))) !== null && _firstParamTargets$va !== void 0 ? _firstParamTargets$va : [defaultWindow].filter((e) => e != null),
411
+ toArray(vue.toValue(firstParamTargets.value ? args[1] : args[0])),
412
+ toArray(vue.unref(firstParamTargets.value ? args[2] : args[1])),
413
+ vue.toValue(firstParamTargets.value ? args[3] : args[2])
414
+ ];
415
+ }, ([raw_targets, raw_events, raw_listeners, raw_options], _, onCleanup) => {
416
+ if (!(raw_targets === null || raw_targets === void 0 ? void 0 : raw_targets.length) || !(raw_events === null || raw_events === void 0 ? void 0 : raw_events.length) || !(raw_listeners === null || raw_listeners === void 0 ? void 0 : raw_listeners.length)) return;
417
+ const optionsClone = isObject(raw_options) ? { ...raw_options } : raw_options;
418
+ const cleanups = raw_targets.flatMap((el) => raw_events.flatMap((event) => raw_listeners.map((listener) => register(el, event, listener, optionsClone))));
419
+ onCleanup(() => {
420
+ cleanups.forEach((fn) => fn());
421
+ });
422
+ }, { flush: "post" });
423
+ }
424
+ // @__NO_SIDE_EFFECTS__
425
+ function useMounted() {
426
+ const isMounted = vue.shallowRef(false);
427
+ const instance = vue.getCurrentInstance();
428
+ if (instance) vue.onMounted(() => {
429
+ isMounted.value = true;
430
+ }, instance);
431
+ return isMounted;
432
+ }
433
+ // @__NO_SIDE_EFFECTS__
434
+ function useSupported(callback) {
435
+ const isMounted = /* @__PURE__ */ useMounted();
436
+ return vue.computed(() => {
437
+ isMounted.value;
438
+ return Boolean(callback());
439
+ });
440
+ }
441
+ const ssrWidthSymbol = Symbol("vueuse-ssr-width");
442
+ // @__NO_SIDE_EFFECTS__
443
+ function useSSRWidth() {
444
+ const ssrWidth = vue.hasInjectionContext() ? /* @__PURE__ */ injectLocal(ssrWidthSymbol, null) : null;
445
+ return typeof ssrWidth === "number" ? ssrWidth : void 0;
446
+ }
447
+ function useMediaQuery(query, options = {}) {
448
+ const { window: window$1 = defaultWindow, ssrWidth = /* @__PURE__ */ useSSRWidth() } = options;
449
+ const isSupported = /* @__PURE__ */ useSupported(() => window$1 && "matchMedia" in window$1 && typeof window$1.matchMedia === "function");
450
+ const ssrSupport = vue.shallowRef(typeof ssrWidth === "number");
451
+ const mediaQuery = vue.shallowRef();
452
+ const matches = vue.shallowRef(false);
453
+ const handler = (event) => {
454
+ matches.value = event.matches;
455
+ };
456
+ vue.watchEffect(() => {
457
+ if (ssrSupport.value) {
458
+ ssrSupport.value = !isSupported.value;
459
+ matches.value = vue.toValue(query).split(",").some((queryString) => {
460
+ const not = queryString.includes("not all");
461
+ const minWidth = queryString.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
462
+ const maxWidth = queryString.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
463
+ let res = Boolean(minWidth || maxWidth);
464
+ if (minWidth && res) res = ssrWidth >= pxValue(minWidth[1]);
465
+ if (maxWidth && res) res = ssrWidth <= pxValue(maxWidth[1]);
466
+ return not ? !res : res;
467
+ });
468
+ return;
469
+ }
470
+ if (!isSupported.value) return;
471
+ mediaQuery.value = window$1.matchMedia(vue.toValue(query));
472
+ matches.value = mediaQuery.value.matches;
473
+ });
474
+ useEventListener(mediaQuery, "change", handler, { passive: true });
475
+ return vue.computed(() => matches.value);
476
+ }
477
+ // @__NO_SIDE_EFFECTS__
478
+ function useBreakpoints(breakpoints, options = {}) {
479
+ function getValue$1(k, delta) {
480
+ let v = vue.toValue(breakpoints[vue.toValue(k)]);
481
+ if (delta != null) v = increaseWithUnit(v, delta);
482
+ if (typeof v === "number") v = `${v}px`;
483
+ return v;
484
+ }
485
+ const { window: window$1 = defaultWindow, strategy = "min-width", ssrWidth = /* @__PURE__ */ useSSRWidth() } = options;
486
+ const ssrSupport = typeof ssrWidth === "number";
487
+ const mounted = ssrSupport ? vue.shallowRef(false) : { value: true };
488
+ if (ssrSupport) tryOnMounted(() => mounted.value = !!window$1);
489
+ function match(query, size) {
490
+ if (!mounted.value && ssrSupport) return query === "min" ? ssrWidth >= pxValue(size) : ssrWidth <= pxValue(size);
491
+ if (!window$1) return false;
492
+ return window$1.matchMedia(`(${query}-width: ${size})`).matches;
493
+ }
494
+ const greaterOrEqual = (k) => {
495
+ return useMediaQuery(() => `(min-width: ${getValue$1(k)})`, options);
496
+ };
497
+ const smallerOrEqual = (k) => {
498
+ return useMediaQuery(() => `(max-width: ${getValue$1(k)})`, options);
499
+ };
500
+ const shortcutMethods = Object.keys(breakpoints).reduce((shortcuts, k) => {
501
+ Object.defineProperty(shortcuts, k, {
502
+ get: () => strategy === "min-width" ? greaterOrEqual(k) : smallerOrEqual(k),
503
+ enumerable: true,
504
+ configurable: true
505
+ });
506
+ return shortcuts;
507
+ }, {});
508
+ function current() {
509
+ const points = Object.keys(breakpoints).map((k) => [
510
+ k,
511
+ shortcutMethods[k],
512
+ pxValue(getValue$1(k))
513
+ ]).sort((a, b) => a[2] - b[2]);
514
+ return vue.computed(() => points.filter(([, v]) => v.value).map(([k]) => k));
515
+ }
516
+ return Object.assign(shortcutMethods, {
517
+ greaterOrEqual,
518
+ smallerOrEqual,
519
+ greater(k) {
520
+ return useMediaQuery(() => `(min-width: ${getValue$1(k, 0.1)})`, options);
521
+ },
522
+ smaller(k) {
523
+ return useMediaQuery(() => `(max-width: ${getValue$1(k, -0.1)})`, options);
524
+ },
525
+ between(a, b) {
526
+ return useMediaQuery(() => `(min-width: ${getValue$1(a)}) and (max-width: ${getValue$1(b, -0.1)})`, options);
527
+ },
528
+ isGreater(k) {
529
+ return match("min", getValue$1(k, 0.1));
530
+ },
531
+ isGreaterOrEqual(k) {
532
+ return match("min", getValue$1(k));
533
+ },
534
+ isSmaller(k) {
535
+ return match("max", getValue$1(k, -0.1));
536
+ },
537
+ isSmallerOrEqual(k) {
538
+ return match("max", getValue$1(k));
539
+ },
540
+ isInBetween(a, b) {
541
+ return match("min", getValue$1(a)) && match("max", getValue$1(b, -0.1));
542
+ },
543
+ current,
544
+ active() {
545
+ const bps = current();
546
+ return vue.computed(() => bps.value.length === 0 ? "" : bps.value.at(strategy === "min-width" ? -1 : 0));
547
+ }
548
+ });
549
+ }
349
550
  const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
350
551
  __name: "ResponsiveList",
351
552
  props: {
@@ -375,16 +576,6 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
375
576
  main: col.main
376
577
  }))
377
578
  );
378
- const breakpointClass = vue.computed(() => {
379
- const breakpoints = {
380
- sm: { mobile: "sm:hidden", desktop: "hidden sm:block" },
381
- md: { mobile: "md:hidden", desktop: "hidden md:block" },
382
- lg: { mobile: "lg:hidden", desktop: "hidden lg:block" },
383
- xl: { mobile: "xl:hidden", desktop: "hidden xl:block" },
384
- "2xl": { mobile: "2xl:hidden", desktop: "hidden 2xl:block" }
385
- };
386
- return breakpoints[props.breakpoint];
387
- });
388
579
  const getCellValue = (item, key) => {
389
580
  const keys = key.split(".");
390
581
  let value = item;
@@ -401,78 +592,79 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
401
592
  return !!slots[`cell-${key}`];
402
593
  };
403
594
  const hasActionsSlot = vue.computed(() => !!slots.actions);
595
+ const breakpoints = /* @__PURE__ */ useBreakpoints({
596
+ sm: 640,
597
+ md: 768,
598
+ lg: 1024,
599
+ xl: 1280,
600
+ "2xl": 1536
601
+ });
602
+ const isDesktop = vue.computed(() => breakpoints.greaterOrEqual(props.breakpoint).value);
404
603
  return (_ctx, _cache) => {
405
604
  return vue.openBlock(), vue.createElementBlock("div", null, [
406
- vue.createElementVNode("div", {
407
- class: vue.normalizeClass(breakpointClass.value.mobile)
605
+ !isDesktop.value ? (vue.openBlock(), vue.createBlock(_sfc_main$9, {
606
+ key: 0,
607
+ items: __props.items,
608
+ "key-field": __props.keyField,
609
+ selectable: __props.selectable,
610
+ "selected-items": __props.selectedItems,
611
+ "selectable-filter": __props.selectableFilter,
612
+ onSelect: _cache[0] || (_cache[0] = ($event) => emit("select", $event)),
613
+ onSelectAll: _cache[1] || (_cache[1] = ($event) => emit("selectAll"))
614
+ }, {
615
+ avatar: vue.withCtx(({ item }) => [
616
+ vue.renderSlot(_ctx.$slots, "avatar", { item })
617
+ ]),
618
+ content: vue.withCtx(({ item }) => [
619
+ vue.renderSlot(_ctx.$slots, "mobileContent", { item })
620
+ ]),
621
+ actions: vue.withCtx(({ item }) => [
622
+ vue.renderSlot(_ctx.$slots, "mobileActions", { item }, () => [
623
+ vue.renderSlot(_ctx.$slots, "actions", { item })
624
+ ])
625
+ ]),
626
+ empty: vue.withCtx(() => [
627
+ vue.renderSlot(_ctx.$slots, "empty")
628
+ ]),
629
+ _: 3
630
+ }, 8, ["items", "key-field", "selectable", "selected-items", "selectable-filter"])) : (vue.openBlock(), vue.createBlock(_sfc_main$a, {
631
+ key: 1,
632
+ items: __props.items,
633
+ properties: tableProperties.value,
634
+ "key-field": __props.keyField,
635
+ selectable: __props.selectable,
636
+ "selected-items": __props.selectedItems,
637
+ "selectable-filter": __props.selectableFilter,
638
+ onSelect: _cache[2] || (_cache[2] = ($event) => emit("select", $event)),
639
+ onSelectAll: _cache[3] || (_cache[3] = ($event) => emit("selectAll"))
640
+ }, vue.createSlots({
641
+ empty: vue.withCtx(() => [
642
+ vue.renderSlot(_ctx.$slots, "empty")
643
+ ]),
644
+ _: 2
408
645
  }, [
409
- vue.createVNode(_sfc_main$9, {
410
- items: __props.items,
411
- "key-field": __props.keyField,
412
- selectable: __props.selectable,
413
- "selected-items": __props.selectedItems,
414
- "selectable-filter": __props.selectableFilter,
415
- onSelect: _cache[0] || (_cache[0] = ($event) => emit("select", $event)),
416
- onSelectAll: _cache[1] || (_cache[1] = ($event) => emit("selectAll"))
417
- }, {
418
- avatar: vue.withCtx(({ item }) => [
419
- vue.renderSlot(_ctx.$slots, "avatar", { item })
420
- ]),
421
- content: vue.withCtx(({ item }) => [
422
- vue.renderSlot(_ctx.$slots, "mobileContent", { item })
423
- ]),
424
- actions: vue.withCtx(({ item }) => [
425
- vue.renderSlot(_ctx.$slots, "mobileActions", { item }, () => [
426
- vue.renderSlot(_ctx.$slots, "actions", { item })
646
+ vue.renderList(__props.columns, (col) => {
647
+ return {
648
+ name: `item-${getColumnKey(col)}`,
649
+ fn: vue.withCtx(({ item, value }) => [
650
+ hasCellSlot(getColumnKey(col)) ? vue.renderSlot(_ctx.$slots, `cell-${getColumnKey(col)}`, {
651
+ key: 0,
652
+ item,
653
+ value: getCellValue(item, getColumnKey(col))
654
+ }) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
655
+ vue.createTextVNode(vue.toDisplayString(value), 1)
656
+ ], 64))
427
657
  ])
658
+ };
659
+ }),
660
+ hasActionsSlot.value ? {
661
+ name: "action",
662
+ fn: vue.withCtx(({ item }) => [
663
+ vue.renderSlot(_ctx.$slots, "actions", { item })
428
664
  ]),
429
- empty: vue.withCtx(() => [
430
- vue.renderSlot(_ctx.$slots, "empty")
431
- ]),
432
- _: 3
433
- }, 8, ["items", "key-field", "selectable", "selected-items", "selectable-filter"])
434
- ], 2),
435
- vue.createElementVNode("div", {
436
- class: vue.normalizeClass(breakpointClass.value.desktop)
437
- }, [
438
- vue.createVNode(_sfc_main$a, {
439
- items: __props.items,
440
- properties: tableProperties.value,
441
- "key-field": __props.keyField,
442
- selectable: __props.selectable,
443
- "selected-items": __props.selectedItems,
444
- "selectable-filter": __props.selectableFilter,
445
- onSelect: _cache[2] || (_cache[2] = ($event) => emit("select", $event)),
446
- onSelectAll: _cache[3] || (_cache[3] = ($event) => emit("selectAll"))
447
- }, vue.createSlots({
448
- empty: vue.withCtx(() => [
449
- vue.renderSlot(_ctx.$slots, "empty")
450
- ]),
451
- _: 2
452
- }, [
453
- vue.renderList(__props.columns, (col) => {
454
- return {
455
- name: `item-${getColumnKey(col)}`,
456
- fn: vue.withCtx(({ item, value }) => [
457
- hasCellSlot(getColumnKey(col)) ? vue.renderSlot(_ctx.$slots, `cell-${getColumnKey(col)}`, {
458
- key: 0,
459
- item,
460
- value: getCellValue(item, getColumnKey(col))
461
- }) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
462
- vue.createTextVNode(vue.toDisplayString(value), 1)
463
- ], 64))
464
- ])
465
- };
466
- }),
467
- hasActionsSlot.value ? {
468
- name: "action",
469
- fn: vue.withCtx(({ item }) => [
470
- vue.renderSlot(_ctx.$slots, "actions", { item })
471
- ]),
472
- key: "0"
473
- } : void 0
474
- ]), 1032, ["items", "properties", "key-field", "selectable", "selected-items", "selectable-filter"])
475
- ], 2)
665
+ key: "0"
666
+ } : void 0
667
+ ]), 1032, ["items", "properties", "key-field", "selectable", "selected-items", "selectable-filter"]))
476
668
  ]);
477
669
  };
478
670
  }
@@ -1279,4 +1471,4 @@ exports._sfc_main$6 = _sfc_main$5;
1279
1471
  exports._sfc_main$7 = _sfc_main$4;
1280
1472
  exports._sfc_main$8 = _sfc_main$3;
1281
1473
  exports._sfc_main$9 = _sfc_main$2;
1282
- //# sourceMappingURL=CollapsibleCard.vue_vue_type_script_setup_true_lang-Cs6KGC-0.cjs.map
1474
+ //# sourceMappingURL=CollapsibleCard.vue_vue_type_script_setup_true_lang-BJdxIJo5.cjs.map