@opentiny/vue-renderless 3.13.2 → 3.14.1
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/action-sheet/index.js +20 -13
- package/action-sheet/vue.js +8 -7
- package/amount/index.js +100 -25
- package/amount/vue.js +102 -26
- package/anchor/index.js +1 -0
- package/area/index.js +8 -8
- package/area/vue.js +5 -5
- package/async-flowchart/index.js +16 -3
- package/autocomplete/index.js +58 -14
- package/autocomplete/vue.js +40 -12
- package/badge/index.js +12 -0
- package/badge/vue.js +6 -4
- package/breadcrumb/vue.js +3 -1
- package/breadcrumb-item/vue.js +6 -2
- package/button/index.js +5 -1
- package/calendar/index.js +2 -86
- package/calendar-bar/index.js +18 -4
- package/calendar-view/index.js +5 -1
- package/calendar-view/vue.js +16 -3
- package/card-group/vue.js +4 -2
- package/cascader/index.js +86 -34
- package/cascader/vue.js +61 -20
- package/cascader-menu/index.js +7 -7
- package/cascader-menu/vue.js +2 -3
- package/cascader-mobile/index.js +36 -23
- package/cascader-mobile/vue.js +6 -0
- package/cascader-node/index.js +13 -1
- package/cascader-node/vue.js +15 -4
- package/cascader-panel/index.js +1 -1
- package/cascader-select/column-index.js +150 -0
- package/cascader-select/column.js +120 -0
- package/cascader-select/index.js +29 -165
- package/cascader-select/usePicker.js +251 -0
- package/cascader-select/useTouch.js +65 -0
- package/cascader-select/vue.js +35 -47
- package/cell/vue.js +2 -1
- package/chart-bar/index.js +2 -3
- package/chart-core/deps/constants.js +43 -43
- package/chart-core/index.js +1 -1
- package/chart-gauge/index.js +2 -2
- package/chart-heatmap/index.js +17 -10
- package/chart-line/index.js +8 -9
- package/chart-tree/index.js +2 -2
- package/chart-waterfall/index.js +4 -6
- package/checkbox/index.js +18 -1
- package/checkbox/vue.js +15 -7
- package/checkbox-group/vue.js +1 -0
- package/col/vue.js +1 -1
- package/collapse/index.js +3 -3
- package/color-select-panel/vue.js +0 -7
- package/column-list-item/index.js +17 -1
- package/column-list-item/vue.js +8 -3
- package/common/bigInt.js +2 -2
- package/common/date.js +7 -5
- package/common/deps/clickoutside.js +6 -2
- package/common/deps/date-util.js +4 -2
- package/common/deps/dom.js +19 -4
- package/common/deps/popper.js +44 -11
- package/common/deps/resize-event.js +1 -0
- package/common/deps/touch-emulator.js +4 -1
- package/common/deps/tree-model/node.js +2 -2
- package/common/deps/tree-model/tree-store.js +2 -13
- package/common/deps/useRect.js +25 -0
- package/common/deps/vue-popper.js +38 -20
- package/common/index.js +2 -2
- package/common/runtime.js +1 -1
- package/common/string.js +2 -2
- package/common/type.js +2 -1
- package/common/validate/rules/enum.js +1 -1
- package/common/validate/rules/pattern.js +2 -2
- package/common/validate/rules/range.js +8 -5
- package/common/validate/rules/required.js +1 -1
- package/common/validate/rules/type.js +5 -5
- package/common/validate/rules/whitespace.js +1 -1
- package/common/validate/util.js +15 -16
- package/common/validate/validations/integer.js +1 -1
- package/common/validate/validations/method.js +1 -1
- package/currency/index.js +74 -7
- package/currency/vue.js +21 -5
- package/date-panel/index.js +16 -0
- package/date-panel/vue.js +8 -2
- package/date-picker-mobile/index.js +12 -0
- package/date-picker-mobile/vue.js +7 -1
- package/date-range/vue.js +15 -6
- package/date-table/index.js +35 -53
- package/date-table/vue.js +4 -2
- package/dialog-box/index.js +46 -14
- package/dialog-box/vue.js +30 -7
- package/dialog-select/index.js +6 -3
- package/dialog-select/vue.js +8 -4
- package/drawer/index.js +27 -5
- package/drawer/vue.js +14 -7
- package/dropdown/index.js +7 -7
- package/dropdown/vue.js +6 -2
- package/dropdown-item/index.js +9 -1
- package/dropdown-item/mf.js +6 -10
- package/dropdown-item/vue.js +20 -7
- package/dropdown-menu/index.js +20 -7
- package/dropdown-menu/vue.js +4 -3
- package/exception/index.js +2 -7
- package/exception/vue.js +7 -10
- package/fall-menu/index.js +5 -1
- package/fall-menu/vue.js +13 -2
- package/file-upload/index.js +68 -18
- package/file-upload/vue.js +38 -8
- package/filter-box/index.js +1 -0
- package/float-button/index.js +42 -0
- package/float-button/vue.js +101 -0
- package/floating-button/index.js +62 -16
- package/floating-button/vue.js +27 -9
- package/flowchart/index.js +134 -25
- package/flowchart/node.js +13 -4
- package/flowchart/vue.js +16 -4
- package/form/vue.js +8 -0
- package/form-item/index.js +5 -5
- package/form-item/vue.js +3 -1
- package/fullscreen/index.js +5 -5
- package/fullscreen/vue.js +3 -3
- package/grid/plugins/export.js +5 -2
- package/grid/utils/column.js +1 -0
- package/grid/utils/dom.js +7 -1
- package/image/index.js +6 -1
- package/image/vue.js +6 -3
- package/image-viewer/index.js +62 -51
- package/image-viewer/vue.js +17 -5
- package/input/index.js +81 -20
- package/input/vue.js +44 -18
- package/ip-address/index.js +61 -19
- package/ip-address/vue.js +22 -4
- package/link/vue.js +3 -1
- package/loading/index.js +2 -2
- package/loading/vue.js +8 -2
- package/logout/index.js +1 -1
- package/menu/index.js +15 -2
- package/menu/vue.js +22 -17
- package/mind-map/index.js +47 -0
- package/mind-map/vue.js +53 -0
- package/modal/index.js +44 -4
- package/modal/vue.js +18 -4
- package/multi-select/index.js +186 -11
- package/multi-select/vue.js +60 -15
- package/multi-select-item/index.js +23 -0
- package/multi-select-item/vue.js +31 -0
- package/numeric/index.js +48 -12
- package/numeric/vue.js +44 -19
- package/option/index.js +27 -9
- package/option/vue.js +37 -21
- package/option-group/index.js +3 -3
- package/package.json +1 -1
- package/pager/index.js +18 -4
- package/pager/vue.js +16 -5
- package/picker/index.js +290 -77
- package/picker/mb.js +42 -0
- package/picker/vue.js +76 -20
- package/picker-column/index.js +1 -1
- package/pop-upload/vue.js +3 -0
- package/popconfirm/index.js +3 -6
- package/popconfirm/vue.js +1 -1
- package/popeditor/index.js +73 -34
- package/popeditor/vue.js +15 -11
- package/popover/index.js +4 -4
- package/popover/vue.js +6 -6
- package/popup/index.js +3 -3
- package/popup/vue.js +5 -5
- package/pull-refresh/index.js +13 -13
- package/pull-refresh/vue.js +5 -4
- package/radio/index.js +0 -17
- package/radio/vue.js +4 -10
- package/rate/index.js +1 -1
- package/rate/vue.js +0 -2
- package/record/index.js +4 -1
- package/rich-text/clipboard.js +54 -0
- package/rich-text/index.js +192 -0
- package/rich-text/module/file-upload.js +107 -0
- package/rich-text/module/image-drop.js +63 -0
- package/rich-text/module/image-upload.js +89 -0
- package/rich-text/options.js +141 -0
- package/rich-text/table-module.js +382 -0
- package/rich-text/vue.js +102 -0
- package/{rich-text-edtior → rich-text-editor}/index.js +2 -2
- package/{rich-text-edtior → rich-text-editor}/vue.js +2 -5
- package/scrollbar/index.js +11 -11
- package/scrollbar/vue-bar.js +3 -3
- package/scrollbar/vue.js +5 -5
- package/search/index.js +9 -9
- package/search/vue.js +8 -6
- package/select/index.js +442 -393
- package/select/vue.js +278 -164
- package/select-dropdown/index.js +61 -3
- package/select-dropdown/vue.js +85 -8
- package/select-view/index.js +3 -1
- package/selected-box/index.js +2 -0
- package/selected-box/vue.js +6 -3
- package/signature/index.js +241 -0
- package/signature/vue.js +88 -0
- package/skeleton/index.js +14 -0
- package/skeleton/vue.js +15 -0
- package/skeleton-item/vue.js +15 -0
- package/slider/index.js +70 -17
- package/slider/vue.js +16 -7
- package/split/index.js +5 -3
- package/split/vue.js +4 -6
- package/standard-list-item/index.js +15 -1
- package/standard-list-item/vue.js +6 -5
- package/steps/index.js +25 -2
- package/steps/slide-bar.js +8 -1
- package/steps/vue.js +15 -3
- package/tab-item-mf/vue.js +14 -8
- package/tab-nav/index.js +30 -5
- package/tab-nav/vue.js +16 -4
- package/tabbar/vue.js +9 -3
- package/tabbar-item/vue.js +3 -2
- package/tabs/index.js +16 -4
- package/tabs/vue.js +2 -1
- package/tabs-mf/index.js +20 -6
- package/tabs-mf/vue-nav.js +26 -11
- package/tabs-mf/vue.js +7 -7
- package/tabs-mf/wheel.js +1 -0
- package/tag/index.js +1 -1
- package/tag-group/index.js +2 -1
- package/time/index.js +5 -2
- package/time/vue.js +1 -1
- package/time-line/index.js +3 -3
- package/time-line/vue.js +2 -2
- package/time-picker-mobile/index.js +24 -5
- package/time-picker-mobile/vue.js +17 -7
- package/time-range/index.js +2 -0
- package/timeline-item/vue.js +1 -1
- package/tooltip/index.js +6 -3
- package/tooltip/vue.js +4 -4
- package/transfer/index.js +20 -22
- package/transfer/vue.js +1 -6
- package/transfer-panel/vue.js +3 -5
- package/tree/index.js +21 -4
- package/tree/vue.js +10 -8
- package/tree-menu/index.js +29 -3
- package/tree-menu/vue.js +28 -15
- package/tree-node/index.js +18 -18
- package/tree-node/vue.js +6 -5
- package/types/action-sheet.type.d.ts +118 -1
- package/types/amount.type.d.ts +168 -1
- package/types/area.type.d.ts +134 -1
- package/types/async-flowchart.type.d.ts +72 -0
- package/types/autocomplete.type.d.ts +199 -1
- package/types/badge.type.d.ts +3 -1
- package/types/breadcrumb-item.type.d.ts +2 -0
- package/types/breadcrumb.type.d.ts +2 -0
- package/types/button-group.type.d.ts +3 -3
- package/types/button.type.d.ts +4 -0
- package/types/cascader-menu.type.d.ts +3 -4
- package/types/cascader-node.type.d.ts +5 -2
- package/types/cascader-panel.type-2bd03be3.d.ts +241 -0
- package/types/cascader-panel.type.d.ts +3 -241
- package/types/cascader.type.d.ts +329 -1
- package/types/checkbox.type.d.ts +6 -0
- package/types/collapse.type.d.ts +19 -2
- package/types/date-picker.type.d.ts +38 -1
- package/types/dialog-box.type.d.ts +13 -3
- package/types/drawer.type.d.ts +133 -1
- package/types/{dropdown-item.type-8ea6c633.d.ts → dropdown-item.type-8475a549.d.ts} +7 -13
- package/types/dropdown-item.type.d.ts +1 -1
- package/types/dropdown-menu.type.d.ts +1 -1
- package/types/dropdown.type.d.ts +1 -5
- package/types/fall-menu.type.d.ts +94 -1
- package/types/file-upload.type.d.ts +1 -1
- package/types/float-button.type.d.ts +123 -0
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-d0fd42f3.d.ts → form.type-a2dc0099.d.ts} +4 -1
- package/types/form.type.d.ts +1 -1
- package/types/{index-e0250f63.d.ts → index-b012f687.d.ts} +9 -0
- package/types/input.type.d.ts +2 -6
- package/types/ip-address.type.d.ts +160 -1
- package/types/link.type.d.ts +6 -3
- package/types/loading.type.d.ts +7 -0
- package/types/mind-map.type.d.ts +20 -0
- package/types/modal.type.d.ts +29 -2
- package/types/numeric.type.d.ts +41 -10
- package/types/pager.type.d.ts +12 -0
- package/types/picker.type.d.ts +18 -0
- package/types/popconfirm.type.d.ts +86 -1
- package/types/popeditor.type.d.ts +4 -0
- package/types/popover.type.d.ts +3 -3
- package/types/progress.type.d.ts +2 -0
- package/types/radio.type.d.ts +0 -4
- package/types/rate.type.d.ts +236 -1
- package/types/search.type.d.ts +88 -1
- package/types/shared.type.d.ts +1 -1
- package/types/skeleton-item.type.d.ts +38 -0
- package/types/skeleton.type.d.ts +45 -0
- package/types/slider.type.d.ts +49 -10
- package/types/steps.type.d.ts +14 -3
- package/types/tab-bar.type.d.ts +1 -1
- package/types/tab-nav.type.d.ts +7 -2
- package/types/tabs.type.d.ts +9 -1
- package/types/tag-group.type.d.ts +64 -1
- package/types/{time-line.type-d7daa669.d.ts → time-line.type-b155cb4f.d.ts} +12 -0
- package/types/time-line.type.d.ts +1 -1
- package/types/timeline-item.type.d.ts +1 -1
- package/types/tooltip.type.d.ts +2 -2
- package/types/transfer.type.d.ts +185 -1
- package/types/tree-menu.type.d.ts +210 -1
- package/types/upload-dragger.type.d.ts +1 -1
- package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-6d6e3d0e.d.ts} +35 -8
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/types/user-head.type.d.ts +146 -1
- package/types/wizard.type.d.ts +1 -0
- package/upload/index.js +64 -34
- package/upload/vue.js +9 -5
- package/upload-dragger/index.js +22 -20
- package/upload-list/index.js +24 -18
- package/upload-list/vue.js +9 -4
- package/user/index.js +35 -26
- package/user/vue.js +1 -1
- package/user-head/index.js +3 -3
- package/watermark/index.js +11 -0
- package/wheel/index.js +3 -0
- package/wizard/vue.js +4 -2
- package/common/deps/modal-queue.js +0 -6
- package/common/deps/requestAnimationFrame.js +0 -25
package/file-upload/vue.js
CHANGED
|
@@ -71,7 +71,9 @@ import {
|
|
|
71
71
|
computedSourcetype,
|
|
72
72
|
getFileSourceType,
|
|
73
73
|
encryptDialogConfirm,
|
|
74
|
-
handleTriggerClick
|
|
74
|
+
handleTriggerClick,
|
|
75
|
+
closeRecordPanel,
|
|
76
|
+
getTipMessage
|
|
75
77
|
} from "./index";
|
|
76
78
|
import { isEmptyObject } from "../common/type";
|
|
77
79
|
const api = [
|
|
@@ -99,10 +101,24 @@ const api = [
|
|
|
99
101
|
"abortDownload",
|
|
100
102
|
"handleClickFileList",
|
|
101
103
|
"handleTriggerClick",
|
|
104
|
+
"closeRecordPanel",
|
|
102
105
|
"encryptDialogConfirm",
|
|
103
|
-
"formatFileSize"
|
|
106
|
+
"formatFileSize",
|
|
107
|
+
"getTipMessage"
|
|
104
108
|
];
|
|
105
|
-
const initState = ({
|
|
109
|
+
const initState = ({
|
|
110
|
+
api: api2,
|
|
111
|
+
reactive,
|
|
112
|
+
computed,
|
|
113
|
+
inject,
|
|
114
|
+
ref,
|
|
115
|
+
vm,
|
|
116
|
+
props,
|
|
117
|
+
httpRequest,
|
|
118
|
+
service,
|
|
119
|
+
useBreakpoint
|
|
120
|
+
}) => {
|
|
121
|
+
const { current } = useBreakpoint();
|
|
106
122
|
const state = reactive({
|
|
107
123
|
url: "",
|
|
108
124
|
updateId: "",
|
|
@@ -165,7 +181,8 @@ const initState = ({ api: api2, reactive, computed, inject, ref, vm, props, http
|
|
|
165
181
|
encryptDialogConfig: {
|
|
166
182
|
show: false,
|
|
167
183
|
selectFileMethod: null
|
|
168
|
-
}
|
|
184
|
+
},
|
|
185
|
+
current
|
|
169
186
|
});
|
|
170
187
|
return state;
|
|
171
188
|
};
|
|
@@ -185,7 +202,7 @@ const initApi = ({ api: api2, state, props, constants, vm, $service, t, Modal })
|
|
|
185
202
|
computedUploadingSize: computedUploadingSize({ state, constants }),
|
|
186
203
|
getFileUploadUrl: getFileUploadUrl($service),
|
|
187
204
|
getToken: getToken({ constants, props, state, t, Modal }),
|
|
188
|
-
getDialogConfigObj: getDialogConfigObj({ props, state }),
|
|
205
|
+
getDialogConfigObj: getDialogConfigObj({ props, state, t, constants }),
|
|
189
206
|
computeDocChunkSize: computeDocChunkSize({ props, state, constants }),
|
|
190
207
|
updateFile: updateFile({ constants, vm }),
|
|
191
208
|
getPreviewUrlSync: getPreviewUrlSync({ constants, props, state }),
|
|
@@ -203,6 +220,7 @@ const initApi = ({ api: api2, state, props, constants, vm, $service, t, Modal })
|
|
|
203
220
|
computedSourcetype: computedSourcetype({ props, constants }),
|
|
204
221
|
getFileSourceType: getFileSourceType({ state, props, constants }),
|
|
205
222
|
encryptDialogConfirm: encryptDialogConfirm({ state }),
|
|
223
|
+
getTipMessage: getTipMessage({ t, api: api2, constants }),
|
|
206
224
|
formatFileSize
|
|
207
225
|
});
|
|
208
226
|
};
|
|
@@ -246,7 +264,8 @@ const mergeApi = ({ api: api2, props, $service, state, constants, emit, mode, Mo
|
|
|
246
264
|
validateDownloadStatus: validateDownloadStatus({ state, Modal }),
|
|
247
265
|
handleChange: handleChange({ vm, constants }),
|
|
248
266
|
handleClickFileList: handleClickFileList({ state, emit }),
|
|
249
|
-
handleTriggerClick: handleTriggerClick({ vm, state, constants, props, emit })
|
|
267
|
+
handleTriggerClick: handleTriggerClick({ vm, state, constants, props, emit }),
|
|
268
|
+
closeRecordPanel: closeRecordPanel({ vm, constants, state, props })
|
|
250
269
|
});
|
|
251
270
|
};
|
|
252
271
|
const initWatch = ({ watch, state, api: api2, props, $service }) => {
|
|
@@ -278,11 +297,22 @@ const initWatch = ({ watch, state, api: api2, props, $service }) => {
|
|
|
278
297
|
watch(() => props.edm, api2.computeDocChunkSize, { deep: true, immediate: true });
|
|
279
298
|
};
|
|
280
299
|
let getApi = () => ({});
|
|
281
|
-
const renderless = (props, { computed, inject, onBeforeUnmount, provide, reactive, ref, watch, onMounted }, { t, vm, parent, emit, service, mode, constants }, { Modal, CryptoJS, Streamsaver }) => {
|
|
300
|
+
const renderless = (props, { computed, inject, onBeforeUnmount, provide, reactive, ref, watch, onMounted }, { t, vm, parent, emit, service, mode, constants, useBreakpoint }, { Modal, CryptoJS, Streamsaver }) => {
|
|
282
301
|
let api2 = {};
|
|
283
302
|
const $service = initService({ props, service });
|
|
284
303
|
const httpRequest = $service.httpRequest;
|
|
285
|
-
const state = initState({
|
|
304
|
+
const state = initState({
|
|
305
|
+
reactive,
|
|
306
|
+
computed,
|
|
307
|
+
api: api2,
|
|
308
|
+
inject,
|
|
309
|
+
ref,
|
|
310
|
+
vm,
|
|
311
|
+
props,
|
|
312
|
+
httpRequest,
|
|
313
|
+
service,
|
|
314
|
+
useBreakpoint
|
|
315
|
+
});
|
|
286
316
|
initApi({ api: api2, state, props, constants, vm, $service, t, Modal });
|
|
287
317
|
mergeApi({ api: api2, props, $service, state, constants, emit, mode, Modal, t, vm, CryptoJS, Streamsaver });
|
|
288
318
|
getApi = () => api2;
|
package/filter-box/index.js
CHANGED
|
@@ -3,6 +3,7 @@ const handleClear = ({ dispatch, emit }) => ($event) => {
|
|
|
3
3
|
dispatch("Picker", "handle-clear", $event);
|
|
4
4
|
dispatch("Select", "handle-clear", $event);
|
|
5
5
|
dispatch("Cascader", "handle-clear", $event);
|
|
6
|
+
dispatch("Amount", "handle-clear", $event);
|
|
6
7
|
emit("handle-clear");
|
|
7
8
|
};
|
|
8
9
|
const handeClick = ({ props, emit }) => ($event) => {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
const handleScroll = ({ props, state }) => {
|
|
3
|
+
if (props.element) {
|
|
4
|
+
const beforeHeight = props.element.scrollTop || document.documentElement.scrollTop || document.body.scrollTop;
|
|
5
|
+
if (beforeHeight <= props.visibilityHeight) {
|
|
6
|
+
state.show = false;
|
|
7
|
+
}
|
|
8
|
+
props.element.onscroll = function() {
|
|
9
|
+
state.show = true;
|
|
10
|
+
const height = props.element.scrollTop || document.documentElement.scrollTop || document.body.scrollTop;
|
|
11
|
+
if (height <= props.visibilityHeight) {
|
|
12
|
+
state.show = false;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const handleClick = ({ emit, props, state }) => (event) => {
|
|
18
|
+
var _a;
|
|
19
|
+
if (props.trigger === "click" && props.resetTime > 0 && !props.backTop) {
|
|
20
|
+
state.disabled = true;
|
|
21
|
+
state.open = !state.open;
|
|
22
|
+
state.timer = window.setTimeout(() => {
|
|
23
|
+
state.disabled = false;
|
|
24
|
+
}, props.resetTime);
|
|
25
|
+
}
|
|
26
|
+
if (!props.trigger && (props.href || props.target) && !props.backTop) {
|
|
27
|
+
window.open(props.href, props.target);
|
|
28
|
+
}
|
|
29
|
+
if (props.backTop) {
|
|
30
|
+
(_a = props.element) == null ? void 0 : _a.scrollTo({
|
|
31
|
+
top: 0,
|
|
32
|
+
behavior: "smooth"
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
emit("click", event);
|
|
36
|
+
};
|
|
37
|
+
const clearTimer = (state) => () => clearTimeout(state.timer);
|
|
38
|
+
export {
|
|
39
|
+
clearTimer,
|
|
40
|
+
handleClick,
|
|
41
|
+
handleScroll
|
|
42
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import { handleClick, clearTimer, handleScroll } from "./index";
|
|
3
|
+
const api = ["state", "handleClick"];
|
|
4
|
+
const watchVariable = ({ watch, props, state, nextTick, vm, emit }) => {
|
|
5
|
+
watch(
|
|
6
|
+
() => props.disabled,
|
|
7
|
+
(value) => {
|
|
8
|
+
state.disabled = value;
|
|
9
|
+
},
|
|
10
|
+
{ immediate: true }
|
|
11
|
+
);
|
|
12
|
+
watch(
|
|
13
|
+
() => props.open,
|
|
14
|
+
(value) => {
|
|
15
|
+
state.open = value;
|
|
16
|
+
},
|
|
17
|
+
{ immediate: true }
|
|
18
|
+
);
|
|
19
|
+
watch(
|
|
20
|
+
() => state.open,
|
|
21
|
+
(value) => {
|
|
22
|
+
if (value) {
|
|
23
|
+
let beforeRootDom = vm.$refs.tinyFloatButton;
|
|
24
|
+
let beforeRootDomStyle = (beforeRootDom == null ? void 0 : beforeRootDom.getClientRects()[0]) || 0;
|
|
25
|
+
nextTick(() => {
|
|
26
|
+
if (!beforeRootDomStyle) {
|
|
27
|
+
beforeRootDom = vm.$refs.tinyFloatButton;
|
|
28
|
+
beforeRootDomStyle = beforeRootDom.getClientRects()[0];
|
|
29
|
+
}
|
|
30
|
+
const dom = vm.$refs.tinyFloatButtonOpen;
|
|
31
|
+
const style = `left:0px;bottom:${beforeRootDomStyle.height + 4 + "px"};`;
|
|
32
|
+
dom == null ? void 0 : dom.setAttribute("style", style);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{ immediate: true }
|
|
37
|
+
);
|
|
38
|
+
watch(
|
|
39
|
+
() => props.trigger,
|
|
40
|
+
(value) => {
|
|
41
|
+
if (value === "hover" && !state.hasEvent) {
|
|
42
|
+
nextTick(() => {
|
|
43
|
+
const dom = vm.$refs.tinyFloatButton;
|
|
44
|
+
dom.addEventListener("mouseover", (event) => {
|
|
45
|
+
state.open = true;
|
|
46
|
+
emit("mouseover", event);
|
|
47
|
+
});
|
|
48
|
+
dom.addEventListener("mouseout", (event) => {
|
|
49
|
+
state.open = false;
|
|
50
|
+
emit("mouseout", event);
|
|
51
|
+
});
|
|
52
|
+
state.hasEvent = true;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{ immediate: true }
|
|
57
|
+
);
|
|
58
|
+
watch(
|
|
59
|
+
() => props.backTop,
|
|
60
|
+
(value) => {
|
|
61
|
+
if (value) {
|
|
62
|
+
handleScroll({ props, vm, state });
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{ immediate: true }
|
|
66
|
+
);
|
|
67
|
+
watch(
|
|
68
|
+
() => props.element,
|
|
69
|
+
() => {
|
|
70
|
+
if (props.backTop) {
|
|
71
|
+
handleScroll({ props, vm, state });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
const renderless = (props, { computed, onBeforeUnmount, reactive, watch, inject, nextTick }, { emit, parent, vm }) => {
|
|
77
|
+
parent.tinyForm = parent.tinyForm || inject("form", null);
|
|
78
|
+
const state = reactive({
|
|
79
|
+
timer: 0,
|
|
80
|
+
disabled: props.disabled,
|
|
81
|
+
open: props.open,
|
|
82
|
+
hasEvent: false,
|
|
83
|
+
show: true,
|
|
84
|
+
formDisabled: computed(() => (parent.tinyForm || {}).disabled),
|
|
85
|
+
buttonDisabled: computed(
|
|
86
|
+
() => props.disabled || state.disabled || (parent.buttonGroup || {}).disabled || state.formDisabled
|
|
87
|
+
)
|
|
88
|
+
});
|
|
89
|
+
watchVariable({ props, vm, watch, state, nextTick, emit });
|
|
90
|
+
const api2 = {
|
|
91
|
+
state,
|
|
92
|
+
clearTimer: clearTimer(state),
|
|
93
|
+
handleClick: handleClick({ emit, props, state })
|
|
94
|
+
};
|
|
95
|
+
onBeforeUnmount(api2.clearTimer);
|
|
96
|
+
return api2;
|
|
97
|
+
};
|
|
98
|
+
export {
|
|
99
|
+
api,
|
|
100
|
+
renderless
|
|
101
|
+
};
|
package/floating-button/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import { off, on } from "../common/deps/dom";
|
|
2
3
|
const getClientWidth = ({ state, vm }) => () => {
|
|
3
|
-
if (vm.$
|
|
4
|
-
state.centerSpace = (document.documentElement.clientWidth - vm.$
|
|
4
|
+
if (vm.$refs.floatingButton) {
|
|
5
|
+
state.centerSpace = (document.documentElement.clientWidth - vm.$refs.floatingButton.clientWidth) / 2;
|
|
5
6
|
}
|
|
6
7
|
};
|
|
7
|
-
const handleClick = ({ props, state, emit }) => (event) => {
|
|
8
|
+
const handleClick = ({ props, state, emit }) => (event, index) => {
|
|
8
9
|
if (state.disabled)
|
|
9
10
|
return;
|
|
10
11
|
if (props.resetTime > 0) {
|
|
@@ -13,33 +14,56 @@ const handleClick = ({ props, state, emit }) => (event) => {
|
|
|
13
14
|
state.disabled = false;
|
|
14
15
|
}, props.resetTime);
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
+
if (state.isExpand) {
|
|
18
|
+
state.isExpand = !state.isExpand;
|
|
19
|
+
} else if (props.isExpand) {
|
|
20
|
+
state.isExpand = true;
|
|
21
|
+
}
|
|
22
|
+
emit("click", event, index);
|
|
17
23
|
};
|
|
18
|
-
const clearTimer = (state) => () =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
window
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
const clearTimer = ({ state, api }) => () => {
|
|
25
|
+
clearTimeout(state.initTimer);
|
|
26
|
+
off(window, "resize", api.getClientWidth);
|
|
27
|
+
off(window, "scroll", api.onScroll);
|
|
28
|
+
off(window, "scroll", api.getScrollListener);
|
|
29
|
+
};
|
|
30
|
+
const getScrollListener = ({ vm, props, state }) => () => {
|
|
31
|
+
const scrollElement = props.elementSelector ? state.scrollElement : window;
|
|
32
|
+
const screenHeight = props.elementSelector ? state.elementHeight : state.screenHeight;
|
|
33
|
+
clearTimeout(state.stayTime);
|
|
34
|
+
const scrollTop = props.elementSelector ? scrollElement.scrollTop : document.documentElement.scrollTop || document.body.scrollTop;
|
|
35
|
+
if (vm.$refs.floatingButton) {
|
|
25
36
|
if (props.animated && scrollTop > screenHeight / 2) {
|
|
26
|
-
state.commHiddenSpace = vm.$
|
|
37
|
+
state.commHiddenSpace = vm.$refs.floatingButton.clientWidth * 0.7;
|
|
27
38
|
state.centerSpace = -state.commHiddenSpace;
|
|
28
|
-
state.specialHiddenSpace =
|
|
39
|
+
state.specialHiddenSpace = -vm.$refs.floatingButton.clientWidth * 0.7;
|
|
29
40
|
state.stayTime = setTimeout(function() {
|
|
30
41
|
if (scrollTop === state.lastScrollTop) {
|
|
31
|
-
state.centerSpace = (document.documentElement.clientWidth - vm.$
|
|
42
|
+
state.centerSpace = (document.documentElement.clientWidth - vm.$refs.floatingButton.clientWidth) / 2;
|
|
32
43
|
state.commHiddenSpace = "";
|
|
33
44
|
state.specialHiddenSpace = "";
|
|
34
45
|
}
|
|
35
46
|
}, 1e3);
|
|
36
47
|
state.lastScrollTop = scrollTop;
|
|
37
48
|
} else {
|
|
38
|
-
state.centerSpace = (document.documentElement.clientWidth - vm.$
|
|
49
|
+
state.centerSpace = (document.documentElement.clientWidth - vm.$refs.floatingButton.clientWidth) / 2;
|
|
39
50
|
state.commHiddenSpace = "";
|
|
40
51
|
state.specialHiddenSpace = "";
|
|
41
52
|
}
|
|
42
|
-
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const useTouchEvent = ({ state, props, nextTick, api }) => () => {
|
|
56
|
+
state.scrolling = false;
|
|
57
|
+
if (props.elementSelector) {
|
|
58
|
+
nextTick(() => {
|
|
59
|
+
state.scrollElement = document.querySelector(props.elementSelector);
|
|
60
|
+
state.elementHeight = state.scrollElement.scrollHeight;
|
|
61
|
+
state.scrollElement.addEventListener("scroll", api.getScrollListener);
|
|
62
|
+
});
|
|
63
|
+
} else {
|
|
64
|
+
state.screenHeight = window.innerHeight;
|
|
65
|
+
window.addEventListener("scroll", api.getScrollListener);
|
|
66
|
+
}
|
|
43
67
|
};
|
|
44
68
|
const onScroll = ({ state, api }) => () => {
|
|
45
69
|
if (state.scrolling) {
|
|
@@ -63,11 +87,33 @@ const computedStyle = ({ props, state }) => () => {
|
|
|
63
87
|
}
|
|
64
88
|
return styleObj;
|
|
65
89
|
};
|
|
90
|
+
const getExpandList = ({ props, state }) => () => {
|
|
91
|
+
if (props.expandList && props.expandList.length > 0) {
|
|
92
|
+
const expandList = props.expandList.map((item) => {
|
|
93
|
+
item.title = item.title.slice(0, 4);
|
|
94
|
+
return item;
|
|
95
|
+
});
|
|
96
|
+
if (props.expandList.length > 3) {
|
|
97
|
+
state.expandList = expandList.slice(0, 3);
|
|
98
|
+
} else {
|
|
99
|
+
state.expandList = expandList;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const mounted = (api) => () => {
|
|
104
|
+
api.getClientWidth();
|
|
105
|
+
api.onScroll();
|
|
106
|
+
api.getExpandList();
|
|
107
|
+
on(window, "resize", api.getClientWidth);
|
|
108
|
+
};
|
|
66
109
|
export {
|
|
67
110
|
clearTimer,
|
|
68
111
|
computedStyle,
|
|
69
112
|
getClientWidth,
|
|
113
|
+
getExpandList,
|
|
114
|
+
getScrollListener,
|
|
70
115
|
handleClick,
|
|
116
|
+
mounted,
|
|
71
117
|
onScroll,
|
|
72
118
|
useTouchEvent
|
|
73
119
|
};
|
package/floating-button/vue.js
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getClientWidth,
|
|
4
|
+
handleClick,
|
|
5
|
+
clearTimer,
|
|
6
|
+
useTouchEvent,
|
|
7
|
+
onScroll,
|
|
8
|
+
computedStyle,
|
|
9
|
+
getExpandList,
|
|
10
|
+
mounted,
|
|
11
|
+
getScrollListener
|
|
12
|
+
} from "./index";
|
|
3
13
|
const api = ["state", "handleClick"];
|
|
4
|
-
const renderless = (props, { computed, reactive, onMounted, onBeforeUnmount }, { vm, emit }) => {
|
|
14
|
+
const renderless = (props, { computed, reactive, onMounted, onBeforeUnmount, watch }, { vm, emit, nextTick }) => {
|
|
5
15
|
const state = reactive({
|
|
6
16
|
centerSpace: 0,
|
|
7
17
|
disabled: false,
|
|
@@ -11,22 +21,30 @@ const renderless = (props, { computed, reactive, onMounted, onBeforeUnmount }, {
|
|
|
11
21
|
specialHiddenSpace: "",
|
|
12
22
|
stayTime: null,
|
|
13
23
|
lastScrollTop: 0,
|
|
14
|
-
style: computed(() => api2.computedStyle())
|
|
24
|
+
style: computed(() => api2.computedStyle()),
|
|
25
|
+
expandList: null,
|
|
26
|
+
itemTitle: "",
|
|
27
|
+
isExpand: false,
|
|
28
|
+
scrollElement: "",
|
|
29
|
+
elementHeight: 0,
|
|
30
|
+
screenHeight: 0
|
|
15
31
|
});
|
|
16
32
|
const api2 = {};
|
|
17
33
|
Object.assign(api2, {
|
|
18
34
|
state,
|
|
19
35
|
getClientWidth: getClientWidth({ state, vm }),
|
|
20
36
|
handleClick: handleClick({ props, state, emit }),
|
|
21
|
-
clearTimer: clearTimer(state),
|
|
22
|
-
useTouchEvent: useTouchEvent({ state,
|
|
37
|
+
clearTimer: clearTimer({ state, api: api2 }),
|
|
38
|
+
useTouchEvent: useTouchEvent({ state, props, nextTick, api: api2 }),
|
|
23
39
|
onScroll: onScroll({ state, api: api2 }),
|
|
24
|
-
computedStyle: computedStyle({ props, state })
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
computedStyle: computedStyle({ props, state }),
|
|
41
|
+
getExpandList: getExpandList({ state, props }),
|
|
42
|
+
mounted: mounted(api2),
|
|
43
|
+
getScrollListener: getScrollListener({ vm, props, state })
|
|
28
44
|
});
|
|
45
|
+
onMounted(api2.mounted);
|
|
29
46
|
onBeforeUnmount(api2.clearTimer);
|
|
47
|
+
watch(() => props.expandList, api2.getExpandList);
|
|
30
48
|
return api2;
|
|
31
49
|
};
|
|
32
50
|
export {
|