-
-
Notifications
You must be signed in to change notification settings - Fork 627
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui/types): 提供jsx,tsx支持.完成以下组件button,checkbox,checkboxGroup,col,c…
…ounter,dialog,form,icon,image,i affects: @varlet/ui
- Loading branch information
Showing
25 changed files
with
513 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,24 @@ | ||
import { VarComponent } from './varComponent' | ||
|
||
export class Button extends VarComponent {} | ||
interface ButtonProps { | ||
type?: 'default' | 'primary' | 'info' | 'success' | 'warning' | 'danger' | ||
size?: 'normal' | 'mini' | 'small' | 'large' | ||
loading?: boolean | ||
round?: boolean | ||
block?: boolean | ||
text?: boolean | ||
outline?: boolean | ||
disabled?: boolean | ||
ripple?: boolean | ||
color?: string | ||
textColor?: string | ||
loadingRadius?: string | number | ||
loadingType?: 'circle' | 'wave' | 'cube' | 'rect' | 'disappear' | ||
loadingSize?: 'normal' | 'mini' | 'small' | 'large' | ||
onClick?: (e: Event) => void | ||
onTouchstart?: (e: Event) => void | ||
} | ||
|
||
export class Button extends VarComponent { | ||
$props: ButtonProps | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
import { VarComponent } from './varComponent' | ||
|
||
export class Checkbox extends VarComponent {} | ||
type ValidateTriggers = 'onChange' | ||
|
||
interface CheckboxProps { | ||
modelValue?: any | ||
checkedValue?: any | ||
uncheckedValue?: any | ||
checkedColor?: string | ||
uncheckedColor?: string | ||
disabled?: boolean | ||
readonly?: boolean | ||
iconSize?: string | number | ||
ripple?: boolean | ||
validateTrigger?: Array<ValidateTriggers> | ||
rules?: Array<(value: any) => any> | ||
onClick?: (e: Event) => void | ||
onChange?: (value: any) => void | ||
'onUpdate:modelValue'?: (value: any) => void | ||
} | ||
|
||
export class Checkbox extends VarComponent { | ||
$props: CheckboxProps | ||
|
||
validate(): Promise<boolean> | ||
|
||
resetValidation(): void | ||
|
||
reset(): void | ||
|
||
toggle(value: any): void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,27 @@ | ||
import { VarComponent } from './varComponent' | ||
|
||
export class CheckboxGroup extends VarComponent {} | ||
export type ValidateTriggers = 'onChange' | ||
|
||
interface CheckboxGroupProps { | ||
modelValue?: any[] | ||
max?: string | number | ||
direction?: 'horizontal' | 'vertical' | ||
validateTrigger?: Array<ValidateTriggers> | ||
rules?: Array<(value: any) => any> | ||
onChange?: (value: Array<any>) => void | ||
'onUpdate:modelValue'?: (value: Array<any>) => void | ||
} | ||
|
||
export class CheckboxGroup extends VarComponent { | ||
$props: CheckboxGroupProps | ||
|
||
validate(): Promise<boolean> | ||
|
||
resetValidation(): void | ||
|
||
reset(): void | ||
|
||
checkAll(): any | ||
|
||
inverseAll(): any | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
import { VarComponent } from './varComponent'; | ||
import { VarComponent } from './varComponent' | ||
|
||
export class Col extends VarComponent {} | ||
interface ColProps { | ||
span?: string | number | ||
offset?: string | number | ||
onClick?: (e: Event) => void | ||
} | ||
|
||
export class Col extends VarComponent { | ||
$props: ColProps | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,42 @@ | ||
import { VarComponent } from './varComponent' | ||
|
||
export class Counter extends VarComponent {} | ||
export type ValidateTriggers = 'onIncrement' | 'onDecrement' | 'onInputChange' | 'onLazyChange' | ||
|
||
interface CounterProps { | ||
modelValue?: string | number | ||
min?: string | number | ||
max?: string | number | ||
step?: string | number | ||
color?: string | ||
inputWidth?: string | number | ||
inputTextSize?: string | number | ||
buttonSize?: string | number | ||
decimalLength?: string | number | ||
disabled?: boolean | ||
readonly?: boolean | ||
disableIncrement?: boolean | ||
disableDecrement?: boolean | ||
disableInput?: boolean | ||
lazyChange?: boolean | ||
incrementButton?: boolean | ||
decrementButton?: boolean | ||
press?: boolean | ||
ripple?: boolean | ||
validateTrigger?: Array<ValidateTriggers> | ||
rules?: Array<(v: number) => any> | ||
onBeforeChange?: (value: number, change: (value: string | number) => void) => void | ||
onChange?: (value: number) => void | ||
onIncrement?: (value: number) => void | ||
onDecrement?: (value: number) => void | ||
'onUpdate:modelValue'?: (value: number) => void | ||
} | ||
|
||
export class Counter extends VarComponent { | ||
$props: CounterProps | ||
|
||
validate(): Promise<boolean> | ||
|
||
resetValidation(): void | ||
|
||
reset(): void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
import { VarComponent } from './varComponent' | ||
|
||
export class Form extends VarComponent {} | ||
interface FormProps { | ||
disabled?: boolean | ||
readonly?: boolean | ||
} | ||
|
||
export class Form extends VarComponent { | ||
$props: FormProps | ||
|
||
validate(): Promise<boolean> | ||
|
||
resetValidation(): void | ||
|
||
reset(): void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
import { VarComponent } from './varComponent' | ||
|
||
export class Icon extends VarComponent {} | ||
interface IconProps { | ||
name?: string | ||
size?: string | number | ||
color?: string | ||
namespace?: string | ||
transition?: string | number | ||
onClick?: () => (event: Event) => void | ||
} | ||
|
||
export class Icon extends VarComponent { | ||
$props: IconProps | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
import { VarComponent } from './varComponent'; | ||
import { VarComponent } from './varComponent' | ||
|
||
interface ImageProps { | ||
src?: string | ||
fit?: 'fill' | 'contain' | 'cover' | 'none' | 'scale-down' | ||
alt?: string | ||
width?: string | number | ||
height?: string | number | ||
radius?: string | number | ||
loading?: string | ||
error?: string | ||
lazy?: boolean | ||
ripple?: boolean | ||
block?: boolean | ||
onClick?: (e: Event) => void | ||
onLoad?: (e: Event) => void | ||
onError?: (e: Event) => void | ||
} | ||
|
||
export class Image extends VarComponent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,43 @@ | ||
import { VarComponent } from './varComponent' | ||
|
||
export class Input extends VarComponent {} | ||
type ValidateTriggers = 'onFocus' | 'onBlur' | 'onChange' | 'onClick' | 'onClear' | 'onInput' | ||
|
||
interface InputProps { | ||
modelValue?: string | number | ||
type?: 'text' | 'password' | ||
textarea?: boolean | ||
rows?: string | number | ||
placeholder?: string | ||
hint?: boolean | ||
textColor?: string | ||
focusColor?: string | ||
blurColor?: string | ||
maxlength?: string | number | ||
disabled?: boolean | ||
readonly?: boolean | ||
clearable?: boolean | ||
resize?: boolean | ||
validateTrigger?: ValidateTriggers[] | ||
rules?: Array<(v: string | number) => any> | ||
onFocus?: (e: Event) => void | ||
onBlur?: (e: Event) => void | ||
onClick?: (e: Event) => void | ||
onClear?: (value: string | number) => void | ||
onInput?: (value: string | number, e: Event) => void | ||
onChange?: (value: string | number, e: Event) => void | ||
'onUpdate:modelValue': (value: string | number) => void | ||
} | ||
|
||
export class Input extends VarComponent { | ||
$props: InputProps | ||
|
||
focus(): void | ||
|
||
blur(): void | ||
|
||
validate(): Promise<boolean> | ||
|
||
resetValidation(): void | ||
|
||
reset(): void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
import { VarComponent } from './varComponent'; | ||
import { VarComponent } from './varComponent' | ||
|
||
export class Menu extends VarComponent {} | ||
interface MenuProps { | ||
show?: boolean | ||
alignment?: 'top' | 'bottom' | ||
offsetX?: string | number | ||
offsetY?: string | number | ||
onOpen?: () => void | ||
onOpened?: () => void | ||
onClose?: () => void | ||
onClosed?: () => void | ||
'onUpdate:show': (show: boolean) => void | ||
} | ||
|
||
export class Menu extends VarComponent { | ||
$props: MenuProps | ||
|
||
resize(): void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
import { VarComponent } from './varComponent' | ||
|
||
export class Option extends VarComponent {} | ||
interface OptionProps { | ||
label?: any | ||
value?: any | ||
} | ||
|
||
export class Option extends VarComponent { | ||
$props: OptionProps | ||
} |
Oops, something went wrong.