@wzyjs/utils 0.0.26 → 0.0.28

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 (153) hide show
  1. package/dist/browser/cjs/browser/element.js +40 -0
  2. package/dist/browser/cjs/browser/index.js +20 -0
  3. package/dist/browser/cjs/browser/other.js +12 -0
  4. package/dist/browser/cjs/browser/style.js +49 -0
  5. package/dist/browser/cjs/browser.js +171 -0
  6. package/dist/browser/cjs/common/classs.js +14 -0
  7. package/dist/browser/cjs/common/dayjs.js +27 -0
  8. package/dist/browser/cjs/types/index.d.ts +27 -0
  9. package/dist/{esm/fe → browser/cjs/utils/src/browser}/index.d.ts +1 -1
  10. package/dist/browser/cjs/utils/src/browser/other.d.ts +1 -0
  11. package/dist/browser/cjs/utils/src/browser.d.ts +2 -0
  12. package/dist/browser/cjs/utils/src/common/classs.d.ts +5 -0
  13. package/dist/browser/cjs/utils/src/common/dayjs.d.ts +4 -0
  14. package/dist/browser/cjs/utils/src/common/index.d.ts +11 -0
  15. package/dist/{cjs/common/tools → browser/cjs/utils/src/common}/other.d.ts +1 -1
  16. package/dist/{cjs/rd → browser/cjs/utils/src/node}/jsonFile/index.d.ts +1 -1
  17. package/dist/browser/cjs/utils/src/node.d.ts +2 -0
  18. package/dist/{esm/fe → browser/esm/browser}/index.js +0 -1
  19. package/dist/browser/esm/browser/other.js +10 -0
  20. package/dist/browser/esm/browser.js +19 -0
  21. package/dist/browser/esm/common/classs.js +12 -0
  22. package/dist/browser/esm/common/dayjs.js +18 -0
  23. package/dist/browser/esm/types/index.d.ts +27 -0
  24. package/dist/{cjs/fe → browser/esm/utils/src/browser}/index.d.ts +1 -1
  25. package/dist/browser/esm/utils/src/browser/other.d.ts +1 -0
  26. package/dist/browser/esm/utils/src/browser.d.ts +2 -0
  27. package/dist/browser/esm/utils/src/common/classs.d.ts +5 -0
  28. package/dist/browser/esm/utils/src/common/dayjs.d.ts +4 -0
  29. package/dist/browser/esm/utils/src/common/index.d.ts +11 -0
  30. package/dist/{esm/common/tools → browser/esm/utils/src/common}/other.d.ts +1 -1
  31. package/dist/{esm/rd → browser/esm/utils/src/node}/jsonFile/index.d.ts +1 -1
  32. package/dist/browser/esm/utils/src/node.d.ts +2 -0
  33. package/dist/node/cjs/common/classs.js +14 -0
  34. package/dist/node/cjs/common/dayjs.js +27 -0
  35. package/dist/node/cjs/common/number.js +34 -0
  36. package/dist/node/cjs/common/object.js +43 -0
  37. package/dist/node/cjs/common/other.js +112 -0
  38. package/dist/node/cjs/common/string.js +137 -0
  39. package/dist/{cjs/index_rd.js → node/cjs/node.js} +28 -8
  40. package/dist/node/cjs/types/index.d.ts +27 -0
  41. package/dist/node/cjs/utils/src/browser/element.d.ts +9 -0
  42. package/dist/node/cjs/utils/src/browser/index.d.ts +18 -0
  43. package/dist/node/cjs/utils/src/browser/other.d.ts +1 -0
  44. package/dist/node/cjs/utils/src/browser/style.d.ts +10 -0
  45. package/dist/node/cjs/utils/src/browser.d.ts +2 -0
  46. package/dist/node/cjs/utils/src/common/classs.d.ts +5 -0
  47. package/dist/node/cjs/utils/src/common/dayjs.d.ts +4 -0
  48. package/dist/node/cjs/utils/src/common/index.d.ts +11 -0
  49. package/dist/node/cjs/utils/src/common/number.d.ts +3 -0
  50. package/dist/node/cjs/utils/src/common/object.d.ts +10 -0
  51. package/dist/node/cjs/utils/src/common/other.d.ts +26 -0
  52. package/dist/node/cjs/utils/src/common/string.d.ts +16 -0
  53. package/dist/node/cjs/utils/src/node/database/Collection.d.ts +22 -0
  54. package/dist/node/cjs/utils/src/node/database/Database.d.ts +10 -0
  55. package/dist/node/cjs/utils/src/node/database/index.d.ts +2 -0
  56. package/dist/node/cjs/utils/src/node/database/types.d.ts +151 -0
  57. package/dist/node/cjs/utils/src/node/database/utils.d.ts +3 -0
  58. package/dist/node/cjs/utils/src/node/index.d.ts +3 -0
  59. package/dist/node/cjs/utils/src/node/jsonFile/index.d.ts +6 -0
  60. package/dist/node/cjs/utils/src/node/mail/index.d.ts +1 -0
  61. package/dist/node/cjs/utils/src/node.d.ts +2 -0
  62. package/dist/node/esm/common/classs.js +12 -0
  63. package/dist/node/esm/common/dayjs.js +18 -0
  64. package/dist/node/esm/common/number.js +30 -0
  65. package/dist/node/esm/common/object.js +39 -0
  66. package/dist/node/esm/common/other.js +106 -0
  67. package/dist/node/esm/common/string.js +120 -0
  68. package/dist/node/esm/node/database/Collection.js +200 -0
  69. package/dist/node/esm/node/database/Database.js +23 -0
  70. package/dist/node/esm/node/database/types.js +25 -0
  71. package/dist/node/esm/node/database/utils.js +27 -0
  72. package/dist/node/esm/node/jsonFile/index.js +27 -0
  73. package/dist/node/esm/node/mail/index.js +29 -0
  74. package/dist/node/esm/node.js +14 -0
  75. package/dist/node/esm/types/index.d.ts +27 -0
  76. package/dist/node/esm/utils/src/browser/element.d.ts +9 -0
  77. package/dist/node/esm/utils/src/browser/index.d.ts +18 -0
  78. package/dist/node/esm/utils/src/browser/other.d.ts +1 -0
  79. package/dist/node/esm/utils/src/browser/style.d.ts +10 -0
  80. package/dist/node/esm/utils/src/browser.d.ts +2 -0
  81. package/dist/node/esm/utils/src/common/classs.d.ts +5 -0
  82. package/dist/node/esm/utils/src/common/dayjs.d.ts +4 -0
  83. package/dist/node/esm/utils/src/common/index.d.ts +11 -0
  84. package/dist/node/esm/utils/src/common/number.d.ts +3 -0
  85. package/dist/node/esm/utils/src/common/object.d.ts +10 -0
  86. package/dist/node/esm/utils/src/common/other.d.ts +26 -0
  87. package/dist/node/esm/utils/src/common/string.d.ts +16 -0
  88. package/dist/node/esm/utils/src/node/database/Collection.d.ts +22 -0
  89. package/dist/node/esm/utils/src/node/database/Database.d.ts +10 -0
  90. package/dist/node/esm/utils/src/node/database/index.d.ts +2 -0
  91. package/dist/node/esm/utils/src/node/database/types.d.ts +151 -0
  92. package/dist/node/esm/utils/src/node/database/utils.d.ts +3 -0
  93. package/dist/node/esm/utils/src/node/index.d.ts +3 -0
  94. package/dist/node/esm/utils/src/node/jsonFile/index.d.ts +6 -0
  95. package/dist/node/esm/utils/src/node/mail/index.d.ts +1 -0
  96. package/dist/node/esm/utils/src/node.d.ts +2 -0
  97. package/package.json +23 -11
  98. package/dist/cjs/common/index.d.ts +0 -6
  99. package/dist/cjs/common/tools/index.d.ts +0 -4
  100. package/dist/cjs/common/types/index.d.ts +0 -15
  101. package/dist/cjs/fe/dayjs.d.ts +0 -2
  102. package/dist/cjs/index_all.d.ts +0 -3
  103. package/dist/cjs/index_fe.d.ts +0 -2
  104. package/dist/cjs/index_rd.d.ts +0 -2
  105. package/dist/esm/common/index.d.ts +0 -6
  106. package/dist/esm/common/tools/index.d.ts +0 -4
  107. package/dist/esm/common/types/index.d.ts +0 -15
  108. package/dist/esm/fe/dayjs.d.ts +0 -2
  109. package/dist/esm/fe/dayjs.js +0 -9
  110. package/dist/esm/index_all.d.ts +0 -3
  111. package/dist/esm/index_fe.d.ts +0 -2
  112. package/dist/esm/index_fe.js +0 -16
  113. package/dist/esm/index_rd.d.ts +0 -2
  114. /package/dist/{cjs/common/tools → browser/cjs/common}/number.js +0 -0
  115. /package/dist/{cjs/common/tools → browser/cjs/common}/object.js +0 -0
  116. /package/dist/{cjs/common/tools → browser/cjs/common}/other.js +0 -0
  117. /package/dist/{cjs/common/tools → browser/cjs/common}/string.js +0 -0
  118. /package/dist/{cjs/fe → browser/cjs/utils/src/browser}/element.d.ts +0 -0
  119. /package/dist/{cjs/fe → browser/cjs/utils/src/browser}/style.d.ts +0 -0
  120. /package/dist/{cjs/common/tools → browser/cjs/utils/src/common}/number.d.ts +0 -0
  121. /package/dist/{cjs/common/tools → browser/cjs/utils/src/common}/object.d.ts +0 -0
  122. /package/dist/{cjs/common/tools → browser/cjs/utils/src/common}/string.d.ts +0 -0
  123. /package/dist/{cjs/rd → browser/cjs/utils/src/node}/database/Collection.d.ts +0 -0
  124. /package/dist/{cjs/rd → browser/cjs/utils/src/node}/database/Database.d.ts +0 -0
  125. /package/dist/{cjs/rd → browser/cjs/utils/src/node}/database/index.d.ts +0 -0
  126. /package/dist/{cjs/rd → browser/cjs/utils/src/node}/database/types.d.ts +0 -0
  127. /package/dist/{cjs/rd → browser/cjs/utils/src/node}/database/utils.d.ts +0 -0
  128. /package/dist/{cjs/rd → browser/cjs/utils/src/node}/index.d.ts +0 -0
  129. /package/dist/{cjs/rd → browser/cjs/utils/src/node}/mail/index.d.ts +0 -0
  130. /package/dist/{esm/fe → browser/esm/browser}/element.js +0 -0
  131. /package/dist/{esm/fe → browser/esm/browser}/style.js +0 -0
  132. /package/dist/{esm/common/tools → browser/esm/common}/number.js +0 -0
  133. /package/dist/{esm/common/tools → browser/esm/common}/object.js +0 -0
  134. /package/dist/{esm/common/tools → browser/esm/common}/other.js +0 -0
  135. /package/dist/{esm/common/tools → browser/esm/common}/string.js +0 -0
  136. /package/dist/{esm/fe → browser/esm/utils/src/browser}/element.d.ts +0 -0
  137. /package/dist/{esm/fe → browser/esm/utils/src/browser}/style.d.ts +0 -0
  138. /package/dist/{esm/common/tools → browser/esm/utils/src/common}/number.d.ts +0 -0
  139. /package/dist/{esm/common/tools → browser/esm/utils/src/common}/object.d.ts +0 -0
  140. /package/dist/{esm/common/tools → browser/esm/utils/src/common}/string.d.ts +0 -0
  141. /package/dist/{esm/rd → browser/esm/utils/src/node}/database/Collection.d.ts +0 -0
  142. /package/dist/{esm/rd → browser/esm/utils/src/node}/database/Database.d.ts +0 -0
  143. /package/dist/{esm/rd → browser/esm/utils/src/node}/database/index.d.ts +0 -0
  144. /package/dist/{esm/rd → browser/esm/utils/src/node}/database/types.d.ts +0 -0
  145. /package/dist/{esm/rd → browser/esm/utils/src/node}/database/utils.d.ts +0 -0
  146. /package/dist/{esm/rd → browser/esm/utils/src/node}/index.d.ts +0 -0
  147. /package/dist/{esm/rd → browser/esm/utils/src/node}/mail/index.d.ts +0 -0
  148. /package/dist/{cjs/rd → node/cjs/node}/database/Collection.js +0 -0
  149. /package/dist/{cjs/rd → node/cjs/node}/database/Database.js +0 -0
  150. /package/dist/{cjs/rd → node/cjs/node}/database/types.js +0 -0
  151. /package/dist/{cjs/rd → node/cjs/node}/database/utils.js +0 -0
  152. /package/dist/{cjs/rd → node/cjs/node}/jsonFile/index.js +0 -0
  153. /package/dist/{cjs/rd → node/cjs/node}/mail/index.js +0 -0
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ // 滚动到让指定元素显示出来的位置
4
+ const scrollIntoView = (el, option) => {
5
+ if (!el) {
6
+ return;
7
+ }
8
+ el.scrollIntoView({ behavior: 'smooth', block: 'start', ...option });
9
+ };
10
+ // 获取指定元素 已经元素原始的样式
11
+ const getElement = (el) => {
12
+ const element = typeof el === 'string' ? document.querySelector(el) : el;
13
+ if (!element) {
14
+ return {
15
+ element: null,
16
+ originalStyle: {},
17
+ };
18
+ }
19
+ // 获取元素原始的样式
20
+ return {
21
+ element,
22
+ originalStyle: window.getComputedStyle(element),
23
+ };
24
+ };
25
+ // 判断元素是否在可见范围内
26
+ const isElementInViewport = (el) => {
27
+ const { element } = getElement(el);
28
+ if (!element) {
29
+ return;
30
+ }
31
+ const rect = element.getBoundingClientRect();
32
+ return (rect.top >= 0 &&
33
+ rect.left >= 0 &&
34
+ rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
35
+ rect.right <= (window.innerWidth || document.documentElement.clientWidth));
36
+ };
37
+
38
+ exports.getElement = getElement;
39
+ exports.isElementInViewport = isElementInViewport;
40
+ exports.scrollIntoView = scrollIntoView;
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ var md5 = require('md5');
4
+ var classnames = require('classnames');
5
+ var copyToClipboard = require('copy-to-clipboard');
6
+ var localforage$1 = require('localforage');
7
+ var anime = require('animejs');
8
+
9
+ const localforage = {
10
+ config: localforage$1.config,
11
+ setItem: localforage$1.setItem,
12
+ getItem: localforage$1.getItem,
13
+ removeItem: localforage$1.removeItem,
14
+ };
15
+
16
+ exports.md5 = md5;
17
+ exports.classnames = classnames;
18
+ exports.copy = copyToClipboard;
19
+ exports.anime = anime;
20
+ exports.localforage = localforage;
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ const readClipboard = async () => {
4
+ try {
5
+ return await navigator.clipboard.readText();
6
+ }
7
+ catch (error) {
8
+ return '';
9
+ }
10
+ };
11
+
12
+ exports.readClipboard = readClipboard;
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ var anime = require('animejs');
4
+ var element = require('./element.js');
5
+
6
+ // 颜色值转换
7
+ const hexToRgba = (hexColor, a = 1) => {
8
+ let red = parseInt(hexColor.substr(1, 2), 16);
9
+ let green = parseInt(hexColor.substr(3, 2), 16);
10
+ let blue = parseInt(hexColor.substr(5, 2), 16);
11
+ return {
12
+ nums: { red, green, blue },
13
+ text: `rgba(${red}, ${green}, ${blue}, ${a})`,
14
+ };
15
+ };
16
+ // 背景颜色闪动
17
+ const flashBackground = (el, color, a = 1) => {
18
+ const { element: element$1, originalStyle } = element.getElement(el);
19
+ if (!element$1) {
20
+ return;
21
+ }
22
+ anime({
23
+ targets: element$1,
24
+ backgroundColor: [hexToRgba(color, a).text, originalStyle.backgroundColor],
25
+ duration: 1500,
26
+ easing: 'easeInOutSine',
27
+ direction: 'alternate',
28
+ loop: false,
29
+ });
30
+ };
31
+ // 边框闪动
32
+ const flashBorder = (el, color, a = 1) => {
33
+ const { element: element$1 } = element.getElement(el);
34
+ if (!element$1) {
35
+ return;
36
+ }
37
+ anime({
38
+ targets: element$1,
39
+ border: [`1px solid ${hexToRgba(color, a).text}`, 'none'],
40
+ duration: 1500,
41
+ easing: 'easeInOutSine',
42
+ direction: 'alternate',
43
+ loop: false,
44
+ });
45
+ };
46
+
47
+ exports.flashBackground = flashBackground;
48
+ exports.flashBorder = flashBorder;
49
+ exports.hexToRgba = hexToRgba;
@@ -0,0 +1,171 @@
1
+ 'use strict';
2
+
3
+ var lodash = require('lodash');
4
+ var consola = require('consola');
5
+ require('./common/dayjs.js');
6
+ var zod = require('zod');
7
+ var string = require('./common/string.js');
8
+ var object = require('./common/object.js');
9
+ var other = require('./common/other.js');
10
+ var number = require('./common/number.js');
11
+ var classs = require('./common/classs.js');
12
+ var index = require('./browser/index.js');
13
+ var dayjs = require('dayjs');
14
+ var style = require('./browser/style.js');
15
+ var element = require('./browser/element.js');
16
+ var other$1 = require('./browser/other.js');
17
+ var copyToClipboard = require('copy-to-clipboard');
18
+ var classnames = require('classnames');
19
+ var md5 = require('md5');
20
+ var anime = require('animejs');
21
+
22
+ function _interopNamespaceDefault(e) {
23
+ var n = Object.create(null);
24
+ if (e) {
25
+ Object.keys(e).forEach(function (k) {
26
+ if (k !== 'default') {
27
+ var d = Object.getOwnPropertyDescriptor(e, k);
28
+ Object.defineProperty(n, k, d.get ? d : {
29
+ enumerable: true,
30
+ get: function () { return e[k]; }
31
+ });
32
+ }
33
+ });
34
+ }
35
+ n.default = e;
36
+ return Object.freeze(n);
37
+ }
38
+
39
+ var consola__namespace = /*#__PURE__*/_interopNamespaceDefault(consola);
40
+
41
+
42
+
43
+ exports._ = lodash;
44
+ Object.defineProperty(exports, 'cloneDeep', {
45
+ enumerable: true,
46
+ get: function () { return lodash.cloneDeep; }
47
+ });
48
+ Object.defineProperty(exports, 'debounce', {
49
+ enumerable: true,
50
+ get: function () { return lodash.debounce; }
51
+ });
52
+ Object.defineProperty(exports, 'find', {
53
+ enumerable: true,
54
+ get: function () { return lodash.find; }
55
+ });
56
+ Object.defineProperty(exports, 'groupBy', {
57
+ enumerable: true,
58
+ get: function () { return lodash.groupBy; }
59
+ });
60
+ Object.defineProperty(exports, 'isBoolean', {
61
+ enumerable: true,
62
+ get: function () { return lodash.isBoolean; }
63
+ });
64
+ Object.defineProperty(exports, 'isEmpty', {
65
+ enumerable: true,
66
+ get: function () { return lodash.isEmpty; }
67
+ });
68
+ Object.defineProperty(exports, 'isEqual', {
69
+ enumerable: true,
70
+ get: function () { return lodash.isEqual; }
71
+ });
72
+ Object.defineProperty(exports, 'isError', {
73
+ enumerable: true,
74
+ get: function () { return lodash.isError; }
75
+ });
76
+ Object.defineProperty(exports, 'isFunction', {
77
+ enumerable: true,
78
+ get: function () { return lodash.isFunction; }
79
+ });
80
+ Object.defineProperty(exports, 'isNumber', {
81
+ enumerable: true,
82
+ get: function () { return lodash.isNumber; }
83
+ });
84
+ Object.defineProperty(exports, 'isObject', {
85
+ enumerable: true,
86
+ get: function () { return lodash.isObject; }
87
+ });
88
+ Object.defineProperty(exports, 'isString', {
89
+ enumerable: true,
90
+ get: function () { return lodash.isString; }
91
+ });
92
+ Object.defineProperty(exports, 'merge', {
93
+ enumerable: true,
94
+ get: function () { return lodash.merge; }
95
+ });
96
+ Object.defineProperty(exports, 'noop', {
97
+ enumerable: true,
98
+ get: function () { return lodash.noop; }
99
+ });
100
+ Object.defineProperty(exports, 'omit', {
101
+ enumerable: true,
102
+ get: function () { return lodash.omit; }
103
+ });
104
+ Object.defineProperty(exports, 'pick', {
105
+ enumerable: true,
106
+ get: function () { return lodash.pick; }
107
+ });
108
+ Object.defineProperty(exports, 'uniq', {
109
+ enumerable: true,
110
+ get: function () { return lodash.uniq; }
111
+ });
112
+ Object.defineProperty(exports, 'uniqBy', {
113
+ enumerable: true,
114
+ get: function () { return lodash.uniqBy; }
115
+ });
116
+ Object.defineProperty(exports, 'uniqWith', {
117
+ enumerable: true,
118
+ get: function () { return lodash.uniqWith; }
119
+ });
120
+ exports.consola = consola__namespace;
121
+ exports.amount = string.amount;
122
+ exports.getChinese = string.getChinese;
123
+ exports.getChineseByStr = string.getChineseByStr;
124
+ exports.getCookie = string.getCookie;
125
+ exports.getLength = string.getLength;
126
+ exports.getProxyUrl = string.getProxyUrl;
127
+ exports.getRandomColor = string.getRandomColor;
128
+ exports.getRandomString = string.getRandomString;
129
+ exports.getSliceStr = string.getSliceStr;
130
+ exports.getStrLength = string.getStrLength;
131
+ exports.getType = string.getType;
132
+ exports.isJson = string.isJson;
133
+ exports.jsonParse = string.jsonParse;
134
+ exports.replaceAll = string.replaceAll;
135
+ exports.replaceByRules = string.replaceByRules;
136
+ exports.toString = string.toString;
137
+ exports.filterParams = object.filterParams;
138
+ exports.findItem = object.findItem;
139
+ exports.watch = object.watch;
140
+ exports.delay = other.delay;
141
+ exports.executePromise = other.executePromise;
142
+ exports.handleParams = other.handleParams;
143
+ exports.handleRes2List = other.handleRes2List;
144
+ exports.locationFn = other.locationFn;
145
+ exports.getFileSize = number.getFileSize;
146
+ exports.getRandomNum = number.getRandomNum;
147
+ exports.limitDecimals = number.limitDecimals;
148
+ exports.CustomError = classs.CustomError;
149
+ exports.localforage = index.localforage;
150
+ Object.defineProperty(exports, 'Dayjs', {
151
+ enumerable: true,
152
+ get: function () { return dayjs.Dayjs; }
153
+ });
154
+ exports.dayjs = dayjs;
155
+ exports.flashBackground = style.flashBackground;
156
+ exports.flashBorder = style.flashBorder;
157
+ exports.hexToRgba = style.hexToRgba;
158
+ exports.getElement = element.getElement;
159
+ exports.isElementInViewport = element.isElementInViewport;
160
+ exports.scrollIntoView = element.scrollIntoView;
161
+ exports.readClipboard = other$1.readClipboard;
162
+ exports.copy = copyToClipboard;
163
+ exports.classnames = classnames;
164
+ exports.md5 = md5;
165
+ exports.anime = anime;
166
+ Object.keys(zod).forEach(function (k) {
167
+ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
168
+ enumerable: true,
169
+ get: function () { return zod[k]; }
170
+ });
171
+ });
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ class CustomError extends Error {
4
+ code;
5
+ data;
6
+ constructor(message, code, data) {
7
+ super(message);
8
+ this.code = code;
9
+ this.data = data;
10
+ Error.captureStackTrace(this, this.constructor);
11
+ }
12
+ }
13
+
14
+ exports.CustomError = CustomError;
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var dayjs = require('dayjs');
6
+ var isBetween = require('dayjs/plugin/isBetween');
7
+ var weekday = require('dayjs/plugin/weekday');
8
+ var localeData = require('dayjs/plugin/localeData');
9
+ var isoWeek = require('dayjs/plugin/isoWeek');
10
+ var updateLocale = require('dayjs/plugin/updateLocale');
11
+ require('dayjs/locale/zh-cn');
12
+
13
+ dayjs.extend(isBetween);
14
+ dayjs.extend(weekday);
15
+ dayjs.extend(localeData);
16
+ dayjs.extend(isoWeek);
17
+ dayjs.extend(updateLocale);
18
+ dayjs.locale('zh-cn');
19
+ dayjs.updateLocale('zh-cn', {
20
+ weekStart: 1,
21
+ });
22
+
23
+ Object.defineProperty(exports, 'Dayjs', {
24
+ enumerable: true,
25
+ get: function () { return dayjs.Dayjs; }
26
+ });
27
+ exports.default = dayjs;
@@ -0,0 +1,27 @@
1
+ export interface RequestRes<D = any> {
2
+ success: boolean;
3
+ message: string;
4
+ data: D;
5
+ }
6
+ export type KeyValue<D extends object | string = string, V = any> = Partial<Record<D extends string ? string : keyof D, V>>;
7
+ export interface Pagination {
8
+ current?: number;
9
+ pageSize?: number;
10
+ }
11
+ export type SortParams<D extends object | string = string> = Record<D extends string ? string : keyof D, 'ascend' | 'descend'>;
12
+ export type OrderParams<D extends object | string = string> = {
13
+ field: D extends string ? string : keyof D;
14
+ type: 'asc' | 'desc';
15
+ };
16
+ export interface Option<V extends string | number = string> {
17
+ label: string;
18
+ value: V;
19
+ children?: Option<V>[];
20
+ }
21
+ export type OrderBy = {
22
+ [key: string]: 'asc' | 'desc';
23
+ } | {
24
+ [key: string]: 'asc' | 'desc';
25
+ }[];
26
+ export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
27
+ export type Set<T, OmitK extends keyof T = never, OptionalK extends Exclude<keyof T, OmitK> = never> = Optional<Omit<T, OmitK>, OptionalK>;
@@ -15,4 +15,4 @@ export declare const localforage: {
15
15
  };
