cisse-vue-ui 0.5.11 → 0.5.13

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,55 +1,61 @@
1
- import { defineComponent, createElementBlock, openBlock, createCommentVNode, renderSlot, createElementVNode, createTextVNode, toDisplayString, useSlots, computed, createVNode, Fragment, renderList, normalizeClass, createBlock, resolveDynamicComponent, withCtx, onMounted, nextTick, getCurrentInstance, getCurrentScope, hasInjectionContext, inject, watch, shallowRef, toValue, watchEffect, unref, createSlots, ref, withDirectives, vModelText, withModifiers, Teleport, Transition, normalizeStyle, resolveComponent, mergeProps, provide, vShow, onUnmounted } from "vue";
1
+ import { defineComponent, computed, createElementBlock, openBlock, createCommentVNode, renderSlot, normalizeClass, createElementVNode, createTextVNode, toDisplayString, useSlots, createVNode, Fragment, renderList, createBlock, resolveDynamicComponent, withCtx, onMounted, nextTick, getCurrentInstance, getCurrentScope, hasInjectionContext, inject, watch, shallowRef, toValue, watchEffect, unref, createSlots, ref, withDirectives, vModelText, withModifiers, Teleport, Transition, normalizeStyle, resolveComponent, mergeProps, provide, vShow, onUnmounted } from "vue";
2
2
  import { _ as _sfc_main$j } from "./Checkbox.vue_vue_type_script_setup_true_lang-B-nLCCNY.js";
3
3
  import { e as _sfc_main$k, d as _sfc_main$l, c as _sfc_main$m, b as _sfc_main$n, a as _sfc_main$o } from "./BadgeType.vue_vue_type_script_setup_true_lang-CnB5eNEM.js";
4
4
  import { Icon } from "@iconify/vue";
5
5
  import { u as useDropdown } from "./useDropdown-iVu14E6s.js";
6
6
  const _hoisted_1$c = { class: "flex flex-col overflow-hidden rounded-lg bg-white shadow-md dark:bg-slate-950" };
7
- const _hoisted_2$9 = {
8
- key: 0,
9
- class: "border-b border-gray-200 dark:border-gray-700"
10
- };
7
+ const _hoisted_2$9 = { class: "flex flex-col gap-0.5" };
11
8
  const _hoisted_3$7 = {
12
- key: 1,
13
- class: "flex items-center justify-between border-b border-gray-200 px-5 py-3 dark:border-gray-700"
14
- };
15
- const _hoisted_4$6 = { class: "flex flex-col gap-0.5" };
16
- const _hoisted_5$4 = {
17
- key: 0,
18
- class: "text-md font-semibold text-gray-800 dark:text-gray-200"
19
- };
20
- const _hoisted_6$4 = {
21
9
  key: 1,
22
10
  class: "text-sm font-normal text-gray-600 dark:text-gray-400"
23
11
  };
