hy-app 0.3.15 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/hy-action-sheet/hy-action-sheet.vue +2 -2
- package/components/hy-action-sheet/typing.d.ts +32 -33
- package/components/hy-back-top/hy-back-top.vue +36 -32
- package/components/hy-button/hy-button.vue +7 -7
- package/components/hy-button/typing.d.ts +39 -40
- package/components/hy-calendar/index.scss +1 -1
- package/components/hy-card/hy-card.vue +3 -3
- package/components/hy-cell/hy-cell.vue +125 -118
- package/components/hy-cell/index.scss +7 -7
- package/components/hy-checkbox/hy-checkbox.vue +17 -16
- package/components/hy-checkbox/index.scss +1 -1
- package/components/hy-checkbox-group/hy-checkbox-group.vue +6 -4
- package/components/hy-checkbox-item/hy-checkbox-item.vue +56 -44
- package/components/hy-checkbox-item/index.scss +1 -1
- package/components/hy-checkbox-item/typing.d.ts +3 -2
- package/components/hy-code-input/hy-code-input.vue +314 -314
- package/components/hy-code-input/index.scss +12 -12
- package/components/hy-count-down/index.scss +1 -1
- package/components/hy-datetime-picker/index.scss +1 -1
- package/components/hy-datetime-picker/typing.d.ts +0 -1
- package/components/hy-divider/index.scss +3 -3
- package/components/hy-dropdown-item/hy-dropdown-item.vue +2 -2
- package/components/hy-dropdown-item/index.scss +5 -5
- package/components/hy-float-button/hy-float-button.vue +1 -1
- package/components/hy-float-button/index.scss +9 -18
- package/components/hy-folding-panel/index.scss +1 -1
- package/components/hy-form/hy-form.vue +2 -7
- package/components/hy-form-item/hy-form-item.vue +203 -201
- package/components/hy-form-item/typing.d.ts +20 -14
- package/components/hy-grid/hy-grid.vue +23 -23
- package/components/hy-grid/index.scss +2 -8
- package/components/hy-icon/index.scss +8 -8
- package/components/hy-input/hy-input.vue +45 -44
- package/components/hy-input/index.scss +12 -11
- package/components/hy-line-progress/index.scss +3 -3
- package/components/hy-list/hy-list.vue +2 -2
- package/components/hy-list/index.scss +4 -4
- package/components/hy-loading/hy-loading.vue +2 -3
- package/components/hy-loading/index.scss +17 -15
- package/components/hy-menu/hy-menu.vue +38 -30
- package/components/hy-menu/index.scss +1 -1
- package/components/hy-menu/typing.d.ts +16 -12
- package/components/hy-modal/hy-modal.vue +11 -11
- package/components/hy-modal/index.scss +17 -17
- package/components/hy-modal/typing.d.ts +0 -2
- package/components/hy-navbar/hy-navbar.vue +3 -3
- package/components/hy-navbar/index.scss +10 -11
- package/components/hy-notice-bar/hy-column-notice.vue +2 -2
- package/components/hy-notice-bar/hy-row-notice.vue +3 -3
- package/components/hy-notice-bar/index.scss +9 -12
- package/components/hy-notify/hy-notify.vue +8 -5
- package/components/hy-notify/index.scss +2 -2
- package/components/hy-number-step/index.scss +9 -10
- package/components/hy-pagination/index.scss +7 -2
- package/components/hy-parse/index.scss +0 -9
- package/components/hy-picker/hy-picker.vue +1 -1
- package/components/hy-picker/index.scss +9 -16
- package/components/hy-popover/hy-popover.vue +6 -4
- package/components/hy-popup/hy-popup.vue +4 -2
- package/components/hy-popup/index.scss +45 -32
- package/components/hy-qrcode/hy-qrcode.vue +3 -3
- package/components/hy-qrcode/index.scss +18 -17
- package/components/hy-radio/hy-radio.vue +20 -18
- package/components/hy-radio/index.scss +26 -22
- package/components/hy-rate/hy-rate.vue +5 -5
- package/components/hy-rate/index.scss +4 -4
- package/components/hy-read-more/hy-read-more.vue +19 -20
- package/components/hy-read-more/index.scss +12 -6
- package/components/hy-scroll-list/hy-scroll-list.vue +3 -6
- package/components/hy-scroll-list/index.scss +4 -4
- package/components/hy-search/index.scss +9 -8
- package/components/hy-slider/hy-slider.vue +5 -5
- package/components/hy-slider/index.scss +12 -12
- package/components/hy-status-bar/index.scss +3 -1
- package/components/hy-steps/hy-steps.vue +50 -23
- package/components/hy-submit-bar/hy-submit-bar.vue +1 -1
- package/components/hy-submit-bar/index.scss +5 -4
- package/components/hy-subsection/hy-subsection.vue +3 -3
- package/components/hy-subsection/index.scss +7 -7
- package/components/hy-swipe-action/hy-swipe-action.vue +8 -8
- package/components/hy-swipe-action/index.scss +8 -4
- package/components/hy-swiper/hy-swiper-indicator.vue +2 -2
- package/components/hy-swiper/hy-swiper.vue +6 -6
- package/components/hy-swiper/index.scss +6 -10
- package/components/hy-switch/hy-switch.vue +4 -4
- package/components/hy-switch/index.scss +4 -22
- package/components/hy-tabs/hy-tabs.vue +16 -16
- package/components/hy-tabs/index.scss +16 -16
- package/components/hy-tag/index.scss +1 -1
- package/components/hy-text/index.scss +3 -3
- package/components/hy-textarea/hy-textarea.vue +11 -11
- package/components/hy-textarea/index.scss +11 -10
- package/components/hy-toast/hy-toast.vue +5 -5
- package/components/hy-toast/index.scss +8 -8
- package/components/hy-tooltip/hy-tooltip.vue +193 -183
- package/components/hy-tooltip/index.scss +69 -45
- package/components/hy-upload/hy-upload.vue +15 -10
- package/components/hy-upload/index.scss +37 -36
- package/components/hy-warn/hy-warn.vue +11 -11
- package/components/hy-warn/index.scss +76 -82
- package/components/hy-waterfall/index.scss +2 -1
- package/composables/usePopover.ts +2 -2
- package/libs/css/mixin.scss +0 -9
- package/package.json +2 -2
- package/utils/inside.ts +4 -1
- package/utils/utils.ts +187 -162
|
@@ -5,137 +5,144 @@
|
|
|
5
5
|
v-if="title || $slots['title']"
|
|
6
6
|
>
|
|
7
7
|
<!-- @slot 标题插槽 -->
|
|
8
|
-
<slot name="title" :title="title">
|
|
9
|
-
|
|
10
|
-
</slot>
|
|
8
|
+
<slot v-if="$slots.title" name="title" :title="title"></slot>
|
|
9
|
+
<text v-else class="hy-cell--title__text">{{ title }}</text>
|
|
11
10
|
</view>
|
|
12
11
|
<view
|
|
13
|
-
class="hy-
|
|
12
|
+
class="hy-cell__body"
|
|
14
13
|
:style="{ 'border-radius': addUnit(borderRadius) }"
|
|
15
14
|
>
|
|
16
15
|
<!-- @slot 整体插槽 -->
|
|
17
|
-
<slot>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<view
|
|
31
|
-
v-if="item?.icon?.name || $slots.icon"
|
|
32
|
-
class="hy-cell--body__container__content-icon"
|
|
33
|
-
>
|
|
34
|
-
<!-- @slot 图标插槽 -->
|
|
35
|
-
<slot name="icon" :icon="item?.icon">
|
|
36
|
-
<HyIcon
|
|
37
|
-
:size="iconSize"
|
|
38
|
-
:name="item?.icon?.name"
|
|
39
|
-
:color="
|
|
40
|
-
disabled || item?.disabled ? '#c0c0c0' : item?.icon?.color
|
|
41
|
-
"
|
|
42
|
-
:bold="item?.icon?.bold"
|
|
43
|
-
:customPrefix="item?.icon?.customPrefix"
|
|
44
|
-
:imgMode="item?.icon?.imgMode"
|
|
45
|
-
:width="item?.icon?.width"
|
|
46
|
-
:height="item?.icon?.height"
|
|
47
|
-
:top="item?.icon?.top"
|
|
48
|
-
:stop="item?.icon?.stop"
|
|
49
|
-
:round="item?.icon?.round"
|
|
50
|
-
:customStyle="item?.icon?.customStyle"
|
|
51
|
-
></HyIcon>
|
|
52
|
-
</slot>
|
|
53
|
-
</view>
|
|
54
|
-
<view class="hy-cell--body__container__content-title">
|
|
55
|
-
<!-- 将slot与默认内容用if/else分开主要是因为微信小程序不支持slot嵌套传递,这样才能解决collapse组件的slot不失效问题,label暂时未用到。 -->
|
|
56
|
-
<!-- @slot 列表标题插槽 -->
|
|
57
|
-
<slot name="cell-title" :title="item?.title">
|
|
58
|
-
<text
|
|
59
|
-
class="hy-cell--body__container__content-title--text"
|
|
60
|
-
:class="[
|
|
61
|
-
(disabled || item?.disabled) && 'hy-cell--disabled',
|
|
62
|
-
]"
|
|
63
|
-
>
|
|
64
|
-
{{ item?.title }}
|
|
65
|
-
</text>
|
|
66
|
-
</slot>
|
|
67
|
-
<!-- @slot 列表小标题插槽 -->
|
|
68
|
-
<slot name="sub" v-if="item?.subhead" :sub="item.subhead">
|
|
69
|
-
<text
|
|
70
|
-
class="hy-cell--body__container__content-title--sub"
|
|
71
|
-
:class="[disabled && 'hy-cell--disabled']"
|
|
72
|
-
>
|
|
73
|
-
{{ item.subhead }}
|
|
74
|
-
</text>
|
|
75
|
-
</slot>
|
|
76
|
-
</view>
|
|
77
|
-
</view>
|
|
16
|
+
<slot v-if="$slots.default"></slot>
|
|
17
|
+
<template v-else v-for="(item, i) in list" :key="i">
|
|
18
|
+
<view
|
|
19
|
+
:class="ItemClass"
|
|
20
|
+
:hover-class="containerClass(item)"
|
|
21
|
+
:hover-stay-time="250"
|
|
22
|
+
:style="{
|
|
23
|
+
borderBottom:
|
|
24
|
+
border && i !== list.length - 1 ? '1rpx solid #c8c7cc66' : '',
|
|
25
|
+
}"
|
|
26
|
+
@tap="clickHandler($event, item, i)"
|
|
27
|
+
>
|
|
28
|
+
<view class="hy-cell__body--container__content">
|
|
78
29
|
<view
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
justifyContent:
|
|
82
|
-
arrange === 'left'
|
|
83
|
-
? 'flex-start'
|
|
84
|
-
: arrange === 'right'
|
|
85
|
-
? 'flex-end'
|
|
86
|
-
: 'center',
|
|
87
|
-
}"
|
|
30
|
+
v-if="item?.icon?.name || $slots.icon"
|
|
31
|
+
class="hy-cell__body--container__content--icon"
|
|
88
32
|
>
|
|
89
|
-
<!-- @slot
|
|
90
|
-
<slot name="
|
|
33
|
+
<!-- @slot 图标插槽 -->
|
|
34
|
+
<slot v-if="$slots.icon" name="icon" :icon="item?.icon"></slot>
|
|
35
|
+
<HyIcon
|
|
36
|
+
v-else
|
|
37
|
+
:size="iconSize"
|
|
38
|
+
:name="item?.icon?.name"
|
|
39
|
+
:color="
|
|
40
|
+
disabled || item?.disabled ? '#c0c0c0' : item?.icon?.color
|
|
41
|
+
"
|
|
42
|
+
:bold="item?.icon?.bold"
|
|
43
|
+
:customPrefix="item?.icon?.customPrefix"
|
|
44
|
+
:imgMode="item?.icon?.imgMode"
|
|
45
|
+
:width="item?.icon?.width"
|
|
46
|
+
:height="item?.icon?.height"
|
|
47
|
+
:top="item?.icon?.top"
|
|
48
|
+
:stop="item?.icon?.stop"
|
|
49
|
+
:round="item?.icon?.round"
|
|
50
|
+
:customStyle="item?.icon?.customStyle"
|
|
51
|
+
></HyIcon>
|
|
52
|
+
</view>
|
|
53
|
+
<view class="hy-cell__body--container__content--title">
|
|
54
|
+
<!-- 将slot与默认内容用if/else分开主要是因为微信小程序不支持slot嵌套传递,这样才能解决collapse组件的slot不失效问题,label暂时未用到。 -->
|
|
55
|
+
<!-- @slot 列表标题插槽 -->
|
|
56
|
+
<slot
|
|
57
|
+
v-if="$slots['cell-title']"
|
|
58
|
+
name="cell-title"
|
|
59
|
+
:title="item?.title"
|
|
60
|
+
></slot>
|
|
61
|
+
<text
|
|
62
|
+
v-else
|
|
63
|
+
class="hy-cell__body--container__content--title__text"
|
|
64
|
+
:class="[(disabled || item?.disabled) && 'hy-cell__disabled']"
|
|
65
|
+
>
|
|
66
|
+
{{ item?.title }}
|
|
67
|
+
</text>
|
|
68
|
+
<!-- @slot 列表小标题插槽 -->
|
|
69
|
+
<template v-if="item?.subhead">
|
|
70
|
+
<slot v-if="$slots.sub" name="sub" :sub="item.subhead"></slot>
|
|
91
71
|
<text
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
72
|
+
v-else
|
|
73
|
+
class="hy-cell__body--container__content--title__sub"
|
|
74
|
+
:class="[disabled && 'hy-cell__disabled']"
|
|
95
75
|
>
|
|
96
|
-
{{ item.
|
|
76
|
+
{{ item.subhead }}
|
|
97
77
|
</text>
|
|
98
|
-
</
|
|
78
|
+
</template>
|
|
99
79
|
</view>
|
|
100
|
-
|
|
101
|
-
|
|
80
|
+
</view>
|
|
81
|
+
<view
|
|
82
|
+
class="hy-cell__body--container__center"
|
|
83
|
+
:style="{
|
|
84
|
+
justifyContent:
|
|
85
|
+
arrange === 'left'
|
|
86
|
+
? 'flex-start'
|
|
87
|
+
: arrange === 'right'
|
|
88
|
+
? 'flex-end'
|
|
89
|
+
: 'center',
|
|
90
|
+
}"
|
|
91
|
+
>
|
|
92
|
+
<!-- @slot 值内容插槽 -->
|
|
93
|
+
<slot v-if="$slots.value" name="value" :record="item"></slot>
|
|
94
|
+
<text
|
|
95
|
+
v-else-if="value || item?.value"
|
|
102
96
|
:class="[
|
|
103
|
-
|
|
97
|
+
'hy-cell__body__container__center--value',
|
|
98
|
+
disabled && 'hy-cell--disabled',
|
|
104
99
|
]"
|
|
105
100
|
>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
101
|
+
{{ item.value || value }}
|
|
102
|
+
</text>
|
|
103
|
+
</view>
|
|
104
|
+
<view
|
|
105
|
+
class="hy-cell__body--container__right-icon"
|
|
106
|
+
:class="[
|
|
107
|
+
`hy-cell__body--container__right-icon--${item?.arrowDirection || arrowDirection}`,
|
|
108
|
+
]"
|
|
109
|
+
>
|
|
110
|
+
<!-- @slot 右边按钮插槽 -->
|
|
111
|
+
<slot
|
|
112
|
+
v-if="$slots['right-icon']"
|
|
113
|
+
name="right-icon"
|
|
114
|
+
:icon="item?.rightIcon || rightIcon"
|
|
115
|
+
></slot>
|
|
116
|
+
<HyIcon
|
|
117
|
+
v-else
|
|
118
|
+
:name="
|
|
119
|
+
item?.rightIcon?.name || rightIcon?.name || IconConfig.RIGHT
|
|
120
|
+
"
|
|
121
|
+
:color="
|
|
122
|
+
disabled || item?.disabled
|
|
123
|
+
? '#c0c0c0'
|
|
124
|
+
: item?.rightIcon?.color || rightIcon?.color
|
|
125
|
+
"
|
|
126
|
+
:bold="item?.rightIcon?.bold || rightIcon?.bold"
|
|
127
|
+
:customPrefix="
|
|
128
|
+
item?.rightIcon?.customPrefix || rightIcon?.customPrefix
|
|
129
|
+
"
|
|
130
|
+
:imgMode="item?.rightIcon?.imgMode || rightIcon?.imgMode"
|
|
131
|
+
:width="item?.rightIcon?.width || rightIcon?.width"
|
|
132
|
+
:height="item?.rightIcon?.height || rightIcon?.height"
|
|
133
|
+
:top="item?.rightIcon?.top || rightIcon?.name"
|
|
134
|
+
:stop="item?.rightIcon?.stop || rightIcon?.stop"
|
|
135
|
+
:round="item?.rightIcon?.round || rightIcon?.round"
|
|
136
|
+
:customStyle="
|
|
137
|
+
item?.rightIcon?.customStyle || rightIcon?.customStyle
|
|
138
|
+
"
|
|
139
|
+
></HyIcon>
|
|
133
140
|
</view>
|
|
141
|
+
</view>
|
|
134
142
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
</slot>
|
|
143
|
+
<!-- @slot 底部插槽 -->
|
|
144
|
+
<slot name="bottom" :record="item" />
|
|
145
|
+
</template>
|
|
139
146
|
</view>
|
|
140
147
|
</view>
|
|
141
148
|
</template>
|
|
@@ -246,7 +253,7 @@ const containerClass = computed(() => {
|
|
|
246
253
|
!props.disabled &&
|
|
247
254
|
!temp?.disabled &&
|
|
248
255
|
props.clickable &&
|
|
249
|
-
"hy-
|
|
256
|
+
"hy-cell__body--container__clickable",
|
|
250
257
|
]
|
|
251
258
|
.filter(Boolean)
|
|
252
259
|
.join();
|
|
@@ -254,8 +261,8 @@ const containerClass = computed(() => {
|
|
|
254
261
|
});
|
|
255
262
|
const ItemClass = computed(() => {
|
|
256
263
|
return [
|
|
257
|
-
"hy-
|
|
258
|
-
`hy-
|
|
264
|
+
"hy-cell__body--container",
|
|
265
|
+
`hy-cell__body--container__${props.size}`,
|
|
259
266
|
];
|
|
260
267
|
});
|
|
261
268
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/*row内容*/
|
|
31
|
-
@include
|
|
31
|
+
@include e(body) {
|
|
32
32
|
/* #ifndef APP-NVUE */
|
|
33
33
|
box-sizing: border-box;
|
|
34
34
|
/* #endif */
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
border-radius: $hy-border-margin-padding-sm;
|
|
38
38
|
overflow: hidden;
|
|
39
39
|
|
|
40
|
-
@include
|
|
40
|
+
@include m(container) {
|
|
41
41
|
@include flex(row);
|
|
42
42
|
align-items: center;
|
|
43
43
|
justify-content: space-between;
|
|
@@ -73,20 +73,20 @@
|
|
|
73
73
|
@include e(content) {
|
|
74
74
|
@include flex(row);
|
|
75
75
|
/*左边icon*/
|
|
76
|
-
|
|
76
|
+
@include m(icon) {
|
|
77
77
|
@include flex;
|
|
78
78
|
align-items: center;
|
|
79
79
|
margin-right: 10px;
|
|
80
80
|
}
|
|
81
81
|
/*行头部*/
|
|
82
|
-
|
|
82
|
+
@include m(title) {
|
|
83
83
|
margin-right: $hy-border-margin-padding-sm;
|
|
84
84
|
flex: 33rpx;
|
|
85
85
|
display: flex;
|
|
86
86
|
flex-direction: column;
|
|
87
87
|
|
|
88
88
|
/*sub值*/
|
|
89
|
-
|
|
89
|
+
@include e(sub) {
|
|
90
90
|
margin-top: $hy-border-margin-padding-sm;
|
|
91
91
|
color: $hy-text-color--grey;
|
|
92
92
|
}
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
@include flex;
|
|
99
99
|
max-width: 90%;
|
|
100
100
|
flex: 1;
|
|
101
|
-
@include
|
|
101
|
+
@include m(value) {
|
|
102
102
|
line-height: 24px;
|
|
103
103
|
color: $hy-text-color--grey;
|
|
104
104
|
margin-right: $hy-border-margin-padding-sm;
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
@include
|
|
130
|
+
@include e(disabled) {
|
|
131
131
|
color: $hy-text-color--disabled;
|
|
132
132
|
/* #ifndef APP-NVUE */
|
|
133
133
|
cursor: not-allowed;
|
|
@@ -11,23 +11,26 @@
|
|
|
11
11
|
]"
|
|
12
12
|
>
|
|
13
13
|
<view
|
|
14
|
-
class="hy-checkbox--icon-wrap cursor-pointer"
|
|
15
14
|
@tap.stop="iconClickHandler($event, item)"
|
|
16
15
|
:class="iconClasses(item)"
|
|
17
16
|
:style="iconWrapStyle(item)"
|
|
18
17
|
>
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
<template v-if="item[fieldNames.checked]">
|
|
19
|
+
<slot
|
|
20
|
+
v-if="$slots.icon"
|
|
21
|
+
name="icon"
|
|
22
|
+
:iconColor="iconColor"
|
|
23
|
+
:iconSize="addUnit(iconSize)"
|
|
24
|
+
>
|
|
25
|
+
</slot>
|
|
24
26
|
<HyIcon
|
|
27
|
+
v-else
|
|
25
28
|
class="hy-checkbox--icon-wrap__icon"
|
|
26
29
|
:name="IconConfig.CHECK_MASK"
|
|
27
|
-
:size="addUnit(sizeType[size]
|
|
30
|
+
:size="addUnit(sizeType[size] || iconSize)"
|
|
28
31
|
:color="iconColor || '#ffffff'"
|
|
29
32
|
/>
|
|
30
|
-
</
|
|
33
|
+
</template>
|
|
31
34
|
</view>
|
|
32
35
|
<view
|
|
33
36
|
:class="[
|
|
@@ -41,7 +44,7 @@
|
|
|
41
44
|
<text
|
|
42
45
|
:style="{
|
|
43
46
|
color: labelColor,
|
|
44
|
-
fontSize: addUnit(sizeType[size]
|
|
47
|
+
fontSize: addUnit(sizeType[size] || labelSize),
|
|
45
48
|
}"
|
|
46
49
|
>
|
|
47
50
|
{{ item[fieldNames.label] }}
|
|
@@ -178,7 +181,7 @@ const columns_1 = ref();
|
|
|
178
181
|
const sizeType: AnyObject = reactive({
|
|
179
182
|
small: 14,
|
|
180
183
|
medium: 18,
|
|
181
|
-
large:
|
|
184
|
+
large: 24,
|
|
182
185
|
});
|
|
183
186
|
|
|
184
187
|
watch(
|
|
@@ -227,7 +230,7 @@ const bemClass = computed(() => {
|
|
|
227
230
|
* */
|
|
228
231
|
const iconClasses = computed(() => {
|
|
229
232
|
return (temp: CheckboxColumnsVo): string[] => {
|
|
230
|
-
let classes: string[] = [];
|
|
233
|
+
let classes: string[] = ["hy-checkbox--icon-wrap", "cursor-pointer"];
|
|
231
234
|
// 组件的形状
|
|
232
235
|
classes.push("hy-checkbox--icon-wrap--" + props.shape);
|
|
233
236
|
if (isDisabled(temp?.disabled)) {
|
|
@@ -253,15 +256,13 @@ const iconWrapStyle = computed(() => {
|
|
|
253
256
|
style.backgroundColor =
|
|
254
257
|
temp[props.fieldNames.checked] && !isDisabled(temp?.disabled)
|
|
255
258
|
? props.activeColor
|
|
256
|
-
:
|
|
257
|
-
? "#ffffff"
|
|
258
|
-
: "";
|
|
259
|
+
: "";
|
|
259
260
|
style.borderColor =
|
|
260
261
|
temp[props.fieldNames.checked] && !isDisabled(temp?.disabled)
|
|
261
262
|
? props.activeColor
|
|
262
263
|
: props.inactiveColor;
|
|
263
|
-
style.width = addUnit(sizeType[props.size]
|
|
264
|
-
style.height = addUnit(sizeType[props.size]
|
|
264
|
+
style.width = addUnit(sizeType[props.size] || props.size);
|
|
265
|
+
style.height = addUnit(sizeType[props.size] || props.size);
|
|
265
266
|
return style;
|
|
266
267
|
};
|
|
267
268
|
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import { computed, provide } from "vue";
|
|
8
|
+
import { computed, provide, toRefs } from "vue";
|
|
9
9
|
import type { CSSProperties, PropType } from "vue";
|
|
10
10
|
import { bem } from "../../utils";
|
|
11
11
|
import type { ICheckBoxGroupEmits } from "./typing";
|
|
@@ -98,8 +98,8 @@ const bemClass = computed(() => {
|
|
|
98
98
|
return bem("checkbox-group", props, ["placement"]);
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
...props,
|
|
101
|
+
const context = {
|
|
102
|
+
...toRefs(props),
|
|
103
103
|
setCheckedStatus(value: string | number) {
|
|
104
104
|
let arr = [...props.modelValue];
|
|
105
105
|
if (props.modelValue?.includes(value)) {
|
|
@@ -110,7 +110,9 @@ provide("hy-checkbox-group", {
|
|
|
110
110
|
emit("update:modelValue", arr);
|
|
111
111
|
emit("change", arr);
|
|
112
112
|
},
|
|
113
|
-
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
provide("hy-checkbox-group", context);
|
|
114
116
|
</script>
|
|
115
117
|
|
|
116
118
|
<style lang="scss" scoped>
|
|
@@ -4,28 +4,32 @@
|
|
|
4
4
|
@tap.stop="wrapperClickHandler"
|
|
5
5
|
:style="checkboxStyle"
|
|
6
6
|
:class="[
|
|
7
|
-
`hy-checkbox--label__${checkboxGroup?.iconPlacement}`,
|
|
8
|
-
checkboxGroup?.borderBottom &&
|
|
9
|
-
checkboxGroup?.placement === 'column' &&
|
|
7
|
+
`hy-checkbox--label__${checkboxGroup?.iconPlacement?.value}`,
|
|
8
|
+
checkboxGroup?.borderBottom?.value &&
|
|
9
|
+
checkboxGroup?.placement?.value === 'column' &&
|
|
10
10
|
'hy-border__bottom',
|
|
11
11
|
]"
|
|
12
12
|
>
|
|
13
13
|
<view
|
|
14
|
-
class="hy-checkbox--icon-wrap cursor-pointer"
|
|
15
14
|
@tap.stop="iconClickHandler"
|
|
16
15
|
:class="iconClasses"
|
|
17
16
|
:style="iconWrapStyle"
|
|
18
17
|
>
|
|
19
|
-
<
|
|
18
|
+
<template v-if="isChecked">
|
|
19
|
+
<slot v-if="$slots.icon" name="icon"></slot>
|
|
20
20
|
<HyIcon
|
|
21
|
+
v-else
|
|
21
22
|
class="hy-checkbox--icon-wrap__icon"
|
|
22
23
|
:name="IconConfig.CHECK_MASK"
|
|
23
24
|
:size="
|
|
24
|
-
addUnit(
|
|
25
|
+
addUnit(
|
|
26
|
+
sizeType[checkboxGroup?.size?.value] ||
|
|
27
|
+
checkboxGroup?.iconSize?.value,
|
|
28
|
+
)
|
|
25
29
|
"
|
|
26
|
-
:color="checkboxGroup?.iconColor || '#ffffff'"
|
|
30
|
+
:color="checkboxGroup?.iconColor?.value || '#ffffff'"
|
|
27
31
|
/>
|
|
28
|
-
</
|
|
32
|
+
</template>
|
|
29
33
|
</view>
|
|
30
34
|
<view
|
|
31
35
|
:class="[
|
|
@@ -38,9 +42,10 @@
|
|
|
38
42
|
<slot name="label">
|
|
39
43
|
<text
|
|
40
44
|
:style="{
|
|
41
|
-
color: checkboxGroup?.labelColor,
|
|
45
|
+
color: checkboxGroup?.labelColor?.value,
|
|
42
46
|
fontSize: addUnit(
|
|
43
|
-
sizeType[checkboxGroup?.size]
|
|
47
|
+
sizeType[checkboxGroup?.size?.value] ||
|
|
48
|
+
checkboxGroup?.labelSize?.value,
|
|
44
49
|
),
|
|
45
50
|
}"
|
|
46
51
|
>
|
|
@@ -67,7 +72,7 @@ import { computed, watch, ref, reactive, inject } from "vue";
|
|
|
67
72
|
import type { CSSProperties } from "vue";
|
|
68
73
|
import { addUnit, error } from "../../utils";
|
|
69
74
|
import { IconConfig } from "../../config";
|
|
70
|
-
import type {
|
|
75
|
+
import type { ICheckboxGroupContext } from "./typing";
|
|
71
76
|
// 组件
|
|
72
77
|
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
73
78
|
|
|
@@ -101,12 +106,12 @@ const props = defineProps({
|
|
|
101
106
|
});
|
|
102
107
|
|
|
103
108
|
// 注入表单上下文
|
|
104
|
-
const checkboxGroup = inject<
|
|
109
|
+
const checkboxGroup = inject<ICheckboxGroupContext>("hy-checkbox-group");
|
|
105
110
|
const isChecked = ref(false);
|
|
106
111
|
const sizeType: AnyObject = reactive({
|
|
107
112
|
small: 14,
|
|
108
113
|
medium: 18,
|
|
109
|
-
large:
|
|
114
|
+
large: 24,
|
|
110
115
|
});
|
|
111
116
|
|
|
112
117
|
watch(
|
|
@@ -119,35 +124,46 @@ watch(
|
|
|
119
124
|
);
|
|
120
125
|
|
|
121
126
|
watch(
|
|
122
|
-
() => checkboxGroup?.modelValue,
|
|
127
|
+
() => checkboxGroup?.modelValue.value,
|
|
123
128
|
(newVal) => {
|
|
124
|
-
if (newVal?.length)
|
|
129
|
+
if (newVal?.length) {
|
|
130
|
+
isChecked.value = newVal.includes(props.value);
|
|
131
|
+
} else {
|
|
132
|
+
isChecked.value = false;
|
|
133
|
+
}
|
|
125
134
|
},
|
|
126
135
|
{ immediate: true },
|
|
127
136
|
);
|
|
128
137
|
|
|
129
|
-
const isDisabled = (): boolean =>
|
|
138
|
+
const isDisabled = (): boolean =>
|
|
139
|
+
checkboxGroup?.disabled?.value || props.disabled;
|
|
130
140
|
|
|
131
141
|
const checkboxStyle = computed(() => {
|
|
132
142
|
const style: CSSProperties = {};
|
|
133
|
-
if (
|
|
143
|
+
if (
|
|
144
|
+
checkboxGroup?.borderBottom?.value &&
|
|
145
|
+
checkboxGroup?.placement?.value === "row"
|
|
146
|
+
) {
|
|
134
147
|
error(
|
|
135
148
|
"检测到您将borderBottom设置为true,需要同时将hy-checkbox-group的placement设置为column才有效",
|
|
136
149
|
);
|
|
137
150
|
}
|
|
138
151
|
// 当父组件设置了显示下边框并且排列形式为纵向时,给内容和边框之间加上一定间隔
|
|
139
|
-
if (
|
|
152
|
+
if (
|
|
153
|
+
checkboxGroup?.borderBottom?.value &&
|
|
154
|
+
checkboxGroup?.placement?.value === "column"
|
|
155
|
+
) {
|
|
140
156
|
style.paddingBottom = "8px";
|
|
141
157
|
}
|
|
142
|
-
return Object.assign(style, checkboxGroup?.customStyle);
|
|
158
|
+
return Object.assign(style, checkboxGroup?.customStyle?.value);
|
|
143
159
|
});
|
|
144
160
|
/**
|
|
145
161
|
* @description 定义icon的Class类名
|
|
146
162
|
* */
|
|
147
163
|
const iconClasses = computed(() => {
|
|
148
|
-
let classes: string[] = [];
|
|
164
|
+
let classes: string[] = ["hy-checkbox--icon-wrap", "cursor-pointer"];
|
|
149
165
|
// 组件的形状
|
|
150
|
-
classes.push("hy-checkbox--icon-wrap--" + checkboxGroup?.shape);
|
|
166
|
+
classes.push("hy-checkbox--icon-wrap--" + checkboxGroup?.shape?.value);
|
|
151
167
|
if (isDisabled()) {
|
|
152
168
|
classes.push("hy-checkbox--icon-wrap--disabled");
|
|
153
169
|
}
|
|
@@ -164,27 +180,23 @@ const iconClasses = computed(() => {
|
|
|
164
180
|
* @description 定义icon的样式
|
|
165
181
|
* */
|
|
166
182
|
const iconWrapStyle = computed(() => {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
style.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
return style;
|
|
187
|
-
};
|
|
183
|
+
// checkbox的整体样式
|
|
184
|
+
const style: CSSProperties = {};
|
|
185
|
+
style.backgroundColor =
|
|
186
|
+
isChecked.value && !isDisabled() ? checkboxGroup?.activeColor?.value : "";
|
|
187
|
+
style.borderColor =
|
|
188
|
+
isChecked.value && !isDisabled()
|
|
189
|
+
? checkboxGroup?.activeColor?.value
|
|
190
|
+
: checkboxGroup?.inactiveColor?.value;
|
|
191
|
+
if (checkboxGroup?.size?.value) {
|
|
192
|
+
style.width = addUnit(
|
|
193
|
+
sizeType[checkboxGroup.size.value] || checkboxGroup.size.value,
|
|
194
|
+
);
|
|
195
|
+
style.height = addUnit(
|
|
196
|
+
sizeType[checkboxGroup.size.value] || checkboxGroup.size.value,
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
return style;
|
|
188
200
|
});
|
|
189
201
|
|
|
190
202
|
/**
|
|
@@ -201,7 +213,7 @@ const iconClickHandler = (e: Event) => {
|
|
|
201
213
|
* */
|
|
202
214
|
const wrapperClickHandler = (e: Event) => {
|
|
203
215
|
e.stopPropagation();
|
|
204
|
-
if (checkboxGroup?.labelDisabled || isDisabled()) return;
|
|
216
|
+
if (checkboxGroup?.labelDisabled?.value || isDisabled()) return;
|
|
205
217
|
setCheckedStatus();
|
|
206
218
|
};
|
|
207
219
|
/**
|
|
@@ -209,7 +221,7 @@ const wrapperClickHandler = (e: Event) => {
|
|
|
209
221
|
* */
|
|
210
222
|
const labelClickHandler = (e: Event) => {
|
|
211
223
|
e.stopPropagation();
|
|
212
|
-
if (checkboxGroup?.labelDisabled || isDisabled()) return;
|
|
224
|
+
if (checkboxGroup?.labelDisabled?.value || isDisabled()) return;
|
|
213
225
|
setCheckedStatus();
|
|
214
226
|
};
|
|
215
227
|
|