@bagelink/vue 1.5.17 → 1.5.22
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/bin/experimentalGenTypedRoutes.ts +15 -15
- package/bin/generateFormSchema.ts +12 -12
- package/bin/utils.ts +4 -4
- package/dist/components/Dropdown.vue.d.ts.map +1 -1
- package/dist/components/calendar/CalendarPopover.vue.d.ts.map +1 -1
- package/dist/components/form/BagelForm.vue.d.ts.map +1 -1
- package/dist/components/form/FieldArray.vue.d.ts +5 -4
- package/dist/components/form/FieldArray.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RichText/index.vue.d.ts +1 -0
- package/dist/components/form/inputs/RichText/index.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/ToggleInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/Upload/UploadInput.vue.d.ts.map +1 -1
- package/dist/composables/useFormField.d.ts.map +1 -1
- package/dist/composables/useSchemaField.d.ts.map +1 -1
- package/dist/index.cjs +17 -14
- package/dist/index.mjs +511 -422
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/AccordionItem.vue +2 -2
- package/src/components/AddToCalendar.vue +1 -1
- package/src/components/BglVideo.vue +8 -8
- package/src/components/Btn.vue +9 -9
- package/src/components/Card.vue +4 -4
- package/src/components/Carousel.vue +44 -44
- package/src/components/DataPreview.vue +1 -1
- package/src/components/DragOver.vue +6 -6
- package/src/components/Dropdown.vue +14 -14
- package/src/components/Flag.vue +3 -3
- package/src/components/Icon/Icon.vue +13 -13
- package/src/components/Image.vue +4 -4
- package/src/components/ImportData.vue +79 -79
- package/src/components/ListItem.vue +7 -7
- package/src/components/MapEmbed/Index.vue +6 -6
- package/src/components/Modal.vue +10 -10
- package/src/components/ModalForm.vue +4 -4
- package/src/components/NavBar.vue +2 -2
- package/src/components/Pagination.vue +9 -9
- package/src/components/Pill.vue +1 -1
- package/src/components/Rating.vue +2 -2
- package/src/components/Slider.vue +77 -77
- package/src/components/Spreadsheet/Index.vue +34 -34
- package/src/components/Spreadsheet/SpreadsheetTable.vue +3 -3
- package/src/components/Zoomer.vue +28 -28
- package/src/components/analytics/BarChart.vue +6 -6
- package/src/components/analytics/KpiCard.vue +2 -2
- package/src/components/analytics/LineChart.vue +14 -14
- package/src/components/analytics/PieChart.vue +11 -11
- package/src/components/calendar/CalendarPopover.vue +1 -1
- package/src/components/calendar/Index.vue +1 -1
- package/src/components/calendar/views/AgendaView.vue +2 -2
- package/src/components/calendar/views/DayView.vue +6 -6
- package/src/components/calendar/views/MonthView.vue +2 -2
- package/src/components/calendar/views/WeekView.vue +18 -18
- package/src/components/dataTable/DataTable.vue +3 -3
- package/src/components/dataTable/useSorting.ts +1 -1
- package/src/components/dataTable/useTableData.ts +15 -15
- package/src/components/dataTable/useTableSelection.ts +8 -8
- package/src/components/dataTable/useTableVirtualization.ts +1 -1
- package/src/components/draggable/useDraggable.ts +42 -42
- package/src/components/form/BagelForm.vue +66 -23
- package/src/components/form/BglMultiStepForm.vue +18 -18
- package/src/components/form/FieldArray.vue +177 -67
- package/src/components/form/inputs/CheckInput.vue +2 -1
- package/src/components/form/inputs/CodeEditor/Index.vue +1 -1
- package/src/components/form/inputs/CodeEditor/format.ts +7 -7
- package/src/components/form/inputs/CodeEditor/useHighlight.ts +6 -6
- package/src/components/form/inputs/DateInput.vue +6 -6
- package/src/components/form/inputs/DatePicker.vue +19 -19
- package/src/components/form/inputs/EmailInput.vue +14 -14
- package/src/components/form/inputs/NumberInput.vue +6 -6
- package/src/components/form/inputs/OTP.vue +3 -3
- package/src/components/form/inputs/RadioGroup.vue +1 -1
- package/src/components/form/inputs/RadioPillsInput.vue +8 -8
- package/src/components/form/inputs/RichText/components/EditorToolbar.vue +10 -10
- package/src/components/form/inputs/RichText/components/TableGridSelector.vue +1 -1
- package/src/components/form/inputs/RichText/composables/useCommands.ts +1 -1
- package/src/components/form/inputs/RichText/composables/useEditor.ts +12 -12
- package/src/components/form/inputs/RichText/composables/useEditorKeyboard.ts +1 -1
- package/src/components/form/inputs/RichText/index.vue +143 -134
- package/src/components/form/inputs/RichText/utils/commands.ts +69 -69
- package/src/components/form/inputs/RichText/utils/debug.ts +1 -1
- package/src/components/form/inputs/RichText/utils/formatting.ts +39 -39
- package/src/components/form/inputs/RichText/utils/media.ts +6 -6
- package/src/components/form/inputs/RichText/utils/selection.ts +28 -28
- package/src/components/form/inputs/RichText/utils/table.ts +19 -19
- package/src/components/form/inputs/SelectBtn.vue +1 -1
- package/src/components/form/inputs/SelectInput.vue +50 -26
- package/src/components/form/inputs/SignaturePad.vue +15 -15
- package/src/components/form/inputs/TableField.vue +1 -1
- package/src/components/form/inputs/TelInput.vue +6 -6
- package/src/components/form/inputs/TextInput.vue +5 -5
- package/src/components/form/inputs/ToggleInput.vue +2 -1
- package/src/components/form/inputs/Upload/UploadInput.vue +155 -102
- package/src/components/form/inputs/Upload/upload.ts +1 -1
- package/src/components/form/inputs/Upload/useFileUpload.ts +6 -6
- package/src/components/form/useBagelFormState.ts +5 -5
- package/src/components/layout/AppContent.vue +1 -1
- package/src/components/layout/AppLayout.vue +1 -1
- package/src/components/layout/Layout.vue +4 -4
- package/src/components/layout/TabbedLayout.vue +1 -1
- package/src/components/layout/Tabs.vue +2 -2
- package/src/components/layout/TabsNav.vue +7 -7
- package/src/components/lightbox/Lightbox.vue +8 -8
- package/src/components/lightbox/index.ts +8 -8
- package/src/composables/index.ts +2 -2
- package/src/composables/useAddToCalendar.ts +13 -13
- package/src/composables/useDevice.ts +2 -2
- package/src/composables/useExcel.ts +6 -6
- package/src/composables/useFormField.ts +5 -9
- package/src/composables/usePolling.ts +8 -8
- package/src/composables/useSchemaField.ts +53 -38
- package/src/composables/useTheme.ts +9 -9
- package/src/composables/useValidateFieldValue.ts +2 -2
- package/src/directives/pattern.ts +25 -25
- package/src/directives/ripple.ts +4 -4
- package/src/directives/vResize.ts +6 -6
- package/src/plugins/bagel.ts +4 -4
- package/src/plugins/useModal.ts +3 -3
- package/src/styles/layout.css +7 -1
- package/src/utils/BagelFormUtils.ts +7 -7
- package/src/utils/calendar/Helpers.ts +8 -8
- package/src/utils/calendar/dateUtils.ts +22 -22
- package/src/utils/calendar/time.ts +25 -25
- package/src/utils/calendar/week.ts +25 -25
- package/src/utils/elementUtils.ts +27 -27
- package/src/utils/index.ts +22 -22
- package/src/utils/sizeParsing.ts +2 -2
- package/src/utils/strings.ts +5 -5
- package/src/utils/tapDetector.ts +11 -11
- package/src/utils/useSearch.ts +29 -29
- package/vite.config.ts +1 -1
package/src/utils/strings.ts
CHANGED
|
@@ -2,26 +2,26 @@ export function formatString(
|
|
|
2
2
|
str: string,
|
|
3
3
|
format: 'pascal' | 'camel' | 'snake' | 'titleCase',
|
|
4
4
|
): string {
|
|
5
|
-
if (
|
|
5
|
+
if ('titleCase' === format) {
|
|
6
6
|
return str
|
|
7
7
|
.split('_')
|
|
8
8
|
.map(word => word[0].toUpperCase() + word.slice(1).toLocaleLowerCase())
|
|
9
9
|
.join(' ')
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
if (
|
|
12
|
+
if ('pascal' === format) {
|
|
13
13
|
return str
|
|
14
14
|
.split('_')
|
|
15
15
|
.map(word => word[0].toUpperCase() + word.slice(1).toLocaleLowerCase())
|
|
16
16
|
.join('')
|
|
17
17
|
}
|
|
18
|
-
if (
|
|
18
|
+
if ('camel' === format) {
|
|
19
19
|
return str
|
|
20
20
|
.split('_')
|
|
21
|
-
.map((word, index) => (
|
|
21
|
+
.map((word, index) => (0 === index ? word : word[0].toUpperCase() + word.slice(1)))
|
|
22
22
|
.join('')
|
|
23
23
|
}
|
|
24
|
-
if (
|
|
24
|
+
if ('snake' === format) {
|
|
25
25
|
return [...str]
|
|
26
26
|
.map((letter) => {
|
|
27
27
|
if (letter === letter.toUpperCase()) {
|
package/src/utils/tapDetector.ts
CHANGED
|
@@ -34,37 +34,37 @@ export default class TapDetector {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
onSingleTap(callback: TapCallback): void {
|
|
37
|
-
if (typeof callback
|
|
37
|
+
if ('function' === typeof callback && !this.singleTapCallbacks.includes(callback)) {
|
|
38
38
|
this.singleTapCallbacks.push(callback)
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
onDoubleTap(callback: TapCallback): void {
|
|
43
|
-
if (typeof callback
|
|
43
|
+
if ('function' === typeof callback && !this.doubleTapCallbacks.includes(callback)) {
|
|
44
44
|
this.doubleTapCallbacks.push(callback)
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
private triggerCallbacks(callbackType: CallbackType, event: { clientX: number, clientY: number }): void {
|
|
49
|
-
const callbacks =
|
|
49
|
+
const callbacks = 'single' === callbackType ? this.singleTapCallbacks : this.doubleTapCallbacks
|
|
50
50
|
callbacks.forEach((callback) => { callback(event) })
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
private onTouchStart = (event: TouchEvent): void => {
|
|
54
54
|
this.isTouchMode = true
|
|
55
|
-
if (event.touches.length
|
|
55
|
+
if (1 === event.touches.length) {
|
|
56
56
|
this.onPointerDown(event.touches[0].clientX, event.touches[0].clientY)
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
private onTouchMove = (event: TouchEvent): void => {
|
|
61
|
-
if (event.touches.length
|
|
61
|
+
if (1 === event.touches.length) {
|
|
62
62
|
this.onPointerMove(event.touches[0].clientX, event.touches[0].clientY)
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
private onTouchEnd = (): void => {
|
|
67
|
-
if (this.isTouchMode) this.onPointerUp()
|
|
67
|
+
if (this.isTouchMode) {this.onPointerUp()}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
private onMouseDown = (event: MouseEvent): void => {
|
|
@@ -74,13 +74,13 @@ export default class TapDetector {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
private onMouseMove = (event: MouseEvent): void => {
|
|
77
|
-
if (!this.isTouchMode && event.button
|
|
77
|
+
if (!this.isTouchMode && 0 === event.button) {
|
|
78
78
|
this.onPointerMove(event.clientX, event.clientY)
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
private onMouseUp = (): void => {
|
|
83
|
-
if (!this.isTouchMode) this.onPointerUp()
|
|
83
|
+
if (!this.isTouchMode) {this.onPointerUp()}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
private onPointerDown(x: number, y: number): void {
|
|
@@ -91,8 +91,8 @@ export default class TapDetector {
|
|
|
91
91
|
|
|
92
92
|
private onPointerUp(): void {
|
|
93
93
|
const currTimeStamp = Date.now()
|
|
94
|
-
if (this.touchMovedLength
|
|
95
|
-
if (currTimeStamp - this.lastTapTimestamp
|
|
94
|
+
if (10 > this.touchMovedLength) {
|
|
95
|
+
if (300 > currTimeStamp - this.lastTapTimestamp) {
|
|
96
96
|
this.tappedCount++
|
|
97
97
|
} else {
|
|
98
98
|
this.tappedCount = 1
|
|
@@ -101,7 +101,7 @@ export default class TapDetector {
|
|
|
101
101
|
this.lastTapTimestamp = currTimeStamp
|
|
102
102
|
this.triggerCallbacks('single', { clientX: this.lastPointerX, clientY: this.lastPointerY })
|
|
103
103
|
|
|
104
|
-
if (this.tappedCount
|
|
104
|
+
if (2 === this.tappedCount) {
|
|
105
105
|
this.triggerCallbacks('double', { clientX: this.lastPointerX, clientY: this.lastPointerY })
|
|
106
106
|
this.tappedCount = 0
|
|
107
107
|
}
|
package/src/utils/useSearch.ts
CHANGED
|
@@ -17,7 +17,7 @@ const htmlReplacers = {
|
|
|
17
17
|
* @returns Plain text without HTML tags
|
|
18
18
|
*/
|
|
19
19
|
export function clearHtml(value?: string) {
|
|
20
|
-
if (!value) return ''
|
|
20
|
+
if (!value) {return ''}
|
|
21
21
|
return Object.entries(htmlReplacers)
|
|
22
22
|
.reduce(
|
|
23
23
|
(
|
|
@@ -52,7 +52,7 @@ function getValueByPath(obj: any, path: string): any {
|
|
|
52
52
|
let result = obj
|
|
53
53
|
|
|
54
54
|
for (const key of keys) {
|
|
55
|
-
if (
|
|
55
|
+
if (null === result || result === undefined || 'object' !== typeof result) {
|
|
56
56
|
return undefined
|
|
57
57
|
}
|
|
58
58
|
result = result[key]
|
|
@@ -71,7 +71,7 @@ function getValueByPath(obj: any, path: string): any {
|
|
|
71
71
|
function calculateRelevance(stringValue: string, searchTerms: string[]): number {
|
|
72
72
|
let score = 0
|
|
73
73
|
|
|
74
|
-
if (stringValue.length
|
|
74
|
+
if (0 === stringValue.length) {return 0}
|
|
75
75
|
|
|
76
76
|
// Track matched character count for density calculation
|
|
77
77
|
let totalMatchedChars = 0
|
|
@@ -138,7 +138,7 @@ export interface SearchResult<T> {
|
|
|
138
138
|
* @returns True if the value is a primitive
|
|
139
139
|
*/
|
|
140
140
|
function isPrimitive(value: any): boolean {
|
|
141
|
-
return
|
|
141
|
+
return 'string' === typeof value || 'number' === typeof value || 'boolean' === typeof value
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
/**
|
|
@@ -147,10 +147,10 @@ function isPrimitive(value: any): boolean {
|
|
|
147
147
|
* @returns String representation or empty string if value can't be converted
|
|
148
148
|
*/
|
|
149
149
|
function toSearchableString(value: any): string {
|
|
150
|
-
if (
|
|
151
|
-
if (typeof value
|
|
152
|
-
if (
|
|
153
|
-
if (typeof value
|
|
150
|
+
if (null === value || value === undefined) {return ''}
|
|
151
|
+
if ('string' === typeof value) {return clearHtml(value)}
|
|
152
|
+
if ('number' === typeof value || 'boolean' === typeof value) {return String(value)}
|
|
153
|
+
if ('object' === typeof value && value instanceof Date) {return value.toISOString()}
|
|
154
154
|
return ''
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -168,14 +168,14 @@ export function searchItems<T>(params: SearchItemParams<T>): T[] {
|
|
|
168
168
|
const itemsArray = toValue(items) || []
|
|
169
169
|
|
|
170
170
|
// Return all items if search is empty or doesn't meet minimum character threshold
|
|
171
|
-
if (!searchValue || searchValue.length < minChars) return itemsArray
|
|
171
|
+
if (!searchValue || searchValue.length < minChars) {return itemsArray}
|
|
172
172
|
|
|
173
173
|
// Split search term into individual words for better matching
|
|
174
174
|
const searchTerms = normalizeText(searchValue)
|
|
175
175
|
.split(/\s+/)
|
|
176
|
-
.filter(term => term.length
|
|
176
|
+
.filter(term => 1 < term.length)
|
|
177
177
|
|
|
178
|
-
if (searchTerms.length
|
|
178
|
+
if (0 === searchTerms.length) {return itemsArray}
|
|
179
179
|
|
|
180
180
|
// ---- Field weight configuration ----
|
|
181
181
|
// Default field weights for common fields
|
|
@@ -209,7 +209,7 @@ export function searchItems<T>(params: SearchItemParams<T>): T[] {
|
|
|
209
209
|
// First check custom weights
|
|
210
210
|
if (path in fieldWeights) {
|
|
211
211
|
const customWeight = fieldWeights[path]
|
|
212
|
-
if (typeof customWeight
|
|
212
|
+
if ('number' === typeof customWeight) {
|
|
213
213
|
return customWeight
|
|
214
214
|
}
|
|
215
215
|
}
|
|
@@ -231,13 +231,13 @@ export function searchItems<T>(params: SearchItemParams<T>): T[] {
|
|
|
231
231
|
* @returns Array of flattened key paths
|
|
232
232
|
*/
|
|
233
233
|
function collectAllKeys(obj: any, prefix = ''): string[] {
|
|
234
|
-
if (!obj || typeof obj
|
|
234
|
+
if (!obj || 'object' !== typeof obj) {return []}
|
|
235
235
|
|
|
236
236
|
return Object.keys(obj).flatMap((key) => {
|
|
237
237
|
const value = obj[key]
|
|
238
238
|
const newPrefix = prefix ? `${prefix}.${key}` : key
|
|
239
239
|
|
|
240
|
-
if (value && typeof value
|
|
240
|
+
if (value && 'object' === typeof value && !Array.isArray(value)) {
|
|
241
241
|
// Recurse for nested objects
|
|
242
242
|
return [newPrefix, ...collectAllKeys(value, newPrefix)]
|
|
243
243
|
}
|
|
@@ -281,7 +281,7 @@ export function searchItems<T>(params: SearchItemParams<T>): T[] {
|
|
|
281
281
|
const value = getValueByPath(item, String(keyPath))
|
|
282
282
|
|
|
283
283
|
// Skip null/undefined values
|
|
284
|
-
if (
|
|
284
|
+
if (null === value || value === undefined) {continue}
|
|
285
285
|
|
|
286
286
|
// CASE 3.1: Handle array field values
|
|
287
287
|
if (Array.isArray(value)) {
|
|
@@ -299,7 +299,7 @@ export function searchItems<T>(params: SearchItemParams<T>): T[] {
|
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
// CASE 3.2: Handle object fields (skip and process their properties separately)
|
|
302
|
-
if (typeof value
|
|
302
|
+
if ('object' === typeof value && !isPrimitive(value)) {
|
|
303
303
|
continue
|
|
304
304
|
}
|
|
305
305
|
|
|
@@ -322,19 +322,19 @@ export function searchItems<T>(params: SearchItemParams<T>): T[] {
|
|
|
322
322
|
})
|
|
323
323
|
|
|
324
324
|
// Filter items with non-zero relevance
|
|
325
|
-
const nonZeroItems = scoredItems.filter(([, score]) =>
|
|
325
|
+
const nonZeroItems = scoredItems.filter(([, score]) => 0 < score)
|
|
326
326
|
|
|
327
327
|
// Apply dynamic threshold based on score distribution
|
|
328
328
|
let filteredItems = nonZeroItems
|
|
329
|
-
if (nonZeroItems.length
|
|
329
|
+
if (0 < nonZeroItems.length) {
|
|
330
330
|
const maxScore = Math.max(...nonZeroItems.map(([, score]) => score))
|
|
331
331
|
|
|
332
332
|
// If we have very high relevance items, filter out low relevance noise
|
|
333
|
-
if (
|
|
333
|
+
if (5 < maxScore) {
|
|
334
334
|
// Items below 25% of max score are considered low relevance
|
|
335
335
|
const threshold = maxScore * 0.25
|
|
336
336
|
filteredItems = nonZeroItems.filter(([, score]) => score >= threshold)
|
|
337
|
-
} else if (
|
|
337
|
+
} else if (2 < maxScore) {
|
|
338
338
|
// For medium relevance results, use a lower threshold
|
|
339
339
|
const threshold = maxScore * 0.15
|
|
340
340
|
filteredItems = nonZeroItems.filter(([, score]) => score >= threshold)
|
|
@@ -384,8 +384,8 @@ export function useSearch<T>(
|
|
|
384
384
|
// Check if first argument is an array or ref (simplified usage)
|
|
385
385
|
// If it's a params object, it won't have these characteristics
|
|
386
386
|
const isArray = Array.isArray(paramsOrItems)
|
|
387
|
-
const isFunction = typeof paramsOrItems
|
|
388
|
-
const isObject = typeof paramsOrItems
|
|
387
|
+
const isFunction = 'function' === typeof paramsOrItems
|
|
388
|
+
const isObject = 'object' === typeof paramsOrItems && null !== paramsOrItems
|
|
389
389
|
const isRef = isObject && 'value' in paramsOrItems && !('items' in paramsOrItems)
|
|
390
390
|
|
|
391
391
|
const isSimplifiedUsage = isArray || isFunction || isRef
|
|
@@ -416,14 +416,14 @@ export function useSearch<T>(
|
|
|
416
416
|
() => toValue(searchTerm),
|
|
417
417
|
async (newTerm) => {
|
|
418
418
|
// Clear previous timeout if it exists
|
|
419
|
-
if (
|
|
419
|
+
if (null !== debounceTimeout) {
|
|
420
420
|
clearTimeout(debounceTimeout)
|
|
421
421
|
}
|
|
422
422
|
|
|
423
|
-
const term = typeof newTerm
|
|
423
|
+
const term = 'string' === typeof newTerm ? newTerm : ''
|
|
424
424
|
|
|
425
425
|
// Allow initial/default fetch when minChars === 0 (including empty term)
|
|
426
|
-
if (term.length < minChars &&
|
|
426
|
+
if (term.length < minChars && 0 < minChars) {
|
|
427
427
|
serverResults.value = []
|
|
428
428
|
return
|
|
429
429
|
}
|
|
@@ -454,11 +454,11 @@ export function useSearch<T>(
|
|
|
454
454
|
|
|
455
455
|
// If using server-side search
|
|
456
456
|
if (serverSearch) {
|
|
457
|
-
if (term && typeof term
|
|
457
|
+
if (term && 'string' === typeof term && term.length >= minChars) {
|
|
458
458
|
return serverResults.value as T[]
|
|
459
459
|
}
|
|
460
460
|
// If minChars is 0, allow default server results when empty
|
|
461
|
-
if (
|
|
461
|
+
if (0 === minChars) {return serverResults.value as T[]}
|
|
462
462
|
}
|
|
463
463
|
|
|
464
464
|
// Otherwise use client-side filtering
|
|
@@ -467,10 +467,10 @@ export function useSearch<T>(
|
|
|
467
467
|
// Create computed references
|
|
468
468
|
const results = computed(() => getFilteredResults())
|
|
469
469
|
const resultCount = computed(() => results.value.length)
|
|
470
|
-
const hasResults = computed(() => resultCount.value
|
|
470
|
+
const hasResults = computed(() => 0 < resultCount.value)
|
|
471
471
|
const isSearching = computed(() => {
|
|
472
472
|
const term = getSearchTermValue()
|
|
473
|
-
return !!term && typeof term
|
|
473
|
+
return !!term && 'string' === typeof term && term.length >= minChars
|
|
474
474
|
})
|
|
475
475
|
|
|
476
476
|
const result: SearchResult<T> = {
|
package/vite.config.ts
CHANGED
|
@@ -28,7 +28,7 @@ export default defineConfig(() => ({
|
|
|
28
28
|
lib: {
|
|
29
29
|
entry: resolve(indexDir, 'index.ts'),
|
|
30
30
|
formats: ['es', 'cjs'],
|
|
31
|
-
fileName: (module, entry) => `${entry}.${
|
|
31
|
+
fileName: (module, entry) => `${entry}.${ 'es' === module ? 'mjs' : module}`,
|
|
32
32
|
cssFileName: 'style',
|
|
33
33
|
},
|
|
34
34
|
rollupOptions: {
|