@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.
Files changed (105) hide show
  1. package/dist/components/BglVideo.vue.d.ts.map +1 -1
  2. package/dist/components/DataPreview.vue.d.ts +9 -3
  3. package/dist/components/DataPreview.vue.d.ts.map +1 -1
  4. package/dist/components/MapEmbed.vue.d.ts.map +1 -1
  5. package/dist/components/ModalForm.vue.d.ts +9 -3
  6. package/dist/components/ModalForm.vue.d.ts.map +1 -1
  7. package/dist/components/NavBar.vue.d.ts.map +1 -1
  8. package/dist/components/TableSchema.vue.d.ts +3 -1
  9. package/dist/components/TableSchema.vue.d.ts.map +1 -1
  10. package/dist/components/Zoomer.vue.d.ts.map +1 -1
  11. package/dist/components/form/BglField.vue.d.ts +3 -1
  12. package/dist/components/form/BglField.vue.d.ts.map +1 -1
  13. package/dist/components/form/BglForm.vue.d.ts +9 -3
  14. package/dist/components/form/BglForm.vue.d.ts.map +1 -1
  15. package/dist/components/form/BglMultiStepForm.vue.d.ts +3 -1
  16. package/dist/components/form/BglMultiStepForm.vue.d.ts.map +1 -1
  17. package/dist/components/form/inputs/ColorPicker.vue.d.ts +6 -2
  18. package/dist/components/form/inputs/ColorPicker.vue.d.ts.map +1 -1
  19. package/dist/components/form/inputs/DatePicker.vue.d.ts +6 -2
  20. package/dist/components/form/inputs/DatePicker.vue.d.ts.map +1 -1
  21. package/dist/components/form/inputs/PasswordInput.vue.d.ts +3 -1
  22. package/dist/components/form/inputs/PasswordInput.vue.d.ts.map +1 -1
  23. package/dist/components/form/inputs/RichText2/formatting.d.ts.map +1 -1
  24. package/dist/components/form/inputs/SelectInput.vue.d.ts +6 -2
  25. package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
  26. package/dist/components/form/inputs/TableField.vue.d.ts +6 -2
  27. package/dist/components/form/inputs/TableField.vue.d.ts.map +1 -1
  28. package/dist/components/form/inputs/TextInput.vue.d.ts +6 -2
  29. package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
  30. package/dist/components/lightbox/Lightbox.vue.d.ts.map +1 -1
  31. package/dist/components/lightbox/index.d.ts.map +1 -1
  32. package/dist/composables/index.d.ts +3 -1
  33. package/dist/composables/index.d.ts.map +1 -1
  34. package/dist/index.cjs +112 -112
  35. package/dist/index.mjs +112 -112
  36. package/dist/plugins/modal.d.ts +12 -4
  37. package/dist/plugins/modal.d.ts.map +1 -1
  38. package/dist/style.css +3070 -393
  39. package/dist/types/BagelForm.d.ts +27 -9
  40. package/dist/types/BagelForm.d.ts.map +1 -1
  41. package/dist/types/index.d.ts +3 -1
  42. package/dist/types/index.d.ts.map +1 -1
  43. package/dist/utils/BagelFormUtils.d.ts +45 -15
  44. package/dist/utils/BagelFormUtils.d.ts.map +1 -1
  45. package/dist/utils/allCountries.d.ts +1 -1
  46. package/dist/utils/allCountries.d.ts.map +1 -1
  47. package/dist/utils/index.d.ts +6 -2
  48. package/dist/utils/index.d.ts.map +1 -1
  49. package/dist/utils/lang.d.ts +3 -1
  50. package/dist/utils/lang.d.ts.map +1 -1
  51. package/dist/utils/strings.d.ts.map +1 -1
  52. package/package.json +5 -5
  53. package/src/components/Accordion.vue +1 -1
  54. package/src/components/AccordionItem.vue +4 -4
  55. package/src/components/AddressSearch.vue +1 -1
  56. package/src/components/BglVideo.vue +1 -2
  57. package/src/components/DataPreview.vue +1 -1
  58. package/src/components/MapEmbed.vue +4 -6
  59. package/src/components/ModalForm.vue +3 -3
  60. package/src/components/NavBar.vue +6 -3
  61. package/src/components/TableSchema.vue +6 -6
  62. package/src/components/Zoomer.vue +7 -8
  63. package/src/components/dashboard/Lineart.vue +3 -3
  64. package/src/components/form/BglField.vue +2 -2
  65. package/src/components/form/BglFieldSet.vue +1 -1
  66. package/src/components/form/BglForm.vue +2 -2
  67. package/src/components/form/inputs/CheckInput.vue +1 -1
  68. package/src/components/form/inputs/ColorPicker.vue +1 -1
  69. package/src/components/form/inputs/DatePicker.vue +1 -1
  70. package/src/components/form/inputs/FileUpload.vue +4 -4
  71. package/src/components/form/inputs/OTP.vue +6 -6
  72. package/src/components/form/inputs/PasswordInput.vue +1 -1
  73. package/src/components/form/inputs/RadioPillsInput.vue +1 -1
  74. package/src/components/form/inputs/RichText.vue +1 -1
  75. package/src/components/form/inputs/RichText2/Toolbar.vue +2 -2
  76. package/src/components/form/inputs/RichText2/formatting.ts +5 -3
  77. package/src/components/form/inputs/RichText2/index.vue +1 -1
  78. package/src/components/form/inputs/SelectInput.vue +5 -5
  79. package/src/components/form/inputs/SignaturePad.vue +2 -2
  80. package/src/components/form/inputs/TableField.vue +5 -5
  81. package/src/components/form/inputs/TelInput.vue +4 -4
  82. package/src/components/form/inputs/TextInput.vue +1 -1
  83. package/src/components/form/inputs/ToggleInput.vue +1 -1
  84. package/src/components/formkit/FileUploader.vue +1 -1
  85. package/src/components/formkit/MiscFields.vue +1 -1
  86. package/src/components/layout/Layout.vue +2 -2
  87. package/src/components/layout/Tabs.vue +2 -2
  88. package/src/components/layout/TabsNav.vue +1 -1
  89. package/src/components/layout/tabsManager.ts +1 -1
  90. package/src/components/lightbox/Lightbox.vue +2 -2
  91. package/src/components/lightbox/index.ts +13 -7
  92. package/src/composables/index.ts +2 -2
  93. package/src/plugins/modal.ts +7 -7
  94. package/src/styles/appearance.css +36 -0
  95. package/src/styles/layout.css +1563 -60
  96. package/src/styles/mobilLayout.css +1519 -30
  97. package/src/styles/theme.css +1 -1
  98. package/src/types/BagelForm.ts +9 -9
  99. package/src/types/index.ts +1 -1
  100. package/src/utils/BagelFormUtils.ts +1 -1
  101. package/src/utils/allCountries.ts +1 -1
  102. package/src/utils/index.ts +7 -7
  103. package/src/utils/lang.ts +1 -1
  104. package/src/utils/strings.ts +1 -2
  105. 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?: Record<string, any>
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 = () => new Date().getTime() - instAt.getTime()
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).substring(7))
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
 
