dufu1991 2 سال پیش
والد
کامیت
30700c539c

+ 32 - 32
doc/components/input/api.md

@@ -1,37 +1,37 @@
 ## Input Props
 
-| 属性              | 类型               | 默认值  | 可选值                                                                             | 必传 | 说明                            |
-| ----------------- | ------------------ | ------- | ---------------------------------------------------------------------------------- | ---- | ------------------------------- |
-| title             | String/slot        | ''      | -                                                                                  | N    | 标题内容。                      |
-| placeholder       | String             | ''      | -                                                                                  | N    | 输入框提示文本。                |
-| titlePosition     | String             | 'out'   | 'out'/'in'/'none'                                                                  | N    | 标题位置。                      |
-| inputPosition     | String             | 'left'  | 'left'/'right'                                                                     | N    | 输入框文字位置。                |
-| radius            | String             | 'base'  | 'none'/'base'/'xl'/'full'                                                          | N    | 圆角风格。                      |
-| inputStyle        | String             | 'block' | 'block'/'line'                                                                     | N    | 输入框风格。                    |
-| py                | String             | '2'     | '0'/'0.5'/'1'/'2'/'3'/'4'/'6'                                                      | N    | 垂直间距。                      |
-| lineTransition    | String             | 'none'  | 'none'/'center'/'left'                                                             | N    | 线性过渡位置。                  |
-| duration          | String             | 'base'  | 'fast'/'base'/'slow'/'slower'                                                      | N    | 过渡时间。                      |
-| value             | String             | ''      | -                                                                                  | N    | 输入框值。                      |
-| type              | String             | 'text'  | 'text'/'decimal'/'email'/'none'/'numeric'/'search'/'tel'/'url'/'password'/'number' | N    | 输入框类型。                    |
-| inputmode         | String             | ''      | 'text'/'decimal'/'email'/'none'/'numeric'/'search'/'tel'/'url'                     | N    | 指定输入的数据类型。            |
-| state             | String             | 'theme' | 'theme'/'success'/'warning'/'error'/'info'                                         | N    | 状态。                          |
-| maxlength         | Number             | 24      | -                                                                                  | N    | 最多可输入文本长度。            |
-| rows              | Number             | 2       | -                                                                                  | N    | textarea 时行数。               |
-| autosize          | Boolean            | false   | true/false                                                                         | N    | textarea 时是否自动调整高度。   |
-| textareaMaxlength | Number             | 200     | -                                                                                  | N    | textarea 时最多可输入文本长度。 |
-| clear             | Boolean            | false   | true/false                                                                         | N    | 是否可清空。                    |
-| autocomplete      | Boolean            | true    | true/false                                                                         | N    | 是否开启自动填充功能。          |
-| disabled          | Boolean            | false   | true/false                                                                         | N    | 是否禁用。                      |
-| label1            | String/Object/slot | ''      | ''/Icon Props/slot                                                                 | N    | 标签 1 内容。                   |
-| label2            | String/slot        | ''      | ''/Any String/slot                                                                 | N    | 标签 2 内容。                   |
-| label3            | String/Object/slot | ''      | ''/Icon Props/slot                                                                 | N    | 标签 3 内容。                   |
-| label4            | String/Object/slot | ''      | ''/Icon Props/slot                                                                 | N    | 标签 4 内容。                   |
-| label5            | String/slot        | ''      | ''/Any String/slot                                                                 | N    | 标签 5 内容。                   |
-| label6            | String/Object/slot | ''      | ''/Icon Props/slot                                                                 | N    | 标签 6 内容。                   |
-| tip               | String/slot        | ''      | ''/Any String/slot                                                                 | N    | 提示信息内容。                  |
-| data1             | String/slot        | ''      | ''/Any String/slot                                                                 | N    | 数据项 1 内容。                 |
-| data2             | String/slot        | ''      | ''/Any String/slot                                                                 | N    | 数据项 2 内容。                 |
-| data3             | String/slot        | ''      | ''/Any String/slot                                                                 | N    | 数据项 3 内容。                 |
+| 属性              | 类型               | 默认值  | 可选值                                                                                        | 必传 | 说明                            |
+| ----------------- | ------------------ | ------- | --------------------------------------------------------------------------------------------- | ---- | ------------------------------- |
+| title             | String/slot        | ''      | -                                                                                             | N    | 标题内容。                      |
+| placeholder       | String             | ''      | -                                                                                             | N    | 输入框提示文本。                |
+| titlePosition     | String             | 'out'   | 'out'/'in'/'none'                                                                             | N    | 标题位置。                      |
+| inputPosition     | String             | 'left'  | 'left'/'right'                                                                                | N    | 输入框文字位置。                |
+| radius            | String             | 'base'  | 'none'/'base'/'xl'/'full'                                                                     | N    | 圆角风格。                      |
+| inputStyle        | String             | 'block' | 'block'/'line'                                                                                | N    | 输入框风格。                    |
+| py                | String             | '2'     | '0'/'0.5'/'1'/'2'/'3'/'4'/'6'                                                                 | N    | 垂直间距。                      |
+| lineTransition    | String             | 'none'  | 'none'/'center'/'left'                                                                        | N    | 线性过渡位置。                  |
+| duration          | String             | 'base'  | 'fast'/'base'/'slow'/'slower'                                                                 | N    | 过渡时间。                      |
+| value             | String             | ''      | -                                                                                             | N    | 输入框值。                      |
+| type              | String             | 'text'  | 'text'/'decimal'/'email'/'none'/'numeric'/'search'/'tel'/'url'/'password'/'number'/'textarea' | N    | 输入框类型。                    |
+| inputmode         | String             | ''      | 'text'/'decimal'/'email'/'none'/'numeric'/'search'/'tel'/'url'                                | N    | 指定输入的数据类型。            |
+| state             | String             | 'theme' | 'theme'/'success'/'warning'/'error'/'info'                                                    | N    | 状态。                          |
+| maxlength         | Number             | 24      | -                                                                                             | N    | 最多可输入文本长度。            |
+| rows              | Number             | 2       | -                                                                                             | N    | textarea 时行数。               |
+| autosize          | Boolean            | false   | true/false                                                                                    | N    | textarea 时是否自动调整高度。   |
+| textareaMaxlength | Number             | 200     | -                                                                                             | N    | textarea 时最多可输入文本长度。 |
+| clear             | Boolean            | false   | true/false                                                                                    | N    | 是否可清空。                    |
+| autocomplete      | Boolean            | true    | true/false                                                                                    | N    | 是否开启自动填充功能。          |
+| disabled          | Boolean            | false   | true/false                                                                                    | N    | 是否禁用。                      |
+| label1            | String/Object/slot | ''      | ''/Icon Props/slot                                                                            | N    | 标签 1 内容。                   |
+| label2            | String/slot        | ''      | ''/Any String/slot                                                                            | N    | 标签 2 内容。                   |
+| label3            | String/Object/slot | ''      | ''/Icon Props/slot                                                                            | N    | 标签 3 内容。                   |
+| label4            | String/Object/slot | ''      | ''/Icon Props/slot                                                                            | N    | 标签 4 内容。                   |
+| label5            | String/slot        | ''      | ''/Any String/slot                                                                            | N    | 标签 5 内容。                   |
+| label6            | String/Object/slot | ''      | ''/Icon Props/slot                                                                            | N    | 标签 6 内容。                   |
+| tip               | String/slot        | ''      | ''/Any String/slot                                                                            | N    | 提示信息内容。                  |
+| data1             | String/slot        | ''      | ''/Any String/slot                                                                            | N    | 数据项 1 内容。                 |
+| data2             | String/slot        | ''      | ''/Any String/slot                                                                            | N    | 数据项 2 内容。                 |
+| data3             | String/slot        | ''      | ''/Any String/slot                                                                            | N    | 数据项 3 内容。                 |
 
 ## Input Events
 

