@itguy614/clean-ui 0.9.0 → 1.0.0
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/dist/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/clean-ui.css +1 -1
- package/dist/components/CuiAccordion.vue.js +7 -0
- package/dist/components/CuiAccordion.vue2.js +55 -0
- package/dist/components/CuiAccordionItem.vue.js +7 -0
- package/dist/components/CuiAccordionItem.vue2.js +91 -0
- package/dist/components/CuiAlert.vue.js +7 -0
- package/dist/components/CuiAlert.vue2.js +110 -0
- package/dist/components/CuiAvatar.vue.js +99 -0
- package/dist/components/CuiAvatar.vue3.js +5 -0
- package/dist/components/CuiAvatarGroup.vue.js +22 -0
- package/dist/components/CuiAvatarGroup.vue3.js +5 -0
- package/dist/components/CuiBackdrop.vue.js +7 -0
- package/dist/components/CuiBackdrop.vue2.js +49 -0
- package/dist/components/CuiBadge.vue.js +7 -0
- package/dist/components/CuiBadge.vue2.js +79 -0
- package/dist/components/CuiBanner.vue.js +81 -0
- package/dist/components/CuiBanner.vue2.js +4 -0
- package/dist/components/CuiBreadcrumb.vue.js +7 -0
- package/dist/components/CuiBreadcrumb.vue2.js +29 -0
- package/dist/components/CuiBreadcrumbItem.vue.js +7 -0
- package/dist/components/CuiBreadcrumbItem.vue2.js +46 -0
- package/dist/components/CuiButton.vue.js +7 -0
- package/dist/components/CuiButton.vue2.js +133 -0
- package/dist/components/CuiButtonGroup.vue.js +7 -0
- package/dist/components/CuiButtonGroup.vue2.js +21 -0
- package/dist/components/CuiCard.vue.js +35 -0
- package/dist/components/CuiCard.vue2.js +4 -0
- package/dist/components/CuiCardBody.vue.js +20 -0
- package/dist/components/CuiCardBody.vue2.js +4 -0
- package/dist/components/CuiCardFooter.vue.js +32 -0
- package/dist/components/CuiCardFooter.vue2.js +4 -0
- package/dist/components/CuiCardHeader.vue.js +51 -0
- package/dist/components/CuiCardHeader.vue2.js +4 -0
- package/dist/components/CuiCardMedia.vue.js +7 -0
- package/dist/components/CuiCardMedia.vue2.js +38 -0
- package/dist/components/CuiCheckbox.vue.js +7 -0
- package/dist/components/CuiCheckbox.vue2.js +105 -0
- package/dist/components/CuiCheckboxGroup.vue.js +7 -0
- package/dist/components/CuiCheckboxGroup.vue2.js +59 -0
- package/dist/components/CuiCodeBlock.vue.js +129 -0
- package/dist/components/CuiCodeBlock.vue2.js +4 -0
- package/dist/components/CuiColorPicker.vue.js +348 -0
- package/dist/components/CuiColorPicker.vue2.js +4 -0
- package/dist/components/CuiCombobox.vue.js +332 -0
- package/dist/components/CuiCombobox.vue2.js +4 -0
- package/dist/components/CuiConfigProvider.vue.js +18 -0
- package/dist/components/CuiConfigProvider.vue2.js +4 -0
- package/dist/components/CuiConfirmDialog.vue.js +208 -0
- package/dist/components/CuiConfirmDialog.vue2.js +4 -0
- package/dist/components/CuiContainer.vue.js +35 -0
- package/dist/components/CuiContainer.vue2.js +4 -0
- package/dist/components/CuiContextMenu.vue.js +7 -0
- package/dist/components/CuiContextMenu.vue2.js +136 -0
- package/dist/components/CuiCopyButton.vue.js +63 -0
- package/dist/components/CuiCopyButton.vue2.js +4 -0
- package/dist/components/CuiDataGrid.vue.js +176 -0
- package/dist/components/CuiDataGrid.vue3.js +5 -0
- package/dist/components/CuiDataGridActiveFilters.vue.js +47 -0
- package/dist/components/CuiDataGridActiveFilters.vue3.js +5 -0
- package/dist/components/CuiDataGridBulkBar.vue.d.ts.map +1 -1
- package/dist/components/CuiDataGridBulkBar.vue.js +70 -0
- package/dist/components/CuiDataGridBulkBar.vue3.js +5 -0
- package/dist/components/CuiDataGridCardView.vue.js +31 -0
- package/dist/components/CuiDataGridCardView.vue2.js +4 -0
- package/dist/components/CuiDataGridColumnManager.vue.js +86 -0
- package/dist/components/CuiDataGridColumnManager.vue2.js +4 -0
- package/dist/components/CuiDataGridFilterPanel.vue.js +181 -0
- package/dist/components/CuiDataGridFilterPanel.vue3.js +5 -0
- package/dist/components/CuiDataGridPagination.vue.js +28 -0
- package/dist/components/CuiDataGridPagination.vue2.js +4 -0
- package/dist/components/CuiDataGridSearch.vue.js +69 -0
- package/dist/components/CuiDataGridSearch.vue2.js +4 -0
- package/dist/components/CuiDataGridTable.vue.js +336 -0
- package/dist/components/CuiDataGridTable.vue2.js +4 -0
- package/dist/components/CuiDataGridToolbar.vue.js +73 -0
- package/dist/components/CuiDataGridToolbar.vue3.js +5 -0
- package/dist/components/CuiDataGridViewManager.vue.js +209 -0
- package/dist/components/CuiDataGridViewManager.vue2.js +4 -0
- package/dist/components/CuiDataGridViewToggle.vue.js +43 -0
- package/dist/components/CuiDataGridViewToggle.vue3.js +5 -0
- package/dist/components/CuiDatePicker.vue.js +382 -0
- package/dist/components/CuiDatePicker.vue2.js +4 -0
- package/dist/components/CuiDateRangePicker.vue.js +376 -0
- package/dist/components/CuiDateRangePicker.vue2.js +4 -0
- package/dist/components/CuiDivider.vue.js +124 -0
- package/dist/components/CuiDivider.vue2.js +4 -0
- package/dist/components/CuiDropdown.vue.js +7 -0
- package/dist/components/CuiDropdown.vue2.js +110 -0
- package/dist/components/CuiDropdownCheckItem.vue.js +7 -0
- package/dist/components/CuiDropdownCheckItem.vue2.js +45 -0
- package/dist/components/CuiDropdownDivider.vue.js +14 -0
- package/dist/components/CuiDropdownHeader.vue.js +16 -0
- package/dist/components/CuiDropdownItem.vue.js +7 -0
- package/dist/components/CuiDropdownItem.vue2.js +55 -0
- package/dist/components/CuiDropdownMenu.vue.js +7 -0
- package/dist/components/CuiDropdownMenu.vue2.js +79 -0
- package/dist/components/CuiDropdownRadioGroup.vue.js +23 -0
- package/dist/components/CuiDropdownRadioGroup.vue2.js +4 -0
- package/dist/components/CuiDropdownRadioItem.vue.js +7 -0
- package/dist/components/CuiDropdownRadioItem.vue2.js +43 -0
- package/dist/components/CuiDropdownSub.vue.js +7 -0
- package/dist/components/CuiDropdownSub.vue2.js +91 -0
- package/dist/components/CuiDropdownTrigger.vue.js +7 -0
- package/dist/components/CuiDropdownTrigger.vue2.js +25 -0
- package/dist/components/CuiEmptyState.vue.js +7 -0
- package/dist/components/CuiEmptyState.vue2.js +70 -0
- package/dist/components/CuiFieldset.vue.js +7 -0
- package/dist/components/CuiFieldset.vue2.js +79 -0
- package/dist/components/CuiFileUpload.vue.js +254 -0
- package/dist/components/CuiFileUpload.vue2.js +4 -0
- package/dist/components/CuiFlex.vue.js +7 -0
- package/dist/components/CuiFlex.vue2.js +72 -0
- package/dist/components/CuiFlexItem.vue.js +35 -0
- package/dist/components/CuiFlexItem.vue2.js +4 -0
- package/dist/components/CuiForm.vue.js +116 -0
- package/dist/components/CuiForm.vue2.js +4 -0
- package/dist/components/CuiFormField.vue.js +7 -0
- package/dist/components/CuiFormField.vue2.js +73 -0
- package/dist/components/CuiGrid.vue.js +7 -0
- package/dist/components/CuiGrid.vue2.js +51 -0
- package/dist/components/CuiGridItem.vue.js +30 -0
- package/dist/components/CuiGridItem.vue2.js +4 -0
- package/dist/components/CuiIcon.vue.js +7 -0
- package/dist/components/CuiIcon.vue2.js +72 -0
- package/dist/components/CuiInput.vue.js +7 -0
- package/dist/components/CuiInput.vue2.js +148 -0
- package/dist/components/CuiInputStepper.vue.js +189 -0
- package/dist/components/CuiInputStepper.vue2.js +4 -0
- package/dist/components/CuiKbd.vue.js +44 -0
- package/dist/components/CuiKbd.vue2.js +4 -0
- package/dist/components/CuiMaskedInput.vue.js +256 -0
- package/dist/components/CuiMaskedInput.vue2.js +4 -0
- package/dist/components/CuiModal.vue.js +7 -0
- package/dist/components/CuiModal.vue2.js +98 -0
- package/dist/components/CuiModalBody.vue.js +50 -0
- package/dist/components/CuiModalBody.vue2.js +4 -0
- package/dist/components/CuiModalFooter.vue.js +36 -0
- package/dist/components/CuiModalFooter.vue2.js +4 -0
- package/dist/components/CuiModalHeader.vue.js +85 -0
- package/dist/components/CuiModalHeader.vue2.js +4 -0
- package/dist/components/CuiPagination.vue.js +7 -0
- package/dist/components/CuiPagination.vue2.js +136 -0
- package/dist/components/CuiPopover.vue.js +227 -0
- package/dist/components/CuiPopover.vue2.js +4 -0
- package/dist/components/CuiProgress.vue.js +7 -0
- package/dist/components/CuiProgress.vue2.js +132 -0
- package/dist/components/CuiRadio.vue.d.ts.map +1 -1
- package/dist/components/CuiRadio.vue.js +7 -0
- package/dist/components/CuiRadio.vue2.js +139 -0
- package/dist/components/CuiRadioGroup.vue.js +7 -0
- package/dist/components/CuiRadioGroup.vue2.js +78 -0
- package/dist/components/CuiRating.vue.js +129 -0
- package/dist/components/CuiRating.vue2.js +4 -0
- package/dist/components/CuiResizablePanels.vue.js +147 -0
- package/dist/components/CuiResizablePanels.vue2.js +4 -0
- package/dist/components/CuiSelect.vue.d.ts.map +1 -1
- package/dist/components/CuiSelect.vue.js +7 -0
- package/dist/components/CuiSelect.vue2.js +359 -0
- package/dist/components/CuiSkeleton.vue.js +7 -0
- package/dist/components/CuiSkeleton.vue2.js +80 -0
- package/dist/components/CuiSlideover.vue.js +109 -0
- package/dist/components/CuiSlideover.vue2.js +4 -0
- package/dist/components/CuiSlider.vue.js +156 -0
- package/dist/components/CuiSlider.vue2.js +4 -0
- package/dist/components/CuiSpacer.vue.js +32 -0
- package/dist/components/CuiSpacer.vue2.js +4 -0
- package/dist/components/CuiSpinner.vue.js +99 -0
- package/dist/components/CuiSpinner.vue3.js +5 -0
- package/dist/components/CuiStack.vue.js +30 -0
- package/dist/components/CuiStack.vue2.js +4 -0
- package/dist/components/CuiStepper.vue.js +153 -0
- package/dist/components/CuiStepper.vue2.js +4 -0
- package/dist/components/CuiTab.vue.js +7 -0
- package/dist/components/CuiTab.vue2.js +73 -0
- package/dist/components/CuiTable.vue.js +90 -0
- package/dist/components/CuiTable.vue3.js +5 -0
- package/dist/components/CuiTableBody.vue.js +18 -0
- package/dist/components/CuiTableBody.vue2.js +4 -0
- package/dist/components/CuiTableCell.vue.js +36 -0
- package/dist/components/CuiTableCell.vue2.js +4 -0
- package/dist/components/CuiTableFoot.vue.js +18 -0
- package/dist/components/CuiTableFoot.vue2.js +4 -0
- package/dist/components/CuiTableHead.vue.js +18 -0
- package/dist/components/CuiTableHead.vue2.js +4 -0
- package/dist/components/CuiTableRow.vue.js +23 -0
- package/dist/components/CuiTableRow.vue2.js +4 -0
- package/dist/components/CuiTabs.vue.js +7 -0
- package/dist/components/CuiTabs.vue2.js +124 -0
- package/dist/components/CuiTagInput.vue.js +296 -0
- package/dist/components/CuiTagInput.vue2.js +4 -0
- package/dist/components/CuiTextarea.vue.js +7 -0
- package/dist/components/CuiTextarea.vue2.js +112 -0
- package/dist/components/CuiTimePicker.vue.js +193 -0
- package/dist/components/CuiTimePicker.vue2.js +4 -0
- package/dist/components/CuiTimeline.vue.js +25 -0
- package/dist/components/CuiTimeline.vue2.js +4 -0
- package/dist/components/CuiTimelineItem.vue.js +113 -0
- package/dist/components/CuiTimelineItem.vue2.js +4 -0
- package/dist/components/CuiToast.vue.js +7 -0
- package/dist/components/CuiToast.vue2.js +129 -0
- package/dist/components/CuiToastProvider.vue.js +7 -0
- package/dist/components/CuiToastProvider.vue2.js +87 -0
- package/dist/components/CuiToggle.vue.d.ts.map +1 -1
- package/dist/components/CuiToggle.vue.js +7 -0
- package/dist/components/CuiToggle.vue2.js +116 -0
- package/dist/components/CuiToggleGroup.vue.js +7 -0
- package/dist/components/CuiToggleGroup.vue2.js +59 -0
- package/dist/components/CuiTooltip.vue.js +7 -0
- package/dist/components/CuiTooltip.vue2.js +128 -0
- package/dist/components/CuiTransferList.vue.js +442 -0
- package/dist/components/CuiTransferList.vue2.js +4 -0
- package/dist/components/CuiTreeNode.vue.js +180 -0
- package/dist/components/CuiTreeNode.vue2.js +4 -0
- package/dist/components/CuiTreeView.vue.js +73 -0
- package/dist/components/CuiTreeView.vue2.js +4 -0
- package/dist/components/accordion-context.js +4 -0
- package/dist/components/breadcrumb-context.js +4 -0
- package/dist/components/config-context.js +4 -0
- package/dist/components/data-grid-context.js +4 -0
- package/dist/components/dropdown-context.js +30 -0
- package/dist/components/form-context.js +4 -0
- package/dist/components/multi-select-group-context.js +5 -0
- package/dist/components/radio-context.js +4 -0
- package/dist/components/table-context.js +5 -0
- package/dist/components/tabs-context.js +4 -0
- package/dist/components/toast-context.js +45 -0
- package/dist/composables/useBreakpoint.js +34 -0
- package/dist/composables/useClickOutside.js +14 -0
- package/dist/composables/useCopyToClipboard.js +25 -0
- package/dist/composables/useDataGrid.js +269 -0
- package/dist/composables/useDataGridInertia.js +35 -0
- package/dist/composables/useDataGridViews.js +67 -0
- package/dist/composables/useDensity.js +42 -0
- package/dist/composables/useLayoutContext.js +21 -0
- package/dist/composables/useMessages.js +10 -0
- package/dist/composables/useOverlay.js +57 -0
- package/dist/composables/usePopover.js +53 -0
- package/dist/composables/useScrollShadows.js +56 -0
- package/dist/composables/useTheme.js +57 -0
- package/dist/composables/useToast.js +23 -0
- package/dist/composables/useVirtualScroll.js +69 -0
- package/dist/index.js +290 -0
- package/dist/messages.js +57 -0
- package/dist/ssr-theme-init.js +13 -0
- package/dist/utils/color.js +195 -0
- package/dist/utils/colorIconMap.js +11 -0
- package/dist/utils/date.js +114 -0
- package/dist/utils/liveRegion.js +12 -0
- package/dist/utils/resolvers.js +28 -0
- package/dist/utils/responsive.js +68 -0
- package/dist/utils/sizing.js +39 -0
- package/package.json +8 -7
- package/dist/clean-ui.js +0 -11937
- package/dist/clean-ui.umd.cjs +0 -11
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { defineComponent as W, ref as f, onMounted as q, onUnmounted as z, provide as K, withDirectives as O, openBlock as y, createElementBlock as $, renderSlot as D, createBlock as I, Teleport as U, normalizeStyle as j, normalizeClass as N, createCommentVNode as P, vShow as V, nextTick as X } from "vue";
|
|
2
|
+
import { DropdownContextKey as Y } from "./dropdown-context.js";
|
|
3
|
+
const J = /* @__PURE__ */ W({
|
|
4
|
+
__name: "CuiContextMenu",
|
|
5
|
+
props: {
|
|
6
|
+
minWidth: { default: "12rem" },
|
|
7
|
+
hidden: { type: Boolean, default: !1 },
|
|
8
|
+
disabled: { type: Boolean, default: !1 }
|
|
9
|
+
},
|
|
10
|
+
setup(p, { expose: E }) {
|
|
11
|
+
const b = p, n = f(!1), s = f(!1), x = f(null), m = f(null), h = f({});
|
|
12
|
+
let i = null;
|
|
13
|
+
const k = `cui-ctx-${Math.random().toString(36).slice(2, 8)}`;
|
|
14
|
+
function v() {
|
|
15
|
+
b.disabled || (i && (clearTimeout(i), i = null), s.value = !1, n.value = !0);
|
|
16
|
+
}
|
|
17
|
+
function c() {
|
|
18
|
+
n.value && (s.value = !0, i = setTimeout(() => {
|
|
19
|
+
n.value = !1, s.value = !1;
|
|
20
|
+
}, 150));
|
|
21
|
+
}
|
|
22
|
+
function T() {
|
|
23
|
+
c();
|
|
24
|
+
}
|
|
25
|
+
function A(e, t) {
|
|
26
|
+
const o = window.innerWidth, u = window.innerHeight, l = 16, r = {
|
|
27
|
+
position: "fixed",
|
|
28
|
+
zIndex: "9990"
|
|
29
|
+
};
|
|
30
|
+
r.left = `${e}px`, r.top = `${t}px`, r.maxHeight = `${Math.min(u - t - l, 400)}px`, h.value = r, X(() => {
|
|
31
|
+
var M;
|
|
32
|
+
if (!m.value) return;
|
|
33
|
+
const d = m.value.getBoundingClientRect(), a = { ...r };
|
|
34
|
+
if (d.right > o - l && (a.left = `${Math.max(l, e - d.width)}px`), d.bottom > u - l) {
|
|
35
|
+
const L = Math.max(l, t - d.height);
|
|
36
|
+
a.top = `${L}px`, a.maxHeight = `${Math.min(t - l, 400)}px`;
|
|
37
|
+
}
|
|
38
|
+
h.value = a;
|
|
39
|
+
const w = (M = m.value) == null ? void 0 : M.querySelector(
|
|
40
|
+
'[role="menuitem"]:not([aria-disabled="true"])'
|
|
41
|
+
);
|
|
42
|
+
w == null || w.focus();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function B(e) {
|
|
46
|
+
b.disabled || (e.preventDefault(), n.value && (n.value = !1, s.value = !1, i && (clearTimeout(i), i = null)), A(e.clientX, e.clientY), v());
|
|
47
|
+
}
|
|
48
|
+
function _(e) {
|
|
49
|
+
var u, l, r, d;
|
|
50
|
+
if (!m.value) return;
|
|
51
|
+
if (e.key === "Escape") {
|
|
52
|
+
e.preventDefault(), e.stopPropagation(), c();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const t = Array.from(m.value.querySelectorAll(
|
|
56
|
+
'[role="menuitem"]:not([aria-disabled="true"]), [role="menuitemcheckbox"]:not([aria-disabled="true"]), [role="menuitemradio"]:not([aria-disabled="true"])'
|
|
57
|
+
)), o = t.indexOf(document.activeElement);
|
|
58
|
+
if (e.key === "ArrowDown") {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
const a = o < t.length - 1 ? o + 1 : 0;
|
|
61
|
+
(u = t[a]) == null || u.focus();
|
|
62
|
+
} else if (e.key === "ArrowUp") {
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
const a = o > 0 ? o - 1 : t.length - 1;
|
|
65
|
+
(l = t[a]) == null || l.focus();
|
|
66
|
+
} else e.key === "Home" ? (e.preventDefault(), (r = t[0]) == null || r.focus()) : e.key === "End" && (e.preventDefault(), (d = t[t.length - 1]) == null || d.focus());
|
|
67
|
+
}
|
|
68
|
+
function C(e) {
|
|
69
|
+
var u;
|
|
70
|
+
if (!n.value) return;
|
|
71
|
+
const t = e.target;
|
|
72
|
+
if ((u = x.value) != null && u.contains(t)) return;
|
|
73
|
+
const o = document.querySelector(`[data-cui-context-menu-id="${k}"]`);
|
|
74
|
+
o != null && o.contains(t) || c();
|
|
75
|
+
}
|
|
76
|
+
function S() {
|
|
77
|
+
n.value && c();
|
|
78
|
+
}
|
|
79
|
+
q(() => {
|
|
80
|
+
document.addEventListener("mousedown", C), window.addEventListener("scroll", S, !0);
|
|
81
|
+
}), z(() => {
|
|
82
|
+
document.removeEventListener("mousedown", C), window.removeEventListener("scroll", S, !0), i && clearTimeout(i);
|
|
83
|
+
});
|
|
84
|
+
const g = /* @__PURE__ */ new Set();
|
|
85
|
+
function R(e) {
|
|
86
|
+
return g.add(e), () => g.delete(e);
|
|
87
|
+
}
|
|
88
|
+
function H(e) {
|
|
89
|
+
for (const t of g)
|
|
90
|
+
t !== e && t();
|
|
91
|
+
}
|
|
92
|
+
return K(Y, {
|
|
93
|
+
isOpen: n,
|
|
94
|
+
isClosing: s,
|
|
95
|
+
trigger: f("click"),
|
|
96
|
+
triggerEl: x,
|
|
97
|
+
placement: f("bottom"),
|
|
98
|
+
open: v,
|
|
99
|
+
close: c,
|
|
100
|
+
toggle: () => {
|
|
101
|
+
n.value ? c() : v();
|
|
102
|
+
},
|
|
103
|
+
closeAll: T,
|
|
104
|
+
registerSubMenu: R,
|
|
105
|
+
closeSiblingSubMenus: H,
|
|
106
|
+
reposition: () => {
|
|
107
|
+
}
|
|
108
|
+
}), E({ open: v, close: c, isOpen: n }), (e, t) => O((y(), $("div", {
|
|
109
|
+
ref_key: "wrapperRef",
|
|
110
|
+
ref: x,
|
|
111
|
+
class: "cui-context-menu",
|
|
112
|
+
onContextmenu: B
|
|
113
|
+
}, [
|
|
114
|
+
D(e.$slots, "default", {}, void 0, !0),
|
|
115
|
+
(y(), I(U, { to: "body" }, [
|
|
116
|
+
n.value || s.value ? (y(), $("div", {
|
|
117
|
+
key: 0,
|
|
118
|
+
ref_key: "menuRef",
|
|
119
|
+
ref: m,
|
|
120
|
+
class: N(["cui-context-menu__panel", { "cui-context-menu__panel--closing": s.value }]),
|
|
121
|
+
"data-cui-context-menu-id": k,
|
|
122
|
+
style: j({ ...h.value, minWidth: p.minWidth }),
|
|
123
|
+
role: "menu",
|
|
124
|
+
onKeydown: _
|
|
125
|
+
}, [
|
|
126
|
+
D(e.$slots, "menu", {}, void 0, !0)
|
|
127
|
+
], 38)) : P("", !0)
|
|
128
|
+
]))
|
|
129
|
+
], 544)), [
|
|
130
|
+
[V, !p.hidden]
|
|
131
|
+
]);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
export {
|
|
135
|
+
J as default
|
|
136
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineComponent as u, computed as p, withDirectives as f, openBlock as l, createBlock as y, unref as o, withCtx as i, createVNode as n, createElementBlock as C, toDisplayString as h, createCommentVNode as z, normalizeStyle as v, vShow as S } from "vue";
|
|
2
|
+
import { clampSize as x } from "../utils/sizing.js";
|
|
3
|
+
import B from "./CuiButton.vue.js";
|
|
4
|
+
import k from "./CuiIcon.vue.js";
|
|
5
|
+
import w from "./CuiTooltip.vue.js";
|
|
6
|
+
import { useCopyToClipboard as D } from "../composables/useCopyToClipboard.js";
|
|
7
|
+
const T = { key: 0 }, O = /* @__PURE__ */ u({
|
|
8
|
+
__name: "CuiCopyButton",
|
|
9
|
+
props: {
|
|
10
|
+
value: {},
|
|
11
|
+
variant: { default: "ghost" },
|
|
12
|
+
tooltip: { default: "Copy" },
|
|
13
|
+
copiedTooltip: { default: "Copied!" },
|
|
14
|
+
resetDelay: { default: 2e3 },
|
|
15
|
+
showLabel: { type: Boolean, default: !1 },
|
|
16
|
+
hidden: { type: Boolean, default: !1 },
|
|
17
|
+
color: { default: "primary" },
|
|
18
|
+
size: { default: "sm" }
|
|
19
|
+
},
|
|
20
|
+
setup(e) {
|
|
21
|
+
const r = ["xs", "sm", "md"], a = e, { copied: t, copy: c } = D(a.resetDelay);
|
|
22
|
+
function s() {
|
|
23
|
+
c(a.value);
|
|
24
|
+
}
|
|
25
|
+
const m = {
|
|
26
|
+
xs: "0.75rem",
|
|
27
|
+
sm: "0.875rem",
|
|
28
|
+
md: "1rem"
|
|
29
|
+
}, d = p(() => x(a.size, r));
|
|
30
|
+
return (b, E) => f((l(), y(w, {
|
|
31
|
+
text: o(t) ? e.copiedTooltip : e.tooltip,
|
|
32
|
+
placement: "top",
|
|
33
|
+
"show-delay": 300
|
|
34
|
+
}, {
|
|
35
|
+
default: i(() => [
|
|
36
|
+
n(B, {
|
|
37
|
+
size: e.size,
|
|
38
|
+
variant: e.variant,
|
|
39
|
+
color: o(t) ? "success" : e.color,
|
|
40
|
+
onClick: s
|
|
41
|
+
}, {
|
|
42
|
+
prefix: i(() => [
|
|
43
|
+
n(k, {
|
|
44
|
+
name: o(t) ? "check" : "copy",
|
|
45
|
+
size: m[d.value],
|
|
46
|
+
style: v({ transition: "transform 0.15s ease", transform: o(t) ? "scale(1.1)" : "scale(1)" })
|
|
47
|
+
}, null, 8, ["name", "size", "style"])
|
|
48
|
+
]),
|
|
49
|
+
default: i(() => [
|
|
50
|
+
e.showLabel ? (l(), C("span", T, h(o(t) ? "Copied" : "Copy"), 1)) : z("", !0)
|
|
51
|
+
]),
|
|
52
|
+
_: 1
|
|
53
|
+
}, 8, ["size", "variant", "color"])
|
|
54
|
+
]),
|
|
55
|
+
_: 1
|
|
56
|
+
}, 8, ["text"])), [
|
|
57
|
+
[S, !e.hidden]
|
|
58
|
+
]);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
export {
|
|
62
|
+
O as default
|
|
63
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { defineComponent as p, useSlots as z, toRef as A, watch as b, withDirectives as D, openBlock as i, createElementBlock as c, createBlock as s, withCtx as f, renderSlot as u, createCommentVNode as h, createVNode as m, unref as n, normalizeStyle as R, createElementVNode as V, normalizeProps as S, guardReactiveProps as B, createSlots as x, renderList as H, createTextVNode as T, toDisplayString as G, vShow as K } from "vue";
|
|
2
|
+
import { useDataGrid as N, provideDataGrid as M } from "../composables/useDataGrid.js";
|
|
3
|
+
import Q from "./CuiDataGridToolbar.vue.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import E from "./CuiDataGridTable.vue.js";
|
|
6
|
+
import F from "./CuiDataGridCardView.vue.js";
|
|
7
|
+
import U from "./CuiDataGridPagination.vue.js";
|
|
8
|
+
import I from "./CuiDataGridBulkBar.vue.js";
|
|
9
|
+
/* empty css */
|
|
10
|
+
import O from "./CuiDataGridFilterPanel.vue.js";
|
|
11
|
+
/* empty css */
|
|
12
|
+
import L from "./CuiDataGridActiveFilters.vue.js";
|
|
13
|
+
/* empty css */
|
|
14
|
+
import j from "./CuiEmptyState.vue.js";
|
|
15
|
+
import q from "./CuiSkeleton.vue.js";
|
|
16
|
+
import { useMessages as J } from "../composables/useMessages.js";
|
|
17
|
+
const W = { class: "cui-data-grid" }, X = {
|
|
18
|
+
key: 1,
|
|
19
|
+
style: { padding: "calc(1rem * var(--cui-density-scale, 1))" }
|
|
20
|
+
}, Y = { key: 2 }, Z = { style: { flex: "1", "min-width": "0" } }, ge = /* @__PURE__ */ p({
|
|
21
|
+
__name: "CuiDataGrid",
|
|
22
|
+
props: {
|
|
23
|
+
columns: {},
|
|
24
|
+
data: {},
|
|
25
|
+
serverSide: { type: Boolean, default: !1 },
|
|
26
|
+
rowKey: { default: "id" },
|
|
27
|
+
bulkActions: {},
|
|
28
|
+
showSelectAll: { type: Boolean, default: !0 },
|
|
29
|
+
stickyHeader: { type: Boolean, default: !0 },
|
|
30
|
+
maxHeight: {},
|
|
31
|
+
striped: { type: Boolean, default: !1 },
|
|
32
|
+
hoverable: { type: Boolean, default: !0 },
|
|
33
|
+
bordered: { type: Boolean, default: !1 },
|
|
34
|
+
size: { default: "md" },
|
|
35
|
+
loading: { type: Boolean, default: !1 },
|
|
36
|
+
perPageOptions: { default: () => [15, 25, 50, 100] },
|
|
37
|
+
hideToolbar: { type: Boolean, default: !1 },
|
|
38
|
+
hidePagination: { type: Boolean, default: !1 },
|
|
39
|
+
hideSearch: { type: Boolean, default: !1 },
|
|
40
|
+
hideColumnManager: { type: Boolean, default: !1 },
|
|
41
|
+
hideFilterPanel: { type: Boolean, default: !1 },
|
|
42
|
+
filterPanelSide: { default: "right" },
|
|
43
|
+
gridId: {},
|
|
44
|
+
viewAdapter: {},
|
|
45
|
+
initialView: {},
|
|
46
|
+
hydrateUrl: { type: Boolean, default: !1 },
|
|
47
|
+
virtualize: { type: Boolean, default: !1 },
|
|
48
|
+
virtualRowHeight: {},
|
|
49
|
+
hidden: { type: Boolean, default: !1 }
|
|
50
|
+
},
|
|
51
|
+
emits: ["navigate", "row-click", "row-action", "bulk-action", "selection-change"],
|
|
52
|
+
setup(e, { expose: C, emit: P }) {
|
|
53
|
+
var w;
|
|
54
|
+
const l = e, d = P, $ = z(), t = N({
|
|
55
|
+
columns: l.columns,
|
|
56
|
+
data: A(l, "data"),
|
|
57
|
+
serverSide: l.serverSide,
|
|
58
|
+
rowKey: l.rowKey,
|
|
59
|
+
defaultPerPage: ((w = l.perPageOptions) == null ? void 0 : w[0]) ?? 15,
|
|
60
|
+
initialView: l.initialView,
|
|
61
|
+
hydrateFromUrl: l.hydrateUrl
|
|
62
|
+
});
|
|
63
|
+
M(t), b(
|
|
64
|
+
() => t.selectedRows.value,
|
|
65
|
+
(o) => {
|
|
66
|
+
d("selection-change", [...o]);
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
function g() {
|
|
70
|
+
l.serverSide && d("navigate", t.getQueryParams());
|
|
71
|
+
}
|
|
72
|
+
b(
|
|
73
|
+
[() => t.sort.value, () => t.filters.value, () => t.searchQuery.value, () => t.page.value, () => t.perPage.value],
|
|
74
|
+
() => {
|
|
75
|
+
g();
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
const y = !!$.card;
|
|
79
|
+
C({
|
|
80
|
+
clearSelection: t.clearSelection,
|
|
81
|
+
getQueryParams: t.getQueryParams,
|
|
82
|
+
getConfig: t.getConfig,
|
|
83
|
+
loadConfig: t.loadConfig,
|
|
84
|
+
resetToDefaults: t.resetToDefaults
|
|
85
|
+
});
|
|
86
|
+
const v = J();
|
|
87
|
+
return (o, r) => D((i(), c("div", W, [
|
|
88
|
+
e.hideToolbar ? h("", !0) : (i(), s(Q, {
|
|
89
|
+
key: 0,
|
|
90
|
+
"hide-search": e.hideSearch,
|
|
91
|
+
"hide-column-manager": e.hideColumnManager,
|
|
92
|
+
"hide-filter-toggle": e.hideFilterPanel,
|
|
93
|
+
"has-card-slot": y,
|
|
94
|
+
"grid-id": e.gridId,
|
|
95
|
+
"view-adapter": e.viewAdapter
|
|
96
|
+
}, {
|
|
97
|
+
"toolbar-start": f(() => [
|
|
98
|
+
u(o.$slots, "toolbar-start")
|
|
99
|
+
]),
|
|
100
|
+
"toolbar-end": f(() => [
|
|
101
|
+
u(o.$slots, "toolbar-end")
|
|
102
|
+
]),
|
|
103
|
+
_: 3
|
|
104
|
+
}, 8, ["hide-search", "hide-column-manager", "hide-filter-toggle", "grid-id", "view-adapter"])),
|
|
105
|
+
m(L),
|
|
106
|
+
e.loading ? (i(), c("div", X, [
|
|
107
|
+
m(q, { lines: 8 })
|
|
108
|
+
])) : n(t).displayData.value.length === 0 ? (i(), c("div", Y, [
|
|
109
|
+
u(o.$slots, "empty", {}, () => [
|
|
110
|
+
m(j, {
|
|
111
|
+
icon: "magnifying-glass",
|
|
112
|
+
title: n(v).dataGrid.noResultsTitle,
|
|
113
|
+
description: n(v).dataGrid.noResultsDescription,
|
|
114
|
+
size: "md",
|
|
115
|
+
color: "secondary"
|
|
116
|
+
}, null, 8, ["title", "description"])
|
|
117
|
+
])
|
|
118
|
+
])) : (i(), c("div", {
|
|
119
|
+
key: 3,
|
|
120
|
+
class: "cui-data-grid__content",
|
|
121
|
+
style: R({ flexDirection: e.filterPanelSide === "left" ? "row-reverse" : "row" })
|
|
122
|
+
}, [
|
|
123
|
+
V("div", Z, [
|
|
124
|
+
n(t).viewMode.value === "card" && y ? (i(), s(F, {
|
|
125
|
+
key: 0,
|
|
126
|
+
"row-key": e.rowKey
|
|
127
|
+
}, {
|
|
128
|
+
card: f((a) => [
|
|
129
|
+
u(o.$slots, "card", S(B(a)))
|
|
130
|
+
]),
|
|
131
|
+
_: 3
|
|
132
|
+
}, 8, ["row-key"])) : (i(), s(E, {
|
|
133
|
+
key: 1,
|
|
134
|
+
"row-key": e.rowKey,
|
|
135
|
+
"bulk-actions": e.bulkActions,
|
|
136
|
+
"show-select-all": e.showSelectAll,
|
|
137
|
+
"sticky-header": e.stickyHeader,
|
|
138
|
+
"max-height": e.maxHeight,
|
|
139
|
+
striped: e.striped,
|
|
140
|
+
hoverable: e.hoverable,
|
|
141
|
+
bordered: e.bordered,
|
|
142
|
+
size: e.size,
|
|
143
|
+
virtualize: e.virtualize,
|
|
144
|
+
"virtual-row-height": e.virtualRowHeight,
|
|
145
|
+
onRowClick: r[0] || (r[0] = (a) => d("row-click", a)),
|
|
146
|
+
onRowAction: r[1] || (r[1] = (a) => d("row-action", a))
|
|
147
|
+
}, x({ _: 2 }, [
|
|
148
|
+
H(n(t).visibleColumns.value, (a) => ({
|
|
149
|
+
name: `cell-${a.key}`,
|
|
150
|
+
fn: f((k) => [
|
|
151
|
+
u(o.$slots, `cell-${a.key}`, S(B(k)), () => [
|
|
152
|
+
T(G(k.value), 1)
|
|
153
|
+
])
|
|
154
|
+
])
|
|
155
|
+
}))
|
|
156
|
+
]), 1032, ["row-key", "bulk-actions", "show-select-all", "sticky-header", "max-height", "striped", "hoverable", "bordered", "size", "virtualize", "virtual-row-height"]))
|
|
157
|
+
]),
|
|
158
|
+
m(O)
|
|
159
|
+
], 4)),
|
|
160
|
+
!e.hidePagination && !e.loading && n(t).displayData.value.length > 0 ? (i(), s(U, {
|
|
161
|
+
key: 4,
|
|
162
|
+
onNavigate: g
|
|
163
|
+
})) : h("", !0),
|
|
164
|
+
e.bulkActions && e.bulkActions.length > 0 ? (i(), s(I, {
|
|
165
|
+
key: 5,
|
|
166
|
+
actions: e.bulkActions,
|
|
167
|
+
onBulkAction: r[2] || (r[2] = (a) => d("bulk-action", a))
|
|
168
|
+
}, null, 8, ["actions"])) : h("", !0)
|
|
169
|
+
], 512)), [
|
|
170
|
+
[K, !e.hidden]
|
|
171
|
+
]);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
export {
|
|
175
|
+
ge as default
|
|
176
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { defineComponent as p, computed as k, openBlock as l, createElementBlock as s, Fragment as g, renderList as C, createBlock as u, unref as m, withCtx as d, createTextVNode as v, toDisplayString as c, createCommentVNode as y } from "vue";
|
|
2
|
+
import { useDataGridState as _ } from "../composables/useDataGrid.js";
|
|
3
|
+
import f from "./CuiBadge.vue.js";
|
|
4
|
+
import b from "./CuiButton.vue.js";
|
|
5
|
+
const x = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "cui-data-grid-active-filters"
|
|
8
|
+
}, h = /* @__PURE__ */ p({
|
|
9
|
+
__name: "CuiDataGridActiveFilters",
|
|
10
|
+
setup(B) {
|
|
11
|
+
const a = _(), o = k(
|
|
12
|
+
() => a.filters.value.map((t) => {
|
|
13
|
+
const e = a.columns.find((n) => (n.filterKey ?? n.key) === t.key), r = (e == null ? void 0 : e.label) ?? t.key, i = Array.isArray(t.value) ? t.value.join(", ") : t.value;
|
|
14
|
+
return { key: t.key, label: r, displayValue: i };
|
|
15
|
+
})
|
|
16
|
+
);
|
|
17
|
+
return (t, e) => o.value.length > 0 ? (l(), s("div", x, [
|
|
18
|
+
(l(!0), s(g, null, C(o.value, (r) => (l(), u(f, {
|
|
19
|
+
key: r.key,
|
|
20
|
+
variant: "subtle",
|
|
21
|
+
color: "primary",
|
|
22
|
+
size: "sm",
|
|
23
|
+
removable: "",
|
|
24
|
+
onRemove: (i) => m(a).removeFilter(r.key)
|
|
25
|
+
}, {
|
|
26
|
+
default: d(() => [
|
|
27
|
+
v(c(r.label) + ": " + c(r.displayValue), 1)
|
|
28
|
+
]),
|
|
29
|
+
_: 2
|
|
30
|
+
}, 1032, ["onRemove"]))), 128)),
|
|
31
|
+
o.value.length > 1 ? (l(), u(b, {
|
|
32
|
+
key: 0,
|
|
33
|
+
variant: "ghost",
|
|
34
|
+
size: "xs",
|
|
35
|
+
onClick: e[0] || (e[0] = (r) => m(a).clearFilters())
|
|
36
|
+
}, {
|
|
37
|
+
default: d(() => [...e[1] || (e[1] = [
|
|
38
|
+
v(" Clear all ", -1)
|
|
39
|
+
])]),
|
|
40
|
+
_: 1
|
|
41
|
+
})) : y("", !0)
|
|
42
|
+
])) : y("", !0);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
export {
|
|
46
|
+
h as default
|
|
47
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CuiDataGridBulkBar.vue.d.ts","sourceRoot":"","sources":["../../src/components/CuiDataGridBulkBar.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CuiDataGridBulkBar.vue.d.ts","sourceRoot":"","sources":["../../src/components/CuiDataGridBulkBar.vue"],"names":[],"mappings":"AAuHA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAO1E,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B,CAAC;;;gBAImC,kBAAkB;cAAQ,WAAW,EAAE;;;;gBAAvC,kBAAkB;cAAQ,WAAW,EAAE;;;AAyJ5E,wBAOG"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { defineComponent as h, computed as d, openBlock as i, createBlock as m, Transition as B, withCtx as r, createElementBlock as _, createElementVNode as o, toDisplayString as s, unref as n, Fragment as w, renderList as S, createTextVNode as v, createVNode as f, createCommentVNode as V } from "vue";
|
|
2
|
+
import { useDataGridState as z } from "../composables/useDataGrid.js";
|
|
3
|
+
import k from "./CuiButton.vue.js";
|
|
4
|
+
import D from "./CuiIcon.vue.js";
|
|
5
|
+
import { useMessages as N } from "../composables/useMessages.js";
|
|
6
|
+
const G = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "cui-data-grid-bulk-bar"
|
|
9
|
+
}, R = { class: "cui-data-grid-bulk-bar__inner" }, E = { class: "cui-data-grid-bulk-bar__count" }, T = { class: "cui-data-grid-bulk-bar__actions" }, j = /* @__PURE__ */ h({
|
|
10
|
+
__name: "CuiDataGridBulkBar",
|
|
11
|
+
props: {
|
|
12
|
+
actions: {}
|
|
13
|
+
},
|
|
14
|
+
emits: ["bulk-action"],
|
|
15
|
+
setup(p, { emit: b }) {
|
|
16
|
+
const l = N(), g = b, t = z(), c = d(() => t.selectedRows.value.size), C = d(() => c.value > 0);
|
|
17
|
+
function x() {
|
|
18
|
+
return t.displayData.value.filter(
|
|
19
|
+
(a) => t.selectedRows.value.has(String(a.id ?? ""))
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
function y(a) {
|
|
23
|
+
g("bulk-action", { action: a, rows: x() });
|
|
24
|
+
}
|
|
25
|
+
return (a, u) => (i(), m(B, { name: "cui-bulk-bar" }, {
|
|
26
|
+
default: r(() => [
|
|
27
|
+
C.value ? (i(), _("div", G, [
|
|
28
|
+
o("div", R, [
|
|
29
|
+
o("span", E, s(n(l).dataGrid.selected(c.value)), 1),
|
|
30
|
+
o("div", T, [
|
|
31
|
+
(i(!0), _(w, null, S(p.actions, (e) => (i(), m(k, {
|
|
32
|
+
key: e.key,
|
|
33
|
+
size: "xs",
|
|
34
|
+
variant: e.variant === "destructive" ? "solid" : "outline",
|
|
35
|
+
color: e.variant === "destructive" ? "error" : "primary",
|
|
36
|
+
onClick: ($) => y(e)
|
|
37
|
+
}, {
|
|
38
|
+
default: r(() => [
|
|
39
|
+
v(s(e.label), 1)
|
|
40
|
+
]),
|
|
41
|
+
_: 2
|
|
42
|
+
}, 1032, ["variant", "color", "onClick"]))), 128))
|
|
43
|
+
]),
|
|
44
|
+
f(k, {
|
|
45
|
+
variant: "ghost",
|
|
46
|
+
size: "xs",
|
|
47
|
+
onClick: u[0] || (u[0] = (e) => n(t).clearSelection()),
|
|
48
|
+
style: { "margin-left": "auto" }
|
|
49
|
+
}, {
|
|
50
|
+
prefix: r(() => [
|
|
51
|
+
f(D, {
|
|
52
|
+
name: "x",
|
|
53
|
+
size: "0.75rem"
|
|
54
|
+
})
|
|
55
|
+
]),
|
|
56
|
+
default: r(() => [
|
|
57
|
+
v(" " + s(n(l).clear), 1)
|
|
58
|
+
]),
|
|
59
|
+
_: 1
|
|
60
|
+
})
|
|
61
|
+
])
|
|
62
|
+
])) : V("", !0)
|
|
63
|
+
]),
|
|
64
|
+
_: 1
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
export {
|
|
69
|
+
j as default
|
|
70
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineComponent as s, openBlock as r, createBlock as u, withCtx as c, createElementBlock as o, Fragment as l, renderList as m, unref as p, renderSlot as f } from "vue";
|
|
2
|
+
import { useDataGridState as g } from "../composables/useDataGrid.js";
|
|
3
|
+
import _ from "./CuiGrid.vue.js";
|
|
4
|
+
const B = /* @__PURE__ */ s({
|
|
5
|
+
__name: "CuiDataGridCardView",
|
|
6
|
+
props: {
|
|
7
|
+
rowKey: {}
|
|
8
|
+
},
|
|
9
|
+
setup(n) {
|
|
10
|
+
const a = n, i = g();
|
|
11
|
+
function d(e) {
|
|
12
|
+
return String(e[a.rowKey ?? "id"] ?? "");
|
|
13
|
+
}
|
|
14
|
+
return (e, C) => (r(), u(_, {
|
|
15
|
+
cols: { sm: 1, md: 2, lg: 3 },
|
|
16
|
+
gap: "4"
|
|
17
|
+
}, {
|
|
18
|
+
default: c(() => [
|
|
19
|
+
(r(!0), o(l, null, m(p(i).displayData.value, (t) => (r(), o("div", {
|
|
20
|
+
key: d(t)
|
|
21
|
+
}, [
|
|
22
|
+
f(e.$slots, "card", { row: t })
|
|
23
|
+
]))), 128))
|
|
24
|
+
]),
|
|
25
|
+
_: 3
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
export {
|
|
30
|
+
B as default
|
|
31
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { defineComponent as x, ref as m, openBlock as c, createBlock as C, withCtx as i, createVNode as s, createTextVNode as k, createElementVNode as V, createElementBlock as d, Fragment as h, renderList as S, unref as f, normalizeStyle as T } from "vue";
|
|
2
|
+
import { useDataGridState as z } from "../composables/useDataGrid.js";
|
|
3
|
+
import B from "./CuiPopover.vue.js";
|
|
4
|
+
import w from "./CuiButton.vue.js";
|
|
5
|
+
import E from "./CuiCheckbox.vue.js";
|
|
6
|
+
import p from "./CuiIcon.vue.js";
|
|
7
|
+
const L = { style: { display: "flex", "flex-direction": "column", gap: "calc(0.125rem * var(--cui-density-scale, 1))" } }, N = ["onDragstart", "onDragover", "onDrop"], O = /* @__PURE__ */ x({
|
|
8
|
+
__name: "CuiDataGridColumnManager",
|
|
9
|
+
setup(G) {
|
|
10
|
+
const u = z(), t = m(null), n = m(null);
|
|
11
|
+
function v(a) {
|
|
12
|
+
var e;
|
|
13
|
+
return ((e = u.columns.find((r) => r.key === a)) == null ? void 0 : e.label) ?? a;
|
|
14
|
+
}
|
|
15
|
+
function g(a, e) {
|
|
16
|
+
t.value = e, a.dataTransfer && (a.dataTransfer.effectAllowed = "move", a.dataTransfer.setData("text/plain", String(e)));
|
|
17
|
+
}
|
|
18
|
+
function D(a, e) {
|
|
19
|
+
a.preventDefault(), n.value = e;
|
|
20
|
+
}
|
|
21
|
+
function y() {
|
|
22
|
+
n.value = null;
|
|
23
|
+
}
|
|
24
|
+
function _(a, e) {
|
|
25
|
+
a.preventDefault(), t.value !== null && t.value !== e && u.reorderColumns(t.value, e), t.value = null, n.value = null;
|
|
26
|
+
}
|
|
27
|
+
function b() {
|
|
28
|
+
t.value = null, n.value = null;
|
|
29
|
+
}
|
|
30
|
+
return (a, e) => (c(), C(B, {
|
|
31
|
+
placement: "bottom",
|
|
32
|
+
width: "240px",
|
|
33
|
+
title: "Columns"
|
|
34
|
+
}, {
|
|
35
|
+
content: i(() => [
|
|
36
|
+
V("div", L, [
|
|
37
|
+
(c(!0), d(h, null, S(f(u).columnState.value, (r, o) => (c(), d("div", {
|
|
38
|
+
key: r.key,
|
|
39
|
+
draggable: "true",
|
|
40
|
+
style: T([{ display: "flex", "align-items": "center", gap: "calc(0.5rem * var(--cui-density-scale, 1))", padding: "calc(0.375rem * var(--cui-density-scale, 1)) 0", "border-radius": "0.25rem", cursor: "grab" }, {
|
|
41
|
+
opacity: t.value === o ? 0.5 : 1,
|
|
42
|
+
borderTop: n.value === o ? "2px solid var(--cui-primary)" : "2px solid transparent"
|
|
43
|
+
}]),
|
|
44
|
+
onDragstart: (l) => g(l, o),
|
|
45
|
+
onDragover: (l) => D(l, o),
|
|
46
|
+
onDragleave: y,
|
|
47
|
+
onDrop: (l) => _(l, o),
|
|
48
|
+
onDragend: b
|
|
49
|
+
}, [
|
|
50
|
+
s(p, {
|
|
51
|
+
name: "dots-six-vertical",
|
|
52
|
+
size: "0.875rem",
|
|
53
|
+
style: { color: "var(--cui-text-tertiary)", "flex-shrink": "0" }
|
|
54
|
+
}),
|
|
55
|
+
s(E, {
|
|
56
|
+
"model-value": r.visible,
|
|
57
|
+
label: v(r.key),
|
|
58
|
+
"onUpdate:modelValue": (l) => f(u).toggleColumnVisibility(r.key)
|
|
59
|
+
}, null, 8, ["model-value", "label", "onUpdate:modelValue"])
|
|
60
|
+
], 44, N))), 128))
|
|
61
|
+
])
|
|
62
|
+
]),
|
|
63
|
+
default: i(() => [
|
|
64
|
+
s(w, {
|
|
65
|
+
variant: "outline",
|
|
66
|
+
size: "sm"
|
|
67
|
+
}, {
|
|
68
|
+
prefix: i(() => [
|
|
69
|
+
s(p, {
|
|
70
|
+
name: "columns",
|
|
71
|
+
size: "0.875rem"
|
|
72
|
+
})
|
|
73
|
+
]),
|
|
74
|
+
default: i(() => [
|
|
75
|
+
e[0] || (e[0] = k(" Columns ", -1))
|
|
76
|
+
]),
|
|
77
|
+
_: 1
|
|
78
|
+
})
|
|
79
|
+
]),
|
|
80
|
+
_: 1
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
export {
|
|
85
|
+
O as default
|
|
86
|
+
};
|