@gspa/ui 0.1.3 → 0.1.4
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 +18 -0
- package/dist/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/components/Accordion.cjs +1 -0
- package/dist/components/Accordion.js +192 -0
- package/dist/components/AccordionItem.cjs +1 -0
- package/dist/components/AccordionItem.js +109 -0
- package/dist/components/AddReminderModal.cjs +1 -0
- package/dist/components/AddReminderModal.js +107 -0
- package/dist/components/Alert.cjs +1 -0
- package/dist/components/Alert.js +222 -0
- package/dist/components/Avatar.cjs +1 -0
- package/dist/components/Avatar.js +86 -0
- package/dist/components/Badge.cjs +1 -0
- package/dist/components/Badge.js +109 -0
- package/dist/components/Breadcrumb.cjs +1 -0
- package/dist/components/Breadcrumb.js +72 -0
- package/dist/components/Button.cjs +1 -0
- package/dist/components/Button.js +190 -0
- package/dist/components/ButtonGroup.cjs +1 -0
- package/dist/components/ButtonGroup.js +46 -0
- package/dist/components/Calendar.cjs +1 -0
- package/dist/components/Calendar.js +341 -0
- package/dist/components/Card.cjs +1 -0
- package/dist/components/Card.js +316 -0
- package/dist/components/CardBody.cjs +1 -0
- package/dist/components/CardBody.js +34 -0
- package/dist/components/CardContent.cjs +1 -0
- package/dist/components/CardContent.js +17 -0
- package/dist/components/CardFooter.cjs +1 -0
- package/dist/components/CardFooter.js +34 -0
- package/dist/components/CardHeader.cjs +1 -0
- package/dist/components/CardHeader.js +91 -0
- package/dist/components/CardTitle.cjs +1 -0
- package/dist/components/CardTitle.js +17 -0
- package/dist/components/Checkbox.cjs +1 -0
- package/dist/components/Checkbox.js +185 -0
- package/dist/components/CircularProgress.cjs +1 -0
- package/dist/components/CircularProgress.js +141 -0
- package/dist/components/DataTable.cjs +1 -0
- package/dist/components/DataTable.js +863 -0
- package/dist/components/DataTableCell.cjs +1 -0
- package/dist/components/DataTableCell.js +95 -0
- package/dist/components/DataTableFilters.cjs +1 -0
- package/dist/components/DataTableFilters.js +519 -0
- package/dist/components/DataTableHeader.cjs +1 -0
- package/dist/components/DataTableHeader.js +116 -0
- package/dist/components/DataTablePagination.cjs +1 -0
- package/dist/components/DataTablePagination.js +290 -0
- package/dist/components/DataTableRow.cjs +1 -0
- package/dist/components/DataTableRow.js +199 -0
- package/dist/components/DataTableToolBar.cjs +1 -0
- package/dist/components/DataTableToolBar.js +477 -0
- package/dist/components/DatePicker.cjs +1 -0
- package/dist/components/DatePicker.js +401 -0
- package/dist/components/Divider.cjs +1 -0
- package/dist/components/Divider.js +103 -0
- package/dist/components/Dropdown.cjs +1 -0
- package/dist/components/Dropdown.js +104 -0
- package/dist/components/DropdownItem.cjs +1 -0
- package/dist/components/DropdownItem.js +60 -0
- package/dist/components/EventsCalendar.cjs +1 -0
- package/dist/components/EventsCalendar.js +863 -0
- package/dist/components/FileUpload.cjs +1 -0
- package/dist/components/FileUpload.js +195 -0
- package/dist/components/FilterDrawer.cjs +1 -0
- package/dist/components/FilterDrawer.js +412 -0
- package/dist/components/Footer.cjs +1 -0
- package/dist/components/Footer.js +157 -0
- package/dist/components/FormField.cjs +1 -0
- package/dist/components/FormField.js +190 -0
- package/dist/components/Graph.cjs +1 -0
- package/dist/components/Graph.js +164 -0
- package/dist/components/GraphFilters.cjs +1 -0
- package/dist/components/GraphFilters.js +305 -0
- package/dist/components/Header.cjs +1 -0
- package/dist/components/Header.js +674 -0
- package/dist/components/Icon.cjs +1 -0
- package/dist/components/Icon.js +51 -0
- package/dist/components/Image.cjs +1 -0
- package/dist/components/Image.js +112 -0
- package/dist/components/Input.cjs +1 -0
- package/dist/components/Input.js +166 -0
- package/dist/components/InputGroup.cjs +1 -0
- package/dist/components/InputGroup.js +45 -0
- package/dist/components/Label.cjs +1 -0
- package/dist/components/Label.js +46 -0
- package/dist/components/Link.cjs +1 -0
- package/dist/components/Link.js +119 -0
- package/dist/components/ListItem.cjs +1 -0
- package/dist/components/ListItem.js +89 -0
- package/dist/components/Loader.cjs +1 -0
- package/dist/components/Loader.js +154 -0
- package/dist/components/Logo.cjs +1 -0
- package/dist/components/Logo.js +67 -0
- package/dist/components/MenuItem.cjs +1 -0
- package/dist/components/MenuItem.js +66 -0
- package/dist/components/Modal.cjs +1 -0
- package/dist/components/Modal.js +110 -0
- package/dist/components/ModalBody.cjs +1 -0
- package/dist/components/ModalBody.js +33 -0
- package/dist/components/ModalFooter.cjs +1 -0
- package/dist/components/ModalFooter.js +33 -0
- package/dist/components/ModalHeader.cjs +1 -0
- package/dist/components/ModalHeader.js +24 -0
- package/dist/components/MultiSelect.cjs +1 -0
- package/dist/components/MultiSelect.js +211 -0
- package/dist/components/Notification.cjs +1 -0
- package/dist/components/Notification.js +121 -0
- package/dist/components/Option.cjs +1 -0
- package/dist/components/Option.js +44 -0
- package/dist/components/Progress.cjs +1 -0
- package/dist/components/Progress.js +77 -0
- package/dist/components/ProgressBar.cjs +1 -0
- package/dist/components/ProgressBar.js +101 -0
- package/dist/components/Radio.cjs +1 -0
- package/dist/components/Radio.js +81 -0
- package/dist/components/RailNav.cjs +1 -0
- package/dist/components/RailNav.js +124 -0
- package/dist/components/ReminderConfig.cjs +1 -0
- package/dist/components/ReminderConfig.js +375 -0
- package/dist/components/ReusableForm.cjs +1 -0
- package/dist/components/ReusableForm.js +657 -0
- package/dist/components/ReusableFormModal.cjs +1 -0
- package/dist/components/ReusableFormModal.js +112 -0
- package/dist/components/RightDrawer.cjs +1 -0
- package/dist/components/RightDrawer.js +143 -0
- package/dist/components/Search.cjs +1 -0
- package/dist/components/Search.js +252 -0
- package/dist/components/Select.cjs +1 -0
- package/dist/components/Select.js +243 -0
- package/dist/components/Sidebar.cjs +1 -0
- package/dist/components/Sidebar.js +372 -0
- package/dist/components/Slider.cjs +1 -0
- package/dist/components/Slider.js +42 -0
- package/dist/components/Spinner.cjs +1 -0
- package/dist/components/Spinner.js +87 -0
- package/dist/components/Stepper.cjs +1 -0
- package/dist/components/Stepper.js +12 -0
- package/dist/components/StepperItem.cjs +1 -0
- package/dist/components/StepperItem.js +33 -0
- package/dist/components/Switch.cjs +1 -0
- package/dist/components/Switch.js +112 -0
- package/dist/components/Tab.cjs +1 -0
- package/dist/components/Tab.js +134 -0
- package/dist/components/TabPanel.cjs +1 -0
- package/dist/components/TabPanel.js +49 -0
- package/dist/components/Text.cjs +1 -0
- package/dist/components/Text.js +84 -0
- package/dist/components/Textarea.cjs +1 -0
- package/dist/components/Textarea.js +102 -0
- package/dist/components/ThemeConfigurator.cjs +1 -0
- package/dist/components/ThemeConfigurator.js +50 -0
- package/dist/components/Timeline.cjs +1 -0
- package/dist/components/Timeline.js +24 -0
- package/dist/components/TimelineItem.cjs +1 -0
- package/dist/components/TimelineItem.js +63 -0
- package/dist/components/Toast.cjs +1 -0
- package/dist/components/Toast.js +231 -0
- package/dist/components/Tooltip.cjs +1 -0
- package/dist/components/Tooltip.js +124 -0
- package/dist/components/Typography.cjs +1 -0
- package/dist/components/Typography.js +267 -0
- package/dist/components/charts/BarChart.cjs +1 -0
- package/dist/components/charts/BarChart.js +323 -0
- package/dist/components/charts/LineChart.cjs +1 -0
- package/dist/components/charts/LineChart.js +322 -0
- package/dist/components/charts/PieChart.cjs +1 -0
- package/dist/components/charts/PieChart.js +311 -0
- package/dist/components/charts/StackedBarChart.cjs +1 -0
- package/dist/components/charts/StackedBarChart.js +348 -0
- package/dist/components/widgets/DashboardWidget.cjs +1 -0
- package/dist/components/widgets/DashboardWidget.js +309 -0
- package/dist/directives/tooltip.cjs +47 -0
- package/dist/directives/tooltip.js +115 -0
- package/dist/index.cjs +1 -0
- package/dist/index.esm.js +311 -19548
- package/dist/layouts/AuthLayout.cjs +1 -0
- package/dist/layouts/AuthLayout.js +190 -0
- package/dist/layouts/DashboardLayout.cjs +1 -0
- package/dist/layouts/DashboardLayout.js +244 -0
- package/dist/layouts/DefaultLayout.cjs +1 -0
- package/dist/layouts/DefaultLayout.js +94 -0
- package/dist/layouts/ErrorLayout.cjs +1 -0
- package/dist/layouts/ErrorLayout.js +452 -0
- package/dist/lib/auth.cjs +1 -0
- package/dist/lib/auth.js +4 -0
- package/dist/lib/theme.cjs +1 -0
- package/dist/lib/theme.js +135 -0
- package/dist/lib/toast.cjs +1 -0
- package/dist/lib/toast.js +81 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/cn.cjs +1 -0
- package/dist/utils/cn.js +7 -0
- package/package.json +37 -7
- package/dist/index.js +0 -605
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),u=require("class-variance-authority"),d=require("../utils/cn.cjs"),m={__name:"DataTableCell",props:{item:{type:Object,required:!0},column:{type:Object,required:!0},value:{type:[String,Number,Boolean,Object,Array],default:null},align:{type:String,default:"left",validator:a=>["left","center","right"].includes(a)},width:{type:String,default:null},padding:{type:String,default:"normal",validator:a=>["compact","normal","comfortable"].includes(a)},textSize:{type:String,default:"md",validator:a=>["xs","sm","md","base","lg"].includes(a)},textColor:{type:String,default:null}},setup(a){const t=a,n=l.computed(()=>{const e=t.value??o();return t.column.formatter?t.column.formatter(e,t.item):e}),o=()=>t.column.accessor?t.column.accessor(t.item):t.column.key.split(".").reduce((e,r)=>e?.[r],t.item),i=u.cva("whitespace-nowrap ui-text",{variants:{align:{left:"text-left",center:"text-center",right:"text-right"},padding:{compact:"px-4 py-2",normal:"px-6 py-4",comfortable:"px-8 py-6"},textSize:{xs:"text-xs",sm:"text-sm",base:"text-base",lg:"text-lg"}},defaultVariants:{align:"left",padding:"normal",textSize:"md"}}),c=l.computed(()=>{const e=t.align||t.column.align||"left",r=t.textColor?`text-${t.textColor}`:"ui-text",s=t.width?`w-${t.width}`:"";return d.cn(i({align:e,padding:t.padding,textSize:t.textSize}),r,s,t.column.cellClasses)});return(e,r)=>(l.openBlock(),l.createElementBlock("td",{class:l.normalizeClass(c.value)},[l.renderSlot(e.$slots,"default",{},()=>[l.createTextVNode(l.toDisplayString(n.value),1)])],2))}};exports.default=m;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { computed as r, createElementBlock as u, openBlock as m, normalizeClass as d, renderSlot as p, createTextVNode as x, toDisplayString as f } from "vue";
|
|
2
|
+
import { cva as g } from "class-variance-authority";
|
|
3
|
+
import { cn as y } from "../utils/cn.js";
|
|
4
|
+
const v = {
|
|
5
|
+
__name: "DataTableCell",
|
|
6
|
+
props: {
|
|
7
|
+
item: {
|
|
8
|
+
type: Object,
|
|
9
|
+
required: !0
|
|
10
|
+
},
|
|
11
|
+
column: {
|
|
12
|
+
type: Object,
|
|
13
|
+
required: !0
|
|
14
|
+
},
|
|
15
|
+
value: {
|
|
16
|
+
type: [String, Number, Boolean, Object, Array],
|
|
17
|
+
default: null
|
|
18
|
+
},
|
|
19
|
+
align: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "left",
|
|
22
|
+
validator: (l) => ["left", "center", "right"].includes(l)
|
|
23
|
+
},
|
|
24
|
+
width: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: null
|
|
27
|
+
},
|
|
28
|
+
padding: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "normal",
|
|
31
|
+
validator: (l) => ["compact", "normal", "comfortable"].includes(l)
|
|
32
|
+
},
|
|
33
|
+
textSize: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "md",
|
|
36
|
+
validator: (l) => ["xs", "sm", "md", "base", "lg"].includes(l)
|
|
37
|
+
},
|
|
38
|
+
textColor: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: null
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
setup(l) {
|
|
44
|
+
const t = l, n = r(() => {
|
|
45
|
+
const e = t.value ?? o();
|
|
46
|
+
return t.column.formatter ? t.column.formatter(e, t.item) : e;
|
|
47
|
+
}), o = () => t.column.accessor ? t.column.accessor(t.item) : t.column.key.split(".").reduce((e, a) => e?.[a], t.item), i = g("whitespace-nowrap ui-text", {
|
|
48
|
+
variants: {
|
|
49
|
+
align: {
|
|
50
|
+
left: "text-left",
|
|
51
|
+
center: "text-center",
|
|
52
|
+
right: "text-right"
|
|
53
|
+
},
|
|
54
|
+
padding: {
|
|
55
|
+
compact: "px-4 py-2",
|
|
56
|
+
normal: "px-6 py-4",
|
|
57
|
+
comfortable: "px-8 py-6"
|
|
58
|
+
},
|
|
59
|
+
textSize: {
|
|
60
|
+
xs: "text-xs",
|
|
61
|
+
sm: "text-sm",
|
|
62
|
+
base: "text-base",
|
|
63
|
+
lg: "text-lg"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
defaultVariants: {
|
|
67
|
+
align: "left",
|
|
68
|
+
padding: "normal",
|
|
69
|
+
textSize: "md"
|
|
70
|
+
}
|
|
71
|
+
}), c = r(() => {
|
|
72
|
+
const e = t.align || t.column.align || "left", a = t.textColor ? `text-${t.textColor}` : "ui-text", s = t.width ? `w-${t.width}` : "";
|
|
73
|
+
return y(
|
|
74
|
+
i({
|
|
75
|
+
align: e,
|
|
76
|
+
padding: t.padding,
|
|
77
|
+
textSize: t.textSize
|
|
78
|
+
}),
|
|
79
|
+
a,
|
|
80
|
+
s,
|
|
81
|
+
t.column.cellClasses
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
return (e, a) => (m(), u("td", {
|
|
85
|
+
class: d(c.value)
|
|
86
|
+
}, [
|
|
87
|
+
p(e.$slots, "default", {}, () => [
|
|
88
|
+
x(f(n.value), 1)
|
|
89
|
+
])
|
|
90
|
+
], 2));
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
export {
|
|
94
|
+
v as default
|
|
95
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),v=require("./Button.cjs"),H=require("./Select.cjs"),g=require("class-variance-authority"),d=require("../utils/cn.cjs"),c=require("./Icon.cjs"),J={class:"bg-white border-b border-gray-200"},X={key:0,class:"flex-1 min-w-80 max-w-md"},Y={class:"relative group"},Z=["model-value","placeholder"],_={key:1,class:"min-w-36"},K={class:"relative"},ee=["value"],te={key:3,class:"flex items-center gap-2"},ae={class:"flex items-center gap-3 ml-auto"},le={class:"grid grid-cols-1 lg:grid-cols-3 gap-6"},se={class:"flex items-center justify-between"},oe={class:"flex items-center gap-3"},re={class:"relative flex-1"},ne=["model-value","placeholder","onInput"],ce={class:"relative flex-1"},de=["model-value","placeholder","onInput"],ie=["onClick"],ue={class:"flex items-center gap-3 flex-wrap"},me=["onClick"],pe={key:2,class:"px-6 py-3 bg-gray-50 border-t border-gray-200"},fe={class:"flex items-center justify-between"},ye={class:"flex items-center gap-4"},ve={class:"text-sm text-gray-600"},ge={class:"font-medium"},he={__name:"DataTableFilters",props:{searchQuery:{type:String,default:""},searchPlaceholder:{type:String,default:"Search..."},selectedStatus:{type:String,default:""},statusOptions:{type:Array,default:()=>[]},showDateFilter:{type:Boolean,default:!1},dateFrom:{type:String,default:""},dateTo:{type:String,default:""},dateFilters:{type:Array,default:()=>[],validator:o=>o.every(i=>Object.prototype.hasOwnProperty.call(i,"key")&&Object.prototype.hasOwnProperty.call(i,"label")&&Object.prototype.hasOwnProperty.call(i,"from")&&Object.prototype.hasOwnProperty.call(i,"to"))},showExport:{type:Boolean,default:!1},showAdd:{type:Boolean,default:!1},showTableInfo:{type:Boolean,default:!0},showSearch:{type:Boolean,default:!0},showFilters:{type:Boolean,default:!0},totalItems:{type:Number,default:0},itemLabel:{type:String,default:"items"},variant:{type:String,default:"default",validator:o=>["default","minimal","bordered"].includes(o)},padding:{type:String,default:"normal",validator:o=>["compact","normal","comfortable"].includes(o)}},emits:["update:searchQuery","update:selectedStatus","update:dateFrom","update:dateTo","update:dateFilters","export","add","clear-filters"],setup(o,{emit:i}){const s=o,n=i,m=e.ref(!1),V=g.cva("flex flex-wrap items-center gap-4",{variants:{variant:{default:"bg-white",minimal:"bg-transparent",bordered:"bg-gray-50"},padding:{compact:"px-4 py-3",normal:"px-6 py-4",comfortable:"px-8 py-6"}},defaultVariants:{variant:"default",padding:"normal"}}),p=g.cva("border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all text-sm",{variants:{size:{sm:"px-2 py-1.5",md:"px-3 py-2.5",lg:"px-4 py-3"}},defaultVariants:{size:"md"}}),f=g.cva("rounded-lg flex items-center font-medium transition-all",{variants:{variant:{default:"text-gray-700 hover:text-gray-900 border border-gray-200 hover:bg-gray-50 hover:border-gray-300 bg-white",primary:"text-white bg-blue-600 hover:bg-blue-700 border border-blue-600 shadow-sm",success:"text-white bg-green-600 hover:bg-green-700 border border-green-600 shadow-sm",ghost:"text-gray-600 hover:text-gray-800 hover:bg-gray-100"},size:{sm:"px-2 py-1.5 text-xs",md:"px-3 py-2 text-sm",lg:"px-4 py-2.5 text-sm"}},defaultVariants:{variant:"default",size:"md"}}),y=l=>!!(l.from||l.to),w=l=>{const t=[...s.dateFilters],a=t.findIndex(r=>r.key===l);a>=0&&(t[a]={...t[a],from:"",to:""},n("update:dateFilters",t))},N=l=>`text-xs px-2 py-1 rounded ${y(l)?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-600"}`,B=()=>{m.value=!m.value},h=(l,t,a)=>{const r=[...s.dateFilters],u=r.findIndex(G=>G.key===l);u>=0&&(r[u]={...r[u],[t]:a},n("update:dateFilters",r))},b=e.computed(()=>{const l=s.searchQuery,t=s.selectedStatus,a=s.dateFrom||s.dateTo,r=s.dateFilters.some(u=>u.from||u.to);return l||t||a||r}),k=e.computed(()=>{let l=0;return s.searchQuery&&l++,s.selectedStatus&&l++,(s.dateFrom||s.dateTo)&&l++,l+=s.dateFilters.filter(t=>t.from||t.to).length,l}),x=e.computed(()=>{const l=[];if(s.searchQuery&&s.searchQuery.trim()&&l.push({key:"search",label:"Search",value:`"${s.searchQuery}"`,icon:"magnifying-glass"}),s.selectedStatus){const t=s.statusOptions.find(a=>a.value===s.selectedStatus);l.push({key:"status",label:"Status",value:t?.label||s.selectedStatus,icon:"filter"})}if(s.dateFrom||s.dateTo){let t="";s.dateFrom&&s.dateTo?t=`${s.dateFrom} to ${s.dateTo}`:s.dateFrom?t=`From ${s.dateFrom}`:s.dateTo&&(t=`Until ${s.dateTo}`),t&&l.push({key:"date",label:"Date Range",value:t,icon:"calendar"})}return s.dateFilters.forEach(t=>{if(t.from||t.to){let a="";t.from&&t.to?a=`${t.from} to ${t.to}`:t.from?a=`From ${t.from}`:t.to&&(a=`Until ${t.to}`),a&&l.push({key:`date-${t.key}`,label:t.label,value:a,icon:"calendar"})}}),l}),E=e.computed(()=>d.cn(V({variant:s.variant,padding:s.padding}))),S=e.computed(()=>"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400 group-hover:text-gray-600 transition-colors"),F=e.computed(()=>d.cn(p({size:"md"}),"w-full pl-10 pr-10 hover:border-gray-300")),z=e.computed(()=>"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600 p-1 hover:bg-gray-100 rounded-full transition-all"),$=e.computed(()=>d.cn(p({size:"md"}),"w-full pr-8 appearance-none hover:border-gray-300")),T=e.computed(()=>{const l=m.value||b.value;return d.cn(f({variant:l?"primary":"default",size:"lg"}),"gap-2")}),D=e.computed(()=>"bg-white text-blue-600 text-xs px-1.5 py-0.5 rounded-full min-w-[20px] text-center font-semibold"),I=e.computed(()=>"px-6 py-4 border-t border-gray-100 bg-gray-50"),C=e.computed(()=>d.cn(p({size:"md"}),"pl-10 pr-3")),A=e.computed(()=>"text-sm font-semibold text-gray-700"),O=e.computed(()=>"text-gray-500 text-sm font-medium"),Q=e.computed(()=>"text-gray-400 hover:text-gray-600 p-1.5 hover:bg-gray-200 rounded-full transition-all"),L=e.computed(()=>d.cn(f({variant:"ghost",size:"md"}))),j=e.computed(()=>d.cn(f({variant:"default",size:"lg"}))),P=e.computed(()=>"px-6 py-3 bg-blue-50 border-t border-blue-100"),q=e.computed(()=>"text-sm font-semibold text-blue-800"),R=e.computed(()=>"flex items-center gap-1.5 bg-white border border-blue-200 text-blue-800 px-3 py-1.5 rounded-full text-sm font-medium"),M=e.computed(()=>"text-blue-600 hover:text-blue-800 ml-1 hover:bg-blue-100 rounded-full p-0.5 transition-all"),U=()=>{n("update:searchQuery",""),n("update:selectedStatus",""),n("update:dateFrom",""),n("update:dateTo","");const l=s.dateFilters.map(t=>({...t,from:"",to:""}));n("update:dateFilters",l),n("clear-filters")},W=l=>{switch(l){case"search":n("update:searchQuery","");break;case"status":n("update:selectedStatus","");break;case"date":n("update:dateFrom",""),n("update:dateTo","");break;default:if(l.startsWith("date-")){const t=l.replace("date-",""),a=s.dateFilters.map(r=>r.key===t?{...r,from:"",to:""}:r);n("update:dateFilters",a)}break}};return(l,t)=>(e.openBlock(),e.createElementBlock("div",J,[e.createElementVNode("div",{class:e.normalizeClass(E.value)},[o.showSearch?(e.openBlock(),e.createElementBlock("div",X,[e.createElementVNode("div",Y,[e.createVNode(c.default,{icon:"magnifying-glass",class:e.normalizeClass(S.value)},null,8,["class"]),e.createElementVNode("input",{"model-value":o.searchQuery,placeholder:o.searchPlaceholder,class:e.normalizeClass(F.value),onInput:t[0]||(t[0]=a=>l.$emit("update:searchQuery",a.target.value))},null,42,Z),o.searchQuery?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(z.value),onClick:t[1]||(t[1]=a=>l.$emit("update:searchQuery",""))},[e.createVNode(c.default,{icon:"xmark",class:"w-3 h-3"})],2)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),o.showFilters&&o.statusOptions.length>0?(e.openBlock(),e.createElementBlock("div",_,[e.createElementVNode("div",K,[e.createVNode(H.default,{"model-value":o.selectedStatus,class:e.normalizeClass($.value),onChange:t[2]||(t[2]=a=>l.$emit("update:selectedStatus",a.target.value))},{default:e.withCtx(()=>[t[5]||(t[5]=e.createElementVNode("option",{value:""}," All Status ",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.statusOptions,a=>(e.openBlock(),e.createElementBlock("option",{key:a.value,value:a.value},e.toDisplayString(a.label),9,ee))),128))]),_:1},8,["model-value","class"]),e.createVNode(c.default,{icon:"chevron-down",class:"absolute right-2 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400 pointer-events-none"})])])):e.createCommentVNode("",!0),o.showFilters?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(T.value),onClick:B},[e.createVNode(c.default,{icon:"filter",class:"w-4 h-4"}),t[6]||(t[6]=e.createTextVNode(" Filters ",-1)),k.value>0?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(D.value)},e.toDisplayString(k.value),3)):e.createCommentVNode("",!0),e.createVNode(c.default,{icon:m.value?"chevron-up":"chevron-down",class:"w-4 h-4 ml-1"},null,8,["icon"])],2)):e.createCommentVNode("",!0),l.$slots.filters?(e.openBlock(),e.createElementBlock("div",te,[e.renderSlot(l.$slots,"filters")])):e.createCommentVNode("",!0),e.createElementVNode("div",ae,[b.value?(e.openBlock(),e.createBlock(v.default,{key:0,class:e.normalizeClass(L.value),onClick:U},{default:e.withCtx(()=>[e.createVNode(c.default,{icon:"rotate-left",class:"w-4 h-4 mr-2"}),t[7]||(t[7]=e.createTextVNode(" Clear All ",-1))]),_:1},8,["class"])):e.createCommentVNode("",!0),o.showExport?(e.openBlock(),e.createBlock(v.default,{key:1,class:e.normalizeClass(j.value),onClick:t[3]||(t[3]=a=>l.$emit("export"))},{default:e.withCtx(()=>[e.createVNode(c.default,{icon:"download",class:"w-4 h-4 mr-2"}),t[8]||(t[8]=e.createTextVNode(" Export ",-1))]),_:1},8,["class"])):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"actions",{},()=>[o.showAdd?(e.openBlock(),e.createBlock(v.default,{key:0,variant:"success",size:"lg",onClick:t[4]||(t[4]=a=>l.$emit("add"))},{default:e.withCtx(()=>[e.createVNode(c.default,{icon:"plus",class:"w-4 h-4 mr-2"}),t[9]||(t[9]=e.createTextVNode(" Add ",-1))]),_:1})):e.createCommentVNode("",!0)])])],2),o.showFilters&&m.value&&o.dateFilters.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(I.value)},[e.createElementVNode("div",le,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.dateFilters,a=>(e.openBlock(),e.createElementBlock("div",{key:a.key,class:"space-y-3"},[e.createElementVNode("div",se,[e.createElementVNode("label",{class:e.normalizeClass(A.value)},e.toDisplayString(a.label),3),e.createElementVNode("span",{class:e.normalizeClass(N(a))},e.toDisplayString(y(a)?"Active":"Inactive"),3)]),e.createElementVNode("div",oe,[e.createElementVNode("div",re,[e.createVNode(c.default,{icon:"calendar",class:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),e.createElementVNode("input",{type:"date","model-value":a.from,class:e.normalizeClass(C.value),placeholder:`From ${a.label}`,onInput:r=>h(a.key,"from",r.target.value)},null,42,ne)]),e.createElementVNode("span",{class:e.normalizeClass(O.value)},"to",2),e.createElementVNode("div",ce,[e.createVNode(c.default,{icon:"calendar",class:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),e.createElementVNode("input",{type:"date","model-value":a.to,class:e.normalizeClass(C.value),placeholder:`To ${a.label}`,onInput:r=>h(a.key,"to",r.target.value)},null,42,de)]),y(a)?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(Q.value),title:"Clear this filter",onClick:r=>w(a.key)},[e.createVNode(c.default,{icon:"xmark",class:"w-4 h-4"})],10,ie)):e.createCommentVNode("",!0)])]))),128))])],2)):e.createCommentVNode("",!0),o.showFilters&&x.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(P.value)},[e.createElementVNode("div",ue,[e.createElementVNode("span",{class:e.normalizeClass(q.value)},"Active filters:",2),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,a=>(e.openBlock(),e.createElementBlock("div",{key:a.key,class:e.normalizeClass(R.value)},[e.createVNode(c.default,{icon:a.icon,class:"w-3 h-3"},null,8,["icon"]),e.createElementVNode("span",null,e.toDisplayString(a.label)+": "+e.toDisplayString(a.value),1),e.createElementVNode("button",{class:e.normalizeClass(M.value),onClick:r=>W(a.key)},[e.createVNode(c.default,{icon:"xmark",class:"w-3 h-3"})],10,me)],2))),128))])],2)):e.createCommentVNode("",!0),o.showTableInfo?(e.openBlock(),e.createElementBlock("div",pe,[e.createElementVNode("div",fe,[e.createElementVNode("div",ye,[e.createElementVNode("span",ve,[e.createElementVNode("span",ge,e.toDisplayString(o.totalItems||0),1),e.createTextVNode(" "+e.toDisplayString(o.itemLabel||"items")+" found ",1)])])])])):e.createCommentVNode("",!0)]))}};exports.default=he;
|
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
import { ref as oe, computed as o, createElementBlock as u, openBlock as n, createElementVNode as r, createCommentVNode as p, normalizeClass as i, createVNode as c, withCtx as w, Fragment as S, renderList as $, toDisplayString as f, createTextVNode as x, renderSlot as z, createBlock as T } from "vue";
|
|
2
|
+
import I from "./Button.js";
|
|
3
|
+
import ne from "./Select.js";
|
|
4
|
+
import { cva as B } from "class-variance-authority";
|
|
5
|
+
import { cn as y } from "../utils/cn.js";
|
|
6
|
+
import v from "./Icon.js";
|
|
7
|
+
const ie = { class: "bg-white border-b border-gray-200" }, de = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "flex-1 min-w-80 max-w-md"
|
|
10
|
+
}, ue = { class: "relative group" }, ce = ["model-value", "placeholder"], me = {
|
|
11
|
+
key: 1,
|
|
12
|
+
class: "min-w-36"
|
|
13
|
+
}, pe = { class: "relative" }, ve = ["value"], fe = {
|
|
14
|
+
key: 3,
|
|
15
|
+
class: "flex items-center gap-2"
|
|
16
|
+
}, ye = { class: "flex items-center gap-3 ml-auto" }, ge = { class: "grid grid-cols-1 lg:grid-cols-3 gap-6" }, he = { class: "flex items-center justify-between" }, be = { class: "flex items-center gap-3" }, xe = { class: "relative flex-1" }, we = ["model-value", "placeholder", "onInput"], ke = { class: "relative flex-1" }, Fe = ["model-value", "placeholder", "onInput"], Ce = ["onClick"], Se = { class: "flex items-center gap-3 flex-wrap" }, $e = ["onClick"], Te = {
|
|
17
|
+
key: 2,
|
|
18
|
+
class: "px-6 py-3 bg-gray-50 border-t border-gray-200"
|
|
19
|
+
}, Ie = { class: "flex items-center justify-between" }, Be = { class: "flex items-center gap-4" }, Ve = { class: "text-sm text-gray-600" }, De = { class: "font-medium" }, Le = {
|
|
20
|
+
__name: "DataTableFilters",
|
|
21
|
+
props: {
|
|
22
|
+
searchQuery: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: ""
|
|
25
|
+
},
|
|
26
|
+
searchPlaceholder: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "Search..."
|
|
29
|
+
},
|
|
30
|
+
selectedStatus: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: ""
|
|
33
|
+
},
|
|
34
|
+
statusOptions: {
|
|
35
|
+
type: Array,
|
|
36
|
+
default: () => []
|
|
37
|
+
},
|
|
38
|
+
// Legacy props for backward compatibility
|
|
39
|
+
showDateFilter: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: !1
|
|
42
|
+
},
|
|
43
|
+
dateFrom: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: ""
|
|
46
|
+
},
|
|
47
|
+
dateTo: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: ""
|
|
50
|
+
},
|
|
51
|
+
// Dynamic date filters prop (NO active property required)
|
|
52
|
+
dateFilters: {
|
|
53
|
+
type: Array,
|
|
54
|
+
default: () => [],
|
|
55
|
+
validator: (l) => l.every(
|
|
56
|
+
(g) => Object.prototype.hasOwnProperty.call(g, "key") && Object.prototype.hasOwnProperty.call(g, "label") && Object.prototype.hasOwnProperty.call(g, "from") && Object.prototype.hasOwnProperty.call(g, "to")
|
|
57
|
+
)
|
|
58
|
+
},
|
|
59
|
+
showExport: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: !1
|
|
62
|
+
},
|
|
63
|
+
showAdd: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: !1
|
|
66
|
+
},
|
|
67
|
+
showTableInfo: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: !0
|
|
70
|
+
},
|
|
71
|
+
showSearch: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: !0
|
|
74
|
+
},
|
|
75
|
+
showFilters: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: !0
|
|
78
|
+
},
|
|
79
|
+
totalItems: {
|
|
80
|
+
type: Number,
|
|
81
|
+
default: 0
|
|
82
|
+
},
|
|
83
|
+
itemLabel: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: "items"
|
|
86
|
+
},
|
|
87
|
+
variant: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: "default",
|
|
90
|
+
validator: (l) => ["default", "minimal", "bordered"].includes(l)
|
|
91
|
+
},
|
|
92
|
+
padding: {
|
|
93
|
+
type: String,
|
|
94
|
+
default: "normal",
|
|
95
|
+
validator: (l) => ["compact", "normal", "comfortable"].includes(l)
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
emits: [
|
|
99
|
+
"update:searchQuery",
|
|
100
|
+
"update:selectedStatus",
|
|
101
|
+
"update:dateFrom",
|
|
102
|
+
"update:dateTo",
|
|
103
|
+
"update:dateFilters",
|
|
104
|
+
"export",
|
|
105
|
+
"add",
|
|
106
|
+
"clear-filters"
|
|
107
|
+
],
|
|
108
|
+
setup(l, { emit: g }) {
|
|
109
|
+
const s = l, m = g, b = oe(!1), j = B("flex flex-wrap items-center gap-4", {
|
|
110
|
+
variants: {
|
|
111
|
+
variant: {
|
|
112
|
+
default: "bg-white",
|
|
113
|
+
minimal: "bg-transparent",
|
|
114
|
+
bordered: "bg-gray-50"
|
|
115
|
+
},
|
|
116
|
+
padding: {
|
|
117
|
+
compact: "px-4 py-3",
|
|
118
|
+
normal: "px-6 py-4",
|
|
119
|
+
comfortable: "px-8 py-6"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
defaultVariants: {
|
|
123
|
+
variant: "default",
|
|
124
|
+
padding: "normal"
|
|
125
|
+
}
|
|
126
|
+
}), k = B("border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all text-sm", {
|
|
127
|
+
variants: {
|
|
128
|
+
size: {
|
|
129
|
+
sm: "px-2 py-1.5",
|
|
130
|
+
md: "px-3 py-2.5",
|
|
131
|
+
lg: "px-4 py-3"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
defaultVariants: {
|
|
135
|
+
size: "md"
|
|
136
|
+
}
|
|
137
|
+
}), F = B("rounded-lg flex items-center font-medium transition-all", {
|
|
138
|
+
variants: {
|
|
139
|
+
variant: {
|
|
140
|
+
default: "text-gray-700 hover:text-gray-900 border border-gray-200 hover:bg-gray-50 hover:border-gray-300 bg-white",
|
|
141
|
+
primary: "text-white bg-blue-600 hover:bg-blue-700 border border-blue-600 shadow-sm",
|
|
142
|
+
success: "text-white bg-green-600 hover:bg-green-700 border border-green-600 shadow-sm",
|
|
143
|
+
ghost: "text-gray-600 hover:text-gray-800 hover:bg-gray-100"
|
|
144
|
+
},
|
|
145
|
+
size: {
|
|
146
|
+
sm: "px-2 py-1.5 text-xs",
|
|
147
|
+
md: "px-3 py-2 text-sm",
|
|
148
|
+
lg: "px-4 py-2.5 text-sm"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
defaultVariants: {
|
|
152
|
+
variant: "default",
|
|
153
|
+
size: "md"
|
|
154
|
+
}
|
|
155
|
+
}), C = (a) => !!(a.from || a.to), E = (a) => {
|
|
156
|
+
const e = [...s.dateFilters], t = e.findIndex((d) => d.key === a);
|
|
157
|
+
t >= 0 && (e[t] = {
|
|
158
|
+
...e[t],
|
|
159
|
+
from: "",
|
|
160
|
+
to: ""
|
|
161
|
+
}, m("update:dateFilters", e));
|
|
162
|
+
}, L = (a) => `text-xs px-2 py-1 rounded ${C(a) ? "bg-blue-100 text-blue-700" : "bg-gray-100 text-gray-600"}`, P = () => {
|
|
163
|
+
b.value = !b.value;
|
|
164
|
+
}, V = (a, e, t) => {
|
|
165
|
+
const d = [...s.dateFilters], h = d.findIndex((re) => re.key === a);
|
|
166
|
+
h >= 0 && (d[h] = {
|
|
167
|
+
...d[h],
|
|
168
|
+
[e]: t
|
|
169
|
+
}, m("update:dateFilters", d));
|
|
170
|
+
}, D = o(() => {
|
|
171
|
+
const a = s.searchQuery, e = s.selectedStatus, t = s.dateFrom || s.dateTo, d = s.dateFilters.some((h) => h.from || h.to);
|
|
172
|
+
return a || e || t || d;
|
|
173
|
+
}), A = o(() => {
|
|
174
|
+
let a = 0;
|
|
175
|
+
return s.searchQuery && a++, s.selectedStatus && a++, (s.dateFrom || s.dateTo) && a++, a += s.dateFilters.filter((e) => e.from || e.to).length, a;
|
|
176
|
+
}), O = o(() => {
|
|
177
|
+
const a = [];
|
|
178
|
+
if (s.searchQuery && s.searchQuery.trim() && a.push({
|
|
179
|
+
key: "search",
|
|
180
|
+
label: "Search",
|
|
181
|
+
value: `"${s.searchQuery}"`,
|
|
182
|
+
icon: "magnifying-glass"
|
|
183
|
+
}), s.selectedStatus) {
|
|
184
|
+
const e = s.statusOptions.find((t) => t.value === s.selectedStatus);
|
|
185
|
+
a.push({
|
|
186
|
+
key: "status",
|
|
187
|
+
label: "Status",
|
|
188
|
+
value: e?.label || s.selectedStatus,
|
|
189
|
+
icon: "filter"
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
if (s.dateFrom || s.dateTo) {
|
|
193
|
+
let e = "";
|
|
194
|
+
s.dateFrom && s.dateTo ? e = `${s.dateFrom} to ${s.dateTo}` : s.dateFrom ? e = `From ${s.dateFrom}` : s.dateTo && (e = `Until ${s.dateTo}`), e && a.push({
|
|
195
|
+
key: "date",
|
|
196
|
+
label: "Date Range",
|
|
197
|
+
value: e,
|
|
198
|
+
icon: "calendar"
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
return s.dateFilters.forEach((e) => {
|
|
202
|
+
if (e.from || e.to) {
|
|
203
|
+
let t = "";
|
|
204
|
+
e.from && e.to ? t = `${e.from} to ${e.to}` : e.from ? t = `From ${e.from}` : e.to && (t = `Until ${e.to}`), t && a.push({
|
|
205
|
+
key: `date-${e.key}`,
|
|
206
|
+
label: e.label,
|
|
207
|
+
value: t,
|
|
208
|
+
icon: "calendar"
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}), a;
|
|
212
|
+
}), N = o(
|
|
213
|
+
() => y(j({
|
|
214
|
+
variant: s.variant,
|
|
215
|
+
padding: s.padding
|
|
216
|
+
}))
|
|
217
|
+
), R = o(
|
|
218
|
+
() => "absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400 group-hover:text-gray-600 transition-colors"
|
|
219
|
+
), U = o(
|
|
220
|
+
() => y(
|
|
221
|
+
k({ size: "md" }),
|
|
222
|
+
"w-full pl-10 pr-10 hover:border-gray-300"
|
|
223
|
+
)
|
|
224
|
+
), W = o(
|
|
225
|
+
() => "absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600 p-1 hover:bg-gray-100 rounded-full transition-all"
|
|
226
|
+
), q = o(
|
|
227
|
+
() => y(
|
|
228
|
+
k({ size: "md" }),
|
|
229
|
+
"w-full pr-8 appearance-none hover:border-gray-300"
|
|
230
|
+
)
|
|
231
|
+
), G = o(() => {
|
|
232
|
+
const a = b.value || D.value;
|
|
233
|
+
return y(
|
|
234
|
+
F({
|
|
235
|
+
variant: a ? "primary" : "default",
|
|
236
|
+
size: "lg"
|
|
237
|
+
}),
|
|
238
|
+
"gap-2"
|
|
239
|
+
);
|
|
240
|
+
}), H = o(
|
|
241
|
+
() => "bg-white text-blue-600 text-xs px-1.5 py-0.5 rounded-full min-w-[20px] text-center font-semibold"
|
|
242
|
+
), J = o(
|
|
243
|
+
() => "px-6 py-4 border-t border-gray-100 bg-gray-50"
|
|
244
|
+
), Q = o(
|
|
245
|
+
() => y(k({ size: "md" }), "pl-10 pr-3")
|
|
246
|
+
), M = o(
|
|
247
|
+
() => "text-sm font-semibold text-gray-700"
|
|
248
|
+
), X = o(
|
|
249
|
+
() => "text-gray-500 text-sm font-medium"
|
|
250
|
+
), Y = o(
|
|
251
|
+
() => "text-gray-400 hover:text-gray-600 p-1.5 hover:bg-gray-200 rounded-full transition-all"
|
|
252
|
+
), Z = o(
|
|
253
|
+
() => y(F({ variant: "ghost", size: "md" }))
|
|
254
|
+
), _ = o(
|
|
255
|
+
() => y(F({ variant: "default", size: "lg" }))
|
|
256
|
+
), K = o(
|
|
257
|
+
() => "px-6 py-3 bg-blue-50 border-t border-blue-100"
|
|
258
|
+
), ee = o(
|
|
259
|
+
() => "text-sm font-semibold text-blue-800"
|
|
260
|
+
), te = o(
|
|
261
|
+
() => "flex items-center gap-1.5 bg-white border border-blue-200 text-blue-800 px-3 py-1.5 rounded-full text-sm font-medium"
|
|
262
|
+
), ae = o(
|
|
263
|
+
() => "text-blue-600 hover:text-blue-800 ml-1 hover:bg-blue-100 rounded-full p-0.5 transition-all"
|
|
264
|
+
), se = () => {
|
|
265
|
+
m("update:searchQuery", ""), m("update:selectedStatus", ""), m("update:dateFrom", ""), m("update:dateTo", "");
|
|
266
|
+
const a = s.dateFilters.map((e) => ({
|
|
267
|
+
...e,
|
|
268
|
+
from: "",
|
|
269
|
+
to: ""
|
|
270
|
+
}));
|
|
271
|
+
m("update:dateFilters", a), m("clear-filters");
|
|
272
|
+
}, le = (a) => {
|
|
273
|
+
switch (a) {
|
|
274
|
+
case "search":
|
|
275
|
+
m("update:searchQuery", "");
|
|
276
|
+
break;
|
|
277
|
+
case "status":
|
|
278
|
+
m("update:selectedStatus", "");
|
|
279
|
+
break;
|
|
280
|
+
case "date":
|
|
281
|
+
m("update:dateFrom", ""), m("update:dateTo", "");
|
|
282
|
+
break;
|
|
283
|
+
default:
|
|
284
|
+
if (a.startsWith("date-")) {
|
|
285
|
+
const e = a.replace("date-", ""), t = s.dateFilters.map(
|
|
286
|
+
(d) => d.key === e ? { ...d, from: "", to: "" } : d
|
|
287
|
+
);
|
|
288
|
+
m("update:dateFilters", t);
|
|
289
|
+
}
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
return (a, e) => (n(), u("div", ie, [
|
|
294
|
+
r("div", {
|
|
295
|
+
class: i(N.value)
|
|
296
|
+
}, [
|
|
297
|
+
l.showSearch ? (n(), u("div", de, [
|
|
298
|
+
r("div", ue, [
|
|
299
|
+
c(v, {
|
|
300
|
+
icon: "magnifying-glass",
|
|
301
|
+
class: i(R.value)
|
|
302
|
+
}, null, 8, ["class"]),
|
|
303
|
+
r("input", {
|
|
304
|
+
"model-value": l.searchQuery,
|
|
305
|
+
placeholder: l.searchPlaceholder,
|
|
306
|
+
class: i(U.value),
|
|
307
|
+
onInput: e[0] || (e[0] = (t) => a.$emit("update:searchQuery", t.target.value))
|
|
308
|
+
}, null, 42, ce),
|
|
309
|
+
l.searchQuery ? (n(), u("button", {
|
|
310
|
+
key: 0,
|
|
311
|
+
class: i(W.value),
|
|
312
|
+
onClick: e[1] || (e[1] = (t) => a.$emit("update:searchQuery", ""))
|
|
313
|
+
}, [
|
|
314
|
+
c(v, {
|
|
315
|
+
icon: "xmark",
|
|
316
|
+
class: "w-3 h-3"
|
|
317
|
+
})
|
|
318
|
+
], 2)) : p("", !0)
|
|
319
|
+
])
|
|
320
|
+
])) : p("", !0),
|
|
321
|
+
l.showFilters && l.statusOptions.length > 0 ? (n(), u("div", me, [
|
|
322
|
+
r("div", pe, [
|
|
323
|
+
c(ne, {
|
|
324
|
+
"model-value": l.selectedStatus,
|
|
325
|
+
class: i(q.value),
|
|
326
|
+
onChange: e[2] || (e[2] = (t) => a.$emit("update:selectedStatus", t.target.value))
|
|
327
|
+
}, {
|
|
328
|
+
default: w(() => [
|
|
329
|
+
e[5] || (e[5] = r("option", { value: "" }, " All Status ", -1)),
|
|
330
|
+
(n(!0), u(S, null, $(l.statusOptions, (t) => (n(), u("option", {
|
|
331
|
+
key: t.value,
|
|
332
|
+
value: t.value
|
|
333
|
+
}, f(t.label), 9, ve))), 128))
|
|
334
|
+
]),
|
|
335
|
+
_: 1
|
|
336
|
+
}, 8, ["model-value", "class"]),
|
|
337
|
+
c(v, {
|
|
338
|
+
icon: "chevron-down",
|
|
339
|
+
class: "absolute right-2 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400 pointer-events-none"
|
|
340
|
+
})
|
|
341
|
+
])
|
|
342
|
+
])) : p("", !0),
|
|
343
|
+
l.showFilters ? (n(), u("button", {
|
|
344
|
+
key: 2,
|
|
345
|
+
class: i(G.value),
|
|
346
|
+
onClick: P
|
|
347
|
+
}, [
|
|
348
|
+
c(v, {
|
|
349
|
+
icon: "filter",
|
|
350
|
+
class: "w-4 h-4"
|
|
351
|
+
}),
|
|
352
|
+
e[6] || (e[6] = x(" Filters ", -1)),
|
|
353
|
+
A.value > 0 ? (n(), u("span", {
|
|
354
|
+
key: 0,
|
|
355
|
+
class: i(H.value)
|
|
356
|
+
}, f(A.value), 3)) : p("", !0),
|
|
357
|
+
c(v, {
|
|
358
|
+
icon: b.value ? "chevron-up" : "chevron-down",
|
|
359
|
+
class: "w-4 h-4 ml-1"
|
|
360
|
+
}, null, 8, ["icon"])
|
|
361
|
+
], 2)) : p("", !0),
|
|
362
|
+
a.$slots.filters ? (n(), u("div", fe, [
|
|
363
|
+
z(a.$slots, "filters")
|
|
364
|
+
])) : p("", !0),
|
|
365
|
+
r("div", ye, [
|
|
366
|
+
D.value ? (n(), T(I, {
|
|
367
|
+
key: 0,
|
|
368
|
+
class: i(Z.value),
|
|
369
|
+
onClick: se
|
|
370
|
+
}, {
|
|
371
|
+
default: w(() => [
|
|
372
|
+
c(v, {
|
|
373
|
+
icon: "rotate-left",
|
|
374
|
+
class: "w-4 h-4 mr-2"
|
|
375
|
+
}),
|
|
376
|
+
e[7] || (e[7] = x(" Clear All ", -1))
|
|
377
|
+
]),
|
|
378
|
+
_: 1
|
|
379
|
+
}, 8, ["class"])) : p("", !0),
|
|
380
|
+
l.showExport ? (n(), T(I, {
|
|
381
|
+
key: 1,
|
|
382
|
+
class: i(_.value),
|
|
383
|
+
onClick: e[3] || (e[3] = (t) => a.$emit("export"))
|
|
384
|
+
}, {
|
|
385
|
+
default: w(() => [
|
|
386
|
+
c(v, {
|
|
387
|
+
icon: "download",
|
|
388
|
+
class: "w-4 h-4 mr-2"
|
|
389
|
+
}),
|
|
390
|
+
e[8] || (e[8] = x(" Export ", -1))
|
|
391
|
+
]),
|
|
392
|
+
_: 1
|
|
393
|
+
}, 8, ["class"])) : p("", !0),
|
|
394
|
+
z(a.$slots, "actions", {}, () => [
|
|
395
|
+
l.showAdd ? (n(), T(I, {
|
|
396
|
+
key: 0,
|
|
397
|
+
variant: "success",
|
|
398
|
+
size: "lg",
|
|
399
|
+
onClick: e[4] || (e[4] = (t) => a.$emit("add"))
|
|
400
|
+
}, {
|
|
401
|
+
default: w(() => [
|
|
402
|
+
c(v, {
|
|
403
|
+
icon: "plus",
|
|
404
|
+
class: "w-4 h-4 mr-2"
|
|
405
|
+
}),
|
|
406
|
+
e[9] || (e[9] = x(" Add ", -1))
|
|
407
|
+
]),
|
|
408
|
+
_: 1
|
|
409
|
+
})) : p("", !0)
|
|
410
|
+
])
|
|
411
|
+
])
|
|
412
|
+
], 2),
|
|
413
|
+
l.showFilters && b.value && l.dateFilters.length > 0 ? (n(), u("div", {
|
|
414
|
+
key: 0,
|
|
415
|
+
class: i(J.value)
|
|
416
|
+
}, [
|
|
417
|
+
r("div", ge, [
|
|
418
|
+
(n(!0), u(S, null, $(l.dateFilters, (t) => (n(), u("div", {
|
|
419
|
+
key: t.key,
|
|
420
|
+
class: "space-y-3"
|
|
421
|
+
}, [
|
|
422
|
+
r("div", he, [
|
|
423
|
+
r("label", {
|
|
424
|
+
class: i(M.value)
|
|
425
|
+
}, f(t.label), 3),
|
|
426
|
+
r("span", {
|
|
427
|
+
class: i(L(t))
|
|
428
|
+
}, f(C(t) ? "Active" : "Inactive"), 3)
|
|
429
|
+
]),
|
|
430
|
+
r("div", be, [
|
|
431
|
+
r("div", xe, [
|
|
432
|
+
c(v, {
|
|
433
|
+
icon: "calendar",
|
|
434
|
+
class: "absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"
|
|
435
|
+
}),
|
|
436
|
+
r("input", {
|
|
437
|
+
type: "date",
|
|
438
|
+
"model-value": t.from,
|
|
439
|
+
class: i(Q.value),
|
|
440
|
+
placeholder: `From ${t.label}`,
|
|
441
|
+
onInput: (d) => V(t.key, "from", d.target.value)
|
|
442
|
+
}, null, 42, we)
|
|
443
|
+
]),
|
|
444
|
+
r("span", {
|
|
445
|
+
class: i(X.value)
|
|
446
|
+
}, "to", 2),
|
|
447
|
+
r("div", ke, [
|
|
448
|
+
c(v, {
|
|
449
|
+
icon: "calendar",
|
|
450
|
+
class: "absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"
|
|
451
|
+
}),
|
|
452
|
+
r("input", {
|
|
453
|
+
type: "date",
|
|
454
|
+
"model-value": t.to,
|
|
455
|
+
class: i(Q.value),
|
|
456
|
+
placeholder: `To ${t.label}`,
|
|
457
|
+
onInput: (d) => V(t.key, "to", d.target.value)
|
|
458
|
+
}, null, 42, Fe)
|
|
459
|
+
]),
|
|
460
|
+
C(t) ? (n(), u("button", {
|
|
461
|
+
key: 0,
|
|
462
|
+
class: i(Y.value),
|
|
463
|
+
title: "Clear this filter",
|
|
464
|
+
onClick: (d) => E(t.key)
|
|
465
|
+
}, [
|
|
466
|
+
c(v, {
|
|
467
|
+
icon: "xmark",
|
|
468
|
+
class: "w-4 h-4"
|
|
469
|
+
})
|
|
470
|
+
], 10, Ce)) : p("", !0)
|
|
471
|
+
])
|
|
472
|
+
]))), 128))
|
|
473
|
+
])
|
|
474
|
+
], 2)) : p("", !0),
|
|
475
|
+
l.showFilters && O.value.length > 0 ? (n(), u("div", {
|
|
476
|
+
key: 1,
|
|
477
|
+
class: i(K.value)
|
|
478
|
+
}, [
|
|
479
|
+
r("div", Se, [
|
|
480
|
+
r("span", {
|
|
481
|
+
class: i(ee.value)
|
|
482
|
+
}, "Active filters:", 2),
|
|
483
|
+
(n(!0), u(S, null, $(O.value, (t) => (n(), u("div", {
|
|
484
|
+
key: t.key,
|
|
485
|
+
class: i(te.value)
|
|
486
|
+
}, [
|
|
487
|
+
c(v, {
|
|
488
|
+
icon: t.icon,
|
|
489
|
+
class: "w-3 h-3"
|
|
490
|
+
}, null, 8, ["icon"]),
|
|
491
|
+
r("span", null, f(t.label) + ": " + f(t.value), 1),
|
|
492
|
+
r("button", {
|
|
493
|
+
class: i(ae.value),
|
|
494
|
+
onClick: (d) => le(t.key)
|
|
495
|
+
}, [
|
|
496
|
+
c(v, {
|
|
497
|
+
icon: "xmark",
|
|
498
|
+
class: "w-3 h-3"
|
|
499
|
+
})
|
|
500
|
+
], 10, $e)
|
|
501
|
+
], 2))), 128))
|
|
502
|
+
])
|
|
503
|
+
], 2)) : p("", !0),
|
|
504
|
+
l.showTableInfo ? (n(), u("div", Te, [
|
|
505
|
+
r("div", Ie, [
|
|
506
|
+
r("div", Be, [
|
|
507
|
+
r("span", Ve, [
|
|
508
|
+
r("span", De, f(l.totalItems || 0), 1),
|
|
509
|
+
x(" " + f(l.itemLabel || "items") + " found ", 1)
|
|
510
|
+
])
|
|
511
|
+
])
|
|
512
|
+
])
|
|
513
|
+
])) : p("", !0)
|
|
514
|
+
]));
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
export {
|
|
518
|
+
Le as default
|
|
519
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),n=require("./Typography.cjs"),r=require("class-variance-authority"),s=require("../utils/cn.cjs"),p={class:"flex items-start justify-between"},f={key:0,class:"flex items-center gap-2"},v={__name:"DataTableHeader",props:{title:{type:String,default:null},description:{type:String,default:null},variant:{type:String,default:"default",validator:t=>["default","minimal","bordered"].includes(t)},padding:{type:String,default:"normal",validator:t=>["compact","normal","comfortable"].includes(t)}},setup(t){const l=t,i=r.cva("border ui-border-strong rounded-2xl",{variants:{variant:{default:"ui-border-strong",minimal:"bg-transparent border-none",bordered:"border-2 ui-border-strong"},padding:{compact:"px-4 py-2",normal:"px-6 py-4",comfortable:"px-8 py-6"}},defaultVariants:{variant:"default",padding:"normal"}}),o=r.cva("font-semibold ui-text",{variants:{size:{sm:"text-base",md:"text-lg",lg:"text-xl"}},defaultVariants:{size:"md"}}),d=r.cva("ui-text mt-1",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),c=e.computed(()=>s.cn(i({variant:l.variant,padding:l.padding}))),u=e.computed(()=>s.cn(o({size:"md"}))),m=e.computed(()=>s.cn(d({size:"md"})));return(a,g)=>t.title||t.description||a.$slots.header?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(c.value)},[e.renderSlot(a.$slots,"header",{},()=>[e.createElementVNode("div",p,[e.createElementVNode("div",null,[t.title?(e.openBlock(),e.createBlock(n.default,{key:0,class:e.normalizeClass(u.value)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),_:1},8,["class"])):e.createCommentVNode("",!0),t.description?(e.openBlock(),e.createBlock(n.default,{key:1,class:e.normalizeClass(m.value)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.description),1)]),_:1},8,["class"])):e.createCommentVNode("",!0)]),a.$slots.filters?(e.openBlock(),e.createElementBlock("div",f,[e.renderSlot(a.$slots,"filters")])):e.createCommentVNode("",!0)])])],2)):e.createCommentVNode("",!0)}};exports.default=v;
|