sard-uniapp 1.19.4 → 1.20.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 +31 -0
- package/README.md +1 -1
- package/components/calendar/README.md +20 -20
- package/components/calendar/calendar.vue +1 -1
- package/components/calendar-input/README.md +10 -10
- package/components/calendar-input/calendar-input.vue +2 -2
- package/components/calendar-month/calendar-month.vue +17 -21
- package/components/calendar-popout/calendar-popout.vue +1 -1
- package/components/card/README.md +16 -8
- package/components/card/card.vue +7 -1
- package/components/card/common.d.ts +2 -0
- package/components/card/index.scss +30 -2
- package/components/card/variables.scss +16 -1
- package/components/checkbox/common.d.ts +1 -0
- package/components/checkbox/common.js +1 -0
- package/components/checkbox-input/checkbox-input.vue +9 -0
- package/components/checkbox-popout/README.md +27 -6
- package/components/checkbox-popout/checkbox-popout.vue +113 -47
- package/components/checkbox-popout/common.d.ts +3 -0
- package/components/checkbox-popout/index.scss +16 -0
- package/components/config/index.d.ts +6 -0
- package/components/config/index.js +6 -0
- package/components/datetime-picker/README.md +1 -71
- package/components/datetime-picker/common.d.ts +1 -0
- package/components/datetime-picker/common.js +21 -8
- package/components/datetime-picker/datetime-picker.vue +3 -3
- package/components/datetime-picker-input/README.md +10 -10
- package/components/datetime-picker-input/datetime-picker-input.vue +2 -2
- package/components/datetime-picker-popout/datetime-picker-popout.vue +1 -1
- package/components/datetime-range-picker/datetime-range-picker.vue +12 -10
- package/components/datetime-range-picker-input/README.md +10 -10
- package/components/datetime-range-picker-input/datetime-range-picker-input.vue +2 -2
- package/components/datetime-range-picker-popout/README.md +0 -6
- package/components/datetime-range-picker-popout/datetime-range-picker-popout.vue +11 -8
- package/components/floating-bubble/floating-bubble.vue +3 -3
- package/components/form/README.md +19 -19
- package/components/form/form.vue +2 -4
- package/components/form-item/form-item.vue +12 -0
- package/components/icon/icon.d.ts +1 -1
- package/components/indexes/README.md +4 -0
- package/components/indexes-nav/indexes-nav.vue +2 -2
- package/components/keyboard/common.d.ts +1 -2
- package/components/keyboard/common.js +2 -11
- package/components/keyboard/keyboard.d.ts +2 -2
- package/components/list-item/index.scss +4 -0
- package/components/locale/index.d.ts +4 -0
- package/components/locale/index.js +14 -1
- package/components/locale/lang/en-US.d.ts +4 -0
- package/components/locale/lang/en-US.js +4 -0
- package/components/locale/lang/zh-CN.d.ts +4 -0
- package/components/locale/lang/zh-CN.js +4 -0
- package/components/marquee/README.md +8 -2
- package/components/marquee/marquee.vue +9 -1
- package/components/notice-bar/README.md +8 -2
- package/components/notice-bar/notice-bar.vue +14 -8
- package/components/notify/notify.d.ts +1 -1
- package/components/notify-agent/notify-agent.d.ts +1 -1
- package/components/pagination/pagination.vue +2 -2
- package/components/popover/utils.js +4 -4
- package/components/pull-down-refresh/common.d.ts +1 -1
- package/components/radio/common.d.ts +1 -0
- package/components/radio/common.js +1 -0
- package/components/radio-input/radio-input.vue +6 -0
- package/components/radio-popout/README.md +20 -6
- package/components/radio-popout/common.d.ts +2 -0
- package/components/radio-popout/index.scss +4 -0
- package/components/radio-popout/radio-popout.vue +91 -45
- package/components/read-more/README.md +82 -0
- package/components/read-more/common.d.ts +24 -0
- package/components/read-more/common.js +2 -0
- package/components/read-more/index.d.ts +1 -0
- package/components/read-more/index.js +1 -0
- package/components/read-more/index.scss +41 -0
- package/components/read-more/read-more.d.ts +20 -0
- package/components/read-more/read-more.vue +168 -0
- package/components/read-more/variables.scss +12 -0
- package/components/resize-sensor/README.md +55 -0
- package/components/resize-sensor/common.d.ts +19 -0
- package/components/resize-sensor/common.js +2 -0
- package/components/resize-sensor/index.d.ts +1 -0
- package/components/resize-sensor/index.js +1 -0
- package/components/resize-sensor/index.scss +33 -0
- package/components/resize-sensor/resize-sensor.d.ts +16 -0
- package/components/resize-sensor/resize-sensor.vue +152 -0
- package/components/scroll-list/README.md +79 -0
- package/components/scroll-list/common.d.ts +23 -0
- package/components/scroll-list/common.js +1 -0
- package/components/scroll-list/index.d.ts +1 -0
- package/components/scroll-list/index.js +1 -0
- package/components/scroll-list/index.scss +35 -0
- package/components/scroll-list/scroll-list.d.ts +20 -0
- package/components/scroll-list/scroll-list.vue +158 -0
- package/components/scroll-list/variables.scss +11 -0
- package/components/sidebar/README.md +8 -8
- package/components/sidebar/sidebar.vue +1 -1
- package/components/slider/slider.vue +4 -4
- package/components/stepper/stepper.vue +2 -2
- package/components/sticky/README.md +92 -0
- package/components/sticky/common.d.ts +15 -0
- package/components/sticky/common.js +1 -0
- package/components/sticky/index.d.ts +1 -0
- package/components/sticky/index.js +1 -0
- package/components/sticky/index.scss +18 -0
- package/components/sticky/sticky.d.ts +10 -0
- package/components/sticky/sticky.vue +190 -0
- package/components/sticky-box/common.d.ts +19 -0
- package/components/sticky-box/common.js +1 -0
- package/components/sticky-box/index.d.ts +1 -0
- package/components/sticky-box/index.js +1 -0
- package/components/sticky-box/index.scss +19 -0
- package/components/sticky-box/sticky-box.d.ts +10 -0
- package/components/sticky-box/sticky-box.vue +82 -0
- package/components/style/mixins/border.scss +101 -38
- package/components/style/variables-dark.scss +4 -0
- package/components/style/variables.scss +8 -0
- package/components/table/table.vue +2 -1
- package/components/table-fixation/table-fixation.vue +2 -1
- package/components/toast/toast.d.ts +1 -1
- package/components/toast-agent/toast-agent.d.ts +1 -1
- package/components/tree/tree.d.ts +1 -1
- package/components/tree-node/tree-node.vue +2 -2
- package/components/upload/README.md +23 -15
- package/components/upload/common.d.ts +6 -4
- package/components/upload/upload.d.ts +2 -0
- package/components/upload/upload.vue +51 -13
- package/components/upload/utils.d.ts +1 -0
- package/components/upload/utils.js +2 -0
- package/components/upload-preview/index.scss +1 -0
- package/components/upload-preview/upload-preview.d.ts +6 -4
- package/components/upload-preview/upload-preview.vue +17 -24
- package/global.d.ts +5 -0
- package/index.d.ts +5 -0
- package/index.js +5 -0
- package/index.scss +2 -0
- package/package.json +4 -2
- package/use/index.d.ts +4 -0
- package/use/index.js +4 -0
- package/use/useIndeterminate.d.ts +10 -0
- package/use/useIndeterminate.js +27 -0
- package/use/useIntersectionObserver.d.ts +16 -0
- package/use/useIntersectionObserver.js +52 -0
- package/use/useSimulatedClick.js +2 -2
- package/use/useSimulatedPress.js +2 -2
- package/use/useSingleTask.d.ts +6 -0
- package/use/useSingleTask.js +40 -0
- package/use/useWindowResize.d.ts +4 -0
- package/use/useWindowResize.js +15 -0
- package/utils/array.d.ts +28 -0
- package/utils/array.js +90 -0
- package/utils/common.d.ts +3 -0
- package/utils/common.js +1 -0
- package/utils/date.d.ts +84 -11
- package/utils/date.js +120 -63
- package/utils/dom.js +2 -0
- package/utils/geometry.d.ts +56 -38
- package/utils/geometry.js +56 -30
- package/utils/index.d.ts +8 -1
- package/utils/index.js +8 -1
- package/utils/is.d.ts +12 -0
- package/utils/is.js +16 -0
- package/utils/number.d.ts +24 -0
- package/utils/number.js +37 -0
- package/utils/object.d.ts +29 -0
- package/utils/object.js +139 -0
- package/utils/persist.d.ts +15 -0
- package/utils/persist.js +89 -0
- package/utils/physics.d.ts +34 -0
- package/utils/physics.js +66 -0
- package/utils/request.d.ts +227 -0
- package/utils/request.js +249 -0
- package/utils/router.d.ts +47 -0
- package/utils/router.js +115 -0
- package/utils/string.d.ts +46 -0
- package/utils/string.js +134 -0
- package/utils/url-query.d.ts +19 -0
- package/utils/url-query.js +95 -0
- package/utils/utils.d.ts +0 -166
- package/utils/utils.js +0 -441
- package/utils/case.d.ts +0 -4
- package/utils/case.js +0 -26
|
@@ -33,11 +33,11 @@ import SarDatetimeRangePicker from "../datetime-range-picker/datetime-range-pick
|
|
|
33
33
|
import {
|
|
34
34
|
defaultDatetimeRangePickerInputProps
|
|
35
35
|
} from "./common";
|
|
36
|
-
import {
|
|
36
|
+
import { isEmptyBinding, toDate } from "../../utils";
|
|
37
37
|
import {
|
|
38
|
-
getInitialValue,
|
|
39
38
|
getMaxDate,
|
|
40
|
-
getMinDate
|
|
39
|
+
getMinDate,
|
|
40
|
+
normalizeRangeValue
|
|
41
41
|
} from "../datetime-picker/common";
|
|
42
42
|
import { useFormPopout } from "../../use";
|
|
43
43
|
/**
|
|
@@ -50,7 +50,7 @@ import { useFormPopout } from "../../use";
|
|
|
50
50
|
* @property {(Date | string)[]} modelValue 绑定的值,默认值:-。
|
|
51
51
|
* @property {(letter: DatetimeLetter, value: number, date: Date, index: number) => boolean} filter 选项的过滤函数,默认值:-。
|
|
52
52
|
* @property {(letter: DatetimeLetter, option: DatetimeColumnOption, date: Date, index: number) => string | void |undefined} formatter 选项的格式化函数,默认值:-。
|
|
53
|
-
* @property {string [详见特殊符号](../
|
|
53
|
+
* @property {string [详见特殊符号](../utilities/date#日期格式特殊符号)} valueFormat 绑定值的格式,不指定则绑定值为 Date 对象,默认值:-。
|
|
54
54
|
* @property {string[]} tabs 设置起始和结束标签页标题,默认值:-。
|
|
55
55
|
* @property {string} popoutClass 弹窗框根元素类名,默认值:-。
|
|
56
56
|
* @property {StyleValue} popoutStyle 弹窗框根元素样式,默认值:-。
|
|
@@ -104,10 +104,13 @@ export default _defineComponent({
|
|
|
104
104
|
});
|
|
105
105
|
const { innerVisible, innerValue, popoutValue, onChange, onConfirm } = useFormPopout(props, emit, {
|
|
106
106
|
onConfirmBefore() {
|
|
107
|
-
if (!popoutValue.value) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
if (!popoutValue.value || Array.isArray(popoutValue.value) && popoutValue.value.filter(Boolean).length < 2) {
|
|
108
|
+
popoutValue.value = normalizeRangeValue(
|
|
109
|
+
minDate.value,
|
|
110
|
+
maxDate.value,
|
|
111
|
+
popoutValue.value,
|
|
112
|
+
props.valueFormat
|
|
113
|
+
);
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
116
|
});
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
getBoundingClientRect,
|
|
24
24
|
uniqid,
|
|
25
25
|
getWindowInfo,
|
|
26
|
-
|
|
26
|
+
clamp
|
|
27
27
|
} from "../../utils";
|
|
28
28
|
import {
|
|
29
29
|
defaultFloatingBubbleProps
|
|
@@ -132,8 +132,8 @@ export default _defineComponent({
|
|
|
132
132
|
const deltaY = event.touches[0].clientY - downCoord.y;
|
|
133
133
|
x = bubbleRect.left + deltaX;
|
|
134
134
|
y = bubbleRect.top + deltaY;
|
|
135
|
-
x =
|
|
136
|
-
y =
|
|
135
|
+
x = clamp(x, getMinX(), getMaxX());
|
|
136
|
+
y = clamp(y, getMinY(), getMaxY());
|
|
137
137
|
if (props.axis === "y") {
|
|
138
138
|
x = getMaxX();
|
|
139
139
|
} else if (props.axis === "x") {
|
|
@@ -160,25 +160,25 @@ import FormItem from 'sard-uniapp/components/form-item/form-item.vue'
|
|
|
160
160
|
|
|
161
161
|
### FormProps
|
|
162
162
|
|
|
163
|
-
| 属性 | 描述 | 类型
|
|
164
|
-
| ------------------------ | ---------------------------------------------------------------------------------- |
|
|
165
|
-
| root-class | 组件根元素类名 | string
|
|
166
|
-
| root-style | 组件根元素样式 | StyleValue
|
|
167
|
-
| model | 表单数据对象 | Record\<string, any>
|
|
168
|
-
| rules | 表单验证规则 | FormRules
|
|
169
|
-
| validate-trigger | 设置字段校验的时机 | TriggerType
|
|
170
|
-
| validate-on-rule-change | 是否在 `rules` 属性改变后立即触发一次验证 | boolean
|
|
171
|
-
| direction | 表单排列方向 | 'horizontal' \| 'vertical'
|
|
172
|
-
| label-width | 标签宽度 | string
|
|
173
|
-
| label-align | 标签水平对齐方式 | 'start' \| 'center' \| 'end'
|
|
174
|
-
| label-valign | 标签垂直对齐方式 | 'start' \| 'center' \| 'end'
|
|
175
|
-
| star-position | 必填星号在标签的左边或右边 | 'left' \| 'right'
|
|
176
|
-
| hide-star | 是否隐藏必填时的星号 | boolean
|
|
177
|
-
| show-error | 是否显示校验错误信息 | boolean
|
|
178
|
-
| scroll-to-first-error | 当校验失败时,滚动到第一个错误表单项 | boolean
|
|
179
|
-
| scroll-into-view-options | 自定义滚动配置选项 | [ScrollIntoViewOptions](../
|
|
180
|
-
| disabled | 是否禁用该表单内的所有组件。 如果设置为 `true`, 它将覆盖内部组件的 `disabled` 属性 | boolean
|
|
181
|
-
| readonly | 是否只读该表单内的所有组件。 如果设置为 `true`, 它将覆盖内部组件的 `readonly` 属性 | boolean
|
|
163
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
164
|
+
| ------------------------ | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------- |
|
|
165
|
+
| root-class | 组件根元素类名 | string | - |
|
|
166
|
+
| root-style | 组件根元素样式 | StyleValue | - |
|
|
167
|
+
| model | 表单数据对象 | Record\<string, any> | - |
|
|
168
|
+
| rules | 表单验证规则 | FormRules | - |
|
|
169
|
+
| validate-trigger | 设置字段校验的时机 | TriggerType | change |
|
|
170
|
+
| validate-on-rule-change | 是否在 `rules` 属性改变后立即触发一次验证 | boolean | true |
|
|
171
|
+
| direction | 表单排列方向 | 'horizontal' \| 'vertical' | 'horizontal' |
|
|
172
|
+
| label-width | 标签宽度 | string | - |
|
|
173
|
+
| label-align | 标签水平对齐方式 | 'start' \| 'center' \| 'end' | 'start' |
|
|
174
|
+
| label-valign | 标签垂直对齐方式 | 'start' \| 'center' \| 'end' | 'start' |
|
|
175
|
+
| star-position | 必填星号在标签的左边或右边 | 'left' \| 'right' | 'left' |
|
|
176
|
+
| hide-star | 是否隐藏必填时的星号 | boolean | false |
|
|
177
|
+
| show-error | 是否显示校验错误信息 | boolean | true |
|
|
178
|
+
| scroll-to-first-error | 当校验失败时,滚动到第一个错误表单项 | boolean | false |
|
|
179
|
+
| scroll-into-view-options | 自定义滚动配置选项 | [ScrollIntoViewOptions](../utilities/geometry#ScrollIntoViewOptions) | {position: 'nearest', startOffset: 0, endOffset: 0} |
|
|
180
|
+
| disabled | 是否禁用该表单内的所有组件。 如果设置为 `true`, 它将覆盖内部组件的 `disabled` 属性 | boolean | false |
|
|
181
|
+
| readonly | 是否只读该表单内的所有组件。 如果设置为 `true`, 它将覆盖内部组件的 `readonly` 属性 | boolean | false |
|
|
182
182
|
|
|
183
183
|
### FormSlots
|
|
184
184
|
|
package/components/form/form.vue
CHANGED
|
@@ -36,7 +36,7 @@ import { useTranslate } from "../locale";
|
|
|
36
36
|
* @property {boolean} hideStar 是否隐藏必填时的星号,默认值:false。
|
|
37
37
|
* @property {boolean} showError 是否显示校验错误信息,默认值:true。
|
|
38
38
|
* @property {boolean} scrollToFirstError 当校验失败时,滚动到第一个错误表单项,默认值:false。
|
|
39
|
-
* @property {[ScrollIntoViewOptions](../
|
|
39
|
+
* @property {[ScrollIntoViewOptions](../utilities/geometry#ScrollIntoViewOptions)} scrollIntoViewOptions 自定义滚动配置选项,默认值:{position: 'nearest', startOffset: 0, endOffset: 0}。
|
|
40
40
|
* @property {boolean} disabled 是否禁用该表单内的所有组件。 如果设置为 `true`, 它将覆盖内部组件的 `disabled` 属性,默认值:false。
|
|
41
41
|
* @property {boolean} readonly 是否只读该表单内的所有组件。 如果设置为 `true`, 它将覆盖内部组件的 `readonly` 属性,默认值:false。
|
|
42
42
|
*/
|
|
@@ -150,9 +150,7 @@ export default _defineComponent({
|
|
|
150
150
|
validate().catch(noop);
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
|
-
{
|
|
154
|
-
deep: true
|
|
155
|
-
}
|
|
153
|
+
{ deep: true, flush: "post" }
|
|
156
154
|
);
|
|
157
155
|
provide(
|
|
158
156
|
formContextSymbol,
|
|
@@ -129,6 +129,18 @@ export default _defineComponent({
|
|
|
129
129
|
validateState.value = props.error ? "error" : "";
|
|
130
130
|
}
|
|
131
131
|
);
|
|
132
|
+
watch(
|
|
133
|
+
() => props.rules,
|
|
134
|
+
() => {
|
|
135
|
+
if (validateMessage.value) {
|
|
136
|
+
validate().catch(noop);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
deep: true,
|
|
141
|
+
flush: "post"
|
|
142
|
+
}
|
|
143
|
+
);
|
|
132
144
|
const shouldShowError = computed(() => {
|
|
133
145
|
return props.showError && formContext.showError && validateMessage.value;
|
|
134
146
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type IconProps } from './common';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<IconProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IconProps> & Readonly<{}>, {
|
|
3
|
-
separate: boolean;
|
|
4
3
|
name: string;
|
|
4
|
+
separate: boolean;
|
|
5
5
|
family: string;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
export default _default;
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
createBem,
|
|
47
47
|
uniqid,
|
|
48
48
|
getBoundingClientRect,
|
|
49
|
-
|
|
49
|
+
clamp
|
|
50
50
|
} from "../../utils";
|
|
51
51
|
import { useMouseDown, useTransition } from "../../use";
|
|
52
52
|
import { defaultConfig } from "../config";
|
|
@@ -106,7 +106,7 @@ export default _defineComponent({
|
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
const offsetY = touch.clientY - navRect.value.top;
|
|
109
|
-
const itemIndex =
|
|
109
|
+
const itemIndex = clamp(
|
|
110
110
|
Math.floor(offsetY / itemSize),
|
|
111
111
|
0,
|
|
112
112
|
props.anchors.length - 1
|
|
@@ -23,5 +23,4 @@ export declare const digitKeys: string[];
|
|
|
23
23
|
export declare const idcardKeys: string[];
|
|
24
24
|
export declare const chineseKeys: string[];
|
|
25
25
|
export declare const englishKeys: string[];
|
|
26
|
-
export declare function
|
|
27
|
-
export declare function getRandomKeys(): any[];
|
|
26
|
+
export declare function getRandomKeys(): string[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defaultConfig } from '../config';
|
|
2
|
+
import { shuffle } from '../../utils';
|
|
2
3
|
export const defaultKeyboardProps = defaultConfig.keyboard;
|
|
3
4
|
export const numberKeys = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];
|
|
4
5
|
export const digitKeys = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '0'];
|
|
@@ -92,16 +93,6 @@ export const englishKeys = [
|
|
|
92
93
|
'N',
|
|
93
94
|
'M',
|
|
94
95
|
];
|
|
95
|
-
export function shuffle(arr) {
|
|
96
|
-
const newArr = arr.slice();
|
|
97
|
-
for (let i = arr.length - 1; i >= 0; i--) {
|
|
98
|
-
const randomIndex = ~~(Math.random() * (i + 1));
|
|
99
|
-
const randomItem = newArr[randomIndex];
|
|
100
|
-
newArr[randomIndex] = newArr[i];
|
|
101
|
-
newArr[i] = randomItem;
|
|
102
|
-
}
|
|
103
|
-
return newArr;
|
|
104
|
-
}
|
|
105
96
|
export function getRandomKeys() {
|
|
106
|
-
return shuffle(numberKeys);
|
|
97
|
+
return shuffle(numberKeys.slice());
|
|
107
98
|
}
|
|
@@ -4,11 +4,11 @@ declare const __VLS_component: import("vue").DefineComponent<KeyboardProps, {
|
|
|
4
4
|
shuffle: () => void;
|
|
5
5
|
toggle: () => void;
|
|
6
6
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
7
|
-
input: (key: string) => any;
|
|
8
7
|
delete: () => any;
|
|
8
|
+
input: (key: string) => any;
|
|
9
9
|
}, string, import("vue").PublicProps, Readonly<KeyboardProps> & Readonly<{
|
|
10
|
-
onInput?: ((key: string) => any) | undefined;
|
|
11
10
|
onDelete?: (() => any) | undefined;
|
|
11
|
+
onInput?: ((key: string) => any) | undefined;
|
|
12
12
|
}>, {
|
|
13
13
|
type: "number" | "digit" | "idcard" | "random" | "plate";
|
|
14
14
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -58,6 +58,8 @@
|
|
|
58
58
|
flex: auto;
|
|
59
59
|
font-size: var(--sar-list-item-title-font-size);
|
|
60
60
|
line-height: var(--sar-list-item-title-line-height);
|
|
61
|
+
word-wrap: break-word;
|
|
62
|
+
word-break: break-word;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
@include e(description) {
|
|
@@ -66,6 +68,8 @@
|
|
|
66
68
|
font-size: var(--sar-list-item-description-font-size);
|
|
67
69
|
line-height: var(--sar-list-item-description-line-height);
|
|
68
70
|
color: var(--sar-list-item-description-color);
|
|
71
|
+
word-wrap: break-word;
|
|
72
|
+
word-break: break-word;
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
@include e(value) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type App, type InjectionKey, type Ref } from 'vue';
|
|
1
2
|
export declare const currentLocale: import("vue").ShallowRef<Record<string, any>, Record<string, any>>;
|
|
2
3
|
export interface LocaleTranslate {
|
|
3
4
|
(chainOrData?: string | Record<string, number | string>, data?: Record<string, number | string>): string;
|
|
@@ -8,3 +9,6 @@ export declare function useTranslate(prefix?: string): {
|
|
|
8
9
|
select: (chain?: string) => any;
|
|
9
10
|
};
|
|
10
11
|
export declare function setLocale(locale: Record<string, any>): void;
|
|
12
|
+
export declare const localeContextSymbol: InjectionKey<Ref<string>>;
|
|
13
|
+
export declare function useLocaleProvide<T extends Record<string, any>>(app: App, languages: T, defaultLocale: keyof T): void;
|
|
14
|
+
export declare function useLocale(): Ref<string, string> | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowRef, computed } from 'vue';
|
|
1
|
+
import { shallowRef, computed, inject, ref, watch, } from 'vue';
|
|
2
2
|
import zhCN from './lang/zh-CN';
|
|
3
3
|
import { chainGet } from '../../utils';
|
|
4
4
|
export const currentLocale = shallowRef(zhCN);
|
|
@@ -42,3 +42,16 @@ export function useTranslate(prefix = '') {
|
|
|
42
42
|
export function setLocale(locale) {
|
|
43
43
|
currentLocale.value = locale;
|
|
44
44
|
}
|
|
45
|
+
export const localeContextSymbol = Symbol('locale-context');
|
|
46
|
+
export function useLocaleProvide(app, languages, defaultLocale) {
|
|
47
|
+
const locale = ref(defaultLocale);
|
|
48
|
+
watch(locale, () => {
|
|
49
|
+
setLocale(languages[locale.value]);
|
|
50
|
+
}, {
|
|
51
|
+
immediate: true,
|
|
52
|
+
});
|
|
53
|
+
app.provide(localeContextSymbol, locale);
|
|
54
|
+
}
|
|
55
|
+
export function useLocale() {
|
|
56
|
+
return inject(localeContextSymbol);
|
|
57
|
+
}
|
|
@@ -29,10 +29,16 @@ import Marquee from 'sard-uniapp/components/marquee/marquee.vue'
|
|
|
29
29
|
`Marquee` 组件是通过 `animation` 来实现高效的滚动动画的,
|
|
30
30
|
会根据内容高度或宽度动态设置动画时长,以实现固定速率滚动。
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
@info
|
|
33
|
+
|
|
34
|
+
在 <sup>1.20</sup>之前,如果 `Marquee` 挂载时机比插槽内容靠前,即插槽内容数据需要通过接口异步获取再渲染的,
|
|
33
35
|
需要手动调用 `update` 方法来更新动画时长。
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
在 <sup>1.20</sup>之后,会监听内容尺寸变化,自动调用更新方法,无需手动调用。
|
|
38
|
+
|
|
39
|
+
@endinfo
|
|
40
|
+
|
|
41
|
+
@code('${DEMO_PATH}/marquee/demo/Async.vue')
|
|
36
42
|
|
|
37
43
|
### 水平方向
|
|
38
44
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<view :class="marqueeClass" :style="marqueeStyle">
|
|
3
3
|
<view :id="wrapperId" :class="bem.e('wrapper')" :style="wrapperStyle">
|
|
4
4
|
<slot></slot>
|
|
5
|
+
<sar-resize-sensor @resize="onResize" />
|
|
5
6
|
</view>
|
|
6
7
|
</view>
|
|
7
8
|
</template>
|
|
@@ -16,6 +17,7 @@ import {
|
|
|
16
17
|
uniqid,
|
|
17
18
|
getBoundingClientRect
|
|
18
19
|
} from "../../utils";
|
|
20
|
+
import SarResizeSensor from "../resize-sensor/resize-sensor.vue";
|
|
19
21
|
import {
|
|
20
22
|
defaultMarqueeProps
|
|
21
23
|
} from "./common";
|
|
@@ -28,6 +30,9 @@ import { useTimeout } from "../../use";
|
|
|
28
30
|
* @property {number} delay 挂载后,延迟动画时间(单位 ms),避免进入页面时卡顿,默认值:1000。
|
|
29
31
|
*/
|
|
30
32
|
export default _defineComponent({
|
|
33
|
+
components: {
|
|
34
|
+
SarResizeSensor,
|
|
35
|
+
},
|
|
31
36
|
...{
|
|
32
37
|
options: {
|
|
33
38
|
virtualHost: true,
|
|
@@ -65,6 +70,9 @@ export default _defineComponent({
|
|
|
65
70
|
onMounted(() => {
|
|
66
71
|
updateLater();
|
|
67
72
|
});
|
|
73
|
+
const onResize = () => {
|
|
74
|
+
update();
|
|
75
|
+
};
|
|
68
76
|
__expose({
|
|
69
77
|
update
|
|
70
78
|
});
|
|
@@ -80,7 +88,7 @@ export default _defineComponent({
|
|
|
80
88
|
animationPlayState: duration.value ? "running" : "paused"
|
|
81
89
|
});
|
|
82
90
|
});
|
|
83
|
-
const __returned__ = { props, bem, instance, wrapperId, duration, update, updateLater, marqueeClass, marqueeStyle, wrapperStyle };
|
|
91
|
+
const __returned__ = { props, bem, instance, wrapperId, duration, update, updateLater, onResize, marqueeClass, marqueeStyle, wrapperStyle, SarResizeSensor };
|
|
84
92
|
return __returned__;
|
|
85
93
|
}
|
|
86
94
|
});
|
|
@@ -28,10 +28,16 @@ import NoticeBar from 'sard-uniapp/components/notice-bar/notice-bar.vue'
|
|
|
28
28
|
`NoticeBar` 组件是通过 `animation` 来实现高效的滚动动画的,
|
|
29
29
|
会根据内容宽度动态设置动画时长,以实现固定速率滚动。
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
@info
|
|
32
|
+
|
|
33
|
+
在 <sup>1.20</sup>之前, 如果 `NoticeBar` 挂载时机比插槽内容靠前,即插槽内容数据需要通过接口异步获取再渲染的,
|
|
32
34
|
需要手动调用 `update` 方法来更新动画时长。
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
在 <sup>1.20</sup>之后,会监听内容尺寸变化,自动调用更新方法,无需手动调用。
|
|
37
|
+
|
|
38
|
+
@endinfo
|
|
39
|
+
|
|
40
|
+
@code('${DEMO_PATH}/notice-bar/demo/Async.vue')
|
|
35
41
|
|
|
36
42
|
### 强制滚动
|
|
37
43
|
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
@animationend="onAnimationEnd"
|
|
14
14
|
>
|
|
15
15
|
<slot></slot>
|
|
16
|
+
<sar-resize-sensor @resize="onResize" />
|
|
16
17
|
</view>
|
|
17
18
|
</view>
|
|
18
19
|
<view
|
|
@@ -41,6 +42,7 @@ import {
|
|
|
41
42
|
getBoundingClientRect
|
|
42
43
|
} from "../../utils";
|
|
43
44
|
import SarIcon from "../icon/icon.vue";
|
|
45
|
+
import SarResizeSensor from "../resize-sensor/resize-sensor.vue";
|
|
44
46
|
import {
|
|
45
47
|
defaultNoticeBarProps
|
|
46
48
|
} from "./common";
|
|
@@ -65,6 +67,7 @@ import { useTimeout } from "../../use";
|
|
|
65
67
|
export default _defineComponent({
|
|
66
68
|
components: {
|
|
67
69
|
SarIcon,
|
|
70
|
+
SarResizeSensor,
|
|
68
71
|
},
|
|
69
72
|
...{
|
|
70
73
|
options: {
|
|
@@ -130,13 +133,6 @@ export default _defineComponent({
|
|
|
130
133
|
firstLap.value = false;
|
|
131
134
|
}
|
|
132
135
|
};
|
|
133
|
-
const innerVisible = ref(props.visible);
|
|
134
|
-
const onRightIconClick = () => {
|
|
135
|
-
if (props.closable) {
|
|
136
|
-
innerVisible.value = false;
|
|
137
|
-
emit("close");
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
136
|
const { start: updateLater } = useTimeout(
|
|
141
137
|
() => {
|
|
142
138
|
update();
|
|
@@ -148,6 +144,16 @@ export default _defineComponent({
|
|
|
148
144
|
updateLater();
|
|
149
145
|
}
|
|
150
146
|
});
|
|
147
|
+
const onResize = () => {
|
|
148
|
+
update();
|
|
149
|
+
};
|
|
150
|
+
const innerVisible = ref(props.visible);
|
|
151
|
+
const onRightIconClick = () => {
|
|
152
|
+
if (props.closable) {
|
|
153
|
+
innerVisible.value = false;
|
|
154
|
+
emit("close");
|
|
155
|
+
}
|
|
156
|
+
};
|
|
151
157
|
const onClick = (event) => {
|
|
152
158
|
emit("click", event);
|
|
153
159
|
};
|
|
@@ -181,7 +187,7 @@ export default _defineComponent({
|
|
|
181
187
|
animationDuration: `${firstLap.value ? wrapperData.value.first : wrapperData.value.later}ms`
|
|
182
188
|
});
|
|
183
189
|
});
|
|
184
|
-
const __returned__ = { props, emit, bem, instance, contentId, wrapperId, shouldScroll, wrapperData, getWidth, update, firstLap, onAnimationEnd, innerVisible, onRightIconClick,
|
|
190
|
+
const __returned__ = { props, emit, bem, instance, contentId, wrapperId, shouldScroll, wrapperData, getWidth, update, firstLap, onAnimationEnd, updateLater, onResize, innerVisible, onRightIconClick, onClick, noticeBarClass, noticeBarStyle, wrapperStyle, SarIcon, SarResizeSensor };
|
|
185
191
|
return __returned__;
|
|
186
192
|
}
|
|
187
193
|
});
|
|
@@ -9,9 +9,9 @@ declare const _default: import("vue").DefineComponent<NotifyProps, {
|
|
|
9
9
|
onClick?: ((event: any) => any) | undefined;
|
|
10
10
|
"onUpdate:visible"?: ((event: any) => any) | undefined;
|
|
11
11
|
}>, {
|
|
12
|
+
timeout: number;
|
|
12
13
|
type: "primary" | "success" | "warning" | "error";
|
|
13
14
|
position: "top" | "bottom";
|
|
14
15
|
duration: number;
|
|
15
|
-
timeout: number;
|
|
16
16
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
17
|
export default _default;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type NotifyAgentProps } from './common';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<NotifyAgentProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NotifyAgentProps> & Readonly<{}>, {
|
|
3
|
+
timeout: number;
|
|
3
4
|
type: "primary" | "success" | "warning" | "error";
|
|
4
5
|
id: string;
|
|
5
6
|
position: "top" | "bottom";
|
|
6
7
|
duration: number;
|
|
7
|
-
timeout: number;
|
|
8
8
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
9
|
export default _default;
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
<script>
|
|
50
50
|
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
51
51
|
import { computed, ref, watch } from "vue";
|
|
52
|
-
import { classNames, stringifyStyle, createBem,
|
|
52
|
+
import { classNames, stringifyStyle, createBem, clamp } from "../../utils";
|
|
53
53
|
import { useTranslate } from "../locale";
|
|
54
54
|
import {
|
|
55
55
|
getPageRange,
|
|
@@ -145,7 +145,7 @@ export default _defineComponent({
|
|
|
145
145
|
const isPrevMulti = i === 0 && page !== 1;
|
|
146
146
|
const isNextMulti = i === length - 1 && page !== innerPageCount.value;
|
|
147
147
|
const type = isPrevMulti ? -1 : isNextMulti ? 1 : 0;
|
|
148
|
-
page = type === 0 ? page :
|
|
148
|
+
page = type === 0 ? page : clamp(
|
|
149
149
|
innerCurrent.value + type * props.multiCount,
|
|
150
150
|
1,
|
|
151
151
|
innerPageCount.value
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getWindowInfo,
|
|
1
|
+
import { getWindowInfo, clamp } from '../../utils';
|
|
2
2
|
const directions = ['top', 'right', 'bottom', 'left'];
|
|
3
3
|
function getReverseDirection(direction) {
|
|
4
4
|
const index = directions.indexOf(direction);
|
|
@@ -77,7 +77,7 @@ export function getPopoverPosition(refRect, popperRect, { refGap, position, view
|
|
|
77
77
|
};
|
|
78
78
|
const offset = strategies[side]();
|
|
79
79
|
// 确保处于屏幕内
|
|
80
|
-
return
|
|
80
|
+
return clamp(offset, viewportGap, axisWindowSize - popperRect[axisSizeName] - viewportGap);
|
|
81
81
|
}
|
|
82
82
|
function getDirectionOffset() {
|
|
83
83
|
const strategies = {
|
|
@@ -96,7 +96,7 @@ export function getPopoverPosition(refRect, popperRect, { refGap, position, view
|
|
|
96
96
|
};
|
|
97
97
|
const offset = strategies[direction]();
|
|
98
98
|
// 确保处于屏幕内
|
|
99
|
-
return
|
|
99
|
+
return clamp(offset, viewportGap, crossAxisWindowSize - popperRect[crossAxisSizeName] - viewportGap);
|
|
100
100
|
}
|
|
101
101
|
popperStyle[crossAxis] = getDirectionOffset();
|
|
102
102
|
popperStyle[axis] = getSideOffset();
|
|
@@ -120,7 +120,7 @@ export function getPopoverPosition(refRect, popperRect, { refGap, position, view
|
|
|
120
120
|
Math.max(refRect[axis], finalPopperRect[axis]);
|
|
121
121
|
const offset = extra + intersection / 2;
|
|
122
122
|
// 确保箭头位于popper之内
|
|
123
|
-
return
|
|
123
|
+
return clamp(offset, arrowSize, popperRect[axisSizeName] - arrowSize);
|
|
124
124
|
}
|
|
125
125
|
arrowStyle[axis] = getArrowOffset();
|
|
126
126
|
arrowStyle[crossAxis] = getArrowCrossOffset(direction, popperRect);
|
|
@@ -19,7 +19,7 @@ export declare const defaultPullDownRefreshProps: () => {
|
|
|
19
19
|
doneDuration: number;
|
|
20
20
|
};
|
|
21
21
|
export declare const pullDownRefreshProps: {
|
|
22
|
-
rootStyle: (
|
|
22
|
+
rootStyle: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
|
|
23
23
|
rootClass: StringConstructor;
|
|
24
24
|
threshold: {
|
|
25
25
|
type: NumberConstructor;
|
|
@@ -2,6 +2,7 @@ import { defaultConfig } from '../config';
|
|
|
2
2
|
export const defaultOptionKeys = {
|
|
3
3
|
label: 'label',
|
|
4
4
|
value: 'value',
|
|
5
|
+
disabled: 'disabled',
|
|
5
6
|
};
|
|
6
7
|
export const defaultRadioGroupProps = defaultConfig.radioGroup;
|
|
7
8
|
export const radioContextSymbol = Symbol('radio-context');
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
:options="options"
|
|
24
24
|
:option-keys="optionKeys"
|
|
25
25
|
:validate-event="validateEvent"
|
|
26
|
+
:searchable="searchable"
|
|
27
|
+
:filter-placeholder="filterPlaceholder"
|
|
26
28
|
@change="onChange"
|
|
27
29
|
/>
|
|
28
30
|
</sar-popout-input>
|
|
@@ -56,6 +58,8 @@ import { usePopoutInput } from "../../use";
|
|
|
56
58
|
* @property {StyleValue} popoutStyle 弹窗框根元素样式,默认值:-。
|
|
57
59
|
* @property {boolean} visible 是否显示弹出框,默认值:-。
|
|
58
60
|
* @property {string} title 弹出框标题,默认值:-。
|
|
61
|
+
* @property {boolean} searchable 是否可搜索,默认值:false。
|
|
62
|
+
* @property {string} filterPlaceholder 搜索输入框占位符内容,默认值:-。
|
|
59
63
|
* @property {boolean} clearable 是否显示清空按钮,默认值:false。
|
|
60
64
|
* @property {string} placeholder 输入框占位符内容,默认值:-。
|
|
61
65
|
* @property {() => any} valueOnClear 设置点击清除按钮后的值,默认值:() => undefined。
|
|
@@ -80,6 +84,8 @@ export default _defineComponent({
|
|
|
80
84
|
title: { type: String, required: false },
|
|
81
85
|
popoutClass: { type: String, required: false },
|
|
82
86
|
popoutStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
87
|
+
searchable: { type: Boolean, required: false },
|
|
88
|
+
filterPlaceholder: { type: String, required: false },
|
|
83
89
|
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
84
90
|
rootClass: { type: String, required: false },
|
|
85
91
|
modelValue: { type: null, required: false },
|