@vtj/materials 0.10.1-alpha.0 → 0.10.1-alpha.2

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 (56) 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 +2 -2
  4. package/dist/assets/ui/index.umd.js +2 -2
  5. package/dist/assets/uni-h5/index.umd.js +3 -3
  6. package/dist/assets/uni-ui/index.umd.js +7 -0
  7. package/dist/assets/vant/index.umd.js +2 -2
  8. package/dist/deps/@vtj/charts/index.umd.js +2 -2
  9. package/dist/deps/@vtj/icons/index.umd.js +2 -2
  10. package/dist/deps/@vtj/ui/index.umd.js +2 -2
  11. package/dist/deps/@vtj/uni/index.umd.js +3 -3
  12. package/dist/deps/@vtj/utils/index.umd.js +2 -2
  13. package/dist/deps/mockjs/mock-min.js +10 -0
  14. package/dist/deps/uni-ui/index.umd.js +1 -0
  15. package/dist/deps/uni-ui/style.css +1 -0
  16. package/package.json +9 -6
  17. package/src/env.d.ts +7 -0
  18. package/src/uni-h5/components/index.ts +43 -2
  19. package/src/uni-ui/components/badge.ts +73 -0
  20. package/src/uni-ui/components/index.ts +30 -0
  21. package/src/uni-ui/index.ts +213 -0
  22. package/src/uni-ui/lib/uni-datetime-picker/calendar-item.vue +177 -0
  23. package/src/uni-ui/lib/uni-datetime-picker/calendar.vue +947 -0
  24. package/src/uni-ui/lib/uni-datetime-picker/i18n/en.json +22 -0
  25. package/src/uni-ui/lib/uni-datetime-picker/i18n/index.js +8 -0
  26. package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hans.json +22 -0
  27. package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hant.json +22 -0
  28. package/src/uni-ui/lib/uni-datetime-picker/time-picker.vue +940 -0
  29. package/src/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +1232 -0
  30. package/src/uni-ui/lib/uni-datetime-picker/util.js +421 -0
  31. package/src/uni-ui/lib/uni-forms/uni-forms.vue +416 -0
  32. package/src/uni-ui/lib/uni-forms/utils.js +293 -0
  33. package/src/uni-ui/lib/uni-forms/validate.js +486 -0
  34. package/src/uni-ui/lib/uni-popup/i18n/en.json +7 -0
  35. package/src/uni-ui/lib/uni-popup/i18n/index.js +8 -0
  36. package/src/uni-ui/lib/uni-popup/i18n/zh-Hans.json +7 -0
  37. package/src/uni-ui/lib/uni-popup/i18n/zh-Hant.json +7 -0
  38. package/src/uni-ui/lib/uni-popup/keypress.js +45 -0
  39. package/src/uni-ui/lib/uni-popup/popup.js +26 -0
  40. package/src/uni-ui/lib/uni-popup/uni-popup.uvue +90 -0
  41. package/src/uni-ui/lib/uni-popup/uni-popup.vue +552 -0
  42. package/src/uni-ui/lib/uni-swipe-action-item/bindingx.js +302 -0
  43. package/src/uni-ui/lib/uni-swipe-action-item/isPC.js +12 -0
  44. package/src/uni-ui/lib/uni-swipe-action-item/mpalipay.js +195 -0
  45. package/src/uni-ui/lib/uni-swipe-action-item/mpother.js +260 -0
  46. package/src/uni-ui/lib/uni-swipe-action-item/mpwxs.js +84 -0
  47. package/src/uni-ui/lib/uni-swipe-action-item/render.js +270 -0
  48. package/src/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +494 -0
  49. package/src/uni-ui/lib/uni-swipe-action-item/wx.wxs +341 -0
  50. package/src/uni-ui/lib/uni-th/filter-dropdown.vue +511 -0
  51. package/src/uni-ui/lib/uni-th/uni-th.vue +295 -0
  52. package/src/uni-ui/lib/uni-tr/table-checkbox.vue +179 -0
  53. package/src/uni-ui/lib/uni-tr/uni-tr.vue +184 -0
  54. package/src/uni-ui/lib/uni.scss +76 -0
  55. package/src/uni-ui/polyfill.ts +41 -0
  56. package/src/version.ts +2 -2
