Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Commit 7f1bd00

Browse files
committed
fix(prettier): fix prettier
Signed-off-by: Shyrro <[email protected]>
1 parent cc3ffa7 commit 7f1bd00

File tree

2 files changed

+23
-31
lines changed

2 files changed

+23
-31
lines changed

packages/vue/src/polymorphic-factory.tsx

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ export type ComponentWithAs<
2020
Component extends ElementType,
2121
P extends Record<string, unknown> = Record<never, never>,
2222
> = {
23-
new(): {
23+
new (): {
2424
$props: AllowedComponentProps &
25-
ComponentCustomProps &
26-
VNodeProps &
27-
ExtractPropTypes<Component> &
28-
(Component extends keyof IntrinsicElementAttributes
29-
? IntrinsicElementAttributes[Component]
30-
: Record<never, never>) &
31-
P & {
32-
as?: ElementType
33-
}
25+
ComponentCustomProps &
26+
VNodeProps &
27+
ExtractPropTypes<Component> &
28+
(Component extends keyof IntrinsicElementAttributes
29+
? IntrinsicElementAttributes[Component]
30+
: Record<never, never>) &
31+
P & {
32+
as?: ElementType
33+
}
3434
}
3535
}
3636

@@ -63,11 +63,7 @@ function defaultStyled(originalComponent: ElementType) {
6363
getAttributes(Component as string, props.modelValue, emit, attrs),
6464
)
6565

66-
return () => (
67-
<Component {...componentAttrs.value}>
68-
{() => slots?.default?.()}
69-
</Component>
70-
)
66+
return () => <Component {...componentAttrs.value}>{() => slots?.default?.()}</Component>
7167
},
7268
}) as ComponentWithAs<never>
7369
}

packages/vue/src/use-v-model.ts

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import { computed, ref } from 'vue'
22

33
const formElements = ['input', 'select', 'textarea', 'fieldset', 'datalist', 'option', 'optgroup']
44

5-
const handleMultipleCheckbox = <TModelValue extends Array<any>>(value: unknown, modelValue: TModelValue) => {
5+
function handleMultipleCheckbox<TModelValue extends Array<any>>(
6+
value: unknown,
7+
modelValue: TModelValue,
8+
) {
69
const currentModelValue = [...modelValue]
710
// If the value is already checked, uncheck it
811
// else, add it to the checked array.
@@ -18,9 +21,9 @@ const handleMultipleCheckbox = <TModelValue extends Array<any>>(value: unknown,
1821
* Function that emits the right events when using v-model.
1922
*/
2023
function handleInput<
21-
TEmit extends CallableFunction,
24+
TEmit extends CallableFunction,
2225
TModelValue extends Array<any>,
23-
TAttrs extends Record<string, unknown>
26+
TAttrs extends Record<string, unknown>,
2427
>(e: Event, emit: TEmit, modelValue: TModelValue, attrs: TAttrs) {
2528
emit(
2629
'update:modelValue',
@@ -41,22 +44,15 @@ function handleInput<
4144
}
4245

4346
export function getAttributes<
44-
TModelValue extends Array<any>,
45-
TEmit extends CallableFunction,
46-
TAttrs extends Record<string, unknown>>
47-
(
48-
elementTag: string,
49-
modelValue: TModelValue,
50-
emit: TEmit,
51-
attrs: TAttrs,
52-
) {
53-
47+
TModelValue extends Array<any>,
48+
TEmit extends CallableFunction,
49+
TAttrs extends Record<string, unknown>,
50+
>(elementTag: string, modelValue: TModelValue, emit: TEmit, attrs: TAttrs) {
5451
const val = ref<Record<string, unknown>>({ value: modelValue })
5552
const attributes = ref({ ...attrs })
5653

5754
// Only do this if v-model directive is provided, otherwise return user props
5855
if (formElements.includes(elementTag) && (modelValue !== null || modelValue !== undefined)) {
59-
6056
if (elementTag === 'input' && (attrs.type === 'checkbox' || attrs.type === 'radio')) {
6157
const isChecked = computed(() =>
6258
// If it's a boolean, it's probably a single checkbox or a radio button
@@ -72,9 +68,9 @@ export function getAttributes<
7268
attributes.value = {
7369
...val.value,
7470
onInput: (e: Event) => handleInput(e, emit, modelValue, attrs),
75-
...attrs
71+
...attrs,
7672
}
7773
}
78-
74+
7975
return attributes.value
8076
}

0 commit comments

Comments
 (0)