first commit
This commit is contained in:
233
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/fab/fab.js
vendored
Normal file
233
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/fab/fab.js
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
"use strict";
|
||||
const uni_modules_tdesignUniapp_components_common_src_instantiationDecorator = require("../common/src/instantiationDecorator.js");
|
||||
const uni_modules_tdesignUniapp_components_common_config = require("../common/config.js");
|
||||
const uni_modules_tdesignUniapp_components_fab_props = require("./props.js");
|
||||
const uni_modules_tdesignUniapp_components_mixins_usingCustomNavbar = require("../mixins/using-custom-navbar.js");
|
||||
const uni_modules_tdesignUniapp_components_common_utils = require("../common/utils.js");
|
||||
const uni_modules_tdesignUniapp_components_common_utils_wxs = require("../common/utils.wxs.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_tdesignUniapp_components_common_wechat = require("../common/wechat.js");
|
||||
const TButton = () => "../button/button.js";
|
||||
const TDraggable = () => "../draggable/draggable.js";
|
||||
const name = `${uni_modules_tdesignUniapp_components_common_config.prefix}-fab`;
|
||||
const baseButtonProps = {
|
||||
size: "large",
|
||||
shape: "circle",
|
||||
theme: "primary",
|
||||
tClass: `${uni_modules_tdesignUniapp_components_common_config.prefix}-fab__button`
|
||||
};
|
||||
const _sfc_main = uni_modules_tdesignUniapp_components_common_src_instantiationDecorator.uniComponent({
|
||||
name,
|
||||
options: {
|
||||
styleIsolation: "shared"
|
||||
},
|
||||
externalClasses: [`${uni_modules_tdesignUniapp_components_common_config.prefix}-class`, `${uni_modules_tdesignUniapp_components_common_config.prefix}-class-button`],
|
||||
mixins: [uni_modules_tdesignUniapp_components_mixins_usingCustomNavbar.useCustomNavbarBehavior],
|
||||
components: {
|
||||
TButton,
|
||||
TDraggable
|
||||
},
|
||||
props: {
|
||||
...uni_modules_tdesignUniapp_components_fab_props.props
|
||||
},
|
||||
emits: [
|
||||
"move",
|
||||
"start",
|
||||
"end"
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
prefix: uni_modules_tdesignUniapp_components_common_config.prefix,
|
||||
classPrefix: name,
|
||||
moveStyle: null,
|
||||
tools: uni_modules_tdesignUniapp_components_common_utils_wxs.tools,
|
||||
systemInfo: uni_modules_tdesignUniapp_components_common_wechat.getWindowInfo()
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
buttonData() {
|
||||
return {
|
||||
...baseButtonProps,
|
||||
shape: this.text ? "round" : "circle",
|
||||
...this.buttonProps,
|
||||
icon: this.icon,
|
||||
content: this.text,
|
||||
ariaLabel: this.ariaLabel
|
||||
};
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
icon: "computedSize",
|
||||
ariaLabel: "computedSize",
|
||||
yBounds: "computedSize",
|
||||
buttonProps: "computedSize",
|
||||
text: {
|
||||
handler(val) {
|
||||
this.content = val;
|
||||
this.computedSize();
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onTplButtonTap(e) {
|
||||
this.$emit("click", { e });
|
||||
},
|
||||
onStart(t) {
|
||||
this.$emit("drag-start", t);
|
||||
},
|
||||
onMove(e) {
|
||||
const {
|
||||
yBounds = [],
|
||||
distanceTop,
|
||||
systemInfo
|
||||
} = this;
|
||||
const { x, y, rect } = e;
|
||||
const maxX = systemInfo.windowWidth - rect.width;
|
||||
const maxY = systemInfo.windowHeight - Math.max(distanceTop, uni_modules_tdesignUniapp_components_common_utils.unitConvert(yBounds[0])) - rect.height;
|
||||
const right = Math.max(0, Math.min(x, maxX));
|
||||
const bottom = Math.max(0, uni_modules_tdesignUniapp_components_common_utils.unitConvert(yBounds[1]), Math.min(y, maxY));
|
||||
this.moveStyle = `right: ${right}px; bottom: ${bottom}px;`;
|
||||
},
|
||||
onEnd(t) {
|
||||
this.$emit("drag-end", t);
|
||||
},
|
||||
computedSize() {
|
||||
if (!this.draggable)
|
||||
return;
|
||||
setTimeout(() => {
|
||||
var _a, _b, _c;
|
||||
const insChild = (_b = (_a = this.$refs.draggableTemplate) == null ? void 0 : _a.$refs) == null ? void 0 : _b.draggable;
|
||||
if ((_c = this == null ? void 0 : this.yBounds) == null ? void 0 : _c[1]) {
|
||||
this.moveStyle = `bottom: ${uni_modules_tdesignUniapp_components_common_utils.unitConvert(this.yBounds[1])}px`;
|
||||
insChild == null ? void 0 : insChild.computedRect();
|
||||
} else {
|
||||
insChild == null ? void 0 : insChild.computedRect();
|
||||
}
|
||||
});
|
||||
},
|
||||
getActionClass(a, b) {
|
||||
return `${a}-${b}`;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!Array) {
|
||||
const _easycom_t_button2 = common_vendor.resolveComponent("t-button");
|
||||
const _easycom_t_draggable2 = common_vendor.resolveComponent("t-draggable");
|
||||
(_easycom_t_button2 + _easycom_t_draggable2)();
|
||||
}
|
||||
const _easycom_t_button = () => "../button/button.js";
|
||||
const _easycom_t_draggable = () => "../draggable/draggable.js";
|
||||
if (!Math) {
|
||||
(_easycom_t_button + _easycom_t_draggable)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: _ctx.draggable
|
||||
}, _ctx.draggable ? common_vendor.e({
|
||||
b: !_ctx.buttonData.content && !_ctx.buttonData.icon
|
||||
}, !_ctx.buttonData.content && !_ctx.buttonData.icon ? {} : common_vendor.e({
|
||||
c: true
|
||||
}, {}, {
|
||||
d: common_vendor.n(_ctx.getActionClass(_ctx.classPrefix, _ctx.buttonData.buttonLayout) || ""),
|
||||
e: _ctx.buttonData.index,
|
||||
f: common_vendor.o(_ctx.onTplButtonTap),
|
||||
g: common_vendor.o(_ctx.onTplButtonTap),
|
||||
h: common_vendor.o(_ctx.onTplButtonTap),
|
||||
i: common_vendor.o(_ctx.onTplButtonTap),
|
||||
j: common_vendor.o(_ctx.onTplButtonTap),
|
||||
k: common_vendor.o(_ctx.onTplButtonTap),
|
||||
l: common_vendor.o(_ctx.onTplButtonTap),
|
||||
m: common_vendor.o(_ctx.onTplButtonTap),
|
||||
n: common_vendor.p({
|
||||
["t-id"]: _ctx.buttonData.tId,
|
||||
["custom-style"]: _ctx.buttonData.style || "",
|
||||
block: _ctx.buttonData.block,
|
||||
["t-class"]: _ctx.buttonData.tClass,
|
||||
disabled: _ctx.buttonData.disabled,
|
||||
["custom-dataset"]: _ctx.buttonData.customDataset,
|
||||
content: _ctx.buttonData.content,
|
||||
icon: _ctx.buttonData.icon,
|
||||
loading: _ctx.buttonData.loading,
|
||||
["loading-props"]: _ctx.buttonData.loadingProps,
|
||||
theme: _ctx.buttonData.theme,
|
||||
ghost: _ctx.buttonData.ghost,
|
||||
shape: _ctx.buttonData.shape,
|
||||
size: _ctx.buttonData.size,
|
||||
variant: _ctx.buttonData.variant,
|
||||
["open-type"]: _ctx.buttonData.openType,
|
||||
["hover-class"]: _ctx.buttonData.hoverClass,
|
||||
["hover-stop-propagation"]: _ctx.buttonData.hoverStopPropagation,
|
||||
["hover-start-time"]: _ctx.buttonData.hoverStartTime,
|
||||
["hover-stay-time"]: _ctx.buttonData.hoverStayTime,
|
||||
lang: _ctx.buttonData.lang,
|
||||
["session-from"]: _ctx.buttonData.sessionFrom,
|
||||
["send-message-title"]: _ctx.buttonData.sendMessageTitle,
|
||||
["send-message-path"]: _ctx.buttonData.sendMessagePath,
|
||||
["send-message-img"]: _ctx.buttonData.sendMessageImg,
|
||||
["app-parameter"]: _ctx.buttonData.appParameter,
|
||||
["show-message-card"]: _ctx.buttonData.showMessageCard,
|
||||
["aria-label"]: _ctx.buttonData.ariaLabel
|
||||
})
|
||||
}), {
|
||||
o: common_vendor.sr("draggable", "f580c3f3-0"),
|
||||
p: common_vendor.o(_ctx.onStart),
|
||||
q: common_vendor.o(_ctx.onMove),
|
||||
r: common_vendor.o(_ctx.onEnd),
|
||||
s: common_vendor.p({
|
||||
["custom-style"]: _ctx.tools._style(["right: 16px; bottom: 32px;", _ctx.customStyle, _ctx.moveStyle]),
|
||||
direction: _ctx.draggable === true ? "all" : _ctx.draggable,
|
||||
["t-class"]: _ctx.tClass
|
||||
})
|
||||
}) : common_vendor.e({
|
||||
t: !_ctx.buttonData || !_ctx.buttonData.content && !_ctx.buttonData.icon
|
||||
}, !_ctx.buttonData || !_ctx.buttonData.content && !_ctx.buttonData.icon ? {} : {
|
||||
v: common_vendor.n(_ctx.getActionClass(_ctx.classPrefix, _ctx.buttonData.buttonLayout) || ""),
|
||||
w: _ctx.buttonData.index,
|
||||
x: common_vendor.o(_ctx.onTplButtonTap),
|
||||
y: common_vendor.o(_ctx.onTplButtonTap),
|
||||
z: common_vendor.o(_ctx.onTplButtonTap),
|
||||
A: common_vendor.o(_ctx.onTplButtonTap),
|
||||
B: common_vendor.o(_ctx.onTplButtonTap),
|
||||
C: common_vendor.o(_ctx.onTplButtonTap),
|
||||
D: common_vendor.o(_ctx.onTplButtonTap),
|
||||
E: common_vendor.o(_ctx.onTplButtonTap),
|
||||
F: common_vendor.p({
|
||||
["t-id"]: _ctx.buttonData.tId,
|
||||
["custom-style"]: _ctx.buttonData.style || "",
|
||||
block: _ctx.buttonData.block,
|
||||
["t-class"]: _ctx.buttonData.tClass,
|
||||
disabled: _ctx.buttonData.disabled,
|
||||
["custom-dataset"]: _ctx.buttonData.customDataset,
|
||||
content: _ctx.buttonData.content,
|
||||
icon: _ctx.buttonData.icon,
|
||||
loading: _ctx.buttonData.loading,
|
||||
["loading-props"]: _ctx.buttonData.loadingProps,
|
||||
theme: _ctx.buttonData.theme,
|
||||
ghost: _ctx.buttonData.ghost,
|
||||
shape: _ctx.buttonData.shape,
|
||||
size: _ctx.buttonData.size,
|
||||
variant: _ctx.buttonData.variant,
|
||||
["open-type"]: _ctx.buttonData.openType,
|
||||
["hover-class"]: _ctx.buttonData.hoverClass,
|
||||
["hover-stop-propagation"]: _ctx.buttonData.hoverStopPropagation,
|
||||
["hover-start-time"]: _ctx.buttonData.hoverStartTime,
|
||||
["hover-stay-time"]: _ctx.buttonData.hoverStayTime,
|
||||
lang: _ctx.buttonData.lang,
|
||||
["session-from"]: _ctx.buttonData.sessionFrom,
|
||||
["send-message-title"]: _ctx.buttonData.sendMessageTitle,
|
||||
["send-message-path"]: _ctx.buttonData.sendMessagePath,
|
||||
["send-message-img"]: _ctx.buttonData.sendMessageImg,
|
||||
["app-parameter"]: _ctx.buttonData.appParameter,
|
||||
["show-message-card"]: _ctx.buttonData.showMessageCard,
|
||||
["aria-label"]: _ctx.buttonData.ariaLabel
|
||||
})
|
||||
}, {
|
||||
G: common_vendor.n(_ctx.classPrefix),
|
||||
H: common_vendor.n(_ctx.tClass),
|
||||
I: common_vendor.s(_ctx.tools._style(["right: 16px; bottom: 32px;", _ctx.customStyle]))
|
||||
}));
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-f580c3f3"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/tdesign-uniapp/components/fab/fab.js.map
|
||||
7
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/fab/fab.json
vendored
Normal file
7
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/fab/fab.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-button": "../button/button",
|
||||
"t-draggable": "../draggable/draggable"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/fab/fab.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/fab/fab.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<t-draggable wx:if="{{a}}" class="r data-v-f580c3f3" u-s="{{['d']}}" u-r="draggable" bindstart="{{p}}" bindmove="{{q}}" bindend="{{r}}" u-i="f580c3f3-0" bind:__l="__l" u-p="{{s}}"><slot wx:if="{{b}}"/><block wx:else name="button"><t-button wx:if="{{n}}" u-s="{{['d']}}" class="{{['data-v-f580c3f3', d]}}" data-type="{{'action'}}" data-extra="{{e}}" bindclick="{{f}}" bindgetuserinfo="{{g}}" bindcontact="{{h}}" bindgetphonenumber="{{i}}" binderror="{{j}}" bindopensetting="{{k}}" bindlaunchapp="{{l}}" bindagreeprivacyauthorization="{{m}}" u-i="f580c3f3-1,f580c3f3-0" bind:__l="__l" u-p="{{n}}"><slot wx:if="{{c}}"/></t-button></block></t-draggable><view wx:else class="{{['data-v-f580c3f3', G, H]}}" style="{{I}}"><slot wx:if="{{t}}"/><t-button wx:else u-s="{{['d']}}" class="{{['data-v-f580c3f3', v]}}" data-type="{{'action'}}" data-extra="{{w}}" bindclick="{{x}}" bindgetuserinfo="{{y}}" bindcontact="{{z}}" bindgetphonenumber="{{A}}" binderror="{{B}}" bindopensetting="{{C}}" bindlaunchapp="{{D}}" bindagreeprivacyauthorization="{{E}}" u-i="f580c3f3-2" bind:__l="__l" u-p="{{F||''}}"><slot/></t-button></view>
|
||||
9
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/fab/fab.wxss
vendored
Normal file
9
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/fab/fab.wxss
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
.t-fab.data-v-f580c3f3 {
|
||||
position: fixed;
|
||||
}
|
||||
.t-fab__button.data-v-f580c3f3 {
|
||||
box-shadow: var(--td-fab-shadow, var(--td-shadow-2, 0 3px 14px 2px rgba(0, 0, 0, 0.05), 0 8px 10px 1px rgba(0, 0, 0, 0.06), 0 5px 5px -3px rgba(0, 0, 0, 0.1)));
|
||||
}
|
||||
.t-fab__draggable.data-v-f580c3f3 {
|
||||
position: fixed;
|
||||
}
|
||||
50
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/fab/props.js
vendored
Normal file
50
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/fab/props.js
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
const props = {
|
||||
/** 透传至 Button 组件 */
|
||||
buttonProps: {
|
||||
type: Object
|
||||
},
|
||||
/** 是否可拖拽。`true` / `'all'`可拖动<br>`'vertical'`可垂直拖动<br>`'horizontal'`可水平拖动<br>`false`禁止拖动 */
|
||||
draggable: {
|
||||
type: [String, Boolean],
|
||||
default: false
|
||||
},
|
||||
/** 图标 */
|
||||
icon: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
/** 悬浮按钮的样式,常用于调整位置(即将废弃,建议使用 `style`) */
|
||||
style: {
|
||||
type: String,
|
||||
default: "right: 16px; bottom: 32px;"
|
||||
},
|
||||
/** 文本内容 */
|
||||
text: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
/** 是否使用了自定义导航栏 */
|
||||
usingCustomNavbar: Boolean,
|
||||
/** 设置垂直方向边界限制,示例:[48, 48] 或 ['96px', 80] */
|
||||
yBounds: {
|
||||
type: Array
|
||||
},
|
||||
/** 悬浮按钮点击事件 */
|
||||
onClick: {
|
||||
type: Function,
|
||||
default: () => ({})
|
||||
},
|
||||
/** 结束拖拽时触发 */
|
||||
onDragEnd: {
|
||||
type: Function,
|
||||
default: () => ({})
|
||||
},
|
||||
/** 开始拖拽时触发 */
|
||||
onDragStart: {
|
||||
type: Function,
|
||||
default: () => ({})
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/tdesign-uniapp/components/fab/props.js.map
|
||||
Reference in New Issue
Block a user