hy-app 0.2.13 → 0.2.15
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 +81 -13
- package/components/hy-action-sheet/typing.d.ts +1 -3
- package/components/hy-address-picker/hy-address-picker.vue +109 -8
- package/components/hy-address-picker/index.scss +2 -2
- package/components/hy-address-picker/typing.d.ts +39 -30
- package/components/hy-avatar/hy-avatar.vue +78 -4
- package/components/hy-avatar/typing.d.ts +21 -16
- package/components/hy-back-top/hy-back-top.vue +86 -28
- package/components/hy-back-top/typing.d.ts +17 -12
- package/components/hy-badge/hy-badge.vue +114 -43
- package/components/hy-badge/typing.d.ts +20 -15
- package/components/hy-button/HyButton.docgen.js +6 -0
- package/components/hy-button/hy-button.vue +70 -77
- package/components/hy-button/props.ts +40 -41
- package/components/hy-calendar/hy-calendar.vue +290 -143
- package/components/hy-calendar/typing.d.ts +38 -31
- package/components/hy-card/hy-card.vue +139 -36
- package/components/hy-card/typing.d.ts +39 -28
- package/components/hy-cell/hy-cell.vue +131 -67
- package/components/hy-cell/typing.d.ts +6 -1
- package/components/hy-check-button/hy-check-button.vue +101 -32
- package/components/hy-check-button/typing.d.ts +26 -19
- package/components/hy-checkbox/hy-checkbox.vue +167 -78
- package/components/hy-checkbox/typing.d.ts +26 -19
- package/components/hy-code-input/hy-code-input.vue +101 -5
- package/components/hy-code-input/typing.d.ts +9 -0
- package/components/hy-config-provider/hy-config-provider.vue +44 -24
- package/components/hy-config-provider/typing.d.ts +0 -4
- package/components/hy-count-down/hy-count-down.vue +99 -62
- package/components/hy-count-down/typing.d.ts +18 -5
- package/components/hy-count-to/hy-count-to.vue +165 -113
- package/components/hy-count-to/typing.d.ts +15 -11
- package/components/hy-datetime-picker/hy-datetime-picker.vue +338 -232
- package/components/hy-datetime-picker/typing.d.ts +49 -39
- package/components/hy-divider/hy-divider.vue +128 -64
- package/components/hy-divider/typing.d.ts +16 -16
- package/components/hy-dropdown/hy-dropdown.vue +57 -19
- package/components/hy-dropdown/typing.d.ts +14 -14
- package/components/hy-dropdown-item/hy-dropdown-item.vue +34 -5
- package/components/hy-dropdown-item/typing.d.ts +13 -6
- package/components/hy-empty/hy-empty.vue +64 -6
- package/components/hy-empty/typing.d.ts +5 -0
- package/components/hy-float-button/hy-float-button.vue +117 -5
- package/components/hy-float-button/typing.d.ts +7 -0
- package/components/hy-folding-panel/hy-folding-panel.vue +87 -25
- package/components/hy-folding-panel/typing.d.ts +24 -15
- package/components/hy-grid/hy-grid.vue +95 -35
- package/components/hy-grid/typing.d.ts +24 -19
- package/components/hy-icon/hy-icon.vue +84 -6
- package/components/hy-icon/typing.d.ts +5 -0
- package/components/hy-image/hy-image.vue +105 -6
- package/components/hy-image/typing.d.ts +9 -0
- package/components/hy-input/hy-input.vue +277 -130
- package/components/hy-input/props.ts +13 -14
- package/components/hy-input/typing.d.ts +59 -38
- package/components/hy-line/hy-line.vue +65 -25
- package/components/hy-line-progress/hy-line-progress.vue +68 -35
- package/components/hy-list/hy-list.vue +127 -61
- package/components/hy-list/typing.d.ts +19 -12
- package/components/hy-loading/hy-loading.vue +79 -25
- package/components/hy-menu/hy-menu.vue +69 -45
- package/components/hy-menu/typing.d.ts +22 -15
- package/components/hy-modal/hy-modal.vue +91 -4
- package/components/hy-modal/typing.d.ts +11 -0
- package/components/hy-navbar/hy-navbar.vue +105 -25
- package/components/hy-navbar/typing.d.ts +25 -20
- package/components/hy-notice-bar/hy-notice-bar.vue +97 -19
- package/components/hy-notice-bar/typing.d.ts +22 -17
- package/components/hy-notify/hy-notify.vue +106 -54
- package/components/hy-number-step/hy-number-step.vue +211 -120
- package/components/hy-number-step/typing.d.ts +45 -28
- package/components/hy-overlay/hy-overlay.vue +60 -16
- package/components/hy-overlay/typing.d.ts +11 -6
- package/components/hy-pagination/hy-pagination.vue +94 -37
- package/components/hy-pagination/typing.d.ts +20 -11
- package/components/hy-picker/hy-picker.vue +225 -160
- package/components/hy-picker/typing.d.ts +51 -28
- package/components/hy-popover/hy-popover.vue +55 -7
- package/components/hy-popover/typing.d.ts +21 -1
- package/components/hy-popup/hy-popup.vue +164 -99
- package/components/hy-popup/typing.d.ts +11 -0
- package/components/hy-price/hy-price.vue +77 -30
- package/components/hy-price/typing.d.ts +10 -10
- package/components/hy-qrcode/hy-qrcode.vue +75 -5
- package/components/hy-qrcode/typing.d.ts +25 -16
- package/components/hy-radio/hy-radio.vue +169 -88
- package/components/hy-radio/typing.d.ts +29 -22
- package/components/hy-rate/hy-rate.vue +155 -104
- package/components/hy-rate/typing.d.ts +23 -16
- package/components/hy-read-more/hy-read-more.vue +83 -56
- package/components/hy-read-more/typing.d.ts +18 -11
- package/components/hy-scroll-list/hy-scroll-list.vue +69 -58
- package/components/hy-scroll-list/typing.d.ts +14 -7
- package/components/hy-search/hy-search.vue +168 -62
- package/components/hy-search/typing.d.ts +47 -26
- package/components/hy-signature/hy-signature.vue +354 -272
- package/components/hy-signature/typing.d.ts +65 -52
- package/components/hy-slider/hy-slider.vue +208 -160
- package/components/hy-slider/typing.d.ts +28 -17
- package/components/hy-steps/hy-steps.vue +125 -99
- package/components/hy-steps/typing.d.ts +21 -14
- package/components/hy-submit-bar/hy-submit-bar.vue +129 -48
- package/components/hy-submit-bar/typing.d.ts +30 -23
- package/components/hy-subsection/hy-subsection.vue +139 -96
- package/components/hy-subsection/typing.d.ts +23 -16
- package/components/hy-swipe-action/hy-swipe-action.vue +161 -135
- package/components/hy-swipe-action/typing.d.ts +26 -17
- package/components/hy-swiper/hy-swiper.vue +178 -73
- package/components/hy-swiper/typing.d.ts +37 -28
- package/components/hy-switch/hy-switch.vue +107 -60
- package/components/hy-switch/typing.d.ts +25 -18
- package/components/hy-tabs/hy-tabs.vue +170 -160
- package/components/hy-tabs/typing.d.ts +36 -22
- package/components/hy-tag/hy-tag.vue +133 -58
- package/components/hy-tag/typing.d.ts +26 -18
- package/components/hy-text/hy-text.vue +106 -6
- package/components/hy-text/typing.d.ts +31 -26
- package/components/hy-textarea/hy-textarea.vue +183 -89
- package/components/hy-textarea/typing.d.ts +41 -24
- package/components/hy-tooltip/hy-tooltip.vue +145 -101
- package/components/hy-tooltip/typing.d.ts +18 -13
- package/components/hy-transition/hy-transition.vue +48 -13
- package/components/hy-transition/typing.d.ts +17 -0
- package/components/hy-upload/hy-upload.vue +113 -148
- package/components/hy-upload/typing.d.ts +71 -71
- package/components/hy-warn/hy-warn.vue +79 -36
- package/components/hy-warn/typing.d.ts +18 -11
- package/components/hy-waterfall/hy-waterfall.vue +90 -77
- package/components/hy-watermark/hy-watermark.vue +82 -5
- package/components/hy-watermark/typing.d.ts +20 -20
- package/global.d.ts +39 -59
- package/package.json +5 -13
- package/utils/inspect.ts +3 -1
- package/web-types.json +1 -1
- package/component-helper.ts +0 -177
- package/components.json +0 -3287
- package/dist/attributes.json +0 -1
- package/dist/docs/components/hy-action-sheet/hy-action-sheet.md +0 -41
- package/dist/docs/components/hy-address-picker/hy-address-picker.md +0 -25
- package/dist/docs/components/hy-avatar/hy-avatar.md +0 -19
- package/dist/docs/components/hy-back-top/hy-back-top.md +0 -19
- package/dist/docs/components/hy-badge/hy-badge.md +0 -13
- package/dist/docs/components/hy-button/hy-button.md +0 -61
- package/dist/docs/components/hy-calendar/header.md +0 -17
- package/dist/docs/components/hy-calendar/hy-calendar.md +0 -27
- package/dist/docs/components/hy-calendar/month.md +0 -38
- package/dist/docs/components/hy-card/hy-card.md +0 -24
- package/dist/docs/components/hy-cell/hy-cell.md +0 -26
- package/dist/docs/components/hy-check-button/hy-check-button.md +0 -14
- package/dist/docs/components/hy-checkbox/hy-checkbox.md +0 -21
- package/dist/docs/components/hy-code-input/hy-code-input.md +0 -15
- package/dist/docs/components/hy-config-provider/hy-config-provider.md +0 -13
- package/dist/docs/components/hy-count-down/hy-count-down.md +0 -34
- package/dist/docs/components/hy-count-to/hy-count-to.md +0 -31
- package/dist/docs/components/hy-datetime-picker/hy-datetime-picker.md +0 -25
- package/dist/docs/components/hy-divider/hy-divider.md +0 -13
- package/dist/docs/components/hy-dropdown/hy-dropdown.md +0 -13
- package/dist/docs/components/hy-dropdown-item/hy-dropdown-item.md +0 -20
- package/dist/docs/components/hy-empty/hy-empty.md +0 -20
- package/dist/docs/components/hy-float-button/hy-float-button.md +0 -20
- package/dist/docs/components/hy-folding-panel/hy-folding-panel.md +0 -24
- package/dist/docs/components/hy-form/hy-form.md +0 -29
- package/dist/docs/components/hy-grid/hy-grid.md +0 -19
- package/dist/docs/components/hy-icon/hy-icon.md +0 -13
- package/dist/docs/components/hy-image/hy-image.md +0 -22
- package/dist/docs/components/hy-input/hy-input.md +0 -29
- package/dist/docs/components/hy-line/hy-line.md +0 -7
- package/dist/docs/components/hy-line-progress/hy-line-progress.md +0 -13
- package/dist/docs/components/hy-list/hy-list.md +0 -25
- package/dist/docs/components/hy-loading/hy-loading.md +0 -14
- package/dist/docs/components/hy-login/ThePhoneLogin.md +0 -20
- package/dist/docs/components/hy-login/TheUserLogin.md +0 -44
- package/dist/docs/components/hy-login/hy-login.md +0 -14
- package/dist/docs/components/hy-menu/hy-menu.md +0 -21
- package/dist/docs/components/hy-modal/hy-modal.md +0 -23
- package/dist/docs/components/hy-navbar/hy-navbar.md +0 -22
- package/dist/docs/components/hy-notice-bar/hy-column-notice.md +0 -20
- package/dist/docs/components/hy-notice-bar/hy-notice-bar.md +0 -14
- package/dist/docs/components/hy-notice-bar/hy-row-notice.md +0 -20
- package/dist/docs/components/hy-notify/hy-notify.md +0 -23
- package/dist/docs/components/hy-number-step/hy-number-step.md +0 -27
- package/dist/docs/components/hy-overlay/hy-overlay.md +0 -19
- package/dist/docs/components/hy-pagination/hy-pagination.md +0 -14
- package/dist/docs/components/hy-parse/hy-parse.md +0 -46
- package/dist/docs/components/hy-parse/node/node.md +0 -7
- package/dist/docs/components/hy-picker/hy-picker.md +0 -32
- package/dist/docs/components/hy-popover/hy-popover.md +0 -34
- package/dist/docs/components/hy-popup/hy-popup.md +0 -22
- package/dist/docs/components/hy-price/hy-price.md +0 -13
- package/dist/docs/components/hy-qrcode/hy-qrcode.md +0 -15
- package/dist/docs/components/hy-radio/hy-radio.md +0 -21
- package/dist/docs/components/hy-rate/hy-rate.md +0 -14
- package/dist/docs/components/hy-read-more/hy-read-more.md +0 -21
- package/dist/docs/components/hy-scroll-list/hy-scroll-list.md +0 -21
- package/dist/docs/components/hy-search/hy-search.md +0 -27
- package/dist/docs/components/hy-signature/hy-signature.md +0 -45
- package/dist/docs/components/hy-slider/hy-slider.md +0 -24
- package/dist/docs/components/hy-status-bar/hy-status-bar.md +0 -13
- package/dist/docs/components/hy-steps/hy-steps.md +0 -23
- package/dist/docs/components/hy-submit-bar/hy-submit-bar.md +0 -21
- package/dist/docs/components/hy-subsection/hy-subsection.md +0 -14
- package/dist/docs/components/hy-swipe-action/hy-swipe-action.md +0 -29
- package/dist/docs/components/hy-swiper/hy-swiper-indicator.md +0 -23
- package/dist/docs/components/hy-swiper/hy-swiper.md +0 -22
- package/dist/docs/components/hy-switch/hy-switch.md +0 -20
- package/dist/docs/components/hy-tabBar/hy-tabBar.md +0 -13
- package/dist/docs/components/hy-tabs/hy-tabs.md +0 -27
- package/dist/docs/components/hy-tag/hy-tag.md +0 -21
- package/dist/docs/components/hy-text/hy-text.md +0 -13
- package/dist/docs/components/hy-textarea/hy-textarea.md +0 -19
- package/dist/docs/components/hy-toast/hy-toast.md +0 -17
- package/dist/docs/components/hy-tooltip/hy-tooltip.md +0 -13
- package/dist/docs/components/hy-transition/hy-transition.md +0 -25
- package/dist/docs/components/hy-upload/hy-upload.md +0 -25
- package/dist/docs/components/hy-warn/hy-warn.md +0 -14
- package/dist/docs/components/hy-waterfall/hy-waterfall.md +0 -30
- package/dist/docs/components/hy-watermark/hy-watermark.md +0 -7
- package/dist/docs/components/message/TheMessage.md +0 -17
- package/dist/docs/components/yk-dialog/yk-dialog.md +0 -7
- package/dist/tags.json +0 -1
- package/dist/web-types.json +0 -1
- package/docgen.config.js +0 -14
- package/web-types.config.js +0 -7
|
@@ -16,11 +16,7 @@
|
|
|
16
16
|
:class="iconClasses(item)"
|
|
17
17
|
:style="iconWrapStyle(item)"
|
|
18
18
|
>
|
|
19
|
-
<slot
|
|
20
|
-
name="icon"
|
|
21
|
-
:iconColor="iconColor"
|
|
22
|
-
:iconSize="addUnit(iconSize)"
|
|
23
|
-
>
|
|
19
|
+
<slot name="icon" :iconColor="iconColor" :iconSize="addUnit(iconSize)">
|
|
24
20
|
<HyIcon
|
|
25
21
|
class="hy-checkbox__icon-wrap__icon"
|
|
26
22
|
:name="IconConfig.CHECK_MASK"
|
|
@@ -43,8 +39,9 @@
|
|
|
43
39
|
color: labelColor,
|
|
44
40
|
fontSize: addUnit(sizeType[size] ?? labelSize),
|
|
45
41
|
}"
|
|
46
|
-
>{{ item[fieldNames.label] }}</text
|
|
47
42
|
>
|
|
43
|
+
{{ item[fieldNames.label] }}
|
|
44
|
+
</text>
|
|
48
45
|
</slot>
|
|
49
46
|
</view>
|
|
50
47
|
</view>
|
|
@@ -53,27 +50,122 @@
|
|
|
53
50
|
</template>
|
|
54
51
|
|
|
55
52
|
<script lang="ts">
|
|
53
|
+
/**
|
|
54
|
+
* 复选框组件一般用于需要多个选择的场景,该组件功能完整,使用方便
|
|
55
|
+
* @displayName hy-checkbox
|
|
56
|
+
*/
|
|
57
|
+
defineOptions({})
|
|
56
58
|
export default {
|
|
57
|
-
name:
|
|
59
|
+
name: 'hy-checkbox',
|
|
58
60
|
options: {
|
|
59
61
|
addGlobalClass: true,
|
|
60
62
|
virtualHost: true,
|
|
61
|
-
styleIsolation:
|
|
63
|
+
styleIsolation: 'shared',
|
|
62
64
|
},
|
|
63
|
-
}
|
|
65
|
+
}
|
|
64
66
|
</script>
|
|
65
67
|
|
|
66
68
|
<script setup lang="ts">
|
|
67
|
-
import
|
|
68
|
-
import type {
|
|
69
|
-
import
|
|
70
|
-
import {
|
|
71
|
-
import
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
69
|
+
import { computed, toRefs, watch, ref, reactive } from 'vue'
|
|
70
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
71
|
+
import { addUnit, bem, error } from '../../utils'
|
|
72
|
+
import { IconConfig } from '../../config'
|
|
73
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
74
|
+
import type { ICheckBoxEmits } from './typing'
|
|
75
|
+
import type { CheckboxColumnsVo, IFieldNames } from '../hy-check-button/typing'
|
|
75
76
|
|
|
76
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
77
|
+
// const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
78
|
+
const props = defineProps({
|
|
79
|
+
/** 双向绑定值,数组类型 */
|
|
80
|
+
modelValue: {
|
|
81
|
+
type: [Boolean, Array<string | number>],
|
|
82
|
+
required: true,
|
|
83
|
+
},
|
|
84
|
+
/** 选择列表数据 */
|
|
85
|
+
columns: {
|
|
86
|
+
type: Array as unknown as PropType<Array<CheckboxColumnsVo>>,
|
|
87
|
+
default: [],
|
|
88
|
+
required: true,
|
|
89
|
+
},
|
|
90
|
+
/** 自定义接收columns的键 */
|
|
91
|
+
fieldNames: {
|
|
92
|
+
type: Object as unknown as PropType<IFieldNames>,
|
|
93
|
+
default: {
|
|
94
|
+
label: 'label',
|
|
95
|
+
value: 'value',
|
|
96
|
+
checked: 'checked',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
/**
|
|
100
|
+
* 标签的大小
|
|
101
|
+
* @values small,medium,large
|
|
102
|
+
* */
|
|
103
|
+
size: {
|
|
104
|
+
type: String,
|
|
105
|
+
default: 'medium',
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* 标签的形状
|
|
109
|
+
* @values circle,square
|
|
110
|
+
* */
|
|
111
|
+
shape: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: 'square',
|
|
114
|
+
},
|
|
115
|
+
/** 是否禁用 */
|
|
116
|
+
disabled: {
|
|
117
|
+
type: Boolean,
|
|
118
|
+
default: false,
|
|
119
|
+
},
|
|
120
|
+
/** 选中状态下的颜色 */
|
|
121
|
+
activeColor: String,
|
|
122
|
+
/** 未选中的颜色 */
|
|
123
|
+
inactiveColor: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: '#c8c9cc',
|
|
126
|
+
},
|
|
127
|
+
/** 图标的大小,单位px */
|
|
128
|
+
iconSize: {
|
|
129
|
+
type: [String, Number],
|
|
130
|
+
default: '20',
|
|
131
|
+
},
|
|
132
|
+
/** 图标颜色 */
|
|
133
|
+
iconColor: String,
|
|
134
|
+
/**
|
|
135
|
+
* 勾选图标的对齐方式
|
|
136
|
+
* @values left,right
|
|
137
|
+
* */
|
|
138
|
+
iconPlacement: {
|
|
139
|
+
type: String,
|
|
140
|
+
default: 'left',
|
|
141
|
+
},
|
|
142
|
+
/** 竖向配列时,是否显示下划线 */
|
|
143
|
+
borderBottom: {
|
|
144
|
+
type: Boolean,
|
|
145
|
+
default: false,
|
|
146
|
+
},
|
|
147
|
+
/** label的字体大小,px单位 */
|
|
148
|
+
labelSize: [String, Number],
|
|
149
|
+
/** label的颜色 */
|
|
150
|
+
labelColor: String,
|
|
151
|
+
/** 是否禁止点击提示语选中复选框 */
|
|
152
|
+
labelDisabled: {
|
|
153
|
+
type: Boolean,
|
|
154
|
+
default: false,
|
|
155
|
+
},
|
|
156
|
+
/**
|
|
157
|
+
* 排列方式
|
|
158
|
+
* @values row,column
|
|
159
|
+
* */
|
|
160
|
+
placement: {
|
|
161
|
+
type: String,
|
|
162
|
+
default: 'row',
|
|
163
|
+
},
|
|
164
|
+
/** 定义需要用到的外部样式 */
|
|
165
|
+
customStyle: {
|
|
166
|
+
type: Object as PropType<CSSProperties>,
|
|
167
|
+
},
|
|
168
|
+
})
|
|
77
169
|
const {
|
|
78
170
|
modelValue,
|
|
79
171
|
columns,
|
|
@@ -88,77 +180,74 @@ const {
|
|
|
88
180
|
borderBottom,
|
|
89
181
|
placement,
|
|
90
182
|
labelDisabled,
|
|
91
|
-
} = toRefs(props)
|
|
92
|
-
const emit = defineEmits(
|
|
183
|
+
} = toRefs(props)
|
|
184
|
+
const emit = defineEmits<ICheckBoxEmits>()
|
|
93
185
|
|
|
94
|
-
const columns_1 = ref()
|
|
186
|
+
const columns_1 = ref()
|
|
95
187
|
const sizeType: AnyObject = reactive({
|
|
96
188
|
small: 14,
|
|
97
189
|
medium: 18,
|
|
98
190
|
large: 22,
|
|
99
|
-
})
|
|
191
|
+
})
|
|
100
192
|
|
|
101
193
|
watch(
|
|
102
194
|
() => modelValue.value,
|
|
103
195
|
(newValue: boolean | (string | number)[]) => {
|
|
104
196
|
// 判断数组长度为1可以传true/false
|
|
105
|
-
if (columns.value?.length === 1 && typeof newValue ===
|
|
106
|
-
columns.value[0][fieldNames.value.checked] = newValue
|
|
107
|
-
columns_1.value = columns.value
|
|
197
|
+
if (columns.value?.length === 1 && typeof newValue === 'boolean') {
|
|
198
|
+
columns.value[0][fieldNames.value.checked] = newValue
|
|
199
|
+
columns_1.value = columns.value
|
|
108
200
|
} else if (Array.isArray(newValue)) {
|
|
109
201
|
columns_1.value = columns.value.map((item) => {
|
|
110
|
-
item[fieldNames.value.checked] = newValue.includes(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return item;
|
|
114
|
-
});
|
|
202
|
+
item[fieldNames.value.checked] = newValue.includes(item[fieldNames.value.value] as string)
|
|
203
|
+
return item
|
|
204
|
+
})
|
|
115
205
|
} else {
|
|
116
|
-
error(
|
|
206
|
+
error('传入值不是数组,请传数组值')
|
|
117
207
|
}
|
|
118
208
|
},
|
|
119
209
|
{ immediate: true },
|
|
120
|
-
)
|
|
210
|
+
)
|
|
121
211
|
|
|
122
|
-
const isDisabled = (disabledVal?: boolean): boolean =>
|
|
123
|
-
disabled.value || !!disabledVal;
|
|
212
|
+
const isDisabled = (disabledVal?: boolean): boolean => disabled.value || !!disabledVal
|
|
124
213
|
|
|
125
214
|
const checkboxStyle = computed(() => {
|
|
126
|
-
const style: CSSProperties = {}
|
|
127
|
-
if (borderBottom.value && placement.value ===
|
|
215
|
+
const style: CSSProperties = {}
|
|
216
|
+
if (borderBottom.value && placement.value === 'row') {
|
|
128
217
|
error(
|
|
129
|
-
|
|
130
|
-
)
|
|
218
|
+
'检测到您将borderBottom设置为true,需要同时将u-checkbox-group的placement设置为column才有效',
|
|
219
|
+
)
|
|
131
220
|
}
|
|
132
221
|
// 当父组件设置了显示下边框并且排列形式为纵向时,给内容和边框之间加上一定间隔
|
|
133
|
-
if (borderBottom.value && placement.value ===
|
|
134
|
-
style.paddingBottom =
|
|
222
|
+
if (borderBottom.value && placement.value === 'column') {
|
|
223
|
+
style.paddingBottom = '8px'
|
|
135
224
|
}
|
|
136
|
-
return Object.assign(style, customStyle.value)
|
|
137
|
-
})
|
|
225
|
+
return Object.assign(style, customStyle.value)
|
|
226
|
+
})
|
|
138
227
|
const bemClass = computed(() => {
|
|
139
|
-
return bem(
|
|
140
|
-
})
|
|
228
|
+
return bem('checkbox-group', props, ['placement'])
|
|
229
|
+
})
|
|
141
230
|
|
|
142
231
|
/**
|
|
143
232
|
* @description 定义icon的Class类名
|
|
144
233
|
* */
|
|
145
234
|
const iconClasses = computed(() => {
|
|
146
235
|
return (temp: CheckboxColumnsVo): string[] => {
|
|
147
|
-
let classes: string[] = []
|
|
236
|
+
let classes: string[] = []
|
|
148
237
|
// 组件的形状
|
|
149
|
-
classes.push(
|
|
238
|
+
classes.push('hy-checkbox__icon-wrap--' + shape.value)
|
|
150
239
|
if (isDisabled(temp?.disabled)) {
|
|
151
|
-
classes.push(
|
|
240
|
+
classes.push('hy-checkbox__icon-wrap--disabled')
|
|
152
241
|
}
|
|
153
242
|
if (temp[fieldNames.value.checked]) {
|
|
154
|
-
classes.push(
|
|
243
|
+
classes.push('hy-checkbox__icon-wrap--checked')
|
|
155
244
|
if (isDisabled(temp?.disabled)) {
|
|
156
|
-
classes.push(
|
|
245
|
+
classes.push('hy-checkbox__icon-wrap--disabled--checked')
|
|
157
246
|
}
|
|
158
247
|
}
|
|
159
|
-
return classes
|
|
160
|
-
}
|
|
161
|
-
})
|
|
248
|
+
return classes
|
|
249
|
+
}
|
|
250
|
+
})
|
|
162
251
|
|
|
163
252
|
/**
|
|
164
253
|
* @description 定义icon的样式
|
|
@@ -166,50 +255,50 @@ const iconClasses = computed(() => {
|
|
|
166
255
|
const iconWrapStyle = computed(() => {
|
|
167
256
|
return (temp: CheckboxColumnsVo): CSSProperties => {
|
|
168
257
|
// checkbox的整体样式
|
|
169
|
-
const style: CSSProperties = {}
|
|
258
|
+
const style: CSSProperties = {}
|
|
170
259
|
style.backgroundColor =
|
|
171
260
|
temp[fieldNames.value.checked] && !isDisabled(temp?.disabled)
|
|
172
261
|
? activeColor.value
|
|
173
262
|
: !isDisabled(temp?.disabled)
|
|
174
|
-
|
|
175
|
-
|
|
263
|
+
? '#ffffff'
|
|
264
|
+
: ''
|
|
176
265
|
style.borderColor =
|
|
177
266
|
temp[fieldNames.value.checked] && !isDisabled(temp?.disabled)
|
|
178
267
|
? activeColor.value
|
|
179
|
-
: inactiveColor.value
|
|
180
|
-
style.width = addUnit(sizeType[size.value] ?? size.value)
|
|
181
|
-
style.height = addUnit(sizeType[size.value] ?? size.value)
|
|
182
|
-
return style
|
|
183
|
-
}
|
|
184
|
-
})
|
|
268
|
+
: inactiveColor.value
|
|
269
|
+
style.width = addUnit(sizeType[size.value] ?? size.value)
|
|
270
|
+
style.height = addUnit(sizeType[size.value] ?? size.value)
|
|
271
|
+
return style
|
|
272
|
+
}
|
|
273
|
+
})
|
|
185
274
|
|
|
186
275
|
/**
|
|
187
276
|
* @description 点击图标
|
|
188
277
|
* */
|
|
189
278
|
const iconClickHandler = (e: Event, temp: CheckboxColumnsVo) => {
|
|
190
|
-
e.stopPropagation()
|
|
279
|
+
e.stopPropagation()
|
|
191
280
|
if (!isDisabled(temp?.disabled)) {
|
|
192
|
-
setRadioCheckedStatus(temp)
|
|
281
|
+
setRadioCheckedStatus(temp)
|
|
193
282
|
}
|
|
194
|
-
}
|
|
283
|
+
}
|
|
195
284
|
/**
|
|
196
285
|
* @description 点击整行
|
|
197
286
|
* */
|
|
198
287
|
const wrapperClickHandler = (e: Event, temp: CheckboxColumnsVo) => {
|
|
199
|
-
e.stopPropagation()
|
|
288
|
+
e.stopPropagation()
|
|
200
289
|
if (!isDisabled(temp?.disabled) || !labelDisabled.value) {
|
|
201
|
-
setRadioCheckedStatus(temp)
|
|
290
|
+
setRadioCheckedStatus(temp)
|
|
202
291
|
}
|
|
203
|
-
}
|
|
292
|
+
}
|
|
204
293
|
/**
|
|
205
294
|
* @description 点击label
|
|
206
295
|
* */
|
|
207
296
|
const labelClickHandler = (e: Event, temp: CheckboxColumnsVo) => {
|
|
208
|
-
e.stopPropagation()
|
|
297
|
+
e.stopPropagation()
|
|
209
298
|
if (!isDisabled(temp?.disabled) || !labelDisabled.value) {
|
|
210
|
-
setRadioCheckedStatus(temp)
|
|
299
|
+
setRadioCheckedStatus(temp)
|
|
211
300
|
}
|
|
212
|
-
}
|
|
301
|
+
}
|
|
213
302
|
|
|
214
303
|
/**
|
|
215
304
|
* @description 执行函数改变状态传给父值
|
|
@@ -218,26 +307,26 @@ const setRadioCheckedStatus = (temp: CheckboxColumnsVo) => {
|
|
|
218
307
|
// 将本组件标记为与原来相反的状态
|
|
219
308
|
columns_1.value = columns_1.value.map((item: CheckboxColumnsVo) => {
|
|
220
309
|
if (temp[fieldNames.value.value] === item[fieldNames.value.value]) {
|
|
221
|
-
item[fieldNames.value.checked] = !item[fieldNames.value.checked]
|
|
310
|
+
item[fieldNames.value.checked] = !item[fieldNames.value.checked]
|
|
222
311
|
}
|
|
223
|
-
return item
|
|
224
|
-
})
|
|
225
|
-
emit(
|
|
312
|
+
return item
|
|
313
|
+
})
|
|
314
|
+
emit('change', temp)
|
|
226
315
|
emit(
|
|
227
|
-
|
|
316
|
+
'update:modelValue',
|
|
228
317
|
columns_1.value.length === 1
|
|
229
318
|
? columns_1.value[0].checked
|
|
230
319
|
: columns_1.value
|
|
231
320
|
.filter((item: CheckboxColumnsVo) => item[fieldNames.value.checked])
|
|
232
321
|
.map((item: CheckboxColumnsVo) => item[fieldNames.value.value]),
|
|
233
|
-
)
|
|
322
|
+
)
|
|
234
323
|
// 双向绑定
|
|
235
324
|
// if (this.usedAlone) {
|
|
236
325
|
// this.$emit('update:checked', this.isChecked)
|
|
237
326
|
// }
|
|
238
|
-
}
|
|
327
|
+
}
|
|
239
328
|
</script>
|
|
240
329
|
|
|
241
330
|
<style lang="scss" scoped>
|
|
242
|
-
@import
|
|
331
|
+
@import './index.scss';
|
|
243
332
|
</style>
|
|
@@ -1,73 +1,80 @@
|
|
|
1
|
-
import type { CSSProperties } from
|
|
2
|
-
import type { CheckboxColumnsVo, IFieldNames } from
|
|
1
|
+
import type { CSSProperties } from 'vue'
|
|
2
|
+
import type { CheckboxColumnsVo, IFieldNames } from '../hy-check-button/typing'
|
|
3
3
|
|
|
4
4
|
export default interface HyCheckboxProps {
|
|
5
5
|
/**
|
|
6
6
|
* @description 双向绑定值,数组类型
|
|
7
7
|
* */
|
|
8
|
-
modelValue: (string | number)[] | boolean
|
|
8
|
+
modelValue: (string | number)[] | boolean
|
|
9
9
|
/**
|
|
10
10
|
* @description 接收数组值
|
|
11
11
|
* */
|
|
12
|
-
columns: CheckboxColumnsVo[]
|
|
12
|
+
columns: CheckboxColumnsVo[]
|
|
13
13
|
/**
|
|
14
14
|
* @description 自定义接收columns的键
|
|
15
15
|
* */
|
|
16
|
-
fieldNames?: IFieldNames
|
|
16
|
+
fieldNames?: IFieldNames
|
|
17
17
|
/**
|
|
18
18
|
* @description 形状,square为方形,circle为圆型
|
|
19
19
|
* */
|
|
20
|
-
shape?: HyApp.ShapeType
|
|
20
|
+
shape?: HyApp.ShapeType
|
|
21
21
|
/**
|
|
22
22
|
* @description 复选框大小
|
|
23
23
|
* */
|
|
24
|
-
size?: HyApp.SizeType | string | number
|
|
24
|
+
size?: HyApp.SizeType | string | number
|
|
25
25
|
/**
|
|
26
26
|
* @description 是否禁用
|
|
27
27
|
* */
|
|
28
|
-
disabled?: boolean
|
|
28
|
+
disabled?: boolean
|
|
29
29
|
/**
|
|
30
30
|
* @description 选中状态下的颜色
|
|
31
31
|
* */
|
|
32
|
-
activeColor?: string
|
|
32
|
+
activeColor?: string
|
|
33
33
|
/**
|
|
34
34
|
* @description 未选中的颜色
|
|
35
35
|
* */
|
|
36
|
-
inactiveColor?: string
|
|
36
|
+
inactiveColor?: string
|
|
37
37
|
/**
|
|
38
38
|
* @description 图标的大小,单位px
|
|
39
39
|
* */
|
|
40
|
-
iconSize?: string | number
|
|
40
|
+
iconSize?: string | number
|
|
41
41
|
/**
|
|
42
42
|
* @description 图标颜色
|
|
43
43
|
* */
|
|
44
|
-
iconColor?: string
|
|
44
|
+
iconColor?: string
|
|
45
45
|
/**
|
|
46
46
|
* @description label的字体大小,px单位
|
|
47
47
|
* */
|
|
48
|
-
labelSize?: string | number
|
|
48
|
+
labelSize?: string | number
|
|
49
49
|
/**
|
|
50
50
|
* @description label的颜色
|
|
51
51
|
* */
|
|
52
|
-
labelColor?: string
|
|
52
|
+
labelColor?: string
|
|
53
53
|
/**
|
|
54
54
|
* @description 勾选图标的对齐方式,left-左边,right-右边
|
|
55
55
|
* */
|
|
56
|
-
iconPlacement?: HyApp.LeftRightType
|
|
56
|
+
iconPlacement?: HyApp.LeftRightType
|
|
57
57
|
/**
|
|
58
58
|
* @description 竖向配列时,是否显示下划线
|
|
59
59
|
* */
|
|
60
|
-
borderBottom?: boolean
|
|
60
|
+
borderBottom?: boolean
|
|
61
61
|
/**
|
|
62
62
|
* @description 是否禁止点击提示语选中复选框
|
|
63
63
|
* */
|
|
64
|
-
labelDisabled?: boolean
|
|
64
|
+
labelDisabled?: boolean
|
|
65
65
|
/**
|
|
66
66
|
* @description 定义需要用到的外部样式
|
|
67
67
|
* */
|
|
68
|
-
customStyle?: CSSProperties
|
|
68
|
+
customStyle?: CSSProperties
|
|
69
69
|
/**
|
|
70
70
|
* @description 排列方式,row-横向,column-纵向
|
|
71
71
|
* */
|
|
72
|
-
placement?: HyApp.DirectionType
|
|
72
|
+
placement?: HyApp.DirectionType
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface ICheckBoxEmits {
|
|
76
|
+
/** 选择触发 */
|
|
77
|
+
(e: 'change', temp: CheckboxColumnsVo): void
|
|
78
|
+
/** 更新值触发 */
|
|
79
|
+
(e: 'update:modelValue', value: any): void
|
|
73
80
|
}
|
|
@@ -42,6 +42,11 @@
|
|
|
42
42
|
</template>
|
|
43
43
|
|
|
44
44
|
<script lang="ts">
|
|
45
|
+
/**
|
|
46
|
+
* 一般用于验证用户短信验证码的场景,也可以结合华玥的键盘组件使用
|
|
47
|
+
* @displayName hy-code-input
|
|
48
|
+
*/
|
|
49
|
+
defineOptions({})
|
|
45
50
|
export default {
|
|
46
51
|
name: 'hy-code-input',
|
|
47
52
|
options: {
|
|
@@ -53,12 +58,103 @@ export default {
|
|
|
53
58
|
</script>
|
|
54
59
|
|
|
55
60
|
<script setup lang="ts">
|
|
56
|
-
import {
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
import {
|
|
62
|
+
computed,
|
|
63
|
+
type CSSProperties,
|
|
64
|
+
nextTick,
|
|
65
|
+
onUnmounted,
|
|
66
|
+
PropType,
|
|
67
|
+
ref,
|
|
68
|
+
toRefs,
|
|
69
|
+
watch,
|
|
70
|
+
} from 'vue'
|
|
71
|
+
import type { ICodeInputEmits } from './typing'
|
|
59
72
|
import { addUnit, getPx } from '../../utils'
|
|
60
73
|
|
|
61
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
74
|
+
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
75
|
+
const props = defineProps({
|
|
76
|
+
/** 获取值 */
|
|
77
|
+
modelValue: {
|
|
78
|
+
type: [String, Number],
|
|
79
|
+
required: true,
|
|
80
|
+
},
|
|
81
|
+
/** 键盘弹起时,是否自动上推页面 */
|
|
82
|
+
adjustPosition: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: true,
|
|
85
|
+
},
|
|
86
|
+
/** 最大输入长度 */
|
|
87
|
+
maxlength: {
|
|
88
|
+
type: Number,
|
|
89
|
+
default: 6,
|
|
90
|
+
},
|
|
91
|
+
/** 显示border */
|
|
92
|
+
border: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: true,
|
|
95
|
+
},
|
|
96
|
+
/** 是否用圆点填充 */
|
|
97
|
+
dot: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: false,
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* 示模式,box-盒子模式,line-底部横线模式
|
|
103
|
+
* @values box,line
|
|
104
|
+
* */
|
|
105
|
+
mode: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: 'box',
|
|
108
|
+
},
|
|
109
|
+
/** 是否细边框 */
|
|
110
|
+
hairline: {
|
|
111
|
+
type: Boolean,
|
|
112
|
+
default: false,
|
|
113
|
+
},
|
|
114
|
+
/** 字符间的距离 */
|
|
115
|
+
space: {
|
|
116
|
+
type: Number,
|
|
117
|
+
default: 10,
|
|
118
|
+
},
|
|
119
|
+
/** 是否自动获取焦点 */
|
|
120
|
+
focus: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: false,
|
|
123
|
+
},
|
|
124
|
+
/** 字体是否加粗 */
|
|
125
|
+
bold: {
|
|
126
|
+
type: Boolean,
|
|
127
|
+
default: false,
|
|
128
|
+
},
|
|
129
|
+
/** 字体颜色 */
|
|
130
|
+
color: String,
|
|
131
|
+
/** 字体大小,单位px */
|
|
132
|
+
fontSize: {
|
|
133
|
+
type: [String, Number],
|
|
134
|
+
default: 18,
|
|
135
|
+
},
|
|
136
|
+
/** 输入框的大小,宽等于高 */
|
|
137
|
+
size: {
|
|
138
|
+
type: [String, Number],
|
|
139
|
+
default: 35,
|
|
140
|
+
},
|
|
141
|
+
/** 是否隐藏原生键盘,如果想用自定义键盘的话,需设置此参数为true */
|
|
142
|
+
disabledKeyboard: {
|
|
143
|
+
type: Boolean,
|
|
144
|
+
default: false,
|
|
145
|
+
},
|
|
146
|
+
/** 边框和线条颜色 */
|
|
147
|
+
borderColor: String,
|
|
148
|
+
/** 是否禁止输入"."符号 */
|
|
149
|
+
disabledDot: {
|
|
150
|
+
type: Boolean,
|
|
151
|
+
default: true,
|
|
152
|
+
},
|
|
153
|
+
/** 定义需要用到的外部样式 */
|
|
154
|
+
customStyle: {
|
|
155
|
+
type: Object as PropType<CSSProperties>,
|
|
156
|
+
},
|
|
157
|
+
})
|
|
62
158
|
const {
|
|
63
159
|
modelValue,
|
|
64
160
|
focus,
|
|
@@ -71,7 +167,7 @@ const {
|
|
|
71
167
|
space,
|
|
72
168
|
borderColor,
|
|
73
169
|
} = toRefs(props)
|
|
74
|
-
const emit = defineEmits(
|
|
170
|
+
const emit = defineEmits<ICodeInputEmits>()
|
|
75
171
|
|
|
76
172
|
const current = ref(0)
|
|
77
173
|
const inputValue = ref('')
|
|
@@ -67,3 +67,12 @@ export default interface HyCodeInputProps {
|
|
|
67
67
|
* */
|
|
68
68
|
customStyle?: CSSProperties
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
export interface ICodeInputEmits {
|
|
72
|
+
/** 输入内容发生改变时触发 */
|
|
73
|
+
(e: 'change', value: string | number): void
|
|
74
|
+
/** 输入字符个数达maxlength值时触发确认 */
|
|
75
|
+
(e: 'finish', value: string | number): void
|
|
76
|
+
/** 更新值 */
|
|
77
|
+
(e: 'update:modelValue', value: string | number): void
|
|
78
|
+
}
|