sard-uniapp 1.19.2 → 1.19.4
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/CHANGELOG.md +19 -0
- package/components/accordion/README.md +91 -0
- package/components/accordion/accordion.vue +7 -0
- package/components/accordion-item/accordion-item.vue +9 -0
- package/components/action-sheet/README.md +85 -0
- package/components/action-sheet/action-sheet.vue +15 -0
- package/components/alert/README.md +74 -0
- package/components/alert/alert.vue +10 -0
- package/components/avatar/README.md +86 -0
- package/components/avatar/avatar.vue +8 -0
- package/components/back-top/README.md +134 -0
- package/components/back-top/back-top.vue +9 -0
- package/components/badge/README.md +95 -0
- package/components/badge/badge.vue +11 -0
- package/components/button/README.md +162 -0
- package/components/button/button.vue +46 -0
- package/components/calendar/README.md +97 -0
- package/components/calendar/calendar.vue +29 -1
- package/components/calendar/common.d.ts +6 -0
- package/components/calendar-input/README.md +65 -0
- package/components/calendar-input/calendar-input.vue +40 -0
- package/components/calendar-month/calendar-month.vue +5 -2
- package/components/calendar-popout/README.md +100 -0
- package/components/calendar-popout/calendar-popout.vue +35 -1
- package/components/card/README.md +82 -0
- package/components/card/card.vue +9 -0
- package/components/cascader/README.md +117 -0
- package/components/cascader/cascader.vue +13 -0
- package/components/cascader-input/README.md +51 -0
- package/components/cascader-input/cascader-input.vue +25 -0
- package/components/cascader-popout/README.md +53 -0
- package/components/cascader-popout/cascader-popout.vue +19 -0
- package/components/checkbox/README.md +185 -0
- package/components/checkbox/checkbox.vue +17 -0
- package/components/checkbox-group/checkbox-group.vue +15 -0
- package/components/checkbox-input/README.md +44 -0
- package/components/checkbox-input/checkbox-input.vue +22 -0
- package/components/checkbox-popout/README.md +52 -0
- package/components/checkbox-popout/checkbox-popout.vue +19 -0
- package/components/col/col.vue +7 -0
- package/components/collapse/README.md +45 -0
- package/components/collapse/collapse.vue +3 -0
- package/components/config/index.d.ts +2 -0
- package/components/config/index.js +1 -0
- package/components/count-down/README.md +97 -0
- package/components/count-down/count-down.vue +8 -0
- package/components/count-to/README.md +61 -0
- package/components/count-to/count-to.vue +7 -0
- package/components/crop-image/README.md +86 -0
- package/components/crop-image/crop-image.vue +15 -0
- package/components/datetime-picker/README.md +136 -0
- package/components/datetime-picker/datetime-picker.vue +14 -0
- package/components/datetime-picker-input/README.md +82 -0
- package/components/datetime-picker-input/datetime-picker-input.vue +25 -0
- package/components/datetime-picker-popout/README.md +77 -0
- package/components/datetime-picker-popout/datetime-picker-popout.vue +19 -0
- package/components/datetime-range-picker/README.md +49 -0
- package/components/datetime-range-picker/datetime-range-picker.vue +15 -0
- package/components/datetime-range-picker-input/README.md +58 -0
- package/components/datetime-range-picker-input/datetime-range-picker-input.vue +26 -0
- package/components/datetime-range-picker-popout/README.md +53 -0
- package/components/datetime-range-picker-popout/datetime-range-picker-popout.vue +20 -0
- package/components/dialog/README.md +192 -0
- package/components/dialog/dialog.vue +33 -0
- package/components/dialog-agent/dialog-agent.vue +21 -0
- package/components/divider/README.md +80 -0
- package/components/divider/divider.vue +8 -0
- package/components/dropdown/README.md +168 -0
- package/components/dropdown/common.d.ts +7 -0
- package/components/dropdown/common.js +1 -0
- package/components/dropdown/dropdown.vue +16 -1
- package/components/dropdown-item/dropdown-item.vue +51 -4
- package/components/empty/README.md +71 -0
- package/components/empty/empty.vue +8 -0
- package/components/fab/README.md +111 -0
- package/components/fab/fab.vue +18 -0
- package/components/floating-bubble/README.md +70 -0
- package/components/floating-bubble/floating-bubble.vue +11 -0
- package/components/floating-panel/README.md +78 -0
- package/components/floating-panel/floating-panel.vue +11 -0
- package/components/form/README.md +308 -0
- package/components/form/form.vue +19 -0
- package/components/form-item/form-item.vue +17 -0
- package/components/grid/README.md +140 -0
- package/components/grid/grid.vue +11 -0
- package/components/grid-item/grid-item.vue +15 -0
- package/components/icon/README.md +118 -0
- package/components/icon/common.d.ts +2 -0
- package/components/icon/icon.d.ts +1 -0
- package/components/icon/icon.vue +18 -3
- package/components/indexes/README.md +83 -0
- package/components/indexes/indexes.vue +7 -0
- package/components/indexes-anchor/indexes-anchor.vue +5 -0
- package/components/input/README.md +170 -0
- package/components/input/input.vue +55 -0
- package/components/keyboard/README.md +82 -0
- package/components/keyboard/keyboard.vue +7 -0
- package/components/layout/README.md +89 -0
- package/components/list/README.md +118 -0
- package/components/list/list.vue +8 -0
- package/components/list-item/list-item.vue +15 -0
- package/components/load-more/README.md +75 -0
- package/components/load-more/load-more.vue +11 -0
- package/components/loading/README.md +89 -0
- package/components/loading/loading.vue +13 -0
- package/components/lucky-draw/README.md +174 -0
- package/components/marquee/README.md +65 -0
- package/components/marquee/marquee.vue +7 -0
- package/components/menu/_README.md +61 -0
- package/components/navbar/README.md +123 -0
- package/components/navbar/navbar.vue +11 -0
- package/components/navbar-item/navbar-item.vue +10 -0
- package/components/notice-bar/README.md +135 -0
- package/components/notice-bar/notice-bar.vue +17 -0
- package/components/notify/README.md +118 -0
- package/components/notify/notify.vue +11 -0
- package/components/notify-agent/notify-agent.vue +12 -0
- package/components/overlay/README.md +56 -0
- package/components/overlay/overlay.vue +10 -0
- package/components/pagination/README.md +80 -0
- package/components/pagination/pagination.vue +15 -0
- package/components/password-input/README.md +87 -0
- package/components/password-input/password-input.vue +17 -0
- package/components/picker/README.md +115 -0
- package/components/picker/picker.vue +10 -0
- package/components/picker-input/README.md +51 -0
- package/components/picker-input/picker-input.vue +21 -0
- package/components/picker-popout/README.md +51 -0
- package/components/picker-popout/picker-popout.vue +15 -0
- package/components/popout/README.md +111 -0
- package/components/popout/popout.vue +29 -0
- package/components/popout-input/README.md +55 -0
- package/components/popout-input/popout-input.vue +15 -0
- package/components/popover/README.md +191 -0
- package/components/popover/popover.vue +15 -0
- package/components/popover-reference/popover-reference.vue +5 -0
- package/components/popup/README.md +67 -0
- package/components/popup/popup.vue +20 -0
- package/components/progress-bar/README.md +90 -0
- package/components/progress-bar/progress-bar.vue +13 -0
- package/components/progress-circle/README.md +75 -0
- package/components/progress-circle/progress-circle.vue +10 -0
- package/components/pull-down-refresh/README.md +100 -0
- package/components/pull-down-refresh/pull-down-refresh.vue +11 -0
- package/components/qrcode/README.md +103 -0
- package/components/qrcode/qrcode.vue +13 -0
- package/components/radio/README.md +172 -0
- package/components/radio/radio.vue +13 -0
- package/components/radio-group/radio-group.vue +16 -0
- package/components/radio-input/README.md +44 -0
- package/components/radio-input/radio-input.vue +23 -0
- package/components/radio-popout/README.md +52 -0
- package/components/radio-popout/radio-popout.vue +20 -0
- package/components/rate/README.md +106 -0
- package/components/rate/rate.vue +22 -0
- package/components/result/README.md +66 -0
- package/components/result/result.vue +10 -0
- package/components/row/row.vue +7 -0
- package/components/scroll-spy/README.md +70 -0
- package/components/scroll-spy/scroll-spy.vue +13 -0
- package/components/search/README.md +117 -0
- package/components/search/search.vue +25 -0
- package/components/share-sheet/README.md +94 -0
- package/components/share-sheet/share-sheet.vue +20 -0
- package/components/sidebar/README.md +118 -0
- package/components/sidebar/sidebar.vue +10 -0
- package/components/sidebar-item/sidebar-item.vue +8 -0
- package/components/signature/README.md +99 -0
- package/components/signature/signature.vue +20 -0
- package/components/skeleton/README.md +128 -0
- package/components/skeleton/skeleton.vue +12 -0
- package/components/skeleton-avatar/skeleton-avatar.vue +9 -0
- package/components/skeleton-block/skeleton-block.vue +8 -0
- package/components/skeleton-paragraph/skeleton-paragraph.vue +9 -0
- package/components/skeleton-title/skeleton-title.vue +8 -0
- package/components/slider/README.md +140 -0
- package/components/slider/slider.vue +29 -0
- package/components/space/README.md +82 -0
- package/components/space/space.vue +9 -0
- package/components/status-bar/README.md +72 -0
- package/components/status-bar/status-bar.vue +6 -0
- package/components/step/step.vue +9 -1
- package/components/stepper/README.md +94 -0
- package/components/stepper/stepper.vue +24 -0
- package/components/steps/README.md +142 -0
- package/components/steps/steps.vue +15 -0
- package/components/style/README.md +20 -0
- package/components/swipe-action/README.md +82 -0
- package/components/swipe-action/swipe-action.vue +7 -0
- package/components/swiper-dot/README.md +45 -0
- package/components/swiper-dot/swiper-dot.vue +9 -0
- package/components/switch/README.md +89 -0
- package/components/switch/switch.vue +18 -0
- package/components/tab/tab.vue +8 -0
- package/components/tabbar/README.md +111 -0
- package/components/tabbar/tabbar.vue +12 -0
- package/components/tabbar-item/tabbar-item.vue +12 -0
- package/components/tabbar-pit/README.md +41 -0
- package/components/tabbar-pit/tabbar-pit.vue +5 -0
- package/components/table/README.md +162 -0
- package/components/table/table.vue +7 -0
- package/components/table-cell/table-cell.vue +7 -0
- package/components/table-row/table-row.vue +5 -0
- package/components/tabs/README.md +113 -0
- package/components/tabs/tabs.vue +10 -0
- package/components/tag/README.md +96 -0
- package/components/tag/tag.vue +14 -0
- package/components/timeline/README.md +66 -0
- package/components/timeline/timeline.vue +4 -0
- package/components/timeline-item/timeline-item.vue +9 -0
- package/components/toast/README.md +111 -0
- package/components/toast/toast.vue +11 -0
- package/components/toast-agent/toast-agent.vue +11 -0
- package/components/tree/README.md +208 -0
- package/components/tree/tree.vue +21 -0
- package/components/upload/README.md +154 -0
- package/components/upload/upload.vue +22 -0
- package/package.json +74 -45
|
@@ -13,6 +13,17 @@ import {
|
|
|
13
13
|
dropdownContextSymbol,
|
|
14
14
|
defaultDropdownProps
|
|
15
15
|
} from "./common";
|
|
16
|
+
/**
|
|
17
|
+
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
18
|
+
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
19
|
+
* @property {'down' | 'up'} direction 菜单弹出方向,默认值:'down'。
|
|
20
|
+
* @property {boolean} disabled 是否禁用,默认值:false。
|
|
21
|
+
* @property {boolean} awayClosable 是否在点击外部区域后自动隐藏,默认值:true。
|
|
22
|
+
* @property {boolean} overlayClosable 是否在点击遮罩后自动隐藏,默认值:true。
|
|
23
|
+
* @property {number} duration 显隐动画时长,单位 ms,默认值:300。
|
|
24
|
+
* @property {boolean} togglable 是否可取消选中的选项,默认值:false。
|
|
25
|
+
* @property {any} valueOnClear 取消选项时设置的值,默认值:undefined。
|
|
26
|
+
*/
|
|
16
27
|
export default _defineComponent({
|
|
17
28
|
...{
|
|
18
29
|
options: {
|
|
@@ -28,7 +39,9 @@ export default _defineComponent({
|
|
|
28
39
|
disabled: { type: Boolean, required: false },
|
|
29
40
|
awayClosable: { type: Boolean, required: false },
|
|
30
41
|
overlayClosable: { type: Boolean, required: false },
|
|
31
|
-
duration: { type: Number, required: false }
|
|
42
|
+
duration: { type: Number, required: false },
|
|
43
|
+
togglable: { type: Boolean, required: false },
|
|
44
|
+
valueOnClear: { type: Function, required: false }
|
|
32
45
|
}, defaultDropdownProps),
|
|
33
46
|
setup(__props, { expose: __expose }) {
|
|
34
47
|
__expose();
|
|
@@ -59,6 +72,8 @@ export default _defineComponent({
|
|
|
59
72
|
awayClosable: toRef(() => props.awayClosable),
|
|
60
73
|
overlayClosable: toRef(() => props.overlayClosable),
|
|
61
74
|
duration: toRef(() => props.duration),
|
|
75
|
+
togglable: toRef(() => props.togglable),
|
|
76
|
+
valueOnClear: toRef(() => props.valueOnClear),
|
|
62
77
|
hideOthers,
|
|
63
78
|
register,
|
|
64
79
|
unregister
|
|
@@ -102,9 +102,38 @@ import SarIcon from "../icon/icon.vue";
|
|
|
102
102
|
import SarOverlay from "../overlay/overlay.vue";
|
|
103
103
|
import {
|
|
104
104
|
dropdownContextSymbol,
|
|
105
|
-
defaultDropdownItemProps
|
|
105
|
+
defaultDropdownItemProps,
|
|
106
|
+
defaultValueOnClear
|
|
106
107
|
} from "../dropdown/common";
|
|
107
108
|
import { useTransition, useZIndex } from "../../use";
|
|
109
|
+
/**
|
|
110
|
+
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
111
|
+
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
112
|
+
* @property {string} title 标题,用于自定义菜单内容,默认值:-。
|
|
113
|
+
* @property {string} label 标签说明,默认值:-。
|
|
114
|
+
* @property {DropdownOption[]} options 菜单选项,默认值:[]。
|
|
115
|
+
* @property {'down' | 'up'} direction 菜单弹出方向,默认值:'down'。
|
|
116
|
+
* @property {boolean} disabled 是否禁用,默认值:false。
|
|
117
|
+
* @property {any} modelValue 当前选择的菜单项的值,默认值:-。
|
|
118
|
+
* @property {boolean} visible 弹出框是否可见,默认值:-。
|
|
119
|
+
* @property {string} separator 标签后面分隔符,默认值:-。
|
|
120
|
+
* @property {string} placeholder 占位符,默认值:-。
|
|
121
|
+
* @property {boolean} togglable 是否可取消选中的选项,默认值:false。
|
|
122
|
+
* @property {any} valueOnClear 取消选项时设置的值,默认值:undefined。
|
|
123
|
+
* @property {() => any} beforeOpen 打开前的回调,返回 `false` 或 `rejected` 状态的 `Promise` 可阻止打开,默认值:-。
|
|
124
|
+
* @property {DropdownBeforeClose} beforeClose 关闭前的回调,返回 `false` 或 `rejected` 状态的 `Promise` 可阻止关闭,默认值:-。
|
|
125
|
+
* @event {(visible: boolean) => void} update 弹出框显隐时触发
|
|
126
|
+
* @event {(value: any) => void} change 选中菜单选项时触发
|
|
127
|
+
* @event {(name: TransitionHookName) => void} visible-hook 入场/退场动画状态改变时触发
|
|
128
|
+
* @event {() => void} before-enter 入场动画开始前触发
|
|
129
|
+
* @event {() => void} enter 入场动画开始时触发
|
|
130
|
+
* @event {() => void} after-enter 入场动画结束时触发
|
|
131
|
+
* @event {() => void} enter-cancelled 入场动画取消时触发
|
|
132
|
+
* @event {() => void} before-leave 退场动画开始前触发
|
|
133
|
+
* @event {() => void} leave 退场动画开始时触发
|
|
134
|
+
* @event {() => void} after-leave 退场动画结束时触发
|
|
135
|
+
* @event {() => void} leave-cancelled 退场动画取消时触发
|
|
136
|
+
*/
|
|
108
137
|
export default _defineComponent({
|
|
109
138
|
components: {
|
|
110
139
|
SarList,
|
|
@@ -130,6 +159,8 @@ export default _defineComponent({
|
|
|
130
159
|
visible: { type: Boolean, required: false },
|
|
131
160
|
separator: { type: String, required: false },
|
|
132
161
|
placeholder: { type: String, required: false },
|
|
162
|
+
togglable: { type: Boolean, required: false },
|
|
163
|
+
valueOnClear: { type: Function, required: false },
|
|
133
164
|
beforeClose: { type: Function, required: false },
|
|
134
165
|
beforeOpen: { type: Function, required: false }
|
|
135
166
|
}, defaultDropdownItemProps),
|
|
@@ -148,6 +179,10 @@ export default _defineComponent({
|
|
|
148
179
|
const itemId = uniqid();
|
|
149
180
|
const instance = getCurrentInstance();
|
|
150
181
|
const innerValue = ref(props.modelValue);
|
|
182
|
+
const mergedTogglable = computed(() => props.togglable || context.togglable);
|
|
183
|
+
const mergedValueOnClear = computed(
|
|
184
|
+
() => props.valueOnClear || context.valueOnClear || defaultValueOnClear
|
|
185
|
+
);
|
|
151
186
|
watch(
|
|
152
187
|
() => props.modelValue,
|
|
153
188
|
() => {
|
|
@@ -257,10 +292,22 @@ export default _defineComponent({
|
|
|
257
292
|
}
|
|
258
293
|
};
|
|
259
294
|
const onOptionClick = (option) => {
|
|
295
|
+
let changed = false;
|
|
260
296
|
if (option.value !== innerValue.value) {
|
|
261
297
|
innerValue.value = option.value;
|
|
262
|
-
|
|
263
|
-
|
|
298
|
+
changed = true;
|
|
299
|
+
} else {
|
|
300
|
+
if (mergedTogglable.value) {
|
|
301
|
+
const value = mergedValueOnClear.value();
|
|
302
|
+
if (value !== innerValue.value) {
|
|
303
|
+
innerValue.value = value;
|
|
304
|
+
}
|
|
305
|
+
changed = true;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (changed) {
|
|
309
|
+
emit("update:model-value", innerValue.value);
|
|
310
|
+
emit("change", innerValue.value);
|
|
264
311
|
}
|
|
265
312
|
perhapsClose("option");
|
|
266
313
|
};
|
|
@@ -346,7 +393,7 @@ export default _defineComponent({
|
|
|
346
393
|
const dropdownItemStyle = computed(() => {
|
|
347
394
|
return stringifyStyle(props.rootStyle);
|
|
348
395
|
});
|
|
349
|
-
const __returned__ = { props, emit, bem, context, itemId, instance, innerValue, innerVisible, wholeVisible, popupVisible, popupInset, awayInset, setPosition, setInnerVisible, get isClosing() {
|
|
396
|
+
const __returned__ = { props, emit, bem, context, itemId, instance, innerValue, mergedTogglable, mergedValueOnClear, innerVisible, wholeVisible, popupVisible, popupInset, awayInset, setPosition, setInnerVisible, get isClosing() {
|
|
350
397
|
return isClosing;
|
|
351
398
|
}, set isClosing(v) {
|
|
352
399
|
isClosing = v;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 组件
|
|
3
|
+
title: Empty
|
|
4
|
+
subtitle: 空状态
|
|
5
|
+
group: 数据展示
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 介绍
|
|
9
|
+
|
|
10
|
+
空状态时的占位提示。
|
|
11
|
+
|
|
12
|
+
## 引入
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { Empty } from 'sard'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 代码演示
|
|
19
|
+
|
|
20
|
+
### 基础使用
|
|
21
|
+
|
|
22
|
+
@code('${DEMO_PATH}/empty/demo/Basic.vue')
|
|
23
|
+
|
|
24
|
+
### 自定义描述信息
|
|
25
|
+
|
|
26
|
+
@code('${DEMO_PATH}/empty/demo/Description.vue')
|
|
27
|
+
|
|
28
|
+
### 自定义图标大小
|
|
29
|
+
|
|
30
|
+
通过配置 `iconSize` 属性可以修改图标大小。
|
|
31
|
+
|
|
32
|
+
@code('${DEMO_PATH}/empty/demo/Size.vue')
|
|
33
|
+
|
|
34
|
+
### 自定义图标
|
|
35
|
+
|
|
36
|
+
通过配置 `icon` 属性可以修改图标。
|
|
37
|
+
|
|
38
|
+
@code('${DEMO_PATH}/empty/demo/Icon.vue')
|
|
39
|
+
|
|
40
|
+
### 额外内容
|
|
41
|
+
|
|
42
|
+
额外内容会显示在底部。
|
|
43
|
+
|
|
44
|
+
@code('${DEMO_PATH}/empty/demo/Extra.vue')
|
|
45
|
+
|
|
46
|
+
## API
|
|
47
|
+
|
|
48
|
+
### EmptyProps
|
|
49
|
+
|
|
50
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
51
|
+
| ----------- | -------------- | ---------- | ---------- |
|
|
52
|
+
| root-class | 组件根元素类名 | string | - |
|
|
53
|
+
| root-style | 组件根元素样式 | StyleValue | - |
|
|
54
|
+
| description | 描述信息 | string | '暂无数据' |
|
|
55
|
+
| icon | 自定义图标 | string | - |
|
|
56
|
+
| icon-family | 图标字体 | string | - |
|
|
57
|
+
| icon-size | 图标大小 | string | - |
|
|
58
|
+
|
|
59
|
+
### EmptySlots
|
|
60
|
+
|
|
61
|
+
| 插槽 | 描述 | 属性 |
|
|
62
|
+
| ----------- | -------------- | ---- |
|
|
63
|
+
| default | 自定义额外内容 | - |
|
|
64
|
+
| icon | 自定义图标内容 | - |
|
|
65
|
+
| description | 自定义描述内容 | - |
|
|
66
|
+
|
|
67
|
+
## 主题定制
|
|
68
|
+
|
|
69
|
+
### CSS 变量
|
|
70
|
+
|
|
71
|
+
@code('./variables.scss#variables')
|
|
@@ -23,6 +23,14 @@ import { classNames, stringifyStyle, createBem } from "../../utils";
|
|
|
23
23
|
import SarIcon from "../icon/icon.vue";
|
|
24
24
|
import { useTranslate } from "../locale";
|
|
25
25
|
import { defaultEmptyProps } from "./common";
|
|
26
|
+
/**
|
|
27
|
+
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
28
|
+
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
29
|
+
* @property {string} description 描述信息,默认值:'暂无数据'。
|
|
30
|
+
* @property {string} icon 自定义图标,默认值:-。
|
|
31
|
+
* @property {string} iconFamily 图标字体,默认值:-。
|
|
32
|
+
* @property {string} iconSize 图标大小,默认值:-。
|
|
33
|
+
*/
|
|
26
34
|
export default _defineComponent({
|
|
27
35
|
components: {
|
|
28
36
|
SarIcon,
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 组件
|
|
3
|
+
title: Fab
|
|
4
|
+
subtitle: 悬浮按钮
|
|
5
|
+
group: 反馈组件
|
|
6
|
+
version: 1.5+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 介绍
|
|
10
|
+
|
|
11
|
+
悬浮按钮,点击可展开扩展按钮。
|
|
12
|
+
|
|
13
|
+
## 引入
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import Fab from 'sard-uniapp/components/fab/fab.vue'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 代码演示
|
|
20
|
+
|
|
21
|
+
### 基础使用
|
|
22
|
+
|
|
23
|
+
设置 `item-list` 属性配置扩展按钮,监听 `select` 事件来知晓用户点击了哪个按钮。
|
|
24
|
+
|
|
25
|
+
@code('${DEMO_PATH}/fab/demo/Basic.vue')
|
|
26
|
+
|
|
27
|
+
### 修改背景色
|
|
28
|
+
|
|
29
|
+
设置 `background` 属性以及按钮项的 `background` 自定义背景色。
|
|
30
|
+
|
|
31
|
+
@code('${DEMO_PATH}/fab/demo/Color.vue')
|
|
32
|
+
|
|
33
|
+
### 隐藏按钮名称
|
|
34
|
+
|
|
35
|
+
默认会显示按钮项的 `name` 属性,可以设置 `hide-name` 属性进行隐藏。
|
|
36
|
+
|
|
37
|
+
@code('${DEMO_PATH}/fab/demo/HideName.vue')
|
|
38
|
+
|
|
39
|
+
### 左上角显示
|
|
40
|
+
|
|
41
|
+
按钮默认显示在右下角,设置 `left` 或 `top` 可以让其显示在左上角。
|
|
42
|
+
|
|
43
|
+
@code('${DEMO_PATH}/fab/demo/TopLeft.vue')
|
|
44
|
+
|
|
45
|
+
### 右上角显示
|
|
46
|
+
|
|
47
|
+
按钮默认显示在右下角,设置 `top` 会将其从底部显示在顶部。
|
|
48
|
+
|
|
49
|
+
@code('${DEMO_PATH}/fab/demo/TopRight.vue')
|
|
50
|
+
|
|
51
|
+
### 左下角显示
|
|
52
|
+
|
|
53
|
+
按钮默认显示在右下角,设置 `left` 会将其从右边显示在左边。
|
|
54
|
+
|
|
55
|
+
@code('${DEMO_PATH}/fab/demo/BottomLeft.vue')
|
|
56
|
+
|
|
57
|
+
### 无扩展按钮显示
|
|
58
|
+
|
|
59
|
+
当不设置 `item-list` 属性,或其数组长度为 0,则不显示扩展按钮。
|
|
60
|
+
|
|
61
|
+
@code('${DEMO_PATH}/fab/demo/NonItemList.vue')
|
|
62
|
+
|
|
63
|
+
## API
|
|
64
|
+
|
|
65
|
+
### FabProps
|
|
66
|
+
|
|
67
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
68
|
+
| ---------------- | -------------------------------------------- | ---------- | ------ |
|
|
69
|
+
| root-class | 组件根元素类名 | string | - |
|
|
70
|
+
| root-style | 组件根元素样式 | StyleValue | - |
|
|
71
|
+
| top | 设置距离窗口顶部的距离,优先级比 `bottom` 高 | string | - |
|
|
72
|
+
| right | 设置距离窗口右边的距离 | string | - |
|
|
73
|
+
| bottom | 设置距离窗口底部的距离 | string | - |
|
|
74
|
+
| left | 设置距离窗口左边的距离,优先级比 `right` 高 | string | - |
|
|
75
|
+
| color | 设置按钮图标的颜色 | string | - |
|
|
76
|
+
| background | 设置按钮的背景色 | string | - |
|
|
77
|
+
| icon | 设置入口按钮的图标 | string | - |
|
|
78
|
+
| icon-family | 设置入口按钮的图标族 | string | - |
|
|
79
|
+
| item-list | 设置扩展按钮 | FabItem[] | [] |
|
|
80
|
+
| hide-name | 是否隐藏按钮名称 | boolean | false |
|
|
81
|
+
| overlay-closable | 点击遮罩是否隐藏扩展按钮 | boolean | false |
|
|
82
|
+
| duration | 扩展按钮显隐动画时长,单位 ms | number | 150 |
|
|
83
|
+
|
|
84
|
+
### FabSlots
|
|
85
|
+
|
|
86
|
+
| 插槽 | 描述 | 属性 |
|
|
87
|
+
| ------- | -------------- | ---- |
|
|
88
|
+
| default | 自定义默认内容 | - |
|
|
89
|
+
|
|
90
|
+
### FabEmits
|
|
91
|
+
|
|
92
|
+
| 事件 | 描述 | 类型 |
|
|
93
|
+
| ------ | ------------------ | -------------------------------------- |
|
|
94
|
+
| click | 点击入口按钮时触发 | (event: any) => void |
|
|
95
|
+
| select | 点击扩展按钮时触发 | (item: FabItem, index: number) => void |
|
|
96
|
+
|
|
97
|
+
### FabItem
|
|
98
|
+
|
|
99
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
100
|
+
| ----------- | ------------ | ------ | ------ |
|
|
101
|
+
| name | 按钮名称 | string | - |
|
|
102
|
+
| color | 按钮图标颜色 | string | - |
|
|
103
|
+
| background | 按钮背景色 | string | - |
|
|
104
|
+
| icon | 按钮图标 | string | - |
|
|
105
|
+
| icon-family | 按钮图标族 | string | - |
|
|
106
|
+
|
|
107
|
+
## 主题定制
|
|
108
|
+
|
|
109
|
+
### CSS 变量
|
|
110
|
+
|
|
111
|
+
@code('./variables.scss#variables')
|
package/components/fab/fab.vue
CHANGED
|
@@ -49,6 +49,24 @@ import {
|
|
|
49
49
|
import { useTransition, useZIndex } from "../../use";
|
|
50
50
|
import SarIcon from "../icon/icon.vue";
|
|
51
51
|
import SarOverlay from "../overlay/overlay.vue";
|
|
52
|
+
/**
|
|
53
|
+
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
54
|
+
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
55
|
+
* @property {string} top 设置距离窗口顶部的距离,优先级比 `bottom` 高,默认值:-。
|
|
56
|
+
* @property {string} right 设置距离窗口右边的距离,默认值:-。
|
|
57
|
+
* @property {string} bottom 设置距离窗口底部的距离,默认值:-。
|
|
58
|
+
* @property {string} left 设置距离窗口左边的距离,优先级比 `right` 高,默认值:-。
|
|
59
|
+
* @property {string} color 设置按钮图标的颜色,默认值:-。
|
|
60
|
+
* @property {string} background 设置按钮的背景色,默认值:-。
|
|
61
|
+
* @property {string} icon 设置入口按钮的图标,默认值:-。
|
|
62
|
+
* @property {string} iconFamily 设置入口按钮的图标族,默认值:-。
|
|
63
|
+
* @property {FabItem[]} itemList 设置扩展按钮,默认值:[]。
|
|
64
|
+
* @property {boolean} hideName 是否隐藏按钮名称,默认值:false。
|
|
65
|
+
* @property {boolean} overlayClosable 点击遮罩是否隐藏扩展按钮,默认值:false。
|
|
66
|
+
* @property {number} duration 扩展按钮显隐动画时长,单位 ms,默认值:150。
|
|
67
|
+
* @event {(event: any) => void} click 点击入口按钮时触发
|
|
68
|
+
* @event {(item: FabItem, index: number) => void} select 点击扩展按钮时触发
|
|
69
|
+
*/
|
|
52
70
|
export default _defineComponent({
|
|
53
71
|
components: {
|
|
54
72
|
SarIcon,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 组件
|
|
3
|
+
title: FloatingBubble
|
|
4
|
+
subtitle: 浮动气泡
|
|
5
|
+
group: 反馈组件
|
|
6
|
+
version: 1.5+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 介绍
|
|
10
|
+
|
|
11
|
+
悬浮在窗口边缘的可点击的气泡。
|
|
12
|
+
|
|
13
|
+
## 引入
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import FloatingBubble from 'sard-uniapp/components/floating-bubble/floating-bubble.vue'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 代码演示
|
|
20
|
+
|
|
21
|
+
### 基础使用
|
|
22
|
+
|
|
23
|
+
浮动气泡默认展示在右下角,并允许在 y 轴方向上下拖拽。
|
|
24
|
+
|
|
25
|
+
@code('${DEMO_PATH}/floating-bubble/demo/Basic.vue')
|
|
26
|
+
|
|
27
|
+
### 自由拖拽和磁吸
|
|
28
|
+
|
|
29
|
+
`axis` 属性设置允许在 x 或 y 轴方向拖拽,`magnet` 属性设置松开手指后吸附到指定轴方向的最近一边。
|
|
30
|
+
|
|
31
|
+
@code('${DEMO_PATH}/floating-bubble/demo/Magnet.vue')
|
|
32
|
+
|
|
33
|
+
### 双向绑定
|
|
34
|
+
|
|
35
|
+
使用 `v-model:offset` 控制气泡的位置。
|
|
36
|
+
|
|
37
|
+
@code('${DEMO_PATH}/floating-bubble/demo/Offset.vue')
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
### FloatingBubbleProps
|
|
42
|
+
|
|
43
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
44
|
+
| ---------------- | --------------------------------------- | ------------------------------ | ------ |
|
|
45
|
+
| root-class | 组件根元素类名 | string | - |
|
|
46
|
+
| root-style | 组件根元素样式 | StyleValue | - |
|
|
47
|
+
| axis | 允许拖拽的方向轴 | 'x' \| 'y' \| 'both' \| 'none' | 'y' |
|
|
48
|
+
| magnet | 吸附到指定轴最近的一边 | 'x' \| 'y' | - |
|
|
49
|
+
| gap-x | 气泡与窗口左右两边的最小间距,单位为 px | number | 24 |
|
|
50
|
+
| gap-y | 气泡与窗口上下两边的最小间距,单位为 px | number | 24 |
|
|
51
|
+
| offset (v-model) | 控制气泡的位置 | { x: number; y: number } | - |
|
|
52
|
+
|
|
53
|
+
### FloatingBubbleSlots
|
|
54
|
+
|
|
55
|
+
| 插槽 | 描述 | 属性 |
|
|
56
|
+
| ------- | -------------- | ---- |
|
|
57
|
+
| default | 自定义默认内容 | - |
|
|
58
|
+
|
|
59
|
+
### FloatingBubbleEmits
|
|
60
|
+
|
|
61
|
+
| 事件 | 描述 | 类型 |
|
|
62
|
+
| ------------- | ---------------------------- | ------------------------------------------ |
|
|
63
|
+
| click | 点击时触发 | (event: any) => void |
|
|
64
|
+
| update:offset | 因用户拖拽导致位置改变时触发 | (offset: { x: number; y: number }) => void |
|
|
65
|
+
|
|
66
|
+
## 主题定制
|
|
67
|
+
|
|
68
|
+
### CSS 变量
|
|
69
|
+
|
|
70
|
+
@code('./variables.scss#variables')
|
|
@@ -29,6 +29,17 @@ import {
|
|
|
29
29
|
defaultFloatingBubbleProps
|
|
30
30
|
} from "./common";
|
|
31
31
|
import { useMouseDown, useTimeout } from "../../use";
|
|
32
|
+
/**
|
|
33
|
+
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
34
|
+
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
35
|
+
* @property {'x' | 'y' | 'both' | 'none'} axis 允许拖拽的方向轴,默认值:'y'。
|
|
36
|
+
* @property {'x' | 'y'} magnet 吸附到指定轴最近的一边,默认值:-。
|
|
37
|
+
* @property {number} gapX 气泡与窗口左右两边的最小间距,单位为 px,默认值:24。
|
|
38
|
+
* @property {number} gapY 气泡与窗口上下两边的最小间距,单位为 px,默认值:24。
|
|
39
|
+
* @property {{ x: number; y: number }} offset 控制气泡的位置,默认值:-。
|
|
40
|
+
* @event {(event: any) => void} click 点击时触发
|
|
41
|
+
* @event {(offset: { x: number; y: number }) => void} update 因用户拖拽导致位置改变时触发
|
|
42
|
+
*/
|
|
32
43
|
export default _defineComponent({
|
|
33
44
|
...{
|
|
34
45
|
options: {
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 组件
|
|
3
|
+
title: FloatingPanel
|
|
4
|
+
subtitle: 浮动面板
|
|
5
|
+
group: 反馈组件
|
|
6
|
+
version: 1.13+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 介绍
|
|
10
|
+
|
|
11
|
+
浮动在页面底部的面板,可以上下拖动来浏览内容,从而在不离开当前视图的情况下访问更多信息,常用于地图导航。
|
|
12
|
+
|
|
13
|
+
## 引入
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import FloatingPanel from 'sard-uniapp/components/floating-panel/floating-panel.vue'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 代码演示
|
|
20
|
+
|
|
21
|
+
### 基础使用
|
|
22
|
+
|
|
23
|
+
`FloatingPanel` 的默认高度为 `100px`,用户可以拖动来展开面板,使高度达到 60% 的可用窗口高度。
|
|
24
|
+
|
|
25
|
+
@code('${DEMO_PATH}/floating-panel/demo/Basic.vue')
|
|
26
|
+
|
|
27
|
+
### 自定义锚点
|
|
28
|
+
|
|
29
|
+
你可以通过 `anchors` 属性来设置 `FloatingPanel` 的锚点位置,并通过 `v-model:height` 来控制当前面板的显示高度。
|
|
30
|
+
|
|
31
|
+
比如,使面板的高度在 100px、40% 可用窗口高度和 70% 可用窗口高度三个位置停靠:
|
|
32
|
+
|
|
33
|
+
@code('${DEMO_PATH}/floating-panel/demo/Anchors.vue')
|
|
34
|
+
|
|
35
|
+
### 仅头部拖拽
|
|
36
|
+
|
|
37
|
+
默认情况下,`FloatingPanel` 的头部区域和内容区域都可以被拖拽,你可以通过 `content-draggable` 属性来禁用内容区域的拖拽。
|
|
38
|
+
|
|
39
|
+
@warning
|
|
40
|
+
|
|
41
|
+
支付宝端内容区域始终不能拖拽,无论有没有设置 `content-draggable` 属性。
|
|
42
|
+
|
|
43
|
+
@endwarning
|
|
44
|
+
|
|
45
|
+
@code('${DEMO_PATH}/floating-panel/demo/ContentDraggable.vue')
|
|
46
|
+
|
|
47
|
+
## API
|
|
48
|
+
|
|
49
|
+
### FloatingPanelProps
|
|
50
|
+
|
|
51
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
52
|
+
| ---------------------- | ----------------------- | ---------- | --------------------------------------------- |
|
|
53
|
+
| root-class | 组件根元素类名 | string | - |
|
|
54
|
+
| root-style | 组件根元素样式 | StyleValue | - |
|
|
55
|
+
| height | 当前面板的显示高度 | number | 0 |
|
|
56
|
+
| anchors | 设置自定义锚点, 单位 px | number[] | [100, uni.getWindowInfo().windowHeight * 0.6] |
|
|
57
|
+
| duration | 动画时长,单位毫秒 | number | 300 |
|
|
58
|
+
| content-draggable | 允许拖拽内容容器 | boolean | true |
|
|
59
|
+
| safe-area-inset-bottom | 是否开启底部安全区适配 | boolean | true |
|
|
60
|
+
|
|
61
|
+
### FloatingPanelSlots
|
|
62
|
+
|
|
63
|
+
| 插槽 | 描述 | 属性 |
|
|
64
|
+
| ------- | -------------- | ---- |
|
|
65
|
+
| default | 自定义默认内容 | - |
|
|
66
|
+
|
|
67
|
+
### FloatingPanelEmits
|
|
68
|
+
|
|
69
|
+
| 事件 | 描述 | 类型 |
|
|
70
|
+
| ------------- | -------------------------------- | --------------- |
|
|
71
|
+
| update:height | 面板显示高度改变时触发 | {value: number} |
|
|
72
|
+
| height-change | 面板显示高度改变且结束拖动后触发 | {value: number} |
|
|
73
|
+
|
|
74
|
+
## 主题定制
|
|
75
|
+
|
|
76
|
+
### CSS 变量
|
|
77
|
+
|
|
78
|
+
@code('./variables.scss#variables')
|
|
@@ -40,6 +40,17 @@ import {
|
|
|
40
40
|
} from "./common";
|
|
41
41
|
import { useMouseDown } from "../../use";
|
|
42
42
|
import { useInitialVelocity } from "../../use/useInitialVelocity";
|
|
43
|
+
/**
|
|
44
|
+
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
45
|
+
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
46
|
+
* @property {number} height 当前面板的显示高度,默认值:0。
|
|
47
|
+
* @property {number[]} anchors 设置自定义锚点, 单位 px,默认值:[100, uni.getWindowInfo().windowHeight * 0.6]。
|
|
48
|
+
* @property {number} duration 动画时长,单位毫秒,默认值:300。
|
|
49
|
+
* @property {boolean} contentDraggable 允许拖拽内容容器,默认值:true。
|
|
50
|
+
* @property {boolean} safeAreaInsetBottom 是否开启底部安全区适配,默认值:true。
|
|
51
|
+
* @event {{value: number}} update 面板显示高度改变时触发
|
|
52
|
+
* @event {{value: number}} height-change 面板显示高度改变且结束拖动后触发
|
|
53
|
+
*/
|
|
43
54
|
export default _defineComponent({
|
|
44
55
|
...{
|
|
45
56
|
options: {
|