sard 1.0.12 → 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/README.md +6 -7
- package/all-components.js +0 -2
- package/components/action-sheet/action-sheet.vue.d.ts +1 -0
- package/components/action-sheet/action-sheet.vue.js +11 -1
- package/components/action-sheet/common.d.ts +1 -0
- package/components/action-sheet/common.js +4 -1
- package/components/badge/index.css +1 -1
- package/components/crop-image/common.d.ts +1 -0
- package/components/crop-image/common.js +2 -1
- package/components/crop-image/crop-image.vue.d.ts +1 -0
- package/components/crop-image/crop-image.vue.js +10 -1
- package/components/dialog/common.d.ts +1 -0
- package/components/dialog/common.js +2 -1
- package/components/dialog/dialog.vue.d.ts +1 -0
- package/components/dialog/dialog.vue.js +14 -1
- package/components/index.d.ts +0 -1
- package/components/index.js +3 -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/popout/common.d.ts +1 -0
- package/components/popout/common.js +2 -1
- package/components/popout/popout.vue.d.ts +1 -0
- package/components/popout/popout.vue.js +11 -1
- package/components/popup/common.d.ts +2 -0
- package/components/popup/index.d.ts +1 -0
- package/components/popup/index.js +2 -1
- package/components/popup/popup-manager.d.ts +15 -0
- package/components/popup/popup-manager.js +25 -0
- package/components/popup/popup.vue.d.ts +3 -0
- package/components/popup/popup.vue.js +16 -1
- package/components/preview-image/common.d.ts +1 -0
- package/components/preview-image/common.js +2 -1
- package/components/preview-image/preview-image.vue.d.ts +1 -0
- package/components/preview-image/preview-image.vue.js +14 -1
- 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 +28 -10
- 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/components/share-sheet/common.d.ts +1 -0
- package/components/share-sheet/common.js +4 -1
- package/components/share-sheet/share-sheet.vue.d.ts +1 -0
- package/components/share-sheet/share-sheet.vue.js +14 -2
- package/global.d.ts +0 -1
- package/index.css +1 -1
- package/index.js +3 -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
package/README.md
CHANGED
|
@@ -123,13 +123,12 @@ npm run publish
|
|
|
123
123
|
4. 暂存 `git add .`
|
|
124
124
|
5. 提交 `git commit -m 'fix: '`
|
|
125
125
|
6. 给提交打标签 `npm run tag`
|
|
126
|
-
7. 生成 changelog `npm run changelog`
|
|
127
|
-
8.
|
|
128
|
-
9.
|
|
129
|
-
10.
|
|
130
|
-
11.
|
|
131
|
-
12.
|
|
132
|
-
13. 部署文档 `npm run deploy`
|
|
126
|
+
7. 生成 changelog 并暂存、提交 `npm run changelog && git commit -a -m 'chore: changelog'`
|
|
127
|
+
8. 打包组件库 `npm run build:sard`
|
|
128
|
+
9. 发布到 npm `npm run publish:sard`
|
|
129
|
+
10. 推送代码和标签 `npm run push`
|
|
130
|
+
11. 打包文档 `npm run build:site`
|
|
131
|
+
12. 部署文档 `npm run deploy`
|
|
133
132
|
|
|
134
133
|
## 新增组件流程
|
|
135
134
|
|
package/all-components.js
CHANGED
|
@@ -47,7 +47,6 @@ import { FormItemPlain, FormPlain } from "./components/form-plain/index.js";
|
|
|
47
47
|
import { Grid, GridItem } from "./components/grid/index.js";
|
|
48
48
|
import { Image } from "./components/image/index.js";
|
|
49
49
|
import { Indexes, IndexesAnchor, IndexesNav } from "./components/indexes/index.js";
|
|
50
|
-
import { InfiniteList } from "./components/infinite-list/index.js";
|
|
51
50
|
import { Input } from "./components/input/index.js";
|
|
52
51
|
import { Keyboard } from "./components/keyboard/index.js";
|
|
53
52
|
import { KeyboardPopout } from "./components/keyboard-popout/index.js";
|
|
@@ -185,7 +184,6 @@ var all_components_default = {
|
|
|
185
184
|
Indexes,
|
|
186
185
|
IndexesAnchor,
|
|
187
186
|
IndexesNav,
|
|
188
|
-
InfiniteList,
|
|
189
187
|
Input,
|
|
190
188
|
Keyboard,
|
|
191
189
|
KeyboardPopout,
|
|
@@ -33,6 +33,7 @@ declare const __VLS_base: import("vue").DefineComponent<ActionSheetProps, {}, {}
|
|
|
33
33
|
cancel: string;
|
|
34
34
|
visible: boolean;
|
|
35
35
|
overlayClosable: boolean;
|
|
36
|
+
closeOnBackPress: boolean;
|
|
36
37
|
description: string;
|
|
37
38
|
itemList: ActionSheetItemProps[];
|
|
38
39
|
showCancel: boolean;
|
|
@@ -42,6 +42,10 @@ var action_sheet_default = /*@__PURE__*/ defineComponent({
|
|
|
42
42
|
internalContext: {
|
|
43
43
|
type: Object,
|
|
44
44
|
required: false
|
|
45
|
+
},
|
|
46
|
+
closeOnBackPress: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
required: false
|
|
45
49
|
}
|
|
46
50
|
}, defaultActionSheetProps),
|
|
47
51
|
emits: [
|
|
@@ -112,6 +116,10 @@ var action_sheet_default = /*@__PURE__*/ defineComponent({
|
|
|
112
116
|
perhapsClose("close");
|
|
113
117
|
}
|
|
114
118
|
};
|
|
119
|
+
const onBackPress = () => {
|
|
120
|
+
emit("close");
|
|
121
|
+
perhapsClose("close");
|
|
122
|
+
};
|
|
115
123
|
const onSelect = (item, index) => {
|
|
116
124
|
if (!item.disabled && !item.loading) {
|
|
117
125
|
item = { ...item };
|
|
@@ -135,7 +143,9 @@ var action_sheet_default = /*@__PURE__*/ defineComponent({
|
|
|
135
143
|
return openBlock(), createBlock(popup_default, {
|
|
136
144
|
effect: "slide-bottom",
|
|
137
145
|
visible: innerVisible.value,
|
|
146
|
+
"close-on-back-press": __props.closeOnBackPress,
|
|
138
147
|
onOverlayClick,
|
|
148
|
+
onBackPress,
|
|
139
149
|
onVisibleHook
|
|
140
150
|
}, {
|
|
141
151
|
default: withCtx(() => [createElementVNode("div", { class: normalizeClass(actionSheetClass.value) }, [
|
|
@@ -152,7 +162,7 @@ var action_sheet_default = /*@__PURE__*/ defineComponent({
|
|
|
152
162
|
}, [renderSlot(_ctx.$slots, "cancel", {}, () => [createTextVNode(toDisplayString(__props.cancel || unref(t)("cancel")), 1)])], 2)], 64)) : createCommentVNode("v-if", true)
|
|
153
163
|
], 2)]),
|
|
154
164
|
_: 3
|
|
155
|
-
}, 8, ["visible"]);
|
|
165
|
+
}, 8, ["visible", "close-on-back-press"]);
|
|
156
166
|
};
|
|
157
167
|
}
|
|
158
168
|
});
|
|
@@ -22,6 +22,7 @@ export interface ActionSheetProps {
|
|
|
22
22
|
overlayClosable?: boolean;
|
|
23
23
|
beforeClose?: ActionSheetBeforeClose;
|
|
24
24
|
internalContext?: UseActionSheetReturn;
|
|
25
|
+
closeOnBackPress?: boolean;
|
|
25
26
|
}
|
|
26
27
|
export declare const defaultActionSheetProps: DefaultProps<ActionSheetProps>;
|
|
27
28
|
export interface ActionSheetEmits extends MotionEmits {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--s-badge-height:18px;--s-badge-font-size:var(--s-font-size-sm);--s-badge-bg:var(--s-color-danger);--s-badge-color:var(--s-white);--s-badge-
|
|
1
|
+
:root{--s-badge-height:18px;--s-badge-font-size:var(--s-font-size-sm);--s-badge-bg:var(--s-color-danger);--s-badge-color:var(--s-white);--s-badge-dot-size:10px}.s-badge{flex:none;display:inline-flex;justify-content:center;align-items:center;min-width:var(--s-badge-height);height:var(--s-badge-height);padding-inline-start:var(--s-size-2xs);padding-inline-end:var(--s-size-2xs);font-size:var(--s-badge-font-size);line-height:var(--s-line-height-none);text-align:center;border-radius:var(--s-border-radius-full);color:var(--s-badge-color);background:var(--s-badge-bg)}.s-badge--fixed{position:absolute;top:0;inset-inline-end:0;transform:translate(50%, -50%);z-index:10}:root[dir=rtl] .s-badge--fixed{transform:translate(-50%, -50%)}.s-badge--dot{width:var(--s-badge-dot-size);height:var(--s-badge-dot-size);min-width:var(--s-badge-dot-size);padding:0;border-radius:var(--s-border-radius-full)}.s-badge--zero-hide{display:none}.s-badge__wrapper{position:relative;display:inline-flex}
|
|
@@ -16,6 +16,7 @@ export interface CropImageProps {
|
|
|
16
16
|
beforeCrop?: (width: number, height: number) => number;
|
|
17
17
|
cancelText?: string;
|
|
18
18
|
confirmText?: string;
|
|
19
|
+
closeOnBackPress?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export declare const defaultCropImageProps: DefaultProps<CropImageProps>;
|
|
21
22
|
export interface CropImageSlots {
|
|
@@ -68,6 +68,10 @@ var crop_image_default = /*@__PURE__*/ defineComponent({
|
|
|
68
68
|
confirmText: {
|
|
69
69
|
type: String,
|
|
70
70
|
required: false
|
|
71
|
+
},
|
|
72
|
+
closeOnBackPress: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
required: false
|
|
71
75
|
}
|
|
72
76
|
}, defaultCropImageProps),
|
|
73
77
|
emits: [
|
|
@@ -95,6 +99,9 @@ var crop_image_default = /*@__PURE__*/ defineComponent({
|
|
|
95
99
|
innerVisible.value = false;
|
|
96
100
|
emit("update:visible", false);
|
|
97
101
|
};
|
|
102
|
+
const onBackPress = () => {
|
|
103
|
+
close();
|
|
104
|
+
};
|
|
98
105
|
const onVisibleHook = (name, el) => {
|
|
99
106
|
emit("visible-hook", name, el);
|
|
100
107
|
emit(name, el);
|
|
@@ -454,6 +461,8 @@ var crop_image_default = /*@__PURE__*/ defineComponent({
|
|
|
454
461
|
effect: "full-fade",
|
|
455
462
|
visible: __props.visible,
|
|
456
463
|
overlay: false,
|
|
464
|
+
"close-on-back-press": __props.closeOnBackPress,
|
|
465
|
+
onBackPress,
|
|
457
466
|
onVisibleHook
|
|
458
467
|
}, {
|
|
459
468
|
default: withCtx(() => [createElementVNode("div", { class: normalizeClass(cropImageClass.value) }, [
|
|
@@ -527,7 +536,7 @@ var crop_image_default = /*@__PURE__*/ defineComponent({
|
|
|
527
536
|
class: normalizeClass(unref(bem).e("loading"))
|
|
528
537
|
}, [createVNode(loading_default)], 2)) : createCommentVNode("v-if", true)]),
|
|
529
538
|
_: 1
|
|
530
|
-
}, 8, ["visible"]);
|
|
539
|
+
}, 8, ["visible", "close-on-back-press"]);
|
|
531
540
|
};
|
|
532
541
|
}
|
|
533
542
|
});
|
|
@@ -20,6 +20,7 @@ export interface DialogProps {
|
|
|
20
20
|
beforeClose?: DialogBeforeClose;
|
|
21
21
|
cancelProps?: ButtonProps;
|
|
22
22
|
confirmProps?: ButtonProps;
|
|
23
|
+
closeOnBackPress?: boolean;
|
|
23
24
|
}
|
|
24
25
|
export declare const defaultDialogProps: DefaultProps<DialogProps>;
|
|
25
26
|
export interface DialogSlots {
|
|
@@ -34,6 +34,7 @@ declare const __VLS_base: import("vue").DefineComponent<DialogProps, {}, {}, {},
|
|
|
34
34
|
title: string;
|
|
35
35
|
visible: boolean;
|
|
36
36
|
overlayClosable: boolean;
|
|
37
|
+
closeOnBackPress: boolean;
|
|
37
38
|
message: string;
|
|
38
39
|
showCancel: boolean;
|
|
39
40
|
beforeClose: import("./common").DialogBeforeClose;
|
|
@@ -62,6 +62,10 @@ var dialog_default = /*@__PURE__*/ defineComponent({
|
|
|
62
62
|
confirmProps: {
|
|
63
63
|
type: Object,
|
|
64
64
|
required: false
|
|
65
|
+
},
|
|
66
|
+
closeOnBackPress: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
required: false
|
|
65
69
|
}
|
|
66
70
|
}, defaultDialogProps),
|
|
67
71
|
emits: [
|
|
@@ -132,6 +136,9 @@ var dialog_default = /*@__PURE__*/ defineComponent({
|
|
|
132
136
|
const onOverlayClick = () => {
|
|
133
137
|
if (props.overlayClosable) perhapsClose("close");
|
|
134
138
|
};
|
|
139
|
+
const onBackPress = () => {
|
|
140
|
+
perhapsClose("close");
|
|
141
|
+
};
|
|
135
142
|
const onClose = () => {
|
|
136
143
|
perhapsClose("close");
|
|
137
144
|
};
|
|
@@ -186,7 +193,9 @@ var dialog_default = /*@__PURE__*/ defineComponent({
|
|
|
186
193
|
effect: "zoom",
|
|
187
194
|
visible: __props.visible,
|
|
188
195
|
class: normalizeClass(unref(bem).e("popup")),
|
|
196
|
+
"close-on-back-press": __props.closeOnBackPress,
|
|
189
197
|
onOverlayClick,
|
|
198
|
+
onBackPress,
|
|
190
199
|
onVisibleHook
|
|
191
200
|
}, {
|
|
192
201
|
default: withCtx(() => [createElementVNode("div", { class: normalizeClass(dialogClass.value) }, [
|
|
@@ -265,7 +274,11 @@ var dialog_default = /*@__PURE__*/ defineComponent({
|
|
|
265
274
|
], 2)
|
|
266
275
|
], 2)]),
|
|
267
276
|
_: 3
|
|
268
|
-
}, 8, [
|
|
277
|
+
}, 8, [
|
|
278
|
+
"visible",
|
|
279
|
+
"class",
|
|
280
|
+
"close-on-back-press"
|
|
281
|
+
]);
|
|
269
282
|
};
|
|
270
283
|
}
|
|
271
284
|
});
|
package/components/index.d.ts
CHANGED
package/components/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useInPopup, usePopupEnter, usePopupVisibleHookProvide } from "./popup/common.js";
|
|
2
2
|
import { Accordion, AccordionItem } from "./accordion/index.js";
|
|
3
|
+
import { popupManager } from "./popup/popup-manager.js";
|
|
3
4
|
import { actionSheet, createActionSheet } from "./action-sheet/imperative.js";
|
|
4
5
|
import { ActionSheet, ActionSheetItem } from "./action-sheet/index.js";
|
|
5
6
|
import { Alert } from "./alert/index.js";
|
|
@@ -59,14 +60,13 @@ import { FormItemPlain, FormPlain } from "./form-plain/index.js";
|
|
|
59
60
|
import { Grid, GridItem } from "./grid/index.js";
|
|
60
61
|
import { Image } from "./image/index.js";
|
|
61
62
|
import { Indexes, IndexesAnchor, IndexesNav } from "./indexes/index.js";
|
|
62
|
-
import { useLoadMore } from "./load-more/useLoadMore.js";
|
|
63
|
-
import { InfiniteList } from "./infinite-list/index.js";
|
|
64
63
|
import { Input } from "./input/index.js";
|
|
65
64
|
import { plateEnglishLetterKeys, plateProvinceKeys, plateSuffixKeys } from "./keyboard/common.js";
|
|
66
65
|
import { Keyboard } from "./keyboard/index.js";
|
|
67
66
|
import { KeyboardPopout } from "./keyboard-popout/index.js";
|
|
68
67
|
import { Col, Row } from "./layout/index.js";
|
|
69
68
|
import { List, ListItem } from "./list/index.js";
|
|
69
|
+
import { LoadMoreStatus } from "./load-more/common.js";
|
|
70
70
|
import { LoadMore } from "./load-more/index.js";
|
|
71
71
|
import { Loading } from "./loading/index.js";
|
|
72
72
|
import { Marquee } from "./marquee/index.js";
|
|
@@ -139,4 +139,4 @@ import { Tree, TreeBranch, TreeNode } from "./tree/index.js";
|
|
|
139
139
|
import { Upload, UploadPreview } from "./upload/index.js";
|
|
140
140
|
import { Waterfall, WaterfallItem, WaterfallLoad } from "./waterfall/index.js";
|
|
141
141
|
import { Watermark } from "./watermark/index.js";
|
|
142
|
-
export { ADD_SWIPER_CONTEXT_KEY, Accordion, AccordionItem, ActionSheet, ActionSheetItem, Alert, Avatar, AvatarGroup, BackTop, Badge, Barcode, Button, Calendar, CalendarInput, CalendarPopout, Card, Cascader, CascaderInput, CascaderPopout, Checkbox, CheckboxGroup, CheckboxInput, CheckboxPopout, Col, Collapse, ColorPicker, ColorPickerInput, ColorPickerPopout, Compact, CoolIcon, CountDown, CountTo, CropImage, DateStrip, DatetimePicker, DatetimePickerInput, DatetimePickerPopout, DatetimeRangePicker, DatetimeRangePickerInput, DatetimeRangePickerPopout, Descriptions, DescriptionsItem, Dialog, Divider, Dnd, DndHandle, DndItem, Dropdown, DropdownItem, Ellipsis, Empty, Fab, FabItem, FloatingBubble, FloatingPanel, Form, FormItem, FormItemPlain, FormPlain, Grid, GridItem, Image, Indexes, IndexesAnchor, IndexesNav,
|
|
142
|
+
export { ADD_SWIPER_CONTEXT_KEY, Accordion, AccordionItem, ActionSheet, ActionSheetItem, Alert, Avatar, AvatarGroup, BackTop, Badge, Barcode, Button, Calendar, CalendarInput, CalendarPopout, Card, Cascader, CascaderInput, CascaderPopout, Checkbox, CheckboxGroup, CheckboxInput, CheckboxPopout, Col, Collapse, ColorPicker, ColorPickerInput, ColorPickerPopout, Compact, CoolIcon, CountDown, CountTo, CropImage, DateStrip, DatetimePicker, DatetimePickerInput, DatetimePickerPopout, DatetimeRangePicker, DatetimeRangePickerInput, DatetimeRangePickerPopout, Descriptions, DescriptionsItem, Dialog, Divider, Dnd, DndHandle, DndItem, Dropdown, DropdownItem, Ellipsis, Empty, Fab, FabItem, FloatingBubble, FloatingPanel, Form, FormItem, FormItemPlain, FormPlain, Grid, GridItem, Image, Indexes, IndexesAnchor, IndexesNav, Input, Keyboard, KeyboardPopout, List, ListItem, LoadMore, LoadMoreStatus, Loading, Marquee, Menu, MenuItem, Motion, Navbar, NavbarItem, NavbarPit, NoticeBar, Notify, Overlay, Pagination, PasswordInput, Picker, PickerInput, PickerPopout, PickerView, PickerViewColumn, Popout, PopoutInput, Popover, Popup, PreviewImage, ProgressBar, ProgressCircle, PullDownRefresh, PuzzleVerify, Qrcode, REMOVE_SWIPER_CONTEXT_KEY, Radio, RadioGroup, RadioInput, RadioPopout, Rate, ReadMore, Result, RotateVerify, Row, SWIPER_AUTO_HEIGHT_KEY, ScrollList, ScrollSpy, ScrollSpyAnchor, Search, Segmented, SegmentedItem, Select, SelectInput, SelectOption, SelectOptionGroup, SelectPopout, ShareSheet, ShareSheetIcon, ShareSheetItem, ShareSheetRow, Sidebar, SidebarItem, Signature, Skeleton, SkeletonAvatar, SkeletonBlock, SkeletonParagraph, SkeletonTitle, SlideVerify, Slider, Space, StatusBar, Step, Stepper, Steps, Sticky, StickyBox, SwipeAction, Swiper, SwiperItem, Switch, Tab, Tabbar, TabbarItem, TabbarPit, Table, Tabs, Tag, Text, Timeline, TimelineItem, Toast, Tree, TreeBranch, TreeNode, Upload, UploadPreview, Waterfall, WaterfallItem, WaterfallLoad, Watermark, actionSheet, createActionSheet, createCropImage, createDialog, createNotify, createPreviewImage, createToast, cropImage, dialog, formatTime, getCurrentTime, notify, omitFormPopoutProps, partitionPopoutInputProps, plateEnglishLetterKeys, plateProvinceKeys, plateSuffixKeys, popupManager, previewImage, safeAreaInsets, spaceSizes, toast, useCountDown, useElementBackTop, useFormContext, useFormItem, useFormItemContext, useFormPopout, useInPopup, useMotioning, usePageBackTop, usePopoutInput, usePopupEnter, usePopupVisibleHookProvide, windowInfo };
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import { type DefaultProps } from '../config';
|
|
2
|
-
import type { LoadMoreStatus } from '../load-more
|
|
2
|
+
import type { LoadMoreStatus } from '../load-more';
|
|
3
3
|
import type { PullDownRefreshSlots } from '../pull-down-refresh/common';
|
|
4
4
|
export interface InfiniteListProps {
|
|
5
|
-
|
|
5
|
+
status?: LoadMoreStatus;
|
|
6
|
+
request: (page: number) => Promise<boolean>;
|
|
6
7
|
hideLoadMore?: boolean;
|
|
7
8
|
refreshable?: boolean;
|
|
8
|
-
doneDuration?: number;
|
|
9
9
|
rootMargin?: string;
|
|
10
10
|
}
|
|
11
11
|
export declare const defaultInfiniteListProps: DefaultProps<InfiniteListProps>;
|
|
12
12
|
export interface InfiniteListSlots extends Omit<PullDownRefreshSlots, 'default'> {
|
|
13
|
-
default?(props:
|
|
14
|
-
status: LoadMoreStatus;
|
|
15
|
-
refresh: () => void;
|
|
16
|
-
}): any;
|
|
13
|
+
default?(props: Record<string, never>): any;
|
|
17
14
|
}
|
|
18
15
|
export interface InfiniteListEmits {
|
|
19
|
-
(e: '
|
|
20
|
-
(e: 'refresh-error'): void;
|
|
16
|
+
(e: 'load'): void;
|
|
21
17
|
}
|
|
22
18
|
export interface InfiniteListExpose {
|
|
23
|
-
refresh: () => void;
|
|
24
19
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.s-infinite-list .s-pull-down-refresh{min-height:100%}.s-infinite-list__load-more:is(.is-hidden){height:0;overflow:hidden;visibility:hidden;pointer-events:none}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { type InfiniteListProps, type InfiniteListSlots, type InfiniteListExpose } from './common';
|
|
2
|
+
import { LoadMoreStatus } from '../load-more';
|
|
2
3
|
type __VLS_Slots = InfiniteListSlots;
|
|
3
4
|
declare const __VLS_base: import("vue").DefineComponent<InfiniteListProps, InfiniteListExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
4
|
-
|
|
5
|
-
"refresh-error": () => any;
|
|
5
|
+
load: () => any;
|
|
6
6
|
}, string, import("vue").PublicProps, Readonly<InfiniteListProps> & Readonly<{
|
|
7
|
-
|
|
8
|
-
"onRefresh-error"?: (() => any) | undefined;
|
|
7
|
+
onLoad?: (() => any) | undefined;
|
|
9
8
|
}>, {
|
|
10
9
|
rootMargin: string;
|
|
11
|
-
|
|
12
|
-
request: (page: number
|
|
10
|
+
status: LoadMoreStatus;
|
|
11
|
+
request: (page: number) => Promise<boolean>;
|
|
13
12
|
hideLoadMore: boolean;
|
|
14
13
|
refreshable: boolean;
|
|
15
14
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { createBem } from "../../utils/bem.js";
|
|
2
|
-
import
|
|
3
|
-
import { useTranslateWithPrefix } from "../../locale/index.js";
|
|
4
|
-
import { defaultInfiniteListProps } from "./common.js";
|
|
5
|
-
import { useScrollParent } from "../../use/useScrollParent.js";
|
|
6
|
-
import pull_down_refresh_default from "../pull-down-refresh/pull-down-refresh.vue.js";
|
|
2
|
+
import { LoadMoreStatus } from "../load-more/common.js";
|
|
7
3
|
import load_more_default from "../load-more/load-more.vue.js";
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
4
|
+
import pull_down_refresh_default from "../pull-down-refresh/pull-down-refresh.vue.js";
|
|
5
|
+
import { defaultInfiniteListProps } from "./common.js";
|
|
6
|
+
import { createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeDefaults, normalizeClass, openBlock, ref, renderSlot, unref, withCtx } from "vue";
|
|
10
7
|
//#region packages/sard/components/infinite-list/infinite-list.vue
|
|
11
8
|
var infinite_list_default = /*@__PURE__*/ defineComponent({
|
|
12
9
|
__name: "infinite-list",
|
|
13
10
|
props: /*@__PURE__*/ mergeDefaults({
|
|
11
|
+
status: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: false
|
|
14
|
+
},
|
|
14
15
|
request: {
|
|
15
16
|
type: Function,
|
|
16
17
|
required: true
|
|
@@ -23,96 +24,54 @@ var infinite_list_default = /*@__PURE__*/ defineComponent({
|
|
|
23
24
|
type: Boolean,
|
|
24
25
|
required: false
|
|
25
26
|
},
|
|
26
|
-
doneDuration: {
|
|
27
|
-
type: Number,
|
|
28
|
-
required: false
|
|
29
|
-
},
|
|
30
27
|
rootMargin: {
|
|
31
28
|
type: String,
|
|
32
29
|
required: false
|
|
33
30
|
}
|
|
34
31
|
}, defaultInfiniteListProps),
|
|
35
|
-
emits: ["
|
|
32
|
+
emits: ["load"],
|
|
36
33
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
37
34
|
const props = __props;
|
|
38
|
-
const emit = __emit;
|
|
39
35
|
const bem = createBem("infinite-list");
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
const status = ref(LoadMoreStatus.INCOMPLETE);
|
|
37
|
+
let page = 1;
|
|
38
|
+
const getData = async () => {
|
|
39
|
+
status.value = LoadMoreStatus.LOADING;
|
|
40
|
+
return props.request(page).then((finish) => {
|
|
41
|
+
if (finish) status.value = LoadMoreStatus.COMPLETE;
|
|
42
|
+
else {
|
|
43
|
+
status.value = LoadMoreStatus.INCOMPLETE;
|
|
44
|
+
page++;
|
|
45
|
+
}
|
|
46
46
|
}).catch(() => {
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
status.value = LoadMoreStatus.ERROR;
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
const refreshing = ref(false);
|
|
51
|
+
const onRefresh = () => {
|
|
52
|
+
page = 1;
|
|
53
|
+
refreshing.value = true;
|
|
54
|
+
getData().finally(() => {
|
|
55
|
+
refreshing.value = false;
|
|
49
56
|
});
|
|
50
57
|
};
|
|
51
|
-
|
|
52
|
-
root: useScrollParent(useTemplateRef("scroll")),
|
|
53
|
-
target: useTemplateRef("load-more"),
|
|
54
|
-
rootMargin: () => props.rootMargin,
|
|
55
|
-
request: async (page, isRefresh) => {
|
|
56
|
-
return props.request(page, isRefresh);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
__expose({ refresh });
|
|
58
|
+
__expose({});
|
|
60
59
|
return (_ctx, _cache) => {
|
|
61
|
-
return openBlock(), createElementBlock("div", {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
loading: unref(isRefreshing),
|
|
66
|
-
disabled: !__props.refreshable || unref(isLoading),
|
|
67
|
-
"done-duration": __props.doneDuration,
|
|
60
|
+
return openBlock(), createElementBlock("div", { class: normalizeClass(unref(bem).b()) }, [__props.refreshable ? (openBlock(), createBlock(pull_down_refresh_default, {
|
|
61
|
+
key: 0,
|
|
62
|
+
loading: refreshing.value,
|
|
63
|
+
disabled: status.value === unref(LoadMoreStatus).LOADING,
|
|
68
64
|
onRefresh
|
|
69
65
|
}, {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
progress: slotsProps.progress
|
|
75
|
-
}, {
|
|
76
|
-
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("unready")), 1)]),
|
|
77
|
-
_: 1
|
|
78
|
-
}, 8, ["progress"])])]),
|
|
79
|
-
ready: withCtx(() => [renderSlot(_ctx.$slots, "ready", {}, () => [createVNode(loading_default, {
|
|
80
|
-
type: "clock",
|
|
81
|
-
size: "16px",
|
|
82
|
-
animated: false
|
|
83
|
-
}, {
|
|
84
|
-
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("ready")), 1)]),
|
|
85
|
-
_: 1
|
|
86
|
-
})])]),
|
|
87
|
-
loading: withCtx(() => [renderSlot(_ctx.$slots, "loading", {}, () => [createVNode(loading_default, {
|
|
88
|
-
type: "clock",
|
|
89
|
-
size: "16px"
|
|
90
|
-
}, {
|
|
91
|
-
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("loading")), 1)]),
|
|
92
|
-
_: 1
|
|
93
|
-
})])]),
|
|
94
|
-
done: withCtx(() => [renderSlot(_ctx.$slots, "done", {}, () => [createTextVNode(toDisplayString(doneText.value), 1)])]),
|
|
95
|
-
default: withCtx(() => [renderSlot(_ctx.$slots, "default", {
|
|
96
|
-
status: unref(status),
|
|
97
|
-
refresh: unref(refresh)
|
|
98
|
-
}), createElementVNode("div", {
|
|
99
|
-
ref: "load-more",
|
|
100
|
-
class: normalizeClass([unref(bem).e("load-more"), unref(bem).is("hidden", __props.hideLoadMore)])
|
|
101
|
-
}, [createVNode(load_more_default, {
|
|
102
|
-
status: unref(status),
|
|
103
|
-
onLoadMore: unref(onLoadMore),
|
|
104
|
-
onReload: unref(onReload)
|
|
105
|
-
}, null, 8, [
|
|
106
|
-
"status",
|
|
107
|
-
"onLoadMore",
|
|
108
|
-
"onReload"
|
|
109
|
-
])], 2)]),
|
|
66
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default"), createVNode(load_more_default, {
|
|
67
|
+
status: status.value,
|
|
68
|
+
onLoad: getData
|
|
69
|
+
}, null, 8, ["status"])]),
|
|
110
70
|
_: 3
|
|
111
|
-
}, 8, [
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
])], 2);
|
|
71
|
+
}, 8, ["loading", "disabled"])) : createCommentVNode("v-if", true), createElementVNode("template", null, [renderSlot(_ctx.$slots, "default"), createVNode(load_more_default, {
|
|
72
|
+
status: status.value,
|
|
73
|
+
onLoad: getData
|
|
74
|
+
}, null, 8, ["status"])])], 2);
|
|
116
75
|
};
|
|
117
76
|
}
|
|
118
77
|
});
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { type DefaultProps } from '../config';
|
|
2
|
-
export
|
|
2
|
+
export declare enum LoadMoreStatus {
|
|
3
|
+
INCOMPLETE = "incomplete",
|
|
4
|
+
LOADING = "loading",
|
|
5
|
+
COMPLETE = "complete",
|
|
6
|
+
ERROR = "error"
|
|
7
|
+
}
|
|
3
8
|
export interface LoadMoreProps {
|
|
4
9
|
status?: LoadMoreStatus;
|
|
5
10
|
incompleteText?: string;
|
|
6
11
|
loadingText?: string;
|
|
7
12
|
completeText?: string;
|
|
8
13
|
errorText?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
rootMargin?: string;
|
|
9
16
|
}
|
|
10
17
|
export declare const defaultLoadMoreProps: DefaultProps<LoadMoreProps>;
|
|
11
18
|
export interface LoadMoreSlots {
|
|
@@ -15,6 +22,5 @@ export interface LoadMoreSlots {
|
|
|
15
22
|
error?(props: Record<string, never>): any;
|
|
16
23
|
}
|
|
17
24
|
export interface LoadMoreEmits {
|
|
18
|
-
(e: 'load
|
|
19
|
-
(e: 'reload'): void;
|
|
25
|
+
(e: 'load'): void;
|
|
20
26
|
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
//#region packages/sard/components/load-more/common.ts
|
|
2
|
-
|
|
2
|
+
let LoadMoreStatus = /* @__PURE__ */ function(LoadMoreStatus) {
|
|
3
|
+
LoadMoreStatus["INCOMPLETE"] = "incomplete";
|
|
4
|
+
LoadMoreStatus["LOADING"] = "loading";
|
|
5
|
+
LoadMoreStatus["COMPLETE"] = "complete";
|
|
6
|
+
LoadMoreStatus["ERROR"] = "error";
|
|
7
|
+
return LoadMoreStatus;
|
|
8
|
+
}({});
|
|
9
|
+
const defaultLoadMoreProps = { status: LoadMoreStatus.INCOMPLETE };
|
|
3
10
|
//#endregion
|
|
4
|
-
export { defaultLoadMoreProps };
|
|
11
|
+
export { LoadMoreStatus, defaultLoadMoreProps };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type EnhancedComponent } from '../../utils';
|
|
2
|
+
import { LoadMoreStatus } from './common';
|
|
2
3
|
import _LoadMore from './load-more.vue';
|
|
3
4
|
export declare const LoadMore: EnhancedComponent<typeof _LoadMore>;
|
|
4
5
|
export default LoadMore;
|
|
5
|
-
export type {
|
|
6
|
-
export
|
|
6
|
+
export type { LoadMoreProps, LoadMoreSlots, LoadMoreEmits } from './common';
|
|
7
|
+
export { LoadMoreStatus };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { enhanceComponent } from "../../utils/component.js";
|
|
2
|
+
import { LoadMoreStatus } from "./common.js";
|
|
2
3
|
import load_more_default from "./load-more.vue.js";
|
|
3
|
-
import { useLoadMore } from "./useLoadMore.js";
|
|
4
4
|
//#region packages/sard/components/load-more/index.ts
|
|
5
5
|
const LoadMore = enhanceComponent(load_more_default);
|
|
6
6
|
//#endregion
|
|
7
|
-
export { LoadMore, LoadMore as default,
|
|
7
|
+
export { LoadMore, LoadMore as default, LoadMoreStatus };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { type LoadMoreProps, type LoadMoreSlots } from './common';
|
|
1
|
+
import { type LoadMoreProps, type LoadMoreSlots, LoadMoreStatus } from './common';
|
|
2
2
|
type __VLS_Slots = LoadMoreSlots;
|
|
3
3
|
declare const __VLS_base: import("vue").DefineComponent<LoadMoreProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
4
|
-
|
|
5
|
-
reload: () => any;
|
|
4
|
+
load: () => any;
|
|
6
5
|
}, string, import("vue").PublicProps, Readonly<LoadMoreProps> & Readonly<{
|
|
7
|
-
|
|
8
|
-
onReload?: (() => any) | undefined;
|
|
6
|
+
onLoad?: (() => any) | undefined;
|
|
9
7
|
}>, {
|
|
10
|
-
|
|
8
|
+
rootMargin: string;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
status: LoadMoreStatus;
|
|
11
11
|
incompleteText: string;
|
|
12
12
|
loadingText: string;
|
|
13
13
|
completeText: string;
|