@opentiny/vue-renderless 3.21.2 → 3.22.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 (323) hide show
  1. package/amount/index.js +4 -4
  2. package/anchor/index.js +1 -1
  3. package/async-flowchart/index.js +1 -1
  4. package/autocomplete/index.js +1 -1
  5. package/autocomplete/vue.js +3 -3
  6. package/base-select/index.js +19 -19
  7. package/base-select/vue.js +2 -2
  8. package/calendar/index.js +2 -2
  9. package/calendar-bar/index.js +2 -2
  10. package/calendar-bar/vue.js +1 -1
  11. package/calendar-view/index.js +66 -22
  12. package/calendar-view/vue.js +2 -3
  13. package/card/index.js +1 -1
  14. package/card-template/index.js +1 -1
  15. package/carousel/index.js +4 -4
  16. package/carousel/vue.js +1 -1
  17. package/cascader/index.js +21 -11
  18. package/cascader/vue.js +6 -5
  19. package/cascader-menu/vue.js +2 -2
  20. package/cascader-mobile/index.js +1 -1
  21. package/cascader-panel/index.js +4 -4
  22. package/cascader-panel/node.js +3 -4
  23. package/cascader-panel/vue.js +1 -1
  24. package/cascader-select/column-index.js +2 -2
  25. package/cascader-view/index.js +1 -1
  26. package/chart-bar/index.js +1 -1
  27. package/chart-candle/index.js +1 -1
  28. package/chart-core/deps/utils.js +6 -6
  29. package/chart-core/index.js +1 -1
  30. package/chart-funnel/index.js +1 -1
  31. package/chart-gauge/index.js +1 -1
  32. package/chart-line/index.js +1 -1
  33. package/chart-map/index.js +1 -1
  34. package/chart-pie/index.js +1 -1
  35. package/chart-radar/index.js +1 -1
  36. package/chart-sankey/index.js +1 -1
  37. package/chart-scatter/index.js +1 -1
  38. package/chart-waterfall/index.js +1 -1
  39. package/chart-wordcloud/index.js +1 -1
  40. package/checkbox/index.js +1 -1
  41. package/collapse-item/vue.js +1 -1
  42. package/column-list-item/index.js +1 -1
  43. package/common/deps/dom.js +20 -196
  44. package/common/deps/infinite-scroll.js +4 -43
  45. package/common/deps/popup-manager.js +1 -200
  46. package/container/index.js +2 -2
  47. package/crop/index.js +3 -3
  48. package/currency/index.js +2 -2
  49. package/date-panel/index.js +75 -25
  50. package/date-panel/vue.js +53 -21
  51. package/date-picker/vue.js +1 -1
  52. package/date-picker-mobile/index.js +1 -1
  53. package/date-range/index.js +71 -37
  54. package/date-range/vue.js +27 -23
  55. package/date-table/index.js +8 -5
  56. package/date-table/vue.js +1 -1
  57. package/dialog-box/index.js +3 -3
  58. package/dialog-box/vue.js +1 -1
  59. package/dialog-select/vue.js +7 -4
  60. package/drawer/index.js +2 -2
  61. package/drop-times/index.js +1 -1
  62. package/dropdown/index.js +11 -3
  63. package/dropdown/vue.js +2 -2
  64. package/dropdown-item/index.js +1 -1
  65. package/dropdown-item/mf.js +1 -1
  66. package/dropdown-menu/index.js +1 -1
  67. package/espace/vue.js +2 -2
  68. package/fall-menu/index.js +3 -3
  69. package/file-upload/index.js +16 -13
  70. package/file-upload/vue.js +2 -2
  71. package/filter/vue.js +1 -1
  72. package/filter-panel/vue.js +1 -2
  73. package/floating-button/index.js +1 -1
  74. package/flowchart/index.js +3 -3
  75. package/flowchart/vue.js +1 -1
  76. package/fluent-editor/index.js +5 -7
  77. package/fluent-editor/options.js +2 -2
  78. package/form/index.js +20 -2
  79. package/form-item/index.js +6 -6
  80. package/fullscreen/index.js +1 -1
  81. package/fullscreen/vue.js +1 -1
  82. package/grid/plugins/export.js +2 -2
  83. package/grid/plugins/exportExcel.js +3 -3
  84. package/grid/plugins/resize.js +2 -2
  85. package/grid/static/base/helperEqualCompare.js +1 -1
  86. package/grid/static/base/isPlainObject.js +1 -1
  87. package/grid/utils/common.js +2 -2
  88. package/grid/utils/dom.js +12 -7
  89. package/grid/utils/event.js +4 -4
  90. package/hrapprover/index.js +1 -1
  91. package/image/index.js +3 -3
  92. package/image-viewer/index.js +4 -6
  93. package/input/index.js +2 -2
  94. package/input/vue.js +1 -1
  95. package/ip-address/index.js +17 -21
  96. package/ip-address/vue.js +1 -1
  97. package/link-menu/index.js +1 -1
  98. package/link-menu/vue.js +1 -1
  99. package/load-list/index.js +1 -1
  100. package/load-list/vue.js +4 -4
  101. package/loading/index.js +2 -2
  102. package/menu/vue.js +1 -1
  103. package/milestone/index.js +6 -45
  104. package/modal/index.js +5 -5
  105. package/month-range/index.js +45 -5
  106. package/month-range/vue.js +19 -15
  107. package/month-table/index.js +5 -5
  108. package/month-table/vue.js +1 -1
  109. package/nav-menu/index.js +7 -7
  110. package/notify/index.js +3 -3
  111. package/numeric/index.js +5 -5
  112. package/option/index.js +1 -1
  113. package/option/vue.js +2 -1
  114. package/package.json +3 -2
  115. package/pager/index.js +28 -16
  116. package/pager/vue.js +27 -16
  117. package/panel/index.js +1 -1
  118. package/picker/index.js +11 -11
  119. package/picker/vue.js +2 -2
  120. package/picker-column/index.js +1 -1
  121. package/pop-upload/vue.js +1 -1
  122. package/popconfirm/vue.js +1 -1
  123. package/popeditor/index.js +6 -6
  124. package/popeditor/vue.js +2 -2
  125. package/popover/index.js +3 -3
  126. package/popover/vue.js +1 -1
  127. package/popup/index.js +3 -3
  128. package/pull-refresh/index.js +1 -1
  129. package/pull-refresh-mobile-first/index.js +1 -1
  130. package/pull-refresh-mobile-first/vue.js +4 -4
  131. package/quarter-panel/index.js +2 -2
  132. package/quarter-panel/vue.js +1 -1
  133. package/radio-group/index.js +1 -1
  134. package/rate/index.js +1 -1
  135. package/rate/vue.js +1 -1
  136. package/recycle-scroller/index.js +2 -2
  137. package/recycle-scroller/vue.js +1 -1
  138. package/rich-text/index.js +1 -1
  139. package/rich-text/table-module.js +2 -2
  140. package/river/river.js +1 -1
  141. package/river/vue.js +1 -1
  142. package/scrollbar/vue-bar.js +1 -1
  143. package/scrollbar/vue.js +1 -1
  144. package/search/index.js +3 -3
  145. package/select/index.js +26 -22
  146. package/select/vue.js +8 -7
  147. package/select-dropdown/vue.js +5 -5
  148. package/selected-box/index.js +1 -1
  149. package/signature/index.js +1 -1
  150. package/signature/vue.js +2 -2
  151. package/skeleton/index.js +1 -1
  152. package/slider/index.js +4 -4
  153. package/slider-button-group/slide-button.js +2 -2
  154. package/split/index.js +2 -2
  155. package/split/vue.js +1 -1
  156. package/statistic/index.js +1 -1
  157. package/steps/index.js +2 -3
  158. package/steps/slide-bar.js +2 -2
  159. package/sticky/vue.js +4 -4
  160. package/tab-bar/index.js +2 -2
  161. package/tab-item-mf/vue.js +1 -1
  162. package/tab-nav/index.js +4 -4
  163. package/tabbar/index.js +1 -1
  164. package/tabbar/vue.js +1 -1
  165. package/tabbar-item/index.js +1 -1
  166. package/tabs-mf/index.js +5 -5
  167. package/tabs-mf/vue-bar.js +1 -1
  168. package/tabs-mf/vue-swipe.js +1 -1
  169. package/tabs-mf/vue.js +2 -2
  170. package/tabs-mf/wheel.js +3 -3
  171. package/tag-group/vue.js +2 -2
  172. package/tall-storage/index.js +1 -1
  173. package/tall-storage/vue.js +1 -1
  174. package/time/index.js +1 -1
  175. package/time/vue.js +1 -1
  176. package/time-line/index.js +1 -1
  177. package/time-line-new/index.js +1 -1
  178. package/time-panel/index.js +2 -2
  179. package/time-panel/vue.js +1 -1
  180. package/time-range/index.js +1 -1
  181. package/time-range/vue.js +1 -1
  182. package/time-spinner/index.js +4 -4
  183. package/time-spinner/vue.js +1 -1
  184. package/timeline-item/index.js +1 -1
  185. package/toggle-menu/index.js +1 -1
  186. package/tooltip/index.js +2 -2
  187. package/tooltip/vue.js +2 -2
  188. package/top-box/index.js +3 -3
  189. package/transfer/index.js +1 -1
  190. package/transfer-panel/index.js +1 -1
  191. package/tree/index.js +9 -9
  192. package/tree/vue.js +2 -2
  193. package/tree-node/index.js +1 -1
  194. package/tree-node/vue.js +1 -1
  195. package/tree-select/index.js +1 -1
  196. package/types/async-flowchart.type.d.ts +2 -14
  197. package/types/breadcrumb-item.type.d.ts +5 -1
  198. package/types/breadcrumb.type.d.ts +5 -1
  199. package/types/button-group.type.d.ts +5 -1
  200. package/types/button.type.d.ts +1 -1
  201. package/types/cascader.type.d.ts +6 -1
  202. package/types/date-table.type.d.ts +1 -120
  203. package/types/dropdown.type.d.ts +1 -1
  204. package/types/label.type.d.ts +1 -53
  205. package/types/loading.type.d.ts +12 -0
  206. package/types/numeric.type.d.ts +3 -22
  207. package/types/pager.type.d.ts +12 -7
  208. package/types/popconfirm.type.d.ts +2 -0
  209. package/types/steps.type.d.ts +1 -0
  210. package/types/tag-group.type.d.ts +2 -14
  211. package/types/tag.type.d.ts +4 -4
  212. package/types/tooltip.type.d.ts +3 -13
  213. package/types/user-head.type.d.ts +0 -4
  214. package/upload/index.js +1 -1
  215. package/upload-list/index.js +1 -1
  216. package/upload-list/vue.js +4 -4
  217. package/user/index.js +7 -7
  218. package/user/vue.js +15 -2
  219. package/user-contact/vue.js +2 -2
  220. package/virtual-scroll-box/index.js +2 -2
  221. package/wizard/index.js +3 -3
  222. package/year-range/index.js +61 -11
  223. package/year-range/vue.js +33 -20
  224. package/year-table/index.js +7 -5
  225. package/avatar/index.js +0 -30
  226. package/avatar/vue.js +0 -22
  227. package/common/array.js +0 -115
  228. package/common/bigInt.js +0 -315
  229. package/common/browser.js +0 -81
  230. package/common/calendar/calendar.js +0 -97
  231. package/common/dataset/index.js +0 -99
  232. package/common/date.js +0 -354
  233. package/common/decimal.js +0 -155
  234. package/common/deps/ResizeObserver.js +0 -456
  235. package/common/deps/after-leave.js +0 -27
  236. package/common/deps/clickoutside.js +0 -75
  237. package/common/deps/date-util.js +0 -255
  238. package/common/deps/date.js +0 -286
  239. package/common/deps/debounce.js +0 -8
  240. package/common/deps/eSpaceCtrl.js +0 -304
  241. package/common/deps/fastdom/async.js +0 -41
  242. package/common/deps/fastdom/index.js +0 -9
  243. package/common/deps/fastdom/sandbox.js +0 -53
  244. package/common/deps/fastdom/singleton.js +0 -88
  245. package/common/deps/fullscreen/apis.js +0 -143
  246. package/common/deps/fullscreen/screenfull.js +0 -165
  247. package/common/deps/memorize.js +0 -124
  248. package/common/deps/observe-visibility.js +0 -106
  249. package/common/deps/popper.js +0 -616
  250. package/common/deps/repeat-click.js +0 -29
  251. package/common/deps/resize-event.js +0 -39
  252. package/common/deps/scroll-into-view.js +0 -29
  253. package/common/deps/scrollbar-width.js +0 -33
  254. package/common/deps/throttle.js +0 -45
  255. package/common/deps/touch-emulator.js +0 -103
  256. package/common/deps/touch.js +0 -37
  257. package/common/deps/tree-model/node.js +0 -475
  258. package/common/deps/tree-model/tree-store.js +0 -312
  259. package/common/deps/tree-model/util.js +0 -24
  260. package/common/deps/upload-ajax.js +0 -81
  261. package/common/deps/useEventListener.js +0 -54
  262. package/common/deps/useInstanceSlots.js +0 -22
  263. package/common/deps/useRect.js +0 -25
  264. package/common/deps/useRelation.js +0 -89
  265. package/common/deps/useTouch.js +0 -68
  266. package/common/deps/useUserAgent.js +0 -16
  267. package/common/deps/useWindowSize.js +0 -23
  268. package/common/deps/vue-emitter.js +0 -34
  269. package/common/deps/vue-popper.js +0 -180
  270. package/common/deps/vue-popup.js +0 -138
  271. package/common/event.js +0 -46
  272. package/common/form/const.js +0 -10
  273. package/common/function.js +0 -28
  274. package/common/global.js +0 -11
  275. package/common/index.js +0 -259
  276. package/common/object.js +0 -227
  277. package/common/prop-util.js +0 -43
  278. package/common/runtime.js +0 -79
  279. package/common/string.js +0 -417
  280. package/common/type.js +0 -66
  281. package/common/validate/index.js +0 -10
  282. package/common/validate/messages.js +0 -65
  283. package/common/validate/rules/enum.js +0 -12
  284. package/common/validate/rules/index.js +0 -18
  285. package/common/validate/rules/pattern.js +0 -20
  286. package/common/validate/rules/range.js +0 -52
  287. package/common/validate/rules/required.js +0 -11
  288. package/common/validate/rules/type.js +0 -100
  289. package/common/validate/rules/whitespace.js +0 -10
  290. package/common/validate/schema.js +0 -290
  291. package/common/validate/util.js +0 -211
  292. package/common/validate/validations/array.js +0 -22
  293. package/common/validate/validations/date.js +0 -31
  294. package/common/validate/validations/enum.js +0 -22
  295. package/common/validate/validations/float.js +0 -22
  296. package/common/validate/validations/index.js +0 -46
  297. package/common/validate/validations/integer.js +0 -22
  298. package/common/validate/validations/method.js +0 -21
  299. package/common/validate/validations/number.js +0 -25
  300. package/common/validate/validations/pattern.js +0 -21
  301. package/common/validate/validations/required.js +0 -11
  302. package/common/validate/validations/string.js +0 -33
  303. package/common/validate/validations/type.js +0 -29
  304. package/index-bar/index.js +0 -66
  305. package/index-bar/vue.js +0 -73
  306. package/index-bar-anchor/vue.js +0 -16
  307. package/label/index.js +0 -56
  308. package/label/vue.js +0 -26
  309. package/list/index.js +0 -13
  310. package/list/vue.js +0 -17
  311. package/mask/index.js +0 -13
  312. package/mask/vue.js +0 -18
  313. package/mini-picker/index.js +0 -165
  314. package/mini-picker/vue.js +0 -122
  315. package/multi-select/index.js +0 -394
  316. package/multi-select/vue.js +0 -113
  317. package/multi-select-item/index.js +0 -23
  318. package/multi-select-item/vue.js +0 -31
  319. package/toast/index.js +0 -7
  320. package/toast/vue.js +0 -19
  321. package/types/toast.type.d.ts +0 -63
  322. package/wheel/index.js +0 -165
  323. package/wheel/vue.js +0 -79
