@opentiny/vue-renderless 3.11.5 → 3.11.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.
@@ -1,5 +1,6 @@
1
1
  import "../../chunk-G2ADBYYC.js";
2
2
  import { hasOwn, isObject, isNull } from "../type";
3
+ import globalConfig from "../global";
3
4
  const isServer = typeof window === "undefined";
4
5
  const SPECIAL_CHARS_REGEXP = /([:\-_]+(.))/g;
5
6
  const MOZ_HACK_REGEXP = /^moz([A-Z])/;
@@ -134,8 +135,9 @@ const isInContainer = (el, container) => {
134
135
  };
135
136
  const isVNode = (node) => node !== null && isObject(node) && hasOwn.call(node, "componentOptions");
136
137
  const getDomNode = () => {
137
- let documentElement = document.documentElement;
138
- let bodyElem = document.body;
138
+ const viewportWindow = globalConfig.viewportWindow || window;
139
+ let documentElement = viewportWindow.document.documentElement;
140
+ let bodyElem = viewportWindow.document.body;
139
141
  return {
140
142
  scrollTop: documentElement.scrollTop || bodyElem.scrollTop,
141
143
  scrollLeft: documentElement.scrollLeft || bodyElem.scrollLeft,
@@ -3,6 +3,7 @@ import {
3
3
  } from "../../chunk-G2ADBYYC.js";
4
4
  import { on, off } from "./dom";
5
5
  import PopupManager from "./popup-manager";
6
+ import globalConfig from "../global";
6
7
  import { typeOf } from "../type";
7
8
  const positions = ["left", "right", "top", "bottom"];
8
9
  const modifiers = ["shift", "offset", "preventOverflow", "keepTogether", "arrow", "flip", "applyStyle"];
@@ -489,7 +490,7 @@ class Popper {
489
490
  let isFixed2 = data.offsets.popper.position === "fixed";
490
491
  let scrollTop = isFixed2 ? 0 : getScrollTopValue(scrollParent);
491
492
  let scrollLeft = isFixed2 ? 0 : getScrollLeftValue(scrollParent);
492
- const viewportWindow = PopupManager.viewportWindow || window;
493
+ const viewportWindow = globalConfig.viewportWindow || PopupManager.viewportWindow || window;
493
494
  boundaries = {
494
495
  top: 0 - (offsetParentRect.top - scrollTop),
495
496
  right: viewportWindow.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
@@ -0,0 +1,11 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ const globalConfig = {
3
+ viewportWindow: null
4
+ // 获取真实视口的window,解决在微前端中某些bug
5
+ };
6
+ const getViewportWindow = () => globalConfig.viewportWindow || window;
7
+ var global_default = globalConfig;
8
+ export {
9
+ global_default as default,
10
+ getViewportWindow
11
+ };
@@ -219,7 +219,7 @@ const getTreeRadio = (vm) => {
219
219
  const { nodes: plainNodes } = vm.$refs.multiTree.state.plainNodeStore;
220
220
  const currentRadio = vm.$refs.multiTree.state.currentRadio;
221
221
  const plainNode = find(plainNodes, (plainNode2) => plainNode2.node.id === currentRadio.value);
222
- return [plainNode.node.data];
222
+ return (plainNode == null ? void 0 : plainNode.node) ? [plainNode.node.data] : [];
223
223
  };
224
224
  const multiTreeCheck = ({ api, props, state, vm, nextTick }) => () => {
225
225
  const { multi, popseletor } = props;
package/dropdown/index.js CHANGED
@@ -147,7 +147,7 @@ const handleMenuItemClick = ({ props, state, emit }) => ({ itemData, vm, disable
147
147
  state.visible = false;
148
148
  }
149
149
  if (!disabled) {
150
- const data = { itemData, vm, disabled };
150
+ const data = { itemData, vm };
151
151
  emit("item-click", data);
152
152
  }
153
153
  };
package/grid/utils/dom.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "../../chunk-G2ADBYYC.js";
2
2
  import { getRowid } from "./common";
3
- import { hasClass } from "../../common/deps/dom";
3
+ import { hasClass, getDomNode } from "../../common/deps/dom";
4
4
  import { getActualTarget } from "../../common/event";
5
5
  import { arrayIndexOf } from "../static";
6
6
  const ATTR_NAME = "data-rowid";
@@ -96,16 +96,6 @@ const colToVisible = ($table, column, move) => {
96
96
  }
97
97
  });
98
98
  };
99
- const getDomNode = () => {
100
- const documentElement = document.documentElement;
101
- const bodyElement = document.body;
102
- return {
103
- scrollTop: documentElement.scrollTop || bodyElement.scrollTop,
104
- scrollLeft: documentElement.scrollLeft || bodyElement.scrollLeft,
105
- visibleHeight: documentElement.clientHeight || bodyElement.clientHeight,
106
- visibleWidth: documentElement.clientWidth || bodyElement.clientWidth
107
- };
108
- };
109
99
  const getEventTargetNode = (event, container, queryCls) => {
110
100
  let targetEl;
111
101
  let target = getActualTarget(event);
package/modal/index.js CHANGED
@@ -3,6 +3,7 @@ import { KEY_CODE } from "../common";
3
3
  import { on, off, addClass, hasClass, removeClass } from "../common/deps/dom";
4
4
  import PopupManager from "../common/deps/popup-manager";
5
5
  import { getDomNode } from "../common/deps/dom";
6
+ import { getViewportWindow } from "../common/global";
6
7
  const DragClass = "is__drag";
7
8
  const emitZoom = ({ params, parent, emit, event }) => {
8
9
  let { $listeners, events = {} } = parent;
@@ -135,8 +136,9 @@ const open = ({
135
136
  nextTick(() => {
136
137
  if (!isMobileFirstMode) {
137
138
  let modalBoxElem = api.getBox();
138
- let clientVisibleWidth = document.documentElement.clientWidth || document.body.clientWidth;
139
- let clientVisibleHeight = document.documentElement.clientHeight || document.body.clientHeight;
139
+ const viewportWindow = getViewportWindow();
140
+ let clientVisibleWidth = viewportWindow.document.documentElement.clientWidth || viewportWindow.document.body.clientWidth;
141
+ let clientVisibleHeight = viewportWindow.document.documentElement.clientHeight || viewportWindow.document.body.clientHeight;
140
142
  modalBoxElem.style.left = `${clientVisibleWidth / 2 - modalBoxElem.offsetWidth / 2}px`;
141
143
  if (modalBoxElem.offsetHeight + modalBoxElem.offsetTop + props.marginSize > clientVisibleHeight) {
142
144
  modalBoxElem.style.top = `${props.marginSize}px`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/vue-renderless",
3
- "version": "3.11.5",
3
+ "version": "3.11.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": [
@@ -61,7 +61,7 @@ const computedWrapperClass = ({ props }) => () => {
61
61
  const { vertical, reverse, textPosition, showDivider } = props;
62
62
  const wrapperClass = [];
63
63
  if (vertical) {
64
- wrapperClass.push("tiny-steps-timeline", { reverse });
64
+ wrapperClass.push("tiny-steps-timeline", { reverse, "tiny-timeline__shape-dot": props.shape === "dot" });
65
65
  } else {
66
66
  wrapperClass.push("tiny-steps-normal", textPosition === "right" ? "text-right" : "text-bottom");
67
67
  }
@@ -70,6 +70,11 @@ const computedWrapperClass = ({ props }) => () => {
70
70
  }
71
71
  return wrapperClass;
72
72
  };
73
+ const toggleFold = ({ props }) => (node) => {
74
+ const isFold = !props.data[node.index].fold;
75
+ props.data[node.index].fold = isFold;
76
+ return isFold;
77
+ };
73
78
  export {
74
79
  changeStatus,
75
80
  computedCurrent,
@@ -81,5 +86,6 @@ export {
81
86
  getDate,
82
87
  getStatus,
83
88
  getStatusCls,
84
- handleClick
89
+ handleClick,
90
+ toggleFold
85
91
  };
package/time-line/vue.js CHANGED
@@ -10,9 +10,10 @@ import {
10
10
  changeStatus,
11
11
  computedStackNodes,
12
12
  computedSpace,
13
- computedWrapperClass
13
+ computedWrapperClass,
14
+ toggleFold
14
15
  } from "./index";
15
- const api = ["state", "handleClick", "getStatusCls", "getStatus", "getDate", "changeStatus"];
16
+ const api = ["state", "handleClick", "getStatusCls", "getStatus", "getDate", "changeStatus", "toggleFold"];
16
17
  const renderless = (props, { computed, reactive, provide, watch }, { t, emit, constants }) => {
17
18
  const api2 = {};
18
19
  const state = reactive({
@@ -38,7 +39,8 @@ const renderless = (props, { computed, reactive, provide, watch }, { t, emit, co
38
39
  getStatusCls: getStatusCls({ constants, state }),
39
40
  computedStackNodes: computedStackNodes({ state, constants }),
40
41
  changeStatus: changeStatus({ state }),
41
- computedWrapperClass: computedWrapperClass({ props })
42
+ computedWrapperClass: computedWrapperClass({ props }),
43
+ toggleFold: toggleFold({ props })
42
44
  });
43
45
  provide("nodesInject", { timelineItems: state.timelineItems, nodes: state.nodes, props });
44
46
  watch(
@@ -9,7 +9,7 @@ const getStatus = ({ state, t }) => (value) => {
9
9
  return status > 0 ? t("ui.steps.done") : status === 0 ? t("ui.steps.doing") : t("ui.steps.wait");
10
10
  };
11
11
  const computedWidth = () => (width) => {
12
- return /^\d+$/.test(width) ? `${width}px` : width;
12
+ return /^\d+$/.test(String(width)) ? `${width}px` : width || "";
13
13
  };
14
14
  const handleClick = ({ emit, state }) => (node) => {
15
15
  const { index } = node || {};
@@ -39,6 +39,9 @@ const computedItemCls = ({ props, api, state }) => () => {
39
39
  const itemClass = [];
40
40
  if (api.rootProps.vertical) {
41
41
  itemClass.push("timeline");
42
+ if (props.node.type) {
43
+ itemClass.push(`timeline-item--${props.node.type}`);
44
+ }
42
45
  } else {
43
46
  itemClass.push("normal");
44
47
  }
@@ -53,7 +56,7 @@ const computedItemStyle = ({ props, state, api }) => () => {
53
56
  const { computedSpace, nodesLength } = state;
54
57
  const { textPosition, vertical } = api.rootProps;
55
58
  if (vertical) {
56
- return { height: index === nodesLength - 1 ? "" : computedSpace || "88px" };
59
+ return { height: index === nodesLength - 1 ? "" : computedSpace };
57
60
  }
58
61
  if (textPosition === "right") {
59
62
  if (computedSpace && !state.computedLineWidth) {
package/tree/index.js CHANGED
@@ -176,6 +176,22 @@ const dragEnd = ({ state, emit }) => (event2) => {
176
176
  dragState.allowDrop = true;
177
177
  dragState.showDropIndicator = false;
178
178
  };
179
+ const afterLoadHandler = ({ state, emit, props, api }) => (params) => {
180
+ const { lazy, afterLoad, showRadio } = props;
181
+ state.loaded = true;
182
+ if (lazy) {
183
+ if (state.root) {
184
+ state.root.childNodes = [...state.root.childNodes];
185
+ }
186
+ if (showRadio) {
187
+ api.setCurrentRadio();
188
+ }
189
+ }
190
+ emit("load-data", params);
191
+ if (typeof afterLoad === "function") {
192
+ afterLoad(params);
193
+ }
194
+ };
179
195
  const initTreeStore = ({ api, props, state, emit }) => () => {
180
196
  const { nodeKey, data, lazy, load, afterLoad, currentNodeKey, checkStrictly, checkDescendants } = props;
181
197
  const { defaultCheckedKeys, defaultExpandedKeys, autoExpandParent, defaultExpandAll, filterNodeMethod } = props;
@@ -185,12 +201,7 @@ const initTreeStore = ({ api, props, state, emit }) => () => {
185
201
  lazy,
186
202
  props: props.props,
187
203
  load,
188
- afterLoad(params) {
189
- !state.loaded && (state.loaded = true);
190
- lazy && state.root && (state.root.childNodes = [...state.root.childNodes]);
191
- emit("load-data", params);
192
- afterLoad && afterLoad(params);
193
- },
204
+ afterLoad: afterLoadHandler({ api, emit, props, state }),
194
205
  currentNodeKey,
195
206
  checkStrictly,
196
207
  checkDescendants,
@@ -28,7 +28,7 @@ declare const $constants: {
28
28
  };
29
29
  declare const datePickerProps: {
30
30
  type: {
31
- type: PropType<"date" | "dates" | "year" | "years" | "yearrange" | "month" | "week" | "daterange" | "datetimerange" | "monthrange" | "datetime">;
31
+ type: PropType<"date" | "dates" | "daterange" | "week" | "month" | "monthrange" | "year" | "years" | "yearrange" | "datetime" | "datetimerange">;
32
32
  default: string;
33
33
  };
34
34
  _constants: {
@@ -256,9 +256,7 @@ declare const getTip: ({ props, vm }: Pick<IDropdownItemRenderlessParams, 'props
256
256
  type IDropdownItemVm = ComponentPublicInstance & {
257
257
  type: string;
258
258
  toggle: (value: boolean, options?: object) => void;
259
- state: {
260
- showPopup: boolean;
261
- };
259
+ state: IDropdownItemState;
262
260
  } & IDropdownItemProps;
263
261
  type IDropdownItemProps = ExtractPropTypes<typeof dropdownItemProps>;
264
262
  type IDropdownItemConstants = typeof $constants;
@@ -1,4 +1,4 @@
1
1
  import 'vue';
2
- export { k as IDropdownItemApi, i as IDropdownItemConstants, q as IDropdownItemMfDataStore, p as IDropdownItemOptionStyle, h as IDropdownItemProps, m as IDropdownItemRenderlessParamUtils, l as IDropdownItemRenderlessParams, j as IDropdownItemState, n as IDropdownItemStyle, o as IDropdownItemTag, g as IDropdownItemVm } from './dropdown-item.type-e59174b8.js';
2
+ export { k as IDropdownItemApi, i as IDropdownItemConstants, q as IDropdownItemMfDataStore, p as IDropdownItemOptionStyle, h as IDropdownItemProps, m as IDropdownItemRenderlessParamUtils, l as IDropdownItemRenderlessParams, j as IDropdownItemState, n as IDropdownItemStyle, o as IDropdownItemTag, g as IDropdownItemVm } from './dropdown-item.type-77f0c8c5.js';
3
3
  import './shared.type.mjs';
4
4
  import './dropdown.type.mjs';
@@ -1,4 +1,4 @@
1
1
  import 'vue';
2
- export { b as IDropdownMenuApi, e as IDropdownMenuPopperParams, I as IDropdownMenuProps, d as IDropdownMenuRenderlessParamUtils, c as IDropdownMenuRenderlessParams, a as IDropdownMenuState, f as IDropdownMenuVm } from './dropdown-item.type-e59174b8.js';
2
+ export { b as IDropdownMenuApi, e as IDropdownMenuPopperParams, I as IDropdownMenuProps, d as IDropdownMenuRenderlessParamUtils, c as IDropdownMenuRenderlessParams, a as IDropdownMenuState, f as IDropdownMenuVm } from './dropdown-item.type-77f0c8c5.js';
3
3
  import './shared.type.mjs';
4
4
  import './dropdown.type.mjs';
@@ -1,4 +1,5 @@
1
1
  import { ExtractPropTypes } from 'vue';
2
+ import { PropType } from '@opentiny/vue-common';
2
3
  import { ISharedRenderlessParamUtils, ISharedRenderlessFunctionParams } from './shared.type.mjs';
3
4
 
4
5
  declare const $constants$1: {
@@ -10,6 +11,7 @@ declare const $constants$1: {
10
11
  STACK_NODES_MAX: number;
11
12
  LIMITED_STACK_NODES: number;
12
13
  };
14
+ type ShapeType = 'circle' | 'dot';
13
15
  declare const timelineProps: {
14
16
  _constants: {
15
17
  type: ObjectConstructor;
@@ -88,6 +90,10 @@ declare const timelineProps: {
88
90
  type: (StringConstructor | NumberConstructor)[];
89
91
  default: string;
90
92
  };
93
+ shape: {
94
+ type: PropType<ShapeType>;
95
+ default: string;
96
+ };
91
97
  tiny_mode: StringConstructor;
92
98
  tiny_mode_root: BooleanConstructor;
93
99
  tiny_template: (FunctionConstructor | ObjectConstructor)[];
@@ -96,6 +102,22 @@ declare const timelineProps: {
96
102
  tiny_chart_theme: ObjectConstructor;
97
103
  };
98
104
 
105
+ /**
106
+ * Copyright (c) 2022 - present TinyVue Authors.
107
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
108
+ *
109
+ * Use of this source code is governed by an MIT-style license.
110
+ *
111
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
112
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
113
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
114
+ *
115
+ */
116
+
117
+ declare const toggleFold: ({ props }: {
118
+ props: any;
119
+ }) => (node: ITimelineItem) => boolean;
120
+
99
121
  declare const $constants: {
100
122
  PROCESS_DONE_CLS: string;
101
123
  PROCESS_CUR_CLS: string;
@@ -155,7 +177,7 @@ declare const getDate: (dateTime: string) => {
155
177
  time: string;
156
178
  };
157
179
  declare const getStatus: ({ state, t }: Pick<ITimelineItemRenderlessParams, 'state' | 't'>) => (value: number) => string;
158
- declare const computedWidth: () => (width: string | number) => string;
180
+ declare const computedWidth: () => (width: string | number) => string | number;
159
181
  declare const handleClick: ({ emit, state }: Pick<ITimelineItemRenderlessParams, 'emit' | 'state'>) => (node: ITimelineItem) => void;
160
182
  declare const getStatusCls: ({ constants, state }: Pick<ITimelineItemRenderlessParams, 'constants' | 'state'>) => (node: ITimelineItem) => ITimelineStatusCls;
161
183
  declare const computedCurrent: ({ state, api }: Pick<ITimelineItemRenderlessParams, 'state' | 'api'>) => () => number;
@@ -182,6 +204,7 @@ declare const computedItemStyle: ({ props, state, api }: Pick<ITimelineItemRende
182
204
  type ITimelineItemProps = ExtractPropTypes<typeof timelineItemProps>;
183
205
  type ITimelineItemConstants = typeof $constants;
184
206
  type ITimelineItemRenderlessParamUtils = ISharedRenderlessParamUtils<ITimelineItemConstants>;
207
+ type TimelineItemType = 'primary' | 'success' | 'warning' | 'error' | 'info';
185
208
  interface ITimelineItemState {
186
209
  nodesLength: number;
187
210
  current: number;
@@ -217,6 +240,8 @@ interface ITimelineItem {
217
240
  time: string;
218
241
  error: boolean;
219
242
  disabled: boolean;
243
+ type: TimelineItemType;
244
+ fold?: boolean;
220
245
  }
221
246
  interface ITimelineInject {
222
247
  timelineItems: ITimelineItem[];
@@ -264,6 +289,7 @@ interface ITimelineApi {
264
289
  computedStackNodes: () => ITimelineItem[];
265
290
  changeStatus: () => boolean;
266
291
  computedWrapperClass: () => ITimelineCustomCls;
292
+ toggleFold: ReturnType<typeof toggleFold>;
267
293
  }
268
294
  type ITimelineRenderlessParams = ISharedRenderlessFunctionParams<ITimelineConstants> & {
269
295
  api: ITimelineApi;
@@ -277,4 +303,4 @@ type ITimelineCustomCls = (string | {
277
303
  [key: string]: boolean;
278
304
  })[];
279
305
 
280
- export { ITimelineItemProps as I, ITimelineItemConstants as a, ITimelineItemRenderlessParamUtils as b, ITimelineItemState as c, ITimelineItemApi as d, ITimelineItemRenderlessParams as e, ITimelineItem as f, ITimelineInject as g, ITimelineProps as h, ITimelineConstants as i, ITimelineRenderlessParamUtils as j, ITimelineState as k, ITimelineApi as l, ITimelineRenderlessParams as m, ITimelineStatusCls as n, ITimelineCustomCls as o };
306
+ export { ITimelineItemProps as I, TimelineItemType as T, ITimelineItemConstants as a, ITimelineItemRenderlessParamUtils as b, ITimelineItemState as c, ITimelineItemApi as d, ITimelineItemRenderlessParams as e, ITimelineItem as f, ITimelineInject as g, ITimelineProps as h, ITimelineConstants as i, ITimelineRenderlessParamUtils as j, ITimelineState as k, ITimelineApi as l, ITimelineRenderlessParams as m, ITimelineStatusCls as n, ITimelineCustomCls as o };
@@ -1,3 +1,4 @@
1
1
  import 'vue';
2
- export { l as ITimelineApi, i as ITimelineConstants, o as ITimelineCustomCls, h as ITimelineProps, j as ITimelineRenderlessParamUtils, m as ITimelineRenderlessParams, k as ITimelineState, n as ITimelineStatusCls } from './time-line.type-4a01d597.js';
2
+ export { l as ITimelineApi, i as ITimelineConstants, o as ITimelineCustomCls, h as ITimelineProps, j as ITimelineRenderlessParamUtils, m as ITimelineRenderlessParams, k as ITimelineState, n as ITimelineStatusCls } from './time-line.type-5f76ecc2.js';
3
3
  import './shared.type.mjs';
4
+ import '@opentiny/vue-common';
@@ -1,3 +1,4 @@
1
1
  import 'vue';
2
- export { g as ITimelineInject, f as ITimelineItem, d as ITimelineItemApi, a as ITimelineItemConstants, I as ITimelineItemProps, b as ITimelineItemRenderlessParamUtils, e as ITimelineItemRenderlessParams, c as ITimelineItemState } from './time-line.type-4a01d597.js';
2
+ export { g as ITimelineInject, f as ITimelineItem, d as ITimelineItemApi, a as ITimelineItemConstants, I as ITimelineItemProps, b as ITimelineItemRenderlessParamUtils, e as ITimelineItemRenderlessParams, c as ITimelineItemState, T as TimelineItemType } from './time-line.type-5f76ecc2.js';
3
3
  import './shared.type.mjs';
4
+ import '@opentiny/vue-common';