@bagelink/vue 1.0.24 → 1.0.30
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/AddressSearch.vue.d.ts +3 -0
- package/dist/components/AddressSearch.vue.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.vue.d.ts.map +1 -1
- package/dist/components/DataTable/tableTypes.d.ts +9 -9
- package/dist/components/DataTable/tableTypes.d.ts.map +1 -1
- package/dist/components/DataTable/useTableData.d.ts +10 -5
- package/dist/components/DataTable/useTableData.d.ts.map +1 -1
- package/dist/components/DropDown.vue.d.ts +2 -1
- package/dist/components/DropDown.vue.d.ts.map +1 -1
- package/dist/components/Icon/Icon.vue.d.ts.map +1 -1
- package/dist/components/Spreadsheet/Index.vue.d.ts.map +1 -1
- package/dist/components/form/BagelForm.vue.d.ts +1 -0
- package/dist/components/form/BagelForm.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/CheckInput.vue.d.ts +22 -30
- package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/ColorInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DateInput.vue.d.ts +1 -0
- package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DatePick.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/NumberInput.vue.d.ts +1 -1
- package/dist/components/form/inputs/NumberInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/PasswordInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts +15 -6
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TelInput.vue.d.ts.map +1 -1
- package/dist/components/layout/TabsNav.vue.d.ts.map +1 -1
- package/dist/composables/index.d.ts +2 -2
- package/dist/composables/index.d.ts.map +1 -1
- package/dist/index.cjs +287 -243
- package/dist/index.mjs +287 -243
- package/dist/style.css +232 -142
- package/dist/types/TableSchema.d.ts +2 -2
- package/dist/types/TableSchema.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/timeAgo.d.ts +1 -1
- package/dist/utils/timeAgo.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/DataPreview.vue +1 -1
- package/src/components/DataTable/DataTable.vue +6 -9
- package/src/components/DataTable/tableTypes.ts +10 -10
- package/src/components/DataTable/useTableData.ts +25 -10
- package/src/components/Dropdown.vue +3 -1
- package/src/components/Icon/Icon.vue +1 -1
- package/src/components/Modal.vue +1 -1
- package/src/components/Spreadsheet/Index.vue +1 -0
- package/src/components/form/BagelForm.vue +5 -3
- package/src/components/form/inputs/CheckInput.vue +7 -7
- package/src/components/form/inputs/ColorInput.vue +33 -5
- package/src/components/form/inputs/DateInput.vue +14 -33
- package/src/components/form/inputs/DatePick.vue +10 -27
- package/src/components/form/inputs/NumberInput.vue +1 -1
- package/src/components/form/inputs/PasswordInput.vue +1 -2
- package/src/components/form/inputs/SelectInput.vue +4 -1
- package/src/components/form/inputs/TelInput.vue +1 -2
- package/src/components/layout/TabsNav.vue +15 -6
- package/src/composables/index.ts +5 -5
- package/src/styles/inputs.css +1 -0
- package/src/styles/layout.css +45 -0
- package/src/styles/mobilLayout.css +45 -0
- package/src/styles/theme.css +13 -0
- package/src/types/TableSchema.ts +2 -2
- package/src/utils/index.ts +3 -3
- package/src/utils/timeAgo.ts +87 -25
package/src/composables/index.ts
CHANGED
|
@@ -6,12 +6,12 @@ import { ref, watch } from 'vue'
|
|
|
6
6
|
|
|
7
7
|
interface useBglSchemaParamsT<T> {
|
|
8
8
|
schema?: BglFormSchemaFnT<T>
|
|
9
|
-
|
|
9
|
+
columns?: string[]
|
|
10
10
|
data?: any[]
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export function useBglSchema<T = { [key: string]: unknown }>(
|
|
14
|
-
{ schema,
|
|
14
|
+
{ schema, columns, data }: useBglSchemaParamsT<T> = {}
|
|
15
15
|
): BglFormSchemaT<T> {
|
|
16
16
|
let _schema = schema
|
|
17
17
|
if (typeof _schema === 'function') {
|
|
@@ -19,12 +19,12 @@ export function useBglSchema<T = { [key: string]: unknown }>(
|
|
|
19
19
|
}
|
|
20
20
|
if (_schema) {
|
|
21
21
|
return (
|
|
22
|
-
|
|
23
|
-
? _schema.filter(f =>
|
|
22
|
+
columns && columns.length > 0
|
|
23
|
+
? _schema.filter(f => columns.includes(f.id as string))
|
|
24
24
|
: _schema
|
|
25
25
|
) as BglFormSchemaT<T>
|
|
26
26
|
}
|
|
27
|
-
return getFallbackSchema(data,
|
|
27
|
+
return getFallbackSchema(data, columns)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export function localRef<T>(
|
package/src/styles/inputs.css
CHANGED
package/src/styles/layout.css
CHANGED
|
@@ -3083,6 +3083,46 @@
|
|
|
3083
3083
|
gap: 10rem;
|
|
3084
3084
|
}
|
|
3085
3085
|
|
|
3086
|
+
.gap-11 {
|
|
3087
|
+
gap: 11rem;
|
|
3088
|
+
}
|
|
3089
|
+
|
|
3090
|
+
.gap-12 {
|
|
3091
|
+
gap: 12rem;
|
|
3092
|
+
}
|
|
3093
|
+
|
|
3094
|
+
.gap-13 {
|
|
3095
|
+
gap: 13rem;
|
|
3096
|
+
}
|
|
3097
|
+
|
|
3098
|
+
.gap-14 {
|
|
3099
|
+
gap: 14rem;
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3102
|
+
.gap-15 {
|
|
3103
|
+
gap: 15rem;
|
|
3104
|
+
}
|
|
3105
|
+
|
|
3106
|
+
.gap-16 {
|
|
3107
|
+
gap: 16rem;
|
|
3108
|
+
}
|
|
3109
|
+
|
|
3110
|
+
.gap-17 {
|
|
3111
|
+
gap: 17rem;
|
|
3112
|
+
}
|
|
3113
|
+
|
|
3114
|
+
.gap-18 {
|
|
3115
|
+
gap: 18rem;
|
|
3116
|
+
}
|
|
3117
|
+
|
|
3118
|
+
.gap-19 {
|
|
3119
|
+
gap: 19rem;
|
|
3120
|
+
}
|
|
3121
|
+
|
|
3122
|
+
.gap-20 {
|
|
3123
|
+
gap: 20rem;
|
|
3124
|
+
}
|
|
3125
|
+
|
|
3086
3126
|
.gap-1-5 {
|
|
3087
3127
|
gap: 1.5rem;
|
|
3088
3128
|
}
|
|
@@ -3405,6 +3445,11 @@
|
|
|
3405
3445
|
flex-grow: 4;
|
|
3406
3446
|
}
|
|
3407
3447
|
|
|
3448
|
+
.flex-grow-9999 {
|
|
3449
|
+
flex-grow: 9999;
|
|
3450
|
+
}
|
|
3451
|
+
|
|
3452
|
+
|
|
3408
3453
|
.flex-shrink-4 {
|
|
3409
3454
|
flex-shrink: 4;
|
|
3410
3455
|
}
|
|
@@ -2368,6 +2368,47 @@
|
|
|
2368
2368
|
gap: 10rem;
|
|
2369
2369
|
}
|
|
2370
2370
|
|
|
2371
|
+
.m_gap-11 {
|
|
2372
|
+
gap: 11rem;
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
.m_gap-12 {
|
|
2376
|
+
gap: 12rem;
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
.m_gap-13 {
|
|
2380
|
+
gap: 13rem;
|
|
2381
|
+
}
|
|
2382
|
+
|
|
2383
|
+
.m_gap-14 {
|
|
2384
|
+
gap: 14rem;
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
.m_gap-15 {
|
|
2388
|
+
gap: 15rem;
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
.m_gap-16 {
|
|
2392
|
+
gap: 16rem;
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
.m_gap-17 {
|
|
2396
|
+
gap: 17rem;
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
.m_gap-18 {
|
|
2400
|
+
gap: 18rem;
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
.m_gap-19 {
|
|
2404
|
+
gap: 19rem;
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
.m_gap-20 {
|
|
2408
|
+
gap: 20rem;
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
|
|
2371
2412
|
.m_gap-1-5 {
|
|
2372
2413
|
gap: 1.5rem;
|
|
2373
2414
|
}
|
|
@@ -2690,6 +2731,10 @@
|
|
|
2690
2731
|
flex-grow: 4;
|
|
2691
2732
|
}
|
|
2692
2733
|
|
|
2734
|
+
.m_flex-grow-9999 {
|
|
2735
|
+
flex-grow: 9999;
|
|
2736
|
+
}
|
|
2737
|
+
|
|
2693
2738
|
.m_flex-shrink-4 {
|
|
2694
2739
|
flex-shrink: 4;
|
|
2695
2740
|
}
|
package/src/styles/theme.css
CHANGED
|
@@ -302,6 +302,19 @@
|
|
|
302
302
|
overflow: hidden;
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
+
.extraOptions {
|
|
306
|
+
max-height: 30px;
|
|
307
|
+
overflow: hidden;
|
|
308
|
+
transition: all 0.2s 30s ease;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
.extraOptions:hover {
|
|
313
|
+
max-height: 200vh;
|
|
314
|
+
transition: 0.2s all 0.2s ease;
|
|
315
|
+
|
|
316
|
+
}
|
|
317
|
+
|
|
305
318
|
@media screen and (max-width: 1000px) {
|
|
306
319
|
.entity-container {
|
|
307
320
|
grid-template-columns: minmax(22vw, 1fr) 2fr;
|
package/src/types/TableSchema.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type EmitOrderT = `${string} ${SortDirectionsT}`
|
|
|
7
7
|
export interface TableSchemaProps<T extends Record<string, any> = Record<string, any>> {
|
|
8
8
|
data: T[]
|
|
9
9
|
schema?: BglFormSchemaT<T> | (() => BglFormSchemaT<T>)
|
|
10
|
-
|
|
10
|
+
columns?: string[]
|
|
11
11
|
useServerSort?: boolean
|
|
12
12
|
selectable?: boolean
|
|
13
13
|
onLastItemVisible?: () => void
|
|
@@ -32,7 +32,7 @@ export interface TableVirtualizationOptions<T> {
|
|
|
32
32
|
export interface TableDataOptions<T> {
|
|
33
33
|
data: Ref<T[]> | ComputedRef<T[]>
|
|
34
34
|
schema?: BglFormSchemaT<T> | (() => BglFormSchemaT<T>)
|
|
35
|
-
|
|
35
|
+
columns?: string[]
|
|
36
36
|
sortField: string
|
|
37
37
|
sortDirection: SortDirectionsT
|
|
38
38
|
useServerSort?: boolean
|
package/src/utils/index.ts
CHANGED
|
@@ -91,7 +91,7 @@ export const isDate = (dateToTest: any) => !Number.isNaN(Date.parse(dateToTest))
|
|
|
91
91
|
|
|
92
92
|
export function getFallbackSchema<T>(
|
|
93
93
|
data?: any[],
|
|
94
|
-
|
|
94
|
+
columns?: string[]
|
|
95
95
|
): BglFormSchemaT<T> {
|
|
96
96
|
const keys = Array.from(new Set((data ?? []).flatMap(Object.keys)))
|
|
97
97
|
|
|
@@ -105,8 +105,8 @@ export function getFallbackSchema<T>(
|
|
|
105
105
|
},
|
|
106
106
|
})) as BglFormSchemaT<T>
|
|
107
107
|
|
|
108
|
-
return
|
|
109
|
-
? schema.filter(f =>
|
|
108
|
+
return columns
|
|
109
|
+
? schema.filter(f => columns.includes(f.id as string) || !f.id)
|
|
110
110
|
: schema
|
|
111
111
|
}
|
|
112
112
|
|
package/src/utils/timeAgo.ts
CHANGED
|
@@ -118,38 +118,100 @@ export function timeAgo(date: string | Date, lang: AvailableTimeLanguages = 'en'
|
|
|
118
118
|
return selectedLang.justNow as string
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
yyyy: { type: 'year', format: 'numeric' },
|
|
130
|
-
HH: { type: 'hour', format: '2-digit' },
|
|
131
|
-
hh: { type: 'hour', format: '2-digit' },
|
|
132
|
-
MM: { type: 'minute', format: '2-digit' },
|
|
133
|
-
ss: { type: 'second', format: '2-digit' },
|
|
134
|
-
ampm: { type: 'dayPeriod', format: 'short' }
|
|
135
|
-
} as const
|
|
136
|
-
|
|
137
|
-
export function formatDate(date?: string | Date, format: string = 'dd.mm.yy') {
|
|
121
|
+
function getBrowserNavigatorLocale(): string {
|
|
122
|
+
if (typeof navigator !== 'object') return 'en-US'
|
|
123
|
+
return navigator.languages && navigator.languages.length
|
|
124
|
+
? navigator.languages[0]
|
|
125
|
+
: navigator.language
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function formatDate(date?: string | Date, format: string = 'dd.mm.yy', locale?: string) {
|
|
138
129
|
if (!date) return ''
|
|
130
|
+
locale = locale || getBrowserNavigatorLocale()
|
|
139
131
|
try {
|
|
140
|
-
|
|
141
|
-
const
|
|
132
|
+
// Validate the date
|
|
133
|
+
const d = typeof date === 'string' ? new Date(date) : date
|
|
142
134
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
135
|
+
// Check if date is valid
|
|
136
|
+
if (Number.isNaN(d.getTime())) {
|
|
137
|
+
console.warn('Invalid date provided to formatDate:', date)
|
|
138
|
+
return ''
|
|
147
139
|
}
|
|
148
140
|
|
|
149
|
-
|
|
141
|
+
// Extract the separator from the format string
|
|
142
|
+
const separator = format.match(/[^\w\s]/)?.[0] || '.'
|
|
143
|
+
|
|
144
|
+
// Split by any non-alphanumeric character (except spaces)
|
|
145
|
+
const formatParts = format.split(/[^\w\s]/)
|
|
146
|
+
|
|
147
|
+
// Create a map of all date parts
|
|
148
|
+
const datePartsMap: Record<string, string> = {
|
|
149
|
+
dd: String(d.getDate()).padStart(2, '0'),
|
|
150
|
+
ddd: d.toLocaleString(locale, { weekday: 'short' }),
|
|
151
|
+
dddd: d.toLocaleString(locale, { weekday: 'long' }),
|
|
152
|
+
mm: String(d.getMonth() + 1).padStart(2, '0'),
|
|
153
|
+
mmm: d.toLocaleString(locale, { month: 'short' }),
|
|
154
|
+
mmmm: d.toLocaleString(locale, { month: 'long' }),
|
|
155
|
+
yy: String(d.getFullYear()).slice(-2),
|
|
156
|
+
yyyy: String(d.getFullYear()),
|
|
157
|
+
HH: String(d.getHours()).padStart(2, '0'),
|
|
158
|
+
MM: String(d.getMinutes()).padStart(2, '0'),
|
|
159
|
+
ss: String(d.getSeconds()).padStart(2, '0')
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// For more complex formats that need localization, use Intl.DateTimeFormat
|
|
163
|
+
const formatter = new Intl.DateTimeFormat(locale, {
|
|
164
|
+
weekday: 'long',
|
|
165
|
+
month: 'long',
|
|
166
|
+
day: 'numeric',
|
|
167
|
+
year: 'numeric',
|
|
168
|
+
hour: '2-digit',
|
|
169
|
+
minute: '2-digit',
|
|
170
|
+
second: '2-digit',
|
|
171
|
+
hour12: true
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
const formattedParts = formatter.formatToParts(d)
|
|
175
|
+
const partsMap: Record<string, string> = {}
|
|
176
|
+
|
|
177
|
+
formattedParts.forEach((part) => {
|
|
178
|
+
if (part.type !== 'literal') {
|
|
179
|
+
partsMap[part.type] = part.value
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
// Add localized formats to our map
|
|
184
|
+
if (partsMap.month) {
|
|
185
|
+
datePartsMap.mmm = partsMap.month.substring(0, 3)
|
|
186
|
+
datePartsMap.mmmm = partsMap.month
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (partsMap.weekday) {
|
|
190
|
+
datePartsMap.ddd = partsMap.weekday.substring(0, 3)
|
|
191
|
+
datePartsMap.dddd = partsMap.weekday
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (partsMap.dayPeriod) {
|
|
195
|
+
datePartsMap.ampm = partsMap.dayPeriod
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Build the formatted date string following the exact format pattern
|
|
199
|
+
let formattedDate = ''
|
|
200
|
+
for (let i = 0; i < formatParts.length; i++) {
|
|
201
|
+
const part = formatParts[i]
|
|
202
|
+
if (datePartsMap[part]) {
|
|
203
|
+
formattedDate += datePartsMap[part]
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Add separator between parts (except after the last part)
|
|
207
|
+
if (i < formatParts.length - 1) {
|
|
208
|
+
formattedDate += separator
|
|
209
|
+
}
|
|
210
|
+
}
|
|
150
211
|
|
|
151
|
-
return
|
|
212
|
+
return formattedDate
|
|
152
213
|
} catch (error) {
|
|
214
|
+
console.warn('Error formatting date', error)
|
|
153
215
|
return ''
|
|
154
216
|
}
|
|
155
217
|
}
|