fit2cloud-ui-plus 0.0.1-beta.10 → 0.0.1-beta.11
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 +61 -9
- package/lib/fit2cloud-ui-plus.es.js +700 -99
- package/lib/fit2cloud-ui-plus.umd.js +1 -1
- package/package.json +5 -3
- package/src/components/filter-bar/index.d.ts +2 -0
- package/src/components/filter-bar/types.d.ts +22 -0
- package/src/components/read-write-switch/index.d.ts +2 -0
- package/src/components/read-write-switch/types.d.ts +4 -0
- package/src/components/speed-dial/FuSpeedDial.vue +289 -0
- package/src/components/speed-dial/FuSpeedDial.vue.d.ts +218 -0
- package/src/components/speed-dial/FuSpeedDialActionButton.vue +88 -0
- package/src/components/speed-dial/FuSpeedDialActionButton.vue.d.ts +32 -0
- package/src/components/speed-dial/FuSpeedDialButton.vue +45 -0
- package/src/components/speed-dial/FuSpeedDialButton.vue.d.ts +42 -0
- package/src/components/speed-dial/FuSpeedDialItem.vue +82 -0
- package/src/components/speed-dial/FuSpeedDialItem.vue.d.ts +12 -0
- package/src/components/speed-dial/index.d.ts +2 -0
- package/src/components/speed-dial/index.ts +11 -0
- package/src/components/speed-dial/types.d.ts +8 -0
- package/src/components/speed-dial/types.ts +12 -0
- package/src/components/split-pane/FuSplitPane.vue.d.ts +59 -0
- package/src/components/split-pane/index.d.ts +2 -0
- package/src/components/table/index.d.ts +2 -0
- package/src/components/table/table-column-select/utils.d.ts +8 -0
- package/src/components/table/types.d.ts +2 -0
- package/src/components/tabs/FuTabs.vue.d.ts +54 -0
- package/src/components/tabs/index.d.ts +2 -0
- package/src/hooks/index.d.ts +3 -0
- package/src/hooks/use-global-config/index.d.ts +1 -0
- package/src/hooks/use-locale/index.d.ts +14 -0
- package/src/hooks/use-size/index.d.ts +5 -0
- package/src/index.d.ts +7 -0
- package/src/locale/index.d.ts +10 -0
- package/src/locale/lang/en.d.ts +59 -0
- package/src/locale/lang/zh-cn.d.ts +59 -0
- package/src/locale/lang/zh-tw.d.ts +59 -0
- package/src/styles/components/speed-dial.scss +1 -51
- package/src/tools/size.d.ts +4 -0
- package/src/tools/theme.d.ts +1 -0
- package/src/tools/time.d.ts +2 -0
- package/src/tools/types.d.ts +8 -0
- package/src/tools/utils.d.ts +2 -0
- package/src/tools/vnode.d.ts +9 -0
- package/types/examples/App.vue.d.ts +2 -0
- package/types/examples/components/CodeExample.vue.d.ts +29 -0
- package/types/examples/components/DocumentTable.vue.d.ts +14 -0
- package/types/examples/components/Markdown.vue.d.ts +12 -0
- package/types/examples/layout/components/AppHeader.vue.d.ts +2 -0
- package/types/examples/layout/components/Sidebar.vue.d.ts +2 -0
- package/types/examples/layout/index.vue.d.ts +2 -0
- package/types/examples/main.d.ts +2 -0
- package/types/examples/pages/filter-bar/attributes.d.ts +63 -0
- package/types/examples/pages/filter-bar/demo/BaseFilterBar.vue.d.ts +2 -0
- package/types/examples/pages/filter-bar/demo/SetConditionsDemo.vue.d.ts +2 -0
- package/types/examples/pages/filter-bar/demo/SlotDemo.vue.d.ts +2 -0
- package/types/examples/pages/filter-bar/index.vue.d.ts +2 -0
- package/types/examples/pages/index.d.ts +3 -0
- package/types/examples/pages/read-write-switch/attributes.d.ts +63 -0
- package/types/examples/pages/read-write-switch/demo/BaseDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/CustomContentDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/InputRwSwitchDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/ReadSwitchDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/SelectRwSwitchDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/TableInnerEditDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/WriteSwitchDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/index.vue.d.ts +2 -0
- package/types/examples/pages/speed-dial/attributes.d.ts +63 -0
- package/types/examples/pages/speed-dial/demo/BaseSpeedDial.vue.d.ts +2 -0
- package/types/examples/pages/speed-dial/demo/SpeedDialCustom.vue.d.ts +2 -0
- package/types/examples/pages/speed-dial/demo/SpeedDialPosition.vue.d.ts +2 -0
- package/types/examples/pages/speed-dial/demo/SpeedDialTrigger.vue.d.ts +2 -0
- package/types/examples/pages/speed-dial/index.vue.d.ts +2 -0
- package/types/examples/pages/split-pane/attributes.d.ts +63 -0
- package/types/examples/pages/split-pane/demo/BaseSplit.vue.d.ts +2 -0
- package/types/examples/pages/split-pane/demo/CustomResizer.vue.d.ts +2 -0
- package/types/examples/pages/split-pane/demo/NestSplit.vue.d.ts +2 -0
- package/types/examples/pages/split-pane/demo/ResizerType.vue.d.ts +2 -0
- package/types/examples/pages/split-pane/index.vue.d.ts +2 -0
- package/types/examples/pages/table/attributes.d.ts +121 -0
- package/types/examples/pages/table/demo/BaseTable.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/DropdownColumn.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/DropdownColumnSlot.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/SaveSelectColumn.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/SelectColumn.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/TableOperations.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/TablePagination.vue.d.ts +2 -0
- package/types/examples/pages/table/index.vue.d.ts +2 -0
- package/types/examples/pages/tabs/attributes.d.ts +63 -0
- package/types/examples/pages/tabs/demo/AddCloseTab.vue.d.ts +2 -0
- package/types/examples/pages/tabs/index.vue.d.ts +2 -0
- package/types/examples/router/doc-routes.d.ts +12 -0
- package/types/examples/router/index.d.ts +4 -0
- package/types/plugins/example-transform.d.ts +5 -0
- package/types/src/components/filter-bar/FuFilter.vue.d.ts +39 -0
- package/types/src/components/filter-bar/FuFilterBar.vue.d.ts +22 -0
- package/types/src/components/filter-bar/FuFilterConditions.vue.d.ts +8 -0
- package/types/src/components/filter-bar/FuSearchInput.vue.d.ts +17 -0
- package/types/src/components/filter-bar/filter-components/FuFilterDate.vue.d.ts +36 -0
- package/types/src/components/filter-bar/filter-components/FuFilterDateTime.vue.d.ts +36 -0
- package/types/src/components/filter-bar/filter-components/FuFilterOption.vue.d.ts +24 -0
- package/types/src/components/filter-bar/filter-components/FuFilterSelect.vue.d.ts +66 -0
- package/types/src/components/filter-bar/index.d.ts +2 -0
- package/types/src/components/filter-bar/types.d.ts +22 -0
- package/types/src/components/read-write-switch/FuInputRwSwitch.vue.d.ts +21 -0
- package/types/src/components/read-write-switch/FuReadWriteSwitch.vue.d.ts +23 -0
- package/types/src/components/read-write-switch/FuSelectRwSwitch.vue.d.ts +33 -0
- package/types/src/components/read-write-switch/index.d.ts +2 -0
- package/types/src/components/read-write-switch/types.d.ts +4 -0
- package/types/src/components/speed-dial/FuSpeedDial.vue.d.ts +218 -0
- package/types/src/components/speed-dial/FuSpeedDialActionButton.vue.d.ts +32 -0
- package/types/src/components/speed-dial/FuSpeedDialButton.vue.d.ts +42 -0
- package/types/src/components/speed-dial/FuSpeedDialItem.vue.d.ts +12 -0
- package/types/src/components/speed-dial/index.d.ts +2 -0
- package/types/src/components/speed-dial/types.d.ts +8 -0
- package/types/src/components/split-pane/FuSplitPane.vue.d.ts +59 -0
- package/types/src/components/split-pane/index.d.ts +2 -0
- package/types/src/components/table/FuTable.vue.d.ts +18 -0
- package/types/src/components/table/FuTableBody.d.ts +3 -0
- package/types/src/components/table/FuTableColumnDropdown.vue.d.ts +50 -0
- package/types/src/components/table/FuTablePagination.vue.d.ts +47 -0
- package/types/src/components/table/index.d.ts +2 -0
- package/types/src/components/table/table-column-select/FuTableColumnSelect.vue.d.ts +10 -0
- package/types/src/components/table/table-column-select/FuTableColumnSelectDialog.vue.d.ts +23 -0
- package/types/src/components/table/table-column-select/FuTableColumnSelectPopover.vue.d.ts +34 -0
- package/types/src/components/table/table-column-select/utils.d.ts +8 -0
- package/types/src/components/table/table-operations/FuTableButton.vue.d.ts +13 -0
- package/types/src/components/table/table-operations/FuTableMoreButton.vue.d.ts +37 -0
- package/types/src/components/table/table-operations/FuTableOperations.vue.d.ts +46 -0
- package/types/src/components/table/types.d.ts +2 -0
- package/types/src/components/tabs/FuTabs.vue.d.ts +54 -0
- package/types/src/components/tabs/index.d.ts +2 -0
- package/types/src/hooks/index.d.ts +3 -0
- package/types/src/hooks/use-global-config/index.d.ts +1 -0
- package/types/src/hooks/use-locale/index.d.ts +14 -0
- package/types/src/hooks/use-size/index.d.ts +5 -0
- package/types/src/index.d.ts +7 -0
- package/types/src/locale/index.d.ts +10 -0
- package/types/src/locale/lang/en.d.ts +59 -0
- package/types/src/locale/lang/zh-cn.d.ts +59 -0
- package/types/src/locale/lang/zh-tw.d.ts +59 -0
- package/types/src/tools/size.d.ts +4 -0
- package/types/src/tools/theme.d.ts +1 -0
- package/types/src/tools/time.d.ts +2 -0
- package/types/src/tools/types.d.ts +8 -0
- package/types/src/tools/utils.d.ts +2 -0
- package/types/src/tools/vnode.d.ts +9 -0
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="fu-speed-dial" :style="style" v-click-outside="outsideClickClose">
|
|
3
|
+
<div class="fu-speed-dial__content">
|
|
4
|
+
<slot name="fab">
|
|
5
|
+
<fu-speed-dial-button v-bind="buttonProps" @click="click" @mousedown="mousedown"/>
|
|
6
|
+
</slot>
|
|
7
|
+
<div :style="contentPosition">
|
|
8
|
+
<slot>
|
|
9
|
+
<fu-speed-dial-item v-for="(item, index) in items" :index="index" :key="index" v-bind="item"
|
|
10
|
+
@click="itemClick(index)"/>
|
|
11
|
+
</slot>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
import {ref, watch, getCurrentInstance, onMounted, computed, provide, useSlots, PropType} from "vue";
|
|
20
|
+
import type {CSSProperties} from 'vue'
|
|
21
|
+
import type {ZIndexProperty, PositionProperty} from 'csstype'
|
|
22
|
+
import {ClickOutside as vClickOutside} from 'element-plus'
|
|
23
|
+
import FuSpeedDialButton from "@/components/speed-dial/FuSpeedDialButton.vue"
|
|
24
|
+
import FuSpeedDialItem from "@/components/speed-dial/FuSpeedDialItem.vue"
|
|
25
|
+
import {SpeedDialKey} from "./types";
|
|
26
|
+
|
|
27
|
+
defineOptions({name: "FuSpeedDial"});
|
|
28
|
+
const props = defineProps({
|
|
29
|
+
modelValue: Boolean,
|
|
30
|
+
id: String,
|
|
31
|
+
type: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "primary"
|
|
34
|
+
},
|
|
35
|
+
items: Array as any,
|
|
36
|
+
size: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "default",
|
|
39
|
+
validator: (value: string) => ["large", "default", "small"].includes(value)
|
|
40
|
+
},
|
|
41
|
+
direction: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "top",
|
|
44
|
+
validator: (value: string) => ["top", "bottom", "left", "right"].includes(value)
|
|
45
|
+
},
|
|
46
|
+
icon: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: "Plus"
|
|
49
|
+
},
|
|
50
|
+
activeIcon: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: "Close"
|
|
53
|
+
},
|
|
54
|
+
movable: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
58
|
+
position: {
|
|
59
|
+
type: String as PropType<PositionProperty>,
|
|
60
|
+
validator: (value: string) => ["absolute", "fixed"].includes(value)
|
|
61
|
+
},
|
|
62
|
+
left: String,
|
|
63
|
+
top: String,
|
|
64
|
+
right: String,
|
|
65
|
+
bottom: String,
|
|
66
|
+
zIndex: {
|
|
67
|
+
type: ([String, Number]) as PropType<ZIndexProperty>,
|
|
68
|
+
default: 99
|
|
69
|
+
},
|
|
70
|
+
itemClickClose: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: true
|
|
73
|
+
},
|
|
74
|
+
outsideClose: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: true
|
|
77
|
+
},
|
|
78
|
+
manual: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: false
|
|
81
|
+
},
|
|
82
|
+
localKey: String,
|
|
83
|
+
sizeOptions: {
|
|
84
|
+
type: Object,
|
|
85
|
+
default: () => {
|
|
86
|
+
return {
|
|
87
|
+
large: {
|
|
88
|
+
fab: {size: 56, fontSize: "18px"},
|
|
89
|
+
item: {size: 40, spacing: 0, titleFontSize: "14px", buttonFontSize: "18px"}
|
|
90
|
+
},
|
|
91
|
+
default: {
|
|
92
|
+
fab: {size: 40, fontSize: "16px"},
|
|
93
|
+
item: {size: 32, spacing: 0, titleFontSize: "14px", buttonFontSize: "16px"}
|
|
94
|
+
},
|
|
95
|
+
small: {
|
|
96
|
+
fab: {size: 32, fontSize: "12px", padding: 0},
|
|
97
|
+
item: {size: 24, spacing: 0, titleFontSize: "12px", buttonFontSize: "12px"}
|
|
98
|
+
},
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
const emit = defineEmits(["close", "outside-click", "click"])
|
|
105
|
+
|
|
106
|
+
const slots = useSlots()
|
|
107
|
+
const instance = getCurrentInstance()
|
|
108
|
+
|
|
109
|
+
const active = ref(false)
|
|
110
|
+
const moving = ref(false)
|
|
111
|
+
|
|
112
|
+
const {zIndex, position, left, top, right, bottom} = props
|
|
113
|
+
const style = ref({zIndex, position, left, top, right, bottom})
|
|
114
|
+
|
|
115
|
+
watch(() => props.modelValue, (v) => {
|
|
116
|
+
active.value = v
|
|
117
|
+
})
|
|
118
|
+
watch(() => props.position, () => updateStyle())
|
|
119
|
+
watch(() => props.zIndex, () => updateStyle())
|
|
120
|
+
watch(() => props.left, () => updateStyle())
|
|
121
|
+
watch(() => props.right, () => updateStyle())
|
|
122
|
+
watch(() => props.top, () => updateStyle())
|
|
123
|
+
watch(() => props.bottom, () => updateStyle())
|
|
124
|
+
|
|
125
|
+
function updateStyle() {
|
|
126
|
+
const {zIndex, position, left, top, right, bottom} = props
|
|
127
|
+
style.value = {zIndex, position, left, top, right, bottom}
|
|
128
|
+
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const saveKey = computed(() => {
|
|
132
|
+
return "Fu-SD-" + props.localKey
|
|
133
|
+
})
|
|
134
|
+
const hashChildren = computed(() => {
|
|
135
|
+
if (props.items && props.items.length > 0) {
|
|
136
|
+
return true
|
|
137
|
+
}
|
|
138
|
+
return slots && slots.default
|
|
139
|
+
})
|
|
140
|
+
const config = computed(() => {
|
|
141
|
+
return props.sizeOptions[props.size] || props.sizeOptions["default"]
|
|
142
|
+
})
|
|
143
|
+
const buttonProps = computed(() => {
|
|
144
|
+
let rotate = true
|
|
145
|
+
let size = config.value.fab.size + "px"
|
|
146
|
+
let fontSize = config.value.fab.fontSize
|
|
147
|
+
let icon = props.activeIcon === props.icon ? props.icon : active.value ? props.activeIcon : props.icon
|
|
148
|
+
return {type: props.type, rotate, active: active.value, size, fontSize, icon}
|
|
149
|
+
})
|
|
150
|
+
const spacing = computed(() => {
|
|
151
|
+
let spacing = config.value.item.spacing || 0
|
|
152
|
+
spacing += (config.value.fab.size - config.value.item.size) / 2
|
|
153
|
+
return spacing
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
const contentPosition = computed(() => {
|
|
157
|
+
let position = config.value.fab.size + spacing.value
|
|
158
|
+
if (["top", "left"].includes(props.direction)) {
|
|
159
|
+
position = -config.value.fab.size - spacing.value
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
let positionStyle: CSSProperties = {position: "absolute", zIndex: props.zIndex}
|
|
163
|
+
if (["top", "bottom"].includes(props.direction)) {
|
|
164
|
+
positionStyle.top = position + "px"
|
|
165
|
+
} else {
|
|
166
|
+
positionStyle.top = 0
|
|
167
|
+
positionStyle.left = position + "px"
|
|
168
|
+
}
|
|
169
|
+
return positionStyle
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
function toggle(bool?: any) {
|
|
174
|
+
if (!moving.value && hashChildren.value) {
|
|
175
|
+
active.value = bool === undefined ? !active.value : bool
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function outsideClickClose() {
|
|
180
|
+
if (props.outsideClose && !props.manual) {
|
|
181
|
+
toggle(false)
|
|
182
|
+
}
|
|
183
|
+
emit("outside-click", [props.id, active.value])
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function click(e: Event) {
|
|
187
|
+
if (!props.manual) {
|
|
188
|
+
toggle()
|
|
189
|
+
}
|
|
190
|
+
emit("click", [props.id, active.value], e)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function mousedown() {
|
|
194
|
+
if (props.movable) {
|
|
195
|
+
document.addEventListener('mousemove', mousemove)
|
|
196
|
+
document.addEventListener('mouseup', mouseup)
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function mousemove(e: MouseEvent) {
|
|
201
|
+
moving.value = true
|
|
202
|
+
if (props.position === "fixed") {
|
|
203
|
+
const el = instance?.vnode.el as HTMLElement
|
|
204
|
+
const rect = el.getBoundingClientRect()
|
|
205
|
+
let left = e.clientX - rect.width / 2
|
|
206
|
+
let top = e.clientY - rect.height / 2
|
|
207
|
+
style.value.left = left + 'px'
|
|
208
|
+
style.value.top = top + 'px'
|
|
209
|
+
delete style.value.right
|
|
210
|
+
delete style.value.bottom
|
|
211
|
+
}
|
|
212
|
+
if (props.position === "absolute") {
|
|
213
|
+
const {offsetLeft, offsetTop, clientWidth, clientHeight, offsetParent} = instance?.vnode.el as HTMLElement
|
|
214
|
+
|
|
215
|
+
const maxWidth = offsetParent && offsetParent.clientWidth || 0 - clientWidth
|
|
216
|
+
const maxHeight = offsetParent && offsetParent.clientHeight || 0 - clientHeight
|
|
217
|
+
|
|
218
|
+
let left = offsetLeft + e.movementX
|
|
219
|
+
let top = offsetTop + e.movementY
|
|
220
|
+
if (left > 0 && left < maxWidth) {
|
|
221
|
+
style.value.left = left + 'px'
|
|
222
|
+
delete style.value.right
|
|
223
|
+
}
|
|
224
|
+
if (top > 0 && top < maxHeight) {
|
|
225
|
+
style.value.top = top + 'px'
|
|
226
|
+
delete style.value.bottom
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function mouseup() {
|
|
232
|
+
writePosition()
|
|
233
|
+
document.removeEventListener('mousemove', mousemove)
|
|
234
|
+
document.removeEventListener('mouseup', mouseup)
|
|
235
|
+
setTimeout(() => moving.value = false)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function writePosition() {
|
|
239
|
+
if (props.localKey) {
|
|
240
|
+
localStorage.setItem(saveKey.value, JSON.stringify(style.value))
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function readPosition() {
|
|
245
|
+
// *******????
|
|
246
|
+
// if (this.savePosition) {
|
|
247
|
+
let position = localStorage.getItem(saveKey.value)
|
|
248
|
+
try {
|
|
249
|
+
localStorage.getItem(saveKey.value)
|
|
250
|
+
if (position) {
|
|
251
|
+
style.value = JSON.parse(position)
|
|
252
|
+
}
|
|
253
|
+
} catch (e) {
|
|
254
|
+
console.warn(saveKey.value + " error", e)
|
|
255
|
+
}
|
|
256
|
+
// }
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function itemClick(index: any) {
|
|
260
|
+
if (index !== undefined) {
|
|
261
|
+
const item = props.items[index] as any;
|
|
262
|
+
if (item.click && typeof item.click === "function") return item.click(index)
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function close() {
|
|
267
|
+
if (props.itemClickClose && !props.manual) {
|
|
268
|
+
toggle(false)
|
|
269
|
+
}
|
|
270
|
+
emit("close", [props.id, active.value])
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
provide(SpeedDialKey, {
|
|
275
|
+
config: config.value,
|
|
276
|
+
direction: computed(() => props.direction),
|
|
277
|
+
active: active,
|
|
278
|
+
close
|
|
279
|
+
|
|
280
|
+
})
|
|
281
|
+
onMounted(() => {
|
|
282
|
+
readPosition()
|
|
283
|
+
})
|
|
284
|
+
|
|
285
|
+
defineExpose({
|
|
286
|
+
close
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
</script>
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
import type { ZIndexProperty, PositionProperty } from 'csstype';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
modelValue: BooleanConstructor;
|
|
5
|
+
id: StringConstructor;
|
|
6
|
+
type: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
items: any;
|
|
11
|
+
size: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
default: string;
|
|
14
|
+
validator: (value: string) => boolean;
|
|
15
|
+
};
|
|
16
|
+
direction: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
default: string;
|
|
19
|
+
validator: (value: string) => boolean;
|
|
20
|
+
};
|
|
21
|
+
icon: {
|
|
22
|
+
type: StringConstructor;
|
|
23
|
+
default: string;
|
|
24
|
+
};
|
|
25
|
+
activeIcon: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
default: string;
|
|
28
|
+
};
|
|
29
|
+
movable: {
|
|
30
|
+
type: BooleanConstructor;
|
|
31
|
+
default: boolean;
|
|
32
|
+
};
|
|
33
|
+
position: {
|
|
34
|
+
type: PropType<PositionProperty>;
|
|
35
|
+
validator: (value: string) => boolean;
|
|
36
|
+
};
|
|
37
|
+
left: StringConstructor;
|
|
38
|
+
top: StringConstructor;
|
|
39
|
+
right: StringConstructor;
|
|
40
|
+
bottom: StringConstructor;
|
|
41
|
+
zIndex: {
|
|
42
|
+
type: PropType<ZIndexProperty>;
|
|
43
|
+
default: number;
|
|
44
|
+
};
|
|
45
|
+
itemClickClose: {
|
|
46
|
+
type: BooleanConstructor;
|
|
47
|
+
default: boolean;
|
|
48
|
+
};
|
|
49
|
+
outsideClose: {
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
default: boolean;
|
|
52
|
+
};
|
|
53
|
+
manual: {
|
|
54
|
+
type: BooleanConstructor;
|
|
55
|
+
default: boolean;
|
|
56
|
+
};
|
|
57
|
+
localKey: StringConstructor;
|
|
58
|
+
sizeOptions: {
|
|
59
|
+
type: ObjectConstructor;
|
|
60
|
+
default: () => {
|
|
61
|
+
large: {
|
|
62
|
+
fab: {
|
|
63
|
+
size: number;
|
|
64
|
+
fontSize: string;
|
|
65
|
+
};
|
|
66
|
+
item: {
|
|
67
|
+
size: number;
|
|
68
|
+
spacing: number;
|
|
69
|
+
titleFontSize: string;
|
|
70
|
+
buttonFontSize: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
default: {
|
|
74
|
+
fab: {
|
|
75
|
+
size: number;
|
|
76
|
+
fontSize: string;
|
|
77
|
+
};
|
|
78
|
+
item: {
|
|
79
|
+
size: number;
|
|
80
|
+
spacing: number;
|
|
81
|
+
titleFontSize: string;
|
|
82
|
+
buttonFontSize: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
small: {
|
|
86
|
+
fab: {
|
|
87
|
+
size: number;
|
|
88
|
+
fontSize: string;
|
|
89
|
+
padding: number;
|
|
90
|
+
};
|
|
91
|
+
item: {
|
|
92
|
+
size: number;
|
|
93
|
+
spacing: number;
|
|
94
|
+
titleFontSize: string;
|
|
95
|
+
buttonFontSize: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
}, {
|
|
101
|
+
close: () => void;
|
|
102
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "close" | "outside-click")[], "click" | "close" | "outside-click", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
103
|
+
modelValue: BooleanConstructor;
|
|
104
|
+
id: StringConstructor;
|
|
105
|
+
type: {
|
|
106
|
+
type: StringConstructor;
|
|
107
|
+
default: string;
|
|
108
|
+
};
|
|
109
|
+
items: any;
|
|
110
|
+
size: {
|
|
111
|
+
type: StringConstructor;
|
|
112
|
+
default: string;
|
|
113
|
+
validator: (value: string) => boolean;
|
|
114
|
+
};
|
|
115
|
+
direction: {
|
|
116
|
+
type: StringConstructor;
|
|
117
|
+
default: string;
|
|
118
|
+
validator: (value: string) => boolean;
|
|
119
|
+
};
|
|
120
|
+
icon: {
|
|
121
|
+
type: StringConstructor;
|
|
122
|
+
default: string;
|
|
123
|
+
};
|
|
124
|
+
activeIcon: {
|
|
125
|
+
type: StringConstructor;
|
|
126
|
+
default: string;
|
|
127
|
+
};
|
|
128
|
+
movable: {
|
|
129
|
+
type: BooleanConstructor;
|
|
130
|
+
default: boolean;
|
|
131
|
+
};
|
|
132
|
+
position: {
|
|
133
|
+
type: PropType<PositionProperty>;
|
|
134
|
+
validator: (value: string) => boolean;
|
|
135
|
+
};
|
|
136
|
+
left: StringConstructor;
|
|
137
|
+
top: StringConstructor;
|
|
138
|
+
right: StringConstructor;
|
|
139
|
+
bottom: StringConstructor;
|
|
140
|
+
zIndex: {
|
|
141
|
+
type: PropType<ZIndexProperty>;
|
|
142
|
+
default: number;
|
|
143
|
+
};
|
|
144
|
+
itemClickClose: {
|
|
145
|
+
type: BooleanConstructor;
|
|
146
|
+
default: boolean;
|
|
147
|
+
};
|
|
148
|
+
outsideClose: {
|
|
149
|
+
type: BooleanConstructor;
|
|
150
|
+
default: boolean;
|
|
151
|
+
};
|
|
152
|
+
manual: {
|
|
153
|
+
type: BooleanConstructor;
|
|
154
|
+
default: boolean;
|
|
155
|
+
};
|
|
156
|
+
localKey: StringConstructor;
|
|
157
|
+
sizeOptions: {
|
|
158
|
+
type: ObjectConstructor;
|
|
159
|
+
default: () => {
|
|
160
|
+
large: {
|
|
161
|
+
fab: {
|
|
162
|
+
size: number;
|
|
163
|
+
fontSize: string;
|
|
164
|
+
};
|
|
165
|
+
item: {
|
|
166
|
+
size: number;
|
|
167
|
+
spacing: number;
|
|
168
|
+
titleFontSize: string;
|
|
169
|
+
buttonFontSize: string;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
default: {
|
|
173
|
+
fab: {
|
|
174
|
+
size: number;
|
|
175
|
+
fontSize: string;
|
|
176
|
+
};
|
|
177
|
+
item: {
|
|
178
|
+
size: number;
|
|
179
|
+
spacing: number;
|
|
180
|
+
titleFontSize: string;
|
|
181
|
+
buttonFontSize: string;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
small: {
|
|
185
|
+
fab: {
|
|
186
|
+
size: number;
|
|
187
|
+
fontSize: string;
|
|
188
|
+
padding: number;
|
|
189
|
+
};
|
|
190
|
+
item: {
|
|
191
|
+
size: number;
|
|
192
|
+
spacing: number;
|
|
193
|
+
titleFontSize: string;
|
|
194
|
+
buttonFontSize: string;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
}>> & {
|
|
200
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
|
201
|
+
onClose?: ((...args: any[]) => any) | undefined;
|
|
202
|
+
"onOutside-click"?: ((...args: any[]) => any) | undefined;
|
|
203
|
+
}, {
|
|
204
|
+
type: string;
|
|
205
|
+
icon: string;
|
|
206
|
+
zIndex: ZIndexProperty;
|
|
207
|
+
size: string;
|
|
208
|
+
modelValue: boolean;
|
|
209
|
+
direction: string;
|
|
210
|
+
movable: boolean;
|
|
211
|
+
manual: boolean;
|
|
212
|
+
items: any;
|
|
213
|
+
activeIcon: string;
|
|
214
|
+
itemClickClose: boolean;
|
|
215
|
+
outsideClose: boolean;
|
|
216
|
+
sizeOptions: Record<string, any>;
|
|
217
|
+
}>;
|
|
218
|
+
export default _default;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="fu-speed-dial-action-button">
|
|
3
|
+
<div v-if="title" class="fu-speed-dial-action-button__title" :style="titleSize">
|
|
4
|
+
<slot name="title">
|
|
5
|
+
<div class="fu-speed-dial-action-button__text" :class="titleClass" :style="titleStyle" @click="click">{{ title
|
|
6
|
+
}}
|
|
7
|
+
</div>
|
|
8
|
+
</slot>
|
|
9
|
+
</div>
|
|
10
|
+
<slot>
|
|
11
|
+
<fu-speed-dial-button :class="buttonClass" v-bind="buttonProps" :icon="icon" @click="click" />
|
|
12
|
+
</slot>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import { inject, computed } from 'vue'
|
|
18
|
+
import type { CSSProperties } from 'vue'
|
|
19
|
+
import FuSpeedDialButton from "@/components/speed-dial/FuSpeedDialButton.vue";
|
|
20
|
+
import { SpeedDialKey } from "./types";
|
|
21
|
+
|
|
22
|
+
const props = defineProps({
|
|
23
|
+
index: Number,
|
|
24
|
+
icon: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "Plus"
|
|
27
|
+
},
|
|
28
|
+
titleClass: String,
|
|
29
|
+
titleBgColor: String,
|
|
30
|
+
titleColor: String,
|
|
31
|
+
buttonClass: String,
|
|
32
|
+
bgColor: String,
|
|
33
|
+
color: String,
|
|
34
|
+
title: [String, Number]
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const emit = defineEmits(["click"])
|
|
38
|
+
const speedDialKey = inject(SpeedDialKey)
|
|
39
|
+
|
|
40
|
+
const config = computed(() => {
|
|
41
|
+
return speedDialKey?.config;
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const direction = computed(() => {
|
|
45
|
+
return speedDialKey?.direction.value || "";
|
|
46
|
+
})
|
|
47
|
+
// const clickClose =computed(()=>{
|
|
48
|
+
// return FuSpeedDial.clickClose;
|
|
49
|
+
// })
|
|
50
|
+
|
|
51
|
+
const titleSize = computed(() => {
|
|
52
|
+
let size = config.value?.fab.size + "px";
|
|
53
|
+
let style: CSSProperties = { position: "absolute", height: size };
|
|
54
|
+
if (["top", "bottom"].includes(direction.value)) {
|
|
55
|
+
style['text-align'] = "right"
|
|
56
|
+
style['right'] = size
|
|
57
|
+
} else {
|
|
58
|
+
style['text-align'] = "center"
|
|
59
|
+
style['min-width'] = size
|
|
60
|
+
if (props.index || 0 % 2 === 0) {
|
|
61
|
+
style.top = size
|
|
62
|
+
} else {
|
|
63
|
+
style.top = "-" + size
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return style;
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const titleStyle = computed(() => {
|
|
70
|
+
let backgroundColor = props.titleBgColor;
|
|
71
|
+
let color = props.titleColor
|
|
72
|
+
let fontSize = config.value?.item.titleFontSize
|
|
73
|
+
return { backgroundColor, color, fontSize }
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
const buttonProps = computed(() => {
|
|
77
|
+
let backgroundColor = props.bgColor;
|
|
78
|
+
let color = props.color
|
|
79
|
+
let fontSize = config.value?.item.buttonFontSize
|
|
80
|
+
let size = config.value?.item.size + "px";
|
|
81
|
+
return { backgroundColor, color, fontSize, size }
|
|
82
|
+
})
|
|
83
|
+
function click(e: Event) {
|
|
84
|
+
const { index, title } = props
|
|
85
|
+
emit("click", { index, title }, e);
|
|
86
|
+
speedDialKey?.close();
|
|
87
|
+
}
|
|
88
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
index: NumberConstructor;
|
|
3
|
+
icon: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
default: string;
|
|
6
|
+
};
|
|
7
|
+
titleClass: StringConstructor;
|
|
8
|
+
titleBgColor: StringConstructor;
|
|
9
|
+
titleColor: StringConstructor;
|
|
10
|
+
buttonClass: StringConstructor;
|
|
11
|
+
bgColor: StringConstructor;
|
|
12
|
+
color: StringConstructor;
|
|
13
|
+
title: (StringConstructor | NumberConstructor)[];
|
|
14
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "click"[], "click", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
|
+
index: NumberConstructor;
|
|
16
|
+
icon: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
titleClass: StringConstructor;
|
|
21
|
+
titleBgColor: StringConstructor;
|
|
22
|
+
titleColor: StringConstructor;
|
|
23
|
+
buttonClass: StringConstructor;
|
|
24
|
+
bgColor: StringConstructor;
|
|
25
|
+
color: StringConstructor;
|
|
26
|
+
title: (StringConstructor | NumberConstructor)[];
|
|
27
|
+
}>> & {
|
|
28
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
icon: string;
|
|
31
|
+
}>;
|
|
32
|
+
export default _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="[
|
|
3
|
+
'fu-speed-dial-button',
|
|
4
|
+
'el-button',
|
|
5
|
+
'el-button--' + type,
|
|
6
|
+
{
|
|
7
|
+
'fu-speed-dial-button--rotate': rotate,
|
|
8
|
+
'is-disabled': disabled,
|
|
9
|
+
'is-active': active,
|
|
10
|
+
},]" :style="{
|
|
11
|
+
width: size,
|
|
12
|
+
height: size,
|
|
13
|
+
backgroundColor: backgroundColor,
|
|
14
|
+
color: color,
|
|
15
|
+
fontSize: fontSize
|
|
16
|
+
}">
|
|
17
|
+
<slot>
|
|
18
|
+
<el-icon>
|
|
19
|
+
<component :is="icon" />
|
|
20
|
+
</el-icon>
|
|
21
|
+
</slot>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup lang="ts">
|
|
26
|
+
import { validateType } from "@/tools/theme"
|
|
27
|
+
defineProps({
|
|
28
|
+
type: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "default",
|
|
31
|
+
validator: validateType
|
|
32
|
+
},
|
|
33
|
+
rotate: Boolean,
|
|
34
|
+
disabled: Boolean,
|
|
35
|
+
active: Boolean,
|
|
36
|
+
icon: String,
|
|
37
|
+
size: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "32px"
|
|
40
|
+
},
|
|
41
|
+
backgroundColor: String,
|
|
42
|
+
color: String,
|
|
43
|
+
fontSize: String
|
|
44
|
+
})
|
|
45
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
type: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
default: string;
|
|
5
|
+
validator: (value: string) => boolean;
|
|
6
|
+
};
|
|
7
|
+
rotate: BooleanConstructor;
|
|
8
|
+
disabled: BooleanConstructor;
|
|
9
|
+
active: BooleanConstructor;
|
|
10
|
+
icon: StringConstructor;
|
|
11
|
+
size: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
default: string;
|
|
14
|
+
};
|
|
15
|
+
backgroundColor: StringConstructor;
|
|
16
|
+
color: StringConstructor;
|
|
17
|
+
fontSize: StringConstructor;
|
|
18
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
19
|
+
type: {
|
|
20
|
+
type: StringConstructor;
|
|
21
|
+
default: string;
|
|
22
|
+
validator: (value: string) => boolean;
|
|
23
|
+
};
|
|
24
|
+
rotate: BooleanConstructor;
|
|
25
|
+
disabled: BooleanConstructor;
|
|
26
|
+
active: BooleanConstructor;
|
|
27
|
+
icon: StringConstructor;
|
|
28
|
+
size: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
backgroundColor: StringConstructor;
|
|
33
|
+
color: StringConstructor;
|
|
34
|
+
fontSize: StringConstructor;
|
|
35
|
+
}>>, {
|
|
36
|
+
type: string;
|
|
37
|
+
disabled: boolean;
|
|
38
|
+
size: string;
|
|
39
|
+
active: boolean;
|
|
40
|
+
rotate: boolean;
|
|
41
|
+
}>;
|
|
42
|
+
export default _default;
|