@vtj/materials 0.13.15 → 0.13.17

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 (127) hide show
  1. package/dist/assets/antdv/index.umd.js +2 -2
  2. package/dist/assets/charts/index.umd.js +2 -2
  3. package/dist/assets/element/index.umd.js +3 -3
  4. package/dist/assets/icons/index.umd.js +2 -2
  5. package/dist/assets/ui/index.umd.js +2 -2
  6. package/dist/assets/uni-h5/index.umd.js +2 -2
  7. package/dist/assets/uni-ui/index.umd.js +2 -2
  8. package/dist/assets/vant/index.umd.js +2 -2
  9. package/dist/deps/@vtj/charts/index.umd.js +2 -2
  10. package/dist/deps/@vtj/icons/index.umd.js +2 -2
  11. package/dist/deps/@vtj/ui/index.umd.js +4 -4
  12. package/dist/deps/@vtj/ui/style.css +1 -1
  13. package/dist/deps/@vtj/utils/index.umd.js +28 -33
  14. package/dist/deps/@vueuse/core/index.iife.min.js +1 -1
  15. package/dist/deps/element-plus/index.css +1 -1
  16. package/dist/deps/element-plus/index.full.min.js +14 -14
  17. package/dist/deps/element-plus/zh-cn.js +1 -1
  18. package/dist/deps/uni-app/index.umd.js +1 -1
  19. package/dist/deps/uni-h5/index.umd.js +8 -8
  20. package/dist/deps/uni-h5/style.css +1 -1
  21. package/dist/deps/uni-h5-vue/index.umd.js +1 -1
  22. package/dist/deps/uni-ui/index.umd.js +6 -1
  23. package/dist/deps/uni-ui/style.css +1 -1
  24. package/dist/deps/vue/vue.global.js +88 -53
  25. package/dist/deps/vue/vue.global.prod.js +9 -9
  26. package/package.json +12 -12
  27. package/src/antdv/image.ts +1 -1
  28. package/src/element/image.ts +1 -1
  29. package/src/element/virtualizedTable.ts +6 -6
  30. package/src/manifest.json +69 -0
  31. package/src/pages/index.vue +2 -0
  32. package/src/pages.json +19 -0
  33. package/src/uni-ui/index.ts +88 -58
  34. package/src/{uni-ui/lib/uni.scss → uni.scss} +4 -0
  35. package/src/version.ts +2 -2
  36. package/src/uni-ui/lib/uni-col/uni-col.vue +0 -324
  37. package/src/uni-ui/lib/uni-collapse/uni-collapse.vue +0 -153
  38. package/src/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +0 -425
  39. package/src/uni-ui/lib/uni-data-picker/keypress.js +0 -45
  40. package/src/uni-ui/lib/uni-data-picker/uni-data-picker.vue +0 -604
  41. package/src/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +0 -622
  42. package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.css +0 -76
  43. package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +0 -335
  44. package/src/uni-ui/lib/uni-data-select/uni-data-select.vue +0 -590
  45. package/src/uni-ui/lib/uni-datetime-picker/calendar-item.vue +0 -188
  46. package/src/uni-ui/lib/uni-datetime-picker/calendar.vue +0 -985
  47. package/src/uni-ui/lib/uni-datetime-picker/i18n/en.json +0 -22
  48. package/src/uni-ui/lib/uni-datetime-picker/i18n/index.js +0 -8
  49. package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hans.json +0 -22
  50. package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hant.json +0 -22
  51. package/src/uni-ui/lib/uni-datetime-picker/time-picker.vue +0 -1032
  52. package/src/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +0 -1230
  53. package/src/uni-ui/lib/uni-datetime-picker/util.js +0 -448
  54. package/src/uni-ui/lib/uni-easyinput/common.js +0 -54
  55. package/src/uni-ui/lib/uni-easyinput/uni-easyinput.vue +0 -790
  56. package/src/uni-ui/lib/uni-fav/i18n/en.json +0 -4
  57. package/src/uni-ui/lib/uni-fav/i18n/index.js +0 -8
  58. package/src/uni-ui/lib/uni-fav/i18n/zh-Hans.json +0 -4
  59. package/src/uni-ui/lib/uni-fav/i18n/zh-Hant.json +0 -4
  60. package/src/uni-ui/lib/uni-fav/uni-fav.vue +0 -170
  61. package/src/uni-ui/lib/uni-file-picker/choose-and-upload-file.js +0 -280
  62. package/src/uni-ui/lib/uni-file-picker/uni-file-picker.vue +0 -668
  63. package/src/uni-ui/lib/uni-file-picker/upload-file.vue +0 -325
  64. package/src/uni-ui/lib/uni-file-picker/upload-image.vue +0 -292
  65. package/src/uni-ui/lib/uni-file-picker/utils.js +0 -110
  66. package/src/uni-ui/lib/uni-forms/uni-forms.vue +0 -416
  67. package/src/uni-ui/lib/uni-forms/utils.js +0 -293
  68. package/src/uni-ui/lib/uni-forms/validate.js +0 -486
  69. package/src/uni-ui/lib/uni-forms-item/uni-forms-item.vue +0 -630
  70. package/src/uni-ui/lib/uni-goods-nav/i18n/en.json +0 -6
  71. package/src/uni-ui/lib/uni-goods-nav/i18n/index.js +0 -8
  72. package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hans.json +0 -6
  73. package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hant.json +0 -6
  74. package/src/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +0 -231
  75. package/src/uni-ui/lib/uni-grid/uni-grid.vue +0 -148
  76. package/src/uni-ui/lib/uni-icons/uni-icons.uvue +0 -91
  77. package/src/uni-ui/lib/uni-icons/uni-icons.vue +0 -114
  78. package/src/uni-ui/lib/uni-icons/uniicons.css +0 -664
  79. package/src/uni-ui/lib/uni-icons/uniicons.ttf +0 -0
  80. package/src/uni-ui/lib/uni-icons/uniicons_file.ts +0 -664
  81. package/src/uni-ui/lib/uni-icons/uniicons_file_vue.js +0 -649
  82. package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +0 -168
  83. package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +0 -404
  84. package/src/uni-ui/lib/uni-list/uni-list.vue +0 -123
  85. package/src/uni-ui/lib/uni-list/uni-refresh.vue +0 -65
  86. package/src/uni-ui/lib/uni-list/uni-refresh.wxs +0 -87
  87. package/src/uni-ui/lib/uni-load-more/i18n/en.json +0 -5
  88. package/src/uni-ui/lib/uni-load-more/i18n/index.js +0 -8
  89. package/src/uni-ui/lib/uni-load-more/i18n/zh-Hans.json +0 -5
  90. package/src/uni-ui/lib/uni-load-more/i18n/zh-Hant.json +0 -5
  91. package/src/uni-ui/lib/uni-load-more/uni-load-more.vue +0 -456
  92. package/src/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +0 -484
  93. package/src/uni-ui/lib/uni-popup/i18n/en.json +0 -7
  94. package/src/uni-ui/lib/uni-popup/i18n/index.js +0 -8
  95. package/src/uni-ui/lib/uni-popup/i18n/zh-Hans.json +0 -7
  96. package/src/uni-ui/lib/uni-popup/i18n/zh-Hant.json +0 -7
  97. package/src/uni-ui/lib/uni-popup/keypress.js +0 -45
  98. package/src/uni-ui/lib/uni-popup/popup.js +0 -26
  99. package/src/uni-ui/lib/uni-popup/uni-popup.uvue +0 -90
  100. package/src/uni-ui/lib/uni-popup/uni-popup.vue +0 -552
  101. package/src/uni-ui/lib/uni-popup-dialog/keypress.js +0 -45
  102. package/src/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +0 -324
  103. package/src/uni-ui/lib/uni-popup-message/uni-popup-message.vue +0 -149
  104. package/src/uni-ui/lib/uni-rate/uni-rate.vue +0 -380
  105. package/src/uni-ui/lib/uni-row/uni-row.vue +0 -193
  106. package/src/uni-ui/lib/uni-search-bar/i18n/en.json +0 -4
  107. package/src/uni-ui/lib/uni-search-bar/i18n/index.js +0 -8
  108. package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hans.json +0 -4
  109. package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hant.json +0 -4
  110. package/src/uni-ui/lib/uni-search-bar/uni-search-bar.vue +0 -339
  111. package/src/uni-ui/lib/uni-swipe-action-item/bindingx.js +0 -311
  112. package/src/uni-ui/lib/uni-swipe-action-item/isPC.js +0 -12
  113. package/src/uni-ui/lib/uni-swipe-action-item/mpalipay.js +0 -195
  114. package/src/uni-ui/lib/uni-swipe-action-item/mpother.js +0 -260
  115. package/src/uni-ui/lib/uni-swipe-action-item/mpwxs.js +0 -84
  116. package/src/uni-ui/lib/uni-swipe-action-item/render.js +0 -270
  117. package/src/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +0 -493
  118. package/src/uni-ui/lib/uni-swipe-action-item/wx.wxs +0 -341
  119. package/src/uni-ui/lib/uni-table/uni-table.vue +0 -496
  120. package/src/uni-ui/lib/uni-td/uni-td.vue +0 -99
  121. package/src/uni-ui/lib/uni-th/filter-dropdown.vue +0 -559
  122. package/src/uni-ui/lib/uni-th/uni-th.vue +0 -322
  123. package/src/uni-ui/lib/uni-tr/table-checkbox.vue +0 -181
  124. package/src/uni-ui/lib/uni-tr/uni-tr.vue +0 -208
  125. package/src/uni-ui/lib/uni-transition/createAnimation.js +0 -131
  126. package/src/uni-ui/lib/uni-transition/uni-transition.vue +0 -310
  127. package/src/uni-ui/polyfill.ts +0 -41
