@bagelink/vue 0.0.805 → 0.0.809
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/BglVideo.vue.d.ts.map +1 -1
- package/dist/components/DataPreview.vue.d.ts +9 -3
- package/dist/components/DataPreview.vue.d.ts.map +1 -1
- package/dist/components/MapEmbed.vue.d.ts.map +1 -1
- package/dist/components/ModalForm.vue.d.ts +9 -3
- package/dist/components/ModalForm.vue.d.ts.map +1 -1
- package/dist/components/NavBar.vue.d.ts.map +1 -1
- package/dist/components/TableSchema.vue.d.ts +3 -1
- package/dist/components/TableSchema.vue.d.ts.map +1 -1
- package/dist/components/Zoomer.vue.d.ts.map +1 -1
- package/dist/components/form/BglField.vue.d.ts +3 -1
- package/dist/components/form/BglField.vue.d.ts.map +1 -1
- package/dist/components/form/BglForm.vue.d.ts +9 -3
- package/dist/components/form/BglForm.vue.d.ts.map +1 -1
- package/dist/components/form/BglMultiStepForm.vue.d.ts +3 -1
- package/dist/components/form/BglMultiStepForm.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/ColorPicker.vue.d.ts +6 -2
- package/dist/components/form/inputs/ColorPicker.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DatePicker.vue.d.ts +6 -2
- package/dist/components/form/inputs/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/FileUpload.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/PasswordInput.vue.d.ts +3 -1
- package/dist/components/form/inputs/PasswordInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RichText2/formatting.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts +6 -2
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TableField.vue.d.ts +6 -2
- package/dist/components/form/inputs/TableField.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TextInput.vue.d.ts +6 -2
- package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
- package/dist/components/layout/BottomMenu.vue.d.ts.map +1 -1
- package/dist/components/lightbox/Lightbox.vue.d.ts.map +1 -1
- package/dist/components/lightbox/index.d.ts.map +1 -1
- package/dist/composables/index.d.ts +3 -1
- package/dist/composables/index.d.ts.map +1 -1
- package/dist/index.cjs +153 -144
- package/dist/index.mjs +153 -144
- package/dist/plugins/modal.d.ts +12 -4
- package/dist/plugins/modal.d.ts.map +1 -1
- package/dist/style.css +3077 -398
- package/dist/types/BagelForm.d.ts +27 -9
- package/dist/types/BagelForm.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/BagelFormUtils.d.ts +45 -15
- package/dist/utils/BagelFormUtils.d.ts.map +1 -1
- package/dist/utils/allCountries.d.ts +1 -1
- package/dist/utils/allCountries.d.ts.map +1 -1
- package/dist/utils/index.d.ts +6 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/lang.d.ts +3 -1
- package/dist/utils/lang.d.ts.map +1 -1
- package/dist/utils/strings.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/components/Accordion.vue +1 -1
- package/src/components/AccordionItem.vue +4 -4
- package/src/components/AddressSearch.vue +1 -1
- package/src/components/BglVideo.vue +1 -2
- package/src/components/DataPreview.vue +1 -1
- package/src/components/MapEmbed.vue +4 -6
- package/src/components/ModalForm.vue +3 -3
- package/src/components/NavBar.vue +6 -3
- package/src/components/TableSchema.vue +6 -6
- package/src/components/Zoomer.vue +7 -8
- package/src/components/dashboard/Lineart.vue +3 -3
- package/src/components/form/BglField.vue +2 -2
- package/src/components/form/BglFieldSet.vue +1 -1
- package/src/components/form/BglForm.vue +2 -2
- package/src/components/form/inputs/CheckInput.vue +1 -1
- package/src/components/form/inputs/ColorPicker.vue +1 -1
- package/src/components/form/inputs/DatePicker.vue +1 -1
- package/src/components/form/inputs/FileUpload.vue +10 -10
- package/src/components/form/inputs/OTP.vue +6 -6
- package/src/components/form/inputs/PasswordInput.vue +1 -1
- package/src/components/form/inputs/RadioPillsInput.vue +1 -1
- package/src/components/form/inputs/RichText.vue +1 -1
- package/src/components/form/inputs/RichText2/Toolbar.vue +2 -2
- package/src/components/form/inputs/RichText2/formatting.ts +5 -3
- package/src/components/form/inputs/RichText2/index.vue +1 -1
- package/src/components/form/inputs/SelectInput.vue +50 -39
- package/src/components/form/inputs/SignaturePad.vue +2 -2
- package/src/components/form/inputs/TableField.vue +5 -5
- package/src/components/form/inputs/TelInput.vue +4 -4
- package/src/components/form/inputs/TextInput.vue +1 -1
- package/src/components/form/inputs/ToggleInput.vue +1 -1
- package/src/components/formkit/FileUploader.vue +1 -1
- package/src/components/formkit/MiscFields.vue +1 -1
- package/src/components/layout/BottomMenu.vue +2 -2
- package/src/components/layout/Layout.vue +2 -2
- package/src/components/layout/Tabs.vue +2 -2
- package/src/components/layout/TabsNav.vue +1 -1
- package/src/components/layout/tabsManager.ts +1 -1
- package/src/components/lightbox/Lightbox.vue +2 -2
- package/src/components/lightbox/index.ts +13 -7
- package/src/composables/index.ts +2 -2
- package/src/plugins/modal.ts +7 -7
- package/src/styles/appearance.css +36 -0
- package/src/styles/layout.css +1563 -60
- package/src/styles/mobilLayout.css +1519 -30
- package/src/styles/theme.css +1 -1
- package/src/styles/transitions.css +5 -2
- package/src/types/BagelForm.ts +9 -9
- package/src/types/index.ts +1 -1
- package/src/utils/BagelFormUtils.ts +1 -1
- package/src/utils/allCountries.ts +1 -1
- package/src/utils/index.ts +7 -7
- package/src/utils/lang.ts +1 -1
- package/src/utils/strings.ts +1 -2
- package/vite.config.ts +1 -1
|
@@ -9,7 +9,7 @@ const props = withDefaults(
|
|
|
9
9
|
label?: string
|
|
10
10
|
id?: string
|
|
11
11
|
schema: BglFormSchemaFnT<any>
|
|
12
|
-
modelValue?:
|
|
12
|
+
modelValue?: { [key: string]: any }
|
|
13
13
|
onDelete?: (id: string) => void
|
|
14
14
|
onSubmit?: (data: any) => void
|
|
15
15
|
status?: FormStatus
|
|
@@ -26,7 +26,7 @@ const slots = useSlots()
|
|
|
26
26
|
const { showModal } = useModal()
|
|
27
27
|
|
|
28
28
|
const instAt = new Date()
|
|
29
|
-
const timeSinceInst = () =>
|
|
29
|
+
const timeSinceInst = () => Date.now() - instAt.getTime()
|
|
30
30
|
let formData = $ref(props.modelValue || {})
|
|
31
31
|
let isDirty = $ref(false)
|
|
32
32
|
let data = $computed({
|
|
@@ -11,7 +11,7 @@ const props = withDefaults(defineProps<{
|
|
|
11
11
|
value?: any
|
|
12
12
|
}>(), { defaultValue: false })
|
|
13
13
|
|
|
14
|
-
const inputId = $computed(() => props.id || Math.random().toString(36).
|
|
14
|
+
const inputId = $computed(() => props.id || Math.random().toString(36).slice(7))
|
|
15
15
|
|
|
16
16
|
const checked = defineModel<boolean | undefined | any[]>('modelValue', { default: undefined })
|
|
17
17
|
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
import { Btn, IMAGE_FORMATS_REGEXP, Icon, type StorageFile, useBagel } from '@bagelink/vue'
|
|
3
3
|
import { onMounted, watch } from 'vue'
|
|
4
4
|
|
|
5
|
+
type StrKey = keyof StorageFile
|
|
6
|
+
|
|
7
|
+
type FSValue = string[] | string | number
|
|
8
|
+
|
|
5
9
|
const props = defineProps<{
|
|
6
10
|
label?: string
|
|
7
11
|
multiple?: boolean
|
|
@@ -17,6 +21,8 @@ const props = defineProps<{
|
|
|
17
21
|
|
|
18
22
|
const emit = defineEmits(['update:modelValue', 'addFileStart'])
|
|
19
23
|
|
|
24
|
+
const bindKey: StrKey = props.bindkey || 'id'
|
|
25
|
+
|
|
20
26
|
const bagel = useBagel()
|
|
21
27
|
|
|
22
28
|
interface QueueFile {
|
|
@@ -27,12 +33,6 @@ interface QueueFile {
|
|
|
27
33
|
uploaded?: boolean
|
|
28
34
|
}
|
|
29
35
|
|
|
30
|
-
type StrKey = keyof StorageFile
|
|
31
|
-
|
|
32
|
-
type FSValue = string[] | string | number
|
|
33
|
-
|
|
34
|
-
const bindKey: StrKey = props.bindkey || 'id'
|
|
35
|
-
|
|
36
36
|
const isImage = (str: string) => IMAGE_FORMATS_REGEXP.test(str)
|
|
37
37
|
|
|
38
38
|
let file_bindkeys = $ref<FSValue>(props.modelValue || [])
|
|
@@ -45,9 +45,9 @@ async function fetchFiles() {
|
|
|
45
45
|
|
|
46
46
|
onMounted(() => {
|
|
47
47
|
if (props.topic) fetchFiles()
|
|
48
|
-
if (!props.files && [file_bindkeys].flat().length) {
|
|
49
|
-
const ids = [file_bindkeys].flat().filter(Boolean)
|
|
50
|
-
if (!ids
|
|
48
|
+
if (!props.files && [file_bindkeys].flat().length > 0) {
|
|
49
|
+
const ids = [file_bindkeys].flat().filter(Boolean) as (string | number)[] | undefined
|
|
50
|
+
if (!ids?.length) return
|
|
51
51
|
if (props.multiple) {
|
|
52
52
|
ids.forEach((id) => {
|
|
53
53
|
void bagel
|
|
@@ -74,7 +74,7 @@ watch(
|
|
|
74
74
|
if (newFiles) {
|
|
75
75
|
const filesToAdd = [newFiles]
|
|
76
76
|
.flat()
|
|
77
|
-
.filter(f => !storageFiles.
|
|
77
|
+
.filter(f => !storageFiles.some(sf => sf[bindKey] === f[bindKey]))
|
|
78
78
|
for (const file of filesToAdd) {
|
|
79
79
|
storageFiles.push(file)
|
|
80
80
|
}
|
|
@@ -4,14 +4,14 @@ import { reactive } from 'vue'
|
|
|
4
4
|
const props = defineProps<{ digitCount: number, default?: string, modelValue?: string }>()
|
|
5
5
|
|
|
6
6
|
const emit = defineEmits(['update:modelValue', 'complete'])
|
|
7
|
-
const digits = reactive<(number | string |
|
|
7
|
+
const digits = reactive<(number | string | undefined)[]>([])
|
|
8
8
|
const otpCont = $ref<HTMLElement>()
|
|
9
9
|
|
|
10
10
|
function handlePaste(event: ClipboardEvent, index: number) {
|
|
11
11
|
event.preventDefault()
|
|
12
12
|
const { clipboardData } = event
|
|
13
|
-
const pastedText = clipboardData?.getData('text').
|
|
14
|
-
const pastedDigits = pastedText
|
|
13
|
+
const pastedText = clipboardData?.getData('text').replaceAll(/\D/g, '') // Ensure only numeric digits are pasted
|
|
14
|
+
const pastedDigits = [...(pastedText ?? '')]
|
|
15
15
|
if (!pastedDigits) return
|
|
16
16
|
for (let i = 0; i < pastedDigits.length; i++) {
|
|
17
17
|
const digit = pastedDigits[i]
|
|
@@ -37,7 +37,7 @@ function handleKeyDown(event: KeyboardEvent, index: number) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
if (event.key === 'Backspace') {
|
|
40
|
-
digits[index] =
|
|
40
|
+
digits[index] = undefined
|
|
41
41
|
|
|
42
42
|
if (index !== 0) {
|
|
43
43
|
const prevDigit = otpCont?.children[index - 1] as any
|
|
@@ -67,13 +67,13 @@ if (props.default && props.default.length === props.digitCount) {
|
|
|
67
67
|
}
|
|
68
68
|
} else {
|
|
69
69
|
for (let i = 0; i < props.digitCount; i++) {
|
|
70
|
-
digits[i] =
|
|
70
|
+
digits[i] = undefined
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
function isDigitsFull() {
|
|
75
75
|
for (const elem of digits) {
|
|
76
|
-
if (elem
|
|
76
|
+
if (elem === undefined) {
|
|
77
77
|
return false
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -6,8 +6,8 @@ import SelectInput from '../SelectInput.vue'
|
|
|
6
6
|
defineProps<{ config: ToolbarConfig }>()
|
|
7
7
|
const emit = defineEmits(['action'])
|
|
8
8
|
|
|
9
|
-
// const colorPicker = $ref<HTMLInputElement |
|
|
10
|
-
// const fontSizeInput = $ref<HTMLInputElement |
|
|
9
|
+
// const colorPicker = $ref<HTMLInputElement | undefined>()
|
|
10
|
+
// const fontSizeInput = $ref<HTMLInputElement | undefined>()
|
|
11
11
|
|
|
12
12
|
interface toolbarOption {
|
|
13
13
|
name: ToolbarConfigOption | 'separator'
|
|
@@ -104,7 +104,7 @@ function increaseFontSize() {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
function decreaseFontSize() {
|
|
107
|
-
|
|
107
|
+
// TODO:
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
function removeFormatting() {
|
|
@@ -135,7 +135,7 @@ function insertList(type: string) {
|
|
|
135
135
|
const list = document.createElement(type)
|
|
136
136
|
const listItem = document.createElement('li')
|
|
137
137
|
listItem.textContent = range.toString()
|
|
138
|
-
list.
|
|
138
|
+
list.append(listItem)
|
|
139
139
|
range.deleteContents()
|
|
140
140
|
range.insertNode(list)
|
|
141
141
|
}
|
|
@@ -158,7 +158,9 @@ export function insertImage() {
|
|
|
158
158
|
console.log('image')
|
|
159
159
|
const { showModalForm } = useModal()
|
|
160
160
|
console.log(showModalForm)
|
|
161
|
-
showModalForm({ title: 'Upload Image', schema: [{ id: 'image', type: 'file' }], onSubmit: (
|
|
161
|
+
showModalForm({ title: 'Upload Image', schema: [{ id: 'image', type: 'file' }], onSubmit: (_data) => {
|
|
162
|
+
//
|
|
163
|
+
} })
|
|
162
164
|
// const url = prompt('Enter the image URL:')
|
|
163
165
|
// if (url) {
|
|
164
166
|
// const selection = window.getSelection()
|
|
@@ -7,7 +7,7 @@ import Toolbar from './Toolbar.vue'
|
|
|
7
7
|
const props = defineProps<{ modelValue: string, toolbarConfig?: ToolbarConfig }>()
|
|
8
8
|
const emit = defineEmits(['update:modelValue'])
|
|
9
9
|
|
|
10
|
-
const editableContent = $ref<HTMLElement |
|
|
10
|
+
const editableContent = $ref<HTMLElement | undefined>()
|
|
11
11
|
const defaultConfig: ToolbarConfig = [
|
|
12
12
|
'bold',
|
|
13
13
|
'italic',
|
|
@@ -32,15 +32,15 @@ const emit = defineEmits(['update:modelValue'])
|
|
|
32
32
|
|
|
33
33
|
const searchPlaceholder = $computed(() => props.searchPlaceholder || 'Search')
|
|
34
34
|
|
|
35
|
-
const searchInput = $ref<HTMLInputElement |
|
|
35
|
+
const searchInput = $ref<HTMLInputElement | undefined>()
|
|
36
36
|
|
|
37
37
|
let selectedItems = $ref<Option[]>([])
|
|
38
38
|
|
|
39
39
|
const selectedItemCount = $computed(() => selectedItems.length ?? 0)
|
|
40
|
-
let search = $ref('')
|
|
41
|
-
|
|
42
|
-
const dropdown = $ref<InstanceType<typeof Dropdown> | null>(null)
|
|
40
|
+
let search = $ref<string>('')
|
|
43
41
|
|
|
42
|
+
const dropdown = $ref<InstanceType<typeof Dropdown> | undefined>()
|
|
43
|
+
let selected = $ref(false)
|
|
44
44
|
let open = $ref(false)
|
|
45
45
|
|
|
46
46
|
function openOptions() {
|
|
@@ -48,18 +48,7 @@ function openOptions() {
|
|
|
48
48
|
// updateOpen(true);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
open = visible
|
|
53
|
-
if (!open) { search = '' }
|
|
54
|
-
else {
|
|
55
|
-
setTimeout(
|
|
56
|
-
() => (searchInput as any)?.$el?.querySelector('input')?.focus(),
|
|
57
|
-
100,
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const selectedLabel = $computed(() => {
|
|
51
|
+
const selectedLabel = $computed((): string => {
|
|
63
52
|
if (selectedItemCount === 0) return props.placeholder || 'Select'
|
|
64
53
|
if (selectedItemCount > 4) {
|
|
65
54
|
const str = selectedItems
|
|
@@ -71,6 +60,38 @@ const selectedLabel = $computed(() => {
|
|
|
71
60
|
return selectedItems.map(item => getLabel(item)).join(', ')
|
|
72
61
|
})
|
|
73
62
|
|
|
63
|
+
const filteredOptions = $computed(() => props.options.filter((option) => {
|
|
64
|
+
const searchTerm = search
|
|
65
|
+
.split(/\s+/)
|
|
66
|
+
.filter(Boolean)
|
|
67
|
+
.map(t => new RegExp(t.replaceAll(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gi'))
|
|
68
|
+
return (
|
|
69
|
+
Boolean(option)
|
|
70
|
+
&& (searchTerm.every(s => getLabel(option).match(s))
|
|
71
|
+
)
|
|
72
|
+
)
|
|
73
|
+
}))
|
|
74
|
+
|
|
75
|
+
const isSelected = (option: Option) => selectedItems.some(item => getValue(option) === getValue(item)) !== undefined
|
|
76
|
+
|
|
77
|
+
function updateOpen(visible: boolean) {
|
|
78
|
+
open = visible
|
|
79
|
+
if (!open) {
|
|
80
|
+
if (props.searchable && !props.multiselect && !search && !selected) selectedItems = []
|
|
81
|
+
if (props.searchable && !props.multiselect && search && filteredOptions.length === 1 && !isSelected(filteredOptions[0])) {
|
|
82
|
+
select(filteredOptions[0])
|
|
83
|
+
}
|
|
84
|
+
search = ''
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
if (props.searchable && !props.multiselect && selectedItemCount) search = selectedLabel as string
|
|
88
|
+
setTimeout(
|
|
89
|
+
() => (searchInput as any)?.$el?.querySelector('input')?.focus(),
|
|
90
|
+
150,
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
74
95
|
function getLabel(option: Option) {
|
|
75
96
|
if (!option) return ''
|
|
76
97
|
if (typeof option === 'string') return option
|
|
@@ -79,27 +100,14 @@ function getLabel(option: Option) {
|
|
|
79
100
|
}
|
|
80
101
|
|
|
81
102
|
function getValue(option?: Option) {
|
|
82
|
-
if (!option) return
|
|
103
|
+
if (!option) return
|
|
83
104
|
if (typeof option === 'string') return option
|
|
84
105
|
if (typeof option === 'number') return option
|
|
85
106
|
return option.value
|
|
86
107
|
}
|
|
87
108
|
|
|
88
|
-
const isSelected = (option: Option) => selectedItems.find(item => getValue(option) === getValue(item)) !== undefined
|
|
89
|
-
|
|
90
|
-
const filteredOptions = $computed(() => props.options.filter((option) => {
|
|
91
|
-
const searchTerm = search
|
|
92
|
-
.split(/\s+/)
|
|
93
|
-
.filter(Boolean)
|
|
94
|
-
.map(t => new RegExp(t, 'gi'))
|
|
95
|
-
return (
|
|
96
|
-
Boolean(option)
|
|
97
|
-
&& (searchTerm.every(s => getLabel(option).match(s))
|
|
98
|
-
)
|
|
99
|
-
)
|
|
100
|
-
}))
|
|
101
|
-
|
|
102
109
|
function select(option: Option) {
|
|
110
|
+
selected = true
|
|
103
111
|
const existingIndex = selectedItems.findIndex(
|
|
104
112
|
item => getValue(item) === getValue(option),
|
|
105
113
|
)
|
|
@@ -191,7 +199,18 @@ onMounted(() => {
|
|
|
191
199
|
<label>
|
|
192
200
|
{{ label }}
|
|
193
201
|
<div class="flex gap-05">
|
|
202
|
+
<TextInput
|
|
203
|
+
v-if="searchable && open"
|
|
204
|
+
ref="searchInput"
|
|
205
|
+
v-model="search"
|
|
206
|
+
class="mb-0"
|
|
207
|
+
dense
|
|
208
|
+
:placeholder="searchPlaceholder"
|
|
209
|
+
icon="search"
|
|
210
|
+
@input="selected = false"
|
|
211
|
+
/>
|
|
194
212
|
<button
|
|
213
|
+
v-else
|
|
195
214
|
:disabled="disabled"
|
|
196
215
|
type="button"
|
|
197
216
|
class="selectinput-btn"
|
|
@@ -234,14 +253,6 @@ onMounted(() => {
|
|
|
234
253
|
class="p-05"
|
|
235
254
|
:style="{ width: fullWidth ? '100%' : 'auto' }"
|
|
236
255
|
>
|
|
237
|
-
<TextInput
|
|
238
|
-
v-if="searchable"
|
|
239
|
-
ref="searchInput"
|
|
240
|
-
v-model="search"
|
|
241
|
-
dense
|
|
242
|
-
:placeholder="searchPlaceholder"
|
|
243
|
-
icon="search"
|
|
244
|
-
/>
|
|
245
256
|
<div class="selectinput-options" :class="{ multiselect }">
|
|
246
257
|
<div
|
|
247
258
|
v-for="(option, i) in filteredOptions"
|
|
@@ -121,8 +121,8 @@ function draw() {
|
|
|
121
121
|
if (!isEmpty()) url = save()
|
|
122
122
|
const ratio = props.ratio ?? 1 / 2
|
|
123
123
|
const { width } = c.getBoundingClientRect()
|
|
124
|
-
c.width = props.width ? Number(props.width.
|
|
125
|
-
c.height = props.height ? Number(props.height.
|
|
124
|
+
c.width = props.width ? Number(props.width.replaceAll('px', '')) : width
|
|
125
|
+
c.height = props.height ? Number(props.height.replaceAll('px', '')) : width * ratio
|
|
126
126
|
clear()
|
|
127
127
|
if (!props.clearOnResize && url !== undefined) fromDataURL(url)
|
|
128
128
|
if (props.waterMark) addWaterMark(props.waterMark)
|
|
@@ -6,14 +6,14 @@ import { VueDraggableNext } from 'vue-draggable-next'
|
|
|
6
6
|
const props = withDefaults(
|
|
7
7
|
defineProps<{
|
|
8
8
|
description?: string
|
|
9
|
-
meta:
|
|
9
|
+
meta: { [key: string]: any } /* EntityMeta */
|
|
10
10
|
fieldname: string
|
|
11
11
|
bagelApp?: any
|
|
12
12
|
modelValue: any
|
|
13
13
|
}>(),
|
|
14
14
|
{
|
|
15
15
|
description: '',
|
|
16
|
-
bagelApp:
|
|
16
|
+
bagelApp: undefined,
|
|
17
17
|
},
|
|
18
18
|
)
|
|
19
19
|
const emits = defineEmits(['update:modelValue'])
|
|
@@ -21,10 +21,10 @@ let bagel: any
|
|
|
21
21
|
let api: any
|
|
22
22
|
const listRef = ref(props.modelValue)
|
|
23
23
|
const fieldMeta = props.meta.doc_meta.fields.find(
|
|
24
|
-
(field:
|
|
24
|
+
(field: { [key: string]: any }) => field.fieldname === props.fieldname,
|
|
25
25
|
)
|
|
26
26
|
const entityMeta = props.meta.links.find(
|
|
27
|
-
(link:
|
|
27
|
+
(link: { [key: string]: any }) => link.id === fieldMeta?.options,
|
|
28
28
|
)
|
|
29
29
|
|
|
30
30
|
function handleUpdateModelValue(value: any, index: number, fieldname: string) {
|
|
@@ -58,7 +58,7 @@ function removeRow(idx: number) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
function ended() {
|
|
61
|
-
listRef.value.forEach((item:
|
|
61
|
+
listRef.value.forEach((item: { [key: string]: any }, index: number) => {
|
|
62
62
|
item.idx = index + 1
|
|
63
63
|
})
|
|
64
64
|
emits('update:modelValue', listRef.value)
|
|
@@ -121,7 +121,7 @@ let selectedIndex = $ref<number>()
|
|
|
121
121
|
const dropdownOpenDirection = $ref('below')
|
|
122
122
|
const searchQuery = $ref('')
|
|
123
123
|
|
|
124
|
-
// const refInput = $ref<HTMLInputElement |
|
|
124
|
+
// const refInput = $ref<HTMLInputElement | undefined>()
|
|
125
125
|
|
|
126
126
|
// Computed: activeCountry
|
|
127
127
|
const activeCountry = $computed(() => props.allCountries.find(
|
|
@@ -132,11 +132,11 @@ const activeCountry = $computed(() => props.allCountries.find(
|
|
|
132
132
|
const isPreferred = (country?: Country) => props.preferredCountries.includes(country?.iso2 as CountryCode)
|
|
133
133
|
|
|
134
134
|
const filteredCountries = $computed(() => {
|
|
135
|
-
if (props.onlyCountries.length) {
|
|
135
|
+
if (props.onlyCountries.length > 0) {
|
|
136
136
|
return props.allCountries.filter(({ iso2 }) => props.onlyCountries.some(c => c.toUpperCase() === iso2),
|
|
137
137
|
)
|
|
138
138
|
}
|
|
139
|
-
if (props.excludeCountries.length) {
|
|
139
|
+
if (props.excludeCountries.length > 0) {
|
|
140
140
|
return props.allCountries.filter(
|
|
141
141
|
({ iso2 }) => !props.excludeCountries.includes(iso2.toUpperCase())
|
|
142
142
|
&& !props.excludeCountries.includes(iso2.toLowerCase()),
|
|
@@ -149,7 +149,7 @@ const sortedCountries = $computed(() => {
|
|
|
149
149
|
const preferredCountries = getCountries(props.preferredCountries)
|
|
150
150
|
|
|
151
151
|
const countriesList = [...preferredCountries, ...filteredCountries]
|
|
152
|
-
const cleanInput = searchQuery.
|
|
152
|
+
const cleanInput = searchQuery.replaceAll(
|
|
153
153
|
// eslint-disable-next-line regexp/no-obscure-range
|
|
154
154
|
/[~`!#$%&*()+={};:'"<>.,/?-_]/g,
|
|
155
155
|
'',
|
|
@@ -10,7 +10,7 @@ const props = withDefaults(defineProps<{
|
|
|
10
10
|
defaultValue?: boolean
|
|
11
11
|
}>(), { defaultValue: false })
|
|
12
12
|
|
|
13
|
-
const inputId = $ref(props.id || Math.random().toString(36).
|
|
13
|
+
const inputId = $ref(props.id || Math.random().toString(36).slice(7))
|
|
14
14
|
|
|
15
15
|
const checked = defineModel<boolean | undefined>('modelValue', { default: undefined })
|
|
16
16
|
|
|
@@ -21,8 +21,8 @@ defineProps<{
|
|
|
21
21
|
v-for="(nav, i) in navLinks" :key="i" :to="nav.to" class="m_h-auto"
|
|
22
22
|
@click="nav.onClick"
|
|
23
23
|
>
|
|
24
|
-
<Icon :icon="nav.icon" :size="1.4" class="m-0" />
|
|
25
|
-
<p class="m-0 pb-025
|
|
24
|
+
<Icon :icon="nav.icon" :size="1.4" class="m-0 line-height-14" />
|
|
25
|
+
<p class="m-0 pb-025 txt14 line-height-1">
|
|
26
26
|
{{ nav.label }}
|
|
27
27
|
</p>
|
|
28
28
|
</Btn>
|
|
@@ -17,14 +17,14 @@ const props = withDefaults(defineProps<LayoutProrps>(), {
|
|
|
17
17
|
mRows: () => ([]),
|
|
18
18
|
})
|
|
19
19
|
|
|
20
|
-
const gridTemplateRows = $computed(() => (props.rows.length ? props.rows.join(' ') : 'auto'))
|
|
20
|
+
const gridTemplateRows = $computed(() => (props.rows.length > 0 ? props.rows.join(' ') : 'auto'))
|
|
21
21
|
const gapSize = $computed(() => `${props.gap}rem`)
|
|
22
22
|
const mGridTemplateRows = $computed(() => {
|
|
23
23
|
if (props.mRows?.length) return props.mRows.join(' ')
|
|
24
24
|
return gridTemplateRows
|
|
25
25
|
})
|
|
26
26
|
|
|
27
|
-
const gridTemplateColumns = $computed(() => (props.columns.length ? props.columns.join(' ') : 'auto'))
|
|
27
|
+
const gridTemplateColumns = $computed(() => (props.columns.length > 0 ? props.columns.join(' ') : 'auto'))
|
|
28
28
|
|
|
29
29
|
const mGridTemplateColumns = $computed(() => {
|
|
30
30
|
if (props.mColumns?.length) return props.mColumns.join(' ')
|
|
@@ -13,7 +13,7 @@ const props = defineProps<{
|
|
|
13
13
|
|
|
14
14
|
const emit = defineEmits(['update:modelValue'])
|
|
15
15
|
const slots = useSlots()
|
|
16
|
-
const group = Math.random().toString(36).
|
|
16
|
+
const group = Math.random().toString(36).slice(7)
|
|
17
17
|
const { currentTab } = useTabs(group)
|
|
18
18
|
|
|
19
19
|
const tabValue = (tab: Tab) => (typeof tab === 'string' ? tab : tab.id)
|
|
@@ -30,7 +30,7 @@ const tabComponent = defineComponent({
|
|
|
30
30
|
const currentTabIndex = props.tabs.findIndex(
|
|
31
31
|
tab => tabValue(tab) === currentTab.value
|
|
32
32
|
)
|
|
33
|
-
if (currentTabIndex === -1) return
|
|
33
|
+
if (currentTabIndex === -1) return
|
|
34
34
|
const slotChildren = slots.default?.()[1]?.children
|
|
35
35
|
|
|
36
36
|
return h('div', (slotChildren as VNode[])[currentTabIndex])
|
|
@@ -9,10 +9,10 @@ let currentItem = $ref<LightboxItem>()
|
|
|
9
9
|
let group = $ref<LightboxItem[]>([])
|
|
10
10
|
let currentIndex = $ref(0)
|
|
11
11
|
|
|
12
|
-
function open(item: LightboxItem, groupItems
|
|
12
|
+
function open(item: LightboxItem, groupItems?: LightboxItem[]) {
|
|
13
13
|
isOpen = true
|
|
14
14
|
currentItem = item
|
|
15
|
-
if (
|
|
15
|
+
if (groupItems === undefined) return
|
|
16
16
|
group = groupItems
|
|
17
17
|
currentIndex = groupItems.findIndex(({ src }) => item.src === src)
|
|
18
18
|
document.addEventListener('keydown', handleKeydown)
|
|
@@ -5,22 +5,28 @@ import { createApp } from 'vue'
|
|
|
5
5
|
import Lightbox from './Lightbox.vue'
|
|
6
6
|
|
|
7
7
|
type OpenFunction = (item: LightboxItem, groupItems?: LightboxItem[]) => void
|
|
8
|
-
const groups:
|
|
8
|
+
const groups: { [key: string]: LightboxItem[] } = {}
|
|
9
|
+
|
|
10
|
+
let clickHandler: ((e: MouseEvent) => any) = (_e: MouseEvent) => void 0
|
|
11
|
+
|
|
9
12
|
const lightboxDirective: Directive = {
|
|
10
13
|
mounted(el: HTMLElement, binding) {
|
|
11
14
|
el.classList.add('hover')
|
|
12
15
|
const item = bindingToItem(binding, el)
|
|
13
16
|
groupHandler(item)
|
|
14
|
-
|
|
17
|
+
clickHandler = (e: MouseEvent) => { openClickHandler(e, el, binding) }
|
|
18
|
+
el.addEventListener('click', clickHandler)
|
|
15
19
|
},
|
|
16
20
|
updated(el: HTMLElement, binding) {
|
|
17
21
|
const item = bindingToItem(binding, el)
|
|
18
22
|
groupHandler(item)
|
|
19
|
-
|
|
20
|
-
el.
|
|
23
|
+
|
|
24
|
+
el.removeEventListener('click', clickHandler)
|
|
25
|
+
clickHandler = (e: MouseEvent) => { openClickHandler(e, el, binding) }
|
|
26
|
+
el.addEventListener('click', clickHandler)
|
|
21
27
|
},
|
|
22
|
-
unmounted(el: HTMLElement
|
|
23
|
-
el.removeEventListener('click',
|
|
28
|
+
unmounted(el: HTMLElement) {
|
|
29
|
+
el.removeEventListener('click', clickHandler)
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
|
|
@@ -60,7 +66,7 @@ function determineFileType(url: string): string {
|
|
|
60
66
|
return 'unknown'
|
|
61
67
|
}
|
|
62
68
|
|
|
63
|
-
let lightboxInstance: InstanceType<typeof Lightbox> |
|
|
69
|
+
let lightboxInstance: InstanceType<typeof Lightbox> | undefined
|
|
64
70
|
|
|
65
71
|
function getLightboxInstance(): InstanceType<typeof Lightbox> {
|
|
66
72
|
if (!lightboxInstance) {
|
package/src/composables/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ interface useBglSchemaParamsT<T> {
|
|
|
9
9
|
data?: any[]
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export function useBglSchema<T =
|
|
12
|
+
export function useBglSchema<T = { [key: string]: unknown }>(
|
|
13
13
|
{ schema, showFields, data }: useBglSchemaParamsT<T> = {}
|
|
14
14
|
): BglFormSchemaT<T> {
|
|
15
15
|
let _schema = schema
|
|
@@ -18,7 +18,7 @@ export function useBglSchema<T = Record<string, unknown>>(
|
|
|
18
18
|
}
|
|
19
19
|
if (_schema) {
|
|
20
20
|
return (
|
|
21
|
-
showFields && showFields.length
|
|
21
|
+
showFields && showFields.length > 0
|
|
22
22
|
? _schema.filter(f => showFields.includes(f.id as string))
|
|
23
23
|
: _schema
|
|
24
24
|
) as BglFormSchemaT<T>
|