@bagelink/vue 0.0.807 → 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/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/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 +112 -112
- package/dist/index.mjs +112 -112
- package/dist/plugins/modal.d.ts +12 -4
- package/dist/plugins/modal.d.ts.map +1 -1
- package/dist/style.css +3070 -393
- 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 +5 -5
- 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 +4 -4
- 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 +5 -5
- 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/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/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
|
|
|
@@ -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,14 +32,14 @@ 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
40
|
let search = $ref<string>('')
|
|
41
41
|
|
|
42
|
-
const dropdown = $ref<InstanceType<typeof Dropdown> |
|
|
42
|
+
const dropdown = $ref<InstanceType<typeof Dropdown> | undefined>()
|
|
43
43
|
let selected = $ref(false)
|
|
44
44
|
let open = $ref(false)
|
|
45
45
|
|
|
@@ -64,7 +64,7 @@ const filteredOptions = $computed(() => props.options.filter((option) => {
|
|
|
64
64
|
const searchTerm = search
|
|
65
65
|
.split(/\s+/)
|
|
66
66
|
.filter(Boolean)
|
|
67
|
-
.map(t => new RegExp(t.
|
|
67
|
+
.map(t => new RegExp(t.replaceAll(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gi'))
|
|
68
68
|
return (
|
|
69
69
|
Boolean(option)
|
|
70
70
|
&& (searchTerm.every(s => getLabel(option).match(s))
|
|
@@ -72,7 +72,7 @@ const filteredOptions = $computed(() => props.options.filter((option) => {
|
|
|
72
72
|
)
|
|
73
73
|
}))
|
|
74
74
|
|
|
75
|
-
const isSelected = (option: Option) => selectedItems.
|
|
75
|
+
const isSelected = (option: Option) => selectedItems.some(item => getValue(option) === getValue(item)) !== undefined
|
|
76
76
|
|
|
77
77
|
function updateOpen(visible: boolean) {
|
|
78
78
|
open = visible
|
|
@@ -100,7 +100,7 @@ function getLabel(option: Option) {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
function getValue(option?: Option) {
|
|
103
|
-
if (!option) return
|
|
103
|
+
if (!option) return
|
|
104
104
|
if (typeof option === 'string') return option
|
|
105
105
|
if (typeof option === 'number') return option
|
|
106
106
|
return option.value
|
|
@@ -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
|
|
|
@@ -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>
|
package/src/plugins/modal.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface ModalFormOptions extends ModalOptions {
|
|
|
19
19
|
'onSubmit'?: (formData: any) => any
|
|
20
20
|
'onDelete'?: (id: string) => Promise<void>
|
|
21
21
|
'onError'?: (err: any) => void
|
|
22
|
-
'modelValue'?:
|
|
22
|
+
'modelValue'?: { [key: string]: any }
|
|
23
23
|
'onUpdate:modelValue'?: (val: any) => void
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -39,7 +39,7 @@ type ModalType = 'modal' | 'modalForm' | 'confirmModal'
|
|
|
39
39
|
type ConfirmModalUserOptions = string | { title: string, message: string, confirmText?: string, cancelText?: string, confirmBtnColor?: string, cancelBtnColor?: string }
|
|
40
40
|
|
|
41
41
|
export interface ModalComponentProps {
|
|
42
|
-
componentSlots:
|
|
42
|
+
componentSlots: { [key: string]: any }
|
|
43
43
|
modalType: ModalType
|
|
44
44
|
modalOptions: ModalOptions | ModalFormOptions | ModalConfirmOptions
|
|
45
45
|
}
|
|
@@ -50,8 +50,8 @@ export interface ModalFormComponentProps extends ModalComponentProps {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export interface ModalApi {
|
|
53
|
-
showModal: (options: ModalOptions, slots?:
|
|
54
|
-
showModalForm: (options: ModalFormOptions, slots?:
|
|
53
|
+
showModal: (options: ModalOptions, slots?: { [key: string]: any }) => ModalComponentProps | undefined
|
|
54
|
+
showModalForm: (options: ModalFormOptions, slots?: { [key: string]: any }) => ModalFormComponentProps | undefined
|
|
55
55
|
hideModal: (index?: number) => void
|
|
56
56
|
confirmModal: (options: ConfirmModalUserOptions) => Promise<boolean>
|
|
57
57
|
}
|
|
@@ -86,7 +86,7 @@ export const ModalPlugin: Plugin = {
|
|
|
86
86
|
const showModal = (
|
|
87
87
|
modalType: ModalType,
|
|
88
88
|
options: ModalOptions | ModalFormOptions,
|
|
89
|
-
slots:
|
|
89
|
+
slots: { [key: string]: any } = {}
|
|
90
90
|
): ModalComponentProps | ModalFormComponentProps | undefined => {
|
|
91
91
|
const modalComponent = {
|
|
92
92
|
modalOptions: options,
|
|
@@ -102,9 +102,9 @@ export const ModalPlugin: Plugin = {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
app.provide(ModalSymbol, {
|
|
105
|
-
showModal: (options: ModalOptions, slots?:
|
|
105
|
+
showModal: (options: ModalOptions, slots?: { [key: string]: any }) => showModal('modal', options, slots),
|
|
106
106
|
|
|
107
|
-
showModalForm: (options: ModalFormOptions, slots?:
|
|
107
|
+
showModalForm: (options: ModalFormOptions, slots?: { [key: string]: any }) => showModal('modalForm', options, slots) as ModalFormComponentProps,
|
|
108
108
|
|
|
109
109
|
confirmModal: (options: ConfirmModalUserOptions) => confirmModal(options),
|
|
110
110
|
|
|
@@ -478,6 +478,20 @@
|
|
|
478
478
|
object-fit: scale-down;
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
+
|
|
482
|
+
.shadow-10 {
|
|
483
|
+
box-shadow: 0 0 10px 0 var(--bgl-shadow) !important;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.shadow-20,
|
|
487
|
+
.shadow {
|
|
488
|
+
box-shadow: 0 0 20px 0 var(--bgl-shadow) !important;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
.shadow-30 {
|
|
492
|
+
box-shadow: 0 0 30px 0 var(--bgl-shadow) !important;
|
|
493
|
+
}
|
|
494
|
+
|
|
481
495
|
.shadow-light {
|
|
482
496
|
box-shadow: 0 1px 5px 0 rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1) !important;
|
|
483
497
|
}
|
|
@@ -1118,4 +1132,26 @@
|
|
|
1118
1132
|
.m_user-select-all {
|
|
1119
1133
|
user-select: all;
|
|
1120
1134
|
}
|
|
1135
|
+
|
|
1136
|
+
.m_shadow-10 {
|
|
1137
|
+
box-shadow: 0 0 10px 0 var(--bgl-shadow) !important;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
.m_shadow-20,
|
|
1141
|
+
.m_shadow {
|
|
1142
|
+
box-shadow: 0 0 20px 0 var(--bgl-shadow) !important;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
.m_shadow-30 {
|
|
1146
|
+
box-shadow: 0 0 30px 0 var(--bgl-shadow) !important;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
.m_shadow-light {
|
|
1150
|
+
box-shadow: 0 1px 5px 0 rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1) !important;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
.m_shadow-txt {
|
|
1154
|
+
filter: drop-shadow(0 0 10px var(--bgl-black-tint));
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1121
1157
|
}
|