sard-uniapp 1.30.0 → 1.30.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/CHANGELOG.md +10 -0
- package/components/form/README.md +20 -19
- package/components/form/common.js +4 -2
- package/components/form/form.vue +1 -1
- package/components/form-item/form-item.vue +11 -10
- package/components/form-item/useFormItem.js +11 -4
- package/components/form-item-plain/form-item-plain.vue +11 -10
- package/components/form-plain/form-plain.vue +1 -1
- package/components/input/input.vue +4 -20
- package/components/input-base/input-base.vue +16 -3
- package/components/swiper/swiper.vue +4 -0
- package/components/textarea-base/textarea-base.vue +16 -3
- package/package.json +1 -1
- package/use/useScrollSpy.d.ts +1 -1
- package/use/useScrollSpy.js +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
## <small>1.30.2 (2026-05-14)</small>
|
|
3
|
+
|
|
4
|
+
* Bug Fixes: 修复表单项布尔类型属性的覆盖问题 ([903a2c4](https://github.com/sutras/sard-uniapp/commit/903a2c4))
|
|
5
|
+
|
|
6
|
+
## <small>1.30.1 (2026-05-10)</small>
|
|
7
|
+
|
|
8
|
+
* Bug Fixes: 修复小程序端字数限制问题 ([a0c6923](https://github.com/sutras/sard-uniapp/commit/a0c6923))
|
|
9
|
+
* Bug Fixes: 修复弹窗中使用时滚动位置不正确问题 ([30fb9d9](https://github.com/sutras/sard-uniapp/commit/30fb9d9))
|
|
10
|
+
* Bug Fixes: 透传常用属性 ([cc21393](https://github.com/sutras/sard-uniapp/commit/cc21393))
|
|
11
|
+
|
|
2
12
|
## 1.30.0 (2026-05-02)
|
|
3
13
|
|
|
4
14
|
* Features: 允许在开关里面展示文字 ([55b9f23](https://github.com/sutras/sard-uniapp/commit/55b9f23))
|
|
@@ -181,7 +181,6 @@ import FormItemPlain from 'sard-uniapp/components/form-item-plain/form-item-plai
|
|
|
181
181
|
| root-style | 组件根元素样式 | StyleValue | - |
|
|
182
182
|
| model | 表单数据对象 | Record\<string, any> | - |
|
|
183
183
|
| rules | 表单验证规则 | FormRules | - |
|
|
184
|
-
| validate-trigger | 设置字段校验的时机 | TriggerType | change |
|
|
185
184
|
| validate-on-rule-change | 是否在 `rules` 属性改变后立即触发一次验证 | boolean | true |
|
|
186
185
|
| direction | 表单排列方向 | 'horizontal' \| 'vertical' | 'horizontal' |
|
|
187
186
|
| label-width | 标签宽度 | string | - |
|
|
@@ -190,6 +189,7 @@ import FormItemPlain from 'sard-uniapp/components/form-item-plain/form-item-plai
|
|
|
190
189
|
| star-position | 必填星号在标签的左边或右边 | 'left' \| 'right' | 'left' |
|
|
191
190
|
| hide-star | 是否隐藏必填时的星号 | boolean | false |
|
|
192
191
|
| content-position <sup>1.24.1+</sup> | 内容位置 | 'left' \| 'right' | 'left' |
|
|
192
|
+
| validate-trigger | 设置字段校验的时机 | TriggerType | 'change' |
|
|
193
193
|
| show-error | 是否显示校验错误信息 | boolean | true |
|
|
194
194
|
| scroll-to-first-error | 当校验失败时,滚动到第一个错误表单项 | boolean | false |
|
|
195
195
|
| scroll-into-view-options | 自定义滚动配置选项 | [ScrollIntoViewOptions](../utilities/geometry#ScrollIntoViewOptions) | `{position: 'nearest', startOffset: 0, endOffset: 0}` |
|
|
@@ -213,24 +213,25 @@ import FormItemPlain from 'sard-uniapp/components/form-item-plain/form-item-plai
|
|
|
213
213
|
|
|
214
214
|
### FormItemProps
|
|
215
215
|
|
|
216
|
-
| 属性 | 描述 | 类型 | 默认值
|
|
217
|
-
| ----------------------------------- | -------------------------------------------------------------------------------------- | ---------------------------- |
|
|
218
|
-
| root-class | 组件根元素类名 | string | -
|
|
219
|
-
| root-style | 组件根元素样式 | StyleValue | -
|
|
220
|
-
|
|
|
221
|
-
| label
|
|
222
|
-
|
|
|
223
|
-
|
|
|
224
|
-
|
|
|
225
|
-
|
|
|
226
|
-
|
|
|
227
|
-
|
|
|
228
|
-
|
|
|
229
|
-
|
|
|
230
|
-
|
|
|
231
|
-
|
|
|
232
|
-
|
|
|
233
|
-
|
|
|
216
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
217
|
+
| ----------------------------------- | -------------------------------------------------------------------------------------- | ---------------------------- | ------ |
|
|
218
|
+
| root-class | 组件根元素类名 | string | - |
|
|
219
|
+
| root-style | 组件根元素样式 | StyleValue | - |
|
|
220
|
+
| name | 表单域 `model` 字段,在使用 `validate、reset` 方法的情况下,该属性是必填的。 | FieldName | - |
|
|
221
|
+
| label | 标签文本 | string | - |
|
|
222
|
+
| required | 是否为必填项,如不设置,则会根据校验规则确认 | boolean | - |
|
|
223
|
+
| rules | 表单验证规则,会合并表单组件上的验证规则 | Rule \| Rule[] | - |
|
|
224
|
+
| error | 表单域验证错误时的提示信息。设置该值会导致表单验证状态变为 `error`,并显示该错误信息。 | string | - |
|
|
225
|
+
| inlaid | 去掉边框和内边距,用于嵌入到其他组件中 | boolean | false |
|
|
226
|
+
| direction | 表单排列方向,可覆盖表单的全局设置 | 'horizontal' \| 'vertical' | - |
|
|
227
|
+
| label-width | 标签宽度,可覆盖表单的全局设置 | string | - |
|
|
228
|
+
| label-align | 标签水平对齐方式,可覆盖表单的全局设置 | 'start' \| 'center' \| 'end' | - |
|
|
229
|
+
| label-valign | 标签垂直对齐方式,可覆盖表单的全局设置 | 'start' \| 'center' \| 'end' | - |
|
|
230
|
+
| star-position | 必填星号在标签的左边或右边,可覆盖表单的全局设置 | 'left' \| 'right' | - |
|
|
231
|
+
| hide-star | 是否隐藏必填时的星号,可覆盖表单的全局设置 | boolean | - |
|
|
232
|
+
| content-position <sup>1.24.1+</sup> | 内容位置,可覆盖表单的全局设置 | 'left' \| 'right' | - |
|
|
233
|
+
| validate-trigger | 设置字段校验的时机,可覆盖表单的全局设置 | TriggerType | - |
|
|
234
|
+
| show-error | 是否显示校验错误信息,可覆盖表单的全局设置 | boolean | - |
|
|
234
235
|
|
|
235
236
|
### FormItemSlots
|
|
236
237
|
|
|
@@ -9,13 +9,15 @@ export const defaultFormProps = () => ({
|
|
|
9
9
|
starPosition: 'left',
|
|
10
10
|
contentPosition: 'left',
|
|
11
11
|
showError: true,
|
|
12
|
+
hideStar: false,
|
|
12
13
|
scrollDuration: 150,
|
|
13
14
|
...defaultConfig.form,
|
|
14
15
|
});
|
|
15
16
|
export const defaultFormItemProps = () => ({
|
|
16
|
-
showError:
|
|
17
|
-
|
|
17
|
+
showError: undefined,
|
|
18
|
+
hideStar: undefined,
|
|
18
19
|
required: undefined,
|
|
20
|
+
...defaultConfig.formItem,
|
|
19
21
|
});
|
|
20
22
|
export const formContextSymbol = Symbol('form-context');
|
|
21
23
|
export const formItemContextSymbol = Symbol('form-item-context');
|
package/components/form/form.vue
CHANGED
|
@@ -18,7 +18,6 @@ import { useForm } from "./useForm";
|
|
|
18
18
|
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
19
19
|
* @property {Record\<string, any>} model 表单数据对象,默认值:-。
|
|
20
20
|
* @property {FormRules} rules 表单验证规则,默认值:-。
|
|
21
|
-
* @property {TriggerType} validateTrigger 设置字段校验的时机,默认值:change。
|
|
22
21
|
* @property {boolean} validateOnRuleChange 是否在 `rules` 属性改变后立即触发一次验证,默认值:true。
|
|
23
22
|
* @property {'horizontal' | 'vertical'} direction 表单排列方向,默认值:'horizontal'。
|
|
24
23
|
* @property {string} labelWidth 标签宽度,默认值:-。
|
|
@@ -27,6 +26,7 @@ import { useForm } from "./useForm";
|
|
|
27
26
|
* @property {'left' | 'right'} starPosition 必填星号在标签的左边或右边,默认值:'left'。
|
|
28
27
|
* @property {boolean} hideStar 是否隐藏必填时的星号,默认值:false。
|
|
29
28
|
* @property {'left' | 'right'} contentPosition 内容位置,默认值:'left'。
|
|
29
|
+
* @property {TriggerType} validateTrigger 设置字段校验的时机,默认值:'change'。
|
|
30
30
|
* @property {boolean} showError 是否显示校验错误信息,默认值:true。
|
|
31
31
|
* @property {boolean} scrollToFirstError 当校验失败时,滚动到第一个错误表单项,默认值:false。
|
|
32
32
|
* @property {[ScrollIntoViewOptions](../utilities/geometry#ScrollIntoViewOptions)} scrollIntoViewOptions 自定义滚动配置选项,默认值:`{position: 'nearest', startOffset: 0, endOffset: 0}`。
|
|
@@ -35,20 +35,21 @@ import { useFormItem } from "./useFormItem";
|
|
|
35
35
|
/**
|
|
36
36
|
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
37
37
|
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
38
|
-
* @property {
|
|
39
|
-
* @property {string} labelWidth 标签宽度,默认值:-。
|
|
40
|
-
* @property {'start' | 'center' | 'end'} labelAlign 标签水平对齐方式,默认值:'start'。
|
|
41
|
-
* @property {'start' | 'center' | 'end'} labelValign 标签垂直对齐方式,默认值:'start'。
|
|
42
|
-
* @property {'left' | 'right'} starPosition 必填星号在标签的左边或右边,默认值:'left'。
|
|
43
|
-
* @property {'left' | 'right'} contentPosition 内容位置,默认值:'left'。
|
|
38
|
+
* @property {FieldName} name 表单域 `model` 字段,在使用 `validate、reset` 方法的情况下,该属性是必填的。,默认值:-。
|
|
44
39
|
* @property {string} label 标签文本,默认值:-。
|
|
45
40
|
* @property {boolean} required 是否为必填项,如不设置,则会根据校验规则确认,默认值:-。
|
|
46
|
-
* @property {
|
|
47
|
-
* @property {Rule | Rule[]} rules 表单验证规则,默认值:-。
|
|
48
|
-
* @property {TriggerType} validateTrigger 设置字段校验的时机,默认值:change。
|
|
41
|
+
* @property {Rule | Rule[]} rules 表单验证规则,会合并表单组件上的验证规则,默认值:-。
|
|
49
42
|
* @property {string} error 表单域验证错误时的提示信息。设置该值会导致表单验证状态变为 `error`,并显示该错误信息。,默认值:-。
|
|
50
|
-
* @property {boolean} showError 是否显示校验错误信息,默认值:true。
|
|
51
43
|
* @property {boolean} inlaid 去掉边框和内边距,用于嵌入到其他组件中,默认值:false。
|
|
44
|
+
* @property {'horizontal' | 'vertical'} direction 表单排列方向,可覆盖表单的全局设置,默认值:-。
|
|
45
|
+
* @property {string} labelWidth 标签宽度,可覆盖表单的全局设置,默认值:-。
|
|
46
|
+
* @property {'start' | 'center' | 'end'} labelAlign 标签水平对齐方式,可覆盖表单的全局设置,默认值:-。
|
|
47
|
+
* @property {'start' | 'center' | 'end'} labelValign 标签垂直对齐方式,可覆盖表单的全局设置,默认值:-。
|
|
48
|
+
* @property {'left' | 'right'} starPosition 必填星号在标签的左边或右边,可覆盖表单的全局设置,默认值:-。
|
|
49
|
+
* @property {boolean} hideStar 是否隐藏必填时的星号,可覆盖表单的全局设置,默认值:-。
|
|
50
|
+
* @property {'left' | 'right'} contentPosition 内容位置,可覆盖表单的全局设置,默认值:-。
|
|
51
|
+
* @property {TriggerType} validateTrigger 设置字段校验的时机,可覆盖表单的全局设置,默认值:-。
|
|
52
|
+
* @property {boolean} showError 是否显示校验错误信息,可覆盖表单的全局设置,默认值:-。
|
|
52
53
|
*/
|
|
53
54
|
export default _defineComponent({
|
|
54
55
|
...{
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { computed, getCurrentInstance, nextTick, onBeforeUnmount, onMounted, provide, reactive, ref, toRef, watch, } from 'vue';
|
|
2
2
|
import { formItemContextSymbol, useFormContext, } from '../form/common';
|
|
3
|
-
import { chainGet, chainSet, deepClone, getBoundingClientRect, getScrollIntoViewValue, getViewportScrollInfo, getWindowInfo, noop, toArray, uniqid, } from '../../utils';
|
|
3
|
+
import { chainGet, chainSet, deepClone, getBoundingClientRect, getScrollIntoViewValue, getViewportScrollInfo, getWindowInfo, isBoolean, noop, toArray, uniqid, } from '../../utils';
|
|
4
4
|
export function useFormItem(props) {
|
|
5
|
-
// main
|
|
6
5
|
// 解决在微信小程序中 被插槽隔离的表单项无法通过inject获得上下文,此时可通过插槽的转发获得上下文
|
|
7
6
|
const formContext = props.context || useFormContext();
|
|
8
7
|
if (!formContext) {
|
|
@@ -42,7 +41,11 @@ export function useFormItem(props) {
|
|
|
42
41
|
flush: 'post',
|
|
43
42
|
});
|
|
44
43
|
const shouldShowError = computed(() => {
|
|
45
|
-
|
|
44
|
+
if (!validateMessage.value)
|
|
45
|
+
return false;
|
|
46
|
+
if (isBoolean(props.showError))
|
|
47
|
+
return props.showError;
|
|
48
|
+
return !!formContext.showError;
|
|
46
49
|
});
|
|
47
50
|
const mergedValidateTrigger = computed(() => {
|
|
48
51
|
const trigger = props.validateTrigger ?? formContext.validateTrigger;
|
|
@@ -93,7 +96,11 @@ export function useFormItem(props) {
|
|
|
93
96
|
return mergedRules.value.some((rule) => rule.required);
|
|
94
97
|
});
|
|
95
98
|
const shouldShowStar = computed(() => {
|
|
96
|
-
|
|
99
|
+
if (!isRequired.value)
|
|
100
|
+
return false;
|
|
101
|
+
if (isBoolean(props.hideStar))
|
|
102
|
+
return !props.hideStar;
|
|
103
|
+
return !formContext.hideStar;
|
|
97
104
|
});
|
|
98
105
|
const validate = async (trigger) => {
|
|
99
106
|
if (isResetting || !props.name) {
|
|
@@ -25,20 +25,21 @@ import { classNames } from "../../utils";
|
|
|
25
25
|
/**
|
|
26
26
|
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
27
27
|
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
28
|
-
* @property {
|
|
29
|
-
* @property {string} labelWidth 标签宽度,默认值:-。
|
|
30
|
-
* @property {'start' | 'center' | 'end'} labelAlign 标签水平对齐方式,默认值:'start'。
|
|
31
|
-
* @property {'start' | 'center' | 'end'} labelValign 标签垂直对齐方式,默认值:'start'。
|
|
32
|
-
* @property {'left' | 'right'} starPosition 必填星号在标签的左边或右边,默认值:'left'。
|
|
33
|
-
* @property {'left' | 'right'} contentPosition 内容位置,默认值:'left'。
|
|
28
|
+
* @property {FieldName} name 表单域 `model` 字段,在使用 `validate、reset` 方法的情况下,该属性是必填的。,默认值:-。
|
|
34
29
|
* @property {string} label 标签文本,默认值:-。
|
|
35
30
|
* @property {boolean} required 是否为必填项,如不设置,则会根据校验规则确认,默认值:-。
|
|
36
|
-
* @property {
|
|
37
|
-
* @property {Rule | Rule[]} rules 表单验证规则,默认值:-。
|
|
38
|
-
* @property {TriggerType} validateTrigger 设置字段校验的时机,默认值:change。
|
|
31
|
+
* @property {Rule | Rule[]} rules 表单验证规则,会合并表单组件上的验证规则,默认值:-。
|
|
39
32
|
* @property {string} error 表单域验证错误时的提示信息。设置该值会导致表单验证状态变为 `error`,并显示该错误信息。,默认值:-。
|
|
40
|
-
* @property {boolean} showError 是否显示校验错误信息,默认值:true。
|
|
41
33
|
* @property {boolean} inlaid 去掉边框和内边距,用于嵌入到其他组件中,默认值:false。
|
|
34
|
+
* @property {'horizontal' | 'vertical'} direction 表单排列方向,可覆盖表单的全局设置,默认值:-。
|
|
35
|
+
* @property {string} labelWidth 标签宽度,可覆盖表单的全局设置,默认值:-。
|
|
36
|
+
* @property {'start' | 'center' | 'end'} labelAlign 标签水平对齐方式,可覆盖表单的全局设置,默认值:-。
|
|
37
|
+
* @property {'start' | 'center' | 'end'} labelValign 标签垂直对齐方式,可覆盖表单的全局设置,默认值:-。
|
|
38
|
+
* @property {'left' | 'right'} starPosition 必填星号在标签的左边或右边,可覆盖表单的全局设置,默认值:-。
|
|
39
|
+
* @property {boolean} hideStar 是否隐藏必填时的星号,可覆盖表单的全局设置,默认值:-。
|
|
40
|
+
* @property {'left' | 'right'} contentPosition 内容位置,可覆盖表单的全局设置,默认值:-。
|
|
41
|
+
* @property {TriggerType} validateTrigger 设置字段校验的时机,可覆盖表单的全局设置,默认值:-。
|
|
42
|
+
* @property {boolean} showError 是否显示校验错误信息,可覆盖表单的全局设置,默认值:-。
|
|
42
43
|
*/
|
|
43
44
|
export default _defineComponent({
|
|
44
45
|
...{
|
|
@@ -14,7 +14,6 @@ import { defaultFormProps } from "../form/common";
|
|
|
14
14
|
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
15
15
|
* @property {Record\<string, any>} model 表单数据对象,默认值:-。
|
|
16
16
|
* @property {FormRules} rules 表单验证规则,默认值:-。
|
|
17
|
-
* @property {TriggerType} validateTrigger 设置字段校验的时机,默认值:change。
|
|
18
17
|
* @property {boolean} validateOnRuleChange 是否在 `rules` 属性改变后立即触发一次验证,默认值:true。
|
|
19
18
|
* @property {'horizontal' | 'vertical'} direction 表单排列方向,默认值:'horizontal'。
|
|
20
19
|
* @property {string} labelWidth 标签宽度,默认值:-。
|
|
@@ -23,6 +22,7 @@ import { defaultFormProps } from "../form/common";
|
|
|
23
22
|
* @property {'left' | 'right'} starPosition 必填星号在标签的左边或右边,默认值:'left'。
|
|
24
23
|
* @property {boolean} hideStar 是否隐藏必填时的星号,默认值:false。
|
|
25
24
|
* @property {'left' | 'right'} contentPosition 内容位置,默认值:'left'。
|
|
25
|
+
* @property {TriggerType} validateTrigger 设置字段校验的时机,默认值:'change'。
|
|
26
26
|
* @property {boolean} showError 是否显示校验错误信息,默认值:true。
|
|
27
27
|
* @property {boolean} scrollToFirstError 当校验失败时,滚动到第一个错误表单项,默认值:false。
|
|
28
28
|
* @property {[ScrollIntoViewOptions](../utilities/geometry#ScrollIntoViewOptions)} scrollIntoViewOptions 自定义滚动配置选项,默认值:`{position: 'nearest', startOffset: 0, endOffset: 0}`。
|
|
@@ -64,13 +64,7 @@
|
|
|
64
64
|
<script>
|
|
65
65
|
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
66
66
|
import { computed, inject, ref, watch } from "vue";
|
|
67
|
-
import {
|
|
68
|
-
classNames,
|
|
69
|
-
stringifyStyle,
|
|
70
|
-
createBem,
|
|
71
|
-
isWeb,
|
|
72
|
-
uniqid
|
|
73
|
-
} from "../../utils";
|
|
67
|
+
import { classNames, stringifyStyle, createBem, uniqid } from "../../utils";
|
|
74
68
|
import SarIcon from "../icon/icon.vue";
|
|
75
69
|
import { useFormContext, useFormItemContext } from "../form/common";
|
|
76
70
|
import {
|
|
@@ -235,16 +229,9 @@ export default _defineComponent({
|
|
|
235
229
|
}
|
|
236
230
|
}
|
|
237
231
|
);
|
|
238
|
-
const onInput = (
|
|
239
|
-
let value = event.detail.value;
|
|
232
|
+
const onInput = (value) => {
|
|
240
233
|
lastFocusInput.value = thisInput;
|
|
241
|
-
if (!isWeb) {
|
|
242
|
-
if (props.maxlength >= 0) {
|
|
243
|
-
value = value.slice(0, props.maxlength);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
234
|
setInnerValue(value);
|
|
247
|
-
return value;
|
|
248
235
|
};
|
|
249
236
|
const innerFocused = ref(props.focus || props.focused);
|
|
250
237
|
watch([() => props.focus, () => props.focused], () => {
|
|
@@ -308,9 +295,6 @@ export default _defineComponent({
|
|
|
308
295
|
const onClick = (event) => {
|
|
309
296
|
emit("click", event);
|
|
310
297
|
};
|
|
311
|
-
const maxLength = computed(() => {
|
|
312
|
-
return isWeb ? props.maxlength : -1;
|
|
313
|
-
});
|
|
314
298
|
const isPlainText = ref(false);
|
|
315
299
|
const eyeIcon = computed(() => isPlainText.value ? "eye" : "eye-slash");
|
|
316
300
|
const onEyeClick = () => {
|
|
@@ -367,7 +351,7 @@ export default _defineComponent({
|
|
|
367
351
|
placeholderStyle: mergedPlaceholderStyle.value,
|
|
368
352
|
placeholderClass: props.placeholderClass,
|
|
369
353
|
disabled: isDisabled.value || isReadonly.value,
|
|
370
|
-
maxlength:
|
|
354
|
+
maxlength: props.maxlength,
|
|
371
355
|
focus: props.focus,
|
|
372
356
|
cursorSpacing: props.cursorSpacing,
|
|
373
357
|
cursor: props.cursor,
|
|
@@ -429,7 +413,7 @@ export default _defineComponent({
|
|
|
429
413
|
return oldValue;
|
|
430
414
|
}, set oldValue(v) {
|
|
431
415
|
oldValue = v;
|
|
432
|
-
}, thisInput, onFocus, onBlur, clearVisible, holdupClear, onClearTouchStart, onClearTouchEnd, onClearMouseDown, onClearClick, onLinechange, onConfirm, onKeyboardheightchange, onClick,
|
|
416
|
+
}, thisInput, onFocus, onBlur, clearVisible, holdupClear, onClearTouchStart, onClearTouchEnd, onClearMouseDown, onClearClick, onLinechange, onConfirm, onKeyboardheightchange, onClick, isPlainText, eyeIcon, onEyeClick, showPassword, omittedType, mergedShowEye, inputClass, inputStyle, controlStyle, mergedPlaceholderStyle, fieldCommonProps, inputOnlyProps, inputProps, textareaOnlyProps, textareaProps, SarIcon, SarInputBase, SarTextareaBase };
|
|
433
417
|
return __returned__;
|
|
434
418
|
}
|
|
435
419
|
});
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:placeholder-style="placeholderStyle"
|
|
8
8
|
:placeholder-class="placeholderClass"
|
|
9
9
|
:disabled="disabled"
|
|
10
|
-
:maxlength="
|
|
10
|
+
:maxlength="maxLength"
|
|
11
11
|
:focus="focus"
|
|
12
12
|
:cursor-spacing="cursorSpacing"
|
|
13
13
|
:cursor="cursor"
|
|
@@ -44,7 +44,9 @@
|
|
|
44
44
|
|
|
45
45
|
<script>
|
|
46
46
|
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
47
|
+
import { computed } from "vue";
|
|
47
48
|
import { defaultInputBaseProps } from "./common";
|
|
49
|
+
import { isWeb } from "../../utils";
|
|
48
50
|
export default _defineComponent({
|
|
49
51
|
...{
|
|
50
52
|
options: {
|
|
@@ -91,9 +93,20 @@ export default _defineComponent({
|
|
|
91
93
|
emits: ["input", "focus", "blur", "confirm", "keyboardheightchange"],
|
|
92
94
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
93
95
|
__expose();
|
|
96
|
+
const props = __props;
|
|
94
97
|
const emit = __emit;
|
|
98
|
+
const maxLength = computed(() => {
|
|
99
|
+
return isWeb ? props.maxlength : -1;
|
|
100
|
+
});
|
|
95
101
|
const onInput = (event) => {
|
|
96
|
-
|
|
102
|
+
let value = event.detail.value;
|
|
103
|
+
if (!isWeb) {
|
|
104
|
+
if (props.maxlength >= 0) {
|
|
105
|
+
value = value.slice(0, props.maxlength);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
emit("input", value);
|
|
109
|
+
return value;
|
|
97
110
|
};
|
|
98
111
|
const onFocus = (event) => {
|
|
99
112
|
emit("focus", event);
|
|
@@ -107,7 +120,7 @@ export default _defineComponent({
|
|
|
107
120
|
const onKeyboardheightchange = (event) => {
|
|
108
121
|
emit("keyboardheightchange", event);
|
|
109
122
|
};
|
|
110
|
-
const __returned__ = { emit, onInput, onFocus, onBlur, onConfirm, onKeyboardheightchange };
|
|
123
|
+
const __returned__ = { props, emit, maxLength, onInput, onFocus, onBlur, onConfirm, onKeyboardheightchange };
|
|
111
124
|
return __returned__;
|
|
112
125
|
}
|
|
113
126
|
});
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
<swiper
|
|
4
4
|
:class="swiperClass"
|
|
5
5
|
:current="innerValue"
|
|
6
|
+
:autoplay="autoplay"
|
|
7
|
+
:interval="interval"
|
|
8
|
+
:duration="duration"
|
|
9
|
+
:circular="circular"
|
|
6
10
|
:previous-margin="previousMargin"
|
|
7
11
|
:next-margin="nextMargin"
|
|
8
12
|
:display-multiple-items="displayMultipleItems"
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:placeholder-style="placeholderStyle"
|
|
8
8
|
:placeholder-class="placeholderClass"
|
|
9
9
|
:disabled="disabled"
|
|
10
|
-
:maxlength="
|
|
10
|
+
:maxlength="maxLength"
|
|
11
11
|
:focus="focus"
|
|
12
12
|
:cursor-spacing="cursorSpacing"
|
|
13
13
|
:cursor="cursor"
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
|
|
38
38
|
<script>
|
|
39
39
|
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
40
|
+
import { computed } from "vue";
|
|
41
|
+
import { isWeb } from "../../utils";
|
|
40
42
|
import {
|
|
41
43
|
defaultTextareaBaseProps
|
|
42
44
|
} from "../input-base/common";
|
|
@@ -78,9 +80,20 @@ export default _defineComponent({
|
|
|
78
80
|
emits: ["linechange", "input", "focus", "blur", "confirm", "keyboardheightchange"],
|
|
79
81
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
80
82
|
__expose();
|
|
83
|
+
const props = __props;
|
|
81
84
|
const emit = __emit;
|
|
85
|
+
const maxLength = computed(() => {
|
|
86
|
+
return isWeb ? props.maxlength : -1;
|
|
87
|
+
});
|
|
82
88
|
const onInput = (event) => {
|
|
83
|
-
|
|
89
|
+
let value = event.detail.value;
|
|
90
|
+
if (!isWeb) {
|
|
91
|
+
if (props.maxlength >= 0) {
|
|
92
|
+
value = value.slice(0, props.maxlength);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
emit("input", value);
|
|
96
|
+
return value;
|
|
84
97
|
};
|
|
85
98
|
const onFocus = (event) => {
|
|
86
99
|
emit("focus", event);
|
|
@@ -94,7 +107,7 @@ export default _defineComponent({
|
|
|
94
107
|
const onKeyboardheightchange = (event) => {
|
|
95
108
|
emit("keyboardheightchange", event);
|
|
96
109
|
};
|
|
97
|
-
const __returned__ = { emit, onInput, onFocus, onBlur, onConfirm, onKeyboardheightchange };
|
|
110
|
+
const __returned__ = { props, emit, maxLength, onInput, onFocus, onBlur, onConfirm, onKeyboardheightchange };
|
|
98
111
|
return __returned__;
|
|
99
112
|
}
|
|
100
113
|
});
|
package/package.json
CHANGED
package/use/useScrollSpy.d.ts
CHANGED
|
@@ -14,6 +14,6 @@ export declare function useScrollSpy(options: UseScrollSpyOptions): {
|
|
|
14
14
|
unregister: (name: string | number) => void;
|
|
15
15
|
onScroll: (event: any) => void;
|
|
16
16
|
scrollTo: (name: string | number) => void;
|
|
17
|
-
update: () =>
|
|
17
|
+
update: () => void;
|
|
18
18
|
initialize: () => Promise<void>;
|
|
19
19
|
};
|
package/use/useScrollSpy.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { computed, nextTick, ref, shallowRef } from 'vue';
|
|
2
2
|
import { useTimeout } from './useTimeout';
|
|
3
3
|
import { isNullish, matchScrollVisible } from '../utils';
|
|
4
|
+
import { usePopupEnter } from '../components/popup';
|
|
4
5
|
export function useScrollSpy(options) {
|
|
5
6
|
const { defaultCurrent, initialScroll, onChange, getSpiedRect } = options;
|
|
6
7
|
const startOffset = computed(() => options.startOffset || 0);
|
|
@@ -101,6 +102,9 @@ export function useScrollSpy(options) {
|
|
|
101
102
|
scrollTo(innerCurrent.value);
|
|
102
103
|
}
|
|
103
104
|
};
|
|
105
|
+
usePopupEnter(() => {
|
|
106
|
+
queueUpdate();
|
|
107
|
+
});
|
|
104
108
|
return {
|
|
105
109
|
scrollTop,
|
|
106
110
|
innerCurrent,
|
|
@@ -109,7 +113,7 @@ export function useScrollSpy(options) {
|
|
|
109
113
|
unregister,
|
|
110
114
|
onScroll,
|
|
111
115
|
scrollTo,
|
|
112
|
-
update,
|
|
116
|
+
update: queueUpdate,
|
|
113
117
|
initialize,
|
|
114
118
|
};
|
|
115
119
|
}
|