@opentiny/vue-renderless 3.9.3 → 3.10.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/vue.js +25 -2
- package/anchor/index.js +3 -3
- package/anchor/vue.js +7 -1
- package/area/index.js +4 -4
- package/button/vue.js +4 -2
- package/button-group/index.js +8 -1
- package/button-group/vue.js +5 -10
- package/calendar/index.js +14 -14
- package/calendar-bar/index.js +3 -3
- package/carousel-item/index.js +1 -1
- package/cascader/vue.js +1 -1
- package/cascader-mobile/index.js +299 -0
- package/cascader-mobile/vue.js +102 -0
- package/cascader-panel/store.js +3 -1
- package/chart-boxplot/index.js +0 -1
- package/chart-core/deps/constants.js +20 -2
- package/chart-core/index.js +9 -1
- package/chart-core/modules/extend.js +14 -1
- package/chart-gauge/index.js +3 -1
- package/chart-graph/index.js +3 -1
- package/chart-map/index.js +11 -1
- package/chart-scatter/index.js +10 -2
- package/chart-waterfall/index.js +4 -1
- package/checkbox/index.js +8 -16
- package/checkbox/vue.js +7 -9
- package/column-list-item/vue.js +10 -1
- package/common/bigInt.js +4 -11
- package/common/date.js +2 -2
- package/common/deps/ResizeObserver.js +3 -1
- package/common/deps/date-util.js +9 -1
- package/common/deps/date.js +18 -5
- package/common/deps/fastdom/async.js +41 -0
- package/common/deps/fastdom/index.js +9 -0
- package/common/deps/fastdom/sandbox.js +53 -0
- package/common/deps/fastdom/singleton.js +80 -0
- package/common/deps/fullscreen/screenfull.js +16 -2
- package/common/deps/memorize.js +3 -3
- package/common/deps/popup-manager.js +0 -1
- package/common/deps/requestAnimationFrame.js +1 -1
- package/common/deps/throttle.js +2 -2
- package/common/deps/tree-model/node.js +23 -11
- package/common/deps/tree-model/tree-store.js +28 -7
- package/common/deps/vue-popper.js +14 -2
- package/common/deps/vue-popup.js +16 -23
- package/common/index.js +7 -35
- package/common/runtime.js +1 -1
- package/common/validate/rules/type.js +3 -1
- package/credit-card-form/vue.js +2 -2
- package/date-panel/index.js +35 -31
- package/date-panel/vue.js +12 -12
- package/date-picker/index.js +9 -5
- package/date-picker/vue.js +20 -8
- package/date-picker-mobile/index.js +3 -3
- package/date-range/index.js +91 -19
- package/date-range/vue.js +19 -11
- package/date-table/index.js +39 -6
- package/date-table/vue.js +2 -2
- package/dept/index.js +1 -1
- package/detail-page/vue.js +9 -1
- package/dialog-box/index.js +11 -2
- package/dialog-box/vue.js +30 -6
- package/dialog-select/index.js +27 -5
- package/dialog-select/vue.js +11 -4
- package/drop-roles/index.js +3 -1
- package/dropdown/index.js +28 -7
- package/dropdown/vue.js +12 -7
- package/dropdown-item/index.js +9 -1
- package/dropdown-item/mf.js +3 -3
- package/dropdown-item/vue.js +12 -10
- package/dropdown-menu/index.js +13 -14
- package/dropdown-menu/vue.js +8 -7
- package/espace/vue.js +9 -1
- package/fall-menu/vue.js +12 -1
- package/file-upload/index.js +137 -89
- package/file-upload/vue.js +24 -14
- package/filter/index.js +1 -1
- package/filter/vue.js +1 -3
- package/floating-button/index.js +73 -0
- package/floating-button/vue.js +35 -0
- package/form/index.js +13 -4
- package/form/vue.js +7 -2
- package/form-item/index.js +4 -1
- package/form-item/vue.js +6 -3
- package/fullscreen/vue.js +24 -3
- package/grid/plugins/exportExcel.js +54 -8
- package/grid/static/base/helperGetHGSKeys.js +1 -4
- package/grid/utils/common.js +15 -11
- package/grid/utils/dom.js +5 -1
- package/guide/index.js +2 -3
- package/hrapprover/index.js +3 -1
- package/index-bar/vue.js +8 -1
- package/input/index.js +1 -11
- package/input/vue.js +6 -12
- package/ip-address/index.js +4 -11
- package/ip-address/vue.js +8 -1
- package/link-menu/vue.js +22 -2
- package/locales/index.js +4 -2
- package/logon-user/index.js +3 -1
- package/logout/index.js +6 -2
- package/milestone/vue.js +1 -1
- package/mini-picker/index.js +12 -10
- package/mini-picker/vue.js +10 -10
- package/modal/index.js +5 -3
- package/modal/vue.js +4 -2
- package/month-range/index.js +18 -18
- package/month-range/vue.js +16 -4
- package/month-table/index.js +7 -3
- package/multi-select/vue.js +1 -9
- package/nav-menu/index.js +33 -4
- package/nav-menu/vue.js +9 -1
- package/notify/vue.js +12 -1
- package/numeric/vue.js +6 -2
- package/option/index.js +10 -2
- package/option/vue.js +20 -9
- package/option-group/index.js +3 -1
- package/package.json +2 -1
- package/picker/index.js +88 -17
- package/picker/vue.js +42 -17
- package/picker-column/index.js +6 -6
- package/picker-column/vue.js +5 -5
- package/popconfirm/vue.js +3 -1
- package/popeditor/index.js +55 -13
- package/popeditor/vue.js +23 -7
- package/popover/vue.js +1 -2
- package/popup/vue.js +15 -2
- package/progress/index.js +9 -7
- package/progress/vue.js +12 -4
- package/pull-refresh/vue.js +10 -1
- package/query-builder/index.js +9 -0
- package/query-builder/vue.js +18 -0
- package/radio/vue.js +3 -1
- package/radio-button/vue.js +1 -1
- package/rate/index.js +8 -2
- package/rate/vue.js +27 -4
- package/recycle-scroller/index.js +0 -1
- package/scrollbar/vue-bar.js +18 -2
- package/search/index.js +12 -5
- package/search/vue.js +7 -5
- package/select/index.js +567 -283
- package/select/vue.js +141 -85
- package/select-dropdown/vue.js +8 -6
- package/select-mobile/index.js +26 -13
- package/select-mobile/vue.js +14 -5
- package/select-view/index.js +5 -21
- package/select-view/vue.js +0 -3
- package/selected-box/index.js +3 -1
- package/slider/index.js +5 -5
- package/slider/vue.js +16 -0
- package/slider-button/index.js +41 -0
- package/slider-button/vue.js +36 -0
- package/slider-button-group/slide-button.js +142 -0
- package/slider-button-group/vue.js +52 -0
- package/steps/slide-bar.js +0 -1
- package/switch/index.js +1 -1
- package/switch/vue.js +1 -1
- package/tab-bar/index.js +8 -6
- package/tab-nav/index.js +19 -13
- package/tab-nav/vue.js +10 -9
- package/tabs/index.js +21 -17
- package/tabs/vue.js +1 -4
- package/tag/vue.js +2 -1
- package/tag-group/index.js +23 -10
- package/tag-group/vue.js +5 -4
- package/time/index.js +8 -8
- package/time/vue.js +9 -9
- package/time-line/index.js +24 -2
- package/time-line/vue.js +30 -4
- package/time-panel/index.js +2 -2
- package/time-panel/vue.js +2 -2
- package/time-range/index.js +24 -21
- package/time-range/vue.js +26 -16
- package/time-spinner/index.js +32 -21
- package/time-spinner/vue.js +37 -12
- package/timeline-item/index.js +77 -0
- package/timeline-item/vue.js +44 -0
- package/toggle-menu/vue.js +0 -1
- package/tooltip/index.js +11 -12
- package/tooltip/vue.js +11 -1
- package/top-box/vue.js +13 -1
- package/tree/index.js +228 -15
- package/tree/vue.js +119 -15
- package/tree-menu/index.js +35 -0
- package/tree-menu/vue.js +27 -5
- package/tree-node/index.js +75 -10
- package/tree-node/vue.js +45 -23
- package/upload/index.js +90 -49
- package/upload/vue.js +22 -10
- package/upload-dragger/index.js +4 -3
- package/upload-list/index.js +67 -16
- package/upload-list/vue.js +26 -9
- package/user/index.js +7 -4
- package/user-link/index.js +2 -1
- package/wizard/index.js +4 -1
- package/wizard/vue.js +19 -2
- package/year-range/index.js +1 -1
- package/year-range/vue.js +3 -3
- package/year-table/index.js +2 -2
package/selected-box/index.js
CHANGED
|
@@ -169,7 +169,9 @@ const initDrag = ({ api, emit, markRaw, props, state, vm }) => () => {
|
|
|
169
169
|
const { select } = state;
|
|
170
170
|
if (from === to && oldIndex !== newIndex) {
|
|
171
171
|
const optDoms = Array.from(vm.$el.querySelectorAll(optionSelector));
|
|
172
|
-
const slct = optDoms.map(
|
|
172
|
+
const slct = optDoms.map(
|
|
173
|
+
(optDom) => select.find((opt) => api.keyOption(opt) === api.keyType(optDom.dataset.key))
|
|
174
|
+
);
|
|
173
175
|
state.select = slct;
|
|
174
176
|
state.refresh += 1;
|
|
175
177
|
api.emitChange();
|
package/slider/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const bindEvent = (api) => () => {
|
|
|
9
9
|
};
|
|
10
10
|
const unBindEvent = (api) => () => off(window, "resize", api.bindResize);
|
|
11
11
|
const bindResize = ({ parent, props, state }) => () => {
|
|
12
|
-
const handleEl = parent.$el.querySelector("div
|
|
12
|
+
const handleEl = parent.$el.querySelector("div.tiny-slider");
|
|
13
13
|
state.sliderSize = handleEl["client" + (props.vertical ? "Height" : "Width")];
|
|
14
14
|
state.sliderOffset = handleEl.getBoundingClientRect();
|
|
15
15
|
};
|
|
@@ -266,11 +266,11 @@ const autoSlider = (api) => (value) => {
|
|
|
266
266
|
};
|
|
267
267
|
const customBeforeAppearHook = (props) => (el) => {
|
|
268
268
|
if (props.vertical) {
|
|
269
|
-
el.style.bottom = "
|
|
270
|
-
el.style.height = "
|
|
269
|
+
el.style.bottom = 0 + "%";
|
|
270
|
+
el.style.height = 0 + "%";
|
|
271
271
|
} else {
|
|
272
|
-
el.style.left = "
|
|
273
|
-
el.style.width = "
|
|
272
|
+
el.style.left = 0 + "%";
|
|
273
|
+
el.style.width = 0 + "%";
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
276
|
const customAfterAppearHook = ({ state, props }) => (el) => {
|
package/slider/vue.js
CHANGED
|
@@ -118,6 +118,22 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, wat
|
|
|
118
118
|
inputValueChange: inputValueChange({ props, api: api2, state })
|
|
119
119
|
});
|
|
120
120
|
watch(() => props.modelValue, api2.watchModelValue, { immediate: true });
|
|
121
|
+
watch(
|
|
122
|
+
() => props.min,
|
|
123
|
+
(min) => {
|
|
124
|
+
const value = Math.max(props.modelValue, min);
|
|
125
|
+
api2.initSlider(value);
|
|
126
|
+
api2.setActiveButtonValue(value);
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
watch(
|
|
130
|
+
() => props.max,
|
|
131
|
+
(max) => {
|
|
132
|
+
const value = Math.min(props.modelValue, max);
|
|
133
|
+
api2.initSlider(Math.min(props.modelValue, max));
|
|
134
|
+
api2.setActiveButtonValue(value);
|
|
135
|
+
}
|
|
136
|
+
);
|
|
121
137
|
watch(() => state.activeValue, api2.watchActiveValue, { immediate: true });
|
|
122
138
|
onMounted(() => {
|
|
123
139
|
api2.bindEvent();
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import "../chunk-PKUHTIDK.js";
|
|
2
|
+
const handleChange = ({ constants, nextTick, dispatch, state }) => () => {
|
|
3
|
+
nextTick(() => {
|
|
4
|
+
dispatch(constants.SLIDER_BUTTON_GROUP, "handleChange", [state.value]);
|
|
5
|
+
});
|
|
6
|
+
};
|
|
7
|
+
const getValue = (state) => () => state.sliderButtonGroup.modelValue;
|
|
8
|
+
const setValue = ({ state }) => (val) => state.sliderButtonGroup.$emit("update:modelValue", val);
|
|
9
|
+
const getGroup = ({ constants, parent: $parent }) => () => {
|
|
10
|
+
let parent = $parent.$parent;
|
|
11
|
+
while (parent) {
|
|
12
|
+
if (parent.$options.componentName !== constants.SLIDER_BUTTON_GROUP) {
|
|
13
|
+
parent = parent.$parent;
|
|
14
|
+
} else {
|
|
15
|
+
return parent;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return parent;
|
|
19
|
+
};
|
|
20
|
+
const mounted = ({ vm, props, dispatch, constants }) => () => {
|
|
21
|
+
dispatch(constants.SLIDER_BUTTON_GROUP, "labelValue", [props.label || props.text]);
|
|
22
|
+
dispatch(constants.SLIDER_BUTTON_GROUP, "eachBlock", [
|
|
23
|
+
vm.$refs.sliderButton.offsetLeft,
|
|
24
|
+
vm.$refs.sliderButton.offsetWidth,
|
|
25
|
+
vm.$refs.sliderButton.offsetHeight
|
|
26
|
+
]);
|
|
27
|
+
};
|
|
28
|
+
const customEvents = ({ props, vm, type }) => {
|
|
29
|
+
const sliderInput = vm.$refs.sliderInput;
|
|
30
|
+
for (let ev in props.events) {
|
|
31
|
+
sliderInput[type + "EventListener"](ev, props.events[ev]);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
customEvents,
|
|
36
|
+
getGroup,
|
|
37
|
+
getValue,
|
|
38
|
+
handleChange,
|
|
39
|
+
mounted,
|
|
40
|
+
setValue
|
|
41
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import "../chunk-PKUHTIDK.js";
|
|
2
|
+
import { handleChange, getValue, setValue, getGroup, mounted, customEvents } from "./index";
|
|
3
|
+
const api = ["state", "handleChange"];
|
|
4
|
+
const renderless = (props, { computed, reactive, onMounted, inject, onBeforeUnmount }, { emit, parent, dispatch, constants, nextTick, vm }) => {
|
|
5
|
+
const state = reactive({
|
|
6
|
+
type: inject("sliderType", null),
|
|
7
|
+
value: computed({
|
|
8
|
+
get: () => api2.getValue(),
|
|
9
|
+
set: (val) => api2.setValue(val)
|
|
10
|
+
}),
|
|
11
|
+
sliderButtonGroup: computed(() => api2.getGroup()),
|
|
12
|
+
size: inject("sliderSize", null),
|
|
13
|
+
tabIndex: computed(() => state.sliderButtonGroup && state.value !== (props.label || props.text) ? -1 : 0)
|
|
14
|
+
});
|
|
15
|
+
const api2 = {};
|
|
16
|
+
Object.assign(api2, {
|
|
17
|
+
state,
|
|
18
|
+
mounted: mounted({ vm, props, dispatch, constants, state, nextTick }),
|
|
19
|
+
getValue: getValue(state),
|
|
20
|
+
setValue: setValue({ emit, state }),
|
|
21
|
+
getGroup: getGroup({ constants, parent }),
|
|
22
|
+
handleChange: handleChange({ constants, dispatch, nextTick, state })
|
|
23
|
+
});
|
|
24
|
+
onMounted(() => {
|
|
25
|
+
api2.mounted();
|
|
26
|
+
customEvents({ props, vm, type: "add" });
|
|
27
|
+
});
|
|
28
|
+
onBeforeUnmount(() => {
|
|
29
|
+
customEvents({ props, vm, type: "remove" });
|
|
30
|
+
});
|
|
31
|
+
return api2;
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
api,
|
|
35
|
+
renderless
|
|
36
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import "../chunk-PKUHTIDK.js";
|
|
2
|
+
import debounce from "../common/deps/debounce";
|
|
3
|
+
import { on, off } from "../common/deps/dom";
|
|
4
|
+
const getButtonPosition = ({ sliderState }) => () => {
|
|
5
|
+
const { slideMainPostion, offsetList } = sliderState;
|
|
6
|
+
const array = offsetList.slice();
|
|
7
|
+
const length = array.length;
|
|
8
|
+
sliderState.boundingIndex = {
|
|
9
|
+
left: -1,
|
|
10
|
+
right: -1
|
|
11
|
+
};
|
|
12
|
+
for (let j = 0; j < length; j++) {
|
|
13
|
+
if (array[j].right > slideMainPostion.right + 2) {
|
|
14
|
+
sliderState.boundingIndex.right = j;
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
for (let k = length - 1; k >= 0; k--) {
|
|
19
|
+
if (array[k].left < slideMainPostion.left) {
|
|
20
|
+
sliderState.boundingIndex.left = k;
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const arrowLeftHandler = ({ sliderState, api: api2 }) => () => {
|
|
26
|
+
const { canLeftScroll, slideMainPostion, offsetList, boundingIndex } = sliderState;
|
|
27
|
+
if (!canLeftScroll || sliderState.timer) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const leftPosition = boundingIndex.left !== -1 && offsetList[boundingIndex.left];
|
|
31
|
+
if (leftPosition) {
|
|
32
|
+
api2.animationEvents(leftPosition.left - slideMainPostion.left);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const arrowRightHandler = ({ sliderState, api: api2 }) => () => {
|
|
36
|
+
const { canRightScroll, slideMainPostion, offsetList, boundingIndex } = sliderState;
|
|
37
|
+
if (!canRightScroll || sliderState.timer) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const rightPosition = boundingIndex.right !== -1 && offsetList[boundingIndex.right];
|
|
41
|
+
if (rightPosition) {
|
|
42
|
+
api2.animationEvents(rightPosition.right - slideMainPostion.right);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const currentPosition = ({ sliderState, vm, props, api: api2 }) => debounce(10, (isInit) => {
|
|
46
|
+
sliderState.offsetList = props.data.map((item, i) => {
|
|
47
|
+
const itemsRef = vm.$refs["block" + i];
|
|
48
|
+
const itemsPosition = itemsRef && itemsRef[0].getBoundingClientRect() || {};
|
|
49
|
+
return Object.assign(itemsPosition, { i });
|
|
50
|
+
});
|
|
51
|
+
sliderState.slideMainPostion = vm.$refs.slideMain.getBoundingClientRect();
|
|
52
|
+
api2.getButtonPosition();
|
|
53
|
+
isInit === true && api2.currentPosition();
|
|
54
|
+
});
|
|
55
|
+
const loopAnimation = ({ sliderState, api: api2, vm }) => (offset, delay, scorllLeft, cb) => {
|
|
56
|
+
const sliderScrollLeft = vm.$refs.slideMain.scrollLeft;
|
|
57
|
+
clearTimeout(sliderState.timer);
|
|
58
|
+
if (sliderScrollLeft !== sliderState.oldScrollLeft && Math.abs(sliderScrollLeft - scorllLeft) > Math.abs(offset)) {
|
|
59
|
+
sliderState.timer = setTimeout(() => {
|
|
60
|
+
vm.$refs.slideMain.scrollLeft += offset;
|
|
61
|
+
sliderState.oldScrollLeft = sliderScrollLeft;
|
|
62
|
+
api2.loopAnimation(offset, delay, scorllLeft, cb);
|
|
63
|
+
}, delay);
|
|
64
|
+
} else {
|
|
65
|
+
sliderState.timer = null;
|
|
66
|
+
vm.$refs.slideMain.scrollLeft = scorllLeft;
|
|
67
|
+
cb && cb();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const animationEvents = ({ api: api2, vm, props }) => (allOffset) => {
|
|
71
|
+
const mathNumber = allOffset > 0 ? Math.ceil : Math.floor;
|
|
72
|
+
const offsetInt = mathNumber(allOffset);
|
|
73
|
+
const { duration, delay } = props;
|
|
74
|
+
if (!duration) {
|
|
75
|
+
vm.$refs.slideMain.scrollLeft += offsetInt;
|
|
76
|
+
api2.currentPosition();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const space = mathNumber(offsetInt / (duration / delay));
|
|
80
|
+
const left = vm.$refs.slideMain.scrollLeft + offsetInt;
|
|
81
|
+
api2.loopAnimation(space, delay, left, () => {
|
|
82
|
+
api2.currentPosition();
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
const clickHandler = (api2) => () => {
|
|
86
|
+
api2.currentPosition();
|
|
87
|
+
};
|
|
88
|
+
const api = ["sliderState", "arrowLeftHandler", "arrowRightHandler", "currentPosition", "clickHandler"];
|
|
89
|
+
const renderless = (props, { reactive, onMounted, onUnmounted, computed, watch }, { vm }) => {
|
|
90
|
+
const sliderState = reactive({
|
|
91
|
+
canLeftScroll: computed(() => !props.noArrow && sliderState.boundingIndex.left !== -1),
|
|
92
|
+
canRightScroll: computed(() => !props.noArrow && sliderState.boundingIndex.right !== -1),
|
|
93
|
+
timer: null,
|
|
94
|
+
offsetList: [],
|
|
95
|
+
slideMainPostion: {},
|
|
96
|
+
oldScrollLeft: -1,
|
|
97
|
+
sliderSpace: props.sliderSpace,
|
|
98
|
+
boundingIndex: {
|
|
99
|
+
left: -1,
|
|
100
|
+
right: -1
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
const api2 = {};
|
|
104
|
+
Object.assign(api2, {
|
|
105
|
+
sliderState,
|
|
106
|
+
arrowLeftHandler: arrowLeftHandler({ sliderState, api: api2 }),
|
|
107
|
+
arrowRightHandler: arrowRightHandler({ sliderState, api: api2 }),
|
|
108
|
+
animationEvents: animationEvents({ api: api2, vm, props }),
|
|
109
|
+
loopAnimation: loopAnimation({ sliderState, api: api2, vm }),
|
|
110
|
+
getButtonPosition: getButtonPosition({ sliderState, api: api2, vm }),
|
|
111
|
+
currentPosition: currentPosition({ sliderState, vm, props, api: api2 }),
|
|
112
|
+
clickHandler: clickHandler(api2)
|
|
113
|
+
});
|
|
114
|
+
onUnmounted(() => {
|
|
115
|
+
off(window, "resize", api2.currentPosition);
|
|
116
|
+
});
|
|
117
|
+
onMounted(() => {
|
|
118
|
+
api2.currentPosition(true);
|
|
119
|
+
on(window, "resize", api2.currentPosition);
|
|
120
|
+
});
|
|
121
|
+
watch(
|
|
122
|
+
() => props.sliderSpace,
|
|
123
|
+
(value, oldValue) => {
|
|
124
|
+
if (value > oldValue) {
|
|
125
|
+
if (props.currentIndex >= sliderState.boundingIndex.right) {
|
|
126
|
+
api2.arrowRightHandler();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (value < oldValue) {
|
|
130
|
+
if (props.currentIndex <= sliderState.boundingIndex.left) {
|
|
131
|
+
api2.arrowLeftHandler();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
api2.currentPosition();
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
return api2;
|
|
138
|
+
};
|
|
139
|
+
export {
|
|
140
|
+
api,
|
|
141
|
+
renderless
|
|
142
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import "../chunk-PKUHTIDK.js";
|
|
2
|
+
const api = ["state"];
|
|
3
|
+
const renderless = (props, { reactive, provide }, { parent }) => {
|
|
4
|
+
const state = reactive({
|
|
5
|
+
tag: "div",
|
|
6
|
+
isActive: false,
|
|
7
|
+
eachBlock: [],
|
|
8
|
+
sliderWidth: 0,
|
|
9
|
+
sliderHeight: 0,
|
|
10
|
+
sliderSpace: props.size === "large" ? 4 : 2,
|
|
11
|
+
sliderWidthData: [],
|
|
12
|
+
sliderHeightData: [],
|
|
13
|
+
eachBlockIndex: [],
|
|
14
|
+
eachBlockData: {},
|
|
15
|
+
currentIndex: 0,
|
|
16
|
+
sliderCount: 0
|
|
17
|
+
});
|
|
18
|
+
parent.$on("handleChange", (value) => {
|
|
19
|
+
state.eachBlockIndex.find((e, index) => {
|
|
20
|
+
if (e.index === value) {
|
|
21
|
+
state.currentIndex = index;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
state.sliderSpace = state.eachBlock[state.currentIndex];
|
|
25
|
+
state.sliderWidth = state.sliderWidthData[state.currentIndex];
|
|
26
|
+
state.sliderHeight = state.sliderHeightData[state.currentIndex];
|
|
27
|
+
parent.$emit("change", value);
|
|
28
|
+
state.sliderCount += 1;
|
|
29
|
+
});
|
|
30
|
+
parent.$on("labelValue", (value) => {
|
|
31
|
+
state.eachBlockIndex.push({ index: value });
|
|
32
|
+
if (props.modelValue === value) {
|
|
33
|
+
state.isActive = true;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
parent.$on("eachBlock", (left, width, height) => {
|
|
37
|
+
state.eachBlock.push(left);
|
|
38
|
+
state.sliderWidthData.push(width);
|
|
39
|
+
state.sliderHeightData.push(height);
|
|
40
|
+
state.sliderWidth = state.sliderWidthData[0];
|
|
41
|
+
state.sliderHeight = state.sliderHeightData[0];
|
|
42
|
+
});
|
|
43
|
+
const api2 = {};
|
|
44
|
+
Object.assign(api2, { state });
|
|
45
|
+
provide("sliderType", props.type);
|
|
46
|
+
provide("sliderSize", props.size);
|
|
47
|
+
return api2;
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
api,
|
|
51
|
+
renderless
|
|
52
|
+
};
|
package/steps/slide-bar.js
CHANGED
|
@@ -99,7 +99,6 @@ const renderless = (props, { reactive, onMounted, onUnmounted, computed }, { vm
|
|
|
99
99
|
const api2 = {};
|
|
100
100
|
Object.assign(api2, {
|
|
101
101
|
slideBarState: state,
|
|
102
|
-
// 内部 state 重命名,避免使用插槽时 state 覆盖问题
|
|
103
102
|
leftSlideHandler: leftSlideHandler({ state, api: api2 }),
|
|
104
103
|
rightSlideHandler: rightSlideHandler({ state, api: api2 }),
|
|
105
104
|
animationHandler: animationHandler({ api: api2, vm, props }),
|
package/switch/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import "../chunk-PKUHTIDK.js";
|
|
|
2
2
|
import { isNull } from "../common/type";
|
|
3
3
|
const toggle = ({ emit, props, state }) => (event) => {
|
|
4
4
|
event.preventDefault();
|
|
5
|
-
if (state.disabled) {
|
|
5
|
+
if (state.disabled || props.types === "loading") {
|
|
6
6
|
return false;
|
|
7
7
|
}
|
|
8
8
|
const change = () => {
|
package/switch/vue.js
CHANGED
|
@@ -13,7 +13,7 @@ const renderless = (props, { computed, watch, reactive, inject }, { parent, cons
|
|
|
13
13
|
wrapClasses: computed(() => api2.computedWarpClasses()),
|
|
14
14
|
style: computed(() => api2.computedStyle()),
|
|
15
15
|
formDisabled: computed(() => (parent.tinyForm || {}).disabled),
|
|
16
|
-
disabled: computed(() => props.disabled || state.formDisabled),
|
|
16
|
+
disabled: computed(() => props.disabled || state.formDisabled || state.isDisplayOnly),
|
|
17
17
|
isDisplayOnly: computed(() => props.displayOnly || (parent.tinyForm || {}).displayOnly),
|
|
18
18
|
showText: computed(() => {
|
|
19
19
|
if (props.showText === void 0) {
|
package/tab-bar/index.js
CHANGED
|
@@ -9,23 +9,26 @@ const computedBarStyle = (parent) => (props, state) => {
|
|
|
9
9
|
const sizeDir = sizeName === "width" ? "x" : "y";
|
|
10
10
|
props.tabs.every(({ state: state2 }) => {
|
|
11
11
|
const $el = parent.$refs[`tabs-${state2.paneName}`];
|
|
12
|
-
if (!$el)
|
|
12
|
+
if (!$el) {
|
|
13
13
|
return false;
|
|
14
|
+
}
|
|
15
|
+
const barLength = $el.getBoundingClientRect()[sizeName];
|
|
16
|
+
const barMarginRight = parseFloat(window.getComputedStyle($el).marginRight);
|
|
14
17
|
if (!state2.active) {
|
|
15
|
-
if ($el
|
|
18
|
+
if ($el.getBoundingClientRect().width === 0) {
|
|
16
19
|
const unactive = $el.cloneNode(true);
|
|
17
20
|
document.body.appendChild(unactive);
|
|
18
21
|
const unactiveSty = window.getComputedStyle(unactive);
|
|
19
|
-
offset += parseFloat(unactiveSty
|
|
22
|
+
offset += parseFloat(unactiveSty[sizeName]) - parseFloat(unactiveSty.marginRight);
|
|
20
23
|
document.body.removeChild(unactive);
|
|
21
24
|
} else {
|
|
22
|
-
offset +=
|
|
25
|
+
offset += sizeName === "height" ? barLength : barLength + barMarginRight;
|
|
23
26
|
}
|
|
24
27
|
return true;
|
|
25
28
|
} else {
|
|
26
29
|
const copyEl = $el.cloneNode(true);
|
|
27
30
|
const eleStyle = window.getComputedStyle(copyEl);
|
|
28
|
-
tabSize =
|
|
31
|
+
tabSize = barLength;
|
|
29
32
|
if (tabSize === 0) {
|
|
30
33
|
document.body.appendChild(copyEl);
|
|
31
34
|
tabSize = parseFloat(eleStyle.width) - parseFloat(eleStyle.paddingLeft) - parseFloat(eleStyle.paddingRight);
|
|
@@ -39,7 +42,6 @@ const computedBarStyle = (parent) => (props, state) => {
|
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
|
-
return false;
|
|
43
45
|
});
|
|
44
46
|
const transform = `translate${capitalize(sizeDir)}(${offset}px)`;
|
|
45
47
|
style[sizeName] = tabSize + "px";
|
package/tab-nav/index.js
CHANGED
|
@@ -33,7 +33,7 @@ const scrollIntoView = ({ parent, refs, state }) => () => {
|
|
|
33
33
|
};
|
|
34
34
|
const computedSizeName = (state) => ~[POSITION.Top, POSITION.Bottom].indexOf(state.rootTabs.position) ? "width" : "height";
|
|
35
35
|
const updated = ({ api, refs, state }) => () => {
|
|
36
|
-
if (!refs.nav) {
|
|
36
|
+
if (!refs.nav || state.dragging) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
let navSize = refs.nav[`offset${capitalize(state.sizeName)}`];
|
|
@@ -66,6 +66,12 @@ const updated = ({ api, refs, state }) => () => {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
state.isActive && api.scrollIntoView();
|
|
69
|
+
if (refs.tabBar) {
|
|
70
|
+
refs.tabBar.state.barStyle = refs.tabBar.computedBarStyle(refs.tabBar, state);
|
|
71
|
+
} else {
|
|
72
|
+
const line = refs.nav.querySelector("tiny-mobile-tabs__line");
|
|
73
|
+
line && line.style && (line.style.transform = api.computedNavStyle(state).transform);
|
|
74
|
+
}
|
|
69
75
|
};
|
|
70
76
|
const mounted = ({ api, parent }) => {
|
|
71
77
|
const el = parent.$refs.nav.$el;
|
|
@@ -209,14 +215,14 @@ const computedHeaderStyle = ({ refs, state }) => () => {
|
|
|
209
215
|
}
|
|
210
216
|
return state.expandHeaderStyle;
|
|
211
217
|
};
|
|
212
|
-
const handleTabDragStart = ({ state,
|
|
218
|
+
const handleTabDragStart = ({ state, refs, emit }) => (event) => {
|
|
213
219
|
state.dragging = true;
|
|
214
|
-
if ([POSITION.Top, POSITION.Bottom].
|
|
220
|
+
if (![POSITION.Top, POSITION.Bottom].includes(state.rootTabs.position)) {
|
|
215
221
|
emit("tab-drag-start", event);
|
|
216
222
|
return;
|
|
217
223
|
}
|
|
218
|
-
const navContainer =
|
|
219
|
-
const nav =
|
|
224
|
+
const navContainer = refs.navScroll;
|
|
225
|
+
const nav = refs.nav;
|
|
220
226
|
const containerWidth = navContainer.offsetWidth;
|
|
221
227
|
const navWidth = nav.offsetWidth;
|
|
222
228
|
if (navWidth > containerWidth) {
|
|
@@ -230,15 +236,15 @@ const handleTabDragStart = ({ state, vm, emit }) => (event) => {
|
|
|
230
236
|
}
|
|
231
237
|
emit("tab-drag-start", event);
|
|
232
238
|
};
|
|
233
|
-
const handleTabDragEnd = ({
|
|
239
|
+
const handleTabDragEnd = ({ refs, state, nextTick }) => () => {
|
|
234
240
|
state.dragging = false;
|
|
235
|
-
if ([POSITION.Top, POSITION.Bottom].
|
|
241
|
+
if (![POSITION.Top, POSITION.Bottom].includes(state.rootTabs.position)) {
|
|
236
242
|
return;
|
|
237
243
|
}
|
|
238
|
-
const nav =
|
|
244
|
+
const nav = refs.nav;
|
|
239
245
|
if (nav.style.width) {
|
|
240
246
|
const navOffset = nav.scrollLeft;
|
|
241
|
-
const navContainer =
|
|
247
|
+
const navContainer = refs.navScroll;
|
|
242
248
|
navContainer.style.height = "";
|
|
243
249
|
nav.style.width = "";
|
|
244
250
|
nav.style.overflowX = "";
|
|
@@ -248,11 +254,11 @@ const handleTabDragEnd = ({ vm, state, nextTick }) => () => {
|
|
|
248
254
|
});
|
|
249
255
|
}
|
|
250
256
|
};
|
|
251
|
-
const sortableEvent = ({ api, props, state,
|
|
257
|
+
const sortableEvent = ({ api, props, state, refs, emit, markRaw }) => () => {
|
|
252
258
|
if (!props.dropConfig || typeof props.dropConfig.plugin !== "function") {
|
|
253
259
|
return;
|
|
254
260
|
}
|
|
255
|
-
const navSortableObj = new props.dropConfig.plugin(
|
|
261
|
+
const navSortableObj = new props.dropConfig.plugin(refs.nav, {
|
|
256
262
|
sort: true,
|
|
257
263
|
draggable: ".tiny-tabs__item",
|
|
258
264
|
onUpdate(event) {
|
|
@@ -270,9 +276,9 @@ const sortableEvent = ({ api, props, state, vm, emit, markRaw }) => () => {
|
|
|
270
276
|
});
|
|
271
277
|
state.navSortableObj = markRaw(navSortableObj);
|
|
272
278
|
};
|
|
273
|
-
const watchCurrentName = ({ nextTick,
|
|
279
|
+
const watchCurrentName = ({ nextTick, refs, state }) => () => {
|
|
274
280
|
nextTick(() => {
|
|
275
|
-
const tabBarVnode =
|
|
281
|
+
const tabBarVnode = refs.tabBar;
|
|
276
282
|
if (tabBarVnode) {
|
|
277
283
|
tabBarVnode.state.barStyle = tabBarVnode.computedBarStyle(tabBarVnode, state);
|
|
278
284
|
}
|
package/tab-nav/vue.js
CHANGED
|
@@ -39,9 +39,10 @@ const api = [
|
|
|
39
39
|
"computedHeaderStyle",
|
|
40
40
|
"swiperHandle"
|
|
41
41
|
];
|
|
42
|
-
const renderless = (props, { computed, inject, onBeforeUnmount, onMounted, onUpdated, reactive, markRaw }, { parent,
|
|
42
|
+
const renderless = (props, { computed, inject, onBeforeUnmount, onMounted, onUpdated, reactive, markRaw }, { parent, nextTick, refs, mode: tinyMode, emit }) => {
|
|
43
43
|
const api2 = { mounted, beforeUnmount, computedNavStyle, computedSizeName };
|
|
44
44
|
const state = reactive({
|
|
45
|
+
dragging: false,
|
|
45
46
|
navOffset: 0,
|
|
46
47
|
lineOffset: 0,
|
|
47
48
|
scrollable: false,
|
|
@@ -53,7 +54,7 @@ const renderless = (props, { computed, inject, onBeforeUnmount, onMounted, onUpd
|
|
|
53
54
|
showExpandItem: false,
|
|
54
55
|
showExpandTabs: props.showExpandTabs,
|
|
55
56
|
expandHeaderStyle: {},
|
|
56
|
-
mode: props._mode || parent.$mode ||
|
|
57
|
+
mode: props._mode || parent.$mode || tinyMode || "pc",
|
|
57
58
|
rootTabs: inject("rootTabs"),
|
|
58
59
|
sizeName: computed(() => api2.computedSizeName(state)),
|
|
59
60
|
navStyle: computed(() => api2.computedNavStyle(state))
|
|
@@ -70,15 +71,15 @@ const renderless = (props, { computed, inject, onBeforeUnmount, onMounted, onUpd
|
|
|
70
71
|
windowBlurHandler: windowBlurHandler(state),
|
|
71
72
|
windowFocusHandler: windowFocusHandler(state),
|
|
72
73
|
visibilityChangeHandler: visibilityChangeHandler(state),
|
|
73
|
-
scrollToActiveTab: scrollToActiveTab({
|
|
74
|
-
scrollIntoView: scrollIntoView({
|
|
74
|
+
scrollToActiveTab: scrollToActiveTab({ parent, refs, state }),
|
|
75
|
+
scrollIntoView: scrollIntoView({ parent, refs, state }),
|
|
75
76
|
computedHeaderStyle: computedHeaderStyle({ refs, state }),
|
|
76
|
-
watchCurrentName: watchCurrentName({ nextTick,
|
|
77
|
-
handleTabDragStart: handleTabDragStart({ state,
|
|
78
|
-
handleTabDragEnd: handleTabDragEnd({ state,
|
|
79
|
-
sortableEvent: sortableEvent({ api: api2, props, state,
|
|
77
|
+
watchCurrentName: watchCurrentName({ nextTick, refs, state }),
|
|
78
|
+
handleTabDragStart: handleTabDragStart({ state, refs, emit }),
|
|
79
|
+
handleTabDragEnd: handleTabDragEnd({ state, refs, nextTick }),
|
|
80
|
+
sortableEvent: sortableEvent({ api: api2, props, state, refs, emit, markRaw })
|
|
80
81
|
});
|
|
81
|
-
Object.assign(api2, { updated: updated({ api: api2,
|
|
82
|
+
Object.assign(api2, { updated: updated({ api: api2, refs, state }), changeTab: changeTab(api2) });
|
|
82
83
|
onUpdated(() => api2.updated());
|
|
83
84
|
onMounted(() => api2.mounted({ api: api2, parent }));
|
|
84
85
|
onBeforeUnmount(() => api2.beforeUnmount({ api: api2, parent }));
|
package/tabs/index.js
CHANGED
|
@@ -27,23 +27,31 @@ const calcPaneInstances = ({ constants, parent, state, childrenHandler }) => (is
|
|
|
27
27
|
state.panes = [];
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
const calcMorePanes = ({ parent, props, state, refs }) => () => {
|
|
30
|
+
const calcMorePanes = ({ parent, props, state, refs, nextTick }) => () => {
|
|
31
31
|
if (!props.showMoreTabs) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
const el = parent.$el;
|
|
35
35
|
const tabs = el.querySelectorAll(".tiny-tabs__item");
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
const tabNavRefs = refs.nav.$refs;
|
|
37
|
+
if (tabs && tabs.length) {
|
|
38
|
+
nextTick(() => {
|
|
39
|
+
nextTick(() => {
|
|
40
|
+
let tabsAllWidth = 0;
|
|
41
|
+
for (let i = 0; i < tabs.length; i++) {
|
|
42
|
+
tabsAllWidth = tabs[i].offsetLeft + tabs[i].offsetWidth / 2;
|
|
43
|
+
const tabsHeaderWidth = tabNavRefs.navScroll.offsetWidth;
|
|
44
|
+
if (tabsAllWidth > tabsHeaderWidth) {
|
|
45
|
+
if (state.currentName >= i + 1) {
|
|
46
|
+
state.showPanesCount = state.currentName - 0;
|
|
47
|
+
} else {
|
|
48
|
+
state.showPanesCount = i;
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
47
55
|
}
|
|
48
56
|
};
|
|
49
57
|
const calcExpandPanes = ({ parent, props, state }) => () => {
|
|
@@ -99,11 +107,7 @@ const changeCurrentName = ({ emit, state }) => (value) => {
|
|
|
99
107
|
emit("update:modelValue", value);
|
|
100
108
|
};
|
|
101
109
|
const created = ({ api, parent, state }) => () => {
|
|
102
|
-
|
|
103
|
-
state.currentIndex = 0;
|
|
104
|
-
api.setCurrentName("0");
|
|
105
|
-
}
|
|
106
|
-
api.changeDirection(state.currentName || "0");
|
|
110
|
+
api.changeDirection(state.currentName);
|
|
107
111
|
parent.$on("tab-nav-update", api.calcPaneInstances.bind(null, true));
|
|
108
112
|
};
|
|
109
113
|
const changeDirection = ({ props, state }) => (currentName) => {
|
package/tabs/vue.js
CHANGED
|
@@ -72,7 +72,7 @@ const renderless = (props, { onMounted, onUpdated, provide, reactive, watch }, {
|
|
|
72
72
|
handleTabRemove: handleTabRemove(emit),
|
|
73
73
|
changeDirection: changeDirection({ props, state }),
|
|
74
74
|
changeCurrentName: changeCurrentName({ emit, state }),
|
|
75
|
-
calcMorePanes: calcMorePanes({ parent, props, state, refs }),
|
|
75
|
+
calcMorePanes: calcMorePanes({ parent, props, state, refs, nextTick }),
|
|
76
76
|
calcExpandPanes: calcExpandPanes({ parent, props, state }),
|
|
77
77
|
calcPaneInstances: calcPaneInstances({ constants, parent, state, childrenHandler }),
|
|
78
78
|
handleTabDragStart: handleTabDragStart({ emit }),
|
|
@@ -85,9 +85,6 @@ const renderless = (props, { onMounted, onUpdated, provide, reactive, watch }, {
|
|
|
85
85
|
api2.created();
|
|
86
86
|
provide("rootTabs", parent);
|
|
87
87
|
initWatcher({ watch, props, api: api2, state, nextTick, refs });
|
|
88
|
-
if (!state.currentName) {
|
|
89
|
-
api2.setCurrentName("0");
|
|
90
|
-
}
|
|
91
88
|
onMounted(() => {
|
|
92
89
|
api2.calcPaneInstances();
|
|
93
90
|
api2.calcMorePanes();
|
package/tag/vue.js
CHANGED
|
@@ -8,10 +8,11 @@ const renderless = (props, { reactive, computed }, { emit, parent }) => {
|
|
|
8
8
|
selected: false
|
|
9
9
|
});
|
|
10
10
|
const api2 = {
|
|
11
|
+
state,
|
|
11
12
|
handleClose: handleClose({ emit, props, state }),
|
|
12
13
|
handleClick: handleClick({ emit, props, parent, state })
|
|
13
14
|
};
|
|
14
|
-
return
|
|
15
|
+
return api2;
|
|
15
16
|
};
|
|
16
17
|
export {
|
|
17
18
|
api,
|