@opentiny/vue-renderless 3.6.2 → 3.6.6
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 +2 -1
- package/breadcrumb-item/vue.js +2 -11
- package/cascader-panel/node.js +1 -1
- package/common/deps/popper.js +41 -29
- package/common/index.js +1 -1
- package/common/runtime.js +1 -1
- package/multi-select/index.js +1 -4
- package/multi-select/vue.js +5 -4
- package/package.json +1 -1
- package/pull-refresh/index.js +10 -7
- package/pull-refresh/vue.js +7 -7
- package/slider/index.js +8 -1
- package/tabs/index.js +1 -0
- package/tooltip/vue.js +1 -2
package/action-sheet/index.js
CHANGED
|
@@ -17,6 +17,7 @@ const setSheetStyle = ({ state, props }) => () => {
|
|
|
17
17
|
"max-height": props.height
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
+
state.contentStyle = props.contentStyle ? props.contentStyle : "";
|
|
20
21
|
};
|
|
21
22
|
const initScrollMenu = ({ state, nextTick, refs, BScroll }) => () => {
|
|
22
23
|
nextTick(() => {
|
|
@@ -24,7 +25,7 @@ const initScrollMenu = ({ state, nextTick, refs, BScroll }) => () => {
|
|
|
24
25
|
if (!state.scroll) {
|
|
25
26
|
state.scroll = new BScroll(scrollMenu, {
|
|
26
27
|
probeType: 3,
|
|
27
|
-
|
|
28
|
+
tap: "tap"
|
|
28
29
|
});
|
|
29
30
|
} else {
|
|
30
31
|
state.scroll.refresh();
|
package/breadcrumb-item/vue.js
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
|
-
import { on, off } from "@opentiny/vue-renderless/common/deps/dom";
|
|
3
2
|
import { linkClick } from "./index";
|
|
4
3
|
const api = ["linkClick"];
|
|
5
|
-
const renderless = (props, {
|
|
4
|
+
const renderless = (props, { inject }, { refs, router, emit }) => {
|
|
6
5
|
const breadcrumbEmitter = inject("breadcrumbEmitter");
|
|
7
6
|
const breadcrumb = inject("breadcrumb");
|
|
8
7
|
const constants = breadcrumb._constants;
|
|
9
8
|
const api2 = {
|
|
10
9
|
linkClick: linkClick({ props, refs, router, emit, breadcrumbEmitter, constants })
|
|
11
10
|
};
|
|
12
|
-
|
|
13
|
-
on(refs.link, "click", api2.linkClick);
|
|
14
|
-
});
|
|
15
|
-
onBeforeUnmount(() => {
|
|
16
|
-
off(refs.link, "click", api2.linkClick);
|
|
17
|
-
});
|
|
18
|
-
return {
|
|
19
|
-
api: api2
|
|
20
|
-
};
|
|
11
|
+
return api2;
|
|
21
12
|
};
|
|
22
13
|
export {
|
|
23
14
|
api,
|
package/cascader-panel/node.js
CHANGED
|
@@ -24,7 +24,7 @@ class Node {
|
|
|
24
24
|
const { config } = this;
|
|
25
25
|
const childrenKey = config.children;
|
|
26
26
|
const childrenData = this.data[childrenKey];
|
|
27
|
-
this.hasChildren = Array.isArray(childrenData);
|
|
27
|
+
this.hasChildren = Array.isArray(childrenData) && childrenData.length > 0;
|
|
28
28
|
this.children = (childrenData || []).map((child) => new Node(child, config, this));
|
|
29
29
|
}
|
|
30
30
|
get isLeaf() {
|
package/common/deps/popper.js
CHANGED
|
@@ -93,36 +93,36 @@ const isScrollElement = (el) => {
|
|
|
93
93
|
return scrollTypes.includes(getStyleComputedProperty(el, "overflow")) || scrollTypes.includes(getStyleComputedProperty(el, "overflow-x")) || scrollTypes.includes(getStyleComputedProperty(el, "overflow-y"));
|
|
94
94
|
};
|
|
95
95
|
const getScrollParent = (el) => {
|
|
96
|
-
let
|
|
97
|
-
if (!
|
|
96
|
+
let parent2 = el.parentNode;
|
|
97
|
+
if (!parent2) {
|
|
98
98
|
return el;
|
|
99
99
|
}
|
|
100
|
-
if (
|
|
100
|
+
if (parent2 === win.document) {
|
|
101
101
|
if (win.document.body.scrollTop || win.document.body.scrollLeft) {
|
|
102
102
|
return win.document.body;
|
|
103
103
|
}
|
|
104
104
|
return win.document.documentElement;
|
|
105
105
|
}
|
|
106
|
-
if (isScrollElement(
|
|
107
|
-
return
|
|
106
|
+
if (isScrollElement(parent2)) {
|
|
107
|
+
return parent2;
|
|
108
108
|
}
|
|
109
109
|
return getScrollParent(el.parentNode);
|
|
110
110
|
};
|
|
111
|
-
const
|
|
111
|
+
const getOffsetRectRelativeToCustomPopper = (el, popper, fixed) => {
|
|
112
112
|
let { top, left, width, height } = getBoundingClientRect(el);
|
|
113
|
-
let
|
|
113
|
+
let popperRect = getBoundingClientRect(popper);
|
|
114
114
|
if (fixed) {
|
|
115
115
|
let { scrollTop, scrollLeft } = getScrollParent(parent);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
popperRect.top += scrollTop;
|
|
117
|
+
popperRect.bottom += scrollTop;
|
|
118
|
+
popperRect.left += scrollLeft;
|
|
119
|
+
popperRect.right += scrollLeft;
|
|
120
120
|
}
|
|
121
121
|
let rect = {
|
|
122
|
-
top: top -
|
|
123
|
-
left: left -
|
|
124
|
-
bottom: top -
|
|
125
|
-
right: left -
|
|
122
|
+
top: top - popperRect.top,
|
|
123
|
+
left: left - popperRect.left,
|
|
124
|
+
bottom: top - popperRect.top + height,
|
|
125
|
+
right: left - popperRect.left + width,
|
|
126
126
|
width,
|
|
127
127
|
height
|
|
128
128
|
};
|
|
@@ -180,10 +180,10 @@ const getArrayKeyIndex = (arr, keyToFind) => {
|
|
|
180
180
|
return null;
|
|
181
181
|
};
|
|
182
182
|
const getAllScrollParents = (el, parents = []) => {
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
185
|
-
isScrollElement(
|
|
186
|
-
return getAllScrollParents(
|
|
183
|
+
const parent2 = el.parentNode;
|
|
184
|
+
if (parent2) {
|
|
185
|
+
isScrollElement(parent2) && parents.push(parent2);
|
|
186
|
+
return getAllScrollParents(parent2, parents);
|
|
187
187
|
}
|
|
188
188
|
return parents;
|
|
189
189
|
};
|
|
@@ -229,6 +229,7 @@ function Popper(reference, popper, options) {
|
|
|
229
229
|
Popper.prototype.destroy = function() {
|
|
230
230
|
this._popper.removeAttribute("x-placement");
|
|
231
231
|
const popperStyle = this._reference === this._oldreference && this._oldreference._popper || {};
|
|
232
|
+
this._popper.style.display = "none";
|
|
232
233
|
this._popper.style.position = "";
|
|
233
234
|
this._popper.style.top = popperStyle.top || "";
|
|
234
235
|
this._popper.style.left = popperStyle.left || "";
|
|
@@ -285,19 +286,19 @@ Popper.prototype.parse = function(config) {
|
|
|
285
286
|
addAttributes(arrow, config.arrowAttributes);
|
|
286
287
|
popper.appendChild(arrow);
|
|
287
288
|
}
|
|
288
|
-
let
|
|
289
|
-
if (typeof
|
|
290
|
-
|
|
291
|
-
if (
|
|
292
|
-
|
|
289
|
+
let parent2 = getRealElement(config.parent);
|
|
290
|
+
if (typeof parent2 === "string") {
|
|
291
|
+
parent2 = docEl.querySelectorAll(config.parent);
|
|
292
|
+
if (parent2 && parent2.length) {
|
|
293
|
+
parent2 = parent2[0];
|
|
293
294
|
} else {
|
|
294
295
|
throw new Error("ERROR: the given `parent` does not exists!");
|
|
295
296
|
}
|
|
296
297
|
}
|
|
297
|
-
if (
|
|
298
|
-
|
|
298
|
+
if (parent2.length > 1 && parent2 instanceof Element === false) {
|
|
299
|
+
parent2 = parent2[0];
|
|
299
300
|
}
|
|
300
|
-
|
|
301
|
+
parent2.appendChild(popper);
|
|
301
302
|
return popper;
|
|
302
303
|
};
|
|
303
304
|
Popper.prototype._getPosition = function(popper, reference) {
|
|
@@ -310,10 +311,21 @@ Popper.prototype._getPosition = function(popper, reference) {
|
|
|
310
311
|
};
|
|
311
312
|
Popper.prototype._getOffsets = function(popper, reference, placement) {
|
|
312
313
|
placement = placement.split("-")[0];
|
|
313
|
-
let popperOffsets = {
|
|
314
|
+
let popperOffsets = {
|
|
315
|
+
position: this.state.position,
|
|
316
|
+
left: 0,
|
|
317
|
+
top: 0,
|
|
318
|
+
width: 0,
|
|
319
|
+
height: 0
|
|
320
|
+
};
|
|
314
321
|
popperOffsets.position = this.state.position;
|
|
315
322
|
let isParentFixed = popperOffsets.position === "fixed";
|
|
316
|
-
|
|
323
|
+
popper.style.left = "0";
|
|
324
|
+
popper.style.top = "0";
|
|
325
|
+
const originMargin = popper.style.margin;
|
|
326
|
+
popper.style.margin = "0";
|
|
327
|
+
let referenceOffsets = getOffsetRectRelativeToCustomPopper(reference, popper, isParentFixed);
|
|
328
|
+
popper.style.margin = originMargin;
|
|
317
329
|
let { width, height } = this.popperOuterSize ? this.popperOuterSize : this.popperOuterSize = getOuterSizes(popper);
|
|
318
330
|
if (~["right", "left"].indexOf(placement)) {
|
|
319
331
|
popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - height / 2;
|
package/common/index.js
CHANGED
package/common/runtime.js
CHANGED
|
@@ -22,7 +22,7 @@ import vuePopup from "@opentiny/vue-renderless/common/deps/vue-popup";
|
|
|
22
22
|
import validate from "@opentiny/vue-renderless/common/validate";
|
|
23
23
|
import memorize from "@opentiny/vue-renderless/common/deps/memorize";
|
|
24
24
|
import * as common from "@opentiny/vue-renderless/common";
|
|
25
|
-
const version = "3.6.
|
|
25
|
+
const version = "3.6.6";
|
|
26
26
|
const Renderless = {
|
|
27
27
|
browser,
|
|
28
28
|
array,
|
package/multi-select/index.js
CHANGED
|
@@ -163,10 +163,7 @@ const getLabelsStyle = (state) => {
|
|
|
163
163
|
const over25Labels = state.labelLevelsInfo.filter((i) => i && !i.isOver25);
|
|
164
164
|
let widthInfo = over25Labels;
|
|
165
165
|
const len = state.dataSource.length;
|
|
166
|
-
if (len >= 4) {
|
|
167
|
-
return getStyleConfig(state.labelLevelsInfo, { width: `${(1 / len * 100).toFixed(2)}%` });
|
|
168
|
-
}
|
|
169
|
-
if (!widthInfo.length || widthInfo.length === state.labelLevelsInfo.length) {
|
|
166
|
+
if (!widthInfo.length || widthInfo.length === state.labelLevelsInfo.length || len >= 4) {
|
|
170
167
|
return getStyleConfig(state.labelLevelsInfo, { maxWidth: `${(1 / len * 100).toFixed(2)}%` });
|
|
171
168
|
}
|
|
172
169
|
let fillArr;
|
package/multi-select/vue.js
CHANGED
|
@@ -18,7 +18,7 @@ const api = [
|
|
|
18
18
|
"clickWheelItem",
|
|
19
19
|
"loadDefault"
|
|
20
20
|
];
|
|
21
|
-
const initState = (reactive) => {
|
|
21
|
+
const initState = ({ computed, reactive }) => {
|
|
22
22
|
const state = reactive({
|
|
23
23
|
dataSource: [],
|
|
24
24
|
wheelData: [],
|
|
@@ -30,7 +30,8 @@ const initState = (reactive) => {
|
|
|
30
30
|
wheelText: "",
|
|
31
31
|
headerInfo: [],
|
|
32
32
|
defaultSelectedIndexs: [],
|
|
33
|
-
defaultSelectedArray: []
|
|
33
|
+
defaultSelectedArray: [],
|
|
34
|
+
isActive: computed(() => state.headerInfo.some((item) => item.isUP))
|
|
34
35
|
});
|
|
35
36
|
return state;
|
|
36
37
|
};
|
|
@@ -60,9 +61,9 @@ const initWatch = ({ watch, props, state, refs, nextTick }) => {
|
|
|
60
61
|
}
|
|
61
62
|
);
|
|
62
63
|
};
|
|
63
|
-
const renderless = (props, { onMounted, reactive, watch }, { emit, nextTick, refs }) => {
|
|
64
|
+
const renderless = (props, { computed, onMounted, reactive, watch }, { emit, nextTick, refs }) => {
|
|
64
65
|
const api2 = {};
|
|
65
|
-
const state = initState(reactive);
|
|
66
|
+
const state = initState({ computed, reactive });
|
|
66
67
|
initApi({ api: api2, props, state, emit, nextTick, refs });
|
|
67
68
|
initWatch({ watch, props, state, refs, nextTick });
|
|
68
69
|
onMounted(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-renderless",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.6",
|
|
4
4
|
"description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
|
|
5
5
|
"homepage": "https://opentiny.design/tiny-vue",
|
|
6
6
|
"keywords": [
|
package/pull-refresh/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
} from "../chunk-PKUHTIDK.js";
|
|
4
4
|
import { on, off } from "@opentiny/vue-renderless/common/deps/dom";
|
|
5
5
|
const initPullRefresh = ({ t, props, state }) => () => {
|
|
6
|
-
var _a, _b, _c;
|
|
7
6
|
const defaultOption = {
|
|
8
7
|
pullingUpText: t("ui.pullRefresh.pullingUp"),
|
|
9
8
|
pullingDownText: t("ui.pullRefresh.pullingDown"),
|
|
@@ -18,16 +17,17 @@ const initPullRefresh = ({ t, props, state }) => () => {
|
|
|
18
17
|
paddingTop: state.pullDown.headHeight + "px",
|
|
19
18
|
paddingBottom: state.pullUp.footHeight + "px"
|
|
20
19
|
};
|
|
21
|
-
state.loosingText = (_a = props.loosingText) != null ? _a : t("ui.pullRefresh.loosing");
|
|
22
|
-
state.successText = (_b = props.successText) != null ? _b : t("ui.pullRefresh.success");
|
|
23
|
-
state.failedText = (_c = props.failedText) != null ? _c : t("ui.pullRefresh.failed");
|
|
24
20
|
};
|
|
25
21
|
const onTouchstart = (state) => (event) => {
|
|
26
22
|
state.draggposition = event.touches[0].clientY;
|
|
27
23
|
};
|
|
28
|
-
const onTouchmove = ({ props, state }) => (event) => {
|
|
24
|
+
const onTouchmove = ({ props, state, refs }) => (event) => {
|
|
29
25
|
if (event.touches[0].clientY < state.draggposition) {
|
|
30
|
-
|
|
26
|
+
const scrollBottom = refs.content.scrollHeight - refs.content.clientHeight - refs.content.scrollTop;
|
|
27
|
+
if (scrollBottom > 10) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (!state.pullUp.pullUpDisabled && state.pullUp.handler) {
|
|
31
31
|
if (props.hasMore) {
|
|
32
32
|
state.translate3d = (event.touches[0].clientY - state.draggposition) / 2;
|
|
33
33
|
state.pullUpReplaces = Math.abs(state.translate3d) > state.pullUp.footHeight ? state.loosingText : state.pullUp.pullingUpText;
|
|
@@ -35,7 +35,10 @@ const onTouchmove = ({ props, state }) => (event) => {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
} else {
|
|
38
|
-
if (
|
|
38
|
+
if (refs.content.scrollTop > 10) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (!state.pullDown.pullDownDisabled && state.pullDown.handler) {
|
|
39
42
|
state.translate3d = (event.touches[0].clientY - state.draggposition) / 2;
|
|
40
43
|
state.pullDownReplaces = Math.abs(state.translate3d) > state.pullDown.headHeight ? state.loosingText : state.pullDown.pullingDownText;
|
|
41
44
|
state.pullUpReplaces = "";
|
package/pull-refresh/vue.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
2
|
import { mountedHandler, beforeUnmountHandler, handlerModelValue, onTouchstart, onTouchmove, onTouchend, initPullRefresh, clearPullRefresh } from "./index";
|
|
3
3
|
const api = ["state"];
|
|
4
|
-
const renderless = (props, { watch, onMounted, reactive, onBeforeUnmount }, { t, refs }) => {
|
|
4
|
+
const renderless = (props, { watch, onMounted, computed, reactive, onBeforeUnmount }, { t, refs }) => {
|
|
5
5
|
const api2 = {};
|
|
6
6
|
const state = reactive({
|
|
7
7
|
pullUpReplaces: "",
|
|
@@ -11,10 +11,10 @@ const renderless = (props, { watch, onMounted, reactive, onBeforeUnmount }, { t,
|
|
|
11
11
|
draggposition: 0,
|
|
12
12
|
pullUpLoading: false,
|
|
13
13
|
pullDownLoading: false,
|
|
14
|
-
loosingText: "",
|
|
15
|
-
successText: "",
|
|
16
|
-
failedText: "",
|
|
17
|
-
noMoreText: "",
|
|
14
|
+
loosingText: computed(() => props.loosingText || t("ui.pullRefresh.loosing")),
|
|
15
|
+
successText: computed(() => props.successText || t("ui.pullRefresh.success")),
|
|
16
|
+
failedText: computed(() => props.failedText || t("ui.pullRefresh.failed")),
|
|
17
|
+
noMoreText: computed(() => !props.hasMore ? t("ui.pullRefresh.noMore") : ""),
|
|
18
18
|
pullUp: null,
|
|
19
19
|
pullDown: null,
|
|
20
20
|
successDuration: props.successDuration,
|
|
@@ -23,7 +23,7 @@ const renderless = (props, { watch, onMounted, reactive, onBeforeUnmount }, { t,
|
|
|
23
23
|
Object.assign(api2, {
|
|
24
24
|
state,
|
|
25
25
|
onTouchstart: onTouchstart(state),
|
|
26
|
-
onTouchmove: onTouchmove({ props, state }),
|
|
26
|
+
onTouchmove: onTouchmove({ props, state, refs }),
|
|
27
27
|
onTouchend: onTouchend({ api: api2, props, state }),
|
|
28
28
|
mountedHandler: mountedHandler({ api: api2, refs }),
|
|
29
29
|
beforeUnmountHandler: beforeUnmountHandler({ api: api2, refs }),
|
|
@@ -35,7 +35,7 @@ const renderless = (props, { watch, onMounted, reactive, onBeforeUnmount }, { t,
|
|
|
35
35
|
() => props.hasMore,
|
|
36
36
|
(value) => {
|
|
37
37
|
if (!value) {
|
|
38
|
-
state.
|
|
38
|
+
state.pullUpLoading = false;
|
|
39
39
|
api2.clearPullRefresh();
|
|
40
40
|
}
|
|
41
41
|
}
|
package/slider/index.js
CHANGED
|
@@ -152,10 +152,17 @@ const calcCurrentValue = ({ currentValue, props, state }) => {
|
|
|
152
152
|
currentValue = props.max;
|
|
153
153
|
} else {
|
|
154
154
|
const step = props.step > 0 ? props.step : 1;
|
|
155
|
+
let stepPrecision = 0;
|
|
156
|
+
if (step - parseInt(step) > 0) {
|
|
157
|
+
stepPrecision = step.toString().split(".")[1].length;
|
|
158
|
+
}
|
|
155
159
|
const stepValue = (currentValue - props.min) % step;
|
|
156
|
-
if (stepValue
|
|
160
|
+
if (stepValue) {
|
|
157
161
|
currentValue -= stepValue;
|
|
158
162
|
currentValue += stepValue * 2 > step ? Number(step) : 0;
|
|
163
|
+
if (stepPrecision) {
|
|
164
|
+
currentValue = currentValue.toFixed(stepPrecision);
|
|
165
|
+
}
|
|
159
166
|
}
|
|
160
167
|
if (state.isDouble) {
|
|
161
168
|
if (state.activeIndex === 0 && currentValue >= state.rightBtnValue) {
|
package/tabs/index.js
CHANGED
package/tooltip/vue.js
CHANGED
|
@@ -24,7 +24,6 @@ const api = [
|
|
|
24
24
|
"show",
|
|
25
25
|
"doDestroy",
|
|
26
26
|
"handleFocus",
|
|
27
|
-
"setExpectedState",
|
|
28
27
|
"debounceClose",
|
|
29
28
|
"handleShowPopper",
|
|
30
29
|
"handleClosePopper",
|
|
@@ -56,7 +55,7 @@ const renderless = (props, { watch, toRefs, reactive, onBeforeUnmount, onDeactiv
|
|
|
56
55
|
show: show({ api: api2, state, props }),
|
|
57
56
|
hide: hide(api2),
|
|
58
57
|
destroyed: destroyed({ state, api: api2 }),
|
|
59
|
-
bindPopper: bindPopper({ vm, refs,
|
|
58
|
+
bindPopper: bindPopper({ vm, refs, nextTick }),
|
|
60
59
|
watchFocusing: watchFocusing(state),
|
|
61
60
|
removeFocusing: removeFocusing(state),
|
|
62
61
|
handleBlur: handleBlur({ api: api2, state }),
|