24
- const _hoisted_7$4 = { class: "flex gap-2" };
12
+ const _hoisted_4$6 = { class: "flex gap-2" };
25
13
  const _sfc_main$i = /* @__PURE__ */ defineComponent({
26
14
  __name: "CardComponent",
27
15
  props: {
28
16
  title: {},
29
- description: {}
17
+ description: {},
18
+ titleClass: {},
19
+ dividerClass: {}
30
20
  },
31
21
  setup(__props) {
22
+ const props = __props;
23
+ const titleClasses = computed(
24
+ () => props.titleClass || "text-gray-800 dark:text-gray-200"
25
+ );
26
+ const dividerClasses = computed(
27
+ () => props.dividerClass || "border-gray-200 dark:border-gray-700"
28
+ );
32
29
  return (_ctx, _cache) => {
33
30
  return openBlock(), createElementBlock("div", _hoisted_1$c, [
34
- _ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_2$9, [
31
+ _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
32
+ key: 0,
33
+ class: normalizeClass(["border-b", dividerClasses.value])
34
+ }, [
35
35
  renderSlot(_ctx.$slots, "header")
36
- ])) : __props.title || __props.description || _ctx.$slots.title || _ctx.$slots.description || _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_3$7, [
37
- createElementVNode("div", _hoisted_4$6, [
38
- __props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span", _hoisted_5$4, [
36
+ ], 2)) : __props.title || __props.description || _ctx.$slots.title || _ctx.$slots.description || _ctx.$slots.actions ? (openBlock(), createElementBlock("div", {
37
+ key: 1,
38
+ class: normalizeClass(["flex items-center justify-between border-b px-5 py-3", dividerClasses.value])
39
+ }, [
40
+ createElementVNode("div", _hoisted_2$9, [
41
+ __props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span", {
42
+ key: 0,
43
+ class: normalizeClass(["text-md font-semibold", titleClasses.value])
44
+ }, [
39
45
  renderSlot(_ctx.$slots, "title", {}, () => [
40
46
  createTextVNode(toDisplayString(__props.title), 1)
41
47
  ])
42
- ])) : createCommentVNode("", true),
43
- __props.description || _ctx.$slots.description ? (openBlock(), createElementBlock("span", _hoisted_6$4, [
48
+ ], 2)) : createCommentVNode("", true),
49
+ __props.description || _ctx.$slots.description ? (openBlock(), createElementBlock("span", _hoisted_3$7, [
44
50
  renderSlot(_ctx.$slots, "description", {}, () => [
45
51
  createTextVNode(toDisplayString(__props.description), 1)
46
52
  ])
47
53
  ])) : createCommentVNode("", true)
48
54
  ]),
49
- createElementVNode("div", _hoisted_7$4, [
55
+ createElementVNode("div", _hoisted_4$6, [
50
56
  renderSlot(_ctx.$slots, "actions")
51
57
  ])
52
- ])) : createCommentVNode("", true),
58
+ ], 2)) : createCommentVNode("", true),
53
59
  renderSlot(_ctx.$slots, "default")
54
60
  ]);
55
61
  };
@@ -63,20 +69,29 @@ const _hoisted_5$3 = {
63
69
  key: 0,
64
70
  class: "w-12 px-3 py-3"
65
71
  };
