@kengic/uni 0.5.1 → 0.5.2-beta.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 (146) hide show
  1. package/dist/uni/uni-ui/uni-badge/uni-badge.vue +222 -219
  2. package/dist/uni/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +29 -29
  3. package/dist/uni/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +88 -88
  4. package/dist/uni/uni-ui/uni-calendar/calendar.js +936 -532
  5. package/dist/uni/uni-ui/uni-calendar/i18n/en.json +10 -10
  6. package/dist/uni/uni-ui/uni-calendar/i18n/index.js +8 -7
  7. package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hans.json +10 -10
  8. package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hant.json +10 -10
  9. package/dist/uni/uni-ui/uni-calendar/uni-calendar-item.vue +190 -168
  10. package/dist/uni/uni-ui/uni-calendar/uni-calendar.vue +459 -459
  11. package/dist/uni/uni-ui/uni-calendar/util.js +324 -340
  12. package/dist/uni/uni-ui/uni-card/uni-card.vue +8 -1
  13. package/dist/uni/uni-ui/uni-col/uni-col.vue +294 -287
  14. package/dist/uni/uni-ui/uni-collapse/uni-collapse.vue +139 -140
  15. package/dist/uni/uni-ui/uni-collapse-item/uni-collapse-item.vue +381 -378
  16. package/dist/uni/uni-ui/uni-combox/uni-combox.vue +280 -272
  17. package/dist/uni/uni-ui/uni-countdown/i18n/en.json +4 -4
  18. package/dist/uni/uni-ui/uni-countdown/i18n/index.js +8 -7
  19. package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hans.json +4 -4
  20. package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hant.json +4 -4
  21. package/dist/uni/uni-ui/uni-countdown/uni-countdown.vue +249 -257
  22. package/dist/uni/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +832 -813
  23. package/dist/uni/uni-ui/uni-data-picker/keypress.js +42 -42
  24. package/dist/uni/uni-ui/uni-data-picker/uni-data-picker.vue +535 -516
  25. package/dist/uni/uni-ui/uni-data-pickerview/uni-data-picker.js +623 -618
  26. package/dist/uni/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +293 -288
  27. package/dist/uni/uni-ui/uni-data-select/uni-data-select.vue +495 -509
  28. package/dist/uni/uni-ui/uni-dateformat/date-format.js +181 -184
  29. package/dist/uni/uni-ui/uni-dateformat/uni-dateformat.vue +81 -82
  30. package/dist/uni/uni-ui/uni-datetime-picker/calendar-item.vue +176 -170
  31. package/dist/uni/uni-ui/uni-datetime-picker/calendar.vue +926 -920
  32. package/dist/uni/uni-ui/uni-datetime-picker/i18n/en.json +20 -20
  33. package/dist/uni/uni-ui/uni-datetime-picker/i18n/index.js +8 -7
  34. package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +21 -21
  35. package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +21 -21
  36. package/dist/uni/uni-ui/uni-datetime-picker/time-picker.vue +921 -926
  37. package/dist/uni/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1059 -1012
  38. package/dist/uni/uni-ui/uni-datetime-picker/util.js +366 -377
  39. package/dist/uni/uni-ui/uni-drawer/keypress.js +42 -42
  40. package/dist/uni/uni-ui/uni-drawer/uni-drawer.vue +176 -167
  41. package/dist/uni/uni-ui/uni-easyinput/common.js +40 -42
  42. package/dist/uni/uni-ui/uni-easyinput/uni-easyinput.vue +628 -547
  43. package/dist/uni/uni-ui/uni-fab/uni-fab.vue +507 -483
  44. package/dist/uni/uni-ui/uni-fav/i18n/en.json +2 -2
  45. package/dist/uni/uni-ui/uni-fav/i18n/index.js +8 -7
  46. package/dist/uni/uni-ui/uni-fav/i18n/zh-Hans.json +2 -2
  47. package/dist/uni/uni-ui/uni-fav/i18n/zh-Hant.json +2 -2
  48. package/dist/uni/uni-ui/uni-fav/uni-fav.vue +155 -147
  49. package/dist/uni/uni-ui/uni-file-picker/choose-and-upload-file.js +172 -198
  50. package/dist/uni/uni-ui/uni-file-picker/uni-file-picker.vue +636 -634
  51. package/dist/uni/uni-ui/uni-file-picker/upload-file.vue +294 -293
  52. package/dist/uni/uni-ui/uni-file-picker/upload-image.vue +267 -270
  53. package/dist/uni/uni-ui/uni-file-picker/utils.js +81 -82
  54. package/dist/uni/uni-ui/uni-forms/uni-forms.vue +360 -372
  55. package/dist/uni/uni-ui/uni-forms/utils.js +170 -174
  56. package/dist/uni/uni-ui/uni-forms/validate.js +447 -456
  57. package/dist/uni/uni-ui/uni-forms-item/uni-forms-item.vue +497 -497
  58. package/dist/uni/uni-ui/uni-goods-nav/i18n/en.json +4 -4
  59. package/dist/uni/uni-ui/uni-goods-nav/i18n/index.js +8 -7
  60. package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hans.json +4 -4
  61. package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hant.json +4 -4
  62. package/dist/uni/uni-ui/uni-goods-nav/uni-goods-nav.vue +238 -222
  63. package/dist/uni/uni-ui/uni-grid/uni-grid.vue +134 -134
  64. package/dist/uni/uni-ui/uni-grid-item/uni-grid-item.vue +121 -119
  65. package/dist/uni/uni-ui/uni-group/uni-group.vue +121 -121
  66. package/dist/uni/uni-ui/uni-icons/icons.js +1170 -1168
  67. package/dist/uni/uni-ui/uni-icons/uni-icons.vue +91 -86
  68. package/dist/uni/uni-ui/uni-icons/uniicons.css +166 -166
  69. package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +129 -129
  70. package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list.vue +352 -347
  71. package/dist/uni/uni-ui/uni-link/uni-link.vue +134 -119
  72. package/dist/uni/uni-ui/uni-list/uni-list.vue +119 -110
  73. package/dist/uni/uni-ui/uni-list/uni-refresh.vue +14 -14
  74. package/dist/uni/uni-ui/uni-list/uni-refresh.wxs +14 -14
  75. package/dist/uni/uni-ui/uni-list-ad/uni-list-ad.vue +101 -95
  76. package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.scss +18 -18
  77. package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.vue +602 -586
  78. package/dist/uni/uni-ui/uni-list-item/uni-list-item.vue +507 -503
  79. package/dist/uni/uni-ui/uni-load-more/i18n/en.json +3 -3
  80. package/dist/uni/uni-ui/uni-load-more/i18n/index.js +8 -7
  81. package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hans.json +3 -3
  82. package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hant.json +3 -3
  83. package/dist/uni/uni-ui/uni-load-more/uni-load-more.vue +402 -392
  84. package/dist/uni/uni-ui/uni-nav-bar/uni-nav-bar.vue +328 -330
  85. package/dist/uni/uni-ui/uni-nav-bar/uni-status-bar.vue +17 -17
  86. package/dist/uni/uni-ui/uni-notice-bar/uni-notice-bar.vue +422 -401
  87. package/dist/uni/uni-ui/uni-number-box/uni-number-box.vue +211 -205
  88. package/dist/uni/uni-ui/uni-pagination/i18n/en.json +3 -3
  89. package/dist/uni/uni-ui/uni-pagination/i18n/es.json +3 -3
  90. package/dist/uni/uni-ui/uni-pagination/i18n/fr.json +3 -3
  91. package/dist/uni/uni-ui/uni-pagination/i18n/index.js +12 -11
  92. package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hans.json +3 -3
  93. package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hant.json +3 -3
  94. package/dist/uni/uni-ui/uni-pagination/uni-pagination.vue +450 -433
  95. package/dist/uni/uni-ui/uni-popup/uni-popup.vue +404 -404
  96. package/dist/uni/uni-ui/uni-popup-dialog/keypress.js +42 -42
  97. package/dist/uni/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +1 -0
  98. package/dist/uni/uni-ui/uni-popup-message/uni-popup-message.vue +126 -125
  99. package/dist/uni/uni-ui/uni-popup-share/uni-popup-share.vue +172 -172
  100. package/dist/uni/uni-ui/uni-rate/uni-rate.vue +343 -347
  101. package/dist/uni/uni-ui/uni-row/uni-row.vue +180 -182
  102. package/dist/uni/uni-ui/uni-scss/changelog.md +11 -4
  103. package/dist/uni/uni-ui/uni-scss/package.json +73 -73
  104. package/dist/uni/uni-ui/uni-scss/readme.md +2 -1
  105. package/dist/uni/uni-ui/uni-scss/styles/setting/_border.scss +2 -2
  106. package/dist/uni/uni-ui/uni-scss/styles/setting/_color.scss +46 -47
  107. package/dist/uni/uni-ui/uni-scss/styles/setting/_radius.scss +49 -49
  108. package/dist/uni/uni-ui/uni-scss/styles/setting/_space.scss +52 -53
  109. package/dist/uni/uni-ui/uni-scss/styles/setting/_styles.scss +142 -147
  110. package/dist/uni/uni-ui/uni-scss/styles/setting/_text.scss +20 -20
  111. package/dist/uni/uni-ui/uni-scss/styles/setting/_variables.scss +111 -95
  112. package/dist/uni/uni-ui/uni-scss/styles/tools/functions.scss +28 -18
  113. package/dist/uni/uni-ui/uni-scss/theme.scss +10 -7
  114. package/dist/uni/uni-ui/uni-scss/variables.scss +42 -24
  115. package/dist/uni/uni-ui/uni-search-bar/i18n/en.json +3 -3
  116. package/dist/uni/uni-ui/uni-search-bar/i18n/index.js +8 -7
  117. package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hans.json +2 -2
  118. package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hant.json +2 -2
  119. package/dist/uni/uni-ui/uni-search-bar/uni-search-bar.vue +290 -281
  120. package/dist/uni/uni-ui/uni-section/uni-section.vue +149 -146
  121. package/dist/uni/uni-ui/uni-segmented-control/uni-segmented-control.vue +141 -131
  122. package/dist/uni/uni-ui/uni-steps/uni-steps.vue +255 -236
  123. package/dist/uni/uni-ui/uni-swipe-action/uni-swipe-action.vue +51 -51
  124. package/dist/uni/uni-ui/uni-swipe-action-item/bindingx.js +276 -282
  125. package/dist/uni/uni-ui/uni-swipe-action-item/isPC.js +10 -10
  126. package/dist/uni/uni-ui/uni-swipe-action-item/mpalipay.js +182 -187
  127. package/dist/uni/uni-ui/uni-swipe-action-item/mpother.js +235 -244
  128. package/dist/uni/uni-ui/uni-swipe-action-item/mpwxs.js +70 -75
  129. package/dist/uni/uni-ui/uni-swipe-action-item/render.js +238 -247
  130. package/dist/uni/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +392 -313
  131. package/dist/uni/uni-ui/uni-swipe-action-item/wx.wxs +206 -215
  132. package/dist/uni/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +241 -197
  133. package/dist/uni/uni-ui/uni-table/uni-table.vue +445 -447
  134. package/dist/uni/uni-ui/uni-tag/uni-tag.vue +234 -244
  135. package/dist/uni/uni-ui/uni-tbody/uni-tbody.vue +20 -23
  136. package/dist/uni/uni-ui/uni-td/uni-td.vue +79 -80
  137. package/dist/uni/uni-ui/uni-th/filter-dropdown.vue +510 -503
  138. package/dist/uni/uni-ui/uni-th/uni-th.vue +289 -273
  139. package/dist/uni/uni-ui/uni-thead/uni-thead.vue +115 -114
  140. package/dist/uni/uni-ui/uni-title/uni-title.vue +151 -154
  141. package/dist/uni/uni-ui/uni-tooltip/uni-tooltip.vue +55 -60
  142. package/dist/uni/uni-ui/uni-tr/table-checkbox.vue +162 -163
  143. package/dist/uni/uni-ui/uni-tr/uni-tr.vue +158 -157
  144. package/dist/uni/uni-ui/uni-transition/createAnimation.js +130 -113
  145. package/dist/uni/uni-ui/uni-transition/uni-transition.vue +274 -272
  146. package/package.json +1 -1
