sard-uniapp 1.21.1 → 1.22.0
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 +24 -0
- package/components/accordion/README.md +13 -6
- package/components/accordion/accordion.vue +10 -3
- package/components/accordion/common.d.ts +2 -0
- package/components/accordion/index.scss +6 -0
- package/components/accordion-item/accordion-item.vue +6 -1
- package/components/accordion-item/index.scss +12 -0
- package/components/calendar-input/README.md +9 -0
- package/components/calendar-input/calendar-input.d.ts +9 -2
- package/components/calendar-input/calendar-input.vue +13 -1
- package/components/calendar-input/common.d.ts +3 -1
- package/components/cascader-input/README.md +8 -1
- package/components/cascader-input/cascader-input.vue +13 -1
- package/components/cascader-input/common.d.ts +2 -2
- package/components/checkbox-input/README.md +9 -0
- package/components/checkbox-input/checkbox-input.d.ts +9 -2
- package/components/checkbox-input/checkbox-input.vue +13 -1
- package/components/checkbox-input/common.d.ts +3 -1
- package/components/config/index.d.ts +5 -0
- package/components/config/index.js +5 -0
- package/components/datetime-picker-input/README.md +9 -0
- package/components/datetime-picker-input/common.d.ts +2 -2
- package/components/datetime-picker-input/datetime-picker-input.vue +13 -1
- package/components/datetime-range-picker-input/README.md +9 -0
- package/components/datetime-range-picker-input/common.d.ts +2 -2
- package/components/datetime-range-picker-input/datetime-range-picker-input.vue +13 -1
- package/components/dnd/README.md +120 -0
- package/components/dnd/common.d.ts +49 -0
- package/components/dnd/common.js +1 -0
- package/components/dnd/dnd.d.ts +37 -0
- package/components/dnd/dnd.vue +136 -0
- package/components/dnd/index.d.ts +1 -0
- package/components/dnd/index.js +1 -0
- package/components/dnd/index.scss +11 -0
- package/components/dnd/variables.scss +7 -0
- package/components/dnd-handle/common.d.ts +12 -0
- package/components/dnd-handle/common.js +1 -0
- package/components/dnd-handle/dnd-handle.d.ts +10 -0
- package/components/dnd-handle/dnd-handle.vue +89 -0
- package/components/dnd-handle/index.d.ts +1 -0
- package/components/dnd-handle/index.js +1 -0
- package/components/dnd-handle/index.scss +13 -0
- package/components/dnd-item/common.d.ts +21 -0
- package/components/dnd-item/common.js +1 -0
- package/components/dnd-item/dnd-item.d.ts +10 -0
- package/components/dnd-item/dnd-item.vue +193 -0
- package/components/dnd-item/index.d.ts +1 -0
- package/components/dnd-item/index.js +1 -0
- package/components/dnd-item/index.scss +28 -0
- package/components/floating-bubble/index.scss +1 -0
- package/components/form/README.md +6 -5
- package/components/form/common.d.ts +4 -0
- package/components/form-item/form-item.vue +10 -4
- package/components/icon/sari.scss +9 -1
- package/components/input/README.md +47 -46
- package/components/input/common.d.ts +1 -0
- package/components/input/index.scss +15 -0
- package/components/input/input.vue +61 -4
- package/components/input/variables.scss +6 -0
- package/components/picker-input/README.md +9 -0
- package/components/picker-input/common.d.ts +2 -2
- package/components/picker-input/picker-input.vue +15 -1
- package/components/popout-input/README.md +20 -11
- package/components/popout-input/common.d.ts +10 -0
- package/components/popout-input/common.js +2 -1
- package/components/popout-input/index.scss +1 -0
- package/components/popout-input/popout-input.d.ts +5 -1
- package/components/popout-input/popout-input.vue +22 -7
- package/components/popup/README.md +24 -22
- package/components/popup/common.d.ts +3 -0
- package/components/popup/popup.d.ts +8 -5
- package/components/popup/popup.vue +25 -2
- package/components/radio-input/README.md +9 -0
- package/components/radio-input/common.d.ts +3 -1
- package/components/radio-input/radio-input.d.ts +9 -2
- package/components/radio-input/radio-input.vue +13 -1
- package/components/share-sheet/share-sheet.vue +1 -1
- package/components/stepper/common.d.ts +1 -1
- package/components/stepper/stepper.vue +1 -1
- package/components/style/mixins/disable-scroll.scss +14 -0
- package/components/style/mixins.scss +1 -0
- package/components/style/variables.scss +4 -0
- package/components/tree/common.d.ts +1 -0
- package/components/tree/index.scss +4 -0
- package/components/tree/tree.vue +33 -21
- package/components/tree/variables.scss +1 -2
- package/components/tree-node/tree-node.vue +2 -0
- package/global.d.ts +3 -0
- package/index.d.ts +3 -0
- package/index.js +3 -0
- package/index.scss +1 -0
- package/package.json +2 -2
- package/use/index.d.ts +1 -0
- package/use/index.js +1 -0
- package/use/useKeyList.d.ts +5 -0
- package/use/useKeyList.js +15 -0
- package/utils/array.js +6 -6
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
:show-count="false"
|
|
50
50
|
/>
|
|
51
51
|
<input
|
|
52
|
-
v-
|
|
52
|
+
v-if="type !== 'textarea' && showPassword"
|
|
53
53
|
:class="classNames(bem.e('control'), bem.em('control', 'input'))"
|
|
54
54
|
:value="innerValue"
|
|
55
55
|
:placeholder="placeholder"
|
|
@@ -75,8 +75,48 @@
|
|
|
75
75
|
@blur="onBlur"
|
|
76
76
|
@confirm="onConfirm"
|
|
77
77
|
@keyboardheightchange="onKeyboardheightchange"
|
|
78
|
-
:type="
|
|
79
|
-
:password="
|
|
78
|
+
:type="mergedType"
|
|
79
|
+
:password="true"
|
|
80
|
+
:always-embed="alwaysEmbed"
|
|
81
|
+
:safe-password-cert-path="safePasswordCertPath"
|
|
82
|
+
:safe-password-length="safePasswordLength"
|
|
83
|
+
:safe-password-time-stamp="safePasswordTimeStamp"
|
|
84
|
+
:safe-password-nonce="safePasswordNonce"
|
|
85
|
+
:safe-password-salt="safePasswordSalt"
|
|
86
|
+
:safe-password-custom-hash="safePasswordCustomHash"
|
|
87
|
+
:random-number="randomNumber"
|
|
88
|
+
:controlled="controlled"
|
|
89
|
+
:always-system="alwaysSystem"
|
|
90
|
+
/>
|
|
91
|
+
<input
|
|
92
|
+
v-if="type !== 'textarea' && !showPassword"
|
|
93
|
+
:class="classNames(bem.e('control'), bem.em('control', 'input'))"
|
|
94
|
+
:value="innerValue"
|
|
95
|
+
:placeholder="placeholder"
|
|
96
|
+
:placeholder-style="mergedPlaceholderStyle"
|
|
97
|
+
:placeholder-class="placeholderClass"
|
|
98
|
+
:disabled="isDisabled || isReadonly"
|
|
99
|
+
:maxlength="maxlength"
|
|
100
|
+
:focus="focus"
|
|
101
|
+
:cursor-spacing="cursorSpacing"
|
|
102
|
+
:cursor="cursor"
|
|
103
|
+
:confirm-type="confirmType"
|
|
104
|
+
:confirm-hold="confirmHold"
|
|
105
|
+
:selection-start="selectionStart"
|
|
106
|
+
:selection-end="selectionEnd"
|
|
107
|
+
:adjust-position="adjustPosition"
|
|
108
|
+
:hold-keyboard="holdKeyboard"
|
|
109
|
+
:auto-blur="autoBlur"
|
|
110
|
+
:ignore-composition-event="ignoreCompositionEvent"
|
|
111
|
+
:inputmode="inputmode"
|
|
112
|
+
autocomplete="off"
|
|
113
|
+
@input="onInput"
|
|
114
|
+
@focus="onFocus"
|
|
115
|
+
@blur="onBlur"
|
|
116
|
+
@confirm="onConfirm"
|
|
117
|
+
@keyboardheightchange="onKeyboardheightchange"
|
|
118
|
+
:type="mergedType"
|
|
119
|
+
:password="false"
|
|
80
120
|
:always-embed="alwaysEmbed"
|
|
81
121
|
:safe-password-cert-path="safePasswordCertPath"
|
|
82
122
|
:safe-password-length="safePasswordLength"
|
|
@@ -99,6 +139,9 @@
|
|
|
99
139
|
>
|
|
100
140
|
<sar-icon family="sari" name="x-circle-fill" />
|
|
101
141
|
</view>
|
|
142
|
+
<view v-if="mergedShowEye" :class="bem.e('eye')" @click.stop="onEyeClick">
|
|
143
|
+
<sar-icon family="sari" :name="eyeIcon" />
|
|
144
|
+
</view>
|
|
102
145
|
<view v-if="$slots.append" :class="bem.e('append')">
|
|
103
146
|
<slot name="append"></slot>
|
|
104
147
|
</view>
|
|
@@ -164,6 +207,7 @@ import {
|
|
|
164
207
|
* @property {boolean} controlled 是否为受控组件。为 `true` 时,value 内容会完全受 `setData` 控制,默认值:false。
|
|
165
208
|
* @property {boolean} alwaysSystem 是否强制使用系统键盘和 `Web-view `创建的 `input` 元素,默认值:false。
|
|
166
209
|
* @property {boolean} validateEvent 是否触发表单验证,默认值:true。
|
|
210
|
+
* @property {boolean} showEye `type` 为 `password` 时,是否显示眼睛图标按钮,默认值:false。
|
|
167
211
|
* @event {(value: string) => void} update 输入框值改变时触发
|
|
168
212
|
* @event {(value: string) => void} input 输入框值改变时触发
|
|
169
213
|
* @event {(value: string) => void} change 键盘非聚焦状态且内容改变时触发
|
|
@@ -231,6 +275,7 @@ export default _defineComponent({
|
|
|
231
275
|
focused: { type: Boolean, required: false },
|
|
232
276
|
minHeight: { type: String, required: false },
|
|
233
277
|
validateEvent: { type: Boolean, required: false },
|
|
278
|
+
showEye: { type: Boolean, required: false },
|
|
234
279
|
internalPrepend: { type: Number, required: false }
|
|
235
280
|
}, defaultInputProps),
|
|
236
281
|
emits: ["update:model-value", "change", "input", "clear", "focus", "blur", "linechange", "confirm", "keyboardheightchange", "click"],
|
|
@@ -327,6 +372,18 @@ export default _defineComponent({
|
|
|
327
372
|
const onClick = (event) => {
|
|
328
373
|
emit("click", event);
|
|
329
374
|
};
|
|
375
|
+
const isPlainText = ref(false);
|
|
376
|
+
const eyeIcon = computed(() => isPlainText.value ? "eye" : "eye-slash");
|
|
377
|
+
const onEyeClick = () => {
|
|
378
|
+
isPlainText.value = !isPlainText.value;
|
|
379
|
+
};
|
|
380
|
+
const showPassword = computed(() => {
|
|
381
|
+
return props.type === "password" && isPlainText.value === false;
|
|
382
|
+
});
|
|
383
|
+
const mergedShowEye = computed(() => props.type === "password" && props.showEye);
|
|
384
|
+
const mergedType = computed(() => {
|
|
385
|
+
return showPassword.value ? "password" : props.type === "password" ? "text" : props.type;
|
|
386
|
+
});
|
|
330
387
|
const inputClass = computed(() => {
|
|
331
388
|
return classNames(
|
|
332
389
|
bem.b(),
|
|
@@ -365,7 +422,7 @@ export default _defineComponent({
|
|
|
365
422
|
return oldValue;
|
|
366
423
|
}, set oldValue(v) {
|
|
367
424
|
oldValue = v;
|
|
368
|
-
}, onFocus, onBlur, clearVisible, holdupClear, onClearTouchStart, onClearTouchEnd, onClearMouseDown, onClearClick, onLinechange, onConfirm, onKeyboardheightchange, onClick, inputClass, inputStyle, controlStyle, mergedPlaceholderStyle, get classNames() {
|
|
425
|
+
}, onFocus, onBlur, clearVisible, holdupClear, onClearTouchStart, onClearTouchEnd, onClearMouseDown, onClearClick, onLinechange, onConfirm, onKeyboardheightchange, onClick, isPlainText, eyeIcon, onEyeClick, showPassword, mergedShowEye, mergedType, inputClass, inputStyle, controlStyle, mergedPlaceholderStyle, get classNames() {
|
|
369
426
|
return classNames;
|
|
370
427
|
}, SarIcon };
|
|
371
428
|
return __returned__;
|
|
@@ -25,6 +25,12 @@ page,
|
|
|
25
25
|
--sar-input-clear-font-size: 32rpx;
|
|
26
26
|
--sar-input-clear-color: var(--sar-fourth-color);
|
|
27
27
|
|
|
28
|
+
--sar-input-eye-margin-left: 16rpx;
|
|
29
|
+
--sar-input-eye-margin-right: calc(var(--sar-input-padding-x) * -1);
|
|
30
|
+
--sar-input-eye-padding-x: 16rpx;
|
|
31
|
+
--sar-input-eye-font-size: 36rpx;
|
|
32
|
+
--sar-input-eye-color: var(--sar-fourth-color);
|
|
33
|
+
|
|
28
34
|
--sar-input-count-font-size: var(--sar-text-sm);
|
|
29
35
|
--sar-input-count-line-height: var(--sar-leading-tight);
|
|
30
36
|
--sar-input-count-color: var(--sar-tertiary-color);
|
|
@@ -41,6 +41,15 @@ import PickerInput from 'sard-uniapp/components/picker-input/picker-input.vue'
|
|
|
41
41
|
| clearable | 是否显示清空按钮 | boolean | false |
|
|
42
42
|
| placeholder | 输入框占位符内容 | string | - |
|
|
43
43
|
| value-on-clear <sup>1.19.2+</sup> | 设置点击清除按钮后的值 | () => any | () => undefined |
|
|
44
|
+
| arrow <sup>1.22+</sup> | 自定义箭头图标名 | string | 'caret-right' |
|
|
45
|
+
| arrow-family <sup>1.22+</sup> | 自定义箭头图标字体 | string | 'sari' |
|
|
46
|
+
| input-props <sup>1.22+</sup> | 自定义输入框组件属性 | InputProps | - |
|
|
47
|
+
|
|
48
|
+
### PickerInputSlots
|
|
49
|
+
|
|
50
|
+
| 插槽 | 描述 | 属性 |
|
|
51
|
+
| ---------------------- | ---------- | ---------- |
|
|
52
|
+
| arrow <sup>1.22+</sup> | 自定义箭头 | () => void |
|
|
44
53
|
|
|
45
54
|
### PickerSlots
|
|
46
55
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PopoutInputProps } from '../popout-input/common';
|
|
1
|
+
import { type PopoutInputSlots, type PopoutInputProps } from '../popout-input/common';
|
|
2
2
|
import { type PickerPopoutSlots, type PickerPopoutEmits, type PickerPopoutProps } from '../picker-popout/common';
|
|
3
3
|
export interface PickerInputProps extends PickerPopoutProps, Omit<PopoutInputProps, 'modelValue'> {
|
|
4
4
|
valueOnClear?: () => any;
|
|
@@ -9,7 +9,7 @@ export declare const defaultPickerInputProps: () => {
|
|
|
9
9
|
columns: () => never[];
|
|
10
10
|
immediateChange: boolean;
|
|
11
11
|
};
|
|
12
|
-
export interface PickerInputSlots extends PickerPopoutSlots {
|
|
12
|
+
export interface PickerInputSlots extends PickerPopoutSlots, PopoutInputSlots {
|
|
13
13
|
}
|
|
14
14
|
export interface PickerInputEmits extends PickerPopoutEmits {
|
|
15
15
|
}
|
|
@@ -7,9 +7,16 @@
|
|
|
7
7
|
:clearable="clearable"
|
|
8
8
|
:root-class="rootClass"
|
|
9
9
|
:root-style="rootStyle"
|
|
10
|
+
:arrow="arrow"
|
|
11
|
+
:internal-arrow="$slots.arrow ? 1 : 0"
|
|
12
|
+
:input-props="inputProps"
|
|
10
13
|
@clear="onClear"
|
|
11
14
|
@click="show"
|
|
12
15
|
>
|
|
16
|
+
<template v-if="$slots.arrow" #arrow>
|
|
17
|
+
<slot name="arrow"></slot>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
13
20
|
<sar-picker-popout
|
|
14
21
|
v-model:visible="innerVisible"
|
|
15
22
|
v-model="innerValue"
|
|
@@ -83,6 +90,9 @@ import {
|
|
|
83
90
|
* @property {boolean} clearable 是否显示清空按钮,默认值:false。
|
|
84
91
|
* @property {string} placeholder 输入框占位符内容,默认值:-。
|
|
85
92
|
* @property {() => any} valueOnClear 设置点击清除按钮后的值,默认值:() => undefined。
|
|
93
|
+
* @property {string} arrow 自定义箭头图标名,默认值:'caret-right'。
|
|
94
|
+
* @property {string} arrowFamily 自定义箭头图标字体,默认值:'sari'。
|
|
95
|
+
* @property {InputProps} inputProps 自定义输入框组件属性,默认值:-。
|
|
86
96
|
* @event {(visible: boolean) => void} update 弹出框显隐时触发
|
|
87
97
|
* @event {(value: any) => void} change 选择器输入组件值改变时触发
|
|
88
98
|
*/
|
|
@@ -117,7 +127,11 @@ export default _defineComponent({
|
|
|
117
127
|
disabled: { type: Boolean, required: false },
|
|
118
128
|
clearable: { type: Boolean, required: false },
|
|
119
129
|
loading: { type: Boolean, required: false },
|
|
120
|
-
multiline: { type: Boolean, required: false }
|
|
130
|
+
multiline: { type: Boolean, required: false },
|
|
131
|
+
arrow: { type: String, required: false },
|
|
132
|
+
arrowFamily: { type: String, required: false },
|
|
133
|
+
internalArrow: { type: Number, required: false },
|
|
134
|
+
inputProps: { type: Object, required: false }
|
|
121
135
|
}, defaultPickerInputProps()),
|
|
122
136
|
emits: ["update:visible", "update:model-value", "change"],
|
|
123
137
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -27,17 +27,26 @@ import PopoutInput from 'sard-uniapp/components/popout-input/popout-input.vue'
|
|
|
27
27
|
|
|
28
28
|
### PopoutInputProps
|
|
29
29
|
|
|
30
|
-
| 属性
|
|
31
|
-
|
|
|
32
|
-
| root-class
|
|
33
|
-
| root-style
|
|
34
|
-
| model-value
|
|
35
|
-
| placeholder
|
|
36
|
-
| disabled
|
|
37
|
-
| readonly
|
|
38
|
-
| loading
|
|
39
|
-
| clearable
|
|
40
|
-
| multiline
|
|
30
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
31
|
+
| ----------------------------- | -------------------- | ---------- | ------------- |
|
|
32
|
+
| root-class | 组件根元素类名 | string | - |
|
|
33
|
+
| root-style | 组件根元素样式 | StyleValue | - |
|
|
34
|
+
| model-value | 输入框值 | string | - |
|
|
35
|
+
| placeholder | 输入框占位符内容 | string | - |
|
|
36
|
+
| disabled | 禁用状态 | boolean | false |
|
|
37
|
+
| readonly | 只读状态 | boolean | false |
|
|
38
|
+
| loading | 加载状态 | boolean | false |
|
|
39
|
+
| clearable | 是否显示清空按钮 | boolean | false |
|
|
40
|
+
| multiline | 是否多行输入框 | boolean | false |
|
|
41
|
+
| arrow <sup>1.22+</sup> | 自定义箭头图标名 | string | 'caret-right' |
|
|
42
|
+
| arrow-family <sup>1.22+</sup> | 自定义箭头图标字体 | string | 'sari' |
|
|
43
|
+
| input-props <sup>1.22+</sup> | 自定义输入框组件属性 | InputProps | - |
|
|
44
|
+
|
|
45
|
+
### PopoutInputSlots
|
|
46
|
+
|
|
47
|
+
| 插槽 | 描述 | 属性 |
|
|
48
|
+
| ---------------------- | ---------- | ---------- |
|
|
49
|
+
| arrow <sup>1.22+</sup> | 自定义箭头 | () => void |
|
|
41
50
|
|
|
42
51
|
### PopoutInputEmits
|
|
43
52
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type StyleValue } from 'vue';
|
|
2
|
+
import { type InputProps } from '../input';
|
|
2
3
|
export interface PopoutInputProps {
|
|
3
4
|
rootStyle?: StyleValue;
|
|
4
5
|
rootClass?: string;
|
|
@@ -9,7 +10,15 @@ export interface PopoutInputProps {
|
|
|
9
10
|
clearable?: boolean;
|
|
10
11
|
loading?: boolean;
|
|
11
12
|
multiline?: boolean;
|
|
13
|
+
arrow?: string;
|
|
14
|
+
arrowFamily?: string;
|
|
15
|
+
internalArrow?: number;
|
|
16
|
+
inputProps?: InputProps;
|
|
12
17
|
}
|
|
18
|
+
export declare const defaultPopoutInputProps: {
|
|
19
|
+
arrow: string;
|
|
20
|
+
arrowFamily: string;
|
|
21
|
+
};
|
|
13
22
|
export interface PopoutInputEmits {
|
|
14
23
|
(e: 'click', event: any): void;
|
|
15
24
|
(e: 'update:model-value', value: string): void;
|
|
@@ -17,4 +26,5 @@ export interface PopoutInputEmits {
|
|
|
17
26
|
(e: 'clear'): void;
|
|
18
27
|
}
|
|
19
28
|
export interface PopoutInputSlots {
|
|
29
|
+
'arrow'(): any;
|
|
20
30
|
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { defaultConfig } from '../config';
|
|
2
|
+
export const defaultPopoutInputProps = defaultConfig.popoutInput;
|
|
@@ -2,6 +2,7 @@ import { type PopoutInputProps } from './common';
|
|
|
2
2
|
declare function __VLS_template(): {
|
|
3
3
|
prepend?(_: {}): any;
|
|
4
4
|
append?(_: {}): any;
|
|
5
|
+
arrow?(_: {}): any;
|
|
5
6
|
default?(_: {}): any;
|
|
6
7
|
};
|
|
7
8
|
declare const __VLS_component: import("vue").DefineComponent<PopoutInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
@@ -14,7 +15,10 @@ declare const __VLS_component: import("vue").DefineComponent<PopoutInputProps, {
|
|
|
14
15
|
onClick?: ((event: any) => any) | undefined;
|
|
15
16
|
onChange?: ((value: string) => any) | undefined;
|
|
16
17
|
onClear?: (() => any) | undefined;
|
|
17
|
-
}>, {
|
|
18
|
+
}>, {
|
|
19
|
+
arrow: string;
|
|
20
|
+
arrowFamily: string;
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
22
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
19
23
|
export default _default;
|
|
20
24
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
<sar-input
|
|
4
4
|
inlaid
|
|
5
5
|
:model-value="innerValue"
|
|
6
|
-
@change="onChange"
|
|
7
6
|
:placeholder="placeholder"
|
|
8
7
|
:readonly="isReadonly"
|
|
9
8
|
:disabled="isDisabled"
|
|
@@ -13,7 +12,9 @@
|
|
|
13
12
|
:auto-height="multiline"
|
|
14
13
|
:input-min-height="multiline"
|
|
15
14
|
:internal-prepend="$slots.prepend ? 1 : 0"
|
|
15
|
+
v-bind="inputProps"
|
|
16
16
|
@clear="onClear"
|
|
17
|
+
@change="onChange"
|
|
17
18
|
>
|
|
18
19
|
<template #prepend>
|
|
19
20
|
<slot name="prepend"></slot>
|
|
@@ -21,11 +22,15 @@
|
|
|
21
22
|
<template #append>
|
|
22
23
|
<slot name="append"></slot>
|
|
23
24
|
<view :class="bem.e('append')">
|
|
24
|
-
<view :class="bem.e('loading')"
|
|
25
|
+
<view v-if="loading" :class="bem.e('loading')">
|
|
25
26
|
<sar-loading />
|
|
26
27
|
</view>
|
|
27
28
|
<view v-if="!isReadonly" :class="bem.e('arrow')">
|
|
28
|
-
<
|
|
29
|
+
<slot
|
|
30
|
+
v-if="internalArrow !== 0 && $slots.arrow"
|
|
31
|
+
name="arrow"
|
|
32
|
+
></slot>
|
|
33
|
+
<sar-icon v-else :family="arrowFamily" :name="arrow" />
|
|
29
34
|
</view>
|
|
30
35
|
</view>
|
|
31
36
|
</template>
|
|
@@ -46,12 +51,15 @@
|
|
|
46
51
|
</template>
|
|
47
52
|
|
|
48
53
|
<script>
|
|
49
|
-
import { defineComponent as _defineComponent } from "vue";
|
|
54
|
+
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
50
55
|
import { computed, ref, watch } from "vue";
|
|
51
56
|
import { classNames, stringifyStyle, createBem } from "../../utils";
|
|
52
57
|
import SarInput from "../input/input.vue";
|
|
53
58
|
import SarIcon from "../icon/icon.vue";
|
|
54
59
|
import { useFormContext } from "../form/common";
|
|
60
|
+
import {
|
|
61
|
+
defaultPopoutInputProps
|
|
62
|
+
} from "./common";
|
|
55
63
|
import SarLoading from "../loading/loading.vue";
|
|
56
64
|
/**
|
|
57
65
|
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
@@ -63,6 +71,9 @@ import SarLoading from "../loading/loading.vue";
|
|
|
63
71
|
* @property {boolean} loading 加载状态,默认值:false。
|
|
64
72
|
* @property {boolean} clearable 是否显示清空按钮,默认值:false。
|
|
65
73
|
* @property {boolean} multiline 是否多行输入框,默认值:false。
|
|
74
|
+
* @property {string} arrow 自定义箭头图标名,默认值:'caret-right'。
|
|
75
|
+
* @property {string} arrowFamily 自定义箭头图标字体,默认值:'sari'。
|
|
76
|
+
* @property {InputProps} inputProps 自定义输入框组件属性,默认值:-。
|
|
66
77
|
* @event {() => void} click 点击输入框时触发,只读和禁用不触发
|
|
67
78
|
* @event {(value: string) => void} update 输入框值改变时触发
|
|
68
79
|
* @event {(value: string) => void} change 输入框值改变时触发
|
|
@@ -81,7 +92,7 @@ export default _defineComponent({
|
|
|
81
92
|
}
|
|
82
93
|
},
|
|
83
94
|
__name: "popout-input",
|
|
84
|
-
props:
|
|
95
|
+
props: _mergeDefaults({
|
|
85
96
|
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
86
97
|
rootClass: { type: String, required: false },
|
|
87
98
|
modelValue: { type: null, required: false },
|
|
@@ -90,8 +101,12 @@ export default _defineComponent({
|
|
|
90
101
|
disabled: { type: Boolean, required: false },
|
|
91
102
|
clearable: { type: Boolean, required: false },
|
|
92
103
|
loading: { type: Boolean, required: false },
|
|
93
|
-
multiline: { type: Boolean, required: false }
|
|
94
|
-
|
|
104
|
+
multiline: { type: Boolean, required: false },
|
|
105
|
+
arrow: { type: String, required: false },
|
|
106
|
+
arrowFamily: { type: String, required: false },
|
|
107
|
+
internalArrow: { type: Number, required: false },
|
|
108
|
+
inputProps: { type: Object, required: false }
|
|
109
|
+
}, defaultPopoutInputProps),
|
|
95
110
|
emits: ["click", "update:model-value", "change", "clear"],
|
|
96
111
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
97
112
|
__expose();
|
|
@@ -28,16 +28,17 @@ import Popup from 'sard-uniapp/components/popup/popup.vue'
|
|
|
28
28
|
|
|
29
29
|
### PopupProps
|
|
30
30
|
|
|
31
|
-
| 属性
|
|
32
|
-
|
|
|
33
|
-
| root-class
|
|
34
|
-
| root-style
|
|
35
|
-
| visible
|
|
36
|
-
| duration
|
|
37
|
-
| effect
|
|
38
|
-
| overlay
|
|
39
|
-
| background
|
|
40
|
-
| transparent
|
|
31
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
32
|
+
| --------------------------------- | ---------------------- | ---------------------------------------------------------------------------------- | ------ |
|
|
33
|
+
| root-class | 组件根元素类名 | string | - |
|
|
34
|
+
| root-style | 组件根元素样式 | StyleValue | - |
|
|
35
|
+
| visible (v-model) | 是否可见 | boolean | false |
|
|
36
|
+
| duration | 显隐动画时长,单位 ms | number | 300 |
|
|
37
|
+
| effect | 显隐效果 | 'slide-top' \| 'slide-right' \| 'slide-bottom' \| 'slide-left' \| 'zoom' \| 'fade' | 'fade' |
|
|
38
|
+
| overlay | 是否显示遮罩 | boolean | true |
|
|
39
|
+
| background | 遮罩背景色 | string | - |
|
|
40
|
+
| transparent | 透明遮罩 | boolean | false |
|
|
41
|
+
| overlay-closable <sup>1.22+</sup> | 是否在点击遮罩层后关闭 | boolean | true |
|
|
41
42
|
|
|
42
43
|
### PopupSlots
|
|
43
44
|
|
|
@@ -47,18 +48,19 @@ import Popup from 'sard-uniapp/components/popup/popup.vue'
|
|
|
47
48
|
|
|
48
49
|
### PopupEmits
|
|
49
50
|
|
|
50
|
-
| 事件
|
|
51
|
-
|
|
|
52
|
-
| overlay-click
|
|
53
|
-
| visible-hook
|
|
54
|
-
| before-enter
|
|
55
|
-
| enter
|
|
56
|
-
| after-enter
|
|
57
|
-
| enter-cancelled
|
|
58
|
-
| before-leave
|
|
59
|
-
| leave
|
|
60
|
-
| after-leave
|
|
61
|
-
| leave-cancelled
|
|
51
|
+
| 事件 | 描述 | 类型 |
|
|
52
|
+
| ------------------------------- | --------------------------- | ---------------------------------- |
|
|
53
|
+
| overlay-click | 点击遮罩时触发 | (event: any) => void |
|
|
54
|
+
| visible-hook | 入场/退场动画状态改变时触发 | (name: TransitionHookName) => void |
|
|
55
|
+
| before-enter | 入场动画开始前触发 | () => void |
|
|
56
|
+
| enter | 入场动画开始时触发 | () => void |
|
|
57
|
+
| after-enter | 入场动画结束时触发 | () => void |
|
|
58
|
+
| enter-cancelled | 入场动画取消时触发 | () => void |
|
|
59
|
+
| before-leave | 退场动画开始前触发 | () => void |
|
|
60
|
+
| leave | 退场动画开始时触发 | () => void |
|
|
61
|
+
| after-leave | 退场动画结束时触发 | () => void |
|
|
62
|
+
| leave-cancelled | 退场动画取消时触发 | () => void |
|
|
63
|
+
| update:visible <sup>1.22+</sup> | 显隐时触发 | (visible: boolean) => void |
|
|
62
64
|
|
|
63
65
|
## 主题定制
|
|
64
66
|
|
|
@@ -12,11 +12,13 @@ export interface PopupProps {
|
|
|
12
12
|
background?: string;
|
|
13
13
|
transparent?: boolean;
|
|
14
14
|
keepRender?: boolean;
|
|
15
|
+
overlayClosable?: boolean;
|
|
15
16
|
}
|
|
16
17
|
export declare const defaultPopupProps: {
|
|
17
18
|
duration: number;
|
|
18
19
|
effect: PopupProps["effect"];
|
|
19
20
|
overlay: boolean;
|
|
21
|
+
overlayClosable: boolean;
|
|
20
22
|
};
|
|
21
23
|
export interface PopupSlots {
|
|
22
24
|
default?(props: Record<string, never>): any;
|
|
@@ -45,6 +47,7 @@ export interface TransitionHookCallbacks {
|
|
|
45
47
|
}
|
|
46
48
|
export interface PopupEmits extends TransitionHookEmits {
|
|
47
49
|
(e: 'overlay-click', event: any): void;
|
|
50
|
+
(e: 'update:visible', visible: boolean): void;
|
|
48
51
|
}
|
|
49
52
|
export interface PopupContext {
|
|
50
53
|
visibleState: TransitionHookName | undefined;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type PopupProps, type PopupSlots } from './common';
|
|
2
|
-
declare
|
|
3
|
-
|
|
2
|
+
declare const _default: {
|
|
3
|
+
mounted(): void;
|
|
4
|
+
};
|
|
5
|
+
// export default _default;
|
|
6
|
+
declare const _default_1: __VLS_WithTemplateSlots<import("vue").DefineComponent<PopupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
4
7
|
[x: string]: any;
|
|
5
8
|
} & {
|
|
6
9
|
[x: string]: any;
|
|
@@ -10,9 +13,9 @@ declare const __VLS_component: import("vue").DefineComponent<PopupProps, {}, {},
|
|
|
10
13
|
effect: "slide-top" | "slide-right" | "slide-bottom" | "slide-left" | "zoom" | "fade" | "full-fade";
|
|
11
14
|
duration: number;
|
|
12
15
|
overlay: boolean;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export default
|
|
16
|
+
overlayClosable: boolean;
|
|
17
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, Readonly<PopupSlots> & PopupSlots>;
|
|
18
|
+
export default _default_1;
|
|
16
19
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
17
20
|
new (): {
|
|
18
21
|
$slots: S;
|
|
@@ -65,6 +65,7 @@ import {
|
|
|
65
65
|
* @property {boolean} overlay 是否显示遮罩,默认值:true。
|
|
66
66
|
* @property {string} background 遮罩背景色,默认值:-。
|
|
67
67
|
* @property {boolean} transparent 透明遮罩,默认值:false。
|
|
68
|
+
* @property {boolean} overlayClosable 是否在点击遮罩层后关闭,默认值:true。
|
|
68
69
|
* @event {(event: any) => void} overlay-click 点击遮罩时触发
|
|
69
70
|
* @event {(name: TransitionHookName) => void} visible-hook 入场/退场动画状态改变时触发
|
|
70
71
|
* @event {() => void} before-enter 入场动画开始前触发
|
|
@@ -75,6 +76,7 @@ import {
|
|
|
75
76
|
* @event {() => void} leave 退场动画开始时触发
|
|
76
77
|
* @event {() => void} after-leave 退场动画结束时触发
|
|
77
78
|
* @event {() => void} leave-cancelled 退场动画取消时触发
|
|
79
|
+
* @event {(visible: boolean) => void} update 显隐时触发
|
|
78
80
|
*/
|
|
79
81
|
export default _defineComponent({
|
|
80
82
|
components: {
|
|
@@ -99,9 +101,10 @@ export default _defineComponent({
|
|
|
99
101
|
overlayStyle: { type: String, required: false },
|
|
100
102
|
background: { type: String, required: false },
|
|
101
103
|
transparent: { type: Boolean, required: false },
|
|
102
|
-
keepRender: { type: Boolean, required: false }
|
|
104
|
+
keepRender: { type: Boolean, required: false },
|
|
105
|
+
overlayClosable: { type: Boolean, required: false }
|
|
103
106
|
}, defaultPopupProps),
|
|
104
|
-
emits: ["overlay-click", "before-enter", "enter", "after-enter", "enter-cancelled", "before-leave", "leave", "after-leave", "leave-cancelled", "visible-hook"],
|
|
107
|
+
emits: ["overlay-click", "update:visible", "before-enter", "enter", "after-enter", "enter-cancelled", "before-leave", "leave", "after-leave", "leave-cancelled", "visible-hook"],
|
|
105
108
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
106
109
|
__expose();
|
|
107
110
|
const props = __props;
|
|
@@ -133,6 +136,9 @@ export default _defineComponent({
|
|
|
133
136
|
);
|
|
134
137
|
const onOverlayClick = (event) => {
|
|
135
138
|
emit("overlay-click", event);
|
|
139
|
+
if (props.overlayClosable) {
|
|
140
|
+
emit("update:visible", false);
|
|
141
|
+
}
|
|
136
142
|
};
|
|
137
143
|
const pageVisible = ref(true);
|
|
138
144
|
onShow(() => {
|
|
@@ -167,6 +173,23 @@ export default _defineComponent({
|
|
|
167
173
|
});
|
|
168
174
|
</script>
|
|
169
175
|
|
|
176
|
+
<!-- #ifdef APP-PLUS -->
|
|
177
|
+
<script module="render" lang="renderjs">
|
|
178
|
+
// @ts-expect-error ignore renderjs
|
|
179
|
+
export default {
|
|
180
|
+
mounted() {
|
|
181
|
+
const root = document.querySelector('uni-app') || document.body
|
|
182
|
+
// @ts-expect-error ignore renderjs
|
|
183
|
+
if (this.$ownerInstance.$el) {
|
|
184
|
+
// @ts-expect-error ignore renderjs
|
|
185
|
+
root.appendChild(this.$ownerInstance.$el)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
</script>
|
|
190
|
+
<!-- #endif -->
|
|
191
|
+
|
|
192
|
+
|
|
170
193
|
<style lang="scss">
|
|
171
194
|
@import './index.scss';
|
|
172
195
|
</style>
|
|
@@ -38,6 +38,15 @@ import RadioInput from 'sard-uniapp/components/radio-input/radio-input.vue'
|
|
|
38
38
|
| clearable | 是否显示清空按钮 | boolean | false |
|
|
39
39
|
| placeholder | 输入框占位符内容 | string | - |
|
|
40
40
|
| value-on-clear <sup>1.19.2+</sup> | 设置点击清除按钮后的值 | () => any | () => undefined |
|
|
41
|
+
| arrow <sup>1.22+</sup> | 自定义箭头图标名 | string | 'caret-right' |
|
|
42
|
+
| arrow-family <sup>1.22+</sup> | 自定义箭头图标字体 | string | 'sari' |
|
|
43
|
+
| input-props <sup>1.22+</sup> | 自定义输入框组件属性 | InputProps | - |
|
|
44
|
+
|
|
45
|
+
### RadioInputSlots
|
|
46
|
+
|
|
47
|
+
| 插槽 | 描述 | 属性 |
|
|
48
|
+
| ---------------------- | ---------- | ---------- |
|
|
49
|
+
| arrow <sup>1.22+</sup> | 自定义箭头 | () => void |
|
|
41
50
|
|
|
42
51
|
### RadioInputEmits
|
|
43
52
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RadioGroupOption } from '../radio/common';
|
|
2
|
-
import { type PopoutInputProps } from '../popout-input/common';
|
|
2
|
+
import { type PopoutInputSlots, type PopoutInputProps } from '../popout-input/common';
|
|
3
3
|
import { type RadioPopoutEmits, type RadioPopoutProps } from '../radio-popout/common';
|
|
4
4
|
export type RadioInputOption = RadioGroupOption;
|
|
5
5
|
export interface RadioInputProps extends RadioPopoutProps, Omit<PopoutInputProps, 'modelValue'> {
|
|
@@ -11,5 +11,7 @@ export declare const defaultRadioInputProps: () => {
|
|
|
11
11
|
validateEvent: boolean;
|
|
12
12
|
type: RadioPopoutProps["type"];
|
|
13
13
|
};
|
|
14
|
+
export interface RadioInputSlots extends PopoutInputSlots {
|
|
15
|
+
}
|
|
14
16
|
export interface RadioInputEmits extends RadioPopoutEmits {
|
|
15
17
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type RadioInputProps } from './common';
|
|
2
|
-
declare
|
|
1
|
+
import { type RadioInputProps, type RadioInputSlots } from './common';
|
|
2
|
+
declare function __VLS_template(): Readonly<RadioInputSlots> & RadioInputSlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<RadioInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
3
4
|
"update:model-value": (value: any) => any;
|
|
4
5
|
change: (value: any) => any;
|
|
5
6
|
"update:visible": (visible: boolean) => any;
|
|
@@ -13,4 +14,10 @@ declare const _default: import("vue").DefineComponent<RadioInputProps, {}, {}, {
|
|
|
13
14
|
valueOnClear: () => any;
|
|
14
15
|
validateEvent: boolean;
|
|
15
16
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
16
18
|
export default _default;
|
|
19
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
20
|
+
new (): {
|
|
21
|
+
$slots: S;
|
|
22
|
+
};
|
|
23
|
+
};
|