@kengic/uni 0.5.1 → 0.5.2-beta.1

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