@@ -1,171 +1,172 @@
1
1
  <template>
2
- <!-- #ifdef H5 -->
3
- <tr class="uni-table-tr">
4
- <th v-if="selection === 'selection' && ishead" class="checkbox" :class="{ 'tr-table--border': border }">
5
- <table-checkbox :checked="checked" :indeterminate="indeterminate" :disabled="disabled" @checkboxSelected="checkboxSelected"></table-checkbox>
6
- </th>
7
- <slot></slot>
8
- <!-- <uni-th class="th-fixed">123</uni-th> -->
9
- </tr>
10
- <!-- #endif -->
11
- <!-- #ifndef H5 -->
12
- <view class="uni-table-tr">
13
- <view v-if="selection === 'selection' " class="checkbox" :class="{ 'tr-table--border': border }">
14
- <table-checkbox :checked="checked" :indeterminate="indeterminate" :disabled="disabled" @checkboxSelected="checkboxSelected"></table-checkbox>
15
- </view>
16
- <slot></slot>
17
- </view>
18
- <!-- #endif -->
2
+ <!-- #ifdef H5 -->
3
+ <tr class="uni-table-tr">
4
+ <th v-if="selection === 'selection' && ishead" class="checkbox" :class="{ 'tr-table--border': border }">
5
+ <table-checkbox :checked="checked" :indeterminate="indeterminate" :disabled="disabled" @checkboxSelected="checkboxSelected"></table-checkbox>
6
+ </th>
7
+ <slot></slot>
8
+ <!-- <uni-th class="th-fixed">123</uni-th> -->
9
+ </tr>
10
+ <!-- #endif -->
11
+ <!-- #ifndef H5 -->
12
+ <view class="uni-table-tr">
13
+ <view v-if="selection === 'selection'" class="checkbox" :class="{ 'tr-table--border': border }">
14
+ <table-checkbox :checked="checked" :indeterminate="indeterminate" :disabled="disabled" @checkboxSelected="checkboxSelected"></table-checkbox>
15
+ </view>
16
+ <slot></slot>
17
+ </view>
18
+ <!-- #endif -->
19
19
  </template>
