sprintify-ui 0.0.110 → 0.0.112
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/sprintify-ui.es.js +2188 -2181
- package/dist/types/src/composables/clickOutside.d.ts +1 -1
- package/dist/types/src/types/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/BaseAutocomplete.vue +8 -2
- package/src/composables/clickOutside.ts +14 -2
- package/src/types/index.ts +2 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MaybeElementRef } from '@vueuse/core';
|
|
2
2
|
interface UseClickOutsideOptions {
|
|
3
|
-
includes?: MaybeElementRef[];
|
|
3
|
+
includes?: (MaybeElementRef | string)[];
|
|
4
4
|
}
|
|
5
5
|
export declare function useClickOutside(element: MaybeElementRef, callback: () => void, options?: UseClickOutsideOptions): {
|
|
6
6
|
stop: () => void;
|
|
@@ -169,6 +169,7 @@ export interface SelectConfigurationOption {
|
|
|
169
169
|
[key: string]: any;
|
|
170
170
|
}
|
|
171
171
|
export interface SelectConfiguration {
|
|
172
|
+
option?: SelectConfigurationOption;
|
|
172
173
|
options: SelectConfigurationOption[];
|
|
173
|
-
onChange
|
|
174
|
+
onChange?: (option: SelectConfigurationOption | null) => void;
|
|
174
175
|
}
|
package/package.json
CHANGED
|
@@ -425,8 +425,14 @@ const selection = ref(null) as Ref<OptionValue>;
|
|
|
425
425
|
watch(
|
|
426
426
|
() => props.select,
|
|
427
427
|
(select) => {
|
|
428
|
-
if (select
|
|
429
|
-
|
|
428
|
+
if (select) {
|
|
429
|
+
if (select.option) {
|
|
430
|
+
selection.value = select.option.value;
|
|
431
|
+
} else if (select.options.length) {
|
|
432
|
+
selection.value = select.options[0].value;
|
|
433
|
+
}
|
|
434
|
+
} else {
|
|
435
|
+
selection.value = null;
|
|
430
436
|
}
|
|
431
437
|
},
|
|
432
438
|
{ immediate: true }
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { MaybeElementRef, unrefElement, tryOnScopeDispose } from '@vueuse/core';
|
|
2
|
+
import { isString } from 'lodash';
|
|
2
3
|
|
|
3
4
|
interface UseClickOutsideOptions {
|
|
4
|
-
includes?: MaybeElementRef[];
|
|
5
|
+
includes?: (MaybeElementRef | string)[];
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
export function useClickOutside(
|
|
@@ -27,7 +28,18 @@ export function useClickOutside(
|
|
|
27
28
|
function onClick(e: Event) {
|
|
28
29
|
const el = unrefElement(element);
|
|
29
30
|
|
|
30
|
-
const includeEls =
|
|
31
|
+
const includeEls = [] as Element[];
|
|
32
|
+
|
|
33
|
+
options.includes?.forEach((include) => {
|
|
34
|
+
if (isString(include)) {
|
|
35
|
+
includeEls.push(...document.querySelectorAll(include));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const element = unrefElement(include);
|
|
39
|
+
if (element) {
|
|
40
|
+
includeEls.push(element);
|
|
41
|
+
}
|
|
42
|
+
}) ?? [];
|
|
31
43
|
|
|
32
44
|
if (!el) {
|
|
33
45
|
return;
|
package/src/types/index.ts
CHANGED
|
@@ -205,6 +205,7 @@ export interface SelectConfigurationOption {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
export interface SelectConfiguration {
|
|
208
|
+
option?: SelectConfigurationOption;
|
|
208
209
|
options: SelectConfigurationOption[];
|
|
209
|
-
onChange
|
|
210
|
+
onChange?: (option: SelectConfigurationOption | null) => void;
|
|
210
211
|
}
|