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