@@ -0,0 +1,511 @@
1
+ <template>
2
+ <view class="uni-filter-dropdown">
3
+ <view class="dropdown-btn" @click="onDropdown">
4
+ <view class="icon-select" :class="{active: canReset}" v-if="isSelect || isRange"></view>
5
+ <view class="icon-search" :class="{active: canReset}" v-if="isSearch">
6
+ <view class="icon-search-0"></view>
7
+ <view class="icon-search-1"></view>
8
+ </view>
9
+ <view class="icon-calendar" :class="{active: canReset}" v-if="isDate">
10
+ <view class="icon-calendar-0"></view>
11
+ <view class="icon-calendar-1"></view>
12
+ </view>
13
+ </view>
14
+ <view class="uni-dropdown-cover" v-if="isOpened" @click="handleClose"></view>
15
+ <view class="dropdown-popup dropdown-popup-right" v-if="isOpened" @click.stop>
16
+ <!-- select-->
17
+ <view v-if="isSelect" class="list">
18
+ <label class="flex-r a-i-c list-item" v-for="(item,index) in dataList" :key="index"
19
+ @click="onItemClick($event, index)">
20
+ <check-box class="check" :checked="item.checked" />
21
+ <view class="checklist-content">
22
+ <text class="checklist-text" :style="item.styleIconText">{{item[map.text]}}</text>
23
+ </view>
24
+ </label>
25
+ </view>
26
+ <view v-if="isSelect" class="flex-r opera-area">
27
+ <view class="flex-f btn btn-default" :class="{disable: !canReset}" @click="handleSelectReset">
28
+ {{resource.reset}}</view>
29
+ <view class="flex-f btn btn-submit" @click="handleSelectSubmit">{{resource.submit}}</view>
30
+ </view>
31
+ <!-- search -->
32
+ <view v-if="isSearch" class="search-area">
33
+ <input class="search-input" v-model="filterValue" />
34
+ </view>
35
+ <view v-if="isSearch" class="flex-r opera-area">
36
+ <view class="flex-f btn btn-submit" @click="handleSearchSubmit">{{resource.search}}</view>
37
+ <view class="flex-f btn btn-default" :class="{disable: !canReset}" @click="handleSearchReset">
38
+ {{resource.reset}}</view>
39
+ </view>
40
+ <!-- range -->
41
+ <view v-if="isRange">
42
+ <view class="input-label">{{resource.gt}}</view>
43
+ <input class="input" v-model="gtValue" />
44
+ <view class="input-label">{{resource.lt}}</view>
45
+ <input class="input" v-model="ltValue" />
46
+ </view>
47
+ <view v-if="isRange" class="flex-r opera-area">
48
+ <view class="flex-f btn btn-default" :class="{disable: !canReset}" @click="handleRangeReset">
49
+ {{resource.reset}}</view>
50
+ <view class="flex-f btn btn-submit" @click="handleRangeSubmit">{{resource.submit}}</view>
51
+ </view>
52
+ <!-- date -->
53
+ <view v-if="isDate">
54
+ <uni-datetime-picker ref="datetimepicker" :value="dateRange" type="datetimerange" return-type="timestamp" @change="datetimechange" @maskClick="timepickerclose">
55
+ <view></view>
56
+ </uni-datetime-picker>
57
+ </view>
58
+ </view>
59
+ </view>
60
+ </template>
61
+
62
+ <script>
63
+ import checkBox from '../uni-tr/table-checkbox.vue'
64
+
65
+ const resource = {
66
+ "reset": "重置",
67
+ "search": "搜索",
68
+ "submit": "确定",
69
+ "filter": "筛选",
70
+ "gt": "大于等于",
71
+ "lt": "小于等于",
72
+ "date": "日期范围"
73
+ }
74
+
75
+ const DropdownType = {
76
+ Select: "select",
77
+ Search: "search",
78
+ Range: "range",
79
+ Date: "date",
80
+ Timestamp: "timestamp"
81
+ }
82
+
83
+ export default {
84
+ name: 'FilterDropdown',
85
+ emits:['change'],
86
+ components: {
87
+ checkBox
88
+ },
89
+ options: {
90
+ virtualHost: true
91
+ },
92
+ props: {
93
+ filterType: {
94
+ type: String,
95
+ default: DropdownType.Select
96
+ },
97
+ filterData: {
98
+ type: Array,
99
+ default () {
100
+ return []
101
+ }
102
+ },
103
+ mode: {
104
+ type: String,
105
+ default: 'default'
106
+ },
107
+ map: {
108
+ type: Object,
109
+ default () {
110
+ return {
111
+ text: 'text',
112
+ value: 'value'
113
+ }
114
+ }
115
+ },
116
+ filterDefaultValue: {
117
+ type: [Array,String],
118
+ default () {
119
+ return ""
120
+ }
121
+ }
122
+ },
123
+ computed: {
124
+ canReset() {
125
+ if (this.isSearch) {
126
+ return this.filterValue.length > 0
127
+ }
128
+ if (this.isSelect) {
129
+ return this.checkedValues.length > 0
130
+ }
131
+ if (this.isRange) {
132
+ return (this.gtValue.length > 0 && this.ltValue.length > 0)
133
+ }
134
+ if (this.isDate) {
135
+ return this.dateSelect.length > 0
136
+ }
137
+ return false
138
+ },
139
+ isSelect() {
140
+ return this.filterType === DropdownType.Select
141
+ },
142
+ isSearch() {
143
+ return this.filterType === DropdownType.Search
144
+ },
145
+ isRange() {
146
+ return this.filterType === DropdownType.Range
147
+ },
148
+ isDate() {
149
+ return (this.filterType === DropdownType.Date || this.filterType === DropdownType.Timestamp)
150
+ }
151
+ },
152
+ watch: {
153
+ filterData(newVal) {
154
+ this._copyFilters()
155
+ },
156
+ indeterminate(newVal) {
157
+ this.isIndeterminate = newVal
158
+ }
159
+ },
160
+ data() {
161
+ return {
162
+ resource,
163
+ enabled: true,
164
+ isOpened: false,
165
+ dataList: [],
166
+ filterValue: this.filterDefaultValue,
167
+ checkedValues: [],
168
+ gtValue: '',
169
+ ltValue: '',
170
+ dateRange: [],
171
+ dateSelect: []
172
+ };
173
+ },
174
+ created() {
175
+ this._copyFilters()
176
+ },
177
+ methods: {
178
+ _copyFilters() {
179
+ let dl = JSON.parse(JSON.stringify(this.filterData))
180
+ for (let i = 0; i < dl.length; i++) {
181
+ if (dl[i].checked === undefined) {
182
+ dl[i].checked = false
183
+ }
184
+ }
185
+ this.dataList = dl
186
+ },
187
+ openPopup() {
188
+ this.isOpened = true
189
+ if (this.isDate) {
190
+ this.$nextTick(() => {
191
+ if (!this.dateRange.length) {
192
+ this.resetDate()
193
+ }
194
+ this.$refs.datetimepicker.show()
195
+ })
196
+ }
197
+ },
198
+ closePopup() {
199
+ this.isOpened = false
200
+ },
201
+ handleClose(e) {
202
+ this.closePopup()
203
+ },
204
+ resetDate() {
205
+ let date = new Date()
206
+ let dateText = date.toISOString().split('T')[0]
207
+ this.dateRange = [dateText + ' 0:00:00', dateText + ' 23:59:59']
208
+ },
209
+ onDropdown(e) {
210
+ this.openPopup()
211
+ },
212
+ onItemClick(e, index) {
213
+ let items = this.dataList
214
+ let listItem = items[index]
215
+ if (listItem.checked === undefined) {
216
+ items[index].checked = true
217
+ } else {
218
+ items[index].checked = !listItem.checked
219
+ }
220
+
221
+ let checkvalues = []
222
+ for (let i = 0; i < items.length; i++) {
223
+ const item = items[i]
224
+ if (item.checked) {
225
+ checkvalues.push(item.value)
226
+ }
227
+ }
228
+ this.checkedValues = checkvalues
229
+ },
230
+ datetimechange(e) {
231
+ this.closePopup()
232
+ this.dateRange = e
233
+ this.dateSelect = e
234
+ this.$emit('change', {
235
+ filterType: this.filterType,
236
+ filter: e
237
+ })
238
+ },
239
+ timepickerclose(e) {
240
+ this.closePopup()
241
+ },
242
+ handleSelectSubmit() {
243
+ this.closePopup()
244
+ this.$emit('change', {
245
+ filterType: this.filterType,
246
+ filter: this.checkedValues
247
+ })
248
+ },
249
+ handleSelectReset() {
250
+ if (!this.canReset) {
251
+ return;
252
+ }
253
+ var items = this.dataList
254
+ for (let i = 0; i < items.length; i++) {
255
+ let item = items[i]
256
+ this.$set(item, 'checked', false)
257
+ }
258
+ this.checkedValues = []
259
+ this.handleSelectSubmit()
260
+ },
261
+ handleSearchSubmit() {
262
+ this.closePopup()
263
+ this.$emit('change', {
264
+ filterType: this.filterType,
265
+ filter: this.filterValue
266
+ })
267
+ },
268
+ handleSearchReset() {
269
+ if (!this.canReset) {
270
+ return;
271
+ }
272
+ this.filterValue = ''
273
+ this.handleSearchSubmit()
274
+ },
275
+ handleRangeSubmit(isReset) {
276
+ this.closePopup()
277
+ this.$emit('change', {
278
+ filterType: this.filterType,
279
+ filter: isReset === true ? [] : [parseInt(this.gtValue), parseInt(this.ltValue)]
280
+ })
281
+ },
282
+ handleRangeReset() {
283
+ if (!this.canReset) {
284
+ return;
285
+ }
286
+ this.gtValue = ''
287
+ this.ltValue = ''
288
+ this.handleRangeSubmit(true)
289
+ }
290
+ }
291
+ }
292
+ </script>
293
+
294
+ <style lang="scss">
295
+ $uni-primary: #1890ff !default;
296
+
297
+ .flex-r {
298
+ display: flex;
299
+ flex-direction: row;
300
+ }
301
+
302
+ .flex-f {
303
+ flex: 1;
304
+ }
305
+
306
+ .a-i-c {
307
+ align-items: center;
308
+ }
309
+
310
+ .j-c-c {
311
+ justify-content: center;
312
+ }
313
+
314
+ .icon-select {
315
+ width: 14px;
316
+ height: 16px;
317
+ border: solid 6px transparent;
318
+ border-top: solid 6px #ddd;
319
+ border-bottom: none;
320
+ background-color: #ddd;
321
+ background-clip: content-box;
322
+ box-sizing: border-box;
323
+ }
324
+
325
+ .icon-select.active {
326
+ background-color: $uni-primary;
327
+ border-top-color: $uni-primary;
328
+ }
329
+
330
+ .icon-search {
331
+ width: 12px;
332
+ height: 16px;
333
+ position: relative;
334
+ }
335
+
336
+ .icon-search-0 {
337
+ border: 2px solid #ddd;
338
+ border-radius: 8px;
339
+ width: 7px;
340
+ height: 7px;
341
+ }
342
+
343
+ .icon-search-1 {
344
+ position: absolute;
345
+ top: 8px;
346
+ right: 0;
347
+ width: 1px;
348
+ height: 7px;
349
+ background-color: #ddd;
350
+ transform: rotate(-45deg);
351
+ }
352
+
353
+ .icon-search.active .icon-search-0 {
354
+ border-color: $uni-primary;
355
+ }
356
+
357
+ .icon-search.active .icon-search-1 {
358
+ background-color: $uni-primary;
359
+ }
360
+
361
+ .icon-calendar {
362
+ color: #ddd;
363
+ width: 14px;
364
+ height: 16px;
365
+ }
366
+
367
+ .icon-calendar-0 {
368
+ height: 4px;
369
+ margin-top: 3px;
370
+ margin-bottom: 1px;
371
+ background-color: #ddd;
372
+ border-radius: 2px 2px 1px 1px;
373
+ position: relative;
374
+ }
375
+ .icon-calendar-0:before, .icon-calendar-0:after {
376
+ content: '';
377
+ position: absolute;
378
+ top: -3px;
379
+ width: 4px;
380
+ height: 3px;
381
+ border-radius: 1px;
382
+ background-color: #ddd;
383
+ }
384
+ .icon-calendar-0:before {
385
+ left: 2px;
386
+ }
387
+ .icon-calendar-0:after {
388
+ right: 2px;
389
+ }
390
+
391
+ .icon-calendar-1 {
392
+ height: 9px;
393
+ background-color: #ddd;
394
+ border-radius: 1px 1px 2px 2px;
395
+ }
396
+
397
+ .icon-calendar.active {
398
+ color: $uni-primary;
399
+ }
400
+
401
+ .icon-calendar.active .icon-calendar-0,
402
+ .icon-calendar.active .icon-calendar-1,
403
+ .icon-calendar.active .icon-calendar-0:before,
404
+ .icon-calendar.active .icon-calendar-0:after {
405
+ background-color: $uni-primary;
406
+ }
407
+
408
+ .uni-filter-dropdown {
409
+ position: relative;
410
+ font-weight: normal;
411
+ }
412
+
413
+ .dropdown-popup {
414
+ position: absolute;
415
+ top: 100%;
416
+ background-color: #fff;
417
+ box-shadow: 0 3px 6px -4px #0000001f, 0 6px 16px #00000014, 0 9px 28px 8px #0000000d;
418
+ min-width: 150px;
419
+ z-index: 1000;
420
+ }
421
+
422
+ .dropdown-popup-left {
423
+ left: 0;
424
+ }
425
+
426
+ .dropdown-popup-right {
427
+ right: 0;
428
+ }
429
+
430
+ .uni-dropdown-cover {
431
+ position: fixed;
432
+ left: 0;
433
+ top: 0;
434
+ right: 0;
435
+ bottom: 0;
436
+ background-color: transparent;
437
+ z-index: 100;
438
+ }
439
+
440
+ .list {
441
+ margin-top: 5px;
442
+ margin-bottom: 5px;
443
+ }
444
+
445
+ .list-item {
446
+ padding: 5px 10px;
447
+ text-align: left;
448
+ }
449
+
450
+ .list-item:hover {
451
+ background-color: #f0f0f0;
452
+ }
453
+
454
+ .check {
455
+ margin-right: 5px;
456
+ }
457
+
458
+ .search-area {
459
+ padding: 10px;
460
+ }
461
+
462
+ .search-input {
463
+ font-size: 12px;
464
+ border: 1px solid #f0f0f0;
465
+ border-radius: 3px;
466
+ padding: 2px 5px;
467
+ min-width: 150px;
468
+ text-align: left;
469
+ }
470
+
471
+ .input-label {
472
+ margin: 10px 10px 5px 10px;
473
+ text-align: left;
474
+ }
475
+
476
+ .input {
477
+ font-size: 12px;
478
+ border: 1px solid #f0f0f0;
479
+ border-radius: 3px;
480
+ margin: 10px;
481
+ padding: 2px 5px;
482
+ min-width: 150px;
483
+ text-align: left;
484
+ }
485
+
486
+ .opera-area {
487
+ cursor: default;
488
+ border-top: 1px solid #ddd;
489
+ padding: 5px;
490
+ }
491
+
492
+ .opera-area .btn {
493
+ font-size: 12px;
494
+ border-radius: 3px;
495
+ margin: 5px;
496
+ padding: 4px 4px;
497
+ }
498
+
499
+ .btn-default {
500
+ border: 1px solid #ddd;
501
+ }
502
+
503
+ .btn-default.disable {
504
+ border-color: transparent;
505
+ }
506
+
507
+ .btn-submit {
508
+ background-color: $uni-primary;
509
+ color: #ffffff;
510
+ }
511
+ </style>