sard 1.0.13 → 1.0.14
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/all-components.js +0 -2
- package/components/badge/index.css +1 -1
- package/components/index.d.ts +0 -1
- package/components/index.js +2 -3
- package/components/infinite-list/common.d.ts +5 -10
- package/components/infinite-list/common.js +1 -1
- package/components/infinite-list/index.css +0 -1
- package/components/infinite-list/infinite-list.vue.d.ts +5 -6
- package/components/infinite-list/infinite-list.vue.js +41 -82
- package/components/load-more/common.d.ts +9 -3
- package/components/load-more/common.js +9 -2
- package/components/load-more/index.d.ts +3 -2
- package/components/load-more/index.js +2 -2
- package/components/load-more/load-more.vue.d.ts +6 -6
- package/components/load-more/load-more.vue.js +33 -5
- package/components/pull-down-refresh/common.d.ts +1 -0
- package/components/pull-down-refresh/common.js +1 -1
- package/components/pull-down-refresh/pull-down-refresh.vue.d.ts +1 -0
- package/components/pull-down-refresh/pull-down-refresh.vue.js +27 -9
- package/components/select/common.d.ts +4 -4
- package/components/select/common.js +0 -1
- package/components/select/index.css +1 -1
- package/components/select/select.vue.d.ts +3 -5
- package/components/select/select.vue.js +14 -51
- package/components/select-input/common.d.ts +2 -2
- package/components/select-input/select-input.vue.d.ts +5 -3
- package/components/select-input/select-input.vue.js +29 -19
- package/components/select-popout/common.d.ts +3 -5
- package/components/select-popout/select-popout.vue.d.ts +5 -3
- package/components/select-popout/select-popout.vue.js +27 -20
- package/global.d.ts +0 -1
- package/index.css +1 -1
- package/index.js +2 -3
- package/package.json +1 -1
- package/use/useIntersectionObserver.d.ts +1 -0
- package/use/useIntersectionObserver.js +4 -1
- package/components/load-more/useLoadMore.d.ts +0 -22
- package/components/load-more/useLoadMore.js +0 -71
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createBem } from "../../utils/bem.js";
|
|
2
|
-
import { debounce } from "../../utils/utils.js";
|
|
3
2
|
import { scrollToTarget } from "../../utils/geometry.js";
|
|
4
3
|
import { useScrollSide } from "../../use/useScrollSide.js";
|
|
5
4
|
import { usePopupEnter } from "../popup/common.js";
|
|
@@ -9,19 +8,13 @@ import { useTranslateWithPrefix } from "../../locale/index.js";
|
|
|
9
8
|
import button_default from "../button/button.vue.js";
|
|
10
9
|
import input_default from "../input/input.vue.js";
|
|
11
10
|
import empty_default from "../empty/empty.vue.js";
|
|
12
|
-
import load_more_default from "../load-more/load-more.vue.js";
|
|
13
|
-
import { useLoadMore } from "../load-more/useLoadMore.js";
|
|
14
11
|
import { defaultSelectProps } from "./common.js";
|
|
15
12
|
import select_option_group_default from "./select-option-group.vue.js";
|
|
16
13
|
import select_option_default from "./select-option.vue.js";
|
|
17
14
|
import { useSelect } from "./useSelect.js";
|
|
18
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, mergeDefaults, mergeProps, normalizeClass,
|
|
15
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, mergeDefaults, mergeProps, normalizeClass, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useSlots, useTemplateRef, watch, withCtx } from "vue";
|
|
19
16
|
import { Search } from "@sard/icons";
|
|
20
17
|
//#region packages/sard/components/select/select.vue
|
|
21
|
-
const _hoisted_1 = {
|
|
22
|
-
key: 1,
|
|
23
|
-
ref: "load-more"
|
|
24
|
-
};
|
|
25
18
|
var select_default = /*@__PURE__*/ defineComponent({
|
|
26
19
|
__name: "select",
|
|
27
20
|
props: /*@__PURE__*/ mergeDefaults({
|
|
@@ -53,18 +46,6 @@ var select_default = /*@__PURE__*/ defineComponent({
|
|
|
53
46
|
type: String,
|
|
54
47
|
required: false
|
|
55
48
|
},
|
|
56
|
-
remote: {
|
|
57
|
-
type: Boolean,
|
|
58
|
-
required: false
|
|
59
|
-
},
|
|
60
|
-
remoteMethod: {
|
|
61
|
-
type: Function,
|
|
62
|
-
required: false
|
|
63
|
-
},
|
|
64
|
-
threshold: {
|
|
65
|
-
type: Number,
|
|
66
|
-
required: false
|
|
67
|
-
},
|
|
68
49
|
showToolbar: {
|
|
69
50
|
type: Boolean,
|
|
70
51
|
required: false
|
|
@@ -80,13 +61,17 @@ var select_default = /*@__PURE__*/ defineComponent({
|
|
|
80
61
|
valueKey: {
|
|
81
62
|
type: String,
|
|
82
63
|
required: false
|
|
64
|
+
},
|
|
65
|
+
filterLoading: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
required: false
|
|
83
68
|
}
|
|
84
69
|
}, defaultSelectProps),
|
|
85
70
|
emits: [
|
|
86
71
|
"update:modelValue",
|
|
87
72
|
"change",
|
|
88
73
|
"select",
|
|
89
|
-
"update:
|
|
74
|
+
"update:filterValue"
|
|
90
75
|
],
|
|
91
76
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
92
77
|
const props = __props;
|
|
@@ -117,32 +102,16 @@ var select_default = /*@__PURE__*/ defineComponent({
|
|
|
117
102
|
};
|
|
118
103
|
const scrollRef = useTemplateRef("scroll");
|
|
119
104
|
const scrollSide = useScrollSide(scrollRef, { direction: "vertical" });
|
|
120
|
-
const searchValue = ref("");
|
|
105
|
+
const searchValue = ref(String(props.filterValue ?? ""));
|
|
121
106
|
watch(() => props.filterValue, () => {
|
|
122
107
|
searchValue.value = String(props.filterValue ?? "");
|
|
123
108
|
});
|
|
124
109
|
watch(searchValue, () => {
|
|
125
110
|
props.filterMethod?.(searchValue.value);
|
|
126
|
-
|
|
127
|
-
if (searchValue.value !== props.filterValue) emit("update:filter-value", searchValue.value);
|
|
128
|
-
});
|
|
129
|
-
const { status, isLoading, onLoadMore, onReload, refresh } = useLoadMore({
|
|
130
|
-
root: scrollRef,
|
|
131
|
-
target: useTemplateRef("load-more"),
|
|
132
|
-
disabled: () => !props.remote || !props.remoteMethod,
|
|
133
|
-
request: async (page, isRefresh) => {
|
|
134
|
-
return props.remoteMethod(searchValue.value, page, isRefresh).then((loaded) => {
|
|
135
|
-
if (isRefresh && scrollRef.value) scrollRef.value.scrollTop = 0;
|
|
136
|
-
return loaded;
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
const debouncedRefresh = debounce(refresh, props.threshold);
|
|
141
|
-
onBeforeUnmount(() => {
|
|
142
|
-
debouncedRefresh.cancel();
|
|
111
|
+
if (searchValue.value !== props.filterValue) emit("update:filterValue", searchValue.value);
|
|
143
112
|
});
|
|
144
113
|
const isEmpty = computed(() => {
|
|
145
|
-
return members.length === 0
|
|
114
|
+
return members.length === 0;
|
|
146
115
|
});
|
|
147
116
|
const onClear = () => {
|
|
148
117
|
if (innerValue.value.length > 0) triggerChange([]);
|
|
@@ -172,7 +141,9 @@ var select_default = /*@__PURE__*/ defineComponent({
|
|
|
172
141
|
const scrollClass = computed(() => {
|
|
173
142
|
return [bem.e("scroll"), bem.em("scroll", "filterable", props.filterable)];
|
|
174
143
|
});
|
|
175
|
-
__expose({
|
|
144
|
+
__expose({ scrollTop: () => {
|
|
145
|
+
if (scrollRef.value) scrollRef.value.scrollTop = 0;
|
|
146
|
+
} });
|
|
176
147
|
return (_ctx, _cache) => {
|
|
177
148
|
return openBlock(), createElementBlock("div", { class: normalizeClass(unref(bem).b()) }, [
|
|
178
149
|
__props.filterable ? (openBlock(), createElementBlock("div", {
|
|
@@ -185,7 +156,7 @@ var select_default = /*@__PURE__*/ defineComponent({
|
|
|
185
156
|
clearable: ""
|
|
186
157
|
}, {
|
|
187
158
|
prepend: withCtx(() => [createVNode(unref(Search))]),
|
|
188
|
-
append: withCtx(() => [
|
|
159
|
+
append: withCtx(() => [__props.filterLoading ? (openBlock(), createBlock(loading_default, {
|
|
189
160
|
key: 0,
|
|
190
161
|
class: normalizeClass(unref(bem).e("loading"))
|
|
191
162
|
}, null, 8, ["class"])) : createCommentVNode("v-if", true)]),
|
|
@@ -237,15 +208,7 @@ var select_default = /*@__PURE__*/ defineComponent({
|
|
|
237
208
|
key: 0,
|
|
238
209
|
class: normalizeClass(unref(bem).e("empty"))
|
|
239
210
|
}, [createVNode(empty_default, { size: "small" })], 2)) : createCommentVNode("v-if", true),
|
|
240
|
-
|
|
241
|
-
status: unref(status),
|
|
242
|
-
onLoadMore: unref(onLoadMore),
|
|
243
|
-
onReload: unref(onReload)
|
|
244
|
-
}, null, 8, [
|
|
245
|
-
"status",
|
|
246
|
-
"onLoadMore",
|
|
247
|
-
"onReload"
|
|
248
|
-
])], 512)) : createCommentVNode("v-if", true)
|
|
211
|
+
renderSlot(_ctx.$slots, "bottom")
|
|
249
212
|
], 2)], 2),
|
|
250
213
|
__props.multiple && __props.showToolbar ? (openBlock(), createElementBlock("div", {
|
|
251
214
|
key: 1,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DefaultProps } from '../config';
|
|
2
|
-
import { type SelectPopoutEmits, type SelectPopoutProps, type SelectPopoutSlots } from '../select-popout/common';
|
|
2
|
+
import { type SelectPopoutEmits, type SelectPopoutExpose, type SelectPopoutProps, type SelectPopoutSlots } from '../select-popout/common';
|
|
3
3
|
import { type PopoutInputSlots, type PopoutInputProps } from '../popout-input/common';
|
|
4
4
|
export interface SelectInputProps extends SelectPopoutProps, Omit<PopoutInputProps, 'modelValue'> {
|
|
5
5
|
maxLabels?: number;
|
|
@@ -10,5 +10,5 @@ export interface SelectInputSlots extends SelectPopoutSlots, Omit<PopoutInputSlo
|
|
|
10
10
|
}
|
|
11
11
|
export interface SelectInputEmits extends SelectPopoutEmits {
|
|
12
12
|
}
|
|
13
|
-
export interface SelectInputExpose {
|
|
13
|
+
export interface SelectInputExpose extends SelectPopoutExpose {
|
|
14
14
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type SelectInputProps, type SelectInputSlots, type SelectInputExpose } from './common';
|
|
2
2
|
type __VLS_Slots = SelectInputSlots;
|
|
3
3
|
declare const __VLS_base: import("vue").DefineComponent<SelectInputProps, SelectInputExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
4
|
+
select: (value: any) => any;
|
|
4
5
|
change: (value: any) => any;
|
|
5
6
|
"before-enter": (el: Element) => any;
|
|
6
7
|
enter: (el: Element) => any;
|
|
@@ -14,7 +15,9 @@ declare const __VLS_base: import("vue").DefineComponent<SelectInputProps, Select
|
|
|
14
15
|
"update:visible": (visible: boolean) => any;
|
|
15
16
|
"update:modelValue": (value: any) => any;
|
|
16
17
|
confirm: (value: any) => any;
|
|
18
|
+
"update:filterValue": (value: string) => any;
|
|
17
19
|
}, string, import("vue").PublicProps, Readonly<SelectInputProps> & Readonly<{
|
|
20
|
+
onSelect?: ((value: any) => any) | undefined;
|
|
18
21
|
onChange?: ((value: any) => any) | undefined;
|
|
19
22
|
"onBefore-enter"?: ((el: Element) => any) | undefined;
|
|
20
23
|
onEnter?: ((el: Element) => any) | undefined;
|
|
@@ -28,6 +31,7 @@ declare const __VLS_base: import("vue").DefineComponent<SelectInputProps, Select
|
|
|
28
31
|
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
29
32
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
30
33
|
onConfirm?: ((value: any) => any) | undefined;
|
|
34
|
+
"onUpdate:filterValue"?: ((value: string) => any) | undefined;
|
|
31
35
|
}>, {
|
|
32
36
|
title: string;
|
|
33
37
|
multiple: boolean;
|
|
@@ -35,7 +39,6 @@ declare const __VLS_base: import("vue").DefineComponent<SelectInputProps, Select
|
|
|
35
39
|
readonly: boolean;
|
|
36
40
|
visible: boolean;
|
|
37
41
|
loading: boolean;
|
|
38
|
-
threshold: number;
|
|
39
42
|
disabled: boolean;
|
|
40
43
|
modelValue: any;
|
|
41
44
|
showConfirm: boolean;
|
|
@@ -52,10 +55,9 @@ declare const __VLS_base: import("vue").DefineComponent<SelectInputProps, Select
|
|
|
52
55
|
filterable: boolean;
|
|
53
56
|
filterMethod: (query: string) => void;
|
|
54
57
|
filterValue: string;
|
|
55
|
-
remote: boolean;
|
|
56
|
-
remoteMethod: (query: string, page: number, isRefresh: boolean) => Promise<boolean>;
|
|
57
58
|
showToolbar: boolean;
|
|
58
59
|
valueKey: string;
|
|
60
|
+
filterLoading: boolean;
|
|
59
61
|
maxLabels: number;
|
|
60
62
|
mapLabel: Record<any, any>;
|
|
61
63
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -5,7 +5,7 @@ import popout_input_default from "../popout-input/popout-input.vue.js";
|
|
|
5
5
|
import { partitionPopoutInputProps, usePopoutInput } from "../popout-input/usePopoutInput.js";
|
|
6
6
|
import select_popout_default from "../select-popout/select-popout.vue.js";
|
|
7
7
|
import { defaultSelectInputProps } from "./common.js";
|
|
8
|
-
import { computed, createBlock, createSlots, createVNode, defineComponent, guardReactiveProps, isRef, mergeDefaults, mergeProps, normalizeProps, openBlock, renderSlot, unref, useSlots, watch, withCtx } from "vue";
|
|
8
|
+
import { computed, createBlock, createSlots, createVNode, defineComponent, guardReactiveProps, isRef, mergeDefaults, mergeProps, normalizeProps, openBlock, renderSlot, unref, useSlots, useTemplateRef, watch, withCtx } from "vue";
|
|
9
9
|
//#region packages/sard/components/select-input/select-input.vue
|
|
10
10
|
var select_input_default = /*@__PURE__*/ defineComponent({
|
|
11
11
|
__name: "select-input",
|
|
@@ -66,18 +66,6 @@ var select_input_default = /*@__PURE__*/ defineComponent({
|
|
|
66
66
|
type: String,
|
|
67
67
|
required: false
|
|
68
68
|
},
|
|
69
|
-
remote: {
|
|
70
|
-
type: Boolean,
|
|
71
|
-
required: false
|
|
72
|
-
},
|
|
73
|
-
remoteMethod: {
|
|
74
|
-
type: Function,
|
|
75
|
-
required: false
|
|
76
|
-
},
|
|
77
|
-
threshold: {
|
|
78
|
-
type: Number,
|
|
79
|
-
required: false
|
|
80
|
-
},
|
|
81
69
|
showToolbar: {
|
|
82
70
|
type: Boolean,
|
|
83
71
|
required: false
|
|
@@ -94,6 +82,10 @@ var select_input_default = /*@__PURE__*/ defineComponent({
|
|
|
94
82
|
type: String,
|
|
95
83
|
required: false
|
|
96
84
|
},
|
|
85
|
+
filterLoading: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
required: false
|
|
88
|
+
},
|
|
97
89
|
placeholder: {
|
|
98
90
|
type: String,
|
|
99
91
|
required: false
|
|
@@ -129,8 +121,6 @@ var select_input_default = /*@__PURE__*/ defineComponent({
|
|
|
129
121
|
}, defaultSelectInputProps),
|
|
130
122
|
emits: [
|
|
131
123
|
"update:visible",
|
|
132
|
-
"update:modelValue",
|
|
133
|
-
"change",
|
|
134
124
|
"confirm",
|
|
135
125
|
"before-enter",
|
|
136
126
|
"enter",
|
|
@@ -140,7 +130,11 @@ var select_input_default = /*@__PURE__*/ defineComponent({
|
|
|
140
130
|
"leave",
|
|
141
131
|
"after-leave",
|
|
142
132
|
"leave-cancelled",
|
|
143
|
-
"visible-hook"
|
|
133
|
+
"visible-hook",
|
|
134
|
+
"update:modelValue",
|
|
135
|
+
"change",
|
|
136
|
+
"select",
|
|
137
|
+
"update:filterValue"
|
|
144
138
|
],
|
|
145
139
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
146
140
|
const props = __props;
|
|
@@ -193,7 +187,16 @@ var select_input_default = /*@__PURE__*/ defineComponent({
|
|
|
193
187
|
const onConfirm = (value) => {
|
|
194
188
|
emit("confirm", value);
|
|
195
189
|
};
|
|
196
|
-
|
|
190
|
+
const onSelect = (value) => {
|
|
191
|
+
emit("select", value);
|
|
192
|
+
};
|
|
193
|
+
const onUpdateFilterValue = (value) => {
|
|
194
|
+
emit("update:filterValue", value);
|
|
195
|
+
};
|
|
196
|
+
const selectPopoutRef = useTemplateRef("selectPopout");
|
|
197
|
+
__expose({ scrollTop: () => {
|
|
198
|
+
selectPopoutRef.value?.scrollTop();
|
|
199
|
+
} });
|
|
197
200
|
return (_ctx, _cache) => {
|
|
198
201
|
return openBlock(), createBlock(popout_input_default, mergeProps(unref(partitionedProps)[0], {
|
|
199
202
|
modelValue: unref(inputValue),
|
|
@@ -202,14 +205,16 @@ var select_input_default = /*@__PURE__*/ defineComponent({
|
|
|
202
205
|
onClear: unref(onClear),
|
|
203
206
|
onClick: unref(show)
|
|
204
207
|
}), createSlots({
|
|
205
|
-
default: withCtx(() => [createVNode(select_popout_default, mergeProps(unref(partitionedProps)[1], {
|
|
208
|
+
default: withCtx(() => [createVNode(select_popout_default, mergeProps({ ref: "selectPopout" }, unref(partitionedProps)[1], {
|
|
206
209
|
visible: unref(innerVisible),
|
|
207
210
|
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => isRef(innerVisible) ? innerVisible.value = $event : null),
|
|
208
211
|
modelValue: unref(innerValue),
|
|
209
212
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(innerValue) ? innerValue.value = $event : null),
|
|
210
213
|
onChange: unref(onChange),
|
|
211
214
|
onVisibleHook: unref(onVisibleHook),
|
|
212
|
-
onConfirm
|
|
215
|
+
onConfirm,
|
|
216
|
+
onSelect,
|
|
217
|
+
"onUpdate:filterValue": onUpdateFilterValue
|
|
213
218
|
}), createSlots({ _: 2 }, [
|
|
214
219
|
slots.default ? {
|
|
215
220
|
name: "default",
|
|
@@ -225,6 +230,11 @@ var select_input_default = /*@__PURE__*/ defineComponent({
|
|
|
225
230
|
name: "option-label",
|
|
226
231
|
fn: withCtx((labelProps) => [renderSlot(_ctx.$slots, "option-label", normalizeProps(guardReactiveProps(labelProps)))]),
|
|
227
232
|
key: "2"
|
|
233
|
+
} : void 0,
|
|
234
|
+
slots.bottom ? {
|
|
235
|
+
name: "bottom",
|
|
236
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "bottom")]),
|
|
237
|
+
key: "3"
|
|
228
238
|
} : void 0
|
|
229
239
|
]), 1040, [
|
|
230
240
|
"visible",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DefaultProps } from '../config';
|
|
2
|
-
import { type SelectSlots, type SelectProps } from '../select/common';
|
|
2
|
+
import { type SelectSlots, type SelectProps, type SelectEmits, type SelectExpose } from '../select/common';
|
|
3
3
|
import { type FormPopoutProps } from '../popout/useFormPopout';
|
|
4
4
|
import type { MotionEmits } from '../motion';
|
|
5
5
|
export interface SelectPopoutProps extends FormPopoutProps, SelectProps {
|
|
@@ -7,11 +7,9 @@ export interface SelectPopoutProps extends FormPopoutProps, SelectProps {
|
|
|
7
7
|
export declare const defaultSelectPopoutProps: DefaultProps<SelectPopoutProps>;
|
|
8
8
|
export interface SelectPopoutSlots extends SelectSlots {
|
|
9
9
|
}
|
|
10
|
-
export interface SelectPopoutEmits extends MotionEmits {
|
|
10
|
+
export interface SelectPopoutEmits extends MotionEmits, SelectEmits {
|
|
11
11
|
(e: 'update:visible', visible: boolean): void;
|
|
12
|
-
(e: 'update:modelValue', value: any): void;
|
|
13
|
-
(e: 'change', value: any): void;
|
|
14
12
|
(e: 'confirm', value: any): void;
|
|
15
13
|
}
|
|
16
|
-
export interface SelectPopoutExpose {
|
|
14
|
+
export interface SelectPopoutExpose extends SelectExpose {
|
|
17
15
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type SelectPopoutProps, type SelectPopoutSlots, type SelectPopoutExpose } from './common';
|
|
2
2
|
type __VLS_Slots = SelectPopoutSlots;
|
|
3
3
|
declare const __VLS_base: import("vue").DefineComponent<SelectPopoutProps, SelectPopoutExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
4
|
+
select: (value: any) => any;
|
|
4
5
|
change: (value: any) => any;
|
|
5
6
|
"before-enter": (el: Element) => any;
|
|
6
7
|
enter: (el: Element) => any;
|
|
@@ -14,7 +15,9 @@ declare const __VLS_base: import("vue").DefineComponent<SelectPopoutProps, Selec
|
|
|
14
15
|
"update:visible": (visible: boolean) => any;
|
|
15
16
|
"update:modelValue": (value: any) => any;
|
|
16
17
|
confirm: (value: any) => any;
|
|
18
|
+
"update:filterValue": (value: string) => any;
|
|
17
19
|
}, string, import("vue").PublicProps, Readonly<SelectPopoutProps> & Readonly<{
|
|
20
|
+
onSelect?: ((value: any) => any) | undefined;
|
|
18
21
|
onChange?: ((value: any) => any) | undefined;
|
|
19
22
|
"onBefore-enter"?: ((el: Element) => any) | undefined;
|
|
20
23
|
onEnter?: ((el: Element) => any) | undefined;
|
|
@@ -28,12 +31,12 @@ declare const __VLS_base: import("vue").DefineComponent<SelectPopoutProps, Selec
|
|
|
28
31
|
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
29
32
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
30
33
|
onConfirm?: ((value: any) => any) | undefined;
|
|
34
|
+
"onUpdate:filterValue"?: ((value: string) => any) | undefined;
|
|
31
35
|
}>, {
|
|
32
36
|
title: string;
|
|
33
37
|
multiple: boolean;
|
|
34
38
|
options: any[];
|
|
35
39
|
visible: boolean;
|
|
36
|
-
threshold: number;
|
|
37
40
|
modelValue: any;
|
|
38
41
|
showConfirm: boolean;
|
|
39
42
|
optionKeys: import("../../index.ts").OptionKeys;
|
|
@@ -44,10 +47,9 @@ declare const __VLS_base: import("vue").DefineComponent<SelectPopoutProps, Selec
|
|
|
44
47
|
filterable: boolean;
|
|
45
48
|
filterMethod: (query: string) => void;
|
|
46
49
|
filterValue: string;
|
|
47
|
-
remote: boolean;
|
|
48
|
-
remoteMethod: (query: string, page: number, isRefresh: boolean) => Promise<boolean>;
|
|
49
50
|
showToolbar: boolean;
|
|
50
51
|
valueKey: string;
|
|
52
|
+
filterLoading: boolean;
|
|
51
53
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
52
54
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
53
55
|
declare const _default: typeof __VLS_export;
|
|
@@ -2,7 +2,7 @@ import popout_default from "../popout/popout.vue.js";
|
|
|
2
2
|
import { omitFormPopoutProps, useFormPopout } from "../popout/useFormPopout.js";
|
|
3
3
|
import select_default from "../select/select.vue.js";
|
|
4
4
|
import { defaultSelectPopoutProps } from "./common.js";
|
|
5
|
-
import { createBlock, createSlots, createVNode, defineComponent, guardReactiveProps, isRef, mergeDefaults, mergeProps, normalizeProps, openBlock, renderSlot, unref, useSlots, withCtx } from "vue";
|
|
5
|
+
import { createBlock, createSlots, createVNode, defineComponent, guardReactiveProps, isRef, mergeDefaults, mergeProps, normalizeProps, openBlock, renderSlot, unref, useSlots, useTemplateRef, withCtx } from "vue";
|
|
6
6
|
//#region packages/sard/components/select-popout/select-popout.vue
|
|
7
7
|
var select_popout_default = /*@__PURE__*/ defineComponent({
|
|
8
8
|
__name: "select-popout",
|
|
@@ -55,18 +55,6 @@ var select_popout_default = /*@__PURE__*/ defineComponent({
|
|
|
55
55
|
type: String,
|
|
56
56
|
required: false
|
|
57
57
|
},
|
|
58
|
-
remote: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
required: false
|
|
61
|
-
},
|
|
62
|
-
remoteMethod: {
|
|
63
|
-
type: Function,
|
|
64
|
-
required: false
|
|
65
|
-
},
|
|
66
|
-
threshold: {
|
|
67
|
-
type: Number,
|
|
68
|
-
required: false
|
|
69
|
-
},
|
|
70
58
|
showToolbar: {
|
|
71
59
|
type: Boolean,
|
|
72
60
|
required: false
|
|
@@ -82,12 +70,14 @@ var select_popout_default = /*@__PURE__*/ defineComponent({
|
|
|
82
70
|
valueKey: {
|
|
83
71
|
type: String,
|
|
84
72
|
required: false
|
|
73
|
+
},
|
|
74
|
+
filterLoading: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
required: false
|
|
85
77
|
}
|
|
86
78
|
}, defaultSelectPopoutProps),
|
|
87
79
|
emits: [
|
|
88
80
|
"update:visible",
|
|
89
|
-
"update:modelValue",
|
|
90
|
-
"change",
|
|
91
81
|
"confirm",
|
|
92
82
|
"before-enter",
|
|
93
83
|
"enter",
|
|
@@ -97,7 +87,11 @@ var select_popout_default = /*@__PURE__*/ defineComponent({
|
|
|
97
87
|
"leave",
|
|
98
88
|
"after-leave",
|
|
99
89
|
"leave-cancelled",
|
|
100
|
-
"visible-hook"
|
|
90
|
+
"visible-hook",
|
|
91
|
+
"update:modelValue",
|
|
92
|
+
"change",
|
|
93
|
+
"select",
|
|
94
|
+
"update:filterValue"
|
|
101
95
|
],
|
|
102
96
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
103
97
|
const props = __props;
|
|
@@ -105,13 +99,20 @@ var select_popout_default = /*@__PURE__*/ defineComponent({
|
|
|
105
99
|
const emit = __emit;
|
|
106
100
|
const omittedProps = omitFormPopoutProps(props);
|
|
107
101
|
const { innerVisible, draftValue, onChange, onConfirm, onVisibleHook } = useFormPopout(props, emit);
|
|
108
|
-
const onSelect = () => {
|
|
102
|
+
const onSelect = (value) => {
|
|
109
103
|
if (!props.multiple && !props.showConfirm) {
|
|
110
104
|
onConfirm(false);
|
|
111
105
|
innerVisible.value = false;
|
|
112
106
|
}
|
|
107
|
+
emit("select", value);
|
|
113
108
|
};
|
|
114
|
-
|
|
109
|
+
const onUpdateFilterValue = (value) => {
|
|
110
|
+
emit("update:filterValue", value);
|
|
111
|
+
};
|
|
112
|
+
const selectRef = useTemplateRef("select");
|
|
113
|
+
__expose({ scrollTop: () => {
|
|
114
|
+
selectRef.value?.scrollTop();
|
|
115
|
+
} });
|
|
115
116
|
return (_ctx, _cache) => {
|
|
116
117
|
return openBlock(), createBlock(popout_default, {
|
|
117
118
|
visible: unref(innerVisible),
|
|
@@ -121,10 +122,11 @@ var select_popout_default = /*@__PURE__*/ defineComponent({
|
|
|
121
122
|
onConfirm: unref(onConfirm),
|
|
122
123
|
onVisibleHook: unref(onVisibleHook)
|
|
123
124
|
}, {
|
|
124
|
-
default: withCtx(() => [createVNode(select_default, mergeProps(unref(omittedProps), {
|
|
125
|
+
default: withCtx(() => [createVNode(select_default, mergeProps({ ref: "select" }, unref(omittedProps), {
|
|
125
126
|
"model-value": unref(draftValue),
|
|
126
127
|
onChange: unref(onChange),
|
|
127
|
-
onSelect
|
|
128
|
+
onSelect,
|
|
129
|
+
"onUpdate:filterValue": onUpdateFilterValue
|
|
128
130
|
}), createSlots({ _: 2 }, [
|
|
129
131
|
slots.default ? {
|
|
130
132
|
name: "default",
|
|
@@ -140,6 +142,11 @@ var select_popout_default = /*@__PURE__*/ defineComponent({
|
|
|
140
142
|
name: "option-label",
|
|
141
143
|
fn: withCtx((labelProps) => [renderSlot(_ctx.$slots, "option-label", normalizeProps(guardReactiveProps(labelProps)))]),
|
|
142
144
|
key: "2"
|
|
145
|
+
} : void 0,
|
|
146
|
+
slots.bottom ? {
|
|
147
|
+
name: "bottom",
|
|
148
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "bottom")]),
|
|
149
|
+
key: "3"
|
|
143
150
|
} : void 0
|
|
144
151
|
]), 1040, ["model-value", "onChange"])]),
|
|
145
152
|
_: 3
|
package/global.d.ts
CHANGED
|
@@ -64,7 +64,6 @@ declare module 'vue' {
|
|
|
64
64
|
SImage: typeof import('./components/image/image').default
|
|
65
65
|
SIndexes: typeof import('./components/indexes/indexes').default
|
|
66
66
|
SIndexesAnchor: typeof import('./components/indexes/indexes-anchor').default
|
|
67
|
-
SInfiniteList: typeof import('./components/infinite-list/infinite-list').default
|
|
68
67
|
SInput: typeof import('./components/input/input').default
|
|
69
68
|
SKeyboard: typeof import('./components/keyboard/keyboard').default
|
|
70
69
|
SKeyboardPopout: typeof import('./components/keyboard-popout/keyboard-popout').default
|