+ 32 - 32
doc/components/input/api_en.md

@@ -1,37 +1,37 @@
 ## Input Props
 
-| Property Name     | Type               | Default Value | Optional Values                                                                    | Required | Description                                                   |
-| ----------------- | ------------------ | ------------- | ---------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------- |
-| title             | String/slot        | ''            | -                                                                                  | No       | The title content.                                            |
-| placeholder       | String             | ''            | -                                                                                  | No       | The placeholder text for the input field.                     |
-| titlePosition     | String             | 'out'         | 'out'/'in'/'none'                                                                  | No       | The position of the title.                                    |
-| inputPosition     | String             | 'left'        | 'left'/'right'                                                                     | No       | The position of the input text.                               |
-| radius            | String             | 'base'        | 'none'/'base'/'xl'/'full'                                                          | No       | The style of the corner radius.                               |
-| inputStyle        | String             | 'block'       | 'block'/'line'                                                                     | No       | The style of the input field.                                 |
-| py                | String             | '2'           | '0'/'0.5'/'1'/'2'/'3'/'4'/'6'                                                      | No       | The vertical spacing.                                         |
-| lineTransition    | String             | 'none'        | 'none'/'center'/'left'                                                             | No       | The position of linear transition.                            |
-| duration          | String             | 'base'        | 'fast'/'base'/'slow'/'slower'                                                      | No       | The transition duration.                                      |
-| value             | String             | ''            | -                                                                                  | No       | The value of the input field.                                 |
-| type              | String             | 'text'        | 'text'/'decimal'/'email'/'none'/'numeric'/'search'/'tel'/'url'/'password'/'number' | No       | The type of the input field.                                  |
-| inputmode         | String             | ''            | 'text'/'decimal'/'email'/'none'/'numeric'/'search'/'tel'/'url'                     | No       | The data type to be entered.                                  |
-| state             | String             | 'theme'       | 'theme'/'success'/'warning'/'error'/'info'                                         | No       | The state of the input field.                                 |
-| maxlength         | Number             | 24            | -                                                                                  | No       | The maximum number of characters allowed.                     |
-| rows              | Number             | 2             | -                                                                                  | No       | The number of rows when the input is a text area.             |
-| autosize          | Boolean            | false         | true/false                                                                         | No       | Whether or not the text area automatically adjust its height. |
-| textareaMaxlength | Number             | 200           | -                                                                                  | No       | The maximum number of characters allowed in the text area.    |
-| clear             | Boolean            | false         | true/false                                                                         | No       | Whether or not it is possible to clear the input field.       |
-| autocomplete      | Boolean            | true          | true/false                                                                         | No       | Whether or not to enable auto-fill functionality.             |
-| disabled          | Boolean            | false         | true/false                                                                         | No       | Whether or not the input field is disabled.                   |
-| label1            | String/Object/slot | ''            | ''/Icon Props/slot                                                                 | No       | The contents of label 1.                                      |
-| label2            | String/slot        | ''            | ''/Any String/slot                                                                 | No       | The contents of label 2.                                      |
-| label3            | String/Object/slot | ''            | ''/Icon Props/slot                                                                 | No       | The contents of label 3.                                      |
-| label4            | String/Object/slot | ''            | ''/Icon Props/slot                                                                 | No       | The contents of label 4.                                      |
-| label5            | String/slot        | ''            | ''/Any String/slot                                                                 | No       | The contents of label 5.                                      |
-| label6            | String/Object/slot | ''            | ''/Icon Props/slot                                                                 | No       | The contents of label 6.                                      |
-| tip               | String/slot        | ''            | ''/Any String/slot                                                                 | No       | The contents of the hint message.                             |
-| data1             | String/slot        | ''            | ''/Any String/slot                                                                 | No       | The contents of data item 1.                                  |
-| data2             | String/slot        | ''            | ''/Any String/slot                                                                 | No       | The contents of data item 2.                                  |
-| data3             | String/slot        | ''            | ''/Any String/slot                                                                 | No       | The contents of data item 3.                                  |
+| Property Name     | Type               | Default Value | Optional Values                                                                               | Required | Description                                                   |
+| ----------------- | ------------------ | ------------- | --------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------- |
+| title             | String/slot        | ''            | -                                                                                             | No       | The title content.                                            |
+| placeholder       | String             | ''            | -                                                                                             | No       | The placeholder text for the input field.                     |
+| titlePosition     | String             | 'out'         | 'out'/'in'/'none'                                                                             | No       | The position of the title.                                    |
+| inputPosition     | String             | 'left'        | 'left'/'right'                                                                                | No       | The position of the input text.                               |
+| radius            | String             | 'base'        | 'none'/'base'/'xl'/'full'                                                                     | No       | The style of the corner radius.                               |
+| inputStyle        | String             | 'block'       | 'block'/'line'                                                                                | No       | The style of the input field.                                 |
+| py                | String             | '2'           | '0'/'0.5'/'1'/'2'/'3'/'4'/'6'                                                                 | No       | The vertical spacing.                                         |
+| lineTransition    | String             | 'none'        | 'none'/'center'/'left'                                                                        | No       | The position of linear transition.                            |
+| duration          | String             | 'base'        | 'fast'/'base'/'slow'/'slower'                                                                 | No       | The transition duration.                                      |
+| value             | String             | ''            | -                                                                                             | No       | The value of the input field.                                 |
+| type              | String             | 'text'        | 'text'/'decimal'/'email'/'none'/'numeric'/'search'/'tel'/'url'/'password'/'number'/'textarea' | No       | The type of the input field.                                  |
+| inputmode         | String             | ''            | 'text'/'decimal'/'email'/'none'/'numeric'/'search'/'tel'/'url'                                | No       | The data type to be entered.                                  |
+| state             | String             | 'theme'       | 'theme'/'success'/'warning'/'error'/'info'                                                    | No       | The state of the input field.                                 |
+| maxlength         | Number             | 24            | -                                                                                             | No       | The maximum number of characters allowed.                     |
+| rows              | Number             | 2             | -                                                                                             | No       | The number of rows when the input is a text area.             |
+| autosize          | Boolean            | false         | true/false                                                                                    | No       | Whether or not the text area automatically adjust its height. |
+| textareaMaxlength | Number             | 200           | -                                                                                             | No       | The maximum number of characters allowed in the text area.    |
+| clear             | Boolean            | false         | true/false                                                                                    | No       | Whether or not it is possible to clear the input field.       |
+| autocomplete      | Boolean            | true          | true/false                                                                                    | No       | Whether or not to enable auto-fill functionality.             |
+| disabled          | Boolean            | false         | true/false                                                                                    | No       | Whether or not the input field is disabled.                   |
+| label1            | String/Object/slot | ''            | ''/Icon Props/slot                                                                            | No       | The contents of label 1.                                      |
+| label2            | String/slot        | ''            | ''/Any String/slot                                                                            | No       | The contents of label 2.                                      |
+| label3            | String/Object/slot | ''            | ''/Icon Props/slot                                                                            | No       | The contents of label 3.                                      |
+| label4            | String/Object/slot | ''            | ''/Icon Props/slot                                                                            | No       | The contents of label 4.                                      |
+| label5            | String/slot        | ''            | ''/Any String/slot                                                                            | No       | The contents of label 5.                                      |
+| label6            | String/Object/slot | ''            | ''/Icon Props/slot                                                                            | No       | The contents of label 6.                                      |
+| tip               | String/slot        | ''            | ''/Any String/slot                                                                            | No       | The contents of the hint message.                             |
+| data1             | String/slot        | ''            | ''/Any String/slot                                                                            | No       | The contents of data item 1.                                  |
+| data2             | String/slot        | ''            | ''/Any String/slot                                                                            | No       | The contents of data item 2.                                  |
+| data3             | String/slot        | ''            | ''/Any String/slot                                                                            | No       | The contents of data item 3.                                  |
 
 ## Input Events
 

