sard-uniapp 1.24.1 → 1.24.3
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 +35 -0
- package/components/cascader-input/cascader-input.vue +1 -0
- package/components/cascader-popout/cascader-popout.vue +1 -0
- package/components/config/index.d.ts +7 -0
- package/components/config/index.js +6 -0
- package/components/count-down/README.md +8 -6
- package/components/count-down/common.d.ts +3 -0
- package/components/count-down/count-down.vue +20 -4
- package/components/count-down/index.scss +10 -0
- package/components/datetime-picker/datetime-picker.vue +2 -2
- package/components/fab/README.md +87 -33
- package/components/fab/common.d.ts +36 -0
- package/components/fab/common.js +1 -0
- package/components/fab/fab.d.ts +21 -2
- package/components/fab/fab.vue +116 -57
- package/components/fab/index.d.ts +1 -1
- package/components/fab/index.scss +29 -52
- package/components/fab-item/common.d.ts +23 -0
- package/components/fab-item/common.js +1 -0
- package/components/fab-item/fab-item.d.ts +14 -0
- package/components/fab-item/fab-item.vue +93 -0
- package/components/fab-item/index.d.ts +1 -0
- package/components/fab-item/index.js +1 -0
- package/components/fab-item/index.scss +44 -0
- package/components/floating-bubble/README.md +12 -9
- package/components/floating-bubble/common.d.ts +4 -0
- package/components/floating-bubble/floating-bubble.d.ts +1 -0
- package/components/floating-bubble/floating-bubble.vue +25 -128
- package/components/floating-bubble/useFloatingBubble.d.ts +46 -0
- package/components/floating-bubble/useFloatingBubble.js +144 -0
- package/components/input/input.vue +0 -3
- package/components/popout/README.md +25 -24
- package/components/popout/common.d.ts +13 -2
- package/components/popout/popout.vue +76 -45
- package/components/popup/README.md +12 -11
- package/components/popup/popup.vue +1 -0
- package/components/share-sheet/share-sheet.vue +1 -0
- package/components/tag/tag.vue +5 -1
- package/components/toast/common.d.ts +1 -0
- package/components/toast/index.scss +0 -16
- package/components/toast/toast.d.ts +1 -0
- package/components/toast/toast.vue +2 -5
- package/components/toast-agent/common.d.ts +1 -0
- package/components/toast-agent/toast-agent.d.ts +1 -0
- package/global.d.ts +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
- package/utils/dom.d.ts +1 -1
- package/utils/dom.js +2 -1
package/components/fab/fab.vue
CHANGED
|
@@ -6,49 +6,61 @@
|
|
|
6
6
|
@click="onOverlayClick"
|
|
7
7
|
/>
|
|
8
8
|
|
|
9
|
-
<view
|
|
9
|
+
<view
|
|
10
|
+
:class="fabClass"
|
|
11
|
+
:style="fabStyle"
|
|
12
|
+
@touchstart="onTouchStart"
|
|
13
|
+
@touchmove.stop.prevent="onTouchMove"
|
|
14
|
+
@touchend="onTouchEnd"
|
|
15
|
+
@touchcancel="onTouchEnd"
|
|
16
|
+
@mousedown="onMouseDown"
|
|
17
|
+
>
|
|
18
|
+
<sar-fab-item
|
|
19
|
+
is-entry
|
|
20
|
+
:color="color"
|
|
21
|
+
:background="background"
|
|
22
|
+
@click="onItemEntryClick"
|
|
23
|
+
>
|
|
24
|
+
<slot :visible="visible">
|
|
25
|
+
<sar-icon :family="iconFamily || 'sari'" :name="entryIcon" />
|
|
26
|
+
</slot>
|
|
27
|
+
</sar-fab-item>
|
|
28
|
+
|
|
10
29
|
<view
|
|
11
30
|
:class="contentClass"
|
|
12
31
|
:style="contentStyle"
|
|
13
32
|
@transitionend="onTransitionEnd"
|
|
14
33
|
>
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
>
|
|
30
|
-
<sar-icon :family="item.iconFamily" :name="item.icon" />
|
|
31
|
-
</view>
|
|
32
|
-
</view>
|
|
33
|
-
</view>
|
|
34
|
-
<view :class="itemEntryClass" @click="onItemEntryClick">
|
|
35
|
-
<view :class="bem.e('item-btn')" :style="itemEntryBtnStyle">
|
|
36
|
-
<sar-icon :family="iconFamily || 'sari'" :name="icon || 'plus'" />
|
|
37
|
-
</view>
|
|
34
|
+
<slot name="list" :on-item-click="onItemClick">
|
|
35
|
+
<sar-fab-item
|
|
36
|
+
v-for="(item, index) in itemList"
|
|
37
|
+
:key="index"
|
|
38
|
+
:index="index"
|
|
39
|
+
:name="item.name"
|
|
40
|
+
:color="item.color"
|
|
41
|
+
:background="item.background"
|
|
42
|
+
:icon="item.icon"
|
|
43
|
+
:icon-family="item.iconFamily"
|
|
44
|
+
:item="item"
|
|
45
|
+
/>
|
|
46
|
+
</slot>
|
|
38
47
|
</view>
|
|
39
48
|
</view>
|
|
40
49
|
</template>
|
|
41
50
|
|
|
42
51
|
<script>
|
|
43
52
|
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
44
|
-
import { computed, reactive, ref, toRef } from "vue";
|
|
53
|
+
import { computed, provide, reactive, ref, toRef } from "vue";
|
|
45
54
|
import { classNames, stringifyStyle, createBem, isNullish } from "../../utils";
|
|
46
55
|
import {
|
|
47
|
-
defaultFabProps
|
|
56
|
+
defaultFabProps,
|
|
57
|
+
fabContextSymbol
|
|
48
58
|
} from "./common";
|
|
49
59
|
import { useTransition, useZIndex } from "../../use";
|
|
50
60
|
import SarIcon from "../icon/icon.vue";
|
|
51
61
|
import SarOverlay from "../overlay/overlay.vue";
|
|
62
|
+
import { useFloatingBubble } from "../floating-bubble/useFloatingBubble";
|
|
63
|
+
import SarFabItem from "../fab-item/fab-item.vue";
|
|
52
64
|
/**
|
|
53
65
|
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
54
66
|
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
@@ -59,18 +71,29 @@ import SarOverlay from "../overlay/overlay.vue";
|
|
|
59
71
|
* @property {string} color 设置按钮图标的颜色,默认值:-。
|
|
60
72
|
* @property {string} background 设置按钮的背景色,默认值:-。
|
|
61
73
|
* @property {string} icon 设置入口按钮的图标,默认值:-。
|
|
74
|
+
* @property {string} visibleIcon 设置弹出扩展按钮时的入口按钮的图标,默认值:-。
|
|
62
75
|
* @property {string} iconFamily 设置入口按钮的图标族,默认值:-。
|
|
63
76
|
* @property {FabItem[]} itemList 设置扩展按钮,默认值:[]。
|
|
64
77
|
* @property {boolean} hideName 是否隐藏按钮名称,默认值:false。
|
|
65
78
|
* @property {boolean} overlayClosable 点击遮罩是否隐藏扩展按钮,默认值:false。
|
|
66
79
|
* @property {number} duration 扩展按钮显隐动画时长,单位 ms,默认值:150。
|
|
80
|
+
* @property {boolean} draggable 是否可拖拽,默认值:false。
|
|
81
|
+
* @property {'x' | 'y' | 'both' | 'none'} axis 允许拖拽的方向轴,默认值:'y'。
|
|
82
|
+
* @property {'x' | 'y'} magnet 吸附到指定轴最近的一边,在拖拽时使用,默认值:-。
|
|
83
|
+
* @property {number} gapX 悬浮按钮与窗口左右两边的最小间距,单位为 px,在拖拽时使用,默认值:24。
|
|
84
|
+
* @property {number} gapY 悬浮按钮与窗口上下两边的最小间距,单位为 px,在拖拽时使用,默认值:24。
|
|
85
|
+
* @property {{ x: number; y: number }} offset 控制悬浮按钮的位置,在拖拽时使用,默认值:-。
|
|
86
|
+
* @property {number} navbarHeight 自定义顶部导航栏的高度,在拖拽时使用,默认值:0。
|
|
87
|
+
* @property {number} tabbarHeight 自定义底部标签栏的高度,在拖拽时使用,默认值:0。
|
|
67
88
|
* @event {(event: any) => void} click 点击入口按钮时触发
|
|
68
89
|
* @event {(item: FabItem, index: number) => void} select 点击扩展按钮时触发
|
|
90
|
+
* @event {(offset: { x: number; y: number }) => void} update 因用户拖拽导致位置改变时触发
|
|
69
91
|
*/
|
|
70
92
|
export default _defineComponent({
|
|
71
93
|
components: {
|
|
72
94
|
SarIcon,
|
|
73
95
|
SarOverlay,
|
|
96
|
+
SarFabItem,
|
|
74
97
|
},
|
|
75
98
|
...{
|
|
76
99
|
options: {
|
|
@@ -89,13 +112,22 @@ export default _defineComponent({
|
|
|
89
112
|
color: { type: String, required: false },
|
|
90
113
|
background: { type: String, required: false },
|
|
91
114
|
icon: { type: String, required: false },
|
|
115
|
+
visibleIcon: { type: String, required: false },
|
|
92
116
|
iconFamily: { type: String, required: false },
|
|
93
117
|
itemList: { type: Array, required: false },
|
|
94
118
|
hideName: { type: Boolean, required: false },
|
|
95
119
|
overlayClosable: { type: Boolean, required: false },
|
|
96
|
-
duration: { type: Number, required: false }
|
|
120
|
+
duration: { type: Number, required: false },
|
|
121
|
+
draggable: { type: Boolean, required: false },
|
|
122
|
+
axis: { type: String, required: false },
|
|
123
|
+
magnet: { type: String, required: false },
|
|
124
|
+
gapX: { type: Number, required: false },
|
|
125
|
+
gapY: { type: Number, required: false },
|
|
126
|
+
offset: { type: Object, required: false },
|
|
127
|
+
navbarHeight: { type: Number, required: false },
|
|
128
|
+
tabbarHeight: { type: Number, required: false }
|
|
97
129
|
}, defaultFabProps()),
|
|
98
|
-
emits: ["click", "select"],
|
|
130
|
+
emits: ["click", "select", "update:offset"],
|
|
99
131
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
100
132
|
__expose();
|
|
101
133
|
const props = __props;
|
|
@@ -110,12 +142,14 @@ export default _defineComponent({
|
|
|
110
142
|
prefix: bem.m("zoom-")
|
|
111
143
|
})
|
|
112
144
|
);
|
|
145
|
+
const entryIcon = computed(() => {
|
|
146
|
+
return visible.value ? props.visibleIcon || "close" : props.icon || "plus";
|
|
147
|
+
});
|
|
113
148
|
const onItemEntryClick = (event) => {
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
149
|
+
if (stopBubbling.value) return;
|
|
150
|
+
visible.value = !visible.value;
|
|
151
|
+
if (visible.value) {
|
|
152
|
+
increaseZIndex();
|
|
119
153
|
}
|
|
120
154
|
emit("click", event);
|
|
121
155
|
};
|
|
@@ -128,22 +162,61 @@ export default _defineComponent({
|
|
|
128
162
|
visible.value = false;
|
|
129
163
|
}
|
|
130
164
|
};
|
|
165
|
+
const {
|
|
166
|
+
onTouchStart,
|
|
167
|
+
onTouchMove,
|
|
168
|
+
onTouchEnd,
|
|
169
|
+
onMouseDown,
|
|
170
|
+
position,
|
|
171
|
+
initialized,
|
|
172
|
+
animated,
|
|
173
|
+
bubbleId,
|
|
174
|
+
stopBubbling,
|
|
175
|
+
windowWidth,
|
|
176
|
+
windowHeight,
|
|
177
|
+
windowTop
|
|
178
|
+
} = useFloatingBubble(props, emit, {
|
|
179
|
+
disabled: visible
|
|
180
|
+
});
|
|
181
|
+
const isTop = computed(() => {
|
|
182
|
+
return props.draggable ? position.value.y > windowHeight / 2 ? false : true : !isNullish(props.top);
|
|
183
|
+
});
|
|
184
|
+
const isLeft = computed(() => {
|
|
185
|
+
return props.draggable ? position.value.x > windowWidth / 2 ? false : true : !isNullish(props.left);
|
|
186
|
+
});
|
|
187
|
+
provide(
|
|
188
|
+
fabContextSymbol,
|
|
189
|
+
reactive({
|
|
190
|
+
hideName: toRef(() => props.hideName),
|
|
191
|
+
isLeft,
|
|
192
|
+
visible,
|
|
193
|
+
onItemClick
|
|
194
|
+
})
|
|
195
|
+
);
|
|
131
196
|
const fabClass = computed(() => {
|
|
132
197
|
return classNames(
|
|
133
198
|
bem.b(),
|
|
134
|
-
bem.m(
|
|
135
|
-
bem.m(
|
|
136
|
-
bem.m("
|
|
137
|
-
|
|
199
|
+
bem.m(isTop.value ? "top" : "bottom"),
|
|
200
|
+
bem.m(isLeft.value ? "left" : "right"),
|
|
201
|
+
bem.m("animated", animated.value),
|
|
202
|
+
bem.m("initialized", initialized.value),
|
|
203
|
+
bem.m("draggable", props.draggable),
|
|
204
|
+
props.rootClass,
|
|
205
|
+
bubbleId
|
|
138
206
|
);
|
|
139
207
|
});
|
|
140
208
|
const fabStyle = computed(() => {
|
|
141
209
|
return stringifyStyle(props.rootStyle, {
|
|
142
210
|
zIndex: visible.value ? zIndex.value : null,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
211
|
+
...props.draggable ? {
|
|
212
|
+
top: `${windowTop}px`,
|
|
213
|
+
transform: `translate3d(${position.value.x}px, ${position.value.y}px, 0)`
|
|
214
|
+
} : {
|
|
215
|
+
top: props.top,
|
|
216
|
+
left: props.left,
|
|
217
|
+
right: isLeft.value ? "auto" : props.right,
|
|
218
|
+
bottom: isTop.value ? "auto" : props.bottom
|
|
219
|
+
}
|
|
147
220
|
});
|
|
148
221
|
});
|
|
149
222
|
const contentClass = computed(() => {
|
|
@@ -153,24 +226,10 @@ export default _defineComponent({
|
|
|
153
226
|
return stringifyStyle({
|
|
154
227
|
display: realVisible.value ? "flex" : "none",
|
|
155
228
|
transitionDuration: props.duration + "ms",
|
|
156
|
-
transformOrigin: `${
|
|
229
|
+
transformOrigin: `${isTop.value ? "top" : "bottom"} ${isLeft.value ? "left" : "right"}`
|
|
157
230
|
});
|
|
158
231
|
});
|
|
159
|
-
const
|
|
160
|
-
return classNames(bem.e("item"), bem.em("item", "entry"));
|
|
161
|
-
});
|
|
162
|
-
const itemEntryBtnStyle = computed(() => {
|
|
163
|
-
return stringifyStyle({
|
|
164
|
-
color: props.color,
|
|
165
|
-
background: props.background
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
const itemClass = computed(() => {
|
|
169
|
-
return classNames(bem.e("item"));
|
|
170
|
-
});
|
|
171
|
-
const __returned__ = { props, emit, bem, visible, zIndex, increaseZIndex, realVisible, transitionClass, onTransitionEnd, onItemEntryClick, onItemClick, onOverlayClick, fabClass, fabStyle, contentClass, contentStyle, itemEntryClass, itemEntryBtnStyle, itemClass, get stringifyStyle() {
|
|
172
|
-
return stringifyStyle;
|
|
173
|
-
}, SarIcon, SarOverlay };
|
|
232
|
+
const __returned__ = { props, emit, bem, visible, zIndex, increaseZIndex, realVisible, transitionClass, onTransitionEnd, entryIcon, onItemEntryClick, onItemClick, onOverlayClick, onTouchStart, onTouchMove, onTouchEnd, onMouseDown, position, initialized, animated, bubbleId, stopBubbling, windowWidth, windowHeight, windowTop, isTop, isLeft, fabClass, fabStyle, contentClass, contentStyle, SarIcon, SarOverlay, SarFabItem };
|
|
174
233
|
return __returned__;
|
|
175
234
|
}
|
|
176
235
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { FabProps, FabEmits, FabItem } from './common';
|
|
1
|
+
export type { FabProps, FabSlots, FabEmits, FabItem } from './common';
|
|
@@ -7,12 +7,19 @@
|
|
|
7
7
|
right: var(--sar-fab-right);
|
|
8
8
|
bottom: var(--sar-fab-bottom);
|
|
9
9
|
z-index: var(--sar-fab-z-index);
|
|
10
|
-
|
|
10
|
+
opacity: 0;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
@include e(content) {
|
|
14
14
|
@include universal;
|
|
15
|
-
|
|
15
|
+
position: absolute;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@include m(draggable) {
|
|
19
|
+
top: 0;
|
|
20
|
+
left: 0;
|
|
21
|
+
right: auto;
|
|
22
|
+
bottom: auto;
|
|
16
23
|
}
|
|
17
24
|
|
|
18
25
|
@include m(zoom-enter-from, zoom-leave-to) {
|
|
@@ -26,70 +33,40 @@
|
|
|
26
33
|
}
|
|
27
34
|
|
|
28
35
|
@include m(zoom-enter-active, zoom-leave-active) {
|
|
29
|
-
transition:
|
|
36
|
+
transition:
|
|
37
|
+
transform var(--sar-fab-duration) ease-out,
|
|
30
38
|
opacity var(--sar-fab-duration) ease-out;
|
|
31
39
|
}
|
|
32
40
|
|
|
33
|
-
@include
|
|
34
|
-
@include
|
|
35
|
-
|
|
36
|
-
align-items: center;
|
|
37
|
-
gap: var(--sar-fab-item-name-gap);
|
|
38
|
-
cursor: pointer;
|
|
39
|
-
|
|
40
|
-
&:active {
|
|
41
|
-
opacity: var(--sar-fab-item-active-opacity);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@include m(entry) {
|
|
45
|
-
@include e(item-btn) {
|
|
46
|
-
transition: transform var(--sar-fab-duration);
|
|
47
|
-
}
|
|
41
|
+
@include m(top) {
|
|
42
|
+
@include e(content) {
|
|
43
|
+
top: calc(100% + var(--sar-fab-item-gap));
|
|
48
44
|
}
|
|
49
45
|
}
|
|
50
46
|
|
|
51
|
-
@include
|
|
52
|
-
@include
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@include e(item-btn) {
|
|
58
|
-
@include universal;
|
|
59
|
-
justify-content: center;
|
|
60
|
-
align-items: center;
|
|
61
|
-
width: var(--sar-fab-item-btn-size);
|
|
62
|
-
height: var(--sar-fab-item-btn-size);
|
|
63
|
-
border-radius: var(--sar-rounded-full);
|
|
64
|
-
font-size: var(--sar-fab-item-btn-font-size);
|
|
65
|
-
color: var(--sar-fab-item-btn-color);
|
|
66
|
-
background-color: var(--sar-fab-item-btn-bg);
|
|
67
|
-
box-shadow: var(--sar-fab-item-btn-box-shadow);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
@include m(top) {
|
|
71
|
-
flex-direction: column-reverse;
|
|
47
|
+
@include m(bottom) {
|
|
48
|
+
@include e(content) {
|
|
49
|
+
bottom: calc(100% + var(--sar-fab-item-gap));
|
|
50
|
+
}
|
|
72
51
|
}
|
|
73
52
|
|
|
74
53
|
@include m(left) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
@include e(item) {
|
|
78
|
-
flex-direction: row-reverse;
|
|
54
|
+
@include e(content) {
|
|
55
|
+
left: 0;
|
|
79
56
|
}
|
|
80
57
|
}
|
|
81
58
|
|
|
82
59
|
@include m(right) {
|
|
83
|
-
|
|
60
|
+
@include e(content) {
|
|
61
|
+
right: 0;
|
|
62
|
+
}
|
|
84
63
|
}
|
|
85
64
|
|
|
86
|
-
@include m(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
}
|
|
65
|
+
@include m(initialized) {
|
|
66
|
+
opacity: 1;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@include m(animated) {
|
|
70
|
+
transition: transform var(--sar-fab-duration);
|
|
94
71
|
}
|
|
95
72
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type StyleValue } from 'vue';
|
|
2
|
+
import { type FabItem } from '../fab/common';
|
|
3
|
+
export interface FabItemProps {
|
|
4
|
+
rootStyle?: StyleValue;
|
|
5
|
+
rootClass?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
background?: string;
|
|
9
|
+
icon?: string;
|
|
10
|
+
iconFamily?: string;
|
|
11
|
+
isEntry?: boolean;
|
|
12
|
+
index?: number;
|
|
13
|
+
item?: FabItem;
|
|
14
|
+
}
|
|
15
|
+
export declare const defaultFabItemProps: {};
|
|
16
|
+
export interface FabItemSlots {
|
|
17
|
+
default?(props: Record<string, never>): any;
|
|
18
|
+
}
|
|
19
|
+
export interface FabItemEmits {
|
|
20
|
+
(e: 'click', event: any): void;
|
|
21
|
+
}
|
|
22
|
+
export interface FabItemExpose {
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const defaultFabItemProps = {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type FabItemProps, type FabItemSlots } from './common';
|
|
2
|
+
declare function __VLS_template(): Readonly<FabItemSlots> & FabItemSlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<FabItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
4
|
+
click: (event: any) => any;
|
|
5
|
+
}, string, import("vue").PublicProps, Readonly<FabItemProps> & Readonly<{
|
|
6
|
+
onClick?: ((event: any) => any) | undefined;
|
|
7
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
9
|
+
export default _default;
|
|
10
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
11
|
+
new (): {
|
|
12
|
+
$slots: S;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="fabItemClass" :style="fabItemStyle" @click="onClick">
|
|
3
|
+
<view
|
|
4
|
+
v-if="!isVisibleEmpty(name) && !context.hideName"
|
|
5
|
+
:class="bem.e('name')"
|
|
6
|
+
>
|
|
7
|
+
{{ name }}
|
|
8
|
+
</view>
|
|
9
|
+
<view
|
|
10
|
+
:class="bem.e('btn')"
|
|
11
|
+
:style="stringifyStyle({ background: background, color: color })"
|
|
12
|
+
>
|
|
13
|
+
<slot>
|
|
14
|
+
<sar-icon :family="iconFamily" :name="icon" />
|
|
15
|
+
</slot>
|
|
16
|
+
</view>
|
|
17
|
+
</view>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
22
|
+
import { computed, inject } from "vue";
|
|
23
|
+
import {
|
|
24
|
+
classNames,
|
|
25
|
+
stringifyStyle,
|
|
26
|
+
createBem,
|
|
27
|
+
isVisibleEmpty
|
|
28
|
+
} from "../../utils";
|
|
29
|
+
import {
|
|
30
|
+
defaultFabItemProps
|
|
31
|
+
} from "./common";
|
|
32
|
+
import { fabContextSymbol } from "../fab/common";
|
|
33
|
+
import SarIcon from "../icon/icon.vue";
|
|
34
|
+
export default _defineComponent({
|
|
35
|
+
components: {
|
|
36
|
+
SarIcon,
|
|
37
|
+
},
|
|
38
|
+
...{
|
|
39
|
+
options: {
|
|
40
|
+
virtualHost: true,
|
|
41
|
+
styleIsolation: "shared"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
__name: "fab-item",
|
|
45
|
+
props: _mergeDefaults({
|
|
46
|
+
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
47
|
+
rootClass: { type: String, required: false },
|
|
48
|
+
name: { type: String, required: false },
|
|
49
|
+
color: { type: String, required: false },
|
|
50
|
+
background: { type: String, required: false },
|
|
51
|
+
icon: { type: String, required: false },
|
|
52
|
+
iconFamily: { type: String, required: false },
|
|
53
|
+
isEntry: { type: Boolean, required: false },
|
|
54
|
+
index: { type: Number, required: false },
|
|
55
|
+
item: { type: Object, required: false }
|
|
56
|
+
}, defaultFabItemProps),
|
|
57
|
+
emits: ["click"],
|
|
58
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
59
|
+
const props = __props;
|
|
60
|
+
const emit = __emit;
|
|
61
|
+
const bem = createBem("fab-item");
|
|
62
|
+
const context = inject(fabContextSymbol);
|
|
63
|
+
const onClick = (event) => {
|
|
64
|
+
if (!props.isEntry) {
|
|
65
|
+
context.onItemClick(props.item || {}, props.index || 0);
|
|
66
|
+
}
|
|
67
|
+
emit("click", event);
|
|
68
|
+
};
|
|
69
|
+
__expose({});
|
|
70
|
+
const fabItemClass = computed(() => {
|
|
71
|
+
return classNames(
|
|
72
|
+
bem.b(),
|
|
73
|
+
bem.m("left", context.isLeft),
|
|
74
|
+
bem.m("entry", props.isEntry),
|
|
75
|
+
props.rootClass
|
|
76
|
+
);
|
|
77
|
+
});
|
|
78
|
+
const fabItemStyle = computed(() => {
|
|
79
|
+
return stringifyStyle(props.rootStyle);
|
|
80
|
+
});
|
|
81
|
+
const __returned__ = { props, emit, bem, context, onClick, fabItemClass, fabItemStyle, get stringifyStyle() {
|
|
82
|
+
return stringifyStyle;
|
|
83
|
+
}, get isVisibleEmpty() {
|
|
84
|
+
return isVisibleEmpty;
|
|
85
|
+
}, SarIcon };
|
|
86
|
+
return __returned__;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<style lang="scss">
|
|
92
|
+
@import './index.scss';
|
|
93
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { FabItemProps, FabItemSlots, FabItemEmits, FabItemExpose, } from './common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@use '../style/base' as *;
|
|
2
|
+
|
|
3
|
+
@include bem(fab-item) {
|
|
4
|
+
@include b() {
|
|
5
|
+
@include universal;
|
|
6
|
+
flex-direction: row;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: var(--sar-fab-item-name-gap);
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
|
|
11
|
+
&:active {
|
|
12
|
+
opacity: var(--sar-fab-item-active-opacity);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@include m(left) {
|
|
16
|
+
flex-direction: row-reverse;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&:not(:first-child) {
|
|
20
|
+
margin-top: var(--sar-fab-item-gap);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@include e(name) {
|
|
25
|
+
@include universal;
|
|
26
|
+
font-size: var(--sar-fab-item-name-font-size);
|
|
27
|
+
color: var(--sar-fab-item-name-color);
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@include e(btn) {
|
|
32
|
+
@include universal;
|
|
33
|
+
flex: none;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
align-items: center;
|
|
36
|
+
width: var(--sar-fab-item-btn-size);
|
|
37
|
+
height: var(--sar-fab-item-btn-size);
|
|
38
|
+
border-radius: var(--sar-rounded-full);
|
|
39
|
+
font-size: var(--sar-fab-item-btn-font-size);
|
|
40
|
+
color: var(--sar-fab-item-btn-color);
|
|
41
|
+
background-color: var(--sar-fab-item-btn-bg);
|
|
42
|
+
box-shadow: var(--sar-fab-item-btn-box-shadow);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -40,15 +40,18 @@ import FloatingBubble from 'sard-uniapp/components/floating-bubble/floating-bubb
|
|
|
40
40
|
|
|
41
41
|
### FloatingBubbleProps
|
|
42
42
|
|
|
43
|
-
| 属性
|
|
44
|
-
|
|
|
45
|
-
| root-class
|
|
46
|
-
| root-style
|
|
47
|
-
| axis
|
|
48
|
-
| magnet
|
|
49
|
-
| gap-x
|
|
50
|
-
| gap-y
|
|
51
|
-
| offset (v-model)
|
|
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
|
+
| draggable <sup>1.24.2+</sup> | 是否可拖拽 | boolean | true |
|
|
53
|
+
| navbar-height <sup>1.24.3+</sup> | 自定义顶部导航栏的高度 | number | 0 |
|
|
54
|
+
| tabbar-height <sup>1.24.3+</sup> | 自定义底部标签栏的高度 | number | 0 |
|
|
52
55
|
|
|
53
56
|
### FloatingBubbleSlots
|
|
54
57
|
|
|
@@ -2,6 +2,7 @@ import { type StyleValue } from 'vue';
|
|
|
2
2
|
export interface FloatingBubbleProps {
|
|
3
3
|
rootStyle?: StyleValue;
|
|
4
4
|
rootClass?: string;
|
|
5
|
+
draggable?: boolean;
|
|
5
6
|
axis?: 'x' | 'y' | 'both' | 'none';
|
|
6
7
|
magnet?: 'x' | 'y';
|
|
7
8
|
gapX?: number;
|
|
@@ -10,8 +11,11 @@ export interface FloatingBubbleProps {
|
|
|
10
11
|
x: number;
|
|
11
12
|
y: number;
|
|
12
13
|
};
|
|
14
|
+
navbarHeight?: number;
|
|
15
|
+
tabbarHeight?: number;
|
|
13
16
|
}
|
|
14
17
|
export declare const defaultFloatingBubbleProps: {
|
|
18
|
+
draggable: boolean;
|
|
15
19
|
axis: FloatingBubbleProps["axis"];
|
|
16
20
|
gapX: number;
|
|
17
21
|
gapY: number;
|
|
@@ -14,6 +14,7 @@ declare const __VLS_component: import("vue").DefineComponent<FloatingBubbleProps
|
|
|
14
14
|
}) => any) | undefined;
|
|
15
15
|
}>, {
|
|
16
16
|
axis: "x" | "y" | "both" | "none";
|
|
17
|
+
draggable: boolean;
|
|
17
18
|
gapX: number;
|
|
18
19
|
gapY: number;
|
|
19
20
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|