@@ -1,448 +0,0 @@
1
- class Calendar {
2
- constructor({ selected, startDate, endDate, range } = {}) {
3
- // 当前日期
4
- this.date = this.getDateObj(new Date()); // 当前初入日期
5
- // 打点信息
6
- this.selected = selected || [];
7
- // 起始时间
8
- this.startDate = startDate;
9
- // 终止时间
10
- this.endDate = endDate;
11
- // 是否范围选择
12
- this.range = range;
13
- // 多选状态
14
- this.cleanMultipleStatus();
15
- // 每周日期
16
- this.weeks = {};
17
- this.lastHover = false;
18
- }
19
- /**
20
- * 设置日期
21
- * @param {Object} date
22
- */
23
- setDate(date) {
24
- const selectDate = this.getDateObj(date);
25
- this.getWeeks(selectDate.fullDate);
26
- }
27
-
28
- /**
29
- * 清理多选状态
30
- */
31
- cleanMultipleStatus() {
32
- this.multipleStatus = {
33
- before: '',
34
- after: '',
35
- data: []
36
- };
37
- }
38
-
39
- setStartDate(startDate) {
40
- this.startDate = startDate;
41
- }
42
-
43
- setEndDate(endDate) {
44
- this.endDate = endDate;
45
- }
46
-
47
- getPreMonthObj(date) {
48
- date = fixIosDateFormat(date);
49
- date = new Date(date);
50
-
51
- const oldMonth = date.getMonth();
52
- date.setMonth(oldMonth - 1);
53
- const newMonth = date.getMonth();
54
- if (oldMonth !== 0 && newMonth - oldMonth === 0) {
55
- date.setMonth(newMonth - 1);
56
- }
57
- return this.getDateObj(date);
58
- }
59
- getNextMonthObj(date) {
60
- date = fixIosDateFormat(date);
61
- date = new Date(date);
62
-
63
- const oldMonth = date.getMonth();
64
- date.setMonth(oldMonth + 1);
65
- const newMonth = date.getMonth();
66
- if (newMonth - oldMonth > 1) {
67
- date.setMonth(newMonth - 1);
68
- }
69
- return this.getDateObj(date);
70
- }
71
-
72
- /**
73
- * 获取指定格式Date对象
74
- */
75
- getDateObj(date) {
76
- date = fixIosDateFormat(date);
77
- date = new Date(date);
78
-
79
- return {
80
- fullDate: getDate(date),
81
- year: date.getFullYear(),
82
- month: addZero(date.getMonth() + 1),
83
- date: addZero(date.getDate()),
84
- day: date.getDay()
85
- };
86
- }
87
-
88
- /**
89
- * 获取上一个月日期集合
90
- */
91
- getPreMonthDays(amount, dateObj) {
92
- const result = [];
93
- for (let i = amount - 1; i >= 0; i--) {
94
- const month = dateObj.month - 1;
95
- result.push({
96
- date: new Date(dateObj.year, month, -i).getDate(),
97
- month,
98
- disable: true
99
- });
100
- }
101
- return result;
102
- }
103
- /**
104
- * 获取本月日期集合
105
- */
106
- getCurrentMonthDays(amount, dateObj) {
107
- const result = [];
108
- const fullDate = this.date.fullDate;
109
- for (let i = 1; i <= amount; i++) {
110
- const currentDate = `${dateObj.year}-${dateObj.month}-${addZero(i)}`;
111
- const isToday = fullDate === currentDate;
112
- // 获取打点信息
113
- const info =
114
- this.selected &&
115
- this.selected.find((item) => {
116
- if (this.dateEqual(currentDate, item.date)) {
117
- return item;
118
- }
119
- });
120
-
121
- // 日期禁用
122
- let disableBefore = true;
123
- let disableAfter = true;
124
- if (this.startDate) {
125
- disableBefore = dateCompare(this.startDate, currentDate);
126
- }
127
-
128
- if (this.endDate) {
129
- disableAfter = dateCompare(currentDate, this.endDate);
130
- }
131
-
132
- let multiples = this.multipleStatus.data;
133
- let multiplesStatus = -1;
134
- if (this.range && multiples) {
135
- multiplesStatus = multiples.findIndex((item) => {
136
- return this.dateEqual(item, currentDate);
137
- });
138
- }
139
- const checked = multiplesStatus !== -1;
140
-
141
- result.push({
142
- fullDate: currentDate,
143
- year: dateObj.year,
144
- date: i,
145
- multiple: this.range ? checked : false,
146
- beforeMultiple: this.isLogicBefore(
147
- currentDate,
148
- this.multipleStatus.before,
149
- this.multipleStatus.after
150
- ),
151
- afterMultiple: this.isLogicAfter(
152
- currentDate,
153
- this.multipleStatus.before,
154
- this.multipleStatus.after
155
- ),
156
- month: dateObj.month,
157
- disable:
158
- (this.startDate && !dateCompare(this.startDate, currentDate)) ||
159
- (this.endDate && !dateCompare(currentDate, this.endDate)),
160
- isToday,
161
- userChecked: false,
162
- extraInfo: info
163
- });
164
- }
165
- return result;
166
- }
167
- /**
168
- * 获取下一个月日期集合
169
- */
170
- _getNextMonthDays(amount, dateObj) {
171
- const result = [];
172
- const month = dateObj.month + 1;
173
- for (let i = 1; i <= amount; i++) {
174
- result.push({
175
- date: i,
176
- month,
177
- disable: true
178
- });
179
- }
180
- return result;
181
- }
182
-
183
- /**
184
- * 获取当前日期详情
185
- * @param {Object} date
186
- */
187
- getInfo(date) {
188
- if (!date) {
189
- date = new Date();
190
- }
191
- const res = this.calendar.find(
192
- (item) => item.fullDate === this.getDateObj(date).fullDate
193
- );
194
- return res ? res : this.getDateObj(date);
195
- }
196
-
197
- /**
198
- * 比较时间是否相等
199
- */
200
- dateEqual(before, after) {
201
- before = new Date(fixIosDateFormat(before));
202
- after = new Date(fixIosDateFormat(after));
203
- return before.valueOf() === after.valueOf();
204
- }
205
-
206
- /**
207
- * 比较真实起始日期
208
- */
209
-
210
- isLogicBefore(currentDate, before, after) {
211
- let logicBefore = before;
212
- if (before && after) {
213
- logicBefore = dateCompare(before, after) ? before : after;
214
- }
215
- return this.dateEqual(logicBefore, currentDate);
216
- }
217
-
218
- isLogicAfter(currentDate, before, after) {
219
- let logicAfter = after;
220
- if (before && after) {
221
- logicAfter = dateCompare(before, after) ? after : before;
222
- }
223
- return this.dateEqual(logicAfter, currentDate);
224
- }
225
-
226
- /**
227
- * 获取日期范围内所有日期
228
- * @param {Object} begin
229
- * @param {Object} end
230
- */
231
- geDateAll(begin, end) {
232
- var arr = [];
233
- var ab = begin.split('-');
234
- var ae = end.split('-');
235
- var db = new Date();
236
- db.setFullYear(ab[0], ab[1] - 1, ab[2]);
237
- var de = new Date();
238
- de.setFullYear(ae[0], ae[1] - 1, ae[2]);
239
- var unixDb = db.getTime() - 24 * 60 * 60 * 1000;
240
- var unixDe = de.getTime() - 24 * 60 * 60 * 1000;
241
- for (var k = unixDb; k <= unixDe; ) {
242
- k = k + 24 * 60 * 60 * 1000;
243
- arr.push(this.getDateObj(new Date(parseInt(k))).fullDate);
244
- }
245
- return arr;
246
- }
247
-
248
- /**
249
- * 获取多选状态
250
- */
251
- setMultiple(fullDate) {
252
- if (!this.range) return;
253
-
254
- let { before, after } = this.multipleStatus;
255
- if (before && after) {
256
- if (!this.lastHover) {
257
- this.lastHover = true;
258
- return;
259
- }
260
- this.multipleStatus.before = fullDate;
261
- this.multipleStatus.after = '';
262
- this.multipleStatus.data = [];
263
- this.multipleStatus.fulldate = '';
264
- this.lastHover = false;
265
- } else {
266
- if (!before) {
267
- this.multipleStatus.before = fullDate;
268
- this.multipleStatus.after = undefined;
269
- this.lastHover = false;
270
- } else {
271
- this.multipleStatus.after = fullDate;
272
- if (
273
- dateCompare(this.multipleStatus.before, this.multipleStatus.after)
274
- ) {
275
- this.multipleStatus.data = this.geDateAll(
276
- this.multipleStatus.before,
277
- this.multipleStatus.after
278
- );
279
- } else {
280
- this.multipleStatus.data = this.geDateAll(
281
- this.multipleStatus.after,
282
- this.multipleStatus.before
283
- );
284
- }
285
- this.lastHover = true;
286
- }
287
- }
288
- this.getWeeks(fullDate);
289
- }
290
-
291
- /**
292
- * 鼠标 hover 更新多选状态
293
- */
294
- setHoverMultiple(fullDate) {
295
- //抖音小程序点击会触发hover事件,需要避免一下
296
- // #ifndef MP-TOUTIAO
297
- if (!this.range || this.lastHover) return;
298
- const { before } = this.multipleStatus;
299
-
300
- if (!before) {
301
- this.multipleStatus.before = fullDate;
302
- } else {
303
- this.multipleStatus.after = fullDate;
304
- if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
305
- this.multipleStatus.data = this.geDateAll(
306
- this.multipleStatus.before,
307
- this.multipleStatus.after
308
- );
309
- } else {
310
- this.multipleStatus.data = this.geDateAll(
311
- this.multipleStatus.after,
312
- this.multipleStatus.before
313
- );
314
- }
315
- }
316
- this.getWeeks(fullDate);
317
- // #endif
318
- }
319
-
320
- /**
321
- * 更新默认值多选状态
322
- */
323
- setDefaultMultiple(before, after) {
324
- this.multipleStatus.before = before;
325
- this.multipleStatus.after = after;
326
- if (before && after) {
327
- if (dateCompare(before, after)) {
328
- this.multipleStatus.data = this.geDateAll(before, after);
329
- this.getWeeks(after);
330
- } else {
331
- this.multipleStatus.data = this.geDateAll(after, before);
332
- this.getWeeks(before);
333
- }
334
- }
335
- }
336
-
337
- /**
338
- * 获取每周数据
339
- * @param {Object} dateData
340
- */
341
- getWeeks(dateData) {
342
- const { year, month } = this.getDateObj(dateData);
343
-
344
- const preMonthDayAmount = new Date(year, month - 1, 1).getDay();
345
- const preMonthDays = this.getPreMonthDays(
346
- preMonthDayAmount,
347
- this.getDateObj(dateData)
348
- );
349
-
350
- const currentMonthDayAmount = new Date(year, month, 0).getDate();
351
- const currentMonthDays = this.getCurrentMonthDays(
352
- currentMonthDayAmount,
353
- this.getDateObj(dateData)
354
- );
355
-
356
- const nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount;
357
- const nextMonthDays = this._getNextMonthDays(
358
- nextMonthDayAmount,
359
- this.getDateObj(dateData)
360
- );
361
-
362
- const calendarDays = [
363
- ...preMonthDays,
364
- ...currentMonthDays,
365
- ...nextMonthDays
366
- ];
367
-
368
- const weeks = new Array(6);
369
- for (let i = 0; i < calendarDays.length; i++) {
370
- const index = Math.floor(i / 7);
371
- if (!weeks[index]) {
372
- weeks[index] = new Array(7);
373
- }
374
- weeks[index][i % 7] = calendarDays[i];
375
- }
376
-
377
- this.calendar = calendarDays;
378
- this.weeks = weeks;
379
- }
380
- }
381
-
382
- function getDateTime(date, hideSecond) {
383
- return `${getDate(date)} ${getTime(date, hideSecond)}`;
384
- }
385
-
386
- function getDate(date) {
387
- date = fixIosDateFormat(date);
388
- date = new Date(date);
389
- const year = date.getFullYear();
390
- const month = date.getMonth() + 1;
391
- const day = date.getDate();
392
- return `${year}-${addZero(month)}-${addZero(day)}`;
393
- }
394
-
395
- function getTime(date, hideSecond) {
396
- date = fixIosDateFormat(date);
397
- date = new Date(date);
398
- const hour = date.getHours();
399
- const minute = date.getMinutes();
400
- const second = date.getSeconds();
401
- return hideSecond
402
- ? `${addZero(hour)}:${addZero(minute)}`
403
- : `${addZero(hour)}:${addZero(minute)}:${addZero(second)}`;
404
- }
405
-
406
- function addZero(num) {
407
- if (num < 10) {
408
- num = `0${num}`;
409
- }
410
- return num;
411
- }
412
-
413
- function getDefaultSecond(hideSecond) {
414
- return hideSecond ? '00:00' : '00:00:00';
415
- }
416
-
417
- function dateCompare(startDate, endDate) {
418
- startDate = new Date(fixIosDateFormat(startDate));
419
- endDate = new Date(fixIosDateFormat(endDate));
420
- return startDate <= endDate;
421
- }
422
-
423
- function checkDate(date) {
424
- const dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g;
425
- return date.match(dateReg);
426
- }
427
- //ios低版本15及以下,无法匹配 没有 ’秒‘ 时的情况,所以需要在末尾 秒 加上 问号
428
- const dateTimeReg =
429
- /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])( [0-5]?[0-9]:[0-5]?[0-9](:[0-5]?[0-9])?)?$/;
430
-
431
- function fixIosDateFormat(value) {
432
- if (typeof value === 'string' && dateTimeReg.test(value)) {
433
- value = value.replace(/-/g, '/');
434
- }
435
- return value;
436
- }
437
-
438
- export {
439
- Calendar,
440
- getDateTime,
441
- getDate,
442
- getTime,
443
- addZero,
444
- getDefaultSecond,
445
- dateCompare,
446
- checkDate,
447
- fixIosDateFormat
448
- };
@@ -1,54 +0,0 @@
1
- /**
2
- * @desc 函数防抖
3
- * @param func 目标函数
4
- * @param wait 延迟执行毫秒数
5
- * @param immediate true - 立即执行, false - 延迟执行
6
- */
7
- export const debounce = function(func, wait = 1000, immediate = true) {
8
- let timer;
9
- return function() {
10
- let context = this,
11
- args = arguments;
12
- if (timer) clearTimeout(timer);
13
- if (immediate) {
14
- let callNow = !timer;
15
- timer = setTimeout(() => {
16
- timer = null;
17
- }, wait);
18
- if (callNow) func.apply(context, args);
19
- } else {
20
- timer = setTimeout(() => {
21
- func.apply(context, args);
22
- }, wait)
23
- }
24
- }
25
- }
26
- /**
27
- * @desc 函数节流
28
- * @param func 函数
29
- * @param wait 延迟执行毫秒数
30
- * @param type 1 使用表时间戳,在时间段开始的时候触发 2 使用表定时器,在时间段结束的时候触发
31
- */
32
- export const throttle = (func, wait = 1000, type = 1) => {
33
- let previous = 0;
34
- let timeout;
35
- return function() {
36
- let context = this;
37
- let args = arguments;
38
- if (type === 1) {
39
- let now = Date.now();
40
-
41
- if (now - previous > wait) {
42
- func.apply(context, args);
43
- previous = now;
44
- }
45
- } else if (type === 2) {
46
- if (!timeout) {
47
- timeout = setTimeout(() => {
48
- timeout = null;
49
- func.apply(context, args)
50
- }, wait)
51
- }
52
- }
53
- }
54
- }