@opentiny/vue-renderless 3.18.0 → 3.18.2

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/common/index.js CHANGED
@@ -237,7 +237,7 @@ const CASCADER = {
237
237
  PropsHover: "hoverThreshold",
238
238
  MenuConnector: "cascader-menu-"
239
239
  };
240
- const version = "3.18.0";
240
+ const version = "3.18.2";
241
241
  const log = (data, type = "log") => {
242
242
  uLog.logger[type](data);
243
243
  };
package/common/runtime.js CHANGED
@@ -22,7 +22,7 @@ import vuePopup from "./deps/vue-popup";
22
22
  import validate from "./validate";
23
23
  import memorize from "./deps/memorize";
24
24
  import * as common from ".";
25
- const version = "3.18.0";
25
+ const version = "3.18.2";
26
26
  const Renderless = {
27
27
  browser,
28
28
  array,
package/modal/index.js CHANGED
@@ -71,6 +71,7 @@ const beforeUnmouted = ({ api, parent, isMobileFirstMode }) => () => {
71
71
  isMobileFirstMode && off(window, "resize", api.resetDragStyle);
72
72
  off(document, "keydown", api.handleGlobalKeydownEvent);
73
73
  off(window, "hashchange", api.handleHashChange);
74
+ off(window, "resize", api.resetModalViewPosition);
74
75
  api.removeMsgQueue();
75
76
  api.hideScrollbar();
76
77
  if (parent.$el.parentNode) {
@@ -179,6 +180,7 @@ const open = ({
179
180
  if (modalBoxElem.offsetHeight + modalBoxElem.offsetTop + props.marginSize > clientVisibleHeight) {
180
181
  modalBoxElem.style.top = `${props.marginSize}px`;
181
182
  }
183
+ on(window, "resize", api.resetModalViewPosition);
182
184
  }
183
185
  if (props.fullscreen) {
184
186
  nextTick(api.maximize);
@@ -668,6 +670,12 @@ const showScrollbar = (lockScrollClass) => () => {
668
670
  const hideScrollbar = (lockScrollClass) => () => {
669
671
  removeClass(document.body, lockScrollClass);
670
672
  };
673
+ const resetModalViewPosition = (api) => () => {
674
+ const modalBoxElement = api.getBox();
675
+ const viewportWindow = getViewportWindow();
676
+ const clientVisibleWidth = viewportWindow.document.documentElement.clientWidth || viewportWindow.document.body.clientWidth;
677
+ modalBoxElement.style.left = `${clientVisibleWidth / 2 - modalBoxElement.offsetWidth / 2}px`;
678
+ };
671
679
  export {
672
680
  MsgQueue,
673
681
  addMsgQueue,
@@ -694,6 +702,7 @@ export {
694
702
  removeMsgQueue,
695
703
  resetDragStyle,
696
704
  resetFormTip,
705
+ resetModalViewPosition,
697
706
  revert,
698
707
  selfClickEvent,
699
708
  showScrollbar,
package/modal/vue.js CHANGED
@@ -26,6 +26,7 @@ import {
26
26
  cancelEvent,
27
27
  open,
28
28
  resetDragStyle,
29
+ resetModalViewPosition,
29
30
  computedBoxStyle,
30
31
  handleHashChange,
31
32
  showScrollbar,
@@ -51,7 +52,8 @@ const api = [
51
52
  "cancelEvent",
52
53
  "open",
53
54
  "beforeUnmouted",
54
- "resetDragStyle"
55
+ "resetDragStyle",
56
+ "resetModalViewPosition"
55
57
  ];
56
58
  const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, watch }, { vm, emit, emitter, nextTick, broadcast, vm: parent, constants, mode }, { isMobileFirstMode }) => {
57
59
  const api2 = {};
@@ -100,6 +102,7 @@ const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, wat
100
102
  mousedownEvent: mousedownEvent({ api: api2, nextTick, props, state, emit, isMobileFirstMode }),
101
103
  dragEvent: dragEvent({ api: api2, emit, parent, props, state }),
102
104
  resetDragStyle: resetDragStyle(api2),
105
+ resetModalViewPosition: resetModalViewPosition(api2),
103
106
  computedBoxStyle: computedBoxStyle({ props, isMobileFirstMode }),
104
107
  watchVisible: watchVisible({ api: api2, props }),
105
108
  hideScrollbar: hideScrollbar(lockScrollClass),
package/nav-menu/index.js CHANGED
@@ -144,8 +144,8 @@ const mounted = ({
144
144
  api.calcWidth();
145
145
  on(window, "resize", api.calcWidth);
146
146
  if (router) {
147
- state.afterEach = () => {
148
- api.setActiveMenu(api.getSelectedIndex(router.currentRoute.path));
147
+ state.afterEach = (to) => {
148
+ api.setActiveMenu(api.getSelectedIndex(to.path));
149
149
  };
150
150
  router.afterEach(state.afterEach);
151
151
  }
@@ -160,6 +160,8 @@ const unMounted = ({ api, state, router }) => () => {
160
160
  off(window, "resize", api.calcWidth);
161
161
  };
162
162
  const getSelectedIndex = (state) => (path) => {
163
+ if (!path)
164
+ return;
163
165
  let length = state.data.length;
164
166
  let index = -1;
165
167
  if (path !== "/") {
@@ -322,6 +324,8 @@ const clickMenu = ({ api, props, state }) => (item, index, parentIndex) => {
322
324
  }
323
325
  };
324
326
  const skip = ({ api, router, fields }) => (item, flag = false) => {
327
+ if (!router)
328
+ return;
325
329
  if (item.isFullUrl) {
326
330
  const { urlField = "url" } = fields || {};
327
331
  const router2 = item[urlField] || item.route;
@@ -329,7 +333,7 @@ const skip = ({ api, router, fields }) => (item, flag = false) => {
329
333
  }
330
334
  const address = !item.route || !flag ? api.getUrl(item).replace(/^#/, "") : `/${item.route || ""}`.replace(/^\/+/, "/").replace("#/", "");
331
335
  if (address) {
332
- return router.push(address);
336
+ return router == null ? void 0 : router.push(address);
333
337
  } else {
334
338
  return "";
335
339
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/vue-renderless",
3
- "version": "3.18.0",
3
+ "version": "3.18.2",
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
  "author": "OpenTiny Team",
6
6
  "license": "MIT",
package/select/index.js CHANGED
@@ -277,7 +277,7 @@ const getOptionOfSetSelected = ({ api, props }) => {
277
277
  } else {
278
278
  option.createdSelected = false;
279
279
  }
280
- if (!option.currentLabel) {
280
+ if (!option.state.currentLabel) {
281
281
  api.clearNoMatchValue("");
282
282
  }
283
283
  return option;
@@ -221,6 +221,7 @@ interface IModalApi {
221
221
  mousedownEvent: (event: MouseEvent) => void;
222
222
  dragEvent: (event: MouseEvent) => void;
223
223
  resetDragStyle: () => void;
224
+ resetModalViewPosition: () => void;
224
225
  }
225
226
  type IModalRenderlessParamUtils = ISharedRenderlessParamUtils<IModalConstants>;
226
227
  interface IModalEmitParam {