hy-app 0.3.1 → 0.3.2
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/README.md +6 -3
- package/common/shakeService.ts +31 -29
- package/components/avatar.zip +0 -0
- package/components/hy-action-sheet/hy-action-sheet.vue +71 -46
- package/components/hy-address-picker/hy-address-picker.vue +94 -83
- package/components/hy-avatar/hy-avatar.vue +84 -85
- package/components/hy-badge/hy-badge.vue +47 -46
- package/components/hy-button/hy-button.vue +117 -93
- package/components/hy-calendar/hy-calendar.vue +168 -160
- package/components/hy-card/hy-card.vue +50 -43
- package/components/hy-card/typing.d.ts +33 -32
- package/components/hy-cell/hy-cell.vue +73 -51
- package/components/hy-check-button/hy-check-button.vue +54 -47
- package/components/hy-checkbox/hy-checkbox.vue +97 -105
- package/components/hy-code-input/hy-code-input.vue +80 -89
- package/components/hy-config-provider/hy-config-provider.vue +19 -20
- package/components/hy-count-down/hy-count-down.vue +66 -67
- package/components/hy-count-to/hy-count-to.vue +105 -99
- package/components/hy-count-to/typing.d.ts +13 -12
- package/components/hy-datetime-picker/hy-datetime-picker.vue +261 -253
- package/components/hy-datetime-picker/typing.d.ts +42 -40
- package/components/hy-divider/hy-divider.vue +68 -73
- package/components/hy-dropdown/hy-dropdown.vue +20 -19
- package/components/hy-dropdown-item/hy-dropdown-item.vue +66 -61
- package/components/hy-dropdown-item/typing.d.ts +9 -9
- package/components/hy-empty/hy-empty.vue +42 -42
- package/components/hy-flex/hy-flex.vue +52 -26
- package/components/hy-float-button/hy-float-button.vue +218 -210
- package/components/hy-folding-panel/hy-folding-panel.vue +32 -33
- package/components/hy-form/hy-form.vue +264 -259
- package/components/hy-grid/hy-grid.vue +44 -43
- package/components/hy-icon/hy-icon.vue +61 -67
- package/components/hy-image/hy-image.vue +112 -88
- package/components/hy-image/typing.d.ts +27 -23
- package/components/hy-input/hy-input.vue +157 -127
- package/components/hy-input/typing.d.ts +53 -47
- package/components/hy-line/hy-line.vue +26 -26
- package/components/hy-line-progress/hy-line-progress.vue +42 -35
- package/components/hy-list/hy-list.vue +76 -85
- package/components/hy-loading/hy-loading.vue +26 -23
- package/components/hy-menu/hy-menu.vue +48 -43
- package/components/hy-menu/typing.d.ts +18 -17
- package/components/hy-modal/hy-modal.vue +39 -35
- package/components/hy-navbar/hy-navbar.vue +25 -25
- package/components/hy-navbar/typing.d.ts +24 -22
- package/components/hy-notice-bar/hy-notice-bar.vue +26 -27
- package/components/hy-notify/hy-notify.vue +53 -53
- package/components/hy-number-step/hy-number-step.vue +134 -146
- package/components/hy-number-step/typing.d.ts +35 -35
- package/components/hy-overlay/hy-overlay.vue +23 -21
- package/components/hy-pagination/hy-pagination.vue +41 -36
- package/components/hy-picker/hy-picker.vue +184 -154
- package/components/hy-picker/typing.d.ts +39 -39
- package/components/hy-popover/hy-popover.vue +97 -77
- package/components/hy-popup/hy-popup.vue +107 -98
- package/components/hy-price/hy-price.vue +38 -34
- package/components/hy-qrcode/hy-qrcode.vue +50 -51
- package/components/hy-radio/hy-radio.vue +101 -113
- package/components/hy-rate/hy-rate.vue +107 -88
- package/components/hy-read-more/hy-read-more.vue +64 -49
- package/components/hy-scroll-list/hy-scroll-list.vue +45 -48
- package/components/hy-search/hy-search.vue +73 -66
- package/components/hy-search/typing.d.ts +36 -35
- package/components/hy-signature/hy-signature.vue +282 -240
- package/components/hy-slider/hy-slider.vue +195 -153
- package/components/hy-slider/typing.d.ts +21 -21
- package/components/hy-steps/hy-steps.vue +118 -90
- package/components/hy-steps/index.scss +31 -21
- package/components/hy-submit-bar/hy-submit-bar.vue +61 -70
- package/components/hy-subsection/hy-subsection.vue +99 -102
- package/components/hy-subsection/typing.d.ts +19 -19
- package/components/hy-swipe-action/hy-swipe-action.vue +131 -118
- package/components/hy-swiper/hy-swiper.vue +85 -71
- package/components/hy-switch/hy-switch.vue +67 -72
- package/components/hy-switch/typing.d.ts +21 -19
- package/components/hy-tabs/hy-tabs.vue +168 -113
- package/components/hy-tag/hy-tag.vue +90 -86
- package/components/hy-tag/typing.d.ts +26 -21
- package/components/hy-text/hy-text.vue +119 -111
- package/components/hy-textarea/hy-textarea.vue +100 -93
- package/components/hy-textarea/typing.d.ts +36 -31
- package/components/hy-toast/hy-toast.vue +77 -67
- package/components/hy-tooltip/hy-tooltip.vue +109 -91
- package/components/hy-transition/hy-transition.vue +62 -66
- package/components/hy-upload/hy-upload.vue +294 -152
- package/components/hy-upload/typing.d.ts +41 -36
- package/components/hy-warn/hy-warn.vue +34 -27
- package/components/hy-waterfall/hy-waterfall.vue +83 -74
- package/components/hy-watermark/hy-watermark.vue +134 -115
- package/composables/usePopover.ts +236 -221
- package/composables/useQueue.ts +53 -52
- package/package.json +2 -2
- package/store/index.ts +9 -1
- package/typing/index.ts +0 -1
- package/typing/modules/common.d.ts +0 -2
- package/web-types.json +1 -1
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
:class="iconClasses(item)"
|
|
17
17
|
:style="iconWrapStyle(item)"
|
|
18
18
|
>
|
|
19
|
-
<slot
|
|
19
|
+
<slot
|
|
20
|
+
name="icon"
|
|
21
|
+
:iconColor="iconColor"
|
|
22
|
+
:iconSize="addUnit(sizeType[size] ?? iconSize)"
|
|
23
|
+
>
|
|
20
24
|
<HyIcon
|
|
21
25
|
class="hy-radio__icon-wrap__icon"
|
|
22
26
|
:name="IconConfig.CHECK_MASK"
|
|
@@ -31,7 +35,10 @@
|
|
|
31
35
|
>
|
|
32
36
|
<slot name="label" :record="item">
|
|
33
37
|
<text
|
|
34
|
-
:class="[
|
|
38
|
+
:class="[
|
|
39
|
+
'hy-radio__text',
|
|
40
|
+
disabled && 'hy-radio__label-wrap--disabled',
|
|
41
|
+
]"
|
|
35
42
|
:style="{
|
|
36
43
|
color: labelColor,
|
|
37
44
|
fontSize: addUnit(sizeType[size] ?? labelSize),
|
|
@@ -48,30 +55,30 @@
|
|
|
48
55
|
|
|
49
56
|
<script lang="ts">
|
|
50
57
|
export default {
|
|
51
|
-
name:
|
|
58
|
+
name: "hy-radio",
|
|
52
59
|
options: {
|
|
53
60
|
addGlobalClass: true,
|
|
54
61
|
virtualHost: true,
|
|
55
|
-
styleIsolation:
|
|
62
|
+
styleIsolation: "shared",
|
|
56
63
|
},
|
|
57
|
-
}
|
|
64
|
+
};
|
|
58
65
|
</script>
|
|
59
66
|
|
|
60
67
|
<script setup lang="ts">
|
|
61
|
-
import { computed, reactive, ref,
|
|
62
|
-
import type { CSSProperties, PropType } from
|
|
63
|
-
import type { IRadioEmits } from
|
|
64
|
-
import type { CheckboxColumnsVo, IFieldNames } from
|
|
65
|
-
import { addUnit, bem, error } from
|
|
66
|
-
import { IconConfig } from
|
|
68
|
+
import { computed, reactive, ref, watch } from "vue";
|
|
69
|
+
import type { CSSProperties, PropType } from "vue";
|
|
70
|
+
import type { IRadioEmits } from "./typing";
|
|
71
|
+
import type { CheckboxColumnsVo, IFieldNames } from "../hy-check-button/typing";
|
|
72
|
+
import { addUnit, bem, error } from "../../utils";
|
|
73
|
+
import { IconConfig } from "../../config";
|
|
67
74
|
// 组件
|
|
68
|
-
import HyIcon from
|
|
75
|
+
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
69
76
|
|
|
70
77
|
/**
|
|
71
78
|
* 复选框组件一般用于需要多个选择的场景,该组件功能完整,使用方便
|
|
72
79
|
* @displayName hy-radio
|
|
73
80
|
*/
|
|
74
|
-
defineOptions({})
|
|
81
|
+
defineOptions({});
|
|
75
82
|
|
|
76
83
|
// const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
77
84
|
const props = defineProps({
|
|
@@ -90,9 +97,9 @@ const props = defineProps({
|
|
|
90
97
|
fieldNames: {
|
|
91
98
|
type: Object as unknown as PropType<IFieldNames>,
|
|
92
99
|
default: {
|
|
93
|
-
label:
|
|
94
|
-
value:
|
|
95
|
-
checked:
|
|
100
|
+
label: "label",
|
|
101
|
+
value: "value",
|
|
102
|
+
checked: "checked",
|
|
96
103
|
},
|
|
97
104
|
},
|
|
98
105
|
/**
|
|
@@ -101,7 +108,7 @@ const props = defineProps({
|
|
|
101
108
|
* */
|
|
102
109
|
size: {
|
|
103
110
|
type: String,
|
|
104
|
-
default:
|
|
111
|
+
default: "medium",
|
|
105
112
|
},
|
|
106
113
|
/**
|
|
107
114
|
* 标签的形状
|
|
@@ -109,7 +116,7 @@ const props = defineProps({
|
|
|
109
116
|
* */
|
|
110
117
|
shape: {
|
|
111
118
|
type: String,
|
|
112
|
-
default:
|
|
119
|
+
default: "square",
|
|
113
120
|
},
|
|
114
121
|
/** 是否禁用 */
|
|
115
122
|
disabled: {
|
|
@@ -121,12 +128,12 @@ const props = defineProps({
|
|
|
121
128
|
/** 未选中的颜色 */
|
|
122
129
|
inactiveColor: {
|
|
123
130
|
type: String,
|
|
124
|
-
default:
|
|
131
|
+
default: "#c8c9cc",
|
|
125
132
|
},
|
|
126
133
|
/** 图标的大小,单位px */
|
|
127
134
|
iconSize: {
|
|
128
135
|
type: [String, Number],
|
|
129
|
-
default:
|
|
136
|
+
default: "20",
|
|
130
137
|
},
|
|
131
138
|
/** 图标颜色 */
|
|
132
139
|
iconColor: String,
|
|
@@ -136,7 +143,7 @@ const props = defineProps({
|
|
|
136
143
|
* */
|
|
137
144
|
iconPlacement: {
|
|
138
145
|
type: String,
|
|
139
|
-
default:
|
|
146
|
+
default: "left",
|
|
140
147
|
},
|
|
141
148
|
/** 竖向配列时,是否显示下划线 */
|
|
142
149
|
borderBottom: {
|
|
@@ -158,106 +165,94 @@ const props = defineProps({
|
|
|
158
165
|
* */
|
|
159
166
|
placement: {
|
|
160
167
|
type: String,
|
|
161
|
-
default:
|
|
168
|
+
default: "row",
|
|
162
169
|
},
|
|
163
170
|
/** 定义需要用到的外部样式 */
|
|
164
171
|
customStyle: {
|
|
165
172
|
type: Object as PropType<CSSProperties>,
|
|
173
|
+
default: () => {},
|
|
166
174
|
},
|
|
167
|
-
})
|
|
168
|
-
const
|
|
169
|
-
modelValue,
|
|
170
|
-
columns,
|
|
171
|
-
fieldNames,
|
|
172
|
-
disabled,
|
|
173
|
-
shape,
|
|
174
|
-
size,
|
|
175
|
-
activeColor,
|
|
176
|
-
inactiveColor,
|
|
177
|
-
customStyle,
|
|
178
|
-
borderBottom,
|
|
179
|
-
placement,
|
|
180
|
-
iconColor,
|
|
181
|
-
labelDisabled,
|
|
182
|
-
} = toRefs(props)
|
|
183
|
-
const emit = defineEmits<IRadioEmits>()
|
|
175
|
+
});
|
|
176
|
+
const emit = defineEmits<IRadioEmits>();
|
|
184
177
|
|
|
185
|
-
const columns_1 = ref()
|
|
178
|
+
const columns_1 = ref<CheckboxColumnsVo[]>();
|
|
186
179
|
const sizeType: AnyObject = reactive({
|
|
187
180
|
small: 14,
|
|
188
181
|
medium: 18,
|
|
189
182
|
large: 22,
|
|
190
|
-
})
|
|
183
|
+
});
|
|
191
184
|
|
|
192
185
|
watch(
|
|
193
|
-
() => modelValue
|
|
186
|
+
() => props.modelValue,
|
|
194
187
|
(newValue) => {
|
|
195
|
-
columns_1.value = columns.
|
|
196
|
-
item[fieldNames.
|
|
197
|
-
|
|
198
|
-
|
|
188
|
+
columns_1.value = props.columns.map((item: any) => {
|
|
189
|
+
item[props.fieldNames.checked] =
|
|
190
|
+
newValue === item[props.fieldNames.value];
|
|
191
|
+
return item;
|
|
192
|
+
});
|
|
199
193
|
},
|
|
200
194
|
{ immediate: true },
|
|
201
|
-
)
|
|
195
|
+
);
|
|
202
196
|
|
|
203
|
-
const isDisabled = (disabledVal?: boolean): boolean =>
|
|
197
|
+
const isDisabled = (disabledVal?: boolean): boolean =>
|
|
198
|
+
props.disabled || !!disabledVal;
|
|
204
199
|
|
|
205
200
|
/**
|
|
206
201
|
* @description icon颜色
|
|
207
202
|
* */
|
|
208
203
|
const iconColorCom = computed(() => {
|
|
209
204
|
return (check: boolean) => {
|
|
210
|
-
if (disabled
|
|
205
|
+
if (props.disabled) {
|
|
211
206
|
if (check) {
|
|
212
|
-
return
|
|
207
|
+
return "#c8c9cc";
|
|
213
208
|
} else {
|
|
214
|
-
return
|
|
209
|
+
return "#F5F5F5";
|
|
215
210
|
}
|
|
216
211
|
} else {
|
|
217
|
-
return iconColor
|
|
212
|
+
return props.iconColor || "#ffffff";
|
|
218
213
|
}
|
|
219
|
-
}
|
|
220
|
-
})
|
|
214
|
+
};
|
|
215
|
+
});
|
|
221
216
|
/**
|
|
222
217
|
* @description 单选框样式
|
|
223
218
|
* */
|
|
224
219
|
const radioStyle = computed(() => {
|
|
225
|
-
const style: CSSProperties = {}
|
|
226
|
-
if (borderBottom
|
|
220
|
+
const style: CSSProperties = {};
|
|
221
|
+
if (props.borderBottom && props.placement === "row") {
|
|
227
222
|
error(
|
|
228
|
-
|
|
229
|
-
)
|
|
223
|
+
"检测到您将borderBottom设置为true,需要同时将u-checkbox-group的placement设置为column才有效",
|
|
224
|
+
);
|
|
230
225
|
}
|
|
231
226
|
// 当父组件设置了显示下边框并且排列形式为纵向时,给内容和边框之间加上一定间隔
|
|
232
|
-
if (borderBottom
|
|
233
|
-
style.paddingBottom =
|
|
227
|
+
if (props.borderBottom && props.placement === "column") {
|
|
228
|
+
style.paddingBottom = "8px";
|
|
234
229
|
}
|
|
235
|
-
return Object.assign(style, customStyle
|
|
236
|
-
})
|
|
230
|
+
return Object.assign(style, props.customStyle);
|
|
231
|
+
});
|
|
237
232
|
const bemClass = computed(() => {
|
|
238
|
-
return bem(
|
|
239
|
-
})
|
|
233
|
+
return bem("radio-group", props, ["placement"]);
|
|
234
|
+
});
|
|
240
235
|
|
|
241
236
|
/**
|
|
242
237
|
* @description 定义icon的Class类名
|
|
243
238
|
* */
|
|
244
239
|
const iconClasses = computed(() => {
|
|
245
240
|
return (temp: CheckboxColumnsVo): string[] => {
|
|
246
|
-
let classes: string[] = []
|
|
241
|
+
let classes: string[] = [];
|
|
247
242
|
// 组件的形状
|
|
248
|
-
classes.push(
|
|
243
|
+
classes.push("hy-radio__icon-wrap--" + props.shape);
|
|
249
244
|
if (isDisabled(temp?.disabled)) {
|
|
250
|
-
classes.push(
|
|
245
|
+
classes.push("hy-radio__icon-wrap--disabled");
|
|
251
246
|
}
|
|
252
|
-
if (temp[fieldNames.
|
|
253
|
-
classes.push(
|
|
247
|
+
if (temp[props.fieldNames.checked]) {
|
|
248
|
+
classes.push("hy-radio__icon-wrap--checked");
|
|
254
249
|
if (isDisabled(temp?.disabled)) {
|
|
255
|
-
classes.push(
|
|
250
|
+
classes.push("hy-radio__icon-wrap--disabled--checked");
|
|
256
251
|
}
|
|
257
252
|
}
|
|
258
|
-
return classes
|
|
259
|
-
}
|
|
260
|
-
})
|
|
253
|
+
return classes;
|
|
254
|
+
};
|
|
255
|
+
});
|
|
261
256
|
|
|
262
257
|
/**
|
|
263
258
|
* @description 定义icon的样式
|
|
@@ -265,71 +260,64 @@ const iconClasses = computed(() => {
|
|
|
265
260
|
const iconWrapStyle = computed(() => {
|
|
266
261
|
return (temp: CheckboxColumnsVo): CSSProperties => {
|
|
267
262
|
// checkbox的整体样式
|
|
268
|
-
const style: CSSProperties = {}
|
|
263
|
+
const style: CSSProperties = {};
|
|
269
264
|
style.backgroundColor =
|
|
270
|
-
temp[fieldNames.
|
|
271
|
-
? activeColor
|
|
265
|
+
temp[props.fieldNames.checked] && !isDisabled(temp?.disabled)
|
|
266
|
+
? props.activeColor
|
|
272
267
|
: !isDisabled(temp?.disabled)
|
|
273
|
-
?
|
|
274
|
-
:
|
|
268
|
+
? "#ffffff"
|
|
269
|
+
: "";
|
|
275
270
|
style.borderColor =
|
|
276
|
-
temp[fieldNames.
|
|
277
|
-
? activeColor
|
|
278
|
-
: inactiveColor
|
|
279
|
-
style.width = addUnit(sizeType[size
|
|
280
|
-
style.height = addUnit(sizeType[size
|
|
281
|
-
return style
|
|
282
|
-
}
|
|
283
|
-
})
|
|
271
|
+
temp[props.fieldNames.checked] && !isDisabled(temp?.disabled)
|
|
272
|
+
? props.activeColor
|
|
273
|
+
: props.inactiveColor;
|
|
274
|
+
style.width = addUnit(sizeType[props.size] ?? props.size);
|
|
275
|
+
style.height = addUnit(sizeType[props.size] ?? props.size);
|
|
276
|
+
return style;
|
|
277
|
+
};
|
|
278
|
+
});
|
|
284
279
|
|
|
285
280
|
/**
|
|
286
281
|
* @description 点击图标
|
|
287
282
|
* */
|
|
288
283
|
const iconClickHandler = (e: Event, temp: CheckboxColumnsVo) => {
|
|
289
|
-
e.stopPropagation()
|
|
284
|
+
e.stopPropagation();
|
|
290
285
|
if (!isDisabled(temp?.disabled)) {
|
|
291
|
-
setRadioCheckedStatus(temp)
|
|
286
|
+
setRadioCheckedStatus(temp);
|
|
292
287
|
}
|
|
293
|
-
}
|
|
288
|
+
};
|
|
294
289
|
/**
|
|
295
290
|
* @description 点击整体
|
|
296
291
|
* */
|
|
297
292
|
const wrapperClickHandler = (e: Event, temp: CheckboxColumnsVo) => {
|
|
298
|
-
e.stopPropagation()
|
|
299
|
-
if (labelDisabled
|
|
300
|
-
setRadioCheckedStatus(temp)
|
|
301
|
-
}
|
|
293
|
+
e.stopPropagation();
|
|
294
|
+
if (props.labelDisabled || isDisabled(temp?.disabled)) return;
|
|
295
|
+
setRadioCheckedStatus(temp);
|
|
296
|
+
};
|
|
302
297
|
/**
|
|
303
298
|
* @description 点击label
|
|
304
299
|
* */
|
|
305
300
|
const labelClickHandler = (e: Event, temp: CheckboxColumnsVo) => {
|
|
306
|
-
e.stopPropagation()
|
|
307
|
-
if (labelDisabled
|
|
308
|
-
setRadioCheckedStatus(temp)
|
|
309
|
-
}
|
|
301
|
+
e.stopPropagation();
|
|
302
|
+
if (props.labelDisabled || isDisabled(temp?.disabled)) return;
|
|
303
|
+
setRadioCheckedStatus(temp);
|
|
304
|
+
};
|
|
310
305
|
|
|
311
306
|
/**
|
|
312
307
|
* @description 执行函数改变状态传给父值
|
|
313
308
|
* */
|
|
314
309
|
const setRadioCheckedStatus = (temp: CheckboxColumnsVo) => {
|
|
315
310
|
// 将本组件标记为与原来相反的状态
|
|
316
|
-
columns_1.value = columns_1.value
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
emit('change', temp)
|
|
325
|
-
emit('update:modelValue', temp[fieldNames.value.value])
|
|
326
|
-
// 双向绑定
|
|
327
|
-
// if (this.usedAlone) {
|
|
328
|
-
// this.$emit('update:checked', this.isChecked)
|
|
329
|
-
// }
|
|
330
|
-
}
|
|
311
|
+
columns_1.value = columns_1.value?.map((item) => {
|
|
312
|
+
item[props.fieldNames.checked] =
|
|
313
|
+
temp[props.fieldNames.value] === item[props.fieldNames.value];
|
|
314
|
+
return item;
|
|
315
|
+
});
|
|
316
|
+
emit("change", temp);
|
|
317
|
+
emit("update:modelValue", temp[props.fieldNames.value]);
|
|
318
|
+
};
|
|
331
319
|
</script>
|
|
332
320
|
|
|
333
321
|
<style lang="scss" scoped>
|
|
334
|
-
@import
|
|
322
|
+
@import "./index.scss";
|
|
335
323
|
</style>
|