16
16
  export * from './style';
17
17
  export * from './element';
18
- export { default as dayjs } from './dayjs';
18
+ export * from './other';
@@ -0,0 +1 @@
1
+ export declare const readClipboard: () => Promise<string>;
@@ -0,0 +1,2 @@
1
+ export * from './common';
2
+ export * from './browser/index';
@@ -0,0 +1,5 @@
1
+ export declare class CustomError extends Error {
2
+ code?: number;
3
+ data?: any;
4
+ constructor(message: string, code?: number, data?: any);
5
+ }
@@ -0,0 +1,4 @@
1
+ import dayjs from 'dayjs';
2
+ import 'dayjs/locale/zh-cn';
3
+ export { Dayjs } from 'dayjs';
4
+ export default dayjs;
@@ -0,0 +1,11 @@
1
+ import { cloneDeep, debounce, isBoolean, isEqual, isFunction, isNumber, isObject, isString, merge, omit, pick, uniq, uniqBy, uniqWith, isEmpty, isError, find, groupBy, noop } from 'lodash';
2
+ export { cloneDeep, debounce, isBoolean, isEqual, isFunction, isNumber, isObject, isString, merge, omit, pick, uniq, uniqBy, uniqWith, isEmpty, isError, find, groupBy, noop, };
3
+ export * as consola from 'consola';
4
+ export { default as dayjs, Dayjs } from './dayjs';
5
+ export * from 'zod';
6
+ export * from './string';
7
+ export * from './object';
8
+ export * from './other';
9
+ export * from './number';
10
+ export * from './classs';
11
+ export { default as _ } from 'lodash';
@@ -1,4 +1,4 @@
1
- import { KeyValue, OrderParams, Pagination, SortParams } from '../types';
1
+ import { KeyValue, OrderParams, Pagination, SortParams } from '@wzyjs/types';
2
2
  export declare const handleParams: (params?: Pagination & KeyValue, sort?: SortParams) => {
3
3
  page: {
4
4
  size?: number | undefined;
@@ -2,5 +2,5 @@ export declare class JsonFile {
2
2
  filePath: string;
3
3
  constructor(filePath: string);
4
4
  get(key: string): Promise<unknown>;
5
- set(key: string, value: string): void;
5
+ set(key: string, value: any): void;
6
6
  }
@@ -0,0 +1,2 @@
1
+ export * from './common';
2
+ export * from './node/index';
@@ -3,7 +3,6 @@ export { default as classnames } from 'classnames';
3
3
  export { default as copy } from 'copy-to-clipboard';
4
4
  import { config, setItem, getItem, removeItem } from 'localforage';
5
5
  export { default as anime } from 'animejs';
6
- import './dayjs.js';
7
6
 
8
7
  const localforage = {
9
8
  config,
@@ -0,0 +1,10 @@
1
+ const readClipboard = async () => {
2
+ try {
3
+ return await navigator.clipboard.readText();
4
+ }
5
+ catch (error) {
6
+ return '';
7
+ }
8
+ };
9
+
10
+ export { readClipboard };
@@ -0,0 +1,19 @@
1
+ export { default as _, cloneDeep, debounce, find, groupBy, isBoolean, isEmpty, isEqual, isError, isFunction, isNumber, isObject, isString, merge, noop, omit, pick, uniq, uniqBy, uniqWith } from 'lodash';
2
+ import * as consola from 'consola';
3
+ export { consola };
4
+ import './common/dayjs.js';
5
+ export * from 'zod';
6
+ export { amount, getChinese, getChineseByStr, getCookie, getLength, getProxyUrl, getRandomColor, getRandomString, getSliceStr, getStrLength, getType, isJson, jsonParse, replaceAll, replaceByRules, toString } from './common/string.js';
7
+ export { filterParams, findItem, watch } from './common/object.js';
8
+ export { delay, executePromise, handleParams, handleRes2List, locationFn } from './common/other.js';
9
+ export { getFileSize, getRandomNum, limitDecimals } from './common/number.js';
10
+ export { CustomError } from './common/classs.js';
11
+ export { localforage } from './browser/index.js';
12
+ export { Dayjs, default as dayjs } from 'dayjs';
13
+ export { flashBackground, flashBorder, hexToRgba } from './browser/style.js';
14
+ export { getElement, isElementInViewport, scrollIntoView } from './browser/element.js';
15
+ export { readClipboard } from './browser/other.js';
16
+ export { default as copy } from 'copy-to-clipboard';
17
+ export { default as classnames } from 'classnames';
18
+ export { default as md5 } from 'md5';
19
+ export { default as anime } from 'animejs';
@@ -0,0 +1,12 @@
1
+ class CustomError extends Error {
2
+ code;
3
+ data;
4
+ constructor(message, code, data) {
5
+ super(message);
6
+ this.code = code;
7
+ this.data = data;
8
+ Error.captureStackTrace(this, this.constructor);
9
+ }
10
+ }
11
+
12
+ export { CustomError };
@@ -0,0 +1,18 @@
1
+ import dayjs from 'dayjs';
2
+ export { Dayjs, default } from 'dayjs';
3
+ import isBetween from 'dayjs/plugin/isBetween';
4
+ import weekday from 'dayjs/plugin/weekday';
5
+ import localeData from 'dayjs/plugin/localeData';
6
+ import isoWeek from 'dayjs/plugin/isoWeek';
7
+ import updateLocale from 'dayjs/plugin/updateLocale';
8
+ import 'dayjs/locale/zh-cn';
9
+
10
+ dayjs.extend(isBetween);
11
+ dayjs.extend(weekday);
12
+ dayjs.extend(localeData);
13
+ dayjs.extend(isoWeek);
14
+ dayjs.extend(updateLocale);
15
+ dayjs.locale('zh-cn');
16
+ dayjs.updateLocale('zh-cn', {
17
+ weekStart: 1,
18
+ });
@@ -0,0 +1,27 @@
1
+ export interface RequestRes<D = any> {
2
+ success: boolean;
3
+ message: string;
4
+ data: D;
5
+ }
6
+ export type KeyValue<D extends object | string = string, V = any> = Partial<Record<D extends string ? string : keyof D, V>>;
7
+ export interface Pagination {
8
+ current?: number;
9
+ pageSize?: number;
10
+ }
11
+ export type SortParams<D extends object | string = string> = Record<D extends string ? string : keyof D, 'ascend' | 'descend'>;
12
+ export type OrderParams<D extends object | string = string> = {
13
+ field: D extends string ? string : keyof D;
14
+ type: 'asc' | 'desc';
15
+ };
16
+ export interface Option<V extends string | number = string> {
17
+ label: string;
18
+ value: V;
19
+ children?: Option<V>[];
20
+ }
21
+ export type OrderBy = {
22
+ [key: string]: 'asc' | 'desc';
23
+ } | {
24
+ [key: string]: 'asc' | 'desc';
25
+ }[];
26
+ export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
27
+ export type Set<T, OmitK extends keyof T = never, OptionalK extends Exclude<keyof T, OmitK> = never> = Optional<Omit<T, OmitK>, OptionalK>;
@@ -15,4 +15,4 @@ export declare const localforage: {
15
15
  };
16
16
  export * from './style';
17
17
  export * from './element';
18
- export { default as dayjs } from './dayjs';
18
+ export * from './other';
@@ -0,0 +1 @@
1
+ export declare const readClipboard: () => Promise<string>;
@@ -0,0 +1,2 @@
1
+ export * from './common';
2
+ export * from './browser/index';
@@ -0,0 +1,5 @@
1
+ export declare class CustomError extends Error {
2
+ code?: number;
3
+ data?: any;
4
+ constructor(message: string, code?: number, data?: any);
5
+ }
@@ -0,0 +1,4 @@
1
+ import dayjs from 'dayjs';
2
+ import 'dayjs/locale/zh-cn';
3
+ export { Dayjs } from 'dayjs';
4
+ export default dayjs;
@@ -0,0 +1,11 @@
1
+ import { cloneDeep, debounce, isBoolean, isEqual, isFunction, isNumber, isObject, isString, merge, omit, pick, uniq, uniqBy, uniqWith, isEmpty, isError, find, groupBy, noop } from 'lodash';
2
+ export { cloneDeep, debounce, isBoolean, isEqual, isFunction, isNumber, isObject, isString, merge, omit, pick, uniq, uniqBy, uniqWith, isEmpty, isError, find, groupBy, noop, };
3
+ export * as consola from 'consola';
4
+ export { default as dayjs, Dayjs } from './dayjs';
5
+ export * from 'zod';
6
+ export * from './string';
7
+ export * from './object';
8
+ export * from './other';
9
+ export * from './number';
10
+ export * from './classs';
11
+ export { default as _ } from 'lodash';
@@ -1,4 +1,4 @@
1
- import { KeyValue, OrderParams, Pagination, SortParams } from '../types';
1
+ import { KeyValue, OrderParams, Pagination, SortParams } from '@wzyjs/types';
2
2
  export declare const handleParams: (params?: Pagination & KeyValue, sort?: SortParams) => {
3
3
  page: {
4
4
  size?: number | undefined;
@@ -2,5 +2,5 @@ export declare class JsonFile {
2
2
  filePath: string;
3
3
  constructor(filePath: string);
4
4
  get(key: string): Promise<unknown>;
5
- set(key: string, value: string): void;
5
+ set(key: string, value: any): void;
6
6
  }
@@ -0,0 +1,2 @@
1
+ export * from './common';
2
+ export * from './node/index';
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ class CustomError extends Error {
4
+ code;
5
+ data;
6
+ constructor(message, code, data) {
7
+ super(message);
8
+ this.code = code;
9
+ this.data = data;
10
+ Error.captureStackTrace(this, this.constructor);
11
+ }
12
+ }
13
+
14
+ exports.CustomError = CustomError;
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var dayjs = require('dayjs');
6
+ var isBetween = require('dayjs/plugin/isBetween');
7
+ var weekday = require('dayjs/plugin/weekday');
8
+ var localeData = require('dayjs/plugin/localeData');
9
+ var isoWeek = require('dayjs/plugin/isoWeek');
10
+ var updateLocale = require('dayjs/plugin/updateLocale');
11
+ require('dayjs/locale/zh-cn');
12
+
13
+ dayjs.extend(isBetween);
14
+ dayjs.extend(weekday);
15
+ dayjs.extend(localeData);
16
+ dayjs.extend(isoWeek);
17
+ dayjs.extend(updateLocale);
18
+ dayjs.locale('zh-cn');
19
+ dayjs.updateLocale('zh-cn', {
20
+ weekStart: 1,
21
+ });
22
+
23
+ Object.defineProperty(exports, 'Dayjs', {
24
+ enumerable: true,
25
+ get: function () { return dayjs.Dayjs; }
26
+ });
27
+ exports.default = dayjs;