20
20
 
21
21
  <script>
22
- import tableCheckbox from './table-checkbox.vue'
23
- /**
24
- * Tr 表格行组件
25
- * @description 表格行组件 仅包含 th,td 组件
26
- * @tutorial https://ext.dcloud.net.cn/plugin?id=
27
- */
28
- export default {
29
- name: 'uniTr',
30
- components: { tableCheckbox },
31
- props: {
32
- disabled: {
33
- type: Boolean,
34
- default: false
35
- },
36
- keyValue: {
37
- type: [String, Number],
38
- default: ''
39
- }
40
- },
41
- options: {
42
- virtualHost: true
43
- },
44
- data() {
45
- return {
46
- value: false,
47
- border: false,
48
- selection: false,
49
- widthThArr: [],
50
- ishead: true,
51
- checked: false,
52
- indeterminate:false
53
- }
54
- },
55
- created() {
56
- this.root = this.getTable()
57
- this.head = this.getTable('uniThead')
58
- if (this.head) {
59
- this.ishead = false
60
- this.head.init(this)
61
- }
62
- this.border = this.root.border
63
- this.selection = this.root.type
64
- this.root.trChildren.push(this)
65
- const rowData = this.root.data.find(v => v[this.root.rowKey] === this.keyValue)
66
- if(rowData){
67
- this.rowData = rowData
68
- }
69
- this.root.isNodata()
70
- },
71
- mounted() {
72
- if (this.widthThArr.length > 0) {
73
- const selectionWidth = this.selection === 'selection' ? 50 : 0
74
- this.root.minWidth = this.widthThArr.reduce((a, b) => Number(a) + Number(b)) + selectionWidth
75
- }
76
- },
77
- // #ifndef VUE3
78
- destroyed() {
79
- const index = this.root.trChildren.findIndex(i => i === this)
80
- this.root.trChildren.splice(index, 1)
81
- this.root.isNodata()
82
- },
83
- // #endif
84
- // #ifdef VUE3
85
- unmounted() {
86
- const index = this.root.trChildren.findIndex(i => i === this)
87
- this.root.trChildren.splice(index, 1)
88
- this.root.isNodata()
89
- },
90
- // #endif
91
- methods: {
92
- minWidthUpdate(width) {
93
- this.widthThArr.push(width)
94
- },
95
- // 选中
96
- checkboxSelected(e) {
97
- let rootData = this.root.data.find(v => v[this.root.rowKey] === this.keyValue)
98
- this.checked = e.checked
99
- this.root.check(rootData||this, e.checked,rootData? this.keyValue:null)
100
- },
101
- change(e) {
102
- this.root.trChildren.forEach(item => {
103
- if (item === this) {
104
- this.root.check(this, e.detail.value.length > 0 ? true : false)
105
- }
106
- })
107
- },
108
- /**
109
- * 获取父元素实例
110
- */
111
- getTable(name = 'uniTable') {
112
- let parent = this.$parent
113
- let parentName = parent.$options.name
114
- while (parentName !== name) {
115
- parent = parent.$parent
116
- if (!parent) return false
117
- parentName = parent.$options.name
118
- }
119
- return parent
120
- }
121
- }
122
- }
22
+ import tableCheckbox from './table-checkbox.vue';
23
+
24
+ /**
25
+ * Tr 表格行组件
26
+ * @description 表格行组件 仅包含 th,td 组件
27
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=
28
+ */
29
+ export default {
30
+ name: 'uniTr',
31
+ components: { tableCheckbox },
32
+ props: {
33
+ disabled: {
34
+ type: Boolean,
35
+ default: false,
36
+ },
37
+ keyValue: {
38
+ type: [String, Number],
39
+ default: '',
40
+ },
41
+ },
42
+ options: {
43
+ virtualHost: true,
44
+ },
45
+ data() {
46
+ return {
47
+ value: false,
48
+ border: false,
49
+ selection: false,
50
+ widthThArr: [],
51
+ ishead: true,
52
+ checked: false,
53
+ indeterminate: false,
54
+ };
55
+ },
56
+ created() {
57
+ this.root = this.getTable();
58
+ this.head = this.getTable('uniThead');
59
+ if (this.head) {
60
+ this.ishead = false;
61
+ this.head.init(this);
62
+ }
63
+ this.border = this.root.border;
64
+ this.selection = this.root.type;
65
+ this.root.trChildren.push(this);
66
+ const rowData = this.root.data.find((v) => v[this.root.rowKey] === this.keyValue);
67
+ if (rowData) {
68
+ this.rowData = rowData;
69
+ }
70
+ this.root.isNodata();
71
+ },
72
+ mounted() {
73
+ if (this.widthThArr.length > 0) {
74
+ const selectionWidth = this.selection === 'selection' ? 50 : 0;
75
+ this.root.minWidth = this.widthThArr.reduce((a, b) => Number(a) + Number(b)) + selectionWidth;
76
+ }
77
+ },
78
+ // #ifndef VUE3
79
+ destroyed() {
80
+ const index = this.root.trChildren.findIndex((i) => i === this);
81
+ this.root.trChildren.splice(index, 1);
82
+ this.root.isNodata();
83
+ },
84
+ // #endif
85
+ // #ifdef VUE3
86
+ unmounted() {
87
+ const index = this.root.trChildren.findIndex((i) => i === this);
88
+ this.root.trChildren.splice(index, 1);
89
+ this.root.isNodata();
90
+ },
91
+ // #endif
92
+ methods: {
93
+ minWidthUpdate(width) {
94
+ this.widthThArr.push(width);
95
+ },
96
+ // 选中
97
+ checkboxSelected(e) {
98
+ let rootData = this.root.data.find((v) => v[this.root.rowKey] === this.keyValue);
99
+ this.checked = e.checked;
100
+ this.root.check(rootData || this, e.checked, rootData ? this.keyValue : null);
101
+ },
102
+ change(e) {
103
+ this.root.trChildren.forEach((item) => {
104
+ if (item === this) {
105
+ this.root.check(this, e.detail.value.length > 0 ? true : false);
106
+ }
107
+ });
108
+ },
109
+ /**
110
+ * 获取父元素实例
111
+ */
112
+ getTable(name = 'uniTable') {
113
+ let parent = this.$parent;
114
+ let parentName = parent.$options.name;
115
+ while (parentName !== name) {
116
+ parent = parent.$parent;
117
+ if (!parent) return false;
118
+ parentName = parent.$options.name;
119
+ }
120
+ return parent;
121
+ },
122
+ },
123
+ };
123
124
  </script>
