cisse-vue-ui 0.5.12 → 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.
@@ -69,20 +69,29 @@ const _hoisted_5$3 = {
69
69
  key: 0,
70
70
  class: "w-12 px-3 py-3"
71
71
  };
72
- 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 = {
73
82
  key: 1,
74
83
  class: "px-3 py-3 text-right"
75
84
  };
76
- const _hoisted_7$3 = { class: "divide-y divide-black/10 font-medium dark:divide-white/10" };
77
- 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 = {
78
87
  key: 0,
79
88
  class: "px-3 py-4"
80
89
  };
81
- const _hoisted_9$3 = {
90
+ const _hoisted_12$1 = {
82
91
  key: 1,
83
92
  class: "flex items-center justify-end gap-2 px-3 py-4"
84
93
  };
85
- const _hoisted_10$2 = { key: 0 };
94
+ const _hoisted_13 = { key: 0 };
86
95
  const _sfc_main$h = /* @__PURE__ */ defineComponent({
87
96
  __name: "TableComponent",
88
97
  props: {
@@ -91,9 +100,11 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
91
100
  selectable: { type: Boolean, default: false },
92
101
  selectedItems: {},
93
102
  selectableFilter: {},
94
- keyField: { default: "id" }
103
+ keyField: { default: "id" },
104
+ sortBy: {},
105
+ sortDirection: {}
95
106
  },
96
- emits: ["select", "selectAll"],
107
+ emits: ["select", "selectAll", "sort"],
97
108
  setup(__props, { emit: __emit }) {
98
109
  const slots = useSlots();
99
110
  const props = __props;
@@ -171,6 +182,14 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
171
182
  emit("select", getKey(item));
172
183
  };
173
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
+ };
174
193
  return (_ctx, _cache) => {
175
194
  return openBlock(), createElementBlock("div", _hoisted_1$b, [
176
195
  createElementVNode("div", _hoisted_2$8, [
@@ -188,23 +207,55 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
188
207
  (openBlock(true), createElementBlock(Fragment, null, renderList(visibleProperties.value, (property) => {
189
208
  return openBlock(), createElementBlock("th", {
190
209
  key: property.name,
191
- 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)
192
216
  }, [
193
- renderSlot(_ctx.$slots, "header-" + property.name, { property }, () => [
194
- createTextVNode(toDisplayString(property.label ?? property.name), 1)
195
- ])
196
- ], 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);
197
248
  }), 128)),
198
- hasActionSlot.value ? (openBlock(), createElementBlock("th", _hoisted_6$3)) : createCommentVNode("", true)
249
+ hasActionSlot.value ? (openBlock(), createElementBlock("th", _hoisted_9$3)) : createCommentVNode("", true)
199
250
  ])
200
251
  ]),
201
- createElementVNode("tbody", _hoisted_7$3, [
252
+ createElementVNode("tbody", _hoisted_10$2, [
202
253
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item) => {
203
254
  return openBlock(), createElementBlock("tr", {
204
255
  key: getKey(item),
205
256
  class: normalizeClass(["hover:bg-black/5 dark:hover:bg-white/5 transition-colors", { "bg-primary/5 dark:bg-primary/10": isSelected(item) }])
206
257
  }, [
207
- __props.selectable ? (openBlock(), createElementBlock("td", _hoisted_8$3, [
258
+ __props.selectable ? (openBlock(), createElementBlock("td", _hoisted_11$1, [
208
259
  isSelectable(item) ? (openBlock(), createBlock(_sfc_main$j, {
209
260
  key: 0,
210
261
  "model-value": isSelected(item),
@@ -232,7 +283,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
232
283
  ])
233
284
  ], 2);
234
285
  }), 128)),
235
- hasActionSlot.value ? (openBlock(), createElementBlock("td", _hoisted_9$3, [
286
+ hasActionSlot.value ? (openBlock(), createElementBlock("td", _hoisted_12$1, [
236
287
  renderSlot(_ctx.$slots, "action", { item })
237
288
  ])) : createCommentVNode("", true)
238
289
  ], 2);
@@ -240,7 +291,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
240
291
  ])
241
292
  ])
242
293
  ]),
243
- !__props.items || __props.items.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_10$2, [
294
+ !__props.items || __props.items.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_13, [
244
295
  renderSlot(_ctx.$slots, "empty")
245
296
  ])) : createCommentVNode("", true)
246
297
  ]);
@@ -573,9 +624,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
573
624
  selectable: { type: Boolean, default: false },
574
625
  selectedItems: {},
575
626
  selectableFilter: {},
576
- breakpoint: { default: "lg" }
627
+ breakpoint: { default: "lg" },
628
+ sortBy: {},
629
+ sortDirection: {}
577
630
  },
578
- emits: ["select", "selectAll"],
631
+ emits: ["select", "selectAll", "sort"],
579
632
  setup(__props, { emit: __emit }) {
580
633
  const props = __props;
581
634
  const emit = __emit;
@@ -653,8 +706,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
653
706
  selectable: __props.selectable,
654
707
  "selected-items": __props.selectedItems,
655
708
  "selectable-filter": __props.selectableFilter,
709
+ "sort-by": __props.sortBy,
710
+ "sort-direction": __props.sortDirection,
656
711
  onSelect: _cache[2] || (_cache[2] = ($event) => emit("select", $event)),
657
- 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))
658
714
  }, createSlots({
659
715
  empty: withCtx(() => [
660
716
  renderSlot(_ctx.$slots, "empty")
@@ -682,7 +738,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
682
738
  ]),
683
739
  key: "0"
684
740
  } : void 0
685
- ]), 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"])
686
742
  ]),
687
743
  _: 3
688
744
  }))
@@ -2083,4 +2139,4 @@ export {
2083
2139
  _sfc_main$1 as q,
2084
2140
  _sfc_main as r
2085
2141
  };
2086
- //# sourceMappingURL=Timeline.vue_vue_type_script_setup_true_lang-go_BS8Q4.js.map
2142
+ //# sourceMappingURL=Timeline.vue_vue_type_script_setup_true_lang-CuPF4MPe.js.map