@cynnie/ui-shadcn 0.1.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/README.md +49 -0
- package/dist/Checkbox-DswwIgpU.js +38 -0
- package/dist/Checkbox-DswwIgpU.js.map +1 -0
- package/dist/DialogTitle-CCJNart2.js +107 -0
- package/dist/DialogTitle-CCJNart2.js.map +1 -0
- package/dist/Input-BQYIq9cS.js +24 -0
- package/dist/Input-BQYIq9cS.js.map +1 -0
- package/dist/Loader-DZyMmrI8.js +19 -0
- package/dist/Loader-DZyMmrI8.js.map +1 -0
- package/dist/ProButton-BQWpTTCy.js +84 -0
- package/dist/ProButton-BQWpTTCy.js.map +1 -0
- package/dist/ProCheckboxGroup-DX6c9gx-.js +71 -0
- package/dist/ProCheckboxGroup-DX6c9gx-.js.map +1 -0
- package/dist/ProConfirmButton-zcvp7NcN.js +175 -0
- package/dist/ProConfirmButton-zcvp7NcN.js.map +1 -0
- package/dist/ProDescriptions-B1znLzkY.js +45 -0
- package/dist/ProDescriptions-B1znLzkY.js.map +1 -0
- package/dist/ProFormBuilder-CsNShZ0y.js +1138 -0
- package/dist/ProFormBuilder-CsNShZ0y.js.map +1 -0
- package/dist/ProInput-D20F1Xx-.js +91 -0
- package/dist/ProInput-D20F1Xx-.js.map +1 -0
- package/dist/ProModal-DsIFQ8y5.js +109 -0
- package/dist/ProModal-DsIFQ8y5.js.map +1 -0
- package/dist/ProRadioGroup-CTxqLQjw.js +138 -0
- package/dist/ProRadioGroup-CTxqLQjw.js.map +1 -0
- package/dist/ProSelect-DT0zjDjT.js +90 -0
- package/dist/ProSelect-DT0zjDjT.js.map +1 -0
- package/dist/ProTable-CP1Mc52q.js +349 -0
- package/dist/ProTable-CP1Mc52q.js.map +1 -0
- package/dist/SelectValue-CWl9zUW3.js +163 -0
- package/dist/SelectValue-CWl9zUW3.js.map +1 -0
- package/dist/button-BQVT6mY3.js +60 -0
- package/dist/button-BQVT6mY3.js.map +1 -0
- package/dist/components/ProButton/ProCountdownButton.vue.d.ts +28 -0
- package/dist/components/ProButton/index.js +2 -0
- package/dist/components/ProButton/index.vue.d.ts +31 -0
- package/dist/components/ProCheckboxGroup/index.js +2 -0
- package/dist/components/ProCheckboxGroup/index.vue.d.ts +18 -0
- package/dist/components/ProConfirmButton/index.js +2 -0
- package/dist/components/ProConfirmButton/index.vue.d.ts +43 -0
- package/dist/components/ProDescriptions/index.js +2 -0
- package/dist/components/ProDescriptions/index.vue.d.ts +40 -0
- package/dist/components/ProFormBuilder/index.js +2 -0
- package/dist/components/ProFormBuilder/index.vue.d.ts +43 -0
- package/dist/components/ProInput/index.js +2 -0
- package/dist/components/ProInput/index.vue.d.ts +27 -0
- package/dist/components/ProModal/index.js +2 -0
- package/dist/components/ProModal/index.vue.d.ts +45 -0
- package/dist/components/ProRadioGroup/index.js +2 -0
- package/dist/components/ProRadioGroup/index.vue.d.ts +20 -0
- package/dist/components/ProSelect/index.js +2 -0
- package/dist/components/ProSelect/index.vue.d.ts +28 -0
- package/dist/components/ProTable/ProTableForm.vue.d.ts +91 -0
- package/dist/components/ProTable/index.js +2 -0
- package/dist/components/ProTable/index.vue.d.ts +36 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/ui/alert/Alert.vue.d.ts +22 -0
- package/dist/components/ui/alert/index.d.ts +6 -0
- package/dist/components/ui/button/Button.vue.d.ts +27 -0
- package/dist/components/ui/button/index.d.ts +7 -0
- package/dist/components/ui/checkbox/Checkbox.vue.d.ts +11 -0
- package/dist/components/ui/checkbox/index.d.ts +1 -0
- package/dist/components/ui/dialog/Dialog.vue.d.ts +22 -0
- package/dist/components/ui/dialog/DialogClose.vue.d.ts +18 -0
- package/dist/components/ui/dialog/DialogContent.vue.d.ts +36 -0
- package/dist/components/ui/dialog/DialogDescription.vue.d.ts +22 -0
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts +21 -0
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts +21 -0
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts +22 -0
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +18 -0
- package/dist/components/ui/dialog/index.d.ts +8 -0
- package/dist/components/ui/index.d.ts +12 -0
- package/dist/components/ui/input/Input.vue.d.ts +13 -0
- package/dist/components/ui/input/index.d.ts +1 -0
- package/dist/components/ui/label/Label.vue.d.ts +24 -0
- package/dist/components/ui/label/index.d.ts +1 -0
- package/dist/components/ui/loader/Loader.vue.d.ts +6 -0
- package/dist/components/ui/loader/index.d.ts +1 -0
- package/dist/components/ui/popover/Popover.vue.d.ts +22 -0
- package/dist/components/ui/popover/PopoverContent.vue.d.ts +38 -0
- package/dist/components/ui/popover/PopoverTrigger.vue.d.ts +18 -0
- package/dist/components/ui/popover/index.d.ts +3 -0
- package/dist/components/ui/radio-group/RadioGroup.vue.d.ts +22 -0
- package/dist/components/ui/radio-group/RadioGroupItem.vue.d.ts +7 -0
- package/dist/components/ui/radio-group/index.d.ts +2 -0
- package/dist/components/ui/select/Select.vue.d.ts +19 -0
- package/dist/components/ui/select/SelectContent.vue.d.ts +32 -0
- package/dist/components/ui/select/SelectItem.vue.d.ts +22 -0
- package/dist/components/ui/select/SelectTrigger.vue.d.ts +21 -0
- package/dist/components/ui/select/SelectValue.vue.d.ts +21 -0
- package/dist/components/ui/select/index.d.ts +5 -0
- package/dist/components/ui/table/Table.vue.d.ts +21 -0
- package/dist/components/ui/table/TableBody.vue.d.ts +21 -0
- package/dist/components/ui/table/TableCell.vue.d.ts +21 -0
- package/dist/components/ui/table/TableHead.vue.d.ts +21 -0
- package/dist/components/ui/table/TableHeader.vue.d.ts +21 -0
- package/dist/components/ui/table/TableRow.vue.d.ts +21 -0
- package/dist/components/ui/table/index.d.ts +6 -0
- package/dist/components/ui/textarea/Textarea.vue.d.ts +13 -0
- package/dist/components/ui/textarea/index.d.ts +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/openDialog-CVp3qAfm.js +95 -0
- package/dist/openDialog-CVp3qAfm.js.map +1 -0
- package/dist/utils/openDialog.d.ts +25 -0
- package/dist/utils/openDialog.js +2 -0
- package/dist/utils/uiMessage.d.ts +8 -0
- package/dist/utils-Dg1mr-yh.js +8 -0
- package/dist/utils-Dg1mr-yh.js.map +1 -0
- package/package.json +108 -0
- package/src/style.css +14 -0
- package/src/tailwind.preset.css +139 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Dg1mr-yh.js";
|
|
2
|
+
import { t as Button_default } from "./button-BQVT6mY3.js";
|
|
3
|
+
import { t as Input_default } from "./Input-BQYIq9cS.js";
|
|
4
|
+
import { t as ProFormBuilder_default } from "./ProFormBuilder-CsNShZ0y.js";
|
|
5
|
+
import { t as Checkbox_default } from "./Checkbox-DswwIgpU.js";
|
|
6
|
+
import { t as ProConfirmButton_default } from "./ProConfirmButton-zcvp7NcN.js";
|
|
7
|
+
import { t as Loader_default } from "./Loader-DZyMmrI8.js";
|
|
8
|
+
import { t as openDialog } from "./openDialog-CVp3qAfm.js";
|
|
9
|
+
import { Fragment, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, h, mergeModels, normalizeClass, openBlock, ref, renderList, renderSlot, shallowRef, toDisplayString, unref, useModel, useTemplateRef, withCtx, withKeys, withModifiers } from "vue";
|
|
10
|
+
import { Toaster, toast } from "vue-sonner";
|
|
11
|
+
var _hoisted_1$1 = {
|
|
12
|
+
"data-slot": "table-container",
|
|
13
|
+
class: "relative w-full overflow-x-auto"
|
|
14
|
+
};
|
|
15
|
+
var Table_default = /* @__PURE__ */ defineComponent({
|
|
16
|
+
__name: "Table",
|
|
17
|
+
props: { class: {} },
|
|
18
|
+
setup(__props) {
|
|
19
|
+
const props = __props;
|
|
20
|
+
return (_ctx, _cache) => {
|
|
21
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1, [createElementVNode("table", {
|
|
22
|
+
"data-slot": "table",
|
|
23
|
+
class: normalizeClass(unref(cn)("w-full caption-bottom text-sm", props.class))
|
|
24
|
+
}, [renderSlot(_ctx.$slots, "default")], 2)]);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
var TableBody_default = /* @__PURE__ */ defineComponent({
|
|
29
|
+
__name: "TableBody",
|
|
30
|
+
props: { class: {} },
|
|
31
|
+
setup(__props) {
|
|
32
|
+
const props = __props;
|
|
33
|
+
return (_ctx, _cache) => {
|
|
34
|
+
return openBlock(), createElementBlock("tbody", {
|
|
35
|
+
"data-slot": "table-body",
|
|
36
|
+
class: normalizeClass(unref(cn)("[&_tr:last-child]:border-0", props.class))
|
|
37
|
+
}, [renderSlot(_ctx.$slots, "default")], 2);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
var TableCell_default = /* @__PURE__ */ defineComponent({
|
|
42
|
+
__name: "TableCell",
|
|
43
|
+
props: { class: {} },
|
|
44
|
+
setup(__props) {
|
|
45
|
+
const props = __props;
|
|
46
|
+
return (_ctx, _cache) => {
|
|
47
|
+
return openBlock(), createElementBlock("td", {
|
|
48
|
+
"data-slot": "table-cell",
|
|
49
|
+
class: normalizeClass(unref(cn)("p-3 align-middle whitespace-nowrap", props.class))
|
|
50
|
+
}, [renderSlot(_ctx.$slots, "default")], 2);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
var TableHead_default = /* @__PURE__ */ defineComponent({
|
|
55
|
+
__name: "TableHead",
|
|
56
|
+
props: { class: {} },
|
|
57
|
+
setup(__props) {
|
|
58
|
+
const props = __props;
|
|
59
|
+
return (_ctx, _cache) => {
|
|
60
|
+
return openBlock(), createElementBlock("th", {
|
|
61
|
+
"data-slot": "table-head",
|
|
62
|
+
class: normalizeClass(unref(cn)("text-foreground h-10 px-3 text-left align-middle font-medium whitespace-nowrap", props.class))
|
|
63
|
+
}, [renderSlot(_ctx.$slots, "default")], 2);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
var TableHeader_default = /* @__PURE__ */ defineComponent({
|
|
68
|
+
__name: "TableHeader",
|
|
69
|
+
props: { class: {} },
|
|
70
|
+
setup(__props) {
|
|
71
|
+
const props = __props;
|
|
72
|
+
return (_ctx, _cache) => {
|
|
73
|
+
return openBlock(), createElementBlock("thead", {
|
|
74
|
+
"data-slot": "table-header",
|
|
75
|
+
class: normalizeClass(unref(cn)("[&_tr]:border-b", props.class))
|
|
76
|
+
}, [renderSlot(_ctx.$slots, "default")], 2);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
var TableRow_default = /* @__PURE__ */ defineComponent({
|
|
81
|
+
__name: "TableRow",
|
|
82
|
+
props: { class: {} },
|
|
83
|
+
setup(__props) {
|
|
84
|
+
const props = __props;
|
|
85
|
+
return (_ctx, _cache) => {
|
|
86
|
+
return openBlock(), createElementBlock("tr", {
|
|
87
|
+
"data-slot": "table-row",
|
|
88
|
+
class: normalizeClass(unref(cn)("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors", props.class))
|
|
89
|
+
}, [renderSlot(_ctx.$slots, "default")], 2);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
var toasterMounted = false;
|
|
94
|
+
function ensureToaster() {
|
|
95
|
+
if (toasterMounted || typeof document === "undefined") return;
|
|
96
|
+
toasterMounted = true;
|
|
97
|
+
if (document.querySelector("[data-snowui-sonner-toaster]")) return;
|
|
98
|
+
const container = document.createElement("div");
|
|
99
|
+
container.setAttribute("data-snowui-sonner-toaster", "");
|
|
100
|
+
document.body.appendChild(container);
|
|
101
|
+
createApp({ render: () => h(Toaster, {
|
|
102
|
+
position: "top-center",
|
|
103
|
+
richColors: true
|
|
104
|
+
}) }).mount(container);
|
|
105
|
+
}
|
|
106
|
+
function withToaster(call) {
|
|
107
|
+
return (...args) => {
|
|
108
|
+
ensureToaster();
|
|
109
|
+
return call(...args);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const uiMessage = {
|
|
113
|
+
success: withToaster((content) => toast.success(content)),
|
|
114
|
+
info: withToaster((content) => toast.info(content)),
|
|
115
|
+
error: withToaster((content) => toast.error(content)),
|
|
116
|
+
warning: withToaster((content) => toast.warning(content))
|
|
117
|
+
};
|
|
118
|
+
var ProTableForm_default = /* @__PURE__ */ defineComponent({
|
|
119
|
+
name: "ProTableForm",
|
|
120
|
+
__name: "ProTableForm",
|
|
121
|
+
props: {
|
|
122
|
+
formItems: {},
|
|
123
|
+
rules: {},
|
|
124
|
+
formData: {},
|
|
125
|
+
requestApi: { type: Function }
|
|
126
|
+
},
|
|
127
|
+
setup(__props, { expose: __expose }) {
|
|
128
|
+
const props = __props;
|
|
129
|
+
const data = ref({ ...props.formData });
|
|
130
|
+
const formRef = useTemplateRef("formRef");
|
|
131
|
+
__expose({ async submit() {
|
|
132
|
+
await formRef.value?.validate();
|
|
133
|
+
return props.requestApi({ ...data.value });
|
|
134
|
+
} });
|
|
135
|
+
return (_ctx, _cache) => {
|
|
136
|
+
return openBlock(), createBlock(ProFormBuilder_default, {
|
|
137
|
+
ref_key: "formRef",
|
|
138
|
+
ref: formRef,
|
|
139
|
+
modelValue: data.value,
|
|
140
|
+
"form-items": _ctx.formItems,
|
|
141
|
+
rules: _ctx.rules
|
|
142
|
+
}, null, 8, [
|
|
143
|
+
"modelValue",
|
|
144
|
+
"form-items",
|
|
145
|
+
"rules"
|
|
146
|
+
]);
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
var _hoisted_1 = { class: "flex flex-wrap items-center gap-3 mb-5" };
|
|
151
|
+
var _hoisted_2 = { class: "flex items-center gap-2 flex-1 max-w-70" };
|
|
152
|
+
var _hoisted_3 = { class: "rounded-md border" };
|
|
153
|
+
var _hoisted_4 = { class: "flex items-center justify-center gap-2 text-muted-foreground" };
|
|
154
|
+
var ProTable_default = /* @__PURE__ */ defineComponent({
|
|
155
|
+
name: "ProTable",
|
|
156
|
+
__name: "index",
|
|
157
|
+
props: /* @__PURE__ */ mergeModels({
|
|
158
|
+
apis: {},
|
|
159
|
+
rowKey: {},
|
|
160
|
+
beforeCreate: { type: Function },
|
|
161
|
+
columns: {},
|
|
162
|
+
formItems: {},
|
|
163
|
+
rules: {}
|
|
164
|
+
}, {
|
|
165
|
+
"queryParams": { default: () => ({}) },
|
|
166
|
+
"queryParamsModifiers": {}
|
|
167
|
+
}),
|
|
168
|
+
emits: ["update:queryParams"],
|
|
169
|
+
setup(__props, { expose: __expose }) {
|
|
170
|
+
const props = __props;
|
|
171
|
+
const key = props.rowKey || "id";
|
|
172
|
+
const queryParams = useModel(__props, "queryParams");
|
|
173
|
+
const { get, create, update, remove } = props.apis;
|
|
174
|
+
const dataSource = ref([]);
|
|
175
|
+
const isLoading = ref(false);
|
|
176
|
+
function loadData() {
|
|
177
|
+
isLoading.value = true;
|
|
178
|
+
get(queryParams.value).then((res) => {
|
|
179
|
+
dataSource.value = res.data;
|
|
180
|
+
}).finally(() => {
|
|
181
|
+
isLoading.value = false;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
const selectedRowKeys = ref([]);
|
|
185
|
+
const selectedRow = shallowRef();
|
|
186
|
+
const allSelected = computed(() => dataSource.value.length > 0 && dataSource.value.every((row) => selectedRowKeys.value.includes(row[key])));
|
|
187
|
+
function onSelectAll(checked) {
|
|
188
|
+
if (checked === true) selectedRowKeys.value = dataSource.value.map((row) => row[key]);
|
|
189
|
+
else selectedRowKeys.value = [];
|
|
190
|
+
}
|
|
191
|
+
function onSelectRow(row, checked) {
|
|
192
|
+
if (checked === true) selectedRowKeys.value = [...selectedRowKeys.value, row[key]];
|
|
193
|
+
else selectedRowKeys.value = selectedRowKeys.value.filter((k) => k !== row[key]);
|
|
194
|
+
selectedRow.value = dataSource.value.find((row$1) => row$1[key] === selectedRowKeys.value[0]);
|
|
195
|
+
}
|
|
196
|
+
function onSelectChange(row) {
|
|
197
|
+
const rowKey = row[key];
|
|
198
|
+
onSelectRow(row, !selectedRowKeys.value.includes(rowKey));
|
|
199
|
+
}
|
|
200
|
+
loadData();
|
|
201
|
+
function openForm(data) {
|
|
202
|
+
openDialog(ProTableForm_default, {
|
|
203
|
+
requestApi: data[key] ? update : create,
|
|
204
|
+
formItems: props.formItems,
|
|
205
|
+
rules: props.rules,
|
|
206
|
+
formData: data
|
|
207
|
+
}, {
|
|
208
|
+
title: data[key] ? "修改" : "新增",
|
|
209
|
+
onOk: () => {
|
|
210
|
+
loadData();
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
async function handleCreate() {
|
|
215
|
+
openForm({});
|
|
216
|
+
}
|
|
217
|
+
function handleUpdate() {
|
|
218
|
+
openForm(selectedRow.value);
|
|
219
|
+
}
|
|
220
|
+
function handleRemove() {
|
|
221
|
+
remove(selectedRowKeys.value).then(loadData).catch(() => {
|
|
222
|
+
uiMessage.error("删除失败");
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
__expose({ refresh: loadData });
|
|
226
|
+
return (_ctx, _cache) => {
|
|
227
|
+
return openBlock(), createElementBlock("div", null, [createElementVNode("div", _hoisted_1, [
|
|
228
|
+
createVNode(unref(Button_default), {
|
|
229
|
+
variant: "default",
|
|
230
|
+
onClick: handleCreate
|
|
231
|
+
}, {
|
|
232
|
+
default: withCtx(() => _cache[2] || (_cache[2] = [createTextVNode("新增")])),
|
|
233
|
+
_: 1,
|
|
234
|
+
__: [2]
|
|
235
|
+
}),
|
|
236
|
+
createVNode(unref(Button_default), {
|
|
237
|
+
variant: "default",
|
|
238
|
+
disabled: !selectedRowKeys.value.length || void 0,
|
|
239
|
+
onClick: handleUpdate
|
|
240
|
+
}, {
|
|
241
|
+
default: withCtx(() => _cache[3] || (_cache[3] = [createTextVNode("修改")])),
|
|
242
|
+
_: 1,
|
|
243
|
+
__: [3]
|
|
244
|
+
}, 8, ["disabled"]),
|
|
245
|
+
createVNode(ProConfirmButton_default, {
|
|
246
|
+
danger: "",
|
|
247
|
+
title: "确定删除吗?",
|
|
248
|
+
disabled: !selectedRowKeys.value.length,
|
|
249
|
+
"on-confirm": handleRemove
|
|
250
|
+
}, {
|
|
251
|
+
default: withCtx(() => _cache[4] || (_cache[4] = [createTextVNode(" 删除 ")])),
|
|
252
|
+
_: 1,
|
|
253
|
+
__: [4]
|
|
254
|
+
}, 8, ["disabled"]),
|
|
255
|
+
renderSlot(_ctx.$slots, "search"),
|
|
256
|
+
createElementVNode("div", _hoisted_2, [createVNode(unref(Input_default), {
|
|
257
|
+
modelValue: queryParams.value.keyword,
|
|
258
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => queryParams.value.keyword = $event),
|
|
259
|
+
placeholder: "搜索关键词",
|
|
260
|
+
onKeydown: withKeys(loadData, ["enter"])
|
|
261
|
+
}, null, 8, ["modelValue"]), createVNode(unref(Button_default), {
|
|
262
|
+
variant: "outline",
|
|
263
|
+
onClick: loadData
|
|
264
|
+
}, {
|
|
265
|
+
default: withCtx(() => _cache[5] || (_cache[5] = [createTextVNode("搜索")])),
|
|
266
|
+
_: 1,
|
|
267
|
+
__: [5]
|
|
268
|
+
})])
|
|
269
|
+
]), createElementVNode("div", _hoisted_3, [createVNode(unref(Table_default), null, {
|
|
270
|
+
default: withCtx(() => [createVNode(unref(TableHeader_default), null, {
|
|
271
|
+
default: withCtx(() => [createVNode(unref(TableRow_default), { class: "hover:bg-transparent" }, {
|
|
272
|
+
default: withCtx(() => [createVNode(unref(TableCell_default), { class: "w-10" }, {
|
|
273
|
+
default: withCtx(() => [createVNode(unref(Checkbox_default), {
|
|
274
|
+
"model-value": allSelected.value,
|
|
275
|
+
"onUpdate:modelValue": onSelectAll,
|
|
276
|
+
"aria-label": "全选"
|
|
277
|
+
}, null, 8, ["model-value"])]),
|
|
278
|
+
_: 1
|
|
279
|
+
}), (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (col) => {
|
|
280
|
+
return openBlock(), createBlock(unref(TableHead_default), { key: col.dataIndex }, {
|
|
281
|
+
default: withCtx(() => [createTextVNode(toDisplayString(col.title), 1)]),
|
|
282
|
+
_: 2
|
|
283
|
+
}, 1024);
|
|
284
|
+
}), 128))]),
|
|
285
|
+
_: 1
|
|
286
|
+
})]),
|
|
287
|
+
_: 1
|
|
288
|
+
}), createVNode(unref(TableBody_default), null, {
|
|
289
|
+
default: withCtx(() => [!isLoading.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [(openBlock(true), createElementBlock(Fragment, null, renderList(dataSource.value, (row) => {
|
|
290
|
+
return openBlock(), createBlock(unref(TableRow_default), {
|
|
291
|
+
key: row[unref(key)],
|
|
292
|
+
class: normalizeClass([{ "bg-muted/50": selectedRowKeys.value.includes(row[unref(key)]) }, "cursor-pointer"]),
|
|
293
|
+
onClick: ($event) => onSelectChange(row)
|
|
294
|
+
}, {
|
|
295
|
+
default: withCtx(() => [createVNode(unref(TableCell_default), { onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"])) }, {
|
|
296
|
+
default: withCtx(() => [createVNode(unref(Checkbox_default), {
|
|
297
|
+
"model-value": selectedRowKeys.value.includes(row[unref(key)]),
|
|
298
|
+
"onUpdate:modelValue": (v) => onSelectRow(row, v),
|
|
299
|
+
"aria-label": `选择 ${row[unref(key)]}`
|
|
300
|
+
}, null, 8, [
|
|
301
|
+
"model-value",
|
|
302
|
+
"onUpdate:modelValue",
|
|
303
|
+
"aria-label"
|
|
304
|
+
])]),
|
|
305
|
+
_: 2
|
|
306
|
+
}, 1024), (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (col) => {
|
|
307
|
+
return openBlock(), createBlock(unref(TableCell_default), { key: col.dataIndex }, {
|
|
308
|
+
default: withCtx(() => [createTextVNode(toDisplayString(row[col.dataIndex]), 1)]),
|
|
309
|
+
_: 2
|
|
310
|
+
}, 1024);
|
|
311
|
+
}), 128))]),
|
|
312
|
+
_: 2
|
|
313
|
+
}, 1032, ["class", "onClick"]);
|
|
314
|
+
}), 128)), !dataSource.value.length ? (openBlock(), createBlock(unref(TableRow_default), {
|
|
315
|
+
key: 0,
|
|
316
|
+
class: "hover:bg-transparent"
|
|
317
|
+
}, {
|
|
318
|
+
default: withCtx(() => [createVNode(unref(TableCell_default), {
|
|
319
|
+
class: "h-24 text-center text-muted-foreground",
|
|
320
|
+
colspan: _ctx.columns.length + 1
|
|
321
|
+
}, {
|
|
322
|
+
default: withCtx(() => _cache[6] || (_cache[6] = [createTextVNode(" 暂无数据 ")])),
|
|
323
|
+
_: 1,
|
|
324
|
+
__: [6]
|
|
325
|
+
}, 8, ["colspan"])]),
|
|
326
|
+
_: 1
|
|
327
|
+
})) : createCommentVNode("", true)], 64)) : (openBlock(), createBlock(unref(TableRow_default), {
|
|
328
|
+
key: 1,
|
|
329
|
+
class: "hover:bg-transparent"
|
|
330
|
+
}, {
|
|
331
|
+
default: withCtx(() => [createVNode(unref(TableCell_default), {
|
|
332
|
+
class: "h-24",
|
|
333
|
+
colspan: _ctx.columns.length + 1
|
|
334
|
+
}, {
|
|
335
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_4, [createVNode(unref(Loader_default)), _cache[7] || (_cache[7] = createTextVNode(" 加载中... "))])]),
|
|
336
|
+
_: 1
|
|
337
|
+
}, 8, ["colspan"])]),
|
|
338
|
+
_: 1
|
|
339
|
+
}))]),
|
|
340
|
+
_: 1
|
|
341
|
+
})]),
|
|
342
|
+
_: 1
|
|
343
|
+
})])]);
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
export { uiMessage as i, ProTableForm_default as n, Toaster as r, ProTable_default as t };
|
|
348
|
+
|
|
349
|
+
//# sourceMappingURL=ProTable-CP1Mc52q.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProTable-CP1Mc52q.js","names":["formItems","rules","columns"],"sources":["../src/components/ui/table/Table.vue","../src/components/ui/table/Table.vue","../src/components/ui/table/TableBody.vue","../src/components/ui/table/TableBody.vue","../src/components/ui/table/TableCell.vue","../src/components/ui/table/TableCell.vue","../src/components/ui/table/TableHead.vue","../src/components/ui/table/TableHead.vue","../src/components/ui/table/TableHeader.vue","../src/components/ui/table/TableHeader.vue","../src/components/ui/table/TableRow.vue","../src/components/ui/table/TableRow.vue","../src/utils/uiMessage.ts","../src/components/ProTable/ProTableForm.vue","../src/components/ProTable/ProTableForm.vue","../src/components/ProTable/index.vue","../src/components/ProTable/index.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <div data-slot=\"table-container\" class=\"relative w-full overflow-x-auto\">\n <table data-slot=\"table\" :class=\"cn('w-full caption-bottom text-sm', props.class)\">\n <slot />\n </table>\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <div data-slot=\"table-container\" class=\"relative w-full overflow-x-auto\">\n <table data-slot=\"table\" :class=\"cn('w-full caption-bottom text-sm', props.class)\">\n <slot />\n </table>\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <tbody data-slot=\"table-body\" :class=\"cn('[&_tr:last-child]:border-0', props.class)\">\n <slot />\n </tbody>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <tbody data-slot=\"table-body\" :class=\"cn('[&_tr:last-child]:border-0', props.class)\">\n <slot />\n </tbody>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <td data-slot=\"table-cell\" :class=\"cn('p-3 align-middle whitespace-nowrap', props.class)\">\n <slot />\n </td>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <td data-slot=\"table-cell\" :class=\"cn('p-3 align-middle whitespace-nowrap', props.class)\">\n <slot />\n </td>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <th\n data-slot=\"table-head\"\n :class=\"cn('text-foreground h-10 px-3 text-left align-middle font-medium whitespace-nowrap', props.class)\"\n >\n <slot />\n </th>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <th\n data-slot=\"table-head\"\n :class=\"cn('text-foreground h-10 px-3 text-left align-middle font-medium whitespace-nowrap', props.class)\"\n >\n <slot />\n </th>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <thead data-slot=\"table-header\" :class=\"cn('[&_tr]:border-b', props.class)\">\n <slot />\n </thead>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <thead data-slot=\"table-header\" :class=\"cn('[&_tr]:border-b', props.class)\">\n <slot />\n </thead>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <tr\n data-slot=\"table-row\"\n :class=\"cn('hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors', props.class)\"\n >\n <slot />\n </tr>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <tr\n data-slot=\"table-row\"\n :class=\"cn('hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors', props.class)\"\n >\n <slot />\n </tr>\n</template>\n","import { createApp, h } from \"vue\";\nimport { Toaster, toast } from \"vue-sonner\";\n\n/**\n * 全局提示的统一抽象:与 ui-antd / ui-element 导出同名方法,调用方无需关心底层 UI 库。\n * shadcn 版基于 vue-sonner(shadcn 官方 toast 方案)。\n *\n * vue-sonner 的 toast 需要页面里存在 <Toaster />;为保证开箱即用,\n * 首次调用时自动在 body 上挂一个(与 antd 的 message 全局可用行为对齐)。\n */\nlet toasterMounted = false;\n\nfunction ensureToaster() {\n if (toasterMounted || typeof document === \"undefined\") return;\n toasterMounted = true;\n if (document.querySelector(\"[data-snowui-sonner-toaster]\")) return;\n const container = document.createElement(\"div\");\n container.setAttribute(\"data-snowui-sonner-toaster\", \"\");\n document.body.appendChild(container);\n const app = createApp({ render: () => h(Toaster, { position: \"top-center\", richColors: true }) });\n app.mount(container);\n}\n\nfunction withToaster<T extends any[]>(call: (...args: T) => any) {\n return (...args: T) => {\n ensureToaster();\n return call(...args);\n };\n}\n\nexport const uiMessage = {\n success: withToaster((content: string) => toast.success(content)),\n info: withToaster((content: string) => toast.info(content)),\n error: withToaster((content: string) => toast.error(content)),\n warning: withToaster((content: string) => toast.warning(content)),\n};\n\nexport { Toaster, toast };\n","<script setup lang=\"ts\">\nimport { ref, useTemplateRef } from \"vue\";\nimport ProFormBuilder from \"../ProFormBuilder/index.vue\";\n\ndefineOptions({\n name: \"ProTableForm\",\n});\n\nconst props = defineProps<{\n formItems: any[];\n rules?: any;\n formData: Record<string, any>;\n requestApi: (data: Record<string, any>) => Promise<any>;\n}>();\n\nconst data = ref<Record<string, any>>({ ...props.formData });\nconst formRef = useTemplateRef<any>(\"formRef\");\n\ndefineExpose({\n async submit() {\n await formRef.value?.validate();\n return props.requestApi({\n ...data.value,\n });\n },\n});\n</script>\n\n<template>\n <ProFormBuilder ref=\"formRef\" :modelValue=\"data\" :form-items=\"formItems\" :rules=\"rules\" />\n</template>\n","<script setup lang=\"ts\">\nimport { ref, useTemplateRef } from \"vue\";\nimport ProFormBuilder from \"../ProFormBuilder/index.vue\";\n\ndefineOptions({\n name: \"ProTableForm\",\n});\n\nconst props = defineProps<{\n formItems: any[];\n rules?: any;\n formData: Record<string, any>;\n requestApi: (data: Record<string, any>) => Promise<any>;\n}>();\n\nconst data = ref<Record<string, any>>({ ...props.formData });\nconst formRef = useTemplateRef<any>(\"formRef\");\n\ndefineExpose({\n async submit() {\n await formRef.value?.validate();\n return props.requestApi({\n ...data.value,\n });\n },\n});\n</script>\n\n<template>\n <ProFormBuilder ref=\"formRef\" :modelValue=\"data\" :form-items=\"formItems\" :rules=\"rules\" />\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref, shallowRef } from \"vue\";\nimport { openDialog } from \"../../utils/openDialog\";\nimport ProTableForm from \"./ProTableForm.vue\";\nimport { Button } from \"../ui/button\";\nimport { Input } from \"../ui/input\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"../ui/table\";\nimport { Checkbox } from \"../ui/checkbox\";\nimport { Loader } from \"../ui/loader\";\nimport ProConfirmButton from \"../ProConfirmButton/index.vue\";\nimport { uiMessage } from \"../../utils/uiMessage\";\nimport type { PageApis, TableColumn, FormItem, FormRules } from \"@cynnie/ui-core\";\n\ndefineOptions({\n name: \"ProTable\",\n});\n\nconst props = defineProps<{\n apis: PageApis;\n rowKey?: string;\n beforeCreate?: () => Promise<Record<string, any>>;\n columns: TableColumn[];\n formItems: FormItem[];\n rules?: FormRules;\n}>();\n\nconst key = props.rowKey || \"id\";\n\nconst queryParams = defineModel<any>(\"queryParams\", { default: () => ({}) });\n\nconst { get, create, update, remove } = props.apis;\nconst dataSource = ref<any[]>([]);\nconst isLoading = ref(false);\nfunction loadData() {\n isLoading.value = true;\n get(queryParams.value)\n .then((res) => {\n dataSource.value = res.data;\n })\n .finally(() => {\n isLoading.value = false;\n });\n}\n\nconst selectedRowKeys = ref<any[]>([]);\n\nconst selectedRow = shallowRef<Record<string, any>>();\n\nconst allSelected = computed(\n () => dataSource.value.length > 0 && dataSource.value.every((row) => selectedRowKeys.value.includes(row[key])),\n);\n\nfunction onSelectAll(checked: boolean | \"indeterminate\") {\n if (checked === true) {\n selectedRowKeys.value = dataSource.value.map((row) => row[key]);\n } else {\n selectedRowKeys.value = [];\n }\n}\n\nfunction onSelectRow(row: Record<string, any>, checked: boolean | \"indeterminate\") {\n if (checked === true) {\n selectedRowKeys.value = [...selectedRowKeys.value, row[key]];\n } else {\n selectedRowKeys.value = selectedRowKeys.value.filter((k) => k !== row[key]);\n }\n // 与 antd / element 版对齐:selection 变化即更新 selectedRow\n selectedRow.value = dataSource.value.find((row) => row[key] === selectedRowKeys.value[0]);\n}\n\nfunction onSelectChange(row: Record<string, any>) {\n const rowKey = row[key];\n const checked = !selectedRowKeys.value.includes(rowKey);\n onSelectRow(row, checked);\n}\n\nloadData();\n\nfunction openForm(data: Record<string, any>) {\n openDialog(\n ProTableForm,\n {\n requestApi: data[key] ? update : create,\n formItems: props.formItems,\n rules: props.rules,\n formData: data,\n },\n {\n title: data[key] ? \"修改\" : \"新增\",\n onOk: () => {\n loadData();\n },\n },\n );\n}\n\nasync function handleCreate() {\n openForm({});\n}\nfunction handleUpdate() {\n openForm(selectedRow.value);\n}\nfunction handleRemove() {\n remove(selectedRowKeys.value)\n .then(loadData)\n .catch(() => {\n uiMessage.error(\"删除失败\");\n });\n}\n\ndefineExpose({\n refresh: loadData,\n});\n</script>\n\n<template>\n <div>\n <div class=\"flex flex-wrap items-center gap-3 mb-5\">\n <Button variant=\"default\" @click=\"handleCreate\">新增</Button>\n <Button variant=\"default\" :disabled=\"!selectedRowKeys.length || undefined\" @click=\"handleUpdate\">修改</Button>\n <ProConfirmButton danger title=\"确定删除吗?\" :disabled=\"!selectedRowKeys.length\" :on-confirm=\"handleRemove\">\n 删除\n </ProConfirmButton>\n <slot name=\"search\"></slot>\n <div class=\"flex items-center gap-2 flex-1 max-w-70\">\n <Input\n v-model=\"queryParams.keyword\"\n placeholder=\"搜索关键词\"\n @keydown.enter=\"loadData\"\n />\n <Button variant=\"outline\" @click=\"loadData\">搜索</Button>\n </div>\n </div>\n\n <div class=\"rounded-md border\">\n <Table>\n <TableHeader>\n <TableRow class=\"hover:bg-transparent\">\n <TableCell class=\"w-10\">\n <Checkbox :model-value=\"allSelected\" @update:model-value=\"onSelectAll\" aria-label=\"全选\" />\n </TableCell>\n <TableHead v-for=\"col in columns\" :key=\"col.dataIndex\">{{ col.title }}</TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>\n <template v-if=\"!isLoading\">\n <TableRow\n v-for=\"row in dataSource\"\n :key=\"row[key]\"\n :class=\"{ 'bg-muted/50': selectedRowKeys.includes(row[key]) }\"\n class=\"cursor-pointer\"\n @click=\"onSelectChange(row)\"\n >\n <TableCell @click.stop>\n <Checkbox\n :model-value=\"selectedRowKeys.includes(row[key])\"\n @update:model-value=\"(v: any) => onSelectRow(row, v)\"\n :aria-label=\"`选择 ${row[key]}`\"\n />\n </TableCell>\n <TableCell v-for=\"col in columns\" :key=\"col.dataIndex\">{{ row[col.dataIndex] }}</TableCell>\n </TableRow>\n <TableRow v-if=\"!dataSource.length\" class=\"hover:bg-transparent\">\n <TableCell class=\"h-24 text-center text-muted-foreground\" :colspan=\"columns.length + 1\">\n 暂无数据\n </TableCell>\n </TableRow>\n </template>\n <TableRow v-else class=\"hover:bg-transparent\">\n <TableCell class=\"h-24\" :colspan=\"columns.length + 1\">\n <div class=\"flex items-center justify-center gap-2 text-muted-foreground\">\n <Loader />\n 加载中...\n </div>\n </TableCell>\n </TableRow>\n </TableBody>\n </Table>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref, shallowRef } from \"vue\";\nimport { openDialog } from \"../../utils/openDialog\";\nimport ProTableForm from \"./ProTableForm.vue\";\nimport { Button } from \"../ui/button\";\nimport { Input } from \"../ui/input\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"../ui/table\";\nimport { Checkbox } from \"../ui/checkbox\";\nimport { Loader } from \"../ui/loader\";\nimport ProConfirmButton from \"../ProConfirmButton/index.vue\";\nimport { uiMessage } from \"../../utils/uiMessage\";\nimport type { PageApis, TableColumn, FormItem, FormRules } from \"@cynnie/ui-core\";\n\ndefineOptions({\n name: \"ProTable\",\n});\n\nconst props = defineProps<{\n apis: PageApis;\n rowKey?: string;\n beforeCreate?: () => Promise<Record<string, any>>;\n columns: TableColumn[];\n formItems: FormItem[];\n rules?: FormRules;\n}>();\n\nconst key = props.rowKey || \"id\";\n\nconst queryParams = defineModel<any>(\"queryParams\", { default: () => ({}) });\n\nconst { get, create, update, remove } = props.apis;\nconst dataSource = ref<any[]>([]);\nconst isLoading = ref(false);\nfunction loadData() {\n isLoading.value = true;\n get(queryParams.value)\n .then((res) => {\n dataSource.value = res.data;\n })\n .finally(() => {\n isLoading.value = false;\n });\n}\n\nconst selectedRowKeys = ref<any[]>([]);\n\nconst selectedRow = shallowRef<Record<string, any>>();\n\nconst allSelected = computed(\n () => dataSource.value.length > 0 && dataSource.value.every((row) => selectedRowKeys.value.includes(row[key])),\n);\n\nfunction onSelectAll(checked: boolean | \"indeterminate\") {\n if (checked === true) {\n selectedRowKeys.value = dataSource.value.map((row) => row[key]);\n } else {\n selectedRowKeys.value = [];\n }\n}\n\nfunction onSelectRow(row: Record<string, any>, checked: boolean | \"indeterminate\") {\n if (checked === true) {\n selectedRowKeys.value = [...selectedRowKeys.value, row[key]];\n } else {\n selectedRowKeys.value = selectedRowKeys.value.filter((k) => k !== row[key]);\n }\n // 与 antd / element 版对齐:selection 变化即更新 selectedRow\n selectedRow.value = dataSource.value.find((row) => row[key] === selectedRowKeys.value[0]);\n}\n\nfunction onSelectChange(row: Record<string, any>) {\n const rowKey = row[key];\n const checked = !selectedRowKeys.value.includes(rowKey);\n onSelectRow(row, checked);\n}\n\nloadData();\n\nfunction openForm(data: Record<string, any>) {\n openDialog(\n ProTableForm,\n {\n requestApi: data[key] ? update : create,\n formItems: props.formItems,\n rules: props.rules,\n formData: data,\n },\n {\n title: data[key] ? \"修改\" : \"新增\",\n onOk: () => {\n loadData();\n },\n },\n );\n}\n\nasync function handleCreate() {\n openForm({});\n}\nfunction handleUpdate() {\n openForm(selectedRow.value);\n}\nfunction handleRemove() {\n remove(selectedRowKeys.value)\n .then(loadData)\n .catch(() => {\n uiMessage.error(\"删除失败\");\n });\n}\n\ndefineExpose({\n refresh: loadData,\n});\n</script>\n\n<template>\n <div>\n <div class=\"flex flex-wrap items-center gap-3 mb-5\">\n <Button variant=\"default\" @click=\"handleCreate\">新增</Button>\n <Button variant=\"default\" :disabled=\"!selectedRowKeys.length || undefined\" @click=\"handleUpdate\">修改</Button>\n <ProConfirmButton danger title=\"确定删除吗?\" :disabled=\"!selectedRowKeys.length\" :on-confirm=\"handleRemove\">\n 删除\n </ProConfirmButton>\n <slot name=\"search\"></slot>\n <div class=\"flex items-center gap-2 flex-1 max-w-70\">\n <Input\n v-model=\"queryParams.keyword\"\n placeholder=\"搜索关键词\"\n @keydown.enter=\"loadData\"\n />\n <Button variant=\"outline\" @click=\"loadData\">搜索</Button>\n </div>\n </div>\n\n <div class=\"rounded-md border\">\n <Table>\n <TableHeader>\n <TableRow class=\"hover:bg-transparent\">\n <TableCell class=\"w-10\">\n <Checkbox :model-value=\"allSelected\" @update:model-value=\"onSelectAll\" aria-label=\"全选\" />\n </TableCell>\n <TableHead v-for=\"col in columns\" :key=\"col.dataIndex\">{{ col.title }}</TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>\n <template v-if=\"!isLoading\">\n <TableRow\n v-for=\"row in dataSource\"\n :key=\"row[key]\"\n :class=\"{ 'bg-muted/50': selectedRowKeys.includes(row[key]) }\"\n class=\"cursor-pointer\"\n @click=\"onSelectChange(row)\"\n >\n <TableCell @click.stop>\n <Checkbox\n :model-value=\"selectedRowKeys.includes(row[key])\"\n @update:model-value=\"(v: any) => onSelectRow(row, v)\"\n :aria-label=\"`选择 ${row[key]}`\"\n />\n </TableCell>\n <TableCell v-for=\"col in columns\" :key=\"col.dataIndex\">{{ row[col.dataIndex] }}</TableCell>\n </TableRow>\n <TableRow v-if=\"!dataSource.length\" class=\"hover:bg-transparent\">\n <TableCell class=\"h-24 text-center text-muted-foreground\" :colspan=\"columns.length + 1\">\n 暂无数据\n </TableCell>\n </TableRow>\n </template>\n <TableRow v-else class=\"hover:bg-transparent\">\n <TableCell class=\"h-24\" :colspan=\"columns.length + 1\">\n <div class=\"flex items-center justify-center gap-2 text-muted-foreground\">\n <Loader />\n 加载中...\n </div>\n </TableCell>\n </TableRow>\n </TableBody>\n </Table>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;ECIA,MAAM,QAAQ;;uBAMZ,mBAIM,OAJN,cAIM,CAHJ,mBAEQ,SAAA;IAFD,aAAU;IAAS,OAAK,eAAE,MAAA,GAAE,CAAA,iCAAkC,MAAM,MAAK,CAAA;OAC9E,WAAQ,KAAA,QAAA,UAAA,CAAA,EAAA,EAAA,CAAA,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|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Dg1mr-yh.js";
|
|
2
|
+
import { createBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderSlot, unref, withCtx } from "vue";
|
|
3
|
+
import { SelectContent, SelectIcon, SelectItem, SelectItemIndicator, SelectItemText, SelectPortal, SelectRoot, SelectScrollDownButton, SelectScrollUpButton, SelectTrigger, SelectValue, SelectViewport, useForwardProps, useForwardPropsEmits } from "reka-ui";
|
|
4
|
+
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-vue-next";
|
|
5
|
+
var Select_default = /* @__PURE__ */ defineComponent({
|
|
6
|
+
__name: "Select",
|
|
7
|
+
props: {
|
|
8
|
+
open: { type: Boolean },
|
|
9
|
+
defaultOpen: { type: Boolean },
|
|
10
|
+
defaultValue: {},
|
|
11
|
+
modelValue: {},
|
|
12
|
+
nullableValue: {},
|
|
13
|
+
by: { type: [String, Function] },
|
|
14
|
+
dir: {},
|
|
15
|
+
multiple: { type: Boolean },
|
|
16
|
+
autocomplete: {},
|
|
17
|
+
disabled: { type: Boolean },
|
|
18
|
+
name: {},
|
|
19
|
+
required: { type: Boolean }
|
|
20
|
+
},
|
|
21
|
+
setup(__props) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
return (_ctx, _cache) => {
|
|
24
|
+
return openBlock(), createBlock(unref(SelectRoot), mergeProps({ "data-slot": "select" }, props), {
|
|
25
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
26
|
+
_: 3
|
|
27
|
+
}, 16);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
var SelectContent_default = /* @__PURE__ */ defineComponent({
|
|
32
|
+
inheritAttrs: false,
|
|
33
|
+
__name: "SelectContent",
|
|
34
|
+
props: {
|
|
35
|
+
forceMount: { type: Boolean },
|
|
36
|
+
position: { default: "popper" },
|
|
37
|
+
bodyLock: { type: Boolean },
|
|
38
|
+
memoDependencies: {},
|
|
39
|
+
side: {},
|
|
40
|
+
sideOffset: {},
|
|
41
|
+
sideFlip: { type: Boolean },
|
|
42
|
+
align: {},
|
|
43
|
+
alignOffset: {},
|
|
44
|
+
alignFlip: { type: Boolean },
|
|
45
|
+
avoidCollisions: { type: Boolean },
|
|
46
|
+
collisionBoundary: {},
|
|
47
|
+
collisionPadding: {},
|
|
48
|
+
arrowPadding: {},
|
|
49
|
+
hideShiftedArrow: { type: Boolean },
|
|
50
|
+
sticky: {},
|
|
51
|
+
hideWhenDetached: { type: Boolean },
|
|
52
|
+
positionStrategy: {},
|
|
53
|
+
updatePositionStrategy: {},
|
|
54
|
+
disableUpdateOnLayoutShift: { type: Boolean },
|
|
55
|
+
prioritizePosition: { type: Boolean },
|
|
56
|
+
reference: {},
|
|
57
|
+
dir: {},
|
|
58
|
+
asChild: { type: Boolean },
|
|
59
|
+
as: {},
|
|
60
|
+
disableOutsidePointerEvents: { type: Boolean },
|
|
61
|
+
class: {}
|
|
62
|
+
},
|
|
63
|
+
emits: [
|
|
64
|
+
"closeAutoFocus",
|
|
65
|
+
"escapeKeyDown",
|
|
66
|
+
"pointerDownOutside"
|
|
67
|
+
],
|
|
68
|
+
setup(__props, { emit: __emit }) {
|
|
69
|
+
const props = __props;
|
|
70
|
+
const delegatedProps = useForwardPropsEmits(props, __emit);
|
|
71
|
+
return (_ctx, _cache) => {
|
|
72
|
+
return openBlock(), createBlock(unref(SelectPortal), null, {
|
|
73
|
+
default: withCtx(() => [createVNode(unref(SelectContent), mergeProps({ "data-slot": "select-content" }, {
|
|
74
|
+
...unref(delegatedProps),
|
|
75
|
+
..._ctx.$attrs
|
|
76
|
+
}, { class: unref(cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-[1100] max-h-(--reka-select-content-available-height) min-w-[8rem] origin-(--reka-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md", _ctx.position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", props.class) }), {
|
|
77
|
+
default: withCtx(() => [
|
|
78
|
+
createVNode(unref(SelectScrollUpButton), { class: "flex cursor-default items-center justify-center py-1" }, {
|
|
79
|
+
default: withCtx(() => [createVNode(unref(ChevronUpIcon), { class: "size-4" })]),
|
|
80
|
+
_: 1
|
|
81
|
+
}),
|
|
82
|
+
createVNode(unref(SelectViewport), { class: normalizeClass(unref(cn)("p-1", _ctx.position === "popper" && "h-[var(--reka-select-trigger-height)] w-full min-w-[var(--reka-select-trigger-width)] scroll-my-1")) }, {
|
|
83
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
84
|
+
_: 3
|
|
85
|
+
}, 8, ["class"]),
|
|
86
|
+
createVNode(unref(SelectScrollDownButton), { class: "flex cursor-default items-center justify-center py-1" }, {
|
|
87
|
+
default: withCtx(() => [createVNode(unref(ChevronDownIcon), { class: "size-4" })]),
|
|
88
|
+
_: 1
|
|
89
|
+
})
|
|
90
|
+
]),
|
|
91
|
+
_: 3
|
|
92
|
+
}, 16, ["class"])]),
|
|
93
|
+
_: 3
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
var _hoisted_1 = { class: "absolute right-2 flex size-3.5 items-center justify-center" };
|
|
99
|
+
var SelectItem_default = /* @__PURE__ */ defineComponent({
|
|
100
|
+
__name: "SelectItem",
|
|
101
|
+
props: {
|
|
102
|
+
value: {},
|
|
103
|
+
disabled: { type: Boolean },
|
|
104
|
+
textValue: {},
|
|
105
|
+
asChild: { type: Boolean },
|
|
106
|
+
as: {},
|
|
107
|
+
class: {}
|
|
108
|
+
},
|
|
109
|
+
setup(__props) {
|
|
110
|
+
const props = __props;
|
|
111
|
+
const delegatedProps = useForwardProps(props);
|
|
112
|
+
return (_ctx, _cache) => {
|
|
113
|
+
return openBlock(), createBlock(unref(SelectItem), mergeProps({ "data-slot": "select-item" }, unref(delegatedProps), { class: unref(cn)("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*=text-])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4 cursor-pointer", props.class) }), {
|
|
114
|
+
default: withCtx(() => [createElementVNode("span", _hoisted_1, [createVNode(unref(SelectItemIndicator), null, {
|
|
115
|
+
default: withCtx(() => [createVNode(unref(CheckIcon), { class: "size-4" })]),
|
|
116
|
+
_: 1
|
|
117
|
+
})]), createVNode(unref(SelectItemText), null, {
|
|
118
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
119
|
+
_: 3
|
|
120
|
+
})]),
|
|
121
|
+
_: 3
|
|
122
|
+
}, 16, ["class"]);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
var SelectTrigger_default = /* @__PURE__ */ defineComponent({
|
|
127
|
+
__name: "SelectTrigger",
|
|
128
|
+
props: { class: {} },
|
|
129
|
+
setup(__props) {
|
|
130
|
+
const props = __props;
|
|
131
|
+
return (_ctx, _cache) => {
|
|
132
|
+
return openBlock(), createBlock(unref(SelectTrigger), {
|
|
133
|
+
"data-slot": "select-trigger",
|
|
134
|
+
class: normalizeClass(unref(cn)("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*=text-])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4 cursor-pointer", props.class))
|
|
135
|
+
}, {
|
|
136
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default"), createVNode(unref(SelectIcon), { "as-child": "" }, {
|
|
137
|
+
default: withCtx(() => [createVNode(unref(ChevronDownIcon), { class: "size-4 opacity-50" })]),
|
|
138
|
+
_: 1
|
|
139
|
+
})]),
|
|
140
|
+
_: 3
|
|
141
|
+
}, 8, ["class"]);
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
var SelectValue_default = /* @__PURE__ */ defineComponent({
|
|
146
|
+
__name: "SelectValue",
|
|
147
|
+
props: { class: {} },
|
|
148
|
+
setup(__props) {
|
|
149
|
+
const props = __props;
|
|
150
|
+
return (_ctx, _cache) => {
|
|
151
|
+
return openBlock(), createBlock(unref(SelectValue), {
|
|
152
|
+
"data-slot": "select-value",
|
|
153
|
+
class: normalizeClass(unref(cn)(props.class))
|
|
154
|
+
}, {
|
|
155
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
156
|
+
_: 3
|
|
157
|
+
}, 8, ["class"]);
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
export { Select_default as a, SelectContent_default as i, SelectTrigger_default as n, SelectItem_default as r, SelectValue_default as t };
|
|
162
|
+
|
|
163
|
+
//# sourceMappingURL=SelectValue-CWl9zUW3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectValue-CWl9zUW3.js","names":["$attrs","position"],"sources":["../src/components/ui/select/Select.vue","../src/components/ui/select/Select.vue","../src/components/ui/select/SelectContent.vue","../src/components/ui/select/SelectContent.vue","../src/components/ui/select/SelectItem.vue","../src/components/ui/select/SelectItem.vue","../src/components/ui/select/SelectTrigger.vue","../src/components/ui/select/SelectTrigger.vue","../src/components/ui/select/SelectValue.vue","../src/components/ui/select/SelectValue.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { SelectRoot, type SelectRootProps } from \"reka-ui\";\n\nconst props = defineProps<SelectRootProps>();\n</script>\n\n<template>\n <SelectRoot data-slot=\"select\" v-bind=\"props\">\n <slot />\n </SelectRoot>\n</template>\n","<script lang=\"ts\" setup>\nimport { SelectRoot, type SelectRootProps } from \"reka-ui\";\n\nconst props = defineProps<SelectRootProps>();\n</script>\n\n<template>\n <SelectRoot data-slot=\"select\" v-bind=\"props\">\n <slot />\n </SelectRoot>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { SelectContent, type SelectContentEmits, type SelectContentProps, SelectPortal, SelectViewport, SelectScrollUpButton, SelectScrollDownButton, useForwardPropsEmits } from \"reka-ui\";\nimport { ChevronDownIcon, ChevronUpIcon } from \"lucide-vue-next\";\nimport { cn } from \"../../../lib/utils\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(defineProps<SelectContentProps & { class?: HTMLAttributes[\"class\"] }>(), {\n position: \"popper\",\n});\nconst emits = defineEmits<SelectContentEmits>();\n\nconst delegatedProps = useForwardPropsEmits(props, emits);\n</script>\n\n<template>\n <SelectPortal>\n <SelectContent\n data-slot=\"select-content\"\n v-bind=\"{ ...delegatedProps, ...$attrs }\"\n :class=\"\n cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-[1100] max-h-(--reka-select-content-available-height) min-w-[8rem] origin-(--reka-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md',\n position === 'popper' &&\n 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',\n props.class,\n )\n \"\n >\n <SelectScrollUpButton class=\"flex cursor-default items-center justify-center py-1\">\n <ChevronUpIcon class=\"size-4\" />\n </SelectScrollUpButton>\n <SelectViewport\n :class=\"\n cn(\n 'p-1',\n position === 'popper' &&\n 'h-[var(--reka-select-trigger-height)] w-full min-w-[var(--reka-select-trigger-width)] scroll-my-1',\n )\n \"\n >\n <slot />\n </SelectViewport>\n <SelectScrollDownButton class=\"flex cursor-default items-center justify-center py-1\">\n <ChevronDownIcon class=\"size-4\" />\n </SelectScrollDownButton>\n </SelectContent>\n </SelectPortal>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { SelectContent, type SelectContentEmits, type SelectContentProps, SelectPortal, SelectViewport, SelectScrollUpButton, SelectScrollDownButton, useForwardPropsEmits } from \"reka-ui\";\nimport { ChevronDownIcon, ChevronUpIcon } from \"lucide-vue-next\";\nimport { cn } from \"../../../lib/utils\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(defineProps<SelectContentProps & { class?: HTMLAttributes[\"class\"] }>(), {\n position: \"popper\",\n});\nconst emits = defineEmits<SelectContentEmits>();\n\nconst delegatedProps = useForwardPropsEmits(props, emits);\n</script>\n\n<template>\n <SelectPortal>\n <SelectContent\n data-slot=\"select-content\"\n v-bind=\"{ ...delegatedProps, ...$attrs }\"\n :class=\"\n cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-[1100] max-h-(--reka-select-content-available-height) min-w-[8rem] origin-(--reka-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md',\n position === 'popper' &&\n 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',\n props.class,\n )\n \"\n >\n <SelectScrollUpButton class=\"flex cursor-default items-center justify-center py-1\">\n <ChevronUpIcon class=\"size-4\" />\n </SelectScrollUpButton>\n <SelectViewport\n :class=\"\n cn(\n 'p-1',\n position === 'popper' &&\n 'h-[var(--reka-select-trigger-height)] w-full min-w-[var(--reka-select-trigger-width)] scroll-my-1',\n )\n \"\n >\n <slot />\n </SelectViewport>\n <SelectScrollDownButton class=\"flex cursor-default items-center justify-center py-1\">\n <ChevronDownIcon class=\"size-4\" />\n </SelectScrollDownButton>\n </SelectContent>\n </SelectPortal>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { SelectItem, SelectItemIndicator, type SelectItemProps, SelectItemText, useForwardProps } from \"reka-ui\";\nimport { CheckIcon } from \"lucide-vue-next\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<SelectItemProps & { class?: HTMLAttributes[\"class\"] }>();\n\nconst delegatedProps = useForwardProps(props);\n</script>\n\n<template>\n <SelectItem\n data-slot=\"select-item\"\n v-bind=\"delegatedProps\"\n :class=\"\n cn(\n 'focus:bg-accent focus:text-accent-foreground [&_svg:not([class*=text-])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4 cursor-pointer',\n props.class,\n )\n \"\n >\n <span class=\"absolute right-2 flex size-3.5 items-center justify-center\">\n <SelectItemIndicator>\n <CheckIcon class=\"size-4\" />\n </SelectItemIndicator>\n </span>\n\n <SelectItemText>\n <slot />\n </SelectItemText>\n </SelectItem>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { SelectItem, SelectItemIndicator, type SelectItemProps, SelectItemText, useForwardProps } from \"reka-ui\";\nimport { CheckIcon } from \"lucide-vue-next\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<SelectItemProps & { class?: HTMLAttributes[\"class\"] }>();\n\nconst delegatedProps = useForwardProps(props);\n</script>\n\n<template>\n <SelectItem\n data-slot=\"select-item\"\n v-bind=\"delegatedProps\"\n :class=\"\n cn(\n 'focus:bg-accent focus:text-accent-foreground [&_svg:not([class*=text-])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4 cursor-pointer',\n props.class,\n )\n \"\n >\n <span class=\"absolute right-2 flex size-3.5 items-center justify-center\">\n <SelectItemIndicator>\n <CheckIcon class=\"size-4\" />\n </SelectItemIndicator>\n </span>\n\n <SelectItemText>\n <slot />\n </SelectItemText>\n </SelectItem>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { SelectTrigger, SelectIcon } from \"reka-ui\";\nimport { ChevronDownIcon } from \"lucide-vue-next\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <SelectTrigger\n data-slot=\"select-trigger\"\n :class=\"\n cn(\n 'border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*=text-])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4 cursor-pointer',\n props.class,\n )\n \"\n >\n <slot />\n <SelectIcon as-child>\n <ChevronDownIcon class=\"size-4 opacity-50\" />\n </SelectIcon>\n </SelectTrigger>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { SelectTrigger, SelectIcon } from \"reka-ui\";\nimport { ChevronDownIcon } from \"lucide-vue-next\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <SelectTrigger\n data-slot=\"select-trigger\"\n :class=\"\n cn(\n 'border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*=text-])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4 cursor-pointer',\n props.class,\n )\n \"\n >\n <slot />\n <SelectIcon as-child>\n <ChevronDownIcon class=\"size-4 opacity-50\" />\n </SelectIcon>\n </SelectTrigger>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { SelectValue } from \"reka-ui\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <SelectValue data-slot=\"select-value\" :class=\"cn(props.class)\">\n <slot />\n </SelectValue>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { SelectValue } from \"reka-ui\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <SelectValue data-slot=\"select-value\" :class=\"cn(props.class)\">\n <slot />\n </SelectValue>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;ECGA,MAAM,QAAQ;;uBAIZ,YAEa,MAAA,WAAA,EAFb,WAEa,EAFD,aAAU,UAAQ,EAAS,MAAK,EAAA;2BAClC,CAAR,WAAQ,KAAA,QAAA,UAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EEAZ,MAAM,QAAQ;EAKd,MAAM,iBAAiB,qBAAqB,OAF9B,OAE2C;;uBAIvD,YA+Be,MAAA,aAAA,EAAA,MAAA;2BADG,CA7BhB,YA6BgB,MAAA,cAAA,EA7BhB,WA6BgB,EA5Bd,aAAU,kBAAgB,EAAA;KAAA,GACb,MAAA,eAAc;KAAA,GAAKA,KAAAA;KAAM,EAAA,EACrC,OAAgB,MAAA,GAAE,CAAA,mjBAAykBC,KAAAA,aAAQ,YAAA,mIAA0K,MAAM,MAAA,EAAA,CAAA,EAAA;4BAW7vB;MAFvB,YAEuB,MAAA,qBAAA,EAAA,EAFD,OAAM,wDAAsD,EAAA;8BAChD,CAAhC,YAAgC,MAAA,cAAA,EAAA,EAAjB,OAAM,UAAQ,CAAA,CAAA,CAAA;;;MAE/B,Y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