124
125
 
125
126
  <style lang="scss">
126
- $border-color: #ebeef5;
127
+ $border-color: #ebeef5;
127
128
 
128
- .uni-table-tr {
129
- /* #ifndef APP-NVUE */
130
- display: table-row;
131
- transition: all 0.3s;
132
- box-sizing: border-box;
133
- /* #endif */
134
- }
129
+ .uni-table-tr {
130
+ /* #ifndef APP-NVUE */
131
+ display: table-row;
132
+ transition: all 0.3s;
133
+ box-sizing: border-box;
134
+ /* #endif */
135
+ }
135
136
 
136
- .checkbox {
137
- padding: 0 8px;
138
- width: 26px;
139
- padding-left: 12px;
140
- /* #ifndef APP-NVUE */
141
- display: table-cell;
142
- vertical-align: middle;
143
- /* #endif */
144
- color: #333;
145
- font-weight: 500;
146
- border-bottom: 1px $border-color solid;
147
- font-size: 14px;
148
- // text-align: center;
149
- }
137
+ .checkbox {
138
+ padding: 0 8px;
139
+ width: 26px;
140
+ padding-left: 12px;
141
+ /* #ifndef APP-NVUE */
142
+ display: table-cell;
143
+ vertical-align: middle;
144
+ /* #endif */
145
+ color: #333;
146
+ font-weight: 500;
147
+ border-bottom: 1px $border-color solid;
148
+ font-size: 14px;
149
+ // text-align: center;
150
+ }
150
151
 
