@opentiny/vue-renderless 3.6.2 → 3.6.7

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.
@@ -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
- click: true
28
+ tap: "tap"
28
29
  });
29
30
  } else {
30
31
  state.scroll.refresh();
@@ -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, { onMounted, onBeforeUnmount, inject }, { refs, router, emit }) => {
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
- onMounted(() => {
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,
@@ -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() {
@@ -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 || "";
package/common/index.js CHANGED
@@ -251,7 +251,7 @@ const EDOC = {
251
251
  constants: 320,
252
252
  twenty: 20
253
253
  };
254
- const version = "3.6.2";
254
+ const version = "3.6.6";
255
255
  const log = (data, type = "log") => {
256
256
  uLog.logger[type](data);
257
257
  };
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.2";
25
+ const version = "3.6.6";
26
26
  const Renderless = {
27
27
  browser,
28
28
  array,
@@ -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;
@@ -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.2",
3
+ "version": "3.6.7",
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": [
@@ -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
- if (!state.pullUp.pullUpDisabled) {
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 (!state.pullDown.pullDownDisabled) {
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 = "";
@@ -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.noMoreText = t("ui.pullRefresh.noMore");
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 > props.step / 10) {
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
@@ -60,6 +60,7 @@ const handleTabClick = ({ api, emit, props, refs }) => (pane, tabName, event) =>
60
60
  if (pane.disabled) {
61
61
  return;
62
62
  }
63
+ event.stopPropagation();
63
64
  api.setCurrentName(tabName);
64
65
  emit("click", pane, event);
65
66
  if (props.showExpandTabs) {
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, state, nextTick }),
58
+ bindPopper: bindPopper({ vm, refs, nextTick }),
60
59
  watchFocusing: watchFocusing(state),
61
60
  removeFocusing: removeFocusing(state),
62
61
  handleBlur: handleBlur({ api: api2, state }),