@opentiny/vue-renderless 3.12.0 → 3.13.0-alpha.0
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/alert/index.js +50 -1
- package/alert/vue.js +36 -9
- 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 +20 -6
- package/calendar-view/index.js +10 -12
- package/calendar-view/vue.js +17 -4
- package/cascader/index.js +80 -34
- package/cascader/vue.js +49 -19
- package/cascader-menu/index.js +7 -7
- package/cascader-menu/vue.js +2 -3
- package/cascader-mobile/index.js +37 -24
- package/cascader-mobile/vue.js +7 -1
- 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/cascader-view/index.js +1 -1
- 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 +17 -0
- package/checkbox/vue.js +16 -7
- package/checkbox-group/vue.js +2 -0
- package/col/index.js +7 -2
- 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/date.js +2 -0
- package/common/deps/dom.js +19 -4
- package/common/deps/popper.js +48 -5
- package/common/deps/touch-emulator.js +4 -1
- package/common/deps/tree-model/node.js +1 -1
- package/common/deps/tree-model/tree-store.js +2 -13
- package/common/deps/useRect.js +25 -0
- package/common/deps/vue-popper.js +22 -10
- package/common/index.js +1 -1
- package/common/runtime.js +1 -1
- 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/container/index.js +17 -1
- package/container/vue.js +12 -3
- 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 +12 -5
- package/date-table/index.js +5 -0
- package/date-table/vue.js +3 -1
- package/dialog-box/index.js +17 -6
- package/dialog-select/index.js +6 -3
- package/dialog-select/vue.js +8 -4
- package/drawer/index.js +26 -5
- package/drawer/vue.js +13 -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 +21 -8
- 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 +47 -12
- package/file-upload/vue.js +38 -8
- package/filter-box/index.js +1 -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 +3 -1
- package/form-item/index.js +4 -4
- package/form-item/vue.js +3 -1
- package/fullscreen/index.js +5 -5
- package/fullscreen/vue.js +3 -3
- package/grid/utils/common.js +10 -5
- package/grid/utils/dom.js +7 -1
- package/image/index.js +6 -0
- package/image/vue.js +6 -3
- package/image-viewer/index.js +62 -51
- package/image-viewer/vue.js +17 -5
- package/input/index.js +89 -22
- package/input/vue.js +52 -21
- package/ip-address/index.js +61 -19
- package/ip-address/vue.js +22 -4
- package/label/index.js +56 -0
- package/label/vue.js +26 -0
- package/link/vue.js +3 -1
- package/loading/vue.js +8 -2
- package/logout/index.js +1 -1
- package/mask/index.js +13 -0
- package/mask/vue.js +18 -0
- package/mind-map/index.js +47 -0
- package/mind-map/vue.js +53 -0
- package/multi-select/index.js +150 -10
- package/multi-select/vue.js +46 -11
- package/multi-select-item/index.js +17 -0
- package/multi-select-item/vue.js +31 -0
- package/numeric/index.js +51 -9
- package/numeric/vue.js +44 -14
- package/option/index.js +12 -5
- package/option/vue.js +15 -7
- package/option-group/index.js +3 -3
- package/package.json +1 -1
- package/pager/index.js +372 -0
- package/pager/vue.js +125 -2
- package/picker/index.js +253 -48
- package/picker/mb.js +42 -0
- package/picker/vue.js +70 -17
- package/picker-column/index.js +1 -1
- package/pop-upload/index.js +0 -2
- package/pop-upload/vue.js +3 -4
- package/popconfirm/index.js +3 -6
- package/popconfirm/vue.js +1 -1
- package/popeditor/index.js +55 -24
- 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 +57 -65
- package/pull-refresh/vue.js +23 -7
- 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-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 +1 -1
- package/search/vue.js +3 -1
- package/select/index.js +185 -113
- package/select/vue.js +105 -20
- package/select-dropdown/index.js +62 -4
- package/select-dropdown/vue.js +85 -8
- package/select-view/index.js +3 -1
- 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 +27 -7
- package/slider/vue.js +26 -7
- package/split/index.js +1 -1
- 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 +9 -4
- package/tab-nav/vue.js +6 -2
- package/tabbar/vue.js +9 -3
- package/tabbar-item/vue.js +3 -2
- package/tabs/index.js +1 -1
- package/tabs/vue.js +1 -0
- package/tabs-mf/index.js +20 -6
- package/tabs-mf/vue-nav.js +26 -11
- package/tabs-mf/vue.js +7 -7
- package/tag/index.js +1 -1
- package/tag/vue.js +5 -1
- package/tag-group/index.js +2 -1
- package/tall-storage/index.js +4 -5
- package/time/index.js +4 -1
- package/time/vue.js +1 -1
- package/time-line/vue.js +1 -1
- package/time-picker-mobile/index.js +24 -5
- package/time-picker-mobile/vue.js +17 -7
- package/time-range/index.js +2 -0
- package/time-spinner/index.js +0 -3
- package/time-spinner/vue.js +2 -3
- package/timeline-item/vue.js +1 -1
- package/tooltip/index.js +1 -2
- package/tooltip/vue.js +3 -3
- 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 +27 -3
- package/tree-menu/vue.js +27 -14
- package/tree-node/index.js +12 -10
- package/tree-node/vue.js +6 -5
- package/types/action-menu.type.d.ts +5 -0
- package/types/action-sheet.type.d.ts +118 -1
- package/types/alert.type.d.ts +16 -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.type.d.ts +5 -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 +327 -1
- package/types/checkbox.type.d.ts +9 -0
- package/types/collapse.type.d.ts +19 -2
- package/types/date-picker.type.d.ts +33 -0
- package/types/dialog-box.type.d.ts +5 -1
- package/types/drawer.type.d.ts +132 -1
- package/types/{dropdown-item.type-bf83e929.d.ts → dropdown-item.type-8475a549.d.ts} +8 -14
- package/types/dropdown-item.type.d.ts +1 -1
- package/types/dropdown-menu.type.d.ts +1 -1
- package/types/dropdown.type.d.ts +2 -5
- package/types/fall-menu.type.d.ts +94 -1
- package/types/file-upload.type.d.ts +1 -1
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-d0fd42f3.d.ts → form.type-d88482e4.d.ts} +3 -0
- package/types/form.type.d.ts +1 -1
- package/types/input.type.d.ts +23 -9
- package/types/ip-address.type.d.ts +160 -1
- package/types/label.type.d.ts +81 -0
- package/types/link.type.d.ts +6 -3
- package/types/mind-map.type.d.ts +20 -0
- package/types/modal.type.d.ts +4 -2
- package/types/numeric.type.d.ts +36 -9
- package/types/pager.type.d.ts +171 -1
- package/types/picker.type.d.ts +14 -0
- package/types/popconfirm.type.d.ts +85 -1
- package/types/popeditor.type.d.ts +4 -0
- package/types/popover.type.d.ts +3 -3
- 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 +8 -1
- package/types/steps.type.d.ts +14 -3
- package/types/tab-item.type.d.ts +0 -1
- package/types/tab-nav.type.d.ts +6 -1
- package/types/tabs.type.d.ts +5 -0
- package/types/tag-group.type.d.ts +64 -1
- package/types/tag.type.d.ts +12 -0
- package/types/tooltip.type.d.ts +1 -1
- package/types/transfer.type.d.ts +183 -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-1078fba2.d.ts} +27 -6
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/types/wizard.type.d.ts +1 -0
- package/upload/index.js +59 -29
- package/upload/vue.js +6 -4
- package/upload-list/index.js +14 -14
- package/upload-list/vue.js +5 -2
- package/user/index.js +5 -4
- package/user-head/index.js +1 -1
- package/wheel/index.js +3 -0
- package/wizard/vue.js +4 -2
package/dropdown-item/mf.js
CHANGED
|
@@ -3,12 +3,11 @@ import { omitText } from "../common/string";
|
|
|
3
3
|
const api = ["dataStore", "handleClick", "dataStore", "mouseEnter", "mouseLeave"];
|
|
4
4
|
const renderless = (props, { reactive, inject }, { dispatch, vm }) => {
|
|
5
5
|
const api2 = {};
|
|
6
|
-
const dropdownMenuVm = inject("dropdownMenuVm");
|
|
7
|
-
const multiStage = inject("multiStage");
|
|
6
|
+
const dropdownMenuVm = inject("dropdownMenuVm", null);
|
|
8
7
|
let dataStore = reactive({
|
|
9
|
-
checkedStatus: dropdownMenuVm.checkedStatus,
|
|
8
|
+
checkedStatus: dropdownMenuVm == null ? void 0 : dropdownMenuVm.checkedStatus,
|
|
10
9
|
multiStageMenu: "",
|
|
11
|
-
multiStage: "",
|
|
10
|
+
multiStage: inject("multiStage", null),
|
|
12
11
|
itemData: "",
|
|
13
12
|
itemLabel: "",
|
|
14
13
|
showContent: false,
|
|
@@ -16,9 +15,6 @@ const renderless = (props, { reactive, inject }, { dispatch, vm }) => {
|
|
|
16
15
|
currentIndex: props.currentIndex,
|
|
17
16
|
level: props.level
|
|
18
17
|
});
|
|
19
|
-
if (multiStage) {
|
|
20
|
-
dataStore.multiStageMenu = true;
|
|
21
|
-
}
|
|
22
18
|
const handleClick = ({ dataStore: dataStore2, props: props2, vm: vm2 }) => () => {
|
|
23
19
|
if (props2.disabled) {
|
|
24
20
|
dataStore2.checkedStatus = false;
|
|
@@ -31,7 +27,7 @@ const renderless = (props, { reactive, inject }, { dispatch, vm }) => {
|
|
|
31
27
|
} else {
|
|
32
28
|
dataStore2.currentIndex = `${props2.currentIndex}`;
|
|
33
29
|
}
|
|
34
|
-
dispatch("TinyDropdown", "
|
|
30
|
+
dispatch("TinyDropdown", "selected-index", [dataStore2.currentIndex]);
|
|
35
31
|
const data = {
|
|
36
32
|
itemData: dataStore2.itemData,
|
|
37
33
|
vm: vm2,
|
|
@@ -69,8 +65,8 @@ const renderless = (props, { reactive, inject }, { dispatch, vm }) => {
|
|
|
69
65
|
Object.assign(api2, {
|
|
70
66
|
dataStore,
|
|
71
67
|
handleClick: handleClick({ dataStore, props, vm }),
|
|
72
|
-
mouseEnter: mouseEnter({ dataStore, vm
|
|
73
|
-
mouseLeave: mouseLeave({ dataStore
|
|
68
|
+
mouseEnter: mouseEnter({ dataStore, vm }),
|
|
69
|
+
mouseLeave: mouseLeave({ dataStore })
|
|
74
70
|
});
|
|
75
71
|
return api2;
|
|
76
72
|
};
|
package/dropdown-item/vue.js
CHANGED
|
@@ -39,6 +39,7 @@ const api = [
|
|
|
39
39
|
];
|
|
40
40
|
const initState = ({ reactive, computed, api: api2, props, parent, dropdownMenuVm }) => {
|
|
41
41
|
const state = reactive({
|
|
42
|
+
checkedStatus: dropdownMenuVm == null ? void 0 : dropdownMenuVm.checkedStatus,
|
|
42
43
|
sort: props.modelValue,
|
|
43
44
|
transition: true,
|
|
44
45
|
getTitle: false,
|
|
@@ -52,9 +53,12 @@ const initState = ({ reactive, computed, api: api2, props, parent, dropdownMenuV
|
|
|
52
53
|
itemStyle: computed(() => api2.getItemStyle()),
|
|
53
54
|
activeColor: computed(() => parent.activeColor),
|
|
54
55
|
closeOnClickOverlay: computed(() => parent.closeOnClickOverlay),
|
|
56
|
+
dropdownMenuVm,
|
|
57
|
+
currentIndex: props.currentIndex,
|
|
55
58
|
textField: (dropdownMenuVm == null ? void 0 : dropdownMenuVm.textField) || props.textField,
|
|
56
59
|
popperClass: (dropdownMenuVm == null ? void 0 : dropdownMenuVm.popperClass) || "",
|
|
57
|
-
getIcon: computed(() => api2.computedGetIcon())
|
|
60
|
+
getIcon: computed(() => api2.computedGetIcon()),
|
|
61
|
+
children: []
|
|
58
62
|
});
|
|
59
63
|
return state;
|
|
60
64
|
};
|
|
@@ -77,21 +81,30 @@ const initApi = ({ api: api2, state, emit, props, parent, dispatch, vm, constant
|
|
|
77
81
|
getItemStyle: getItemStyle({ parent, state }),
|
|
78
82
|
bindScroll: bindScroll({ api: api2, parent }),
|
|
79
83
|
confirm: confirm({ emit, props, state }),
|
|
80
|
-
handleClick: handleClick({ props, dispatch, vm, emit }),
|
|
84
|
+
handleClick: handleClick({ state, props, dispatch, vm, emit }),
|
|
81
85
|
computedGetIcon: computedGetIcon({ constants, designConfig }),
|
|
82
86
|
getTip: getTip({ props, vm })
|
|
83
87
|
});
|
|
84
88
|
};
|
|
85
|
-
const renderless = (props, { computed, reactive, watch, inject }, { parent, emit, vm, dispatch,
|
|
89
|
+
const renderless = (props, { computed, onMounted, reactive, watch, inject }, { parent, emit, vm, dispatch, constants, designConfig }) => {
|
|
86
90
|
const api2 = {};
|
|
87
|
-
const dropdownMenuVm = inject("dropdownMenuVm");
|
|
88
|
-
if (mode === "mobile" && dropdownMenuVm) {
|
|
89
|
-
dropdownMenuVm.state.children = [...dropdownMenuVm.state.children, vm];
|
|
90
|
-
}
|
|
91
|
-
parent = parent.$parent;
|
|
91
|
+
const dropdownMenuVm = inject("dropdownMenuVm", null);
|
|
92
92
|
const state = initState({ reactive, computed, api: api2, props, parent, dropdownMenuVm });
|
|
93
93
|
initApi({ api: api2, state, emit, props, parent, dispatch, vm, constants, designConfig });
|
|
94
94
|
watch(() => state.showPopup, api2.bindScroll);
|
|
95
|
+
onMounted(() => {
|
|
96
|
+
const realParent = parent.$parent.$parent || {};
|
|
97
|
+
if (realParent.state && realParent.state.children) {
|
|
98
|
+
realParent.state.children.push(vm);
|
|
99
|
+
} else {
|
|
100
|
+
if (dropdownMenuVm) {
|
|
101
|
+
dropdownMenuVm.state.children = [...dropdownMenuVm.state.children, vm];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (props.disabled) {
|
|
105
|
+
state.checkedStatus = false;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
95
108
|
return api2;
|
|
96
109
|
};
|
|
97
110
|
export {
|
package/dropdown-menu/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const toggleItem = (state) => (active, item) => {
|
|
|
6
6
|
if (item.disabled) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
-
if (item.type
|
|
9
|
+
if (item.type === "sort") {
|
|
10
10
|
if (!item.modelValue || item.modelValue === "desc") {
|
|
11
11
|
item.state.sort = "asc";
|
|
12
12
|
item.$emit("update:modelValue", "asc");
|
|
@@ -64,21 +64,34 @@ const getScroller = (el, root) => {
|
|
|
64
64
|
}
|
|
65
65
|
return root || null;
|
|
66
66
|
};
|
|
67
|
-
const useVuePopper = ({
|
|
67
|
+
const useVuePopper = ({
|
|
68
|
+
api,
|
|
69
|
+
props,
|
|
70
|
+
hooks,
|
|
71
|
+
instance,
|
|
72
|
+
state,
|
|
73
|
+
dropdownVm,
|
|
74
|
+
designConfig
|
|
75
|
+
}) => {
|
|
76
|
+
var _a, _b;
|
|
68
77
|
const { nextTick, onBeforeUnmount, onDeactivated, onMounted, reactive, toRefs, watch } = hooks;
|
|
69
|
-
const { emit,
|
|
78
|
+
const { emit, slots, vm, parent } = instance;
|
|
79
|
+
const designProps = {
|
|
80
|
+
placement: props.placement || ((_a = designConfig == null ? void 0 : designConfig.props) == null ? void 0 : _a.placement) || "bottom-end",
|
|
81
|
+
visibleArrow: props.visibleArrow || ((_b = designConfig == null ? void 0 : designConfig.props) == null ? void 0 : _b.visibleArrow) || false
|
|
82
|
+
};
|
|
70
83
|
const popper = userPopper({
|
|
71
84
|
emit,
|
|
72
85
|
nextTick,
|
|
73
86
|
onBeforeUnmount,
|
|
74
87
|
onDeactivated,
|
|
75
|
-
props: __spreadValues({
|
|
88
|
+
props: __spreadValues(__spreadValues({
|
|
76
89
|
popperOptions: { boundariesPadding: 0, gpuAcceleration: false },
|
|
77
90
|
offset: 0,
|
|
78
91
|
boundariesPadding: 5
|
|
79
|
-
}, props),
|
|
92
|
+
}, props), designProps),
|
|
80
93
|
reactive,
|
|
81
|
-
|
|
94
|
+
vm,
|
|
82
95
|
slots,
|
|
83
96
|
toRefs,
|
|
84
97
|
watch
|
|
@@ -118,7 +131,7 @@ const useVuePopper = ({ api, props, hooks, instance, state, dropdownVm }) => {
|
|
|
118
131
|
);
|
|
119
132
|
};
|
|
120
133
|
const mounted = ({ api, parent, state }) => () => {
|
|
121
|
-
parent.$on("
|
|
134
|
+
parent.$on("menu-selected-index", (selectedIndex) => {
|
|
122
135
|
state.selectedIndex = selectedIndex;
|
|
123
136
|
});
|
|
124
137
|
parent.$on("menu-item-click", api.handleMenuItemClick);
|
package/dropdown-menu/vue.js
CHANGED
|
@@ -22,7 +22,7 @@ const api = [
|
|
|
22
22
|
const renderless = (props, hooks, instance) => {
|
|
23
23
|
const api2 = {};
|
|
24
24
|
const { reactive, provide, onMounted, inject } = hooks;
|
|
25
|
-
const { nextTick, mode, vm, parent, dispatch, emit } = instance;
|
|
25
|
+
const { nextTick, mode, vm, parent, dispatch, emit, designConfig } = instance;
|
|
26
26
|
const state = reactive({
|
|
27
27
|
offset: 0,
|
|
28
28
|
scroller: null,
|
|
@@ -32,7 +32,8 @@ const renderless = (props, hooks, instance) => {
|
|
|
32
32
|
label: "",
|
|
33
33
|
showContent: false,
|
|
34
34
|
selected: false,
|
|
35
|
-
selectedIndex: -1
|
|
35
|
+
selectedIndex: -1,
|
|
36
|
+
canvasHeight: inject("change-size", null)
|
|
36
37
|
});
|
|
37
38
|
provide("dropdownMenuVm", vm);
|
|
38
39
|
provide("multiStage", props.multiStage);
|
|
@@ -42,7 +43,7 @@ const renderless = (props, hooks, instance) => {
|
|
|
42
43
|
state.scroller = getScroller(vm.$refs.menu);
|
|
43
44
|
});
|
|
44
45
|
} else {
|
|
45
|
-
useVuePopper({ api: api2, hooks, props, instance, state, dropdownVm });
|
|
46
|
+
useVuePopper({ api: api2, hooks, props, instance, state, dropdownVm, designConfig });
|
|
46
47
|
}
|
|
47
48
|
Object.assign(api2, {
|
|
48
49
|
state,
|
package/exception/index.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
const
|
|
3
|
-
const getMessage = ({ props, t }) => () => {
|
|
4
|
-
const types = ["build", "weaknet", "pcview", "busy", "noperm"];
|
|
5
|
-
return props.message || t(`ui.exception.${~types.indexOf(props.type) ? props.type : "nodata"}`);
|
|
6
|
-
};
|
|
2
|
+
const emitClick = (emit) => () => emit("click");
|
|
7
3
|
export {
|
|
8
|
-
|
|
9
|
-
getMessage
|
|
4
|
+
emitClick
|
|
10
5
|
};
|
package/exception/vue.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import {
|
|
2
|
+
import { emitClick } from "./index";
|
|
3
3
|
const api = ["state", "create"];
|
|
4
|
-
const renderless = (props, {
|
|
5
|
-
const api2 = {
|
|
6
|
-
create: create(emit),
|
|
7
|
-
getMessage: getMessage({ props, t })
|
|
8
|
-
};
|
|
4
|
+
const renderless = (props, { reactive }, { emit }) => {
|
|
9
5
|
const state = reactive({
|
|
10
|
-
urlType: props.type
|
|
11
|
-
images,
|
|
12
|
-
message: computed(() => api2.getMessage({ props, t }))
|
|
6
|
+
urlType: props.type
|
|
13
7
|
});
|
|
14
|
-
api2
|
|
8
|
+
const api2 = {
|
|
9
|
+
state,
|
|
10
|
+
create: emitClick(emit)
|
|
11
|
+
};
|
|
15
12
|
return api2;
|
|
16
13
|
};
|
|
17
14
|
export {
|
package/fall-menu/index.js
CHANGED
|
@@ -33,7 +33,11 @@ const computePx = ({ props, refs, state }) => () => {
|
|
|
33
33
|
const list = refs.list;
|
|
34
34
|
const width = list.parentElement.clientWidth;
|
|
35
35
|
const arr = list.querySelectorAll("li");
|
|
36
|
-
const set = {
|
|
36
|
+
const set = {
|
|
37
|
+
data: [],
|
|
38
|
+
offset: [],
|
|
39
|
+
index: []
|
|
40
|
+
};
|
|
37
41
|
const liWidth = [];
|
|
38
42
|
let innerwidth = 0;
|
|
39
43
|
let start = 0;
|
package/fall-menu/vue.js
CHANGED
|
@@ -12,7 +12,12 @@ import {
|
|
|
12
12
|
computeData
|
|
13
13
|
} from "./index";
|
|
14
14
|
const api = ["state", "fall", "arrowClick", "mouseover", "mouseout", "overContent", "reRender", "left"];
|
|
15
|
-
const initState = ({
|
|
15
|
+
const initState = ({
|
|
16
|
+
reactive,
|
|
17
|
+
computed,
|
|
18
|
+
api: api2,
|
|
19
|
+
props
|
|
20
|
+
}) => {
|
|
16
21
|
const state = reactive({
|
|
17
22
|
pager: 1,
|
|
18
23
|
level2data: [],
|
|
@@ -24,7 +29,13 @@ const initState = ({ reactive, computed, api: api2, props }) => {
|
|
|
24
29
|
});
|
|
25
30
|
return state;
|
|
26
31
|
};
|
|
27
|
-
const initApi = ({
|
|
32
|
+
const initApi = ({
|
|
33
|
+
api: api2,
|
|
34
|
+
state,
|
|
35
|
+
fall,
|
|
36
|
+
props,
|
|
37
|
+
refs
|
|
38
|
+
}) => {
|
|
28
39
|
Object.assign(api2, {
|
|
29
40
|
fall,
|
|
30
41
|
state,
|
package/file-upload/index.js
CHANGED
|
@@ -77,7 +77,7 @@ const watchListType = ({ constants, state, api }) => (type) => {
|
|
|
77
77
|
try {
|
|
78
78
|
file.url = URL.createObjectURL(file.raw);
|
|
79
79
|
} catch (err) {
|
|
80
|
-
return;
|
|
80
|
+
return null;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
return file;
|
|
@@ -412,7 +412,8 @@ const getFileHash = ({
|
|
|
412
412
|
};
|
|
413
413
|
});
|
|
414
414
|
};
|
|
415
|
-
const handleHwh5Files = (files) => {
|
|
415
|
+
const handleHwh5Files = (files, hwh5) => {
|
|
416
|
+
const fileMap = hwh5 && hwh5.fileMap;
|
|
416
417
|
return files.map((file) => {
|
|
417
418
|
if (file instanceof File)
|
|
418
419
|
return file;
|
|
@@ -427,7 +428,8 @@ const handleHwh5Files = (files) => {
|
|
|
427
428
|
const [name, index] = url.match(/[^/]*$/);
|
|
428
429
|
const [type] = url.match(/\.[^.]*$/);
|
|
429
430
|
const filePath = url.substring(0, index);
|
|
430
|
-
|
|
431
|
+
const updateFile2 = __spreadProps(__spreadValues({}, f), { type, name, filePath, webkitRelativePath: filePath });
|
|
432
|
+
return typeof fileMap === "function" ? fileMap(updateFile2) : updateFile2;
|
|
431
433
|
});
|
|
432
434
|
};
|
|
433
435
|
const handleStart = ({
|
|
@@ -438,7 +440,7 @@ const handleStart = ({
|
|
|
438
440
|
vm
|
|
439
441
|
}) => (rawFiles, updateId, reUpload = false) => {
|
|
440
442
|
if (state.isHwh5) {
|
|
441
|
-
rawFiles = handleHwh5Files(rawFiles);
|
|
443
|
+
rawFiles = handleHwh5Files(rawFiles, props.hwh5);
|
|
442
444
|
}
|
|
443
445
|
state.currentUploadingFileUids = [];
|
|
444
446
|
rawFiles.forEach((rawFile) => api.addFileToList(rawFile, updateId, reUpload));
|
|
@@ -481,14 +483,14 @@ const handleStart = ({
|
|
|
481
483
|
}
|
|
482
484
|
if (!state.isEdm && props.autoUpload) {
|
|
483
485
|
if (props.multiple && props.mergeService) {
|
|
484
|
-
const handler = (file) =>
|
|
486
|
+
const handler = (file) => vm.$refs[constants.UPLOAD_INNER].$refs[constants.UPLOAD_INNER_TEMPLATE].upload(file.raw);
|
|
485
487
|
rawFiles.length && api.beforeUpload({ raw: rawFiles }, true, handler);
|
|
486
488
|
} else {
|
|
487
489
|
rawFiles.forEach((rawFile) => {
|
|
488
490
|
const file = api.getFile(rawFile);
|
|
489
491
|
if (!file)
|
|
490
492
|
return;
|
|
491
|
-
const handler = (file2) =>
|
|
493
|
+
const handler = (file2) => vm.$refs[constants.UPLOAD_INNER].$refs[constants.UPLOAD_INNER_TEMPLATE].upload(file2.raw);
|
|
492
494
|
api.beforeUpload(file, true, handler);
|
|
493
495
|
});
|
|
494
496
|
}
|
|
@@ -560,6 +562,7 @@ const handleSuccess = ({
|
|
|
560
562
|
Modal,
|
|
561
563
|
t
|
|
562
564
|
}) => (res, rawFile) => {
|
|
565
|
+
var _a;
|
|
563
566
|
const currentUploadFiles = state.uploadFiles.filter((file) => state.currentUploadingFileUids.includes(file.uid));
|
|
564
567
|
if (Array.isArray(rawFile)) {
|
|
565
568
|
state.uploadFiles.forEach((file) => {
|
|
@@ -574,7 +577,7 @@ const handleSuccess = ({
|
|
|
574
577
|
});
|
|
575
578
|
} else {
|
|
576
579
|
const file = api.getFile(rawFile);
|
|
577
|
-
const status = res
|
|
580
|
+
const status = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.status;
|
|
578
581
|
const { STATUS_SPECIAL_CHARACTERS, NOT_SUPPORT_SPECIAL_CHARACTERS } = constants.EDM;
|
|
579
582
|
delete file.cancelToken;
|
|
580
583
|
if (props.edm.upload && file && res.data && status !== 200) {
|
|
@@ -1179,9 +1182,9 @@ const getDownloadFileInfo = ({ api, state, props, service }) => ({ docId }) => {
|
|
|
1179
1182
|
cancelToken: api.createDownloadCancelToken({ docId }),
|
|
1180
1183
|
data: { docInfoVO: { ids: [docId], docType: "", docVersion: "" } }
|
|
1181
1184
|
}).then((res) => {
|
|
1182
|
-
const { data
|
|
1185
|
+
const { data } = res || {};
|
|
1183
1186
|
if (data && data.status === 200) {
|
|
1184
|
-
const fileInfo = outDocQueryList && outDocQueryList[0].verInfo[0].docInfo[0];
|
|
1187
|
+
const fileInfo = data.result.outDocQueryList && data.result.outDocQueryList[0].verInfo[0].docInfo[0];
|
|
1185
1188
|
resolve(fileInfo);
|
|
1186
1189
|
} else {
|
|
1187
1190
|
reject(res);
|
|
@@ -1867,7 +1870,7 @@ const getPreviewUrlSync = ({ constants, props, state }) => (file, batch) => {
|
|
|
1867
1870
|
authToken: edmToken,
|
|
1868
1871
|
jslibhtml: html,
|
|
1869
1872
|
docId: file.docId,
|
|
1870
|
-
docVersion: file.docVersion || file.version || "
|
|
1873
|
+
docVersion: file.docVersion || file.version || "",
|
|
1871
1874
|
type: "doc",
|
|
1872
1875
|
pageNum: "1"
|
|
1873
1876
|
});
|
|
@@ -1937,7 +1940,7 @@ const previewImageBatch = ({ service, api }) => ({ url, file }) => {
|
|
|
1937
1940
|
});
|
|
1938
1941
|
return service.all(promises);
|
|
1939
1942
|
};
|
|
1940
|
-
const getDialogConfigObj = ({ props, state }) => () => {
|
|
1943
|
+
const getDialogConfigObj = ({ props, state, t, constants }) => () => {
|
|
1941
1944
|
const dialogConfigDefault = {
|
|
1942
1945
|
class: "single-download-modal single-download-modal1",
|
|
1943
1946
|
style: "",
|
|
@@ -1945,7 +1948,7 @@ const getDialogConfigObj = ({ props, state }) => () => {
|
|
|
1945
1948
|
lockScroll: true,
|
|
1946
1949
|
visible: state.showPreview,
|
|
1947
1950
|
dragable: true,
|
|
1948
|
-
title:
|
|
1951
|
+
title: t(constants.EDM.DOC_PREVIEW),
|
|
1949
1952
|
width: "60%"
|
|
1950
1953
|
},
|
|
1951
1954
|
on: {
|
|
@@ -1985,6 +1988,7 @@ const computeDocChunkSize = ({ props, state, constants }) => () => {
|
|
|
1985
1988
|
chunkSize = Math.max(size, SIZE_2M);
|
|
1986
1989
|
return true;
|
|
1987
1990
|
}
|
|
1991
|
+
return false;
|
|
1988
1992
|
});
|
|
1989
1993
|
}
|
|
1990
1994
|
state.docSize = docSize * 1024;
|
|
@@ -2067,6 +2071,35 @@ const encryptDialogConfirm = ({ state }) => () => {
|
|
|
2067
2071
|
state.encryptDialogConfig.show = false;
|
|
2068
2072
|
typeof selectFileMethod === "function" && selectFileMethod();
|
|
2069
2073
|
};
|
|
2074
|
+
const closeRecordPanel = ({ vm, constants, state, props }) => () => {
|
|
2075
|
+
const { PICTURE_CARD } = constants.LIST_TYPE;
|
|
2076
|
+
const { isHwh5 } = state;
|
|
2077
|
+
const { listType } = props;
|
|
2078
|
+
if (listType === PICTURE_CARD && isHwh5) {
|
|
2079
|
+
vm.$refs[constants.UPLOAD_LIST_INNER].$refs[constants.UPLOAD_LIST_INNER_TEMPLATE].state.showAudioPanel = false;
|
|
2080
|
+
}
|
|
2081
|
+
};
|
|
2082
|
+
const getTipMessage = ({ t, api, constants }) => ({ accept, fileSize, limit }) => {
|
|
2083
|
+
let acceptTip = accept ? t(constants.ONLY_SUPPORT, {
|
|
2084
|
+
type: accept.split(",").map((item) => item.trim().replace(/^\./, "")).join(t(constants.COMMA))
|
|
2085
|
+
}) : "";
|
|
2086
|
+
if (fileSize && acceptTip.length !== 0) {
|
|
2087
|
+
acceptTip += `${t(constants.COMMA)} `;
|
|
2088
|
+
}
|
|
2089
|
+
let fileSizeTip = "";
|
|
2090
|
+
let kibibyte = 1024;
|
|
2091
|
+
if (typeof fileSize === "number") {
|
|
2092
|
+
fileSizeTip = `${t(constants.FILE_NOT_LESS_THAN)}${api.formatFileSize(fileSize * kibibyte)}`;
|
|
2093
|
+
} else if (Array.isArray(fileSize)) {
|
|
2094
|
+
fileSizeTip += !isNaN(fileSize[0]) ? `${t(constants.FILE_NOT_LESS_THAN)}${api.formatFileSize(Number(fileSize[0]) * kibibyte)}${t(constants.COMMA)}` : "";
|
|
2095
|
+
fileSizeTip += !isNaN(fileSize[1]) ? `${t(constants.FILE_NOT_MORE_THAN)}${api.formatFileSize(Number(fileSize[1]) * kibibyte)}` : "";
|
|
2096
|
+
}
|
|
2097
|
+
let limitTip = limit ? t(constants.NUMBER_LIMIT, { number: limit }) : "";
|
|
2098
|
+
if ((fileSize || acceptTip.length !== 0) && limit) {
|
|
2099
|
+
limitTip = `${t(constants.COMMA)} ` + limitTip;
|
|
2100
|
+
}
|
|
2101
|
+
return acceptTip + fileSizeTip + limitTip;
|
|
2102
|
+
};
|
|
2070
2103
|
export {
|
|
2071
2104
|
abort,
|
|
2072
2105
|
abortDownload,
|
|
@@ -2078,6 +2111,7 @@ export {
|
|
|
2078
2111
|
calcUploadingFilesInfo,
|
|
2079
2112
|
clearFiles,
|
|
2080
2113
|
clearUploadingFiles,
|
|
2114
|
+
closeRecordPanel,
|
|
2081
2115
|
computeDocChunkSize,
|
|
2082
2116
|
computedSourcetype,
|
|
2083
2117
|
computedUploadDisabled,
|
|
@@ -2103,6 +2137,7 @@ export {
|
|
|
2103
2137
|
getKiaScanTip,
|
|
2104
2138
|
getNewTabPreviewUrl,
|
|
2105
2139
|
getPreviewUrlSync,
|
|
2140
|
+
getTipMessage,
|
|
2106
2141
|
getToken,
|
|
2107
2142
|
handleChange,
|
|
2108
2143
|
handleClick,
|
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) => {
|
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
|
};
|