@bagelink/vue 0.0.927 → 0.0.933

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.
@@ -13,10 +13,11 @@ export declare function denullify(itemData?: {
13
13
  [key: string]: any;
14
14
  }, fieldID?: string): any;
15
15
  export declare const isDate: (dateToTest: any) => boolean;
16
- export * as bagelFormUtils from './BagelFormUtils';
17
- export { useLang } from './lang';
18
- export { formatString } from './strings';
19
16
  export declare function getFallbackSchema<T>(data?: any[], showFields?: string[]): BglFormSchemaT<T>;
20
17
  export declare function sleep(ms?: number): Promise<unknown>;
21
18
  export declare function appendScript(src: string): Promise<void>;
19
+ export * as bagelFormUtils from './BagelFormUtils';
20
+ export { useLang } from './lang';
21
+ export { formatString } from './strings';
22
+ export { useDebounceFn } from '@vueuse/core';
22
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE/D,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,EAC3E,QAAQ,EAAE,CAAC,EACX,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,OAAO,GACjB,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAelC;AAED,wBAAgB,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ3D;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,iBAGtE;AAED,wBAAgB,QAAQ,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,UAG3C;AAED,wBA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,UAAU,CAAC,EAAE,MAAM,EAAE,GACnB,cAAc,CAAC,CAAC,CAAC,CAWnB;AAED,wBAAgB,KAAK,CAAC,EAAE,GAAE,MAAY,oBAErC;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAcvD;AAED,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAA;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "0.0.927",
4
+ "version": "0.0.933",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -27,6 +27,7 @@ const is = $computed(() => (props.to ? 'router-link' : 'div'))
27
27
  <template>
28
28
  <component
29
29
  :is="is"
30
+ v-ripple="!!to"
30
31
  :to="to"
31
32
  class="bgl_card"
32
33
  :class="{
@@ -7,8 +7,8 @@ import {
7
7
  keyToLabel,
8
8
  useBglSchema,
9
9
  } from '@bagelink/vue'
10
- import { useVirtualList } from '@vueuse/core'
11
- import { computed, useSlots, watch, onMounted, onUnmounted } from 'vue'
10
+ import { useVirtualList, useIntersectionObserver, until } from '@vueuse/core'
11
+ import { computed, useSlots, watch, onMounted } from 'vue'
12
12
 
13
13
  export type SortDirectionsT = 'ASC' | 'DESC'
14
14
  export type EmitOrderT = `${string} ${SortDirectionsT}`
@@ -188,24 +188,22 @@ function toggleSelectAll(event: Event) {
188
188
  selectedItems.value = value ? computedData.value.map((d: any) => d.id) : []
189
189
  }
190
190
  // #endregion ? SELECT COLUMN
191
+
191
192
  const lastItem = $ref<HTMLTableRowElement | null>()
192
- let observer: IntersectionObserver | undefined
193
193
 
