@10yun/cv-mobile-ui 0.4.2 → 0.4.4

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 (168) hide show
  1. package/package.json +1 -1
  2. package/ui-cv/cv-form-item/cv-form-item.vue +1 -1
  3. package/ui-cv/cv-input-password/cv-input-password.vue +2 -2
  4. package/ui-uni/amap-wx/js/util.js +166 -158
  5. package/ui-uni/page-foot/page-foot.vue +38 -0
  6. package/ui-uni/page-head/page-head.vue +16 -0
  7. package/ui-uni/product.vue +52 -52
  8. package/ui-uni/u-charts/u-charts.js +743 -1092
  9. package/ui-uni/u-link/u-link.vue +59 -0
  10. package/ui-uni/uni-badge/uni-badge.vue +250 -0
  11. package/ui-uni/uni-calendar/calendar.js +546 -0
  12. package/ui-uni/uni-calendar/uni-calendar-item.vue +171 -0
  13. package/ui-uni/uni-calendar/uni-calendar.vue +504 -0
  14. package/{ui-cv/cv-calendar → ui-uni/uni-calendar}/util.js +0 -0
  15. package/ui-uni/uni-card/uni-card.vue +420 -0
  16. package/ui-uni/uni-col/uni-col.vue +2968 -0
  17. package/ui-uni/uni-collapse/uni-collapse.vue +146 -0
  18. package/ui-uni/uni-collapse-item/uni-collapse-item.vue +378 -0
  19. package/ui-uni/uni-combox/uni-combox.vue +237 -0
  20. package/ui-uni/uni-countdown/uni-countdown.vue +234 -0
  21. package/ui-uni/uni-data-checkbox/uni-data-checkbox.vue +792 -0
  22. package/{ui-cv/cv-data-indexed-list → ui-uni/uni-data-indexed-list}/clientdb.js +0 -0
  23. package/ui-uni/uni-data-indexed-list/uni-data-indexed-list-item.vue +142 -0
  24. package/ui-uni/uni-data-indexed-list/uni-data-indexed-list.vue +364 -0
  25. package/{ui-cv/cv-data-picker → ui-uni/uni-data-picker}/keypress.js +0 -0
  26. package/ui-uni/uni-data-picker/uni-data-picker.vue +468 -0
  27. package/{ui-cv/cv-data-pickerview/cv-data-picker.js → ui-uni/uni-data-pickerview/uni-data-picker.js} +0 -0
  28. package/ui-uni/uni-data-pickerview/uni-data-pickerview.vue +298 -0
  29. package/{ui-cv/cv-dateformat → ui-uni/uni-dateformat}/date-format.js +0 -0
  30. package/ui-uni/uni-dateformat/uni-dateformat.vue +88 -0
  31. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/calendar-item.vue +0 -0
  32. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/calendar.js +0 -0
  33. package/ui-uni/uni-datetime-picker/calendar.vue +747 -0
  34. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/keypress.js +0 -0
  35. package/ui-uni/uni-datetime-picker/time-picker.vue +899 -0
  36. package/ui-uni/uni-datetime-picker/uni-datetime-picker.vue +874 -0
  37. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/util.js +0 -0
  38. package/ui-uni/uni-drawer/keypress.js +45 -0
  39. package/ui-uni/uni-drawer/uni-drawer.vue +178 -0
  40. package/{ui-cv/cv-easyinput → ui-uni/uni-easyinput}/common.js +0 -0
  41. package/ui-uni/uni-easyinput/uni-easyinput.vue +438 -0
  42. package/ui-uni/uni-fab/uni-fab.vue +443 -0
  43. package/{ui-cv/cv-fab/cv-fab.vue.bak → ui-uni/uni-fab/uni-fab.vue.bak} +2 -2
  44. package/ui-uni/uni-fav/uni-fav.vue +136 -0
  45. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/choose-and-upload-file.js +0 -0
  46. package/ui-uni/uni-file-picker/uni-file-picker.vue +614 -0
  47. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/upload-file.vue +0 -0
  48. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/upload-image.vue +0 -0
  49. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/utils.js +0 -0
  50. package/ui-uni/uni-forms/uni-forms.vue +467 -0
  51. package/ui-uni/uni-forms/validate.js +486 -0
  52. package/ui-uni/uni-forms-item/uni-forms-item.vue +500 -0
  53. package/{ui-cv/cv-goods-nav/cv-goods-nav.vue → ui-uni/uni-goods-nav/uni-goods-nav.vue} +1 -1
  54. package/ui-uni/uni-grid/uni-grid.vue +141 -0
  55. package/ui-uni/uni-grid-item/uni-grid-item.vue +123 -0
  56. package/ui-uni/uni-group/uni-group.vue +123 -0
  57. package/ui-uni/uni-icons/icons.js +132 -0
  58. package/ui-uni/uni-icons/uni-icons.vue +72 -0
  59. package/{ui-cv/cv-icon2 → ui-uni/uni-icons}/uni.ttf +0 -0
  60. package/ui-uni/uni-indexed-list/uni-indexed-list-item.vue +142 -0
  61. package/ui-uni/uni-indexed-list/uni-indexed-list.vue +357 -0
  62. package/ui-uni/uni-link/uni-link.vue +117 -0
  63. package/ui-uni/uni-list/uni-list.vue +107 -0
  64. package/ui-uni/uni-list/uni-refresh.vue +65 -0
  65. package/{ui-cv/cv-list → ui-uni/uni-list}/uni-refresh.wxs +0 -0
  66. package/ui-uni/uni-list-ad/uni-list-ad.vue +106 -0
  67. package/{ui-cv/cv-list-chat/cv-list-chat.scss → ui-uni/uni-list-chat/uni-list-chat.scss} +0 -0
  68. package/{ui-cv/cv-list-chat/cv-list-chat.vue → ui-uni/uni-list-chat/uni-list-chat.vue} +0 -0
  69. package/ui-uni/uni-list-item/uni-list-item.vue +428 -0
  70. package/ui-uni/uni-load-more/uni-load-more.vue +366 -0
  71. package/ui-uni/uni-nav-bar/uni-nav-bar.vue +244 -0
  72. package/{ui-cv/cv-nav-bar/cv-status-bar.vue → ui-uni/uni-nav-bar/uni-status-bar.vue} +0 -0
  73. package/ui-uni/uni-notice-bar/uni-notice-bar.vue +394 -0
  74. package/ui-uni/uni-number-box/uni-number-box.vue +224 -0
  75. package/ui-uni/uni-pagination/uni-pagination.vue +376 -0
  76. package/{ui-cv/cv-popup → ui-uni/uni-popup}/keypress.js +0 -0
  77. package/{ui-cv/cv-popup → ui-uni/uni-popup}/popup.js +0 -0
  78. package/ui-uni/uni-popup/uni-popup.vue +412 -0
  79. package/{ui-cv/cv-popup-dialog → ui-uni/uni-popup-dialog}/keypress.js +0 -0
  80. package/{ui-cv/cv-popup-dialog/cv-popup-dialog.vue → ui-uni/uni-popup-dialog/uni-popup-dialog.vue} +0 -0
  81. package/ui-uni/uni-popup-message/uni-popup-message.vue +143 -0
  82. package/{ui-cv/cv-popup-share/cv-popup-share.vue → ui-uni/uni-popup-share/uni-popup-share.vue} +0 -0
  83. package/ui-uni/uni-rate/uni-rate.vue +357 -0
  84. package/ui-uni/uni-row/uni-row.vue +155 -0
  85. package/ui-uni/uni-search-bar/uni-search-bar.vue +262 -0
  86. package/{ui-cv/cv-section/cv-section.vue → ui-uni/uni-section/uni-section.vue} +0 -0
  87. package/{ui-cv/cv-segmented-control/cv-segmented-control.vue → ui-uni/uni-segmented-control/uni-segmented-control.vue} +0 -0
  88. package/{ui-cv/cv-status-bar/cv-status-bar.vue → ui-uni/uni-status-bar/uni-status-bar.vue} +0 -0
  89. package/ui-uni/uni-steps/uni-steps.vue +250 -0
  90. package/{ui-cv/cv-swipe-action/cv-swipe-action.vue → ui-uni/uni-swipe-action/uni-swipe-action.vue} +0 -0
  91. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/bindingx.js +0 -0
  92. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/index.wxs +0 -0
  93. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/isPC.js +0 -0
  94. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpalipay.js +0 -0
  95. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpother.js +0 -0
  96. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpwxs.js +0 -0
  97. package/{ui-cv/cv-swipe-action-item/cv-swipe-action-item.vue → ui-uni/uni-swipe-action-item/uni-swipe-action-item.vue} +0 -0
  98. package/ui-uni/uni-swiper-dot/uni-swiper-dot.vue +205 -0
  99. package/ui-uni/uni-table/uni-table.vue +455 -0
  100. package/ui-uni/uni-tag/uni-tag.vue +283 -0
  101. package/ui-uni/uni-tbody/uni-tbody.vue +30 -0
  102. package/ui-uni/uni-td/uni-td.vue +88 -0
  103. package/{ui-cv/cv-test/cv-test.vue → ui-uni/uni-test/uni-test.vue} +0 -0
  104. package/{ui-cv/cv-th → ui-uni/uni-th}/filter-dropdown.vue +0 -0
  105. package/ui-uni/uni-th/uni-th.vue +259 -0
  106. package/ui-uni/uni-thead/uni-thead.vue +114 -0
  107. package/ui-uni/uni-title/uni-title.vue +171 -0
  108. package/{ui-cv/cv-tr → ui-uni/uni-tr}/table-checkbox.vue +0 -0
  109. package/ui-uni/uni-tr/uni-tr.vue +156 -0
  110. package/{ui-cv/cv-transition → ui-uni/uni-transition}/createAnimation.js +0 -0
  111. package/ui-uni/uni-transition/uni-transition.vue +287 -0
  112. package/ui-cv/cv-badge/cv-badge.vue +0 -249
  113. package/ui-cv/cv-calendar/calendar.js +0 -963
  114. package/ui-cv/cv-calendar/cv-calendar-item.vue +0 -198
  115. package/ui-cv/cv-calendar/cv-calendar.vue +0 -508
  116. package/ui-cv/cv-card/cv-card.vue +0 -427
  117. package/ui-cv/cv-col/cv-col.vue +0 -2965
  118. package/ui-cv/cv-collapse/cv-collapse.vue +0 -146
  119. package/ui-cv/cv-collapse-item/cv-collapse-item.vue +0 -395
  120. package/ui-cv/cv-combox/cv-combox.vue +0 -250
  121. package/ui-cv/cv-countdown/cv-countdown.vue +0 -245
  122. package/ui-cv/cv-data-checkbox/cv-data-checkbox.vue +0 -841
  123. package/ui-cv/cv-data-indexed-list/cv-data-indexed-list-item.vue +0 -154
  124. package/ui-cv/cv-data-indexed-list/cv-data-indexed-list.vue +0 -376
  125. package/ui-cv/cv-data-picker/cv-data-picker.vue +0 -486
  126. package/ui-cv/cv-data-pickerview/cv-data-pickerview.vue +0 -304
  127. package/ui-cv/cv-dateformat/cv-dateformat.vue +0 -86
  128. package/ui-cv/cv-datetime-picker/calendar.vue +0 -761
  129. package/ui-cv/cv-datetime-picker/cv-datetime-picker.vue +0 -958
  130. package/ui-cv/cv-datetime-picker/time-picker.vue +0 -907
  131. package/ui-cv/cv-drawer/cv-drawer.vue +0 -185
  132. package/ui-cv/cv-drawer/keypress.js +0 -45
  133. package/ui-cv/cv-easyinput/cv-easyinput.vue +0 -514
  134. package/ui-cv/cv-fab/cv-fab.vue +0 -465
  135. package/ui-cv/cv-fav/cv-fav.vue +0 -150
  136. package/ui-cv/cv-file-picker/cv-file-picker.vue +0 -619
  137. package/ui-cv/cv-form-base/cv-form-base.vue +0 -470
  138. package/ui-cv/cv-form-base/validate.js +0 -477
  139. package/ui-cv/cv-grid-group/cv-grid-group.vue +0 -148
  140. package/ui-cv/cv-grid-item/cv-grid-item.vue +0 -132
  141. package/ui-cv/cv-icon2/cv-icon2.vue +0 -78
  142. package/ui-cv/cv-icon2/icons.js +0 -132
  143. package/ui-cv/cv-indexed-list/cv-indexed-list-item.vue +0 -154
  144. package/ui-cv/cv-indexed-list/cv-indexed-list.vue +0 -371
  145. package/ui-cv/cv-link2/cv-link2.vue +0 -130
  146. package/ui-cv/cv-list/cv-list.vue +0 -107
  147. package/ui-cv/cv-list/cv-refresh.vue +0 -65
  148. package/ui-cv/cv-list-ad/cv-list-ad.vue +0 -113
  149. package/ui-cv/cv-list-item/cv-list-item.vue +0 -449
  150. package/ui-cv/cv-nav-bar/cv-nav-bar.vue +0 -256
  151. package/ui-cv/cv-notice-bar/cv-notice-bar.vue +0 -453
  152. package/ui-cv/cv-number-box/cv-number-box.vue +0 -223
  153. package/ui-cv/cv-pagination/cv-pagination.vue +0 -397
  154. package/ui-cv/cv-popup/cv-popup.vue +0 -429
  155. package/ui-cv/cv-popup-message/cv-popup-message.vue +0 -143
  156. package/ui-cv/cv-row/cv-row.vue +0 -157
  157. package/ui-cv/cv-search-bar/cv-search-bar.vue +0 -280
  158. package/ui-cv/cv-steps/cv-steps.vue +0 -293
  159. package/ui-cv/cv-swiper-dot/cv-swiper-dot.vue +0 -255
  160. package/ui-cv/cv-table/cv-table.vue +0 -460
  161. package/ui-cv/cv-tag/cv-tag.vue +0 -276
  162. package/ui-cv/cv-tbody/cv-tbody.vue +0 -28
  163. package/ui-cv/cv-td/cv-td.vue +0 -93
  164. package/ui-cv/cv-th/cv-th.vue +0 -270
  165. package/ui-cv/cv-thead/cv-thead.vue +0 -114
  166. package/ui-cv/cv-title/cv-title.vue +0 -168
  167. package/ui-cv/cv-tr/cv-tr.vue +0 -166
  168. package/ui-cv/cv-transition/cv-transition.vue +0 -279