66
- const _hoisted_6$3 = {
72
+ const _hoisted_6$3 = ["onClick"];
73
+ const _hoisted_7$3 = {
74
+ key: 0,
75
+ d: "M7 14l5-5 5 5H7z"
76
+ };
77
+ const _hoisted_8$3 = {
78
+ key: 1,
79
+ d: "M7 10l5 5 5-5H7z"
80
+ };
81
+ const _hoisted_9$3 = {
67
82
  key: 1,
68
83
  class: "px-3 py-3 text-right"
69
84
  };
70
- const _hoisted_7$3 = { class: "divide-y divide-black/10 font-medium dark:divide-white/10" };
71
- const _hoisted_8$3 = {
85
+ const _hoisted_10$2 = { class: "divide-y divide-black/10 font-medium dark:divide-white/10" };
86
+ const _hoisted_11$1 = {
72
87
  key: 0,
73
88
  class: "px-3 py-4"
74
89
  };
75
- const _hoisted_9$3 = {
90
+ const _hoisted_12$1 = {
76
91
  key: 1,
77
92
  class: "flex items-center justify-end gap-2 px-3 py-4"
78
93
  };
79
- const _hoisted_10$2 = { key: 0 };
94
+ const _hoisted_13 = { key: 0 };
80
95
  const _sfc_main$h = /* @__PURE__ */ defineComponent({
81
96
  __name: "TableComponent",
82
97
  props: {
@@ -85,9 +100,11 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
85
100
  selectable: { type: Boolean, default: false },
86
101
  selectedItems: {},
87
102
  selectableFilter: {},
88
- keyField: { default: "id" }
103
+ keyField: { default: "id" },
104
+ sortBy: {},
105
+ sortDirection: {}
89
106
  },
90
- emits: ["select", "selectAll"],
107
+ emits: ["select", "selectAll", "sort"],
91
108
  setup(__props, { emit: __emit }) {
92
109
  const slots = useSlots();
93
110
  const props = __props;
@@ -165,6 +182,14 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
165
182
  emit("select", getKey(item));
166
183
  };
167
184
  const hasActionSlot = computed(() => !!slots.action);
185
+ const handleSort = (property) => {
186
+ if (!property.sortable) return;
187
+ const newDirection = props.sortBy === property.name && props.sortDirection === "asc" ? "desc" : "asc";
188
+ emit("sort", property.name, newDirection);
189
+ };
190
+ const isSortedColumn = (property) => {
191
+ return props.sortBy === property.name;
192
+ };
168
193
  return (_ctx, _cache) => {
169
194
  return openBlock(), createElementBlock("div", _hoisted_1$b, [
170
195
  createElementVNode("div", _hoisted_2$8, [
@@ -182,23 +207,55 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
182
207
  (openBlock(true), createElementBlock(Fragment, null, renderList(visibleProperties.value, (property) => {
183
208
  return openBlock(), createElementBlock("th", {
184
209
  key: property.name,
185
- class: normalizeClass([getAlignmentClass(property.align), "px-3 py-3"])
210
+ class: normalizeClass([
211
+ getAlignmentClass(property.align),
212
+ "px-3 py-3",
213
+ property.sortable ? "cursor-pointer select-none hover:bg-black/5 dark:hover:bg-white/5" : ""
214
+ ]),
215
+ onClick: ($event) => handleSort(property)
186
216
  }, [
187
- renderSlot(_ctx.$slots, "header-" + property.name, { property }, () => [
188
- createTextVNode(toDisplayString(property.label ?? property.name), 1)
189
- ])
190
- ], 2);
217
+ createElementVNode("div", {
218
+ class: normalizeClass(["flex items-center gap-1", {
219
+ "justify-center": property.align === "center",
220
+ "justify-end": property.align === "right"
221
+ }])
222
+ }, [
223
+ renderSlot(_ctx.$slots, "header-" + property.name, { property }, () => [
224
+ createTextVNode(toDisplayString(property.label ?? property.name), 1)
225
+ ]),
226
+ property.sortable ? (openBlock(), createElementBlock("svg", {
227
+ key: 0,
228
+ class: normalizeClass([
229
+ "w-4 h-4 transition-colors",
230
+ isSortedColumn(property) ? "text-primary-500" : "text-gray-400"
231
+ ]),
232
+ viewBox: "0 0 24 24",
233
+ fill: "currentColor"
234
+ }, [
235
+ isSortedColumn(property) && __props.sortDirection === "asc" ? (openBlock(), createElementBlock("path", _hoisted_7$3)) : isSortedColumn(property) && __props.sortDirection === "desc" ? (openBlock(), createElementBlock("path", _hoisted_8$3)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
236
+ _cache[1] || (_cache[1] = createElementVNode("path", {
237
+ d: "M7 14l5-5 5 5H7z",
238
+ class: "opacity-40"
239
+ }, null, -1)),
240
+ _cache[2] || (_cache[2] = createElementVNode("path", {
241
+ d: "M7 10l5 5 5-5H7z",
242
+ class: "opacity-40"
243
+ }, null, -1))
244
+ ], 64))
245
+ ], 2)) : createCommentVNode("", true)
246
+ ], 2)
247
+ ], 10, _hoisted_6$3);
191
248
  }), 128)),
192
- hasActionSlot.value ? (openBlock(), createElementBlock("th", _hoisted_6$3)) : createCommentVNode("", true)
249
+ hasActionSlot.value ? (openBlock(), createElementBlock("th", _hoisted_9$3)) : createCommentVNode("", true)
193
250
  ])
194
251
  ]),
195
- createElementVNode("tbody", _hoisted_7$3, [
252
+ createElementVNode("tbody", _hoisted_10$2, [
196
253
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item) => {
197
254
  return openBlock(), createElementBlock("tr", {
198
255
  key: getKey(item),
199
256
  class: normalizeClass(["hover:bg-black/5 dark:hover:bg-white/5 transition-colors", { "bg-primary/5 dark:bg-primary/10": isSelected(item) }])
200
257
  }, [
201
- __props.selectable ? (openBlock(), createElementBlock("td", _hoisted_8$3, [
258
+ __props.selectable ? (openBlock(), createElementBlock("td", _hoisted_11$1, [
202
259
  isSelectable(item) ? (openBlock(), createBlock(_sfc_main$j, {
203
260
  key: 0,
204
261
  "model-value": isSelected(item),
@@ -226,7 +283,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
226
283
  ])
227
284
  ], 2);
228
285
  }), 128)),
229
- hasActionSlot.value ? (openBlock(), createElementBlock("td", _hoisted_9$3, [
286
+ hasActionSlot.value ? (openBlock(), createElementBlock("td", _hoisted_12$1, [
230
287
  renderSlot(_ctx.$slots, "action", { item })
231
288
  ])) : createCommentVNode("", true)
232
289
  ], 2);
@@ -234,7 +291,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
234
291
  ])
235
292
  ])
236
293
  ]),
237
- !__props.items || __props.items.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_10$2, [
294
+ !__props.items || __props.items.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_13, [
238
295
  renderSlot(_ctx.$slots, "empty")
239
296
  ])) : createCommentVNode("", true)
240
297
  ]);
@@ -567,9 +624,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
567
624
  selectable: { type: Boolean, default: false },
568
625
  selectedItems: {},
569
626
  selectableFilter: {},
570
- breakpoint: { default: "lg" }
627
+ breakpoint: { default: "lg" },
628
+ sortBy: {},
629
+ sortDirection: {}
571
630
  },