151
- .tr-table--border {
152
- border-right: 1px $border-color solid;
153
- }
152
+ .tr-table--border {
153
+ border-right: 1px $border-color solid;
154
+ }
154
155
 
155
- /* #ifndef APP-NVUE */
156
- .uni-table-tr {
157
- ::v-deep .uni-table-th {
158
- &.table--border:last-child {
159
- // border-right: none;
160
- }
161
- }
156
+ /* #ifndef APP-NVUE */
157
+ .uni-table-tr {
158
+ ::v-deep .uni-table-th {
159
+ &.table--border:last-child {
160
+ // border-right: none;
161
+ }
162
+ }
162
163
 
163
- ::v-deep .uni-table-td {
164
- &.table--border:last-child {
165
- // border-right: none;
166
- }
167
- }
168
- }
164
+ ::v-deep .uni-table-td {
165
+ &.table--border:last-child {
166
+ // border-right: none;
167
+ }
168
+ }
169
+ }
169
170
 
170
- /* #endif */
171
+ /* #endif */
171
172
  </style>
@@ -5,127 +5,144 @@
5
5
  // transformOrigin: '50% 50% 0'
6
6
  // }
7
7
  // #ifdef APP-NVUE
8
- const nvueAnimation = uni.requireNativePlugin('animation')
8
+ const nvueAnimation = uni.requireNativePlugin('animation');
9
9
  // #endif