@@ -10,7 +10,7 @@ const props = withDefaults(
10
10
  editMode?: boolean
11
11
  small?: boolean
12
12
  required?: boolean
13
- nativeInputAttrs?: Record<string, any>
13
+ nativeInputAttrs?: { [key: string]: any }
14
14
  }>(),
15
15
  {
16
16
  editMode: true,
@@ -5,7 +5,7 @@ import '@vuepic/vue-datepicker/dist/main.css'
5
5
  const props = defineProps<{
6
6
  label?: string
7
7
  id?: string
8
- options?: Record<string, any>
8
+ options?: { [key: string]: any }
9
9
  showTimeWrap?: boolean
10
10
  modelValue?: Date
11
11
  allowedDates?: string[] | Date[]
@@ -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.length) return
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.find(sf => sf[bindKey] === f[bindKey]))
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 | null)[]>([])
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').replace(/\D/g, '') // Ensure only numeric digits are pasted
14
- const pastedDigits = pastedText?.split('')
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] = null
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] = null
70
+ digits[i] = undefined
71
71
  }
72
72
  }
73
73
 
74
74
  function isDigitsFull() {
75
75
  for (const elem of digits) {
76
- if (elem == null || elem == undefined) {
76
+ if (elem === undefined) {
77
77
  return false
78
78
  }
79
79
  }
@@ -13,7 +13,7 @@ export interface TextInputProps {
13
13
  pattern?: string
14
14
  shrink?: boolean
15
15
  disabled?: boolean
16
- nativeInputAttrs?: Record<string, any>
16
+ nativeInputAttrs?: { [key: string]: any }
17
17
  icon?: MaterialIcons
18
18
  iconStart?: MaterialIcons
19
19
  multiline?: boolean
@@ -12,7 +12,7 @@ const props = withDefaults(
12
12
  }>(),
13
13
  {
14
14
  modelValue: '',
15
- id: () => `radio-pill-${Math.random().toString(36).substring(2, 9)}`,
15
+ id: () => `radio-pill-${Math.random().toString(36).slice(2, 9)}`,
16
16
  label: '',
17
17
  },
18
18
  )
@@ -50,7 +50,7 @@ const config: {
50
50
  name: string
51
51
  command: any
52
52
  icon: MaterialIcons
53
- option?: Record<string, any>
53
+ option?: { [key: string]: any }
54
54
  disabled?: () => boolean
55
55
  }[] = [
56
56
  {
@@ -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 | null>(null)
10
- // const fontSizeInput = $ref<HTMLInputElement | null>(null)
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.appendChild(listItem)
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: (data) => {} })
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 | null>(null)
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 | null>(null)
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> | null>(null)
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.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gi'))
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.find(item => getValue(option) === getValue(item)) !== undefined
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 undefined
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.replace(/px/g, '')) : width
125
- c.height = props.height ? Number(props.height.replace(/px/g, '')) : width * ratio
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: Record<string, any> /* EntityMeta */
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: null,
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: Record<string, any>) => field.fieldname === props.fieldname,
24
+ (field: { [key: string]: any }) => field.fieldname === props.fieldname,
25
25
  )
