@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
|
@@ -5,7 +5,7 @@ export type EmitOrderT = `${string} ${SortDirectionsT}`;
|
|
|
5
5
|
export interface TableSchemaProps<T extends Record<string, any> = Record<string, any>> {
|
|
6
6
|
data: T[];
|
|
7
7
|
schema?: BglFormSchemaT<T> | (() => BglFormSchemaT<T>);
|
|
8
|
-
|
|
8
|
+
columns?: string[];
|
|
9
9
|
useServerSort?: boolean;
|
|
10
10
|
selectable?: boolean;
|
|
11
11
|
onLastItemVisible?: () => void;
|
|
@@ -28,7 +28,7 @@ export interface TableVirtualizationOptions<T> {
|
|
|
28
28
|
export interface TableDataOptions<T> {
|
|
29
29
|
data: Ref<T[]> | ComputedRef<T[]>;
|
|
30
30
|
schema?: BglFormSchemaT<T> | (() => BglFormSchemaT<T>);
|
|
31
|
-
|
|
31
|
+
columns?: string[];
|
|
32
32
|
sortField: string;
|
|
33
33
|
sortDirection: SortDirectionsT;
|
|
34
34
|
useServerSort?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableSchema.d.ts","sourceRoot":"","sources":["../../src/types/TableSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,KAAK,CAAA;AAE3C,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,MAAM,CAAA;AAC5C,MAAM,MAAM,UAAU,GAAG,GAAG,MAAM,IAAI,eAAe,EAAE,CAAA;AAEvD,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACpF,IAAI,EAAE,CAAC,EAAE,CAAA;IACT,MAAM,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;IACtD,
|
|
1
|
+
{"version":3,"file":"TableSchema.d.ts","sourceRoot":"","sources":["../../src/types/TableSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,KAAK,CAAA;AAE3C,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,MAAM,CAAA;AAC5C,MAAM,MAAM,UAAU,GAAG,GAAG,MAAM,IAAI,eAAe,EAAE,CAAA;AAEvD,MAAM,WAAW,gBAAgB,CAAC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AAE,MAAM,CAAA;IACjB,aAAa,EAAE,eAAe,CAAA;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAA;CACvB"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare function denullify(itemData?: {
|
|
|
14
14
|
[key: string]: any;
|
|
15
15
|
}, fieldID?: string): any;
|
|
16
16
|
export declare const isDate: (dateToTest: any) => boolean;
|
|
17
|
-
export declare function getFallbackSchema<T>(data?: any[],
|
|
17
|
+
export declare function getFallbackSchema<T>(data?: any[], columns?: string[]): BglFormSchemaT<T>;
|
|
18
18
|
export declare function sleep(ms?: number): Promise<unknown>;
|
|
19
19
|
export declare function appendScript(src: string, options?: {
|
|
20
20
|
id?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAI/D,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,IAAI,GAAE,MAAY,QAO1D;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,UAMlC;AAED,wBAAgB,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ3D;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,iBAGtE;AAED,wBAAgB,QAAQ,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,UAG3C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,IAAI,QAIrE;AAED,wBAAgB,QAAQ,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,UAOpE;AAED,wBAAgB,SAA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AAE,MAAM,cAAc,CAAA;AAK5C,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,sBAO5C;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,GAAE,GAAe,GAAG,GAAG,CAa1F"}
|
package/dist/utils/timeAgo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type AvailableTimeLanguages = 'en' | 'es' | 'fr' | 'he';
|
|
2
2
|
export declare function timeAgo(date: string | Date, lang?: AvailableTimeLanguages): string;
|
|
3
|
-
export declare function formatDate(date?: string | Date, format?: string): string;
|
|
3
|
+
export declare function formatDate(date?: string | Date, format?: string, locale?: string): string;
|
|
4
4
|
export {};
|
|
5
5
|
//# sourceMappingURL=timeAgo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeAgo.d.ts","sourceRoot":"","sources":["../../src/utils/timeAgo.ts"],"names":[],"mappings":"AAWA,KAAK,sBAAsB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAqDvD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,GAAE,sBAA6B,UAsD/E;
|
|
1
|
+
{"version":3,"file":"timeAgo.d.ts","sourceRoot":"","sources":["../../src/utils/timeAgo.ts"],"names":[],"mappings":"AAWA,KAAK,sBAAsB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAqDvD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,GAAE,sBAA6B,UAsD/E;AASD,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,GAAE,MAAmB,EAAE,MAAM,CAAC,EAAE,MAAM,UAyF5F"}
|
package/package.json
CHANGED
|
@@ -38,6 +38,9 @@ const selectedItems = defineModel<string[]>(
|
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
const data = computed(() => props.data)
|
|
41
|
+
const schema = computed(() => props.schema)
|
|
42
|
+
const columns = computed(() => props.columns)
|
|
43
|
+
const useServerSort = computed(() => props.useServerSort)
|
|
41
44
|
|
|
42
45
|
const {
|
|
43
46
|
computedSchema,
|
|
@@ -45,15 +48,9 @@ const {
|
|
|
45
48
|
sortField,
|
|
46
49
|
sortDirection,
|
|
47
50
|
toggleSort
|
|
48
|
-
} = useTableData<T>({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
showFields: props.showFields,
|
|
52
|
-
useServerSort: props.useServerSort,
|
|
53
|
-
onSort: (field, direction) => {
|
|
54
|
-
emit('orderBy', `${field} ${direction}`.trim() as EmitOrderT)
|
|
55
|
-
}
|
|
56
|
-
})
|
|
51
|
+
} = useTableData<T>({ data, schema, columns, useServerSort, onSort: (field, direction) => {
|
|
52
|
+
emit('orderBy', `${field} ${direction}`.trim() as EmitOrderT)
|
|
53
|
+
} })
|
|
57
54
|
|
|
58
55
|
const {
|
|
59
56
|
computedSelectedItems,
|
|
@@ -6,12 +6,21 @@ export type EmitOrderT = `${string} ${SortDirectionsT}`
|
|
|
6
6
|
export interface TableSchemaProps<T extends Record<string, any> = Record<string, any>> {
|
|
7
7
|
data: T[]
|
|
8
8
|
schema?: BglFormSchemaT<T> | (() => BglFormSchemaT<T>)
|
|
9
|
-
|
|
9
|
+
columns?: string[]
|
|
10
10
|
useServerSort?: boolean
|
|
11
11
|
selectable?: boolean
|
|
12
12
|
onLastItemVisible?: () => void
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
export interface TableDataOptions<T> {
|
|
16
|
+
data: T[]
|
|
17
|
+
schema?: BglFormSchemaT<T> | (() => BglFormSchemaT<T>)
|
|
18
|
+
columns?: string[]
|
|
19
|
+
sortField: string
|
|
20
|
+
sortDirection: SortDirectionsT
|
|
21
|
+
useServerSort?: boolean
|
|
22
|
+
}
|
|
23
|
+
|
|
15
24
|
export interface SortingOptions<T> {
|
|
16
25
|
onSort: (field: string, direction: SortDirectionsT) => void
|
|
17
26
|
}
|
|
@@ -27,12 +36,3 @@ export interface TableVirtualizationOptions<T> {
|
|
|
27
36
|
itemHeight: number
|
|
28
37
|
onLastItemVisible?: () => void
|
|
29
38
|
}
|
|
30
|
-
|
|
31
|
-
export interface TableDataOptions<T> {
|
|
32
|
-
data: T[]
|
|
33
|
-
schema?: BglFormSchemaT<T> | (() => BglFormSchemaT<T>)
|
|
34
|
-
showFields?: string[]
|
|
35
|
-
sortField: string
|
|
36
|
-
sortDirection: SortDirectionsT
|
|
37
|
-
useServerSort?: boolean
|
|
38
|
-
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ComputedRef } from 'vue'
|
|
1
2
|
import type { TableDataOptions, SortDirectionsT } from '../../types/TableSchema'
|
|
2
3
|
import { useBglSchema, isDate } from '@bagelink/vue'
|
|
3
|
-
import { computed, ref } from 'vue'
|
|
4
|
+
import { computed, ref, watch } from 'vue'
|
|
4
5
|
|
|
5
6
|
const NON_DIGIT_REGEX = /[^\d.-]/g
|
|
6
7
|
|
|
@@ -10,7 +11,12 @@ const SLOT_VALUE_COMPONENTS = new Set(['div', 'span', 'p'])
|
|
|
10
11
|
// Components that should receive their value as src attribute
|
|
11
12
|
const SRC_VALUE_COMPONENTS = new Set(['img', 'iframe'])
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
// Extend the base options interface to include computed refs
|
|
15
|
+
export interface UseTableDataOptions<T> {
|
|
16
|
+
data: TableDataOptions<T>['data']
|
|
17
|
+
schema?: ComputedRef<TableDataOptions<T>['schema']> | TableDataOptions<T>['schema']
|
|
18
|
+
columns?: ComputedRef<string[] | undefined> | string[]
|
|
19
|
+
useServerSort?: ComputedRef<boolean | undefined> | boolean | undefined
|
|
14
20
|
onSort?: (field: string, direction: SortDirectionsT) => void
|
|
15
21
|
}
|
|
16
22
|
|
|
@@ -24,17 +30,24 @@ interface TransformedDataBase {
|
|
|
24
30
|
type TransformedData<T> = T & TransformedDataBase
|
|
25
31
|
|
|
26
32
|
export function useTableData<T extends Record<string, any>>(options: UseTableDataOptions<T>) {
|
|
27
|
-
// Create reactive reference to data prop
|
|
28
|
-
|
|
29
33
|
// Sorting state
|
|
30
34
|
const sortField = ref('')
|
|
31
35
|
const sortDirection = ref<SortDirectionsT>('ASC')
|
|
36
|
+
// Helper function to get the value from a possibly computed ref
|
|
37
|
+
function getValue<V>(value: ComputedRef<V> | V): V {
|
|
38
|
+
return (value as ComputedRef<V>).value !== undefined
|
|
39
|
+
? (value as ComputedRef<V>).value
|
|
40
|
+
: value as V
|
|
41
|
+
}
|
|
32
42
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
// Create a computed property for the schema that will react to changes in options.columns
|
|
44
|
+
const computedSchema = computed(() => {
|
|
45
|
+
return useBglSchema<T>({
|
|
46
|
+
schema: getValue(options.schema),
|
|
47
|
+
columns: getValue(options.columns),
|
|
48
|
+
data: options.data.value,
|
|
49
|
+
})
|
|
50
|
+
})
|
|
38
51
|
|
|
39
52
|
function transform(rowData: T): TransformedData<T> {
|
|
40
53
|
const transformed = { ...rowData } as TransformedData<T>
|
|
@@ -73,7 +86,9 @@ export function useTableData<T extends Record<string, any>>(options: UseTableDat
|
|
|
73
86
|
|
|
74
87
|
const computedData = computed(() => {
|
|
75
88
|
const currentData = options.data.value
|
|
76
|
-
|
|
89
|
+
const useServerSortValue = getValue(options.useServerSort)
|
|
90
|
+
|
|
91
|
+
if (!sortField.value || useServerSortValue === true) {
|
|
77
92
|
return currentData.map(transform)
|
|
78
93
|
}
|
|
79
94
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { IconType } from '@bagelink/vue'
|
|
2
|
+
import type { IconType, ThemeType } from '@bagelink/vue'
|
|
3
3
|
import type { TriggerEvent } from 'floating-vue'
|
|
4
4
|
import { Btn } from '@bagelink/vue'
|
|
5
5
|
import { Dropdown as DDown } from 'floating-vue'
|
|
@@ -29,6 +29,7 @@ const {
|
|
|
29
29
|
flat?: boolean
|
|
30
30
|
disabled?: boolean
|
|
31
31
|
icon?: IconType
|
|
32
|
+
color?: ThemeType
|
|
32
33
|
triggerClass?: string
|
|
33
34
|
iconEnd?: IconType
|
|
34
35
|
border?: boolean
|
|
@@ -111,6 +112,7 @@ defineExpose({ show, hide, shown })
|
|
|
111
112
|
:flat="flat"
|
|
112
113
|
:outline="outline"
|
|
113
114
|
:round="round"
|
|
115
|
+
:color="color"
|
|
114
116
|
/>
|
|
115
117
|
</slot>
|
|
116
118
|
<template #popper="{ hide, show }">
|
package/src/components/Modal.vue
CHANGED
|
@@ -88,7 +88,7 @@ onUnmounted(() => {
|
|
|
88
88
|
<Title v-if="title" class="modal-title" tag="h3" :label="title" />
|
|
89
89
|
</header>
|
|
90
90
|
|
|
91
|
-
<div v-else class="sticky
|
|
91
|
+
<div v-else class="sticky z-index-999 -mt-1 -ms-1 px-025 h-30px pt-025 modal-no-title">
|
|
92
92
|
<Btn
|
|
93
93
|
class="position-start"
|
|
94
94
|
icon="close"
|
|
@@ -9,13 +9,15 @@ export interface BagelFormProps<_T> {
|
|
|
9
9
|
modelValue?: _T
|
|
10
10
|
schema?: BglFormSchemaFnT<_T>
|
|
11
11
|
tag?: 'form' | 'template'
|
|
12
|
+
class?: string
|
|
12
13
|
onSubmit?: (data: _T) => Promise<void> | void
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
const props = withDefaults(defineProps<BagelFormProps<T>>(), {
|
|
16
17
|
modelValue: undefined,
|
|
17
18
|
schema: undefined,
|
|
18
|
-
tag: 'form'
|
|
19
|
+
tag: 'form',
|
|
20
|
+
class: ''
|
|
19
21
|
})
|
|
20
22
|
|
|
21
23
|
const emit = defineEmits<{
|
|
@@ -132,7 +134,7 @@ defineExpose({ form, isDirty, validateForm })
|
|
|
132
134
|
|
|
133
135
|
<template>
|
|
134
136
|
<template v-if="formState !== 'success' || !$slots.success">
|
|
135
|
-
<form v-if="props.tag === 'form'" ref="form" @submit.prevent="handleSubmit">
|
|
137
|
+
<form v-if="props.tag === 'form'" ref="form" :class="props.class" @submit.prevent="handleSubmit">
|
|
136
138
|
<template v-if="resolvedSchema">
|
|
137
139
|
<template v-for="field in (resolvedSchema as Field[])" :key="field.id">
|
|
138
140
|
<component :is="renderSchemaField(field)" />
|
|
@@ -143,7 +145,7 @@ defineExpose({ form, isDirty, validateForm })
|
|
|
143
145
|
</form>
|
|
144
146
|
<template v-else>
|
|
145
147
|
<template v-for="field in (resolvedSchema as Field[])" :key="field.id">
|
|
146
|
-
<component :is="renderSchemaField(field)" />
|
|
148
|
+
<component :is="renderSchemaField(field)" :class="props.class" />
|
|
147
149
|
</template>
|
|
148
150
|
</template>
|
|
149
151
|
</template>
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
1
|
+
<script setup lang="ts" generic="T extends boolean | undefined | any[]">
|
|
2
2
|
import { onMounted } from 'vue'
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const { defaultValue = false, id } = defineProps<{
|
|
5
5
|
label?: string
|
|
6
6
|
id?: string
|
|
7
7
|
title?: string
|
|
8
8
|
small?: boolean
|
|
9
9
|
required?: boolean
|
|
10
|
-
defaultValue?:
|
|
10
|
+
defaultValue?: T
|
|
11
11
|
value?: any
|
|
12
|
-
}>()
|
|
12
|
+
}>()
|
|
13
13
|
|
|
14
|
-
const inputId = $computed(() =>
|
|
14
|
+
const inputId = $computed(() => id || Math.random().toString(36).slice(7))
|
|
15
15
|
|
|
16
|
-
const checked = defineModel<
|
|
16
|
+
const checked = defineModel<T>('modelValue', { default: undefined })
|
|
17
17
|
|
|
18
18
|
onMounted(() => {
|
|
19
|
-
if (checked.value === undefined) checked.value =
|
|
19
|
+
if (checked.value === undefined) checked.value = defaultValue as T
|
|
20
20
|
})
|
|
21
21
|
</script>
|
|
22
22
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { Btn } from '@bagelink/vue'
|
|
2
3
|
import { watch } from 'vue'
|
|
3
4
|
|
|
4
5
|
const props = withDefaults(
|
|
@@ -26,13 +27,40 @@ watch(
|
|
|
26
27
|
</script>
|
|
27
28
|
|
|
28
29
|
<template>
|
|
29
|
-
<div class="bagel-input" :class="{ small }" :title="label">
|
|
30
|
+
<div class="bagel-input " :class="{ small }" :title="label">
|
|
30
31
|
<label>
|
|
31
32
|
{{ label }}
|
|
32
|
-
<input
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
<div class="flex bg-input rounded px-025 colorInputPickWrap">
|
|
34
|
+
<input
|
|
35
|
+
:id="id"
|
|
36
|
+
v-model="inputVal" class="border" type="color" :placeholder="placeholder || label"
|
|
37
|
+
:class="{ 'no-edit': !editMode, 'opacity-1': !inputVal }" :required="required" v-bind="nativeInputAttrs"
|
|
38
|
+
>
|
|
39
|
+
<input
|
|
40
|
+
v-model="inputVal"
|
|
41
|
+
class="flex-grow-4 border colorInputPick"
|
|
42
|
+
style="width: 50px"
|
|
43
|
+
type="text"
|
|
44
|
+
placeholder="Enter color"
|
|
45
|
+
>
|
|
46
|
+
<Btn :class="{ 'not-allowed opacity-3': !inputVal }" round flat thin icon="clear" @click="inputVal = ''" />
|
|
47
|
+
</div>
|
|
36
48
|
</label>
|
|
37
49
|
</div>
|
|
38
50
|
</template>
|
|
51
|
+
|
|
52
|
+
<style>
|
|
53
|
+
.colorInputPick{
|
|
54
|
+
--input-font-size: 12px;
|
|
55
|
+
height: calc(var(--input-height) - 9px) !important;
|
|
56
|
+
background: transparent !important;
|
|
57
|
+
}
|
|
58
|
+
.colorInputPick:focus{
|
|
59
|
+
outline: none;
|
|
60
|
+
box-shadow: none !important;
|
|
61
|
+
}
|
|
62
|
+
.colorInputPickWrap:focus-within {
|
|
63
|
+
box-shadow: inset 0 0 10px #00000021;
|
|
64
|
+
outline-color: var(--input-bg);
|
|
65
|
+
}
|
|
66
|
+
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { modeType } from '../../Calendar/typings/types'
|
|
3
|
-
import { Btn, NumberInput, Dropdown, TextInput } from '@bagelink/vue'
|
|
3
|
+
import { Btn, NumberInput, Dropdown, TextInput, formatDate } from '@bagelink/vue'
|
|
4
4
|
import { computed, ref, onMounted, onBeforeUnmount } from 'vue'
|
|
5
5
|
import Time, { WEEK_START_DAY } from '../../Calendar/helpers/Time'
|
|
6
6
|
|
|
@@ -20,6 +20,7 @@ const props = withDefaults(
|
|
|
20
20
|
max?: string | Date
|
|
21
21
|
timezone?: string
|
|
22
22
|
mode?: modeType
|
|
23
|
+
defaultValue?: string | Date
|
|
23
24
|
firstDayOfWeek?: WEEK_START_DAY
|
|
24
25
|
locale?: string
|
|
25
26
|
center?: boolean
|
|
@@ -49,28 +50,7 @@ const time = new Time(props.firstDayOfWeek, props.locale)
|
|
|
49
50
|
function useFormatting() {
|
|
50
51
|
const formatDisplayDate = (date: Date | string | undefined): string => {
|
|
51
52
|
if (!date) return ''
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const options: Intl.DateTimeFormatOptions = {
|
|
55
|
-
year: 'numeric',
|
|
56
|
-
month: 'short',
|
|
57
|
-
day: 'numeric',
|
|
58
|
-
...(props.enableTime && {
|
|
59
|
-
hour: '2-digit',
|
|
60
|
-
minute: '2-digit',
|
|
61
|
-
}),
|
|
62
|
-
timeZone: props.timezone
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return dateObj.toLocaleString(props.locale || undefined, options)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const formatDate = (date: Date | string | undefined): string => {
|
|
69
|
-
if (!date) return ''
|
|
70
|
-
const dateObj = typeof date === 'string' ? new Date(date) : date
|
|
71
|
-
return props.enableTime
|
|
72
|
-
? dateObj.toISOString().slice(0, 16)
|
|
73
|
-
: dateObj.toISOString().split('T')[0]
|
|
53
|
+
return formatDate(date, props.enableTime ? 'dd.mm.yy HH:MM' : 'dd.mm.yy')
|
|
74
54
|
}
|
|
75
55
|
|
|
76
56
|
const parseUserInput = (input: string): Date | null => {
|
|
@@ -97,7 +77,7 @@ function useFormatting() {
|
|
|
97
77
|
|
|
98
78
|
return {
|
|
99
79
|
formatDisplayDate,
|
|
100
|
-
|
|
80
|
+
|
|
101
81
|
parseUserInput
|
|
102
82
|
}
|
|
103
83
|
}
|
|
@@ -131,14 +111,15 @@ function useDateValidation() {
|
|
|
131
111
|
|
|
132
112
|
// Date state composable
|
|
133
113
|
function useDateState() {
|
|
134
|
-
const { formatDisplayDate
|
|
114
|
+
const { formatDisplayDate } = useFormatting()
|
|
135
115
|
|
|
136
116
|
const formattedDisplayValue = computed(() => formatDisplayDate(props.modelValue))
|
|
137
|
-
const formattedMin = computed(() => formatDate(props.min))
|
|
138
|
-
const formattedMax = computed(() => formatDate(props.max))
|
|
117
|
+
const formattedMin = computed(() => formatDate(props.min, props.enableTime ? 'dd.mm.yy HH:MM' : 'dd.mm.yy'))
|
|
118
|
+
const formattedMax = computed(() => formatDate(props.max, props.enableTime ? 'dd.mm.yy HH:MM' : 'dd.mm.yy'))
|
|
139
119
|
const selectedDate = computed(() => {
|
|
140
|
-
|
|
141
|
-
|
|
120
|
+
const value = props.modelValue || props.defaultValue
|
|
121
|
+
if (!value) return null
|
|
122
|
+
return typeof value === 'string' ? new Date(value) : value
|
|
142
123
|
})
|
|
143
124
|
|
|
144
125
|
return {
|
|
@@ -381,11 +362,9 @@ const { hours, minutes, handleHourInput, handleMinuteInput, timezoneDisplay } =
|
|
|
381
362
|
function selectDate(date: Date | null) {
|
|
382
363
|
if (!date || !props.editMode) return
|
|
383
364
|
|
|
384
|
-
// Create date in the target timezone
|
|
385
|
-
const tzOffset = new Date().getTimezoneOffset()
|
|
386
|
-
const newDate = new Date(date.getFullYear(), date.getMonth(), date.getDate())
|
|
387
|
-
|
|
388
365
|
if (props.enableTime) {
|
|
366
|
+
// Create date in the target timezone
|
|
367
|
+
const newDate = new Date(date.getFullYear(), date.getMonth(), date.getDate())
|
|
389
368
|
const currentHours = selectedDate.value?.getHours() ?? new Date().getHours()
|
|
390
369
|
const currentMinutes = selectedDate.value?.getMinutes() ?? new Date().getMinutes()
|
|
391
370
|
newDate.setHours(currentHours)
|
|
@@ -393,11 +372,13 @@ function selectDate(date: Date | null) {
|
|
|
393
372
|
|
|
394
373
|
// Adjust for timezone when time is enabled
|
|
395
374
|
if (props.timezone === 'UTC') {
|
|
375
|
+
const tzOffset = new Date().getTimezoneOffset()
|
|
396
376
|
newDate.setMinutes(newDate.getMinutes() + tzOffset)
|
|
397
377
|
}
|
|
398
378
|
emit('update:modelValue', newDate.toISOString())
|
|
399
379
|
} else {
|
|
400
380
|
// For date-only selection, ensure we're working with UTC midnight
|
|
381
|
+
// This ensures the date displayed matches the date selected regardless of timezone
|
|
401
382
|
const utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()))
|
|
402
383
|
emit('update:modelValue', utcDate.toISOString().split('T')[0])
|
|
403
384
|
isOpen.value = false
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { modeType } from '../../Calendar/typings/types'
|
|
3
|
-
import { Btn, NumberInput, Dropdown } from '@bagelink/vue'
|
|
3
|
+
import { Btn, NumberInput, Dropdown, formatDate } from '@bagelink/vue'
|
|
4
4
|
import Time, { WEEK_START_DAY } from '../../Calendar/helpers/Time'
|
|
5
5
|
|
|
6
6
|
const props = withDefaults(
|
|
@@ -41,36 +41,19 @@ const time = new Time(props.firstDayOfWeek, props.locale)
|
|
|
41
41
|
|
|
42
42
|
function formatDisplayDate(date: Date | string | undefined): string {
|
|
43
43
|
if (!date) return ''
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (props.enableTime) {
|
|
47
|
-
return dateObj.toLocaleString(props.locale || undefined, {
|
|
48
|
-
year: 'numeric',
|
|
49
|
-
month: 'short',
|
|
50
|
-
day: 'numeric',
|
|
51
|
-
hour: '2-digit',
|
|
52
|
-
minute: '2-digit',
|
|
53
|
-
timeZone: props.timezone
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return dateObj.toLocaleString(props.locale || undefined, {
|
|
58
|
-
year: 'numeric',
|
|
59
|
-
month: 'short',
|
|
60
|
-
day: 'numeric',
|
|
61
|
-
timeZone: props.timezone
|
|
62
|
-
})
|
|
44
|
+
console.log('date', date)
|
|
45
|
+
return formatDate(date, props.enableTime ? 'dd.mm.yy HH:MM' : 'dd.mm.yy', props.locale)
|
|
63
46
|
}
|
|
64
47
|
|
|
65
|
-
function formatDate(date: Date | string | undefined): string {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
48
|
+
// function formatDate(date: Date | string | undefined): string {
|
|
49
|
+
// if (!date) return ''
|
|
50
|
+
// const dateObj = typeof date === 'string' ? new Date(date) : date
|
|
51
|
+
// return props.enableTime ? dateObj.toISOString().slice(0, 16) : dateObj.toISOString().split('T')[0]
|
|
52
|
+
// }
|
|
70
53
|
|
|
71
54
|
const formattedDisplayValue = $computed(() => formatDisplayDate(props.modelValue))
|
|
72
|
-
const formattedMin = $computed(() => formatDate(props.min))
|
|
73
|
-
const formattedMax = $computed(() => formatDate(props.max))
|
|
55
|
+
const formattedMin = $computed(() => formatDate(props.min, props.enableTime ? 'dd.mm.yy HH:MM' : 'dd.mm.yy'))
|
|
56
|
+
const formattedMax = $computed(() => formatDate(props.max, props.enableTime ? 'dd.mm.yy HH:MM' : 'dd.mm.yy'))
|
|
74
57
|
|
|
75
58
|
const selectedDate = $computed(() => {
|
|
76
59
|
if (!props.modelValue) return null
|
|
@@ -37,8 +37,7 @@ const props = withDefaults(
|
|
|
37
37
|
const password = defineModel<string>('modelValue')
|
|
38
38
|
const showPwd = defineModel<boolean>('showPwd', { default: false })
|
|
39
39
|
|
|
40
|
-
const toggleShowPwdIcon = $computed(() => showPwd.value ? 'visibility_off' : 'visibility'
|
|
41
|
-
)
|
|
40
|
+
const toggleShowPwdIcon = $computed(() => showPwd.value ? 'visibility_off' : 'visibility')
|
|
42
41
|
const inputType = $computed(() => (showPwd.value ? 'text' : 'password'))
|
|
43
42
|
</script>
|
|
44
43
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import type { IconType, Option } from '@bagelink/vue'
|
|
3
|
+
import type { AlignedPlacement } from '../../Dropdown.vue'
|
|
3
4
|
import {
|
|
4
5
|
Btn,
|
|
5
6
|
Card,
|
|
@@ -26,12 +27,14 @@ interface PropTypes {
|
|
|
26
27
|
hideLabel?: boolean
|
|
27
28
|
defaultValue?: Option
|
|
28
29
|
clearable?: boolean
|
|
30
|
+
placement?: AlignedPlacement
|
|
29
31
|
searchPlaceholder?: string
|
|
30
32
|
onSearch?: (search: string) => Promise<Option[]>
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
const props = withDefaults(defineProps<PropTypes>(), {
|
|
34
36
|
placeholder: 'Select',
|
|
37
|
+
placement: 'bottom-start',
|
|
35
38
|
})
|
|
36
39
|
|
|
37
40
|
const emit = defineEmits(['update:modelValue']) // Add 'search' event
|
|
@@ -229,7 +232,7 @@ onMounted(() => {
|
|
|
229
232
|
<Dropdown
|
|
230
233
|
ref="dropdown"
|
|
231
234
|
v-model:shown="open"
|
|
232
|
-
placement="
|
|
235
|
+
:placement="placement"
|
|
233
236
|
class="bagel-input selectinput"
|
|
234
237
|
no-auto-focus
|
|
235
238
|
>
|
|
@@ -396,7 +396,7 @@ onMounted(initializeCountry)
|
|
|
396
396
|
v-for="(pb, index) in sortedCountries"
|
|
397
397
|
:key="pb.iso2 + isPreferred(pb)"
|
|
398
398
|
role="option"
|
|
399
|
-
class="flex gap-075"
|
|
399
|
+
class="flex gap-075 pointer hover"
|
|
400
400
|
tabindex="-1"
|
|
401
401
|
:aria-selected="activeCountryCode === pb.iso2 && !isPreferred(pb)
|
|
402
402
|
"
|
|
@@ -425,7 +425,6 @@ onMounted(initializeCountry)
|
|
|
425
425
|
:disabled="disabled"
|
|
426
426
|
type="tel"
|
|
427
427
|
:autocomplete="autocomplete"
|
|
428
|
-
class="vti__input"
|
|
429
428
|
:pattern="computedInputOptions.pattern"
|
|
430
429
|
:minlength="computedInputOptions.minlength"
|
|
431
430
|
:maxlength="computedInputOptions.maxlength"
|
|
@@ -31,14 +31,15 @@ const tabsWrap = ref<HTMLElement | undefined>(undefined)
|
|
|
31
31
|
const tabs = ref<HTMLElement[]>([])
|
|
32
32
|
|
|
33
33
|
function updateIndicator() {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
nextTick(() => {
|
|
35
|
+
if (!tabsWrap.value) return
|
|
36
|
+
const activeTab = tabs.value.find(tab => tab.classList.contains('active'))
|
|
37
|
+
if (activeTab) {
|
|
38
|
+
const { offsetLeft, offsetWidth } = activeTab
|
|
39
|
+
tabsWrap.value.style.setProperty('--indicator-left', `${offsetLeft}px`)
|
|
39
40
|
tabsWrap.value.style.setProperty('--indicator-width', `${offsetWidth}px`)
|
|
40
41
|
}
|
|
41
|
-
}
|
|
42
|
+
})
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
function selectTab(tab: TabType | string) {
|
|
@@ -71,6 +72,14 @@ onMounted(() => {
|
|
|
71
72
|
updateIndicator()
|
|
72
73
|
window.addEventListener('resize', updateIndicator)
|
|
73
74
|
})
|
|
75
|
+
|
|
76
|
+
watch(
|
|
77
|
+
() => tabs.value,
|
|
78
|
+
() => {
|
|
79
|
+
nextTick(() => { updateIndicator() })
|
|
80
|
+
},
|
|
81
|
+
{ deep: true }
|
|
82
|
+
)
|
|
74
83
|
onBeforeUnmount(() => {
|
|
75
84
|
window.removeEventListener('resize', updateIndicator)
|
|
76
85
|
})
|