@opentiny/vue-renderless 3.20.2 → 3.21.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.
Files changed (94) hide show
  1. package/anchor/index.js +1 -1
  2. package/badge/vue.js +1 -1
  3. package/base-select/index.js +3 -0
  4. package/bulletin-board/index.js +1 -1
  5. package/button/index.js +1 -1
  6. package/cascader/index.js +10 -8
  7. package/cascader-panel/vue.js +1 -1
  8. package/cascader-select/column-index.js +3 -0
  9. package/chart-core/deps/utils.js +1 -1
  10. package/chart-core/index.js +1 -1
  11. package/common/browser.js +2 -0
  12. package/common/deps/eSpaceCtrl.js +3 -2
  13. package/common/deps/fastdom/singleton.js +9 -1
  14. package/common/deps/fullscreen/screenfull.js +54 -25
  15. package/common/deps/popper.js +18 -18
  16. package/common/deps/touch-emulator.js +15 -10
  17. package/common/deps/upload-ajax.js +1 -1
  18. package/common/index.js +2 -2
  19. package/common/runtime.js +1 -1
  20. package/common/string.js +5 -2
  21. package/common/validate/util.js +1 -1
  22. package/dialog-box/index.js +6 -3
  23. package/divider/index.js +47 -0
  24. package/divider/vue.js +24 -3
  25. package/dropdown/index.js +7 -6
  26. package/dropdown/vue.js +7 -3
  27. package/espace/index.js +1 -1
  28. package/fall-menu/index.js +1 -1
  29. package/file-upload/index.js +71 -67
  30. package/file-upload/vue.js +6 -6
  31. package/floatbar/index.js +1 -1
  32. package/fluent-editor/index.js +25 -9
  33. package/form/vue.js +1 -1
  34. package/grid/plugins/export.js +1 -1
  35. package/guide/index.js +1 -1
  36. package/image/index.js +1 -1
  37. package/image-viewer/index.js +3 -2
  38. package/input/vue.js +3 -0
  39. package/link/vue.js +1 -1
  40. package/locales/index.js +1 -1
  41. package/logout/index.js +1 -1
  42. package/menu/index.js +1 -1
  43. package/milestone/index.js +2 -1
  44. package/modal/index.js +0 -1
  45. package/nav-menu/index.js +80 -11
  46. package/nav-menu/vue.js +13 -1
  47. package/package.json +2 -2
  48. package/picker/index.js +10 -0
  49. package/rich-text/index.js +1 -1
  50. package/rich-text/module/file-upload.js +1 -1
  51. package/rich-text/module/image-upload.js +1 -1
  52. package/rich-text-editor/vue.js +11 -10
  53. package/roles/index.js +1 -1
  54. package/select/index.js +27 -17
  55. package/select/vue.js +33 -5
  56. package/select-dropdown/vue.js +2 -1
  57. package/split/index.js +2 -1
  58. package/statistic/index.js +5 -2
  59. package/tabbar-item/vue.js +1 -1
  60. package/tabs-mf/wheel.js +14 -9
  61. package/time-panel/index.js +8 -1
  62. package/time-panel/vue.js +2 -0
  63. package/time-spinner/index.js +2 -1
  64. package/toggle-menu/index.js +1 -1
  65. package/transfer/index.js +1 -5
  66. package/tree-menu/index.js +5 -1
  67. package/tree-menu/vue.js +5 -2
  68. package/types/alert.type.d.ts +4 -0
  69. package/types/date-picker.type.d.ts +1 -1
  70. package/types/dialog-box.type.d.ts +10 -0
  71. package/types/divider.type.d.ts +94 -0
  72. package/types/dropdown.type.d.ts +2 -0
  73. package/types/file-upload.type.d.ts +1 -1
  74. package/types/float-button.type.d.ts +2 -2
  75. package/types/form-item.type.d.ts +1 -1
  76. package/types/{form.type-f6fb4c38.d.ts → form.type-4e0ec0a1.d.ts} +2 -1
  77. package/types/form.type.d.ts +1 -1
  78. package/types/image.type.d.ts +1 -1
  79. package/types/nav-menu.type.d.ts +1 -0
  80. package/types/statistic.type.d.ts +2 -5
  81. package/types/tree-menu.type.d.ts +19 -0
  82. package/types/upload-dragger.type.d.ts +2 -2
  83. package/types/{upload-list.type-6189e4c9.d.ts → upload-list.type-eaf82b7a.d.ts} +4 -8
  84. package/types/upload-list.type.d.ts +1 -1
  85. package/types/upload.type.d.ts +1 -1
  86. package/types/user-contact.type.d.ts +1 -1
  87. package/upload-dragger/index.js +49 -24
  88. package/upload-dragger/vue.js +1 -0
  89. package/upload-list/index.js +1 -1
  90. package/upload-list/vue.js +2 -1
  91. package/user/index.js +1 -1
  92. package/user-contact/index.js +1 -1
  93. package/year-table/index.js +2 -2
  94. package/common/xss.js +0 -191