+ 4 - 0
doc/components/input/version.md

@@ -1,3 +1,7 @@
+## 0.3.2
+
+- [!tag|B|2|]修复 textarea 回车无法换行的问题。
+
 ## 0.3.1
 
 - [!tag|A|0|]新增监听键盘事件 keydown。

+ 4 - 0
doc/components/input/version_en.md

@@ -1,3 +1,7 @@
+## 0.3.2
+
+- [!tag|B|2|] Fixed the problem that textarea cannot wrap when pressing enter.
+
 ## 0.3.1
 
 - [!tag|A|0|] Added keydown event listener.

+ 4 - 0
doc/guide/changelog.md

@@ -1,3 +1,7 @@
+## 0.3.2
+
+- 修复 Input 组件,详见 [Input](https://stdf.design/#/components?nav=input&tab=4)。
+
 ## 0.3.1
 
 - 增强 Input 组件,详见 [Input](https://stdf.design/#/components?nav=input&tab=4)。

+ 4 - 0
doc/guide/changelog_en.md

@@ -1,3 +1,7 @@
+## 0.3.2
+
+- Fix Input, please see [Input](https://stdf.design/#/components?nav=input&tab=4).
+
 ## 0.3.1
 
 - Enhanced the Input component. For details, see [Input](https://stdf.design/#/components?nav=input&tab=4).

+ 4 - 9
packages/stdf/components/input/Input.svelte

@@ -87,8 +87,8 @@
 	// Status: theme/success/warning/error/info
 	export let state = 'theme';
 
-	// 输入框类型,文本/小数/邮箱/不显示/整数/搜索/电话/链接/密码/数字
-	// Input box type, text/decimal/email/none/numeric/search/tel/url/password/number
+	// 输入框类型,文本/小数/邮箱/不显示/整数/搜索/电话/链接/密码/数字/多行文本
+	// Input box type, text/decimal/email/none/numeric/search/tel/url/password/number/textarea
 	export let type = 'text';
 
 	// 输入模式
@@ -308,11 +308,6 @@
 	// 键盘事件
 	// Keyboard event
 	const keydownFunc = e => {
-		// 如果是回车阻止默认事件,防止滚动
-		// If it is an enter key, prevent the default event to prevent scrolling
-		if (e.key === 'Enter') {
-			e.preventDefault();
-		}
 		// 派发事件,并传出按键的 key
 		// Dispatch events and pass out the key of the key
 		dispatch('keydown', e.key);
@@ -393,7 +388,7 @@
 					<div class="text-gray6 text-xs">{title}</div>
 				{/if}
 				<div class="flex space-x-1">
-					<form action="" class="w-full">
+					<div class="w-full">
 						{#if type === 'textarea'}
 							<textarea
 								bind:value
@@ -433,7 +428,7 @@
 								on:keydown={keydownFunc}
 							/>
 						{/if}
-					</form>
+					</div>
 					{#if clear && value !== ''}
 						<!-- svelte-ignore a11y-click-events-have-key-events -->
 						<!-- svelte-ignore a11y-no-static-element-interactions -->

+ 1 - 1
packages/stdf/package.json

@@ -1,6 +1,6 @@
 {
 	"name": "stdf",
-	"version": "0.3.1",
+	"version": "0.3.2",
 	"description": "Mobile web component library based on Svelte and Tailwind",
 	"main": "./components/index.js",
 	"svelte": "./components/index.js",