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

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