@@ -0,0 +1,792 @@
1
+ <template>
2
+ <view class="uni-data-checklist" :style="{'margin-top':isTop+'px'}">
3
+ <template v-if="!isLocal">
4
+ <view class="uni-data-loading">
5
+ <uni-load-more v-if="!mixinDatacomErrorMessage" status="loading" iconType="snow" :iconSize="18" :content-text="contentText"></uni-load-more>
6
+ <text v-else>{{mixinDatacomErrorMessage}}</text>
7
+ </view>
8
+ </template>
9
+ <template v-else>
10
+ <checkbox-group v-if="multiple" class="checklist-group" :class="{'is-list':mode==='list' || wrap}" @change="chagne">
11
+ <label class="checklist-box" :class="['is--'+mode,item.selected?'is-checked':'',(disabled || !!item.disabled)?'is-disable':'',index!==0&&mode==='list'?'is-list-border':'']" :style="item.styleBackgroud" v-for="(item,index) in dataList" :key="index">
12
+ <checkbox class="hidden" hidden :disabled="disabled || !!item.disabled" :value="item[map.value]+''" :checked="item.selected" />
13
+ <view v-if="(mode !=='tag' && mode !== 'list') || ( mode === 'list' && icon === 'left')" class="checkbox__inner" :style="item.styleIcon">
14
+ <view class="checkbox__inner-icon"></view>
15
+ </view>
16
+ <view class="checklist-content" :class="{'list-content':mode === 'list' && icon ==='left'}">
17
+ <text class="checklist-text" :style="item.styleIconText">{{item[map.text]}}</text>
18
+ <view v-if="mode === 'list' && icon === 'right'" class="checkobx__list" :style="item.styleBackgroud"></view>
19
+ </view>
20
+ </label>
21
+ </checkbox-group>
22
+ <radio-group v-else class="checklist-group" :class="{'is-list':mode==='list','is-wrap':wrap}" @change="chagne">
23
+ <!-- -->
24
+ <label class="checklist-box" :class="['is--'+mode,item.selected?'is-checked':'',(disabled || !!item.disabled)?'is-disable':'',index!==0&&mode==='list'?'is-list-border':'']" :style="item.styleBackgroud" v-for="(item,index) in dataList" :key="index">
25
+ <radio class="hidden" hidden :disabled="disabled || item.disabled" :value="item[map.value]+''" :checked="item.selected" />
26
+ <view v-if="(mode !=='tag' && mode !== 'list') || ( mode === 'list' && icon === 'left')" class="radio__inner" :style="item.styleBackgroud">
27
+ <view class="radio__inner-icon" :style="item.styleIcon"></view>
28
+ </view>
29
+ <view class="checklist-content" :class="{'list-content':mode === 'list' && icon ==='left'}">
30
+ <text class="checklist-text" :style="item.styleIconText">{{item[map.text]}}</text>
31
+ <view v-if="mode === 'list' && icon === 'right'" :style="item.styleRightIcon" class="checkobx__list"></view>
32
+ </view>
33
+ </label>
34
+ </radio-group>
35
+ </template>
36
+ </view>
37
+ </template>
38
+
39
+ <script>
40
+ /**
41
+ * DataChecklist 数据选择器
42
+ * @description 通过数据渲染 checkbox 和 radio
43
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=xxx
44
+ * @property {String} mode = [default| list | button | tag] 显示模式
45
+ * @value default 默认横排模式
46
+ * @value list 列表模式
47
+ * @value button 按钮模式
48
+ * @value tag 标签模式
49
+ * @property {Boolean} multiple = [true|false] 是否多选
50
+ * @property {Array|String|Number} value 默认值
51
+ * @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}]
52
+ * @property {Number|String} min 最小选择个数 ,multiple为true时生效
53
+ * @property {Number|String} max 最大选择个数 ,multiple为true时生效
54
+ * @property {Boolean} wrap 是否换行显示
55
+ * @property {String} icon = [left|right] list 列表模式下icon显示位置
56
+ * @property {Boolean} selectedColor 选中颜色
57
+ * @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
58
+ * @property {Boolean} selectedTextColor 选中文本颜色,如不填写则自动显示
59
+ * @property {Object} map 字段映射, 默认 map={text:'text',value:'value'}
60
+ * @value left 左侧显示
61
+ * @value right 右侧显示
62
+ * @event {Function} change 选中发生变化触发
63
+ */
64
+
65
+ // import clientdb from './clientdb.js'
66
+ export default {
67
+ name: 'uniDataChecklist',
68
+ // mixins: [clientdb],
69
+ mixins: [uniCloud.mixinDatacom || {}],
70
+ // model: {
71
+ // prop: 'modelValue',
72
+ // event: 'update:modelValue'
73
+ // },
74
+ emits: ['input', 'update:modelValue', 'change'],
75
+ props: {
76
+ mode: {
77
+ type: String,
78
+ default: 'default'
79
+ },
80
+
81
+ multiple: {
82
+ type: Boolean,
83
+ default: false
84
+ },
85
+ value: {
86
+ type: [Array, String, Number],
87
+ default () {
88
+ return ''
89
+ }
90
+ },
91
+ // TODO vue3
92
+ modelValue: {
93
+ type: [Array, String, Number],
94
+ default () {
95
+ return '';
96
+ }
97
+ },
98
+ localdata: {
99
+ type: Array,
100
+ default () {
101
+ return []
102
+ }
103
+ },
104
+ min: {
105
+ type: [Number, String],
106
+ default: ''
107
+ },
108
+ max: {
109
+ type: [Number, String],
110
+ default: ''
111
+ },
112
+ wrap: {
113
+ type: Boolean,
114
+ default: false
115
+ },
116
+ icon: {
117
+ type: String,
118
+ default: 'left'
119
+ },
120
+ selectedColor: {
121
+ type: String,
122
+ default: ''
123
+ },
124
+ selectedTextColor: {
125
+ type: String,
126
+ default: ''
127
+ },
128
+ emptyText: {
129
+ type: String,
130
+ default: '暂无数据'
131
+ },
132
+ disabled: {
133
+ type: Boolean,
134
+ default: false
135
+ },
136
+ map: {
137
+ type: Object,
138
+ default () {
139
+ return {
140
+ text: 'text',
141
+ value: 'value'
142
+ }
143
+ }
144
+ }
145
+ },
146
+ watch: {
147
+ localdata: {
148
+ handler(newVal) {
149
+ this.range = newVal
150
+ this.dataList = this.getDataList(this.getSelectedValue(newVal))
151
+ },
152
+ deep: true
153
+ },
154
+ mixinDatacomResData(newVal) {
155
+ this.range = newVal
156
+ this.dataList = this.getDataList(this.getSelectedValue(newVal))
157
+ },
158
+ value(newVal) {
159
+ this.dataList = this.getDataList(newVal)
160
+ this.formItem && this.formItem.setValue(newVal)
161
+ },
162
+ modelValue(newVal) {
163
+ this.dataList = this.getDataList(newVal);
164
+ this.formItem && this.formItem.setValue(newVal);
165
+ }
166
+ },
167
+ data() {
168
+ return {
169
+ dataList: [],
170
+ range: [],
171
+ contentText: {
172
+ contentdown: '查看更多',
173
+ contentrefresh: '加载中',
174
+ contentnomore: '没有更多'
175
+ },
176
+ isLocal: true,
177
+ styles: {
178
+ selectedColor: '#007aff',
179
+ selectedTextColor: '#333',
180
+ },
181
+ isTop: 0
182
+ };
183
+ },
184
+ computed: {
185
+ dataValue() {
186
+ if (this.value === '') return this.modelValue
187
+ if (this.modelValue === '') return this.value
188
+ return this.value
189
+ }
190
+ },
191
+ created() {
192
+ this.form = this.getForm('uniForms')
193
+ this.formItem = this.getForm('uniFormsItem')
194
+ // this.formItem && this.formItem.setValue(this.value)
195
+
196
+ if (this.formItem) {
197
+ this.isTop = 6
198
+ if (this.formItem.name) {
199
+ this.rename = this.formItem.name
200
+ this.form.inputChildrens.push(this)
201
+ }
202
+ }
203
+
204
+ if (this.localdata && this.localdata.length !== 0) {
205
+ this.isLocal = true
206
+ this.range = this.localdata
207
+ this.dataList = this.getDataList(this.getSelectedValue(this.range))
208
+ } else {
209
+ if (this.collection) {
210
+ this.isLocal = false
211
+ this.loadData()
212
+ }
213
+ }
214
+ },
215
+ methods: {
216
+ loadData() {
217
+ this.mixinDatacomGet().then(res => {
218
+ this.mixinDatacomResData = res.result.data
219
+ if (this.mixinDatacomResData.length === 0) {
220
+ this.isLocal = false
221
+ this.mixinDatacomErrorMessage = this.emptyText
222
+ } else {
223
+ this.isLocal = true
224
+ }
225
+ }).catch(err => {
226
+ this.mixinDatacomErrorMessage = err.message
227
+ })
228
+ },
229
+ /**
230
+ * 获取父元素实例
231
+ */
232
+ getForm(name = 'uniForms') {
233
+ let parent = this.$parent;
234
+ let parentName = parent.$options.name;
235
+ while (parentName !== name) {
236
+ parent = parent.$parent;
237
+ if (!parent) return false
238
+ parentName = parent.$options.name;
239
+ }
240
+ return parent;
241
+ },
242
+ chagne(e) {
243
+ const values = e.detail.value
244
+
245
+ let detail = {
246
+ value: [],
247
+ data: []
248
+ }
249
+
250
+ if (this.multiple) {
251
+ this.range.forEach(item => {
252
+
253
+ if (values.includes(item[this.map.value] + '')) {
254
+ detail.value.push(item[this.map.value])
255
+ detail.data.push(item)
256
+ }
257
+ })
258
+ } else {
259
+ const range = this.range.find(item => (item[this.map.value] + '') === values)
260
+ if (range) {
261
+ detail = {
262
+ value: range[this.map.value],
263
+ data: range
264
+ }
265
+ }
266
+ }
267
+ this.formItem && this.formItem.setValue(detail.value)
268
+ // TODO 兼容 vue2
269
+ this.$emit('input', detail.value);
270
+ // // TOTO 兼容 vue3
271
+ this.$emit('update:modelValue', detail.value);
272
+ this.$emit('change', {
273
+ detail
274
+ })
275
+ if (this.multiple) {
276
+ // 如果 v-model 没有绑定 ,则走内部逻辑
277
+ // if (this.value.length === 0) {
278
+ this.dataList = this.getDataList(detail.value, true)
279
+ // }
280
+ } else {
281
+ this.dataList = this.getDataList(detail.value)
282
+ }
283
+ },
284
+
285
+ /**
286
+ * 获取渲染的新数组
287
+ * @param {Object} value 选中内容
288
+ */
289
+ getDataList(value) {
290
+ // 解除引用关系,破坏原引用关系,避免污染源数据
291
+ let dataList = JSON.parse(JSON.stringify(this.range))
292
+ let list = []
293
+ if (this.multiple) {
294
+ if (!Array.isArray(value)) {
295
+ value = []
296
+ }
297
+ }
298
+ dataList.forEach((item, index) => {
299
+ item.disabled = item.disable || item.disabled || false
300
+ if (this.multiple) {
301
+ if (value.length > 0) {
302
+ let have = value.find(val => val === item[this.map.value])
303
+ item.selected = have !== undefined
304
+ } else {
305
+ item.selected = false
306
+ }
307
+ } else {
308
+ item.selected = value === item[this.map.value]
309
+ }
310
+
311
+ list.push(item)
312
+ })
313
+ return this.setRange(list)
314
+ },
315
+ /**
316
+ * 处理最大最小值
317
+ * @param {Object} list
318
+ */
319
+ setRange(list) {
320
+ let selectList = list.filter(item => item.selected)
321
+ let min = Number(this.min) || 0
322
+ let max = Number(this.max) || ''
323
+ list.forEach((item, index) => {
324
+ if (this.multiple) {
325
+ if (selectList.length <= min) {
326
+ let have = selectList.find(val => val[this.map.value] === item[this.map.value])
327
+ if (have !== undefined) {
328
+ item.disabled = true
329
+ }
330
+ }
331
+
332
+ if (selectList.length >= max && max !== '') {
333
+ let have = selectList.find(val => val[this.map.value] === item[this.map.value])
334
+ if (have === undefined) {
335
+ item.disabled = true
336
+ }
337
+ }
338
+ }
339
+ this.setStyles(item, index)
340
+ list[index] = item
341
+ })
342
+ return list
343
+ },
344
+ /**
345
+ * 设置 class
346
+ * @param {Object} item
347
+ * @param {Object} index
348
+ */
349
+ setStyles(item, index) {
350
+ // 设置自定义样式
351
+ item.styleBackgroud = this.setStyleBackgroud(item)
352
+ item.styleIcon = this.setStyleIcon(item)
353
+ item.styleIconText = this.setStyleIconText(item)
354
+ item.styleRightIcon = this.setStyleRightIcon(item)
355
+ },
356
+
357
+ /**
358
+ * 获取选中值
359
+ * @param {Object} range
360
+ */
361
+ getSelectedValue(range) {
362
+ if (!this.multiple) return this.dataValue
363
+ let selectedArr = []
364
+ range.forEach((item) => {
365
+ if (item.selected) {
366
+ selectedArr.push(item[this.map.value])
367
+ }
368
+ })
369
+ return this.dataValue.length > 0 ? this.dataValue : selectedArr
370
+ },
371
+
372
+ /**
373
+ * 设置背景样式
374
+ */
375
+ setStyleBackgroud(item) {
376
+ let styles = {}
377
+ let selectedColor = this.selectedColor ? this.selectedColor : '#007aff'
378
+ if (this.mode !== 'list') {
379
+ styles['border-color'] = item.selected ? selectedColor : '#DCDFE6'
380
+ }
381
+ if (this.mode === 'tag') {
382
+ styles['background-color'] = item.selected ? selectedColor : '#f5f5f5'
383
+ }
384
+ let classles = ''
385
+ for (let i in styles) {
386
+ classles += `${i}:${styles[i]};`
387
+ }
388
+ return classles
389
+ },
390
+ setStyleIcon(item) {
391
+ let styles = {}
392
+ let classles = ''
393
+ let selectedColor = this.selectedColor ? this.selectedColor : '#007aff'
394
+ styles['background-color'] = item.selected ? selectedColor : '#fff'
395
+ styles['border-color'] = item.selected ? selectedColor : '#DCDFE6'
396
+
397
+ if (!item.selected && item.disabled) {
398
+ styles['background-color'] = '#F2F6FC'
399
+ styles['border-color'] = item.selected ? selectedColor : '#DCDFE6'
400
+ }
401
+
402
+ for (let i in styles) {
403
+ classles += `${i}:${styles[i]};`
404
+ }
405
+ return classles
406
+ },
407
+ setStyleIconText(item) {
408
+ let styles = {}
409
+ let classles = ''
410
+ let selectedColor = this.selectedColor ? this.selectedColor : '#007aff'
411
+ if (this.mode === 'tag') {
412
+ styles.color = item.selected ? (this.selectedTextColor ? this.selectedTextColor : '#fff') : '#333'
413
+ } else {
414
+ styles.color = item.selected ? (this.selectedTextColor ? this.selectedTextColor : selectedColor) : '#333'
415
+ }
416
+ if (!item.selected && item.disabled) {
417
+ styles.color = '#999'
418
+ }
419
+
420
+ for (let i in styles) {
421
+ classles += `${i}:${styles[i]};`
422
+ }
423
+ return classles
424
+ },
425
+ setStyleRightIcon(item) {
426
+ let styles = {}
427
+ let classles = ''
428
+ if (this.mode === 'list') {
429
+ styles['border-color'] = item.selected ? this.styles.selectedColor : '#DCDFE6'
430
+ }
431
+ for (let i in styles) {
432
+ classles += `${i}:${styles[i]};`
433
+ }
434
+
435
+ return classles
436
+ }
437
+ }
438
+ }
439
+ </script>
440
+
441
+ <style scoped>
442
+ .uni-data-loading {
443
+ /* #ifndef APP-NVUE */
444
+ display: flex;
445
+ /* #endif */
446
+ flex-direction: row;
447
+ justify-content: center;
448
+ align-items: center;
449
+ height: 36px;
450
+ padding-left: 10px;
451
+ color: #999;
452
+ }
453
+
454
+ .uni-data-checklist {
455
+ position: relative;
456
+ z-index: 0;
457
+ }
458
+
459
+ .uni-data-checklist .checklist-group {
460
+ /* #ifndef APP-NVUE */
461
+ display: flex;
462
+ /* #endif */
463
+ flex-direction: row;
464
+ flex-wrap: wrap;
465
+ }
466
+
467
+ .uni-data-checklist .checklist-group.is-list {
468
+ flex-direction: column;
469
+ }
470
+
471
+ .uni-data-checklist .checklist-group .checklist-box {
472
+ /* #ifndef APP-NVUE */
473
+ display: flex;
474
+ /* #endif */
475
+ flex-direction: row;
476
+ align-items: center;
477
+ position: relative;
478
+ margin: 5px 0;
479
+ margin-right: 25px;
480
+ }
481
+
482
+ .uni-data-checklist .checklist-group .checklist-box .hidden {
483
+ position: absolute;
484
+ opacity: 0;
485
+ }
486
+
487
+ .uni-data-checklist .checklist-group .checklist-box .checklist-content {
488
+ /* #ifndef APP-NVUE */
489
+ display: flex;
490
+ /* #endif */
491
+ flex: 1;
492
+ flex-direction: row;
493
+ align-items: center;
494
+ justify-content: space-between;
495
+ }
496
+
497
+ .uni-data-checklist .checklist-group .checklist-box .checklist-content .checklist-text {
498
+ font-size: 14px;
499
+ color: #333;
500
+ margin-left: 5px;
501
+ line-height: 14px;
502
+ }
503
+
504
+ .uni-data-checklist .checklist-group .checklist-box .checklist-content .checkobx__list {
505
+ border-right-width: 1px;
506
+ border-right-color: #007aff;
507
+ border-right-style: solid;
508
+ border-bottom-width: 1px;
509
+ border-bottom-color: #007aff;
510
+ border-bottom-style: solid;
511
+ height: 12px;
512
+ width: 6px;
513
+ left: -5px;
514
+ transform-origin: center;
515
+ transform: rotate(45deg);
516
+ opacity: 0;
517
+ }
518
+
519
+ .uni-data-checklist .checklist-group .checklist-box .checkbox__inner {
520
+ /* #ifndef APP-NVUE */
521
+ flex-shrink: 0;
522
+ box-sizing: border-box;
523
+ /* #endif */
524
+ position: relative;
525
+ width: 16px;
526
+ height: 16px;
527
+ border: 1px solid #DCDFE6;
528
+ border-radius: 2px;
529
+ background-color: #fff;
530
+ z-index: 1;
531
+ }
532
+
533
+ .uni-data-checklist .checklist-group .checklist-box .checkbox__inner .checkbox__inner-icon {
534
+ position: absolute;
535
+ /* #ifdef APP-NVUE */
536
+ top: 2px;
537
+ /* #endif */
538
+ /* #ifndef APP-NVUE */
539
+ top: 1px;
540
+ /* #endif */
541
+ left: 5px;
542
+ height: 8px;
543
+ width: 4px;
544
+ border-right-width: 1px;
545
+ border-right-color: #fff;
546
+ border-right-style: solid;
547
+ border-bottom-width: 1px;
548
+ border-bottom-color: #fff;
549
+ border-bottom-style: solid;
550
+ opacity: 0;
551
+ transform-origin: center;
552
+ transform: rotate(40deg);
553
+ }
554
+
555
+ .uni-data-checklist .checklist-group .checklist-box .radio__inner {
556
+ /* #ifndef APP-NVUE */
557
+ display: flex;
558
+ /* #endif */
559
+ /* #ifndef APP-NVUE */
560
+ flex-shrink: 0;
561
+ box-sizing: border-box;
562
+ /* #endif */
563
+ justify-content: center;
564
+ align-items: center;
565
+ position: relative;
566
+ width: 16px;
567
+ height: 16px;
568
+ border: 1px solid #DCDFE6;
569
+ border-radius: 16px;
570
+ background-color: #fff;
571
+ z-index: 1;
572
+ }
573
+
574
+ .uni-data-checklist .checklist-group .checklist-box .radio__inner .radio__inner-icon {
575
+ width: 8px;
576
+ height: 8px;
577
+ border-radius: 10px;
578
+ opacity: 0;
579
+ }
580
+
581
+ .uni-data-checklist .checklist-group .checklist-box.is--default.is-disable {
582
+ /* #ifdef H5 */
583
+ cursor: not-allowed;
584
+ /* #endif */
585
+ }
586
+
587
+ .uni-data-checklist .checklist-group .checklist-box.is--default.is-disable .checkbox__inner {
588
+ background-color: #F2F6FC;
589
+ border-color: #DCDFE6;
590
+ /* #ifdef H5 */
591
+ cursor: not-allowed;
592
+ /* #endif */
593
+ }
594
+
595
+ .uni-data-checklist .checklist-group .checklist-box.is--default.is-disable .radio__inner {
596
+ background-color: #F2F6FC;
597
+ border-color: #DCDFE6;
598
+ }
599
+
600
+ .uni-data-checklist .checklist-group .checklist-box.is--default.is-disable .checklist-text {
601
+ color: #999;
602
+ }
603
+
604
+ .uni-data-checklist .checklist-group .checklist-box.is--default.is-checked .checkbox__inner {
605
+ border-color: #007aff;
606
+ background-color: #007aff;
607
+ }
608
+
609
+ .uni-data-checklist .checklist-group .checklist-box.is--default.is-checked .checkbox__inner .checkbox__inner-icon {
610
+ opacity: 1;
611
+ transform: rotate(45deg);
612
+ }
613
+
614
+ .uni-data-checklist .checklist-group .checklist-box.is--default.is-checked .radio__inner {
615
+ border-color: #007aff;
616
+ }
617
+
618
+ .uni-data-checklist .checklist-group .checklist-box.is--default.is-checked .radio__inner .radio__inner-icon {
619
+ opacity: 1;
620
+ background-color: #007aff;
621
+ }
622
+
623
+ .uni-data-checklist .checklist-group .checklist-box.is--default.is-checked .checklist-text {
624
+ color: #007aff;
625
+ }
626
+
627
+ .uni-data-checklist .checklist-group .checklist-box.is--default.is-checked.is-disable .checkbox__inner {
628
+ opacity: 0.4;
629
+ }
630
+
631
+ .uni-data-checklist .checklist-group .checklist-box.is--default.is-checked.is-disable .checklist-text {
632
+ opacity: 0.4;
633
+ }
634
+
635
+ .uni-data-checklist .checklist-group .checklist-box.is--default.is-checked.is-disable .radio__inner {
636
+ opacity: 0.4;
637
+ }
638
+
639
+ .uni-data-checklist .checklist-group .checklist-box.is--button {
640
+ margin-right: 10px;
641
+ padding: 5px 15px;
642
+ border: 1px #DCDFE6 solid;
643
+ border-radius: 3px;
644
+ transition: border-color 0.2s;
645
+ }
646
+
647
+ .uni-data-checklist .checklist-group .checklist-box.is--button.is-disable {
648
+ /* #ifdef H5 */
649
+ cursor: not-allowed;
650
+ /* #endif */
651
+ border: 1px #eee solid;
652
+ opacity: 0.4;
653
+ }
654
+
655
+ .uni-data-checklist .checklist-group .checklist-box.is--button.is-disable .checkbox__inner {
656
+ background-color: #F2F6FC;
657
+ border-color: #DCDFE6;
658
+ /* #ifdef H5 */
659
+ cursor: not-allowed;
660
+ /* #endif */
661
+ }
662
+
663
+ .uni-data-checklist .checklist-group .checklist-box.is--button.is-disable .radio__inner {
664
+ background-color: #F2F6FC;
665
+ border-color: #DCDFE6;
666
+ /* #ifdef H5 */
667
+ cursor: not-allowed;
668
+ /* #endif */
669
+ }
670
+
671
+ .uni-data-checklist .checklist-group .checklist-box.is--button.is-disable .checklist-text {
672
+ color: #999;
673
+ }
674
+
675
+ .uni-data-checklist .checklist-group .checklist-box.is--button.is-checked {
676
+ border-color: #007aff;
677
+ }
678
+
679
+ .uni-data-checklist .checklist-group .checklist-box.is--button.is-checked .checkbox__inner {
680
+ border-color: #007aff;
681
+ background-color: #007aff;
682
+ }
683
+
684
+ .uni-data-checklist .checklist-group .checklist-box.is--button.is-checked .checkbox__inner .checkbox__inner-icon {
685
+ opacity: 1;
686
+ transform: rotate(45deg);
687
+ }
688
+
689
+ .uni-data-checklist .checklist-group .checklist-box.is--button.is-checked .radio__inner {
690
+ border-color: #007aff;
691
+ }
692
+
693
+ .uni-data-checklist .checklist-group .checklist-box.is--button.is-checked .radio__inner .radio__inner-icon {
694
+ opacity: 1;
695
+ background-color: #007aff;
696
+ }
697
+
698
+ .uni-data-checklist .checklist-group .checklist-box.is--button.is-checked .checklist-text {
699
+ color: #007aff;
700
+ }
701
+
702
+ .uni-data-checklist .checklist-group .checklist-box.is--button.is-checked.is-disable {
703
+ opacity: 0.4;
704
+ }
705
+
706
+ .uni-data-checklist .checklist-group .checklist-box.is--tag {
707
+ margin-right: 10px;
708
+ padding: 5px 10px;
709
+ border: 1px #DCDFE6 solid;
710
+ border-radius: 3px;
711
+ background-color: #f5f5f5;
712
+ }
713
+
714
+ .uni-data-checklist .checklist-group .checklist-box.is--tag .checklist-text {
715
+ margin: 0;
716
+ color: #333;
717
+ }
718
+
719
+ .uni-data-checklist .checklist-group .checklist-box.is--tag.is-disable {
720
+ /* #ifdef H5 */
721
+ cursor: not-allowed;
722
+ /* #endif */
723
+ opacity: 0.4;
724
+ }
725
+
726
+ .uni-data-checklist .checklist-group .checklist-box.is--tag.is-checked {
727
+ background-color: #007aff;
728
+ border-color: #007aff;
729
+ }
730
+
731
+ .uni-data-checklist .checklist-group .checklist-box.is--tag.is-checked .checklist-text {
732
+ color: #fff;
733
+ }
734
+
735
+ .uni-data-checklist .checklist-group .checklist-box.is--list {
736
+ /* #ifndef APP-NVUE */
737
+ display: flex;
738
+ /* #endif */
739
+ padding: 10px 15px;
740
+ padding-left: 0;
741
+ margin: 0;
742
+ }
743
+
744
+ .uni-data-checklist .checklist-group .checklist-box.is--list.is-list-border {
745
+ border-top: 1px #eee solid;
746
+ }
747
+
748
+ .uni-data-checklist .checklist-group .checklist-box.is--list.is-disable {
749
+ /* #ifdef H5 */
750
+ cursor: not-allowed;
751
+ /* #endif */
752
+ }
753
+
754
+ .uni-data-checklist .checklist-group .checklist-box.is--list.is-disable .checkbox__inner {
755
+ background-color: #F2F6FC;
756
+ border-color: #DCDFE6;
757
+ /* #ifdef H5 */
758
+ cursor: not-allowed;
759
+ /* #endif */
760
+ }
761
+
762
+ .uni-data-checklist .checklist-group .checklist-box.is--list.is-disable .checklist-text {
763
+ color: #999;
764
+ }
765
+
766
+ .uni-data-checklist .checklist-group .checklist-box.is--list.is-checked .checkbox__inner {
767
+ border-color: #007aff;
768
+ background-color: #007aff;
769
+ }
770
+
771
+ .uni-data-checklist .checklist-group .checklist-box.is--list.is-checked .checkbox__inner .checkbox__inner-icon {
772
+ opacity: 1;
773
+ transform: rotate(45deg);
774
+ }
775
+
776
+ .uni-data-checklist .checklist-group .checklist-box.is--list.is-checked .checklist-text {
777
+ color: #007aff;
778
+ }
779
+
780
+ .uni-data-checklist .checklist-group .checklist-box.is--list.is-checked .checklist-content .checkobx__list {
781
+ opacity: 1;
782
+ border-color: #007aff;
783
+ }
784
+
785
+ .uni-data-checklist .checklist-group .checklist-box.is--list.is-checked.is-disable .checkbox__inner {
786
+ opacity: 0.4;
787
+ }
788
+
789
+ .uni-data-checklist .checklist-group .checklist-box.is--list.is-checked.is-disable .checklist-text {
790
+ opacity: 0.4;
791
+ }
792
+ </style>