package/common/bigInt.js DELETED
@@ -1,315 +0,0 @@
1
- import "../chunk-G2ADBYYC.js";
2
- import { fillChar } from "./string";
3
- import { isBrowser } from "./browser";
4
- const BigInt = isBrowser ? window.BigInt : global.BigInt;
5
- function supportBigInt() {
6
- return typeof BigInt === "function";
7
- }
8
- function trimNumber(numStr) {
9
- let string = numStr.toString().trim();
10
- let negative = string.startsWith("-");
11
- if (negative) {
12
- string = string.slice(1);
13
- }
14
- string = string.replace(/(\.\d*[^0])0*$/, "$1").replace(/\.0*$/, "").replace(/^0+/, "");
15
- if (string.startsWith(".")) {
16
- string = "0".concat(string);
17
- }
18
- let trimStr = string || "0";
19
- let splitNumber = trimStr.split(".");
20
- let integerStr = splitNumber[0] || "0";
21
- let decimalStr = splitNumber[1] || "0";
22
- if (integerStr === "0" && decimalStr === "0") {
23
- negative = false;
24
- }
25
- let negativeStr = negative ? "-" : "";
26
- return {
27
- negative,
28
- negativeStr,
29
- trimStr,
30
- integerStr,
31
- decimalStr,
32
- fullStr: "".concat(negativeStr).concat(trimStr)
33
- };
34
- }
35
- function isE(number) {
36
- let str = String(number);
37
- return !isNaN(Number(str)) && ~str.indexOf("e");
38
- }
39
- function validateNumber(num) {
40
- if (typeof num === "number") {
41
- return !isNaN(num);
42
- }
43
- if (!num) {
44
- return false;
45
- }
46
- return (
47
- // Normal type: 11.28
48
- /^\s*-?\d+(\.\d+)?\s*$/.test(num) || // Pre-number: 1.
49
- /^\s*-?\d+\.\s*$/.test(num) || // Post-number: .1
50
- /^\s*-?\.\d+\s*$/.test(num)
51
- );
52
- }
53
- function getNumberPrecision(number) {
54
- let numStr = String(number);
55
- if (isE(number)) {
56
- let precision = Number(numStr.slice(numStr.indexOf("e-") + 2));
57
- let decimalMatch = numStr.match(/\.(\d+)/);
58
- if (decimalMatch === null || decimalMatch === void 0 ? void 0 : decimalMatch[1]) {
59
- precision += decimalMatch[1].length;
60
- }
61
- return precision;
62
- }
63
- return ~numStr.indexOf(".") && validateNumber(numStr) ? numStr.length - numStr.indexOf(".") - 1 : 0;
64
- }
65
- function num2str(number) {
66
- let numStr = String(number);
67
- if (isE(number)) {
68
- if (number > Number.MAX_SAFE_INTEGER) {
69
- return String(supportBigInt() ? BigInt(number).toString() : Number.MAX_SAFE_INTEGER);
70
- }
71
- if (number < Number.MIN_SAFE_INTEGER) {
72
- return String(supportBigInt() ? BigInt(number).toString() : Number.MIN_SAFE_INTEGER);
73
- }
74
- numStr = number.toFixed(getNumberPrecision(numStr));
75
- }
76
- return trimNumber(numStr).fullStr;
77
- }
78
- function pluginDecimal(decimal) {
79
- if (!decimal.add) {
80
- Object.assign(decimal, {
81
- add: decimal.plus,
82
- lessEquals: decimal.isLessThan,
83
- equals: decimal.isEqualTo
84
- });
85
- }
86
- return decimal;
87
- }
88
- const DecimalCls = {
89
- CLS: null
90
- };
91
- let setDecimalClass;
92
- function getMiniDecimal(value, decimal) {
93
- if (!DecimalCls.CLS) {
94
- setDecimalClass(decimal);
95
- }
96
- return pluginDecimal(new DecimalCls.CLS(value));
97
- }
98
- class BigIntDecimal {
99
- constructor(value) {
100
- if (!value && value !== 0 || !String(value).trim()) {
101
- this.empty = true;
102
- return;
103
- }
104
- this.origin = String(value);
105
- this.negative = void 0;
106
- this.integer = void 0;
107
- this.decimal = void 0;
108
- this.decimalLen = void 0;
109
- this.empty = void 0;
110
- this.nan = void 0;
111
- if (value === "-") {
112
- this.nan = true;
113
- return;
114
- }
115
- let mergedValue = isE(value) ? Number(value) : value;
116
- if (typeof mergedValue !== "string") {
117
- num2str(mergedValue);
118
- }
119
- const f = Function;
120
- const convertBigInt = (str) => {
121
- const validStr = str.replace(/^0+/, "") || "0";
122
- return f(`return BigInt('${validStr}')`)();
123
- };
124
- if (validateNumber(mergedValue)) {
125
- const trimRet = trimNumber(mergedValue);
126
- this.negative = trimRet.negative;
127
- const numbers = trimRet.trimStr.split(".");
128
- this.integer = !numbers[0].includes("e") ? BigInt(numbers[0]) : numbers[0];
129
- const decimalStr = numbers[1] || "0";
130
- this.decimal = decimalStr.includes("e") ? convertBigInt(decimalStr) : BigInt(decimalStr);
131
- this.decimalLen = decimalStr.length;
132
- } else {
133
- this.nan = true;
134
- }
135
- }
136
- getDecimalStr() {
137
- return this.decimal.toString().padStart(this.decimalLen, "0");
138
- }
139
- getIntegerStr() {
140
- return this.integer.toString();
141
- }
142
- getMark() {
143
- return this.negative ? "-" : "";
144
- }
145
- /**
146
- * Align BigIntDecimal with same decimal length. e.g. 12.3 + 5 = 1230000
147
- * This is used for add function only.
148
- */
149
- alignDecimal(decimalLength) {
150
- const string = `${this.getMark()}${this.getIntegerStr()}${this.getDecimalStr().padEnd(decimalLength, "0")}`;
151
- return BigInt(string);
152
- }
153
- add(value) {
154
- if (this.isInvalidate()) {
155
- return new BigIntDecimal(value);
156
- }
157
- const offsetObj = new BigIntDecimal(value);
158
- if (offsetObj.isInvalidate()) {
159
- return this;
160
- }
161
- const maxDecimalLength = Math.max(this.getDecimalStr().length, offsetObj.getDecimalStr().length);
162
- const offsetAlignedDecimal = offsetObj.alignDecimal(maxDecimalLength);
163
- const myAlignedDecimal = this.alignDecimal(maxDecimalLength);
164
- const valueStr = `${myAlignedDecimal + offsetAlignedDecimal}`;
165
- const { negativeStr: str, trimStr } = trimNumber(valueStr);
166
- const hydrateValueStr = `${str}${trimStr.padStart(maxDecimalLength + 1, "0")}`;
167
- return getMiniDecimal(`${hydrateValueStr.slice(0, -maxDecimalLength)}.${hydrateValueStr.slice(-maxDecimalLength)}`);
168
- }
169
- negate() {
170
- const clone = new BigIntDecimal(this.toString());
171
- clone.negative = !clone.negative;
172
- return clone;
173
- }
174
- isNaN() {
175
- return this.nan;
176
- }
177
- isEmpty() {
178
- return this.empty;
179
- }
180
- isInvalidate() {
181
- return this.isEmpty() || this.isNaN();
182
- }
183
- lessEquals(target) {
184
- return this.add(target.negate().toString()).toNumber() <= 0;
185
- }
186
- equals(target) {
187
- return this.toString() === (target && target.toString());
188
- }
189
- toNumber() {
190
- if (this.isNaN()) {
191
- return NaN;
192
- }
193
- return Number(this.toString());
194
- }
195
- toString(safe = true) {
196
- if (!safe) {
197
- return this.origin;
198
- }
199
- if (this.isInvalidate()) {
200
- return "";
201
- }
202
- return trimNumber(`${this.getMark()}${this.getIntegerStr()}.${this.getDecimalStr()}`).fullStr;
203
- }
204
- }
205
- class NumberDecimal {
206
- constructor(value = "") {
207
- if (!value && value !== 0 || !String(value).trim()) {
208
- this.empty = true;
209
- return;
210
- }
211
- this.origin = "";
212
- this.number = void 0;
213
- this.empty = void 0;
214
- this.origin = String(value);
215
- this.number = Number(value);
216
- }
217
- negate() {
218
- return new NumberDecimal(-this.toNumber());
219
- }
220
- add(value) {
221
- if (this.isInvalidate()) {
222
- return new NumberDecimal(value);
223
- }
224
- const target = Number(value);
225
- if (isNaN(target)) {
226
- return this;
227
- }
228
- const number = this.number + target;
229
- if (number < Number.MIN_SAFE_INTEGER) {
230
- return new NumberDecimal(Number.MIN_SAFE_INTEGER);
231
- }
232
- if (number > Number.MAX_SAFE_INTEGER) {
233
- return new NumberDecimal(Number.MAX_SAFE_INTEGER);
234
- }
235
- const maxPrecision = Math.max(getNumberPrecision(target), getNumberPrecision(this.number));
236
- return new NumberDecimal(number.toFixed(maxPrecision));
237
- }
238
- isNaN() {
239
- return isNaN(this.number);
240
- }
241
- isEmpty() {
242
- return this.empty;
243
- }
244
- isInvalidate() {
245
- return this.isEmpty() || this.isNaN();
246
- }
247
- equals(target) {
248
- return this.toNumber() === (target && target.toNumber());
249
- }
250
- lessEquals(target) {
251
- return this.add(target.negate().toString()).toNumber() <= 0;
252
- }
253
- toNumber() {
254
- return this.number;
255
- }
256
- toString(safe = true) {
257
- if (!safe) {
258
- return this.origin;
259
- }
260
- if (this.isInvalidate()) {
261
- return "";
262
- }
263
- return num2str(this.number);
264
- }
265
- }
266
- setDecimalClass = function(decimaljs) {
267
- DecimalCls.CLS = supportBigInt() ? BigIntDecimal : typeof decimaljs === "function" ? decimaljs : NumberDecimal;
268
- };
269
- function lessEquals(value1, value2) {
270
- return getMiniDecimal(value1).lessEquals(getMiniDecimal(value2));
271
- }
272
- function equalsDecimal(value1, value2) {
273
- return getMiniDecimal(value1).equals(getMiniDecimal(value2));
274
- }
275
- function toFixed(numStr, precision, rounding = 5) {
276
- if (numStr === "") {
277
- return "";
278
- }
279
- const separatorStr = ".";
280
- const { negativeStr, integerStr, decimalStr } = trimNumber(numStr);
281
- const precisionDecimalStr = `${separatorStr}${decimalStr}`;
282
- const numberWithoutDecimal = `${negativeStr}${integerStr}`;
283
- if (precision >= 0) {
284
- const advancedNum = Number(decimalStr[precision]);
285
- if (advancedNum >= rounding && rounding !== 0) {
286
- const advancedDecimal = getMiniDecimal(`${integerStr}${separatorStr}${decimalStr}`).add(
287
- `0.${fillChar("", precision, true)}${10 - advancedNum}`
288
- );
289
- return toFixed(negativeStr + advancedDecimal.toString(), precision, 0);
290
- }
291
- if (precision === 0) {
292
- return numberWithoutDecimal;
293
- }
294
- return `${numberWithoutDecimal}${separatorStr}${fillChar(decimalStr, precision, true).slice(0, precision)}`;
295
- }
296
- if (precisionDecimalStr === ".0") {
297
- return numberWithoutDecimal;
298
- }
299
- return `${numberWithoutDecimal}${precisionDecimalStr}`;
300
- }
301
- export {
302
- BigIntDecimal,
303
- NumberDecimal,
304
- equalsDecimal,
305
- getMiniDecimal,
306
- getNumberPrecision,
307
- isE,
308
- lessEquals,
309
- num2str,
310
- setDecimalClass,
311
- supportBigInt,
312
- toFixed,
313
- trimNumber,
314
- validateNumber
315
- };
package/common/browser.js DELETED
@@ -1,81 +0,0 @@
1
- import "../chunk-G2ADBYYC.js";
2
- const getIEVersion = () => {
3
- let version = 8;
4
- if (!!document.addEventListener && !!window.performance) {
5
- version = 9;
6
- if (!!window.atob && !!window.matchMedia) {
7
- version = 10;
8
- if (!window.attachEvent && !document.all) {
9
- version = 11;
10
- }
11
- }
12
- }
13
- return version;
14
- };
15
- const isEdge = (browser) => {
16
- if (browser.chrome && ~navigator.userAgent.indexOf("Edg")) {
17
- browser.name = "edge";
18
- browser.edge = true;
19
- delete browser.chrome;
20
- } else if (!document.documentMode && !!window.StyleMedia) {
21
- browser.name = "edge";
22
- browser.edge = true;
23
- }
24
- };
25
- const isBrowser = typeof window !== "undefined" && typeof document !== "undefined" && window.document === document;
26
- const globalEnvironment = isBrowser ? window : global;
27
- var browser_default = (() => {
28
- const browser = {
29
- name: void 0,
30
- version: void 0,
31
- isDoc: typeof document !== "undefined",
32
- isMobile: false,
33
- isPC: true,
34
- isNode: typeof window === "undefined"
35
- };
36
- if (isBrowser) {
37
- const isMobile = /(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent);
38
- browser.isMobile = isMobile;
39
- browser.isPC = !isMobile;
40
- let matches;
41
- if (!!window.chrome && (!!window.chrome.webstore || /^Google\b/.test(window.navigator.vendor))) {
42
- browser.name = "chrome";
43
- browser.chrome = true;
44
- matches = navigator.userAgent.match(/chrome\/(\d+)/i);
45
- browser.version = !!matches && !!matches[1] && parseInt(matches[1], 10);
46
- matches = void 0;
47
- } else if (!!document.all || !!document.documentMode) {
48
- browser.name = "ie";
49
- browser.version = getIEVersion();
50
- browser.ie = true;
51
- } else if (typeof window.InstallTrigger !== "undefined") {
52
- browser.name = "firefox";
53
- browser.firefox = true;
54
- } else if (Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor") > 0) {
55
- browser.name = "safari";
56
- browser.safari = true;
57
- } else if (!!window.opr && !!window.opr.addons || !!window.opera) {
58
- browser.name = "opera";
59
- browser.opera = true;
60
- }
61
- isEdge(browser);
62
- if (!~["ie", "chrome"].indexOf(browser.name)) {
63
- const reg = browser.name + "/(\\d+)";
64
- matches = navigator.userAgent.match(new RegExp(reg, "i"));
65
- browser.version = !!matches && !!matches[1] && parseInt(matches[1], 10);
66
- matches = void 0;
67
- }
68
- if (browser.isDoc) {
69
- const bodyEl = document.body || document.documentElement;
70
- ["webkit", "khtml", "moz", "ms", "o"].forEach((core) => {
71
- browser["-" + core] = !!bodyEl[core + "MatchesSelector"];
72
- });
73
- }
74
- }
75
- return browser;
76
- })();
77
- export {
78
- browser_default as default,
79
- globalEnvironment,
80
- isBrowser
81
- };
@@ -1,97 +0,0 @@
1
- import "../../chunk-G2ADBYYC.js";
2
- import { isLeapYear } from "../date";
3
- const getDays = (year, month) => {
4
- return [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month - 1];
5
- };
6
- const getWeek = (year, month, day) => (/* @__PURE__ */ new Date(`${year}/${month}/${day}`)).getDay();
7
- const lastMonth = (year, month) => {
8
- year = +year;
9
- month = +month;
10
- if (month === 1) {
11
- year--;
12
- month = 12;
13
- } else {
14
- month--;
15
- }
16
- return { year, month };
17
- };
18
- const nextMonth = (year, month) => {
19
- year = +year;
20
- month = +month;
21
- if (month === 12) {
22
- year++;
23
- month = 1;
24
- } else {
25
- month++;
26
- }
27
- return { year, month };
28
- };
29
- const getCalendar = (year, month) => {
30
- if (year && month && month <= 12) {
31
- const days = getDays(year, month);
32
- const firstWeek = getWeek(year, month, 1);
33
- const lastWeek = getWeek(year, month, days);
34
- const last = lastMonth(year, month);
35
- const next = nextMonth(year, month);
36
- const lastDays = getDays(last.year, last.month);
37
- let remainDays = 0;
38
- const totalDays = days + firstWeek + 7 - lastWeek - 1;
39
- if (totalDays / 7 < 6 && totalDays / 7 >= 5) {
40
- remainDays = 6 * 7 - totalDays;
41
- }
42
- return {
43
- last: {
44
- year: last.year,
45
- month: last.month,
46
- start: lastDays - (firstWeek - 1),
47
- end: lastDays
48
- },
49
- current: {
50
- year,
51
- month,
52
- start: 1,
53
- end: days
54
- },
55
- next: {
56
- year: next.year,
57
- month: next.month,
58
- start: 1,
59
- end: 7 - lastWeek - 1 + remainDays
60
- }
61
- };
62
- }
63
- };
64
- const transformArray = (array) => {
65
- const result = [];
66
- let index = 0;
67
- if (array && array.length) {
68
- const length = array.length / 7;
69
- for (let i = 0; i < length; i++) {
70
- result[i] = [];
71
- for (let j = 0; j < 7; j++) {
72
- result[i][j] = array[index++];
73
- }
74
- }
75
- }
76
- return result;
77
- };
78
- const parseDate = (time) => {
79
- const date = new Date(time && typeof time === "number" ? time : 0);
80
- return {
81
- year: date.getFullYear(),
82
- month: date.getMonth() + 1,
83
- day: date.getDate(),
84
- hours: date.getHours(),
85
- minutes: date.getMinutes(),
86
- seconds: date.getSeconds()
87
- };
88
- };
89
- export {
90
- getCalendar,
91
- getDays,
92
- getWeek,
93
- lastMonth,
94
- nextMonth,
95
- parseDate,
96
- transformArray
97
- };
@@ -1,99 +0,0 @@
1
- import {
2
- __objRest,
3
- __spreadValues
4
- } from "../../chunk-G2ADBYYC.js";
5
- import { format } from "../string";
6
- import { isObject } from "../type";
7
- import { transformTreeData } from "../array";
8
- const getFilterStr = (filters) => {
9
- const filterArr = {};
10
- Object.keys(filters).forEach((property) => {
11
- const { type, value } = filters[property];
12
- if (type === "enum") {
13
- filterArr[property] = { type: value.map(() => 0), value };
14
- if (value.length > 1) {
15
- filters[property].relation = "or";
16
- }
17
- }
18
- if (type === "input") {
19
- const { relation, text } = value;
20
- filterArr[property] = {
21
- type: [relation === "startwith" ? 8 : relation === "equals" ? 0 : 6],
22
- value: text
23
- };
24
- }
25
- });
26
- return JSON.stringify(filterArr);
27
- };
28
- const getNsObj = (obj, names) => {
29
- const arr = Array.isArray(names) ? names : names.split(".");
30
- const curkey = arr.shift();
31
- const curObj = obj[curkey];
32
- if (isObject(curObj) && arr.length) {
33
- return getNsObj(curObj, arr);
34
- }
35
- return curObj;
36
- };
37
- const handlerArgs = (options, args) => {
38
- if (args) {
39
- const { page, sort, filters } = args;
40
- const { currentPage, pageSize } = page || {};
41
- const filterStr = getFilterStr(filters || {});
42
- const orderBy = sort && sort.property ? sort.property + " " + sort.order : "";
43
- options.url = format(options.url, {
44
- curPage: currentPage,
45
- pageSize,
46
- filterStr,
47
- orderBy
48
- });
49
- }
50
- };
51
- const transForm = (response, tree) => {
52
- const { result, pageVO } = response;
53
- const { key = "id", parentKey } = tree || {};
54
- let data = result || response;
55
- if (parentKey) {
56
- data = transformTreeData(data, key, parentKey);
57
- }
58
- return pageVO ? { result: data, page: { total: pageVO.totalRows } } : data;
59
- };
60
- const getDataset = ({ dataset, service, tree }, args) => new Promise((resolve, reject) => {
61
- const { source, value, api } = dataset || {};
62
- const $service = service || dataset && dataset.service;
63
- if (Array.isArray(dataset)) {
64
- return resolve(transForm(dataset, tree));
65
- }
66
- if (Array.isArray(value)) {
67
- return resolve(transForm(value, tree));
68
- }
69
- if (!$service) {
70
- return resolve([]);
71
- }
72
- if (isObject(source) && source.url) {
73
- const _a = source, { type = "GET", data, beforeRequest, afterRequest, success, hideErr, url, method } = _a, options = __objRest(_a, ["type", "data", "beforeRequest", "afterRequest", "success", "hideErr", "url", "method"]);
74
- options.url = url;
75
- options.method = method || type.toLocaleLowerCase();
76
- const mergeTarget = options.method === "get" ? "params" : "data";
77
- options[mergeTarget] = data || {};
78
- const afterRequestFn = afterRequest || success;
79
- const config = __spreadValues({}, options);
80
- handlerArgs(config, args);
81
- beforeRequest && beforeRequest(config, args);
82
- $service.network.request(config).then((response) => {
83
- afterRequestFn && afterRequestFn(response.data);
84
- resolve(transForm(response.data, tree));
85
- }).catch((error) => {
86
- hideErr || reject(error);
87
- });
88
- } else if (api) {
89
- const fetchFn = getNsObj($service, api.name);
90
- fetchFn && fetchFn(__spreadValues(__spreadValues({}, api.data), args)).then((response) => {
91
- resolve(transForm(response, tree));
92
- }).catch((error) => {
93
- reject(error);
94
- });
95
- }
96
- });
97
- export {
98
- getDataset
99
- };