@bagelink/vue 0.0.464 → 0.0.471
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/Accordion.vue.d.ts.map +1 -1
- package/dist/components/AccordionItem.vue.d.ts.map +1 -1
- package/dist/components/Alert.vue.d.ts +2 -2
- package/dist/components/Alert.vue.d.ts.map +1 -1
- package/dist/components/Avatar.vue.d.ts.map +1 -1
- package/dist/components/Badge.vue.d.ts +2 -2
- package/dist/components/Badge.vue.d.ts.map +1 -1
- package/dist/components/BglVideo.vue.d.ts +2 -2
- package/dist/components/BglVideo.vue.d.ts.map +1 -1
- package/dist/components/Btn.vue.d.ts.map +1 -1
- package/dist/components/Card.vue.d.ts.map +1 -1
- package/dist/components/Carousel.vue.d.ts +4 -2
- package/dist/components/Carousel.vue.d.ts.map +1 -1
- package/dist/components/DataPreview.vue.d.ts.map +1 -1
- package/dist/components/Drop.vue.d.ts +34 -0
- package/dist/components/Drop.vue.d.ts.map +1 -0
- package/dist/components/FileUploader.vue.d.ts +60 -0
- package/dist/components/FileUploader.vue.d.ts.map +1 -0
- package/dist/components/Flag.vue.d.ts +2 -2
- package/dist/components/Flag.vue.d.ts.map +1 -1
- package/dist/components/ListItem.vue.d.ts.map +1 -1
- package/dist/components/ListView.vue.d.ts.map +1 -1
- package/dist/components/MapEmbed.vue.d.ts +2 -2
- package/dist/components/MapEmbed.vue.d.ts.map +1 -1
- package/dist/components/MaterialIcon.vue.d.ts.map +1 -1
- package/dist/components/Modal.vue.d.ts +2 -1
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/ModalConfirm.vue.d.ts.map +1 -1
- package/dist/components/ModalForm.vue.d.ts.map +1 -1
- package/dist/components/NavBar.vue.d.ts.map +1 -1
- package/dist/components/PageTitle.vue.d.ts.map +1 -1
- package/dist/components/TableSchema.vue.d.ts.map +1 -1
- package/dist/components/Title.vue.d.ts.map +1 -1
- package/dist/components/dashboard/Lineart.vue.d.ts.map +1 -1
- package/dist/components/dashboard/index.d.ts.map +1 -1
- package/dist/components/form/BglField.vue.d.ts.map +1 -1
- package/dist/components/form/BglForm.vue.d.ts +4 -2
- package/dist/components/form/BglForm.vue.d.ts.map +1 -1
- package/dist/components/form/ItemRef.vue.d.ts +1 -0
- package/dist/components/form/ItemRef.vue.d.ts.map +1 -1
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/Checkbox.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/ColorPicker.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/FileUpload.vue.d.ts +2 -1
- package/dist/components/form/inputs/FileUpload.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/JSONInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RadioPillsInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RichText.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectField.vue.d.ts +1 -4
- package/dist/components/form/inputs/SelectField.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SignaturePad.vue.d.ts +56 -0
- package/dist/components/form/inputs/SignaturePad.vue.d.ts.map +1 -0
- package/dist/components/form/inputs/TableField.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TelInput.vue.d.ts +2 -2
- package/dist/components/form/inputs/TelInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/ToggleInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/index.d.ts +1 -0
- package/dist/components/form/inputs/index.d.ts.map +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/layout/BottomMenu.vue.d.ts.map +1 -1
- package/dist/components/layout/Layout.vue.d.ts +2 -2
- package/dist/components/layout/Layout.vue.d.ts.map +1 -1
- package/dist/components/layout/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/components/layout/TabbedLayout.vue.d.ts.map +1 -1
- package/dist/components/layout/Tabs.vue.d.ts.map +1 -1
- package/dist/components/layout/TabsBody.vue.d.ts.map +1 -1
- package/dist/components/layout/TabsNav.vue.d.ts.map +1 -1
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/index.cjs +17616 -20818
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +17616 -20818
- package/dist/plugins/bagel.d.ts +1 -1
- package/dist/plugins/bagel.d.ts.map +1 -1
- package/dist/plugins/modal.d.ts +14 -14
- package/dist/plugins/modal.d.ts.map +1 -1
- package/dist/style.css +330 -309
- package/dist/types/BagelForm.d.ts +16 -16
- package/dist/types/BagelForm.d.ts.map +1 -1
- package/dist/types/BtnOptions.d.ts +1 -1
- package/dist/types/BtnOptions.d.ts.map +1 -1
- package/dist/types/NavLink.d.ts +2 -2
- package/dist/types/NavLink.d.ts.map +1 -1
- package/dist/types/file.d.ts +2 -2
- package/dist/types/file.d.ts.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/materialIcons.d.ts.map +1 -1
- package/dist/utils/BagelFormUtils.d.ts.map +1 -1
- package/dist/utils/allCountries.d.ts +2 -2
- package/dist/utils/allCountries.d.ts.map +1 -1
- package/dist/utils/clickOutside.d.ts.map +1 -1
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +19 -17
- package/src/components/Accordion.vue +10 -10
- package/src/components/AccordionItem.vue +47 -47
- package/src/components/Alert.vue +21 -21
- package/src/components/Avatar.vue +15 -15
- package/src/components/Badge.vue +17 -16
- package/src/components/BglVideo.vue +43 -43
- package/src/components/Btn.vue +64 -65
- package/src/components/Card.vue +26 -26
- package/src/components/Carousel.vue +130 -134
- package/src/components/DataPreview.vue +30 -30
- package/src/components/Flag.vue +26 -26
- package/src/components/ListItem.vue +13 -13
- package/src/components/ListView.vue +2 -2
- package/src/components/MapEmbed.vue +33 -33
- package/src/components/MaterialIcon.vue +12 -12
- package/src/components/Modal.vue +73 -66
- package/src/components/ModalConfirm.vue +18 -18
- package/src/components/ModalForm.vue +79 -76
- package/src/components/NavBar.vue +33 -30
- package/src/components/PageTitle.vue +10 -8
- package/src/components/TableSchema.vue +123 -113
- package/src/components/Title.vue +8 -8
- package/src/components/dashboard/Lineart.vue +103 -96
- package/src/components/dashboard/index.ts +1 -1
- package/src/components/form/BglField.vue +61 -61
- package/src/components/form/BglFieldSet.vue +9 -8
- package/src/components/form/BglForm.vue +71 -70
- package/src/components/form/index.ts +4 -4
- package/src/components/form/inputs/CheckInput.vue +25 -23
- package/src/components/form/inputs/Checkbox.vue +10 -10
- package/src/components/form/inputs/ColorPicker.vue +26 -24
- package/src/components/form/inputs/DateInput.vue +39 -39
- package/src/components/form/inputs/DatePicker.vue +37 -36
- package/src/components/form/inputs/FileUpload.vue +165 -161
- package/src/components/form/inputs/FileUploadURL.vue +134 -132
- package/src/components/form/inputs/JSONInput.vue +29 -29
- package/src/components/form/inputs/RadioPillsInput.vue +49 -49
- package/src/components/form/inputs/RichText.vue +62 -63
- package/src/components/form/inputs/SelectInput.vue +173 -167
- package/src/components/form/inputs/SignaturePad.vue +150 -0
- package/src/components/form/inputs/TableField.vue +77 -76
- package/src/components/form/inputs/TelInput.vue +280 -285
- package/src/components/form/inputs/TextInput.vue +81 -76
- package/src/components/form/inputs/ToggleInput.vue +13 -13
- package/src/components/form/inputs/index.ts +17 -15
- package/src/components/formkit/FileUploader.vue +162 -158
- package/src/components/formkit/MiscFields.vue +20 -20
- package/src/components/formkit/Toggle.vue +13 -13
- package/src/components/index.ts +28 -28
- package/src/components/layout/BottomMenu.vue +25 -21
- package/src/components/layout/Layout.vue +29 -29
- package/src/components/layout/SidebarMenu.vue +31 -27
- package/src/components/layout/TabbedLayout.vue +47 -45
- package/src/components/layout/Tabs.vue +32 -32
- package/src/components/layout/TabsBody.vue +10 -10
- package/src/components/layout/TabsNav.vue +44 -44
- package/src/components/layout/index.ts +7 -7
- package/src/components/layout/tabsManager.ts +6 -6
- package/src/index.ts +13 -8
- package/src/plugins/bagel.ts +37 -37
- package/src/plugins/modal.ts +66 -67
- package/src/styles/layout.css +5 -3
- package/src/styles/mobilLayout.css +7 -0
- package/src/types/BagelForm.ts +27 -27
- package/src/types/BtnOptions.ts +13 -13
- package/src/types/NavLink.ts +8 -8
- package/src/types/file.ts +11 -11
- package/src/types/index.ts +16 -12
- package/src/types/materialIcons.ts +3249 -3249
- package/src/utils/BagelFormUtils.ts +23 -23
- package/src/utils/allCountries.ts +11 -12
- package/src/utils/clickOutside.ts +6 -6
- package/src/utils/index.ts +39 -41
- package/src/utils/lang.ts +13 -13
- package/src/utils/strings.ts +9 -9
- package/tsconfig.json +0 -1
- package/vite.config.ts +8 -8
- package/dist/components/Popover.vue.d.ts +0 -10
- package/dist/components/Popover.vue.d.ts.map +0 -1
- package/dist/types/materialIcon.d.ts +0 -2
- package/dist/types/materialIcon.d.ts.map +0 -1
|
@@ -1,101 +1,75 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<template v-if="id">
|
|
3
|
-
<BglField
|
|
4
|
-
v-for="(field, i) in schema"
|
|
5
|
-
:key="field.id || `${i}p`"
|
|
6
|
-
:field="field"
|
|
7
|
-
v-model="data"
|
|
8
|
-
/>
|
|
9
|
-
</template>
|
|
10
|
-
<form
|
|
11
|
-
v-else-if="!slots.success || status !== 'success'"
|
|
12
|
-
ref="form"
|
|
13
|
-
@submit.prevent="runSubmit"
|
|
14
|
-
>
|
|
15
|
-
<Title tag="h4" :label="label" v-if="label" />
|
|
16
|
-
<BglField
|
|
17
|
-
v-for="(field, i) in schema"
|
|
18
|
-
:key="field.id || `${i}p`"
|
|
19
|
-
:field="field"
|
|
20
|
-
v-model="data"
|
|
21
|
-
/>
|
|
22
|
-
<slot name="submit" :submit="runSubmit" :isDirty />
|
|
23
|
-
</form>
|
|
24
|
-
<slot v-if="status === 'success'" name="success" />
|
|
25
|
-
<slot v-if="status === 'error'" name="error" />
|
|
26
|
-
</template>
|
|
27
|
-
|
|
28
1
|
<script lang="ts" setup>
|
|
29
|
-
import { useSlots, watch } from 'vue'
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
import { type BglFormSchemaT } from '@bagelink/vue';
|
|
2
|
+
import { useSlots, watch } from 'vue'
|
|
3
|
+
import { BglField, Title, useModal } from '@bagelink/vue'
|
|
33
4
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const { showModal } = useModal();
|
|
5
|
+
import type { BglFormSchemaT } from '@bagelink/vue'
|
|
37
6
|
|
|
38
7
|
const props = withDefaults(
|
|
39
8
|
defineProps<{
|
|
40
|
-
label?: string
|
|
41
|
-
id?: string
|
|
42
|
-
schema: BglFormSchemaT<any
|
|
43
|
-
modelValue?: Record<string, any
|
|
44
|
-
onDelete?: (id: string) => void
|
|
45
|
-
onSubmit?: (data: any) => void
|
|
46
|
-
status?: FormStatus
|
|
9
|
+
label?: string
|
|
10
|
+
id?: string
|
|
11
|
+
schema: BglFormSchemaT<any>
|
|
12
|
+
modelValue?: Record<string, any>
|
|
13
|
+
onDelete?: (id: string) => void
|
|
14
|
+
onSubmit?: (data: any) => void
|
|
15
|
+
status?: FormStatus
|
|
47
16
|
}>(),
|
|
48
17
|
{
|
|
49
18
|
modelValue: () => ({}),
|
|
50
19
|
},
|
|
51
|
-
)
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
const emit = defineEmits(['update:modelValue', 'submit', 'dirty'])
|
|
23
|
+
|
|
24
|
+
const slots = useSlots()
|
|
52
25
|
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
let
|
|
26
|
+
const { showModal } = useModal()
|
|
27
|
+
|
|
28
|
+
const instAt = new Date()
|
|
29
|
+
const timeSinceInst = () => new Date().getTime() - instAt.getTime()
|
|
30
|
+
let formData = $ref(props.modelValue || {})
|
|
31
|
+
let isDirty = $ref(false)
|
|
58
32
|
let data = $computed({
|
|
59
33
|
set: (val: any) => {
|
|
60
34
|
if (timeSinceInst() > 100) {
|
|
61
|
-
emit('dirty')
|
|
62
|
-
isDirty = true
|
|
35
|
+
emit('dirty')
|
|
36
|
+
isDirty = true
|
|
63
37
|
}
|
|
64
|
-
formData = val
|
|
65
|
-
emit('update:modelValue', val)
|
|
38
|
+
formData = val
|
|
39
|
+
emit('update:modelValue', val)
|
|
66
40
|
},
|
|
67
41
|
get: () => formData,
|
|
68
|
-
})
|
|
69
|
-
const form = $ref<HTMLFormElement>()
|
|
42
|
+
})
|
|
43
|
+
const form = $ref<HTMLFormElement>()
|
|
70
44
|
|
|
71
|
-
const validateForm = () => form?.reportValidity
|
|
45
|
+
const validateForm = () => form?.reportValidity()
|
|
72
46
|
|
|
73
|
-
const clearForm = () => (data = {})
|
|
47
|
+
const clearForm = () => (data = {})
|
|
74
48
|
|
|
75
|
-
type FormStatus = 'idle' | 'loading' | 'success' | 'error'
|
|
49
|
+
type FormStatus = 'idle' | 'loading' | 'success' | 'error'
|
|
76
50
|
|
|
77
51
|
watch(
|
|
78
52
|
() => props.status,
|
|
79
53
|
(status) => {
|
|
80
54
|
if (status === 'success') {
|
|
81
|
-
isDirty = false
|
|
82
|
-
clearForm()
|
|
55
|
+
isDirty = false
|
|
56
|
+
clearForm()
|
|
83
57
|
}
|
|
84
58
|
},
|
|
85
59
|
{ immediate: true },
|
|
86
|
-
)
|
|
60
|
+
)
|
|
87
61
|
|
|
88
|
-
|
|
89
|
-
const isValid = validateForm()
|
|
90
|
-
if (!isValid) return
|
|
62
|
+
function runSubmit() {
|
|
63
|
+
const isValid = validateForm()
|
|
64
|
+
if (!isValid) return
|
|
91
65
|
// props.onSubmit?.(data);
|
|
92
|
-
emit('submit', { ...formData })
|
|
93
|
-
isDirty = false
|
|
94
|
-
}
|
|
66
|
+
emit('submit', { ...formData })
|
|
67
|
+
isDirty = false
|
|
68
|
+
}
|
|
95
69
|
|
|
96
|
-
const i18nT = (val: string) => val
|
|
70
|
+
const i18nT = (val: string) => val
|
|
97
71
|
|
|
98
|
-
|
|
72
|
+
function deleteItem() {
|
|
99
73
|
showModal(
|
|
100
74
|
{
|
|
101
75
|
class: 'small-modal',
|
|
@@ -110,17 +84,44 @@ const deleteItem = () => {
|
|
|
110
84
|
],
|
|
111
85
|
},
|
|
112
86
|
{ default: i18nT('form.deleteMessage') },
|
|
113
|
-
)
|
|
114
|
-
}
|
|
87
|
+
)
|
|
88
|
+
}
|
|
115
89
|
|
|
116
90
|
defineExpose({
|
|
117
91
|
validateForm,
|
|
118
92
|
deleteItem,
|
|
119
93
|
isDirty,
|
|
120
94
|
clearForm,
|
|
121
|
-
})
|
|
95
|
+
})
|
|
122
96
|
</script>
|
|
123
97
|
|
|
98
|
+
<template>
|
|
99
|
+
<template v-if="id">
|
|
100
|
+
<BglField
|
|
101
|
+
v-for="(field, i) in schema"
|
|
102
|
+
:key="field.id || `${i}p`"
|
|
103
|
+
v-model="data"
|
|
104
|
+
:field="field"
|
|
105
|
+
/>
|
|
106
|
+
</template>
|
|
107
|
+
<form
|
|
108
|
+
v-else-if="!slots.success || status !== 'success'"
|
|
109
|
+
ref="form"
|
|
110
|
+
@submit.prevent="runSubmit"
|
|
111
|
+
>
|
|
112
|
+
<Title v-if="label" tag="h4" :label="label" />
|
|
113
|
+
<BglField
|
|
114
|
+
v-for="(field, i) in schema"
|
|
115
|
+
:key="field.id || `${i}p`"
|
|
116
|
+
v-model="data"
|
|
117
|
+
:field="field"
|
|
118
|
+
/>
|
|
119
|
+
<slot name="submit" :submit="runSubmit" :isDirty />
|
|
120
|
+
</form>
|
|
121
|
+
<slot v-if="status === 'success'" name="success" />
|
|
122
|
+
<slot v-if="status === 'error'" name="error" />
|
|
123
|
+
</template>
|
|
124
|
+
|
|
124
125
|
<style>
|
|
125
126
|
.del-top {
|
|
126
127
|
transform: translateY(-2.6rem);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as BglForm } from './BglForm.vue'
|
|
2
|
-
export { default as BagelForm } from './BglForm.vue'
|
|
3
|
-
export { default as BglField } from './BglField.vue'
|
|
4
|
-
export * from './inputs'
|
|
1
|
+
export { default as BglForm } from './BglForm.vue'
|
|
2
|
+
export { default as BagelForm } from './BglForm.vue'
|
|
3
|
+
export { default as BglField } from './BglField.vue'
|
|
4
|
+
export * from './inputs'
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="bagel-input bgl-checkbox" :title="title" :class="{ small: small }">
|
|
3
|
-
<div class="check-square" :class="{ checked: checked }" @click="checked = !checked">
|
|
4
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">
|
|
5
|
-
<path d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z" />
|
|
6
|
-
</svg>
|
|
7
|
-
</div>
|
|
8
|
-
<label>
|
|
9
|
-
<input :required="required" :id="id" type="checkbox" v-model="checked">
|
|
10
|
-
<slot name="label">
|
|
11
|
-
{{ label }}
|
|
12
|
-
</slot>
|
|
13
|
-
</label>
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
1
|
<script setup lang="ts">
|
|
18
2
|
defineProps<{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}>()
|
|
3
|
+
label?: string
|
|
4
|
+
id?: string
|
|
5
|
+
title?: string
|
|
6
|
+
small?: boolean
|
|
7
|
+
required?: boolean
|
|
8
|
+
}>()
|
|
25
9
|
|
|
26
|
-
const checked = defineModel<boolean>('modelValue', { default: false })
|
|
10
|
+
const checked = defineModel<boolean>('modelValue', { default: false })
|
|
27
11
|
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<div class="bagel-input bgl-checkbox" :title="title" :class="{ small }">
|
|
15
|
+
<div class="check-square" :class="{ checked }" @click="checked = !checked">
|
|
16
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">
|
|
17
|
+
<path d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z" />
|
|
18
|
+
</svg>
|
|
19
|
+
</div>
|
|
20
|
+
<label>
|
|
21
|
+
<input :id="id" v-model="checked" :required="required" type="checkbox">
|
|
22
|
+
<slot name="label">
|
|
23
|
+
{{ label }}
|
|
24
|
+
</slot>
|
|
25
|
+
</label>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
28
29
|
<style>
|
|
29
30
|
:root {
|
|
30
31
|
--bgl-white: #fff;
|
|
@@ -35,6 +36,7 @@ const checked = defineModel<boolean>('modelValue', { default: false });
|
|
|
35
36
|
|
|
36
37
|
}
|
|
37
38
|
</style>
|
|
39
|
+
|
|
38
40
|
<style scoped>
|
|
39
41
|
.bgl-checkbox {
|
|
40
42
|
position: relative;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { MaterialIcon } from '@bagelink/vue'
|
|
3
|
+
|
|
4
|
+
const val = defineModel('modelValue', {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
default: false,
|
|
7
|
+
})
|
|
8
|
+
</script>
|
|
9
|
+
|
|
1
10
|
<template>
|
|
2
11
|
<label class="primary-checkbox">
|
|
3
|
-
<input
|
|
12
|
+
<input v-model="val" type="checkbox">
|
|
4
13
|
<span>
|
|
5
14
|
<MaterialIcon icon="check" />
|
|
6
15
|
</span>
|
|
7
16
|
</label>
|
|
8
17
|
</template>
|
|
9
18
|
|
|
10
|
-
<script setup lang="ts">
|
|
11
|
-
import { MaterialIcon } from '@bagelink/vue';
|
|
12
|
-
|
|
13
|
-
const val = defineModel('modelValue', {
|
|
14
|
-
type: Boolean,
|
|
15
|
-
default: false,
|
|
16
|
-
});
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
19
|
<style scoped>
|
|
20
20
|
.primary-checkbox input {
|
|
21
21
|
display: none;
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="bagel-input" :class="{ small }" :title="label" v-if="id">
|
|
3
|
-
<label>
|
|
4
|
-
{{ label }}
|
|
5
|
-
<input :id="id" v-model="inputVal" type="color" :placeholder="placeholder || label"
|
|
6
|
-
:class="{ 'no-edit': !editMode }" :required="required" v-bind="nativeInputAttrs">
|
|
7
|
-
</label>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
1
|
<script setup lang="ts">
|
|
12
|
-
import { watch } from 'vue'
|
|
2
|
+
import { watch } from 'vue'
|
|
13
3
|
|
|
14
|
-
const emits = defineEmits(['update:modelValue']);
|
|
15
4
|
const props = withDefaults(
|
|
16
5
|
defineProps<{
|
|
17
|
-
label?: string
|
|
18
|
-
id?: string
|
|
19
|
-
placeholder?: string
|
|
20
|
-
modelValue: any
|
|
21
|
-
editMode?: boolean
|
|
22
|
-
small?: boolean
|
|
23
|
-
required?: boolean
|
|
24
|
-
nativeInputAttrs?: Record<string, any
|
|
6
|
+
label?: string
|
|
7
|
+
id?: string
|
|
8
|
+
placeholder?: string
|
|
9
|
+
modelValue: any
|
|
10
|
+
editMode?: boolean
|
|
11
|
+
small?: boolean
|
|
12
|
+
required?: boolean
|
|
13
|
+
nativeInputAttrs?: Record<string, any>
|
|
25
14
|
}>(),
|
|
26
15
|
{
|
|
27
16
|
editMode: true,
|
|
28
17
|
},
|
|
29
|
-
)
|
|
30
|
-
const
|
|
18
|
+
)
|
|
19
|
+
const emits = defineEmits(['update:modelValue'])
|
|
20
|
+
const inputVal = $ref<string>(props.modelValue)
|
|
31
21
|
|
|
32
22
|
watch(
|
|
33
23
|
() => inputVal,
|
|
34
|
-
(newVal) => emits('update:modelValue', newVal),
|
|
35
|
-
)
|
|
24
|
+
(newVal) => { emits('update:modelValue', newVal) },
|
|
25
|
+
)
|
|
36
26
|
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<div v-if="id" class="bagel-input" :class="{ small }" :title="label">
|
|
30
|
+
<label>
|
|
31
|
+
{{ label }}
|
|
32
|
+
<input
|
|
33
|
+
:id="id" v-model="inputVal" type="color" :placeholder="placeholder || label"
|
|
34
|
+
:class="{ 'no-edit': !editMode }" :required="required" v-bind="nativeInputAttrs"
|
|
35
|
+
>
|
|
36
|
+
</label>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="bagel-input"
|
|
4
|
-
:title="label"
|
|
5
|
-
:class="{ small: small }"
|
|
6
|
-
>
|
|
7
|
-
<label v-if="label">
|
|
8
|
-
{{ label }}
|
|
9
|
-
</label>
|
|
10
|
-
<VDatepicker
|
|
11
|
-
ref="datePicker"
|
|
12
|
-
:auto-apply="true"
|
|
13
|
-
v-model="date"
|
|
14
|
-
:enable-time-picker="enableTime"
|
|
15
|
-
v-bind="extraProps"
|
|
16
|
-
/>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
1
|
<script setup lang="ts">
|
|
21
|
-
import VDatepicker, { type DatePickerInstance, type VueDatePickerProps } from '@vuepic/vue-datepicker'
|
|
22
|
-
import '@vuepic/vue-datepicker/dist/main.css'
|
|
23
|
-
import { onMounted } from 'vue'
|
|
24
|
-
|
|
25
|
-
const datePicker = $ref<DatePickerInstance>();
|
|
2
|
+
import VDatepicker, { type DatePickerInstance, type VueDatePickerProps } from '@vuepic/vue-datepicker'
|
|
3
|
+
import '@vuepic/vue-datepicker/dist/main.css'
|
|
4
|
+
import { onMounted } from 'vue'
|
|
26
5
|
|
|
27
6
|
const props = withDefaults(
|
|
28
7
|
defineProps<{
|
|
29
|
-
label?: string
|
|
30
|
-
editMode?: boolean
|
|
31
|
-
small?: boolean
|
|
32
|
-
enableTime?: boolean
|
|
33
|
-
modelValue?: string | Date
|
|
34
|
-
defaultValue?: string | Date
|
|
35
|
-
extraProps?: VueDatePickerProps
|
|
8
|
+
label?: string
|
|
9
|
+
editMode?: boolean
|
|
10
|
+
small?: boolean
|
|
11
|
+
enableTime?: boolean
|
|
12
|
+
modelValue?: string | Date
|
|
13
|
+
defaultValue?: string | Date
|
|
14
|
+
extraProps?: VueDatePickerProps
|
|
36
15
|
}>(),
|
|
37
16
|
{
|
|
38
17
|
enableTime: false,
|
|
39
18
|
editMode: true,
|
|
40
19
|
small: false,
|
|
41
20
|
},
|
|
42
|
-
)
|
|
21
|
+
)
|
|
43
22
|
|
|
44
|
-
const emit = defineEmits(['update:modelValue'])
|
|
23
|
+
const emit = defineEmits(['update:modelValue'])
|
|
24
|
+
|
|
25
|
+
const datePicker = $ref<DatePickerInstance>()
|
|
45
26
|
|
|
46
27
|
const date = $computed<string | Date>({
|
|
47
28
|
get: () => props.modelValue || '',
|
|
48
29
|
set: (val) => {
|
|
49
|
-
const d = typeof val === 'string' ? new Date(val) : val
|
|
30
|
+
const d = typeof val === 'string' ? new Date(val) : val
|
|
50
31
|
if (props.enableTime) {
|
|
51
|
-
emit('update:modelValue', d.toISOString())
|
|
32
|
+
emit('update:modelValue', d.toISOString())
|
|
52
33
|
} else {
|
|
53
|
-
emit('update:modelValue', d.toISOString().split('T')[0])
|
|
34
|
+
emit('update:modelValue', d.toISOString().split('T')[0])
|
|
54
35
|
}
|
|
55
36
|
},
|
|
56
|
-
})
|
|
37
|
+
})
|
|
57
38
|
|
|
58
39
|
onMounted(() => {
|
|
59
40
|
if (
|
|
60
41
|
props.defaultValue && date === ''
|
|
61
42
|
) {
|
|
62
|
-
Object.assign(date, { date: props.defaultValue })
|
|
43
|
+
Object.assign(date, { date: props.defaultValue })
|
|
63
44
|
}
|
|
64
|
-
})
|
|
45
|
+
})
|
|
65
46
|
</script>
|
|
66
47
|
|
|
48
|
+
<template>
|
|
49
|
+
<div
|
|
50
|
+
class="bagel-input"
|
|
51
|
+
:title="label"
|
|
52
|
+
:class="{ small }"
|
|
53
|
+
>
|
|
54
|
+
<label v-if="label">
|
|
55
|
+
{{ label }}
|
|
56
|
+
</label>
|
|
57
|
+
<VDatepicker
|
|
58
|
+
ref="datePicker"
|
|
59
|
+
v-model="date"
|
|
60
|
+
:auto-apply="true"
|
|
61
|
+
:enable-time-picker="enableTime"
|
|
62
|
+
v-bind="extraProps"
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
67
|
<style>
|
|
68
68
|
.dp__input_wrap input {
|
|
69
69
|
padding-inline-start: 2rem !important;
|
|
@@ -1,10 +1,42 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import VDatepicker from '@vuepic/vue-datepicker'
|
|
3
|
+
import '@vuepic/vue-datepicker/dist/main.css'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
label?: string
|
|
7
|
+
id?: string
|
|
8
|
+
options?: Record<string, any>
|
|
9
|
+
showTimeWrap?: boolean
|
|
10
|
+
modelValue?: Date
|
|
11
|
+
allowedDates?: string[] | Date[]
|
|
12
|
+
disabledDates?: string[] | Date[]
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const emit = defineEmits(['update:modelValue'])
|
|
16
|
+
|
|
17
|
+
const selectedDate = $computed({
|
|
18
|
+
get: () => props.modelValue || new Date(),
|
|
19
|
+
set: (value: Date) => {
|
|
20
|
+
console.log(value)
|
|
21
|
+
emit('update:modelValue', value)
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
const selectedHour = $ref()
|
|
25
|
+
|
|
26
|
+
const hours = Array.from({ length: 18 }, (_, index) => {
|
|
27
|
+
const hour = Math.floor(index / 2) + 9
|
|
28
|
+
const minute = index % 2 === 0 ? '00' : '30'
|
|
29
|
+
return `${hour}:${minute}`
|
|
30
|
+
})
|
|
31
|
+
</script>
|
|
32
|
+
|
|
1
33
|
<template>
|
|
2
34
|
<div class="datetime-wrap">
|
|
3
35
|
<div class="date-wrap">
|
|
4
36
|
<VDatepicker
|
|
37
|
+
v-model="selectedDate"
|
|
5
38
|
inline
|
|
6
39
|
week-start="0"
|
|
7
|
-
v-model="selectedDate"
|
|
8
40
|
:allowed-dates="allowedDates"
|
|
9
41
|
:disabled-dates="disabledDates"
|
|
10
42
|
:auto-apply="true"
|
|
@@ -17,52 +49,21 @@
|
|
|
17
49
|
<template #action-preview />
|
|
18
50
|
</VDatepicker>
|
|
19
51
|
</div>
|
|
20
|
-
<div class="time-wrap"
|
|
52
|
+
<div v-if="showTimeWrap" class="time-wrap">
|
|
21
53
|
<template v-for="hr in hours" :key="hr">
|
|
22
54
|
<input
|
|
23
|
-
type="radio"
|
|
24
55
|
:id="`${hr}_${id}`"
|
|
56
|
+
v-model="selectedHour"
|
|
57
|
+
type="radio"
|
|
25
58
|
:name="label"
|
|
26
59
|
:value="hr"
|
|
27
|
-
|
|
28
|
-
/>
|
|
60
|
+
>
|
|
29
61
|
<label :for="`${hr}_${id}`">{{ hr }}</label>
|
|
30
62
|
</template>
|
|
31
63
|
</div>
|
|
32
64
|
</div>
|
|
33
65
|
</template>
|
|
34
66
|
|
|
35
|
-
<script setup lang="ts">
|
|
36
|
-
import VDatepicker from '@vuepic/vue-datepicker';
|
|
37
|
-
import '@vuepic/vue-datepicker/dist/main.css';
|
|
38
|
-
|
|
39
|
-
const props = defineProps<{
|
|
40
|
-
label?: string;
|
|
41
|
-
id?: string;
|
|
42
|
-
options?: Record<string, any>;
|
|
43
|
-
showTimeWrap?: boolean;
|
|
44
|
-
modelValue?: Date;
|
|
45
|
-
allowedDates?: string[] | Date[];
|
|
46
|
-
disabledDates?: string[] | Date[];
|
|
47
|
-
}>();
|
|
48
|
-
|
|
49
|
-
const emit = defineEmits(['update:modelValue']);
|
|
50
|
-
|
|
51
|
-
const selectedDate = $computed({
|
|
52
|
-
get: () => props.modelValue || new Date(),
|
|
53
|
-
set: (value: Date) => {
|
|
54
|
-
console.log(value);
|
|
55
|
-
emit('update:modelValue', value);
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
const selectedHour = $ref();
|
|
59
|
-
|
|
60
|
-
const hours = Array.from({ length: 18 }, (_, index) => {
|
|
61
|
-
const hour = Math.floor(index / 2) + 9;
|
|
62
|
-
const minute = index % 2 === 0 ? '00' : '30';
|
|
63
|
-
return `${hour}:${minute}`;
|
|
64
|
-
});
|
|
65
|
-
</script>
|
|
66
67
|
<style>
|
|
67
68
|
.datetime-wrap {
|
|
68
69
|
display: flex;
|