572
- emits: ["select", "selectAll"],
631
+ emits: ["select", "selectAll", "sort"],
573
632
  setup(__props, { emit: __emit }) {
574
633
  const props = __props;
575
634
  const emit = __emit;
@@ -647,8 +706,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
647
706
  selectable: __props.selectable,
648
707
  "selected-items": __props.selectedItems,
649
708
  "selectable-filter": __props.selectableFilter,
709
+ "sort-by": __props.sortBy,
710
+ "sort-direction": __props.sortDirection,
650
711
  onSelect: _cache[2] || (_cache[2] = ($event) => emit("select", $event)),
651
- onSelectAll: _cache[3] || (_cache[3] = ($event) => emit("selectAll"))
712
+ onSelectAll: _cache[3] || (_cache[3] = ($event) => emit("selectAll")),
713
+ onSort: _cache[4] || (_cache[4] = (col, dir) => emit("sort", col, dir))
652
714
  }, createSlots({
653
715
  empty: withCtx(() => [
654
716
  renderSlot(_ctx.$slots, "empty")
@@ -676,7 +738,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
676
738
  ]),
677
739
  key: "0"
678
740
  } : void 0
679
- ]), 1032, ["items", "properties", "key-field", "selectable", "selected-items", "selectable-filter"])
741
+ ]), 1032, ["items", "properties", "key-field", "selectable", "selected-items", "selectable-filter", "sort-by", "sort-direction"])
680
742
  ]),
681
743
  _: 3
682
744
  }))
@@ -2077,4 +2139,4 @@ export {
2077
2139
  _sfc_main$1 as q,
2078
2140
  _sfc_main as r
2079
2141
  };
2080
- //# sourceMappingURL=Timeline.vue_vue_type_script_setup_true_lang-SaNCS3ie.js.map
2142
+ //# sourceMappingURL=Timeline.vue_vue_type_script_setup_true_lang-CuPF4MPe.js.map