194
- function registerLastItemObserver() {
195
- if (onLastItemVisible === undefined) return
196
- observer = new IntersectionObserver(([entry]) => {
194
+ async function registerLastItemObserver() {
195
+ await until(() => lastItem).toBeTruthy()
196
+
197
+ useIntersectionObserver(lastItem, ([entry]) => {
197
198
  if (entry.isIntersecting && computedData.value.length) {
198
- void onLastItemVisible()
199
+ void onLastItemVisible?.()
199
200
  }
200
201
  })
201
- if (lastItem) observer.observe(lastItem)
202
202
  }
203
203
 
204
204
  onMounted(() => {
205
- registerLastItemObserver()
205
+ void registerLastItemObserver()
206
206
  })
207
-
208
- onUnmounted(() => { observer?.disconnect() })
209
207
  </script>
210
208
 
211
209
  <template>
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  MaterialIcon,
4
4
  type MaterialIcons,
5
- debounce,
5
+ useDebounceFn,
6
6
  } from '@bagelink/vue'
7
7
  import { onMounted, watch } from 'vue'
8
8
 
@@ -51,13 +51,14 @@ const rows = $computed(() => {
51
51
  return 1
52
52
  })
53
53
 
54
- const debounceUpdate = debounce(() => { emit('debounce', inputVal) }, props.debounceDelay)
54
+ const debounceUpdate = useDebounceFn(() => { emit('debounce', inputVal) }, props.debounceDelay)
55
+
55
56
  function updateInputVal() {
56
57
  if (props.disabled) return
57
58
 
58
59
  emit('update:modelValue', inputVal as string)
59
60
 
60
- debounceUpdate()
61
+ void debounceUpdate()
61
62
  }
62
63
 
63
64
  watch(
@@ -94,33 +95,33 @@ onMounted(() => {
94
95
 
95
96
  <input
96
97
  v-if="!multiline && !autoheight && !code"
97
- :id="id"
98
+ :id
98
99
  ref="input"
99
100
  v-model.trim="inputVal"
100
- :title="title"
101
- :autocomplete="autocomplete"
101
+ :title
102
+ :autocomplete
102
103
  :type="type"
103
104
  :rows="1"
104
105
  :placeholder="placeholder || label"
105
106
  :disabled
106
- :required="required"
107
- :pattern="pattern"
107
+ :required
108
+ :pattern
108
109
  v-bind="nativeInputAttrs"
109
110
  @focusout="onFocusout"
110
111
  @input="updateInputVal"
111
112
  >
112
113
  <textarea
113
114
  v-else
114
- :id="id"
115
+ :id
115
116
  ref="input"
116
117
  v-model="inputVal"
117
- :title="title"
118
- :type="type"
119
- :rows="rows"
118
+ :title
119
+ :type
120
+ :rows
120
121
  :placeholder="placeholder || label"
121
122
  :disabled
122
- :required="required"
123
- :pattern="pattern"
123
+ :required
124
+ :pattern
124
125
  v-bind="nativeInputAttrs"
125
126
  @input="updateInputVal"
126
127
  @focusout="onFocusout"
@@ -133,7 +134,7 @@ onMounted(() => {
133
134
  />
134
135
  <MaterialIcon
135
136
  v-if="icon"
136
- :icon="icon"
137
+ :icon
137
138
  />
138
139
  </label>
139
140
  </div>
@@ -1,12 +1,7 @@
1
- import type { Directive } from 'vue'
2
-
3
- const ripple: Directive<HTMLElement> = {
4
- mounted(el: HTMLElement) {
5
- if (getComputedStyle(el).position === 'static') {
6
- el.style.position = 'relative'
7
- }
8
- el.style.overflow = 'hidden'
1
+ import type { Directive, DirectiveBinding } from 'vue'
9
2
 
3
+ const ripple: Directive<HTMLElement, boolean> = {
4
+ mounted(el: HTMLElement, binding: DirectiveBinding<boolean>) {
10
5
  const clickHandler = (e: MouseEvent) => {
11
6
  const rect = el.getBoundingClientRect()
12
7
  const size = Math.max(rect.width, rect.height)
@@ -27,11 +22,30 @@ const ripple: Directive<HTMLElement> = {
27
22
  })
28
23
 
29
24
  el.appendChild(ripple)
30
- // setTimeout(() => { ripple.remove() }, 600)
25
+ setTimeout(() => { ripple.remove() }, 600)
31
26
  };
32
27
 
33
28
  (el as any).__rippleClickHandler = clickHandler
34
- el.addEventListener('mousedown', clickHandler)
29
+
30
+ if (binding.value !== false) {
31
+ if (getComputedStyle(el).position === 'static') {
32
+ el.style.position = 'relative'
33
+ }
34
+ el.style.overflow = 'hidden'
35
+ el.addEventListener('mousedown', clickHandler)
36
+ }
37
+ },
38
+ updated(el: HTMLElement, binding: DirectiveBinding<boolean>) {
39
+ const clickHandler = (el as any).__rippleClickHandler
40
+ if (binding.value === false) {
41
+ el.removeEventListener('mousedown', clickHandler)
42
+ } else {
43
+ if (getComputedStyle(el).position === 'static') {
44
+ el.style.position = 'relative'
45
+ }
46
+ el.style.overflow = 'hidden'
47
+ el.addEventListener('mousedown', clickHandler)
48
+ }
35
49
  },
36
50
  unmounted(el: HTMLElement) {
37
51
  const clickHandler = (el as any).__rippleClickHandler
@@ -91,12 +91,6 @@ export function denullify(itemData?: { [key: string]: any }, fieldID?: string) {
91
91
 
92
92
  export const isDate = (dateToTest: any) => !Number.isNaN(Date.parse(dateToTest))
93
93
 
94
- export * as bagelFormUtils from './BagelFormUtils'
95
-
96
- export { useLang } from './lang'
97
-
98
- export { formatString } from './strings'
99
-
100
94
  export function getFallbackSchema<T>(
101
95
  data?: any[],
102
96
  showFields?: string[]
@@ -132,3 +126,10 @@ export function appendScript(src: string): Promise<void> {
132
126
  document.head.append(script)
133
127
  })
134
128
  }
129
+
130
+ export * as bagelFormUtils from './BagelFormUtils'
131
+
132
+ export { useLang } from './lang'
133
+
134
+ export { formatString } from './strings'
135
+ export { useDebounceFn } from '@vueuse/core'