diff --git a/src/config.json b/src/config.json index 32d56561ab..73b3d2d43a 100644 --- a/src/config.json +++ b/src/config.json @@ -392,6 +392,7 @@ "name": "Input", "cName": "输入框", "desc": "输入框组件", + "setup": true, "author": "gxx158" }, { diff --git a/src/packages/__VUE/input/doc.en-US.md b/src/packages/__VUE/input/doc.en-US.md index 0a54a858d7..4a8589a759 100644 --- a/src/packages/__VUE/input/doc.en-US.md +++ b/src/packages/__VUE/input/doc.en-US.md @@ -121,6 +121,21 @@ After setting the `maxlength` and `show-word-limit` attributes, word count will | blur `4.0.6` | Blur | | select `4.0.6` | Selct | +### Types version + +The component exports the following type definitions: + +```ts +import type { + InputType, + InputAlign, + InputConfirmType, + InputFormatTrigger, + InputProps, + InputInstance +} from '@nutui/nutui' +``` + ## Theming ### CSS Variables diff --git a/src/packages/__VUE/input/doc.md b/src/packages/__VUE/input/doc.md index bb13def945..f62bce1cb0 100644 --- a/src/packages/__VUE/input/doc.md +++ b/src/packages/__VUE/input/doc.md @@ -132,6 +132,21 @@ app.use(Input) | blur `4.0.6` | 失去焦点 | | select `4.0.6` | 选择文字 | +### 类型定义 version + +组件导出以下类型定义: + +```ts +import type { + InputType, + InputAlign, + InputConfirmType, + InputFormatTrigger, + InputProps, + InputInstance +} from '@nutui/nutui' +``` + ## 主题定制 ### 样式变量 diff --git a/src/packages/__VUE/input/doc.taro.md b/src/packages/__VUE/input/doc.taro.md index 0f87e3a9cc..0dc2c233b7 100644 --- a/src/packages/__VUE/input/doc.taro.md +++ b/src/packages/__VUE/input/doc.taro.md @@ -130,6 +130,21 @@ app.use(Input) | left `4.0.1` | 自定义输入框左侧插槽内容 | | right `4.0.1` | 自定义输入框右侧插槽内容 | +### 类型定义 version + +组件导出以下类型定义: + +```ts +import type { + InputType, + InputAlign, + InputConfirmType, + InputFormatTrigger, + InputProps, + InputInstance +} from '@nutui/nutui-taro' +``` + ## 主题定制 ### 样式变量 diff --git a/src/packages/__VUE/input/index.taro.ts b/src/packages/__VUE/input/index.taro.ts new file mode 100644 index 0000000000..ba9d0e95d9 --- /dev/null +++ b/src/packages/__VUE/input/index.taro.ts @@ -0,0 +1,13 @@ +import Input from './input.taro.vue' +import type { ComponentPublicInstance } from 'vue' +import { withInstall } from '@/packages/utils' + +withInstall(Input) + +export type { InputProps } from './input.taro.vue' + +export type { InputType, InputAlign, InputConfirmType, InputFormatTrigger } from './types' + +export type InputInstance = ComponentPublicInstance & InstanceType + +export { Input, Input as default } diff --git a/src/packages/__VUE/input/index.taro.vue b/src/packages/__VUE/input/index.taro.vue deleted file mode 100644 index ebbb25045c..0000000000 --- a/src/packages/__VUE/input/index.taro.vue +++ /dev/null @@ -1,362 +0,0 @@ - - diff --git a/src/packages/__VUE/input/index.ts b/src/packages/__VUE/input/index.ts new file mode 100644 index 0000000000..9b2bb35350 --- /dev/null +++ b/src/packages/__VUE/input/index.ts @@ -0,0 +1,13 @@ +import Input from './input.vue' +import type { ComponentPublicInstance } from 'vue' +import { withInstall } from '@/packages/utils' + +withInstall(Input) + +export type { InputProps } from './input.vue' + +export type { InputType, InputAlign, InputConfirmType, InputFormatTrigger } from './types' + +export type InputInstance = ComponentPublicInstance & InstanceType + +export { Input, Input as default } diff --git a/src/packages/__VUE/input/index.vue b/src/packages/__VUE/input/index.vue deleted file mode 100644 index 01205d6f09..0000000000 --- a/src/packages/__VUE/input/index.vue +++ /dev/null @@ -1,328 +0,0 @@ - - diff --git a/src/packages/__VUE/input/input.taro.vue b/src/packages/__VUE/input/input.taro.vue new file mode 100644 index 0000000000..9dde73e88a --- /dev/null +++ b/src/packages/__VUE/input/input.taro.vue @@ -0,0 +1,295 @@ + + +./types diff --git a/src/packages/__VUE/input/input.vue b/src/packages/__VUE/input/input.vue new file mode 100644 index 0000000000..ce647b0aa3 --- /dev/null +++ b/src/packages/__VUE/input/input.vue @@ -0,0 +1,269 @@ + + +./types diff --git a/src/packages/__VUE/input/type.ts b/src/packages/__VUE/input/types.ts similarity index 84% rename from src/packages/__VUE/input/type.ts rename to src/packages/__VUE/input/types.ts index 0111dc0c1a..77129fb419 100644 --- a/src/packages/__VUE/input/type.ts +++ b/src/packages/__VUE/input/types.ts @@ -1,4 +1,4 @@ -export type InputAlignType = 'left' | 'center' | 'right' // text-align +export type InputAlign = 'left' | 'center' | 'right' // text-align export type InputFormatTrigger = 'onChange' | 'onBlur' // onChange: 在输入时执行格式化 ; onBlur: 在失焦时执行格式化 @@ -38,7 +38,7 @@ export type InputRule = { required?: boolean } -export type ConfirmTextType = 'send' | 'search' | 'next' | 'go' | 'done' +export type InputConfirmType = 'send' | 'search' | 'next' | 'go' | 'done' export interface InputTarget extends HTMLInputElement { composing?: boolean diff --git a/src/packages/__VUE/input/util.ts b/src/packages/__VUE/input/util.ts index 57befbb8d8..673b993e35 100644 --- a/src/packages/__VUE/input/util.ts +++ b/src/packages/__VUE/input/util.ts @@ -1,5 +1,5 @@ import type { HTMLAttributes, InputHTMLAttributes } from 'vue' -import type { InputType } from './type' +import type { InputType } from './types' function trimExtraChar(value: string, char: string, regExp: RegExp) { const index = value.indexOf(char) diff --git a/src/packages/__VUE/invoice/invoice.taro.vue b/src/packages/__VUE/invoice/invoice.taro.vue index e1f95879aa..32bbae3cfd 100644 --- a/src/packages/__VUE/invoice/invoice.taro.vue +++ b/src/packages/__VUE/invoice/invoice.taro.vue @@ -43,7 +43,7 @@ import NutFormItem from '../formitem/index.taro' import NutRadio from '../radio/index.taro' import NutRadioGroup from '../radiogroup/index.taro' import NutButton from '../button/index.taro' -import NutInput from '../input/index.taro.vue' +import NutInput from '../input/index.taro' import type { InvoiceDataItem } from './types' defineOptions({ diff --git a/src/packages/__VUE/invoice/invoice.vue b/src/packages/__VUE/invoice/invoice.vue index 93c574996e..2634251844 100644 --- a/src/packages/__VUE/invoice/invoice.vue +++ b/src/packages/__VUE/invoice/invoice.vue @@ -43,7 +43,7 @@ import NutFormItem from '../formitem' import NutRadio from '../radio' import NutRadioGroup from '../radiogroup' import NutButton from '../button' -import NutInput from '../input/index.vue' +import NutInput from '../input' import type { InvoiceDataItem } from './types' defineOptions({