sard-uniapp 1.25.1 → 1.25.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
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [1.25.2](https://github.com/sutras/sard-uniapp/compare/v1.25.1...v1.25.2) (2025-11-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **cascader:** 节点值相同时优先绑定后代节点 ([3937b2d](https://github.com/sutras/sard-uniapp/commit/3937b2d3ee47afe875d5d1544d211ca31f7490a0))
|
|
7
|
+
* **input:** 修复web端最大字数限制无效问题 ([8811d13](https://github.com/sutras/sard-uniapp/commit/8811d13ef1c5294ad16fb52b1d1b56fd2c37f356))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
1
11
|
## [1.25.1](https://github.com/sutras/sard-uniapp/compare/v1.25.0...v1.25.1) (2025-11-07)
|
|
2
12
|
|
|
3
13
|
|
|
@@ -24,15 +24,17 @@ export function getSelectedOptionsByValue(options, value, fieldKeys) {
|
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
26
|
for (const option of options) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
27
|
+
// 优先在子结点中查找,找到后再向上回溯路径
|
|
28
|
+
// 这样可以处理存在重复值场景时候更偏向于更深层次的选项
|
|
30
29
|
if (Array.isArray(option[fieldKeys.children])) {
|
|
31
30
|
const selectedOptions = getSelectedOptionsByValue(option[fieldKeys.children], value, fieldKeys);
|
|
32
31
|
if (selectedOptions) {
|
|
33
32
|
return [option, ...selectedOptions];
|
|
34
33
|
}
|
|
35
34
|
}
|
|
35
|
+
if (option[fieldKeys.value] === value) {
|
|
36
|
+
return [option];
|
|
37
|
+
}
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
)
|
|
18
18
|
"
|
|
19
19
|
:enableNative="enableNative"
|
|
20
|
+
:controlled="controlled"
|
|
20
21
|
:value="innerValue"
|
|
21
22
|
:placeholder="placeholder"
|
|
22
23
|
:placeholder-style="mergedPlaceholderStyle"
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
:fixed="fixed"
|
|
39
40
|
:show-confirm-bar="showConfirmBar"
|
|
40
41
|
:disable-default-padding="disableDefaultPadding"
|
|
42
|
+
:maxlength="maxLength"
|
|
41
43
|
@input="onInput"
|
|
42
44
|
@focus="onFocus"
|
|
43
45
|
@blur="onBlur"
|
|
@@ -52,6 +54,7 @@
|
|
|
52
54
|
v-if="type !== 'textarea' && showPassword"
|
|
53
55
|
:class="classNames(bem.e('control'), bem.em('control', 'input'))"
|
|
54
56
|
:enableNative="enableNative"
|
|
57
|
+
:controlled="controlled"
|
|
55
58
|
:value="innerValue"
|
|
56
59
|
:placeholder="placeholder"
|
|
57
60
|
:placeholder-style="mergedPlaceholderStyle"
|
|
@@ -70,6 +73,7 @@
|
|
|
70
73
|
:ignore-composition-event="ignoreCompositionEvent"
|
|
71
74
|
:inputmode="inputmode"
|
|
72
75
|
autocomplete="off"
|
|
76
|
+
:maxlength="maxLength"
|
|
73
77
|
@input="onInput"
|
|
74
78
|
@focus="onFocus"
|
|
75
79
|
@blur="onBlur"
|
|
@@ -85,12 +89,12 @@
|
|
|
85
89
|
:safe-password-salt="safePasswordSalt"
|
|
86
90
|
:safe-password-custom-hash="safePasswordCustomHash"
|
|
87
91
|
:random-number="randomNumber"
|
|
88
|
-
:controlled="controlled"
|
|
89
92
|
:always-system="alwaysSystem"
|
|
90
93
|
/>
|
|
91
94
|
<input
|
|
92
95
|
v-if="type !== 'textarea' && !showPassword"
|
|
93
96
|
:class="classNames(bem.e('control'), bem.em('control', 'input'))"
|
|
97
|
+
:controlled="controlled"
|
|
94
98
|
:enableNative="enableNative"
|
|
95
99
|
:value="innerValue"
|
|
96
100
|
:placeholder="placeholder"
|
|
@@ -110,6 +114,7 @@
|
|
|
110
114
|
:ignore-composition-event="ignoreCompositionEvent"
|
|
111
115
|
:inputmode="inputmode"
|
|
112
116
|
autocomplete="off"
|
|
117
|
+
:maxlength="maxLength"
|
|
113
118
|
@input="onInput"
|
|
114
119
|
@focus="onFocus"
|
|
115
120
|
@blur="onBlur"
|
|
@@ -125,7 +130,6 @@
|
|
|
125
130
|
:safe-password-salt="safePasswordSalt"
|
|
126
131
|
:safe-password-custom-hash="safePasswordCustomHash"
|
|
127
132
|
:random-number="randomNumber"
|
|
128
|
-
:controlled="controlled"
|
|
129
133
|
:always-system="alwaysSystem"
|
|
130
134
|
/>
|
|
131
135
|
<view :class="bem.e('tools')">
|
|
@@ -154,7 +158,8 @@
|
|
|
154
158
|
<slot name="addon"></slot>
|
|
155
159
|
</view>
|
|
156
160
|
<view v-if="showCount" :class="bem.e('count')">
|
|
157
|
-
{{ innerValue.length }}
|
|
161
|
+
<view v-if="maxlength === -1">{{ innerValue.length }}</view>
|
|
162
|
+
<view v-else>{{ innerValue.length }} / {{ maxlength }}</view>
|
|
158
163
|
</view>
|
|
159
164
|
</view>
|
|
160
165
|
</template>
|
|
@@ -162,7 +167,7 @@
|
|
|
162
167
|
<script>
|
|
163
168
|
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
164
169
|
import { computed, ref, watch } from "vue";
|
|
165
|
-
import { classNames, stringifyStyle, createBem } from "../../utils";
|
|
170
|
+
import { classNames, stringifyStyle, createBem, isWeb } from "../../utils";
|
|
166
171
|
import SarIcon from "../icon/icon.vue";
|
|
167
172
|
import { useFormContext, useFormItemContext } from "../form/common";
|
|
168
173
|
import {
|
|
@@ -317,8 +322,10 @@ export default _defineComponent({
|
|
|
317
322
|
);
|
|
318
323
|
const onInput = (event) => {
|
|
319
324
|
let value = event.detail.value;
|
|
320
|
-
if (
|
|
321
|
-
|
|
325
|
+
if (!isWeb) {
|
|
326
|
+
if (props.maxlength >= 0) {
|
|
327
|
+
value = value.slice(0, props.maxlength);
|
|
328
|
+
}
|
|
322
329
|
}
|
|
323
330
|
setInnerValue(value);
|
|
324
331
|
return value;
|
|
@@ -380,6 +387,9 @@ export default _defineComponent({
|
|
|
380
387
|
const onClick = (event) => {
|
|
381
388
|
emit("click", event);
|
|
382
389
|
};
|
|
390
|
+
const maxLength = computed(() => {
|
|
391
|
+
return isWeb ? props.maxlength : -1;
|
|
392
|
+
});
|
|
383
393
|
const isPlainText = ref(false);
|
|
384
394
|
const eyeIcon = computed(() => isPlainText.value ? "eye" : "eye-slash");
|
|
385
395
|
const onEyeClick = () => {
|
|
@@ -430,7 +440,7 @@ export default _defineComponent({
|
|
|
430
440
|
return oldValue;
|
|
431
441
|
}, set oldValue(v) {
|
|
432
442
|
oldValue = v;
|
|
433
|
-
}, onFocus, onBlur, clearVisible, holdupClear, onClearTouchStart, onClearTouchEnd, onClearMouseDown, onClearClick, onLinechange, onConfirm, onKeyboardheightchange, onClick, isPlainText, eyeIcon, onEyeClick, showPassword, mergedType, mergedShowEye, inputClass, inputStyle, controlStyle, mergedPlaceholderStyle, get classNames() {
|
|
443
|
+
}, onFocus, onBlur, clearVisible, holdupClear, onClearTouchStart, onClearTouchEnd, onClearMouseDown, onClearClick, onLinechange, onConfirm, onKeyboardheightchange, onClick, maxLength, isPlainText, eyeIcon, onEyeClick, showPassword, mergedType, mergedShowEye, inputClass, inputStyle, controlStyle, mergedPlaceholderStyle, get classNames() {
|
|
434
444
|
return classNames;
|
|
435
445
|
}, SarIcon };
|
|
436
446
|
return __returned__;
|