10
10
  class MPAnimation {
11
- constructor(options, _this) {
12
- this.options = options
13
- // 在iOS10+QQ小程序平台下,传给原生的对象一定是个普通对象而不是Proxy对象,否则会报parameter should be Object instead of ProxyObject的错误
14
- this.animation = uni.createAnimation({
15
- ...options
16
- })
17
- this.currentStepAnimates = {}
18
- this.next = 0
19
- this.$ = _this
11
+ constructor(options, _this) {
12
+ this.options = options;
13
+ // 在iOS10+QQ小程序平台下,传给原生的对象一定是个普通对象而不是Proxy对象,否则会报parameter should be Object instead of ProxyObject的错误
14
+ this.animation = uni.createAnimation({
15
+ ...options,
16
+ });
17
+ this.currentStepAnimates = {};
18
+ this.next = 0;
19
+ this.$ = _this;
20
+ }
20
21
 
21
- }
22
+ _nvuePushAnimates(type, args) {
23
+ let aniObj = this.currentStepAnimates[this.next];
24
+ let styles = {};
25
+ if (!aniObj) {
26
+ styles = {
27
+ styles: {},
28
+ config: {},
29
+ };
30
+ } else {
31
+ styles = aniObj;
32
+ }
33
+ if (animateTypes1.includes(type)) {
34
+ if (!styles.styles.transform) {
35
+ styles.styles.transform = '';
36
+ }
37
+ let unit = '';
38
+ if (type === 'rotate') {
39
+ unit = 'deg';
40
+ }
41
+ styles.styles.transform += `${type}(${args + unit}) `;
42
+ } else {
43
+ styles.styles[type] = `${args}`;
44
+ }
45
+ this.currentStepAnimates[this.next] = styles;
46
+ }
47
+ _animateRun(styles = {}, config = {}) {
48
+ let ref = this.$.$refs['ani'].ref;
49
+ if (!ref) return;
50
+ return new Promise((resolve, reject) => {
51
+ nvueAnimation.transition(
52
+ ref,
53
+ {
54
+ styles,
55
+ ...config,
56
+ },
57
+ (res) => {
58
+ resolve();
59
+ },
60
+ );
61
+ });
62
+ }
22
63
 
23
- _nvuePushAnimates(type, args) {
24
- let aniObj = this.currentStepAnimates[this.next]
25
- let styles = {}
26
- if (!aniObj) {
27
- styles = {
28
- styles: {},
29
- config: {}
30
- }
31
- } else {
32
- styles = aniObj
33
- }
34
- if (animateTypes1.includes(type)) {
35
- if (!styles.styles.transform) {
36
- styles.styles.transform = ''
37
- }
38
- let unit = ''
39
- if(type === 'rotate'){
40
- unit = 'deg'
41
- }
42
- styles.styles.transform += `${type}(${args+unit}) `
43
- } else {
44
- styles.styles[type] = `${args}`
45
- }
46
- this.currentStepAnimates[this.next] = styles
47
- }
48
- _animateRun(styles = {}, config = {}) {
49
- let ref = this.$.$refs['ani'].ref
50
- if (!ref) return
51
- return new Promise((resolve, reject) => {
52
- nvueAnimation.transition(ref, {
53
- styles,
54
- ...config
55
- }, res => {
56
- resolve()
57
- })
58
- })
59
- }
64
+ _nvueNextAnimate(animates, step = 0, fn) {
65
+ let obj = animates[step];
66
+ if (obj) {
67
+ let { styles, config } = obj;
68
+ this._animateRun(styles, config).then(() => {
69
+ step += 1;
70
+ this._nvueNextAnimate(animates, step, fn);
71
+ });
72
+ } else {
73
+ this.currentStepAnimates = {};
74
+ typeof fn === 'function' && fn();
75
+ this.isEnd = true;
76
+ }
77
+ }
60
78
 
61
- _nvueNextAnimate(animates, step = 0, fn) {
62
- let obj = animates[step]
63
- if (obj) {
64
- let {
65
- styles,
66
- config
67
- } = obj
68
- this._animateRun(styles, config).then(() => {
69
- step += 1
70
- this._nvueNextAnimate(animates, step, fn)
71
- })
72
- } else {
73
- this.currentStepAnimates = {}
74
- typeof fn === 'function' && fn()
75
- this.isEnd = true
76
- }
77
- }
79
+ step(config = {}) {
80
+ // #ifndef APP-NVUE
81
+ this.animation.step(config);
82
+ // #endif
83
+ // #ifdef APP-NVUE
84
+ this.currentStepAnimates[this.next].config = Object.assign({}, this.options, config);
85
+ this.currentStepAnimates[this.next].styles.transformOrigin = this.currentStepAnimates[this.next].config.transformOrigin;
86
+ this.next++;
87
+ // #endif
88
+ return this;
89
+ }
78
90
 
79
- step(config = {}) {
80
- // #ifndef APP-NVUE
81
- this.animation.step(config)
82
- // #endif
83
- // #ifdef APP-NVUE
84
- this.currentStepAnimates[this.next].config = Object.assign({}, this.options, config)
85
- this.currentStepAnimates[this.next].styles.transformOrigin = this.currentStepAnimates[this.next].config.transformOrigin
86
- this.next++
87
- // #endif
88
- return this
89
- }
90
-
91
- run(fn) {
92
- // #ifndef APP-NVUE
93
- this.$.animationData = this.animation.export()
94
- this.$.timer = setTimeout(() => {
95
- typeof fn === 'function' && fn()
96
- }, this.$.durationTime)
97
- // #endif
98
- // #ifdef APP-NVUE
99
- this.isEnd = false
100
- let ref = this.$.$refs['ani'] && this.$.$refs['ani'].ref
101
- if(!ref) return
102
- this._nvueNextAnimate(this.currentStepAnimates, 0, fn)
103
- this.next = 0
104
- // #endif
105
- }
91
+ run(fn) {
92
+ // #ifndef APP-NVUE
93
+ this.$.animationData = this.animation.export();
94
+ this.$.timer = setTimeout(() => {
95
+ typeof fn === 'function' && fn();
96
+ }, this.$.durationTime);
97
+ // #endif
98
+ // #ifdef APP-NVUE
99
+ this.isEnd = false;
100
+ let ref = this.$.$refs['ani'] && this.$.$refs['ani'].ref;
101
+ if (!ref) return;
102
+ this._nvueNextAnimate(this.currentStepAnimates, 0, fn);
103
+ this.next = 0;
104
+ // #endif
105
+ }
106
106
  }