26
26
  const entityMeta = props.meta.links.find(
27
- (link: Record<string, any>) => link.id === fieldMeta?.options,
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: Record<string, any>, index: number) => {
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 | null>(null)
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.replace(
152
+ const cleanInput = searchQuery.replaceAll(
153
153
  // eslint-disable-next-line regexp/no-obscure-range
154
154
  /[~`!#$%&*()+={};:'"<>.,/?-_]/g,
155
155
  '',
@@ -21,7 +21,7 @@ const props = withDefaults(
21
21
  shrink?: boolean
22
22
  disabled?: boolean
23
23
  type?: string
24
- nativeInputAttrs?: Record<string, any>
24
+ nativeInputAttrs?: { [key: string]: any }
25
25
  icon?: MaterialIcons
26
26
  iconStart?: MaterialIcons
27
27
  multiline?: boolean
@@ -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).substring(7))
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
 
@@ -15,7 +15,7 @@ import { onMounted, onUnmounted } from 'vue'
15
15
 
16
16
  const props = withDefaults(
17
17
  defineProps<{
18
- context: Record<string, any>
18
+ context: { [key: string]: any }
19
19
  dragDropLabel?: string
20
20
  browseLabel?: string
21
21
  multiple?: boolean
@@ -2,7 +2,7 @@
2
2
  import { Btn } from '@bagelink/vue'
3
3
 
4
4
  const props = defineProps<{
5
- context: Record<string, any>
5
+ context: { [key: string]: any }
6
6
  addBtnLabel: string
7
7
  }>()
8
8
 
@@ -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).substring(7)
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 null
33
+ if (currentTabIndex === -1) return
34
34
  const slotChildren = slots.default?.()[1]?.children
35
35
 
36
36
  return h('div', (slotChildren as VNode[])[currentTabIndex])
@@ -26,7 +26,7 @@ currentTab.value
26
26
  ? props.tabs[0]
27
27
  : props.tabs[0].id
28
28
 
29
- const tabsWrap = ref<HTMLElement | null>(null)
29
+ const tabsWrap = ref<HTMLElement | undefined>(undefined)
30
30
  const tabs = ref<HTMLElement[]>([])
31
31
 
32
32
  function updateIndicator() {
@@ -4,7 +4,7 @@ const state = reactive(new Map())
4
4
 
5
5
  export function useTabs(group: string) {
6
6
  if (!state.has(group)) {
7
- state.set(group, reactive({ currentTab: null }))
7
+ state.set(group, reactive({ currentTab: undefined }))
8
8
  }
9
9
 
10
10
  const currentTab = computed({
@@ -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: LightboxItem[] = []) {
12
+ function open(item: LightboxItem, groupItems?: LightboxItem[]) {
13
13
  isOpen = true
14
14
  currentItem = item
15
- if (!groupItems.length) return
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: Record<string, LightboxItem[]> = {}
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
- el.addEventListener('click', (e) => { openClickHandler(e, el, binding) })
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
- el.removeEventListener('click', (e) => { openClickHandler(e, el, binding) })
20
- el.addEventListener('click', (e) => { openClickHandler(e, el, binding) })
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, binding) {
23
- el.removeEventListener('click', (e) => { openClickHandler(e, el, binding) })
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> | null = null
69
+ let lightboxInstance: InstanceType<typeof Lightbox> | undefined
64
70
 
65
71
  function getLightboxInstance(): InstanceType<typeof Lightbox> {
66
72
  if (!lightboxInstance) {
@@ -9,7 +9,7 @@ interface useBglSchemaParamsT<T> {
9
9
  data?: any[]
10
10
  }
11
11
 
12
- export function useBglSchema<T = Record<string, unknown>>(
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>
@@ -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'?: Record<string, any>
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: Record<string, any>
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?: Record<string, any>) => ModalComponentProps | undefined
54
- showModalForm: (options: ModalFormOptions, slots?: Record<string, any>) => ModalFormComponentProps | undefined
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: Record<string, any> = {}
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?: Record<string, any>) => showModal('modal', options, slots),
105
+ showModal: (options: ModalOptions, slots?: { [key: string]: any }) => showModal('modal', options, slots),
106
106
 
107
- showModalForm: (options: ModalFormOptions, slots?: Record<string, any>) => showModal('modalForm', options, slots) as ModalFormComponentProps,
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
  }