@bagelink/vue 1.4.188 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/RouterWrapper.vue.d.ts +16 -1
- package/dist/components/RouterWrapper.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RichText/index.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectBtn.vue.d.ts.map +1 -1
- package/dist/components/layout/AppSidebar.vue.d.ts.map +1 -1
- package/dist/index.cjs +15 -9
- package/dist/index.mjs +15 -9
- package/dist/style.css +1 -1
- package/dist/utils/BagelFormUtils.d.ts +16 -0
- package/dist/utils/BagelFormUtils.d.ts.map +1 -1
- package/dist/utils/useSearch.d.ts +18 -1
- package/dist/utils/useSearch.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/RouterWrapper.vue +13 -12
- package/src/components/form/inputs/RichText/index.vue +279 -149
- package/src/components/form/inputs/SelectBtn.vue +3 -8
- package/src/components/layout/AppSidebar.vue +42 -29
- package/src/styles/layout.css +82 -2
- package/src/styles/mobilLayout.css +91 -1
- package/src/utils/BagelFormUtils.ts +43 -0
- package/src/utils/useSearch.ts +57 -2
|
@@ -50,14 +50,9 @@ function isSelected(value: string | number) {
|
|
|
50
50
|
<template>
|
|
51
51
|
<div class="flex flex-wrap gap-05 SelectBtn">
|
|
52
52
|
<Btn
|
|
53
|
-
v-for="option in options"
|
|
54
|
-
:
|
|
55
|
-
|
|
56
|
-
:outline="outline"
|
|
57
|
-
:class="isSelected(option.value) ? 'primary' : 'bg-transparent color-black'"
|
|
58
|
-
type="button"
|
|
59
|
-
class="border px-075 radius-2"
|
|
60
|
-
@click="toggleOption(option.value)"
|
|
53
|
+
v-for="option in options" :key="option.value" :thin="thin" :outline="outline"
|
|
54
|
+
:class="isSelected(option.value) ? 'primary' : 'bg-transparent'" type="button"
|
|
55
|
+
class="border px-075 radius-2" @click="toggleOption(option.value)"
|
|
61
56
|
>
|
|
62
57
|
<Icon v-if="option.icon" :name="option.icon" weight="300" />
|
|
63
58
|
<p>{{ option.label }}</p>
|
|
@@ -76,31 +76,39 @@ const sidebarStyles = computed(() => {
|
|
|
76
76
|
</script>
|
|
77
77
|
|
|
78
78
|
<template>
|
|
79
|
-
<aside
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
79
|
+
<aside
|
|
80
|
+
class="app-sidebar transition-400 fixed start top bottom h-100vh z-99" :class="{
|
|
81
|
+
'sidebar-mobile-open': menuState.isMobile.value && menuState.isOpen.value,
|
|
82
|
+
'sidebar-mobile-closed':
|
|
83
|
+
menuState.isMobile.value && !menuState.isOpen.value,
|
|
84
|
+
'transitioning': isTransitioning,
|
|
85
|
+
'p-05': props.card,
|
|
86
|
+
'sidebar-collapsed': !menuState.isMobile.value && !menuState.isOpen.value,
|
|
87
|
+
}" :style="sidebarStyles"
|
|
88
|
+
>
|
|
89
|
+
<div
|
|
90
|
+
:style="{
|
|
91
|
+
backgroundColor: props.bgColor,
|
|
92
|
+
color: props.textColor,
|
|
93
|
+
...(props.card && { borderRadius: 'var(--card-border-radius)' }),
|
|
94
|
+
}" :class="{
|
|
92
95
|
'card cardWrapSide': props.card,
|
|
93
96
|
'ps-05': !menuState.isOpen.value,
|
|
94
97
|
'scrollbar-gutter-both': menuState.isOpen.value,
|
|
95
98
|
'aside_frame': props.frame,
|
|
96
|
-
}" class="overflow-hidden flex column flex-stretch gap-1 w100p pt-1 pb-05 h-100p"
|
|
99
|
+
}" class="overflow-hidden flex column flex-stretch gap-1 w100p pt-1 pb-05 h-100p"
|
|
100
|
+
>
|
|
97
101
|
<!-- Logo/Brand -->
|
|
98
|
-
<router-link
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
<router-link
|
|
103
|
+
to="/" class="decoration-none flex px-05" :class="{
|
|
104
|
+
'gap-05': menuState.isOpen.value,
|
|
105
|
+
'gap-0': !menuState.isOpen.value,
|
|
106
|
+
}"
|
|
107
|
+
>
|
|
108
|
+
<img
|
|
109
|
+
v-if="props.logo" :src="props.logo" :alt="props.logoAlt" class="contain"
|
|
110
|
+
:style="{ height: props.logoHeight }"
|
|
111
|
+
>
|
|
104
112
|
<span class="nav-text">
|
|
105
113
|
{{ props.name }}
|
|
106
114
|
</span>
|
|
@@ -108,15 +116,17 @@ const sidebarStyles = computed(() => {
|
|
|
108
116
|
|
|
109
117
|
<!-- Navigation Links -->
|
|
110
118
|
<nav class="sidebar-nav flex column flex-stretch gap-025 align-items-start scrollbar-gutter-stable">
|
|
111
|
-
<Btn
|
|
112
|
-
|
|
113
|
-
|
|
119
|
+
<Btn
|
|
120
|
+
v-for="link in props.navLinks" :key="link.to" :title="!menuState.isOpen.value && !menuState.isMobile.value
|
|
121
|
+
? link.label
|
|
122
|
+
: ''
|
|
114
123
|
" fullWidth alignTxt="start" class="flex-shrink-0 px-1" :class="{ 'nav-btn-active': route.path === link.to }"
|
|
115
124
|
:style="{
|
|
116
125
|
backgroundColor:
|
|
117
126
|
route.path === link.to ? props.activeColor : props.bgColor,
|
|
118
127
|
color: route.path === link.to ? 'white' : props.textColor,
|
|
119
|
-
}" :to="link.to || '/'" @click="link.action"
|
|
128
|
+
}" :to="link.to || '/'" @click="link.action"
|
|
129
|
+
>
|
|
120
130
|
<Icon :name="link.icon" size="1.2" />
|
|
121
131
|
<span class="nav-text">
|
|
122
132
|
{{ link.label }}
|
|
@@ -125,12 +135,15 @@ const sidebarStyles = computed(() => {
|
|
|
125
135
|
</nav>
|
|
126
136
|
<!-- Footer -->
|
|
127
137
|
<div
|
|
128
|
-
class="sidebar-footer flex column flex-stretch gap-025 align-items-start mt-auto scrollbar-gutter-stable"
|
|
138
|
+
class="sidebar-footer flex column flex-stretch gap-025 align-items-start mt-auto scrollbar-gutter-stable"
|
|
139
|
+
>
|
|
129
140
|
<!-- Footer Links -->
|
|
130
|
-
<Btn
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
141
|
+
<Btn
|
|
142
|
+
v-for="link in props.footerLinks" :key="link.to || link.label" :title="!menuState.isOpen.value && !menuState.isMobile.value
|
|
143
|
+
? link.label
|
|
144
|
+
: ''
|
|
145
|
+
" alignTxt="start" fullWidth flat :icon="link.icon" class="flex-shrink-0 px-1" :to="link.to" @click="link.action"
|
|
146
|
+
>
|
|
134
147
|
<span class="nav-text">
|
|
135
148
|
{{ link.label }}
|
|
136
149
|
</span>
|
package/src/styles/layout.css
CHANGED
|
@@ -741,8 +741,8 @@
|
|
|
741
741
|
top: 10rem;
|
|
742
742
|
}
|
|
743
743
|
|
|
744
|
-
.top-50p
|
|
745
|
-
top:
|
|
744
|
+
.top-50p{
|
|
745
|
+
top: 50%;
|
|
746
746
|
}
|
|
747
747
|
|
|
748
748
|
.-top-025 {
|
|
@@ -2072,6 +2072,86 @@
|
|
|
2072
2072
|
margin-inline-end: auto;
|
|
2073
2073
|
width: 98%;
|
|
2074
2074
|
}
|
|
2075
|
+
.w1,
|
|
2076
|
+
.w1px,
|
|
2077
|
+
.w-1px,
|
|
2078
|
+
.max-w1px,
|
|
2079
|
+
.w-max-1px,
|
|
2080
|
+
.w-max-1px {
|
|
2081
|
+
max-width: 1px;
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
.w2,
|
|
2085
|
+
.w2px,
|
|
2086
|
+
.w-2px,
|
|
2087
|
+
.max-w2px,
|
|
2088
|
+
.w-max-2px,
|
|
2089
|
+
.w-max-2px {
|
|
2090
|
+
max-width: 2px;
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
.w3,
|
|
2094
|
+
.w3px,
|
|
2095
|
+
.w-3px,
|
|
2096
|
+
.max-w3px,
|
|
2097
|
+
.w-max-3px,
|
|
2098
|
+
.w-max-3px {
|
|
2099
|
+
max-width: 3px;
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
.w4,
|
|
2103
|
+
.w4px,
|
|
2104
|
+
.w-4px,
|
|
2105
|
+
.max-w4px,
|
|
2106
|
+
.w-max-4px,
|
|
2107
|
+
.w-max-4px {
|
|
2108
|
+
max-width: 4px;
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
.w5,
|
|
2112
|
+
.w5px,
|
|
2113
|
+
.w-5px,
|
|
2114
|
+
.max-w5px,
|
|
2115
|
+
.w-max-5px,
|
|
2116
|
+
.w-max-5px {
|
|
2117
|
+
max-width: 5px;
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
.w6,
|
|
2121
|
+
.w6px,
|
|
2122
|
+
.w-6px,
|
|
2123
|
+
.max-w6px,
|
|
2124
|
+
.w-max-6px,
|
|
2125
|
+
.w-max-6px {
|
|
2126
|
+
max-width: 6px;
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
.w7,
|
|
2130
|
+
.w7px,
|
|
2131
|
+
.w-7px,
|
|
2132
|
+
.max-w7px,
|
|
2133
|
+
.w-max-7px,
|
|
2134
|
+
.w-max-7px {
|
|
2135
|
+
max-width: 7px;
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
.w8,
|
|
2139
|
+
.w8px,
|
|
2140
|
+
.w-8px,
|
|
2141
|
+
.max-w8px,
|
|
2142
|
+
.w-max-8px,
|
|
2143
|
+
.w-max-8px {
|
|
2144
|
+
max-width: 8px;
|
|
2145
|
+
}
|
|
2146
|
+
|
|
2147
|
+
.w9,
|
|
2148
|
+
.w9px,
|
|
2149
|
+
.w-9px,
|
|
2150
|
+
.max-w9px,
|
|
2151
|
+
.w-max-9px,
|
|
2152
|
+
.w-max-9px {
|
|
2153
|
+
max-width: 9px;
|
|
2154
|
+
}
|
|
2075
2155
|
|
|
2076
2156
|
.w10,
|
|
2077
2157
|
.w10px,
|
|
@@ -308,6 +308,12 @@
|
|
|
308
308
|
width: 100%;
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
+
.m_w-100i,
|
|
312
|
+
.m_w-100pi,
|
|
313
|
+
.m_w100pi .m_width-100i {
|
|
314
|
+
width: 100% !important;
|
|
315
|
+
}
|
|
316
|
+
|
|
311
317
|
.m_min-w-100p,
|
|
312
318
|
.m_w-min-100p,
|
|
313
319
|
.m_min-w100p {
|
|
@@ -1289,6 +1295,90 @@
|
|
|
1289
1295
|
width: 98%;
|
|
1290
1296
|
}
|
|
1291
1297
|
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
.m_w1,
|
|
1301
|
+
.m_w1px,
|
|
1302
|
+
.m_w-1px,
|
|
1303
|
+
.m_max-w1px,
|
|
1304
|
+
.m_w-max-1px,
|
|
1305
|
+
.m_w-max-1px {
|
|
1306
|
+
max-width: 1px;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
.m_w2,
|
|
1310
|
+
.m_w2px,
|
|
1311
|
+
.m_w-2px,
|
|
1312
|
+
.m_max-w2px,
|
|
1313
|
+
.m_w-max-2px,
|
|
1314
|
+
.m_w-max-2px {
|
|
1315
|
+
max-width: 2px;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
.m_w3,
|
|
1319
|
+
.m_w3px,
|
|
1320
|
+
.m_w-3px,
|
|
1321
|
+
.m_max-w3px,
|
|
1322
|
+
.m_w-max-3px,
|
|
1323
|
+
.m_w-max-3px {
|
|
1324
|
+
max-width: 3px;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
.m_w4,
|
|
1328
|
+
.m_w4px,
|
|
1329
|
+
.m_w-4px,
|
|
1330
|
+
.m_max-w4px,
|
|
1331
|
+
.m_w-max-4px,
|
|
1332
|
+
.m_w-max-4px {
|
|
1333
|
+
max-width: 4px;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
.m_w5,
|
|
1337
|
+
.m_w5px,
|
|
1338
|
+
.m_w-5px,
|
|
1339
|
+
.m_max-w5px,
|
|
1340
|
+
.m_w-max-5px,
|
|
1341
|
+
.m_w-max-5px {
|
|
1342
|
+
max-width: 5px;
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
.m_w6,
|
|
1346
|
+
.m_w6px,
|
|
1347
|
+
.m_w-6px,
|
|
1348
|
+
.m_max-w6px,
|
|
1349
|
+
.m_w-max-6px,
|
|
1350
|
+
.m_w-max-6px {
|
|
1351
|
+
max-width: 6px;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
.m_w7,
|
|
1355
|
+
.m_w7px,
|
|
1356
|
+
.m_w-7px,
|
|
1357
|
+
.m_max-w7px,
|
|
1358
|
+
.m_w-max-7px,
|
|
1359
|
+
.m_w-max-7px {
|
|
1360
|
+
max-width: 7px;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
.m_w8,
|
|
1364
|
+
.m_w8px,
|
|
1365
|
+
.m_w-8px,
|
|
1366
|
+
.m_max-w8px,
|
|
1367
|
+
.m_w-max-8px,
|
|
1368
|
+
.m_w-max-8px {
|
|
1369
|
+
max-width: 8px;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
.m_w9,
|
|
1373
|
+
.m_w9px,
|
|
1374
|
+
.m_w-9px,
|
|
1375
|
+
.m_max-w9px,
|
|
1376
|
+
.m_w-max-9px,
|
|
1377
|
+
.m_w-max-9px {
|
|
1378
|
+
max-width: 9px;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
|
|
1292
1382
|
.m_w10,
|
|
1293
1383
|
.m_w10px,
|
|
1294
1384
|
.m_w-10px,
|
|
@@ -7424,7 +7514,7 @@
|
|
|
7424
7514
|
}
|
|
7425
7515
|
|
|
7426
7516
|
.m_top-50p {
|
|
7427
|
-
top:
|
|
7517
|
+
top: 50%;
|
|
7428
7518
|
}
|
|
7429
7519
|
|
|
7430
7520
|
.m_bottom,
|
|
@@ -67,6 +67,25 @@ export interface NumFieldOptions<T, K extends Path<T>> extends InputOptions<T, K
|
|
|
67
67
|
|
|
68
68
|
export interface RichTextOptions<T, P extends Path<T>> extends InputOptions<T, P> {
|
|
69
69
|
height?: number | string
|
|
70
|
+
basic?: boolean
|
|
71
|
+
simple?: boolean
|
|
72
|
+
debug?: boolean
|
|
73
|
+
// Manual hide options
|
|
74
|
+
hideToolbar?: boolean
|
|
75
|
+
hideInlineToolbar?: boolean
|
|
76
|
+
hideImages?: boolean
|
|
77
|
+
hideVideos?: boolean
|
|
78
|
+
hideEmbed?: boolean
|
|
79
|
+
hideTables?: boolean
|
|
80
|
+
hideAlignment?: boolean
|
|
81
|
+
hideDirections?: boolean
|
|
82
|
+
hideH5H6?: boolean
|
|
83
|
+
// Simple array-based hide option
|
|
84
|
+
hide?: string[]
|
|
85
|
+
// Control autofocus behavior
|
|
86
|
+
autofocus?: boolean
|
|
87
|
+
// Text color
|
|
88
|
+
textColor?: string
|
|
70
89
|
}
|
|
71
90
|
|
|
72
91
|
export interface TelInputOptions<T, P extends Path<T>> extends InputOptions<T, P> {
|
|
@@ -101,11 +120,29 @@ export function richText<
|
|
|
101
120
|
required: options?.required,
|
|
102
121
|
id,
|
|
103
122
|
label,
|
|
123
|
+
helptext: options?.helpText,
|
|
124
|
+
disabled: options?.disabled,
|
|
125
|
+
defaultValue: options?.defaultValue,
|
|
104
126
|
vIf: options?.vIf,
|
|
105
127
|
transform: options?.transform,
|
|
106
128
|
placeholder: options?.placeholder,
|
|
107
129
|
attrs: {
|
|
108
130
|
height: options?.height,
|
|
131
|
+
basic: options?.basic,
|
|
132
|
+
simple: options?.simple,
|
|
133
|
+
debug: options?.debug,
|
|
134
|
+
hideToolbar: options?.hideToolbar,
|
|
135
|
+
hideInlineToolbar: options?.hideInlineToolbar,
|
|
136
|
+
hideImages: options?.hideImages,
|
|
137
|
+
hideVideos: options?.hideVideos,
|
|
138
|
+
hideEmbed: options?.hideEmbed,
|
|
139
|
+
hideTables: options?.hideTables,
|
|
140
|
+
hideAlignment: options?.hideAlignment,
|
|
141
|
+
hideDirections: options?.hideDirections,
|
|
142
|
+
hideH5H6: options?.hideH5H6,
|
|
143
|
+
hide: options?.hide,
|
|
144
|
+
autofocus: options?.autofocus,
|
|
145
|
+
textColor: options?.textColor,
|
|
109
146
|
autocomplete: options?.autocomplete,
|
|
110
147
|
},
|
|
111
148
|
}
|
|
@@ -601,6 +638,12 @@ export function createSchema<T, PO extends PathsOptions = DefaultPathsOptions>()
|
|
|
601
638
|
label?: string,
|
|
602
639
|
options?: { [key: string]: any }
|
|
603
640
|
) => colorField<T, P, PO>(id, label, options),
|
|
641
|
+
|
|
642
|
+
richText: <P extends Path<T, PO>>(
|
|
643
|
+
id?: P,
|
|
644
|
+
label?: string,
|
|
645
|
+
options?: RichTextOptions<T, P>
|
|
646
|
+
) => richText<T, P, PO>(id, label, options),
|
|
604
647
|
}
|
|
605
648
|
}
|
|
606
649
|
|
package/src/utils/useSearch.ts
CHANGED
|
@@ -129,6 +129,7 @@ export interface SearchResult<T> {
|
|
|
129
129
|
hasResults: ComputedRef<boolean>
|
|
130
130
|
isSearching: ComputedRef<boolean>
|
|
131
131
|
isLoading: ComputedRef<boolean> // New property to track server-side loading state
|
|
132
|
+
searchTerm?: import('vue').Ref<string> // Optional searchTerm ref for simplified usage
|
|
132
133
|
}
|
|
133
134
|
|
|
134
135
|
/**
|
|
@@ -349,12 +350,59 @@ export function searchItems<T>(params: SearchItemParams<T>): T[] {
|
|
|
349
350
|
/**
|
|
350
351
|
* Vue composable for searching items with reactive results
|
|
351
352
|
* Supports both client-side filtering and server-side search
|
|
352
|
-
*
|
|
353
|
+
*
|
|
354
|
+
* Usage 1 - Simplified: Pass items directly and get searchTerm ref back
|
|
355
|
+
* ```ts
|
|
356
|
+
* const { results, searchTerm } = useSearch(itemList)
|
|
357
|
+
* ```
|
|
358
|
+
*
|
|
359
|
+
* Usage 2 - Advanced: Pass full params object with custom search term
|
|
360
|
+
* ```ts
|
|
361
|
+
* const searchTerm = ref('')
|
|
362
|
+
* const { results } = useSearch({ searchTerm, items: itemList, keysToSearch: ['name'] })
|
|
363
|
+
* ```
|
|
364
|
+
*
|
|
365
|
+
* @param paramsOrItems Search parameters object or array of items for simplified usage
|
|
366
|
+
* @param options Optional additional search parameters (only used with simplified usage)
|
|
353
367
|
* @returns Reactive search results and metadata
|
|
354
368
|
*/
|
|
369
|
+
export function useSearch<T>(
|
|
370
|
+
items: MaybeRefOrGetter<T[]>,
|
|
371
|
+
options?: Omit<SearchItemParams<T>, 'items' | 'searchTerm'>
|
|
372
|
+
): SearchResult<T> & { searchTerm: import('vue').Ref<string> }
|
|
355
373
|
export function useSearch<T>(
|
|
356
374
|
params: SearchItemParams<T>
|
|
375
|
+
): SearchResult<T>
|
|
376
|
+
export function useSearch<T>(
|
|
377
|
+
paramsOrItems: SearchItemParams<T> | MaybeRefOrGetter<T[]>,
|
|
378
|
+
options?: Omit<SearchItemParams<T>, 'items' | 'searchTerm'>
|
|
357
379
|
): SearchResult<T> {
|
|
380
|
+
// Normalize inputs - detect if first argument is items array or params object
|
|
381
|
+
let params: SearchItemParams<T>
|
|
382
|
+
let ownedSearchTerm: import('vue').Ref<string> | undefined
|
|
383
|
+
|
|
384
|
+
// Check if first argument is an array or ref (simplified usage)
|
|
385
|
+
// If it's a params object, it won't have these characteristics
|
|
386
|
+
const isArray = Array.isArray(paramsOrItems)
|
|
387
|
+
const isFunction = typeof paramsOrItems === 'function'
|
|
388
|
+
const isObject = typeof paramsOrItems === 'object' && paramsOrItems !== null
|
|
389
|
+
const isRef = isObject && 'value' in paramsOrItems && !('items' in paramsOrItems)
|
|
390
|
+
|
|
391
|
+
const isSimplifiedUsage = isArray || isFunction || isRef
|
|
392
|
+
|
|
393
|
+
if (isSimplifiedUsage) {
|
|
394
|
+
// Simplified usage: useSearch(items, options)
|
|
395
|
+
ownedSearchTerm = ref('')
|
|
396
|
+
params = {
|
|
397
|
+
items: paramsOrItems as MaybeRefOrGetter<T[]>,
|
|
398
|
+
searchTerm: ownedSearchTerm,
|
|
399
|
+
...options
|
|
400
|
+
}
|
|
401
|
+
} else {
|
|
402
|
+
// Advanced usage: useSearch(params)
|
|
403
|
+
params = paramsOrItems as SearchItemParams<T>
|
|
404
|
+
}
|
|
405
|
+
|
|
358
406
|
const { searchTerm, minChars = 2, serverSearch, debounceMs = 300 } = params
|
|
359
407
|
|
|
360
408
|
// For tracking server-side loading state
|
|
@@ -425,11 +473,18 @@ export function useSearch<T>(
|
|
|
425
473
|
return !!term && typeof term === 'string' && term.length >= minChars
|
|
426
474
|
})
|
|
427
475
|
|
|
428
|
-
|
|
476
|
+
const result: SearchResult<T> = {
|
|
429
477
|
results,
|
|
430
478
|
resultCount,
|
|
431
479
|
hasResults,
|
|
432
480
|
isSearching,
|
|
433
481
|
isLoading: computed(() => isLoading.value),
|
|
434
482
|
}
|
|
483
|
+
|
|
484
|
+
// Include searchTerm in result if we created it (simplified usage)
|
|
485
|
+
if (ownedSearchTerm) {
|
|
486
|
+
result.searchTerm = ownedSearchTerm
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
return result
|
|
435
490
|
}
|