107
107
 
108
-
109
- const animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d',
110
- 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY',
111
- 'translateZ'
112
- ]
113
- const animateTypes2 = ['opacity', 'backgroundColor']
114
- const animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom']
115
- animateTypes1.concat(animateTypes2, animateTypes3).forEach(type => {
116
- MPAnimation.prototype[type] = function(...args) {
117
- // #ifndef APP-NVUE
118
- this.animation[type](...args)
119
- // #endif
120
- // #ifdef APP-NVUE
121
- this._nvuePushAnimates(type, args)
122
- // #endif
123
- return this
124
- }
125
- })
108
+ const animateTypes1 = [
109
+ 'matrix',
110
+ 'matrix3d',
111
+ 'rotate',
112
+ 'rotate3d',
113
+ 'rotateX',
114
+ 'rotateY',
115
+ 'rotateZ',
116
+ 'scale',
117
+ 'scale3d',
118
+ 'scaleX',
119
+ 'scaleY',
120
+ 'scaleZ',
121
+ 'skew',
122
+ 'skewX',
123
+ 'skewY',
124
+ 'translate',
125
+ 'translate3d',
126
+ 'translateX',
127
+ 'translateY',
128
+ 'translateZ',
129
+ ];
130
+ const animateTypes2 = ['opacity', 'backgroundColor'];
131
+ const animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom'];
132
+ animateTypes1.concat(animateTypes2, animateTypes3).forEach((type) => {
133
+ MPAnimation.prototype[type] = function (...args) {
134
+ // #ifndef APP-NVUE
135
+ this.animation[type](...args);
136
+ // #endif
137
+ // #ifdef APP-NVUE
138
+ this._nvuePushAnimates(type, args);
139
+ // #endif
140
+ return this;
141
+ };
142
+ });
126
143
 
127
144
  export function createAnimation(option, _this) {
128
- if(!_this) return
129
- clearTimeout(_this.timer)
130
- return new MPAnimation(option, _this)
145
+ if (!_this) return;
146
+ clearTimeout(_this.timer);
147
+ return new MPAnimation(option, _this);
131
148
  }