package/anchor/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
2
  import { addClass, removeClass } from "../common/deps/dom";
3
- const getEleMentBySelect = (parent, selector) => (selector == null ? void 0 : selector.startsWith("#")) ? document.getElementById("selector") : parent.querySelector(selector);
3
+ const getEleMentBySelect = (parent, selector) => (selector == null ? void 0 : selector.startsWith("#")) ? document.getElementById(selector.slice(1)) : parent.querySelector(selector);
4
4
  const setFixAnchor = ({ vm, props }) => () => {
5
5
  const { anchorWrapRef } = vm.$refs;
6
6
  if (anchorWrapRef && props.isAffix) {
package/badge/vue.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
2
  import { computedContent, computedValueRef, computedTransform } from "./index";
3
- import { xss } from "../common/xss";
3
+ import { xss } from "@opentiny/utils";
4
4
  const api = ["state"];
5
5
  const renderless = (props, { computed, reactive }, { designConfig }) => {
6
6
  const state = reactive({
@@ -19,6 +19,7 @@ import { isNull } from "../common/type";
19
19
  import { fastdom } from "../common/deps/fastdom";
20
20
  import { deepClone } from "../picker-column";
21
21
  import { escapeRegexpString } from "../option";
22
+ import { isBrowser } from "../common/browser";
22
23
  const handleComposition = ({ api, nextTick, state }) => (event) => {
23
24
  const text = event.target.value;
24
25
  if (event.type === "compositionend") {
@@ -1291,6 +1292,8 @@ const watchInitValue = ({ props, emit }) => (value) => {
1291
1292
  }
1292
1293
  };
1293
1294
  const watchShowClose = ({ nextTick, state, parent }) => () => {
1295
+ if (!isBrowser)
1296
+ return;
1294
1297
  nextTick(() => {
1295
1298
  const parentEl = parent.$el;
1296
1299
  const inputEl = parentEl.querySelector('input[data-tag="tiny-input-inner"]');
@@ -1,5 +1,5 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { xss } from "../common/xss";
2
+ import { xss } from "@opentiny/utils";
3
3
  const getRoute = (route) => `/${route || ""}`.replace(/^\/+/, "/");
4
4
  const computedDataList = ({ props, state }) => () => {
5
5
  const list = props.data[Number(state.actName) - 1] || [];
package/button/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { xss } from "../common/xss";
2
+ import { xss } from "@opentiny/utils";
3
3
  const handleClick = ({ emit, props, state, designConfig }) => (event) => {
4
4
  var _a, _b;
5
5
  const urlHref = xss.filterUrl(props.href);
package/cascader/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import browser from "../common/browser";
2
+ import browser, { isBrowser } from "../common/browser";
3
3
  import { isNull } from "../common/type";
4
4
  import debounce from "../common/deps/debounce";
5
5
  import { isEqual } from "../common/object";
@@ -237,15 +237,17 @@ const focusFirstNode = ({ vm, state }) => () => {
237
237
  }
238
238
  };
239
239
  const computePresentText = ({ props, state }) => () => {
240
- if (!isEmpty(state.checkedValue)) {
241
- const node = state.panel.getNodeByValue(state.checkedValue);
242
- if (node && (state.config.checkStrictly || node.isLeaf)) {
243
- state.presentText = node.getText(props.showAllLevels, props.separator);
244
- return;
240
+ if (isBrowser) {
241
+ if (!isEmpty(state.checkedValue)) {
242
+ const node = state.panel.getNodeByValue(state.checkedValue);
243
+ if (node && (state.config.checkStrictly || node.isLeaf)) {
244
+ state.presentText = node.getText(props.showAllLevels, props.separator);
245
+ return;
246
+ }
245
247
  }
248
+ state.inputValue = null;
249
+ state.presentText = null;
246
250
  }
247
- state.inputValue = null;
248
- state.presentText = null;
249
251
  };
250
252
  const computePresentTags = ({ api, props, state }) => () => {
251
253
  const checkedNodes = api.getCheckedNodes(state.leafOnly);
@@ -27,7 +27,7 @@ import {
27
27
  } from "./index";
28
28
  import { merge } from "../common/object";
29
29
  import { isEmpty } from "../cascader";
30
- import Store from "./store.js";
30
+ import Store from "./store";
31
31
  const api = [
32
32
  "state",
33
33
  "handleKeyDown",
@@ -1,4 +1,5 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
+ import { isBrowser } from "../common/browser";
2
3
  const DEFAULT_DURATION = 200;
3
4
  const INERTIA_TIME = 300;
4
5
  const INERTIA_DISTANCE = 15;
@@ -23,6 +24,8 @@ const setRollerStyle = ({ state }) => (index) => {
23
24
  return `transform: rotate3d(1, 0, 0, ${-state.rotation * index}deg) translate3d(0px, 0px, 104px)`;
24
25
  };
25
26
  const onTouchStart = ({ state, props, touch, vm }) => (event) => {
27
+ if (!isBrowser)
28
+ return;
26
29
  touch.start(event);
27
30
  if (state.moving) {
28
31
  const dom = vm.$refs.roller;
@@ -7,7 +7,7 @@ import { isObject, typeOf as getType, isNull } from "../../common/type";
7
7
  import _debounce from "../../common/deps/debounce";
8
8
  import _numerify from "./numerify";
9
9
  import { escapeHtml } from "../../common/string";
10
- import { xss } from "../../common/xss";
10
+ import { xss } from "@opentiny/utils";
11
11
  import { setObj, getObj, isEqual } from "../../common/object";
12
12
  import { typeOf, isObject as isObject2 } from "../../common/type";
13
13
  const debounce = (callback, delay) => _debounce(delay, false, callback);
@@ -12,7 +12,7 @@ import {
12
12
  DEFAULT_CONFIG
13
13
  } from "./deps/constants";
14
14
  import { getType, debounce, isObject, cloneDeep, isEqual, htmlHandler, get } from "./deps/utils";
15
- import { xss } from "../common/xss";
15
+ import { xss } from "@opentiny/utils";
16
16
  import setAnimation from "./modules/animation";
17
17
  import setExtend from "./modules/extend";
18
18
  import setMark from "./modules/mark";
package/common/browser.js CHANGED
@@ -23,6 +23,7 @@ const isEdge = (browser) => {
23
23
  }
24
24
  };
25
25
  const isBrowser = typeof window !== "undefined" && typeof document !== "undefined" && window.document === document;
26
+ const globalEnvironment = isBrowser ? window : global;
26
27
  var browser_default = (() => {
27
28
  const browser = {
28
29
  name: void 0,
@@ -75,5 +76,6 @@ var browser_default = (() => {
75
76
  })();
76
77
  export {
77
78
  browser_default as default,
79
+ globalEnvironment,
78
80
  isBrowser
79
81
  };
@@ -1,4 +1,5 @@
1
1
  import "../../chunk-G2ADBYYC.js";
2
+ import { isBrowser } from "../browser";
2
3
  let ws = null;
3
4
  const url = "ws://localhost";
4
5
  const ports = [27197, 27198, 27199];
@@ -268,7 +269,7 @@ out.addContactList = function(account, cb) {
268
269
  cb
269
270
  );
270
271
  };
271
- if (!window.WebSocket) {
272
+ if (!isBrowser || !window.WebSocket) {
272
273
  const notFn = function() {
273
274
  return void 0;
274
275
  };
@@ -283,7 +284,7 @@ if (!window.WebSocket) {
283
284
  }
284
285
  let initialized = false;
285
286
  function init() {
286
- if (!initialized) {
287
+ if (!initialized && isBrowser) {
287
288
  localStorage.setItem("eSpaceCtrl_initialized", 0);
288
289
  out.init({ timeout: 3e3, pollingInterval: 1e3 });
289
290
  out.ready(() => {
@@ -1,5 +1,13 @@
1
1
  import "../../../chunk-G2ADBYYC.js";
2
- const RAF = window.requestAnimationFrame;
2
+ import { isBrowser } from "../../browser";
3
+ const RAF = function() {
4
+ if (isBrowser) {
5
+ return window.requestAnimationFrame.bind(window);
6
+ }
7
+ return function(callback) {
8
+ setTimeout(() => callback(Date.now()), 1e3 / 60);
9
+ };
10
+ }();
3
11
  const scheduleFlush = (fastdom) => {
4
12
  if (!fastdom.scheduled) {
5
13
  fastdom.scheduled = true;
@@ -1,5 +1,6 @@
1
1
  import "../../../chunk-G2ADBYYC.js";
2
2
  import { on, off } from "../dom";
3
+ import { isBrowser } from "../../browser";
3
4
  const fullscreenApi = [
4
5
  "fullscreenElement",
5
6
  "fullscreenEnabled",
@@ -36,6 +37,8 @@ const fullscreenApiMap = [fullscreenApi, fullscreenApiWebkit, fullscreenApiMoz,
36
37
  const document = typeof window !== "undefined" && typeof window.document !== "undefined" ? window.document : {};
37
38
  let fullscreenEvents = null;
38
39
  const getFullScreenEvents = () => {
40
+ if (!isBrowser)
41
+ return;
39
42
  for (let i = 0, len = fullscreenApiMap.length; i < len; i++) {
40
43
  let eventName = fullscreenApiMap[i];
41
44
  if (eventName && eventName[1] in document) {
@@ -60,12 +63,14 @@ const screenfull = {
60
63
  resolve();
61
64
  };
62
65
  this.on("change", onFullscreenEntered);
63
- element = element || document.documentElement;
64
- if (element[fullscreenEvents && fullscreenEvents.requestFullscreen]) {
65
- const promiseReturn = element[fullscreenEvents && fullscreenEvents.requestFullscreen](options);
66
+ element = element || (isBrowser ? document.documentElement : null);
67
+ if (element && fullscreenEvents && element[fullscreenEvents.requestFullscreen]) {
68
+ const promiseReturn = element[fullscreenEvents.requestFullscreen](options);
66
69
  if (promiseReturn instanceof Promise) {
67
70
  promiseReturn.then(onFullscreenEntered).catch(reject);
68
71
  }
72
+ } else {
73
+ reject(new Error("Fullscreen API not supported or element is null."));
69
74
  }
70
75
  });
71
76
  },
@@ -80,11 +85,13 @@ const screenfull = {
80
85
  resolve();
81
86
  };
82
87
  this.on("change", onFullscreenExit);
83
- if (document[fullscreenEvents && fullscreenEvents.exitFullscreen]) {
84
- const promiseReturn = document[fullscreenEvents && fullscreenEvents.exitFullscreen]();
88
+ if (isBrowser && fullscreenEvents && document[fullscreenEvents.exitFullscreen]) {
89
+ const promiseReturn = document[fullscreenEvents.exitFullscreen]();
85
90
  if (promiseReturn instanceof Promise) {
86
91
  promiseReturn.then(onFullscreenExit).catch(reject);
87
92
  }
93
+ } else {
94
+ reject(new Error("Fullscreen API not supported."));
88
95
  }
89
96
  });
90
97
  },
@@ -99,37 +106,59 @@ const screenfull = {
99
106
  },
100
107
  on(event, callback) {
101
108
  const eventName = eventNameMap[event];
102
- if (eventName) {
109
+ if (eventName && isBrowser) {
103
110
  on(document, eventName, callback);
104
111
  }
105
112
  },
106
113
  off(event, callback) {
107
114
  const eventName = eventNameMap[event];
108
- if (eventName) {
115
+ if (eventName && isBrowser) {
109
116
  off(document, eventName, callback);
110
117
  }
111
118
  },
112
- raw: fullscreenEvents
119
+ raw: fullscreenEvents || {}
113
120
  };
114
- Object.defineProperties(screenfull, {
115
- isFullscreen: {
116
- get() {
117
- return !!document[fullscreenEvents && fullscreenEvents.fullscreenElement];
118
- }
119
- },
120
- element: {
121
- enumerable: true,
122
- get() {
123
- return document[fullscreenEvents && fullscreenEvents.fullscreenElement];
121
+ if (isBrowser) {
122
+ Object.defineProperties(screenfull, {
123
+ isFullscreen: {
124
+ get() {
125
+ return !!document[fullscreenEvents && fullscreenEvents.fullscreenElement];
126
+ }
127
+ },
128
+ element: {
129
+ enumerable: true,
130
+ get() {
131
+ return document[fullscreenEvents && fullscreenEvents.fullscreenElement];
132
+ }
133
+ },
134
+ isEnabled: {
135
+ enumerable: true,
136
+ get() {
137
+ return !!document[fullscreenEvents && fullscreenEvents.fullscreenEnabled];
138
+ }
124
139
  }
125
- },
126
- isEnabled: {
127
- enumerable: true,
128
- get() {
129
- return !!document[fullscreenEvents && fullscreenEvents.fullscreenEnabled];
140
+ });
141
+ } else {
142
+ Object.defineProperties(screenfull, {
143
+ isFullscreen: {
144
+ get() {
145
+ return false;
146
+ }
147
+ },
148
+ element: {
149
+ enumerable: true,
150
+ get() {
151
+ return null;
152
+ }
153
+ },
154
+ isEnabled: {
155
+ enumerable: true,
156
+ get() {
157
+ return false;
158
+ }
130
159
  }
131
- }
132
- });
160
+ });
161
+ }
133
162
  var screenfull_default = screenfull;
134
163
  export {
135
164
  screenfull_default as default
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  __spreadValues
3
3
  } from "../../chunk-G2ADBYYC.js";
4
- import { on, off, isDisplayNone, isServer } from "./dom";
4
+ import { on, off, isDisplayNone } from "./dom";
5
5
  import PopupManager from "./popup-manager";
6
6
  import globalConfig from "../global";
7
7
  import { typeOf } from "../type";
8
+ import { isBrowser } from "../browser";
8
9
  const positions = ["left", "right", "top", "bottom"];
9
10
  const modifiers = ["shift", "offset", "preventOverflow", "keepTogether", "arrow", "flip", "applyStyle"];
10
11
  const DEFAULTS = {
@@ -186,16 +187,13 @@ const getOffsetRect = (el) => {
186
187
  const stopFn = (ev) => {
187
188
  ev.stopPropagation();
188
189
  };
189
- let resizeOb;
190
- if (!isServer) {
191
- resizeOb = new ResizeObserver((entries) => {
192
- entries.forEach((entry) => {
193
- if (entry.target.popperVm && entry.contentRect.height > 50) {
194
- entry.target.popperVm.update();
195
- }
196
- });
190
+ const resizeOb = isBrowser && typeof ResizeObserver === "function" ? new ResizeObserver((entries) => {
191
+ entries.forEach((entry) => {
192
+ if (entry.target.popperVm && entry.contentRect.height > 50) {
193
+ entry.target.popperVm.update();
194
+ }
197
195
  });
198
- }
196
+ }) : null;
199
197
  class Popper {
200
198
  constructor(reference, popper, options) {
201
199
  this.modifiers = {};
@@ -208,15 +206,17 @@ class Popper {
208
206
  this._options.modifierFns = modifiers.map((modifier) => {
209
207
  return this[modifier];
210
208
  });
211
- this._popper.setAttribute("x-placement", this._options.placement);
212
- this.state.position = this._getPopperPositionByRefernce(this._reference);
213
- setStyle(this._popper, { position: this.state.position, top: 0 });
214
- if (this._popper) {
215
- this._popper.popperVm = this;
216
- resizeOb && resizeOb.observe(this._popper);
209
+ if (isBrowser) {
210
+ this._popper.setAttribute("x-placement", this._options.placement);
211
+ this.state.position = this._getPopperPositionByRefernce(this._reference);
212
+ setStyle(this._popper, { position: this.state.position, top: 0 });
213
+ if (this._popper) {
214
+ this._popper.popperVm = this;
215
+ resizeOb && resizeOb.observe(this._popper);
216
+ }
217
+ this.update();
218
+ this._setupEventListeners();
217
219
  }
218
- this.update();
219
- this._setupEventListeners();
220
220
  }
221
221
  destroy() {
222
222
  this._popper.removeAttribute("x-placement");
@@ -1,15 +1,18 @@
1
1
  import "../../chunk-G2ADBYYC.js";
2
+ import { isBrowser } from "../browser";
2
3
  let emulated = false;
3
4
  let initiated = false;
4
5
  let eventTarget = null;
5
6
  let mouseTarget = null;
6
- const matches = Element.prototype.matches;
7
+ const matches = isBrowser ? Element.prototype.matches : null;
7
8
  const closest = (el, s) => {
8
- do {
9
- if (matches.call(el, s))
10
- return el;
11
- el = el.parentElement || el.parentNode;
12
- } while (el !== null && el.nodeType === 1);
9
+ if (isBrowser) {
10
+ do {
11
+ if (matches.call(el, s))
12
+ return el;
13
+ el = el.parentElement || el.parentNode;
14
+ } while (el !== null && el.nodeType === 1);
15
+ }
13
16
  return null;
14
17
  };
15
18
  class Touch {
@@ -86,10 +89,12 @@ const touchEmulator = () => {
86
89
  window.addEventListener("mouseup", onMouse("touchend"), true);
87
90
  };
88
91
  const emulate = () => {
89
- const supportTouch = "ontouchstart" in window;
90
- if (!emulated && !supportTouch) {
91
- emulated = true;
92
- touchEmulator();
92
+ if (isBrowser) {
93
+ const supportTouch = "ontouchstart" in window;
94
+ if (!emulated && !supportTouch) {
95
+ emulated = true;
96
+ touchEmulator();
97
+ }
93
98
  }
94
99
  };
95
100
  var touch_emulator_default = emulate;
@@ -1,6 +1,6 @@
1
1
  import "../../chunk-G2ADBYYC.js";
2
2
  import { hasOwn } from "../type";
3
- import { xss } from "../xss";
3
+ import { xss } from "@opentiny/utils";
4
4
  const getBody = (xhr) => {
5
5
  const text = xhr.responseText || xhr.response;
6
6
  if (!text) {
package/common/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { log as uLog, xss } from "./xss";
2
+ import { log as uLog, xss } from "@opentiny/utils";
3
3
  const KEY_CODE = {
4
4
  Backspace: 8,
5
5
  Tab: 9,
@@ -237,7 +237,7 @@ const CASCADER = {
237
237
  PropsHover: "hoverThreshold",
238
238
  MenuConnector: "cascader-menu-"
239
239
  };
240
- const version = "3.20.2";
240
+ const version = "3.21.0";
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.20.2";
25
+ const version = "3.21.0";
26
26
  const Renderless = {
27
27
  browser,
28
28
  array,
package/common/string.js CHANGED
@@ -2,6 +2,7 @@ import "../chunk-G2ADBYYC.js";
2
2
  import { isPlainObject, isNumber, isNumeric, isNull } from "./type";
3
3
  import { getObj, toJsonStr } from "./object";
4
4
  import { toFixed, Decimal } from "./decimal";
5
+ import { globalEnvironment, isBrowser } from "./browser";
5
6
  const formatTypes = {
6
7
  text: "text",
7
8
  url: "url",
@@ -117,7 +118,7 @@ const fillChar = (string, length, append, chr = "0") => {
117
118
  };
118
119
  const random = () => {
119
120
  let MAX_UINT32_PLUS_ONE = 4294967296;
120
- return window.crypto.getRandomValues(new window.Uint32Array(1))[0] / MAX_UINT32_PLUS_ONE;
121
+ return globalEnvironment.crypto.getRandomValues(new globalEnvironment.Uint32Array(1))[0] / MAX_UINT32_PLUS_ONE;
121
122
  };
122
123
  const guid = (prefix = "", length = 8) => prefix + random().toString().substr(2, length);
123
124
  const escapeHtml = (string, isReplaceSpace) => {
@@ -362,11 +363,13 @@ const formatFileSize = (size, baseUnit = "") => {
362
363
  };
363
364
  const isKorean = (text) => /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi.test(text);
364
365
  const omitText = (text, font, w) => {
366
+ let t;
367
+ if (!isBrowser)
368
+ return { t: text, o: false };
365
369
  const canvas = document.createElement("canvas");
366
370
  const ctx = canvas.getContext("2d");
367
371
  ctx.font = font;
368
372
  let metric = ctx.measureText(text);
369
- let t;
370
373
  if (metric.width < w) {
371
374
  return { t: text, o: false };
372
375
  } else {
@@ -2,7 +2,7 @@ import {
2
2
  __spreadValues
3
3
  } from "../../chunk-G2ADBYYC.js";
4
4
  import { hasOwn, isNull } from "../type";
5
- import { log } from "../xss";
5
+ import { log } from "@opentiny/utils";
6
6
  const formatRegExp = /%[sdj%]/g;
7
7
  const warning = () => void 0;
8
8
  function convertFieldsError(errors) {
@@ -33,6 +33,9 @@ const computedStyle = ({ props, state, designConfig }) => () => {
33
33
  style = { left: "0px", top: "0px" };
34
34
  }
35
35
  }
36
+ if (props.customStyle) {
37
+ style = Object.assign(style, props.customStyle);
38
+ }
36
39
  return style;
37
40
  };
38
41
  const watchVisible = ({
@@ -71,9 +74,9 @@ const watchVisible = ({
71
74
  if (props.destroyOnClose) {
72
75
  nextTick(() => state.key++);
73
76
  }
74
- if (props.rightSlide) {
75
- const dialogBoxDom = el.querySelector(constants.DIALOG_BOX_CLASS) || el;
76
- dialogBoxDom.style.left = "";
77
+ if (props.rightSlide && state.current !== "default") {
78
+ const selector = `[data-tag=${constants.DIALOG_BOX_DATA_TAG}]`;
79
+ props.rightSlide && (el.querySelector(selector).style.left = "");
77
80
  }
78
81
  }
79
82
  };
@@ -0,0 +1,47 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ const computedRootStyle = ({ state, props }) => () => {
3
+ return {
4
+ height: props.height || state.height,
5
+ margin: props.margin || state.margin,
6
+ fontSize: props.fontSize
7
+ };
8
+ };
9
+ const computedLineStyle = ({ props }) => () => {
10
+ const lineStyle = {
11
+ borderTopStyle: props.borderStyle
12
+ };
13
+ if (props.color) {
14
+ Object.assign(lineStyle, { borderTopColor: props.color });
15
+ }
16
+ return lineStyle;
17
+ };
18
+ const computedTextStyle = ({ props }) => () => {
19
+ const textStyle = {
20
+ left: "unset",
21
+ right: "unset"
22
+ };
23
+ const defaultOffset = "5%";
24
+ if (props.contentPosition === "left") {
25
+ textStyle.left = props.offset || defaultOffset;
26
+ } else if (props.contentPosition === "right") {
27
+ textStyle.right = props.offset || defaultOffset;
28
+ }
29
+ return textStyle;
30
+ };
31
+ const setDividerHeight = ({ state, props, vm, nextTick }) => () => {
32
+ const verticalHeight = "12px";
33
+ if (props.direction === "vertical") {
34
+ state.height = props.height || verticalHeight;
35
+ } else {
36
+ nextTick(() => {
37
+ const offsetHeight = vm.$refs.text && vm.$refs.text.offsetHeight;
38
+ state.height = props.height || offsetHeight ? offsetHeight + "px" : "auto";
39
+ });
40
+ }
41
+ };
42
+ export {
43
+ computedLineStyle,
44
+ computedRootStyle,
45
+ computedTextStyle,
46
+ setDividerHeight
47
+ };
package/divider/vue.js CHANGED
@@ -1,7 +1,28 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- const api = [];
3
- const renderless = () => {
4
- return api;
2
+ import { computedLineStyle, computedTextStyle, computedRootStyle, setDividerHeight } from "./index";
3
+ const api = ["state"];
4
+ const renderless = (props, { reactive, onMounted, computed }, { vm, nextTick }) => {
5
+ const defaultMargin = "16px 0";
6
+ const verticalMargin = "0 8px";
7
+ const api2 = {};
8
+ const state = reactive({
9
+ height: "auto",
10
+ margin: props.direction === "vertical" ? verticalMargin : defaultMargin,
11
+ lineStyle: computed(() => api2.computedLineStyle()),
12
+ textStyle: computed(() => api2.computedTextStyle()),
13
+ rootStyle: computed(() => api2.computedRootStyle())
14
+ });
15
+ Object.assign(api2, {
16
+ state,
17
+ computedLineStyle: computedLineStyle({ props }),
18
+ computedTextStyle: computedTextStyle({ props }),
19
+ computedRootStyle: computedRootStyle({ props, state }),
20
+ setDividerHeight: setDividerHeight({ props, state, vm, nextTick })
21
+ });
22
+ onMounted(() => {
23
+ api2.setDividerHeight();
24
+ });
25
+ return api2;
5
26
  };
6
27
  export {
7
28
  api,
package/dropdown/index.js CHANGED
@@ -124,9 +124,9 @@ const initEvent = ({ api, props, state, vm, mode }) => () => {
124
124
  on(state.triggerElm, "keydown", api.handleTriggerKeyDown);
125
125
  (_a = state.dropdownElm) == null ? void 0 : _a.addEventListener("keydown", api.handleItemKeyDown, true);
126
126
  if (!props.splitButton || !props.singleButton) {
127
- on(state.triggerElm, "focus", toggleFocus({ state, value: true }));
128
- on(state.triggerElm, "blur", toggleFocus({ state, value: false }));
129
- on(state.triggerElm, "click", toggleFocus({ state, value: false }));
127
+ on(state.triggerElm, "focus", api.toggleFocusOnTrue);
128
+ on(state.triggerElm, "blur", api.toggleFocusOnFalse);
129
+ on(state.triggerElm, "click", api.toggleFocusOnFalse);
130
130
  }
131
131
  if (state.trigger === "hover") {
132
132
  on(state.triggerElm, "mouseenter", api.show);
@@ -181,9 +181,9 @@ const mounted = ({ api, vm, state, broadcast }) => () => {
181
181
  const beforeDistory = ({ vm, api, state }) => () => {
182
182
  if (state.triggerElm) {
183
183
  off(state.triggerElm, "keydown", api.handleTriggerKeyDown);
184
- off(state.triggerElm, "focus", toggleFocus({ state, value: true }));
185
- off(state.triggerElm, "blur", toggleFocus({ state, value: false }));
186
- off(state.triggerElm, "click", toggleFocus({ state, value: false }));
184
+ off(state.triggerElm, "focus", api.toggleFocusOnTrue);
185
+ off(state.triggerElm, "blur", api.toggleFocusOnFalse);
186
+ off(state.triggerElm, "click", api.toggleFocusOnFalse);
187
187
  off(state.triggerElm, "mouseenter", api.show);
188
188
  off(state.triggerElm, "mouseleave", api.hide);
189
189
  off(state.triggerElm, "click", api.handleClick);
@@ -221,6 +221,7 @@ export {
221
221
  removeTabindex,
222
222
  resetTabindex,
223
223
  show,
224
+ toggleFocus,
224
225
  triggerElmFocus,
225
226
  watchFocusing,
226
227
  watchVisible