sard-uniapp 1.1.0-beta.1 → 1.1.0-rc.1
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 +6 -0
- package/components/_template/{index.vue → _template.vue} +1 -1
- package/components/config/index.d.ts +14 -0
- package/components/config/index.js +7 -0
- package/components/load-more/common.d.ts +33 -0
- package/components/load-more/common.js +12 -0
- package/components/load-more/index.d.ts +1 -0
- package/components/load-more/index.js +1 -0
- package/components/load-more/index.scss +17 -0
- package/components/load-more/load-more.vue +65 -0
- package/components/load-more/variables.scss +7 -0
- package/components/locale/lang/zh-CN.d.ts +6 -0
- package/components/locale/lang/zh-CN.js +6 -0
- package/components/pull-down-refresh/common.d.ts +5 -0
- package/components/pull-down-refresh/common.js +10 -4
- package/components/pull-down-refresh/pull-down-refresh.vue +2 -1
- package/components/pull-down-refresh/wx.wxs +5 -1
- package/components/stepper/common.d.ts +5 -0
- package/components/stepper/common.js +5 -0
- package/components/stepper/index.scss +15 -1
- package/components/stepper/stepper.vue +2 -1
- package/components/stepper/variables.scss +8 -4
- package/global.d.ts +2 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.scss +1 -0
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
## 1.1.0-rc.1 (2024-04-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
1
6
|
## 1.1.0-beta.1 (2024-04-06)
|
|
2
7
|
|
|
8
|
+
* feat: 新增pull-down-refresh组件, slider组件新增时间, 重构loading组件, 其他优化 ([802816a](https://github.com/sutras/sard-uniapp/commit/802816a))
|
|
3
9
|
* docs: update quickstart.md ([fa280f6](https://github.com/sutras/sard-uniapp/commit/fa280f6))
|
|
4
10
|
* build: 新增changelog构建流程 ([e1e862d](https://github.com/sutras/sard-uniapp/commit/e1e862d))
|
|
5
11
|
|
|
@@ -173,6 +173,12 @@ export declare const defaultConfig: {
|
|
|
173
173
|
percent: number;
|
|
174
174
|
thickness: number;
|
|
175
175
|
};
|
|
176
|
+
pullDownRefresh: {
|
|
177
|
+
threshold: number;
|
|
178
|
+
headerHeight: number;
|
|
179
|
+
transitionDuration: number;
|
|
180
|
+
doneDuration: number;
|
|
181
|
+
};
|
|
176
182
|
radioGroup: {
|
|
177
183
|
direction: string;
|
|
178
184
|
validateEvent: boolean;
|
|
@@ -212,6 +218,7 @@ export declare const defaultConfig: {
|
|
|
212
218
|
pressTime: number;
|
|
213
219
|
interval: number;
|
|
214
220
|
validateEvent: boolean;
|
|
221
|
+
size: string;
|
|
215
222
|
};
|
|
216
223
|
steps: {
|
|
217
224
|
current: number;
|
|
@@ -478,6 +485,12 @@ export declare function useConfigContext(): DeepPartial<{
|
|
|
478
485
|
percent: number;
|
|
479
486
|
thickness: number;
|
|
480
487
|
};
|
|
488
|
+
pullDownRefresh: {
|
|
489
|
+
threshold: number;
|
|
490
|
+
headerHeight: number;
|
|
491
|
+
transitionDuration: number;
|
|
492
|
+
doneDuration: number;
|
|
493
|
+
};
|
|
481
494
|
radioGroup: {
|
|
482
495
|
direction: string;
|
|
483
496
|
validateEvent: boolean;
|
|
@@ -517,6 +530,7 @@ export declare function useConfigContext(): DeepPartial<{
|
|
|
517
530
|
pressTime: number;
|
|
518
531
|
interval: number;
|
|
519
532
|
validateEvent: boolean;
|
|
533
|
+
size: string;
|
|
520
534
|
};
|
|
521
535
|
steps: {
|
|
522
536
|
current: number;
|
|
@@ -174,6 +174,12 @@ export const defaultConfig = {
|
|
|
174
174
|
percent: 0,
|
|
175
175
|
thickness: 4,
|
|
176
176
|
},
|
|
177
|
+
pullDownRefresh: {
|
|
178
|
+
threshold: 50,
|
|
179
|
+
headerHeight: 50,
|
|
180
|
+
transitionDuration: 300,
|
|
181
|
+
doneDuration: 0,
|
|
182
|
+
},
|
|
177
183
|
radioGroup: {
|
|
178
184
|
direction: 'vertical',
|
|
179
185
|
validateEvent: true,
|
|
@@ -213,6 +219,7 @@ export const defaultConfig = {
|
|
|
213
219
|
pressTime: 350,
|
|
214
220
|
interval: 150,
|
|
215
221
|
validateEvent: true,
|
|
222
|
+
size: 'medium',
|
|
216
223
|
},
|
|
217
224
|
steps: {
|
|
218
225
|
current: 0,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type PropType, type StyleValue } from 'vue';
|
|
2
|
+
export type LoadMoreStatus = 'incomplete' | 'loading' | 'complete' | 'error';
|
|
3
|
+
export interface LoadMoreProps {
|
|
4
|
+
rootStyle?: StyleValue;
|
|
5
|
+
rootClass?: string;
|
|
6
|
+
status?: LoadMoreStatus;
|
|
7
|
+
incompleteText?: string;
|
|
8
|
+
loadingText?: string;
|
|
9
|
+
completeText?: string;
|
|
10
|
+
errorText?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const loadMoreProps: {
|
|
13
|
+
rootStyle: PropType<StyleValue>;
|
|
14
|
+
rootClass: StringConstructor;
|
|
15
|
+
status: {
|
|
16
|
+
type: PropType<LoadMoreStatus>;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
incompleteText: StringConstructor;
|
|
20
|
+
loadingText: StringConstructor;
|
|
21
|
+
completeText: StringConstructor;
|
|
22
|
+
errorText: StringConstructor;
|
|
23
|
+
};
|
|
24
|
+
export interface LoadMoreSlots {
|
|
25
|
+
incomplete(props: Record<string, never>): any;
|
|
26
|
+
loading(props: Record<string, never>): any;
|
|
27
|
+
complete(props: Record<string, never>): any;
|
|
28
|
+
error(props: Record<string, never>): any;
|
|
29
|
+
}
|
|
30
|
+
export interface LoadMoreEmits {
|
|
31
|
+
(e: 'load-more'): void;
|
|
32
|
+
(e: 'reload'): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { LoadMoreStatus, LoadMoreProps, LoadMoreSlots, LoadMoreEmits, } from './common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@use '../style/base' as *;
|
|
2
|
+
|
|
3
|
+
@include bem(load-more) {
|
|
4
|
+
@include b() {
|
|
5
|
+
@include universal;
|
|
6
|
+
flex-direction: row;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
height: var(--sar-load-more-height);
|
|
10
|
+
font-size: var(--sar-load-more-font-size);
|
|
11
|
+
color: var(--sar-load-more-color);
|
|
12
|
+
|
|
13
|
+
@include m(incomplete, error) {
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="loadMoreClass" :style="loadMoreStyle" @click="onClick">
|
|
3
|
+
<slot v-if="status === 'incomplete'" name="incomplete">
|
|
4
|
+
{{ incompleteText || t('incompleteText') }}
|
|
5
|
+
</slot>
|
|
6
|
+
<slot v-else-if="status === 'loading'" name="loading">
|
|
7
|
+
<sar-loading>
|
|
8
|
+
{{ loadingText || t('loadingText') }}
|
|
9
|
+
</sar-loading>
|
|
10
|
+
</slot>
|
|
11
|
+
<slot v-else-if="status === 'complete'" name="complete">
|
|
12
|
+
{{ completeText || t('completeText') }}
|
|
13
|
+
</slot>
|
|
14
|
+
<slot v-else-if="status === 'error'" name="error">
|
|
15
|
+
{{ errorText || t('errorText') }}
|
|
16
|
+
</slot>
|
|
17
|
+
</view>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
22
|
+
import { computed } from "vue";
|
|
23
|
+
import { classNames, stringifyStyle, createBem } from "../../utils";
|
|
24
|
+
import { loadMoreProps } from "./common";
|
|
25
|
+
import { useTranslate } from "../locale";
|
|
26
|
+
import SarLoading from "../loading/loading.vue";
|
|
27
|
+
const __default__ = {
|
|
28
|
+
options: {
|
|
29
|
+
virtualHost: true,
|
|
30
|
+
styleIsolation: "shared"
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export default /* @__PURE__ */ _defineComponent({
|
|
34
|
+
...__default__,
|
|
35
|
+
__name: "load-more",
|
|
36
|
+
props: loadMoreProps,
|
|
37
|
+
emits: ["load-more", "reload"],
|
|
38
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
39
|
+
__expose();
|
|
40
|
+
const props = __props;
|
|
41
|
+
const emit = __emit;
|
|
42
|
+
const bem = createBem("load-more");
|
|
43
|
+
const { t } = useTranslate("loadMore");
|
|
44
|
+
const onClick = () => {
|
|
45
|
+
if (props.status === "incomplete") {
|
|
46
|
+
emit("load-more");
|
|
47
|
+
} else if (props.status === "error") {
|
|
48
|
+
emit("reload");
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const loadMoreClass = computed(() => {
|
|
52
|
+
return classNames(bem.b(), bem.m(props.status), props.rootClass);
|
|
53
|
+
});
|
|
54
|
+
const loadMoreStyle = computed(() => {
|
|
55
|
+
return stringifyStyle(props.rootStyle);
|
|
56
|
+
});
|
|
57
|
+
const __returned__ = { props, emit, bem, t, onClick, loadMoreClass, loadMoreStyle, SarLoading };
|
|
58
|
+
return __returned__;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<style lang="scss">
|
|
64
|
+
@import './index.scss';
|
|
65
|
+
</style>
|
|
@@ -8,6 +8,7 @@ export interface PullDownRefreshProps {
|
|
|
8
8
|
loading?: boolean;
|
|
9
9
|
transitionDuration?: number;
|
|
10
10
|
doneDuration?: number;
|
|
11
|
+
disabled?: number;
|
|
11
12
|
}
|
|
12
13
|
export declare const pullDownRefreshProps: {
|
|
13
14
|
rootStyle: PropType<StyleValue>;
|
|
@@ -32,6 +33,10 @@ export declare const pullDownRefreshProps: {
|
|
|
32
33
|
type: NumberConstructor;
|
|
33
34
|
default: number;
|
|
34
35
|
};
|
|
36
|
+
disabled: {
|
|
37
|
+
type: BooleanConstructor;
|
|
38
|
+
default: boolean;
|
|
39
|
+
};
|
|
35
40
|
};
|
|
36
41
|
export interface PullDownRefreshSlots {
|
|
37
42
|
default(props: Record<string, never>): any;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
+
import { defaultConfig } from '../config';
|
|
1
2
|
// const props = withDefaults(defineProps<PullDownRefreshProps>(), {
|
|
2
3
|
// threshold: 50,
|
|
3
4
|
// headerHeight: 50,
|
|
4
5
|
// loading: false,
|
|
5
6
|
// transitionDuration: 300,
|
|
6
7
|
// doneDuration: 0,
|
|
8
|
+
// disabled: false,
|
|
7
9
|
// })
|
|
8
10
|
export const pullDownRefreshProps = {
|
|
9
11
|
rootStyle: [String, Object, Array],
|
|
10
12
|
rootClass: String,
|
|
11
13
|
threshold: {
|
|
12
14
|
type: Number,
|
|
13
|
-
default:
|
|
15
|
+
default: defaultConfig.pullDownRefresh.threshold,
|
|
14
16
|
},
|
|
15
17
|
headerHeight: {
|
|
16
18
|
type: Number,
|
|
17
|
-
default:
|
|
19
|
+
default: defaultConfig.pullDownRefresh.headerHeight,
|
|
18
20
|
},
|
|
19
21
|
loading: {
|
|
20
22
|
type: Boolean,
|
|
@@ -22,10 +24,14 @@ export const pullDownRefreshProps = {
|
|
|
22
24
|
},
|
|
23
25
|
transitionDuration: {
|
|
24
26
|
type: Number,
|
|
25
|
-
default:
|
|
27
|
+
default: defaultConfig.pullDownRefresh.transitionDuration,
|
|
26
28
|
},
|
|
27
29
|
doneDuration: {
|
|
28
30
|
type: Number,
|
|
29
|
-
default:
|
|
31
|
+
default: defaultConfig.pullDownRefresh.doneDuration,
|
|
32
|
+
},
|
|
33
|
+
disabled: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
30
36
|
},
|
|
31
37
|
};
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
:data-threshold="threshold"
|
|
41
41
|
:data-headerheight="headerHeight"
|
|
42
42
|
:data-duration="transitionDuration"
|
|
43
|
+
:data-disabled="disabled"
|
|
43
44
|
@touchstart="wxsswipe.onTouchStart"
|
|
44
45
|
@touchmove="wxsswipe.onTouchMove"
|
|
45
46
|
@touchend="wxsswipe.onTouchEnd"
|
|
@@ -143,7 +144,7 @@ export default {
|
|
|
143
144
|
let lockDirection = "";
|
|
144
145
|
const isDragging = ref(false);
|
|
145
146
|
const onTouchStart = (event) => {
|
|
146
|
-
if (status.value !== "initial" || scrollTop.value !== 0) {
|
|
147
|
+
if (props.disabled || status.value !== "initial" || scrollTop.value !== 0) {
|
|
147
148
|
return;
|
|
148
149
|
}
|
|
149
150
|
startX = event.touches[0].clientX;
|
|
@@ -12,7 +12,11 @@ function setStyle(instance, offsetY, duration) {
|
|
|
12
12
|
|
|
13
13
|
function onTouchStart(event) {
|
|
14
14
|
var dataset = event.instance.getDataset()
|
|
15
|
-
if (
|
|
15
|
+
if (
|
|
16
|
+
dataset.disabled ||
|
|
17
|
+
dataset.status !== 'initial' ||
|
|
18
|
+
dataset.scrolltop !== 0
|
|
19
|
+
) {
|
|
16
20
|
return
|
|
17
21
|
}
|
|
18
22
|
startX = event.touches[0].clientX
|
|
@@ -17,6 +17,7 @@ export interface StepperProps {
|
|
|
17
17
|
pressTime?: number;
|
|
18
18
|
interval?: number;
|
|
19
19
|
validateEvent?: boolean;
|
|
20
|
+
size?: 'small' | 'medium';
|
|
20
21
|
}
|
|
21
22
|
export declare const stepperProps: {
|
|
22
23
|
rootStyle: PropType<StyleValue>;
|
|
@@ -60,6 +61,10 @@ export declare const stepperProps: {
|
|
|
60
61
|
type: BooleanConstructor;
|
|
61
62
|
default: boolean;
|
|
62
63
|
};
|
|
64
|
+
size: {
|
|
65
|
+
type: StringConstructor;
|
|
66
|
+
default: string;
|
|
67
|
+
};
|
|
63
68
|
};
|
|
64
69
|
export interface StepperEmits {
|
|
65
70
|
(e: 'update:model-value', value: number | string | undefined): void;
|
|
@@ -8,6 +8,7 @@ import { defaultConfig } from '../config';
|
|
|
8
8
|
// pressTime: 350,
|
|
9
9
|
// interval: 150,
|
|
10
10
|
// validateEvent: true,
|
|
11
|
+
// size: 'medium',
|
|
11
12
|
// })
|
|
12
13
|
export const stepperProps = {
|
|
13
14
|
rootStyle: [String, Object, Array],
|
|
@@ -51,4 +52,8 @@ export const stepperProps = {
|
|
|
51
52
|
type: Boolean,
|
|
52
53
|
default: defaultConfig.stepper.validateEvent,
|
|
53
54
|
},
|
|
55
|
+
size: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: defaultConfig.stepper.size,
|
|
58
|
+
},
|
|
54
59
|
};
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
flex: none;
|
|
16
16
|
justify-content: center;
|
|
17
17
|
align-items: center;
|
|
18
|
-
width: var(--sar-stepper-
|
|
18
|
+
width: var(--sar-stepper-height);
|
|
19
19
|
font-size: var(--sar-stepper-button-font-size);
|
|
20
20
|
background-color: var(--sar-stepper-bg);
|
|
21
21
|
|
|
@@ -72,4 +72,18 @@
|
|
|
72
72
|
color: var(--sar-stepper-input-disabled-color);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
+
|
|
76
|
+
@include m(small) {
|
|
77
|
+
height: var(--sar-stepper-height-sm);
|
|
78
|
+
|
|
79
|
+
@include e(input) {
|
|
80
|
+
width: var(--sar-stepper-input-width-sm);
|
|
81
|
+
font-size: var(--sar-stepper-input-font-size-sm);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@include e(button) {
|
|
85
|
+
width: var(--sar-stepper-height-sm);
|
|
86
|
+
font-size: var(--sar-stepper-button-font-size-sm);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
75
89
|
}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
:placeholder-class="bem.e('placeholder')"
|
|
25
25
|
:value="inputValue"
|
|
26
26
|
:disabled="isDisabled || isReadonly"
|
|
27
|
-
:
|
|
27
|
+
:style="inputStyle"
|
|
28
28
|
@input="onInput"
|
|
29
29
|
@blur="onBlur"
|
|
30
30
|
@focus="onFocus"
|
|
@@ -192,6 +192,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
192
192
|
const stepperClass = computed(() => {
|
|
193
193
|
return classNames(
|
|
194
194
|
bem.b(),
|
|
195
|
+
bem.m(props.size),
|
|
195
196
|
bem.m("disabled", isDisabled.value),
|
|
196
197
|
bem.m("readonly", isReadonly.value),
|
|
197
198
|
props.rootClass
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
// #variables
|
|
2
2
|
page {
|
|
3
|
-
--sar-stepper-height:
|
|
3
|
+
--sar-stepper-height: 64rpx;
|
|
4
4
|
--sar-stepper-gap: 8rpx;
|
|
5
5
|
--sar-stepper-bg: var(--sar-secondary-bg);
|
|
6
6
|
|
|
7
|
-
--sar-stepper-input-width:
|
|
7
|
+
--sar-stepper-input-width: 80rpx;
|
|
8
8
|
--sar-stepper-input-padding-x: 10rpx;
|
|
9
9
|
--sar-stepper-input-font-size: var(--sar-text-base);
|
|
10
10
|
--sar-stepper-input-disabled-color: var(--sar-disabled-color);
|
|
11
11
|
--sar-stepper-placeholder-color: var(--sar-quaternary-color);
|
|
12
12
|
|
|
13
|
-
--sar-stepper-button-
|
|
14
|
-
--sar-stepper-button-font-size: 36rpx;
|
|
13
|
+
--sar-stepper-button-font-size: var(--sar-text-lg);
|
|
15
14
|
--sar-stepper-button-border-radius: var(--sar-rounded-sm);
|
|
16
15
|
--sar-stepper-button-active-bg: var(--sar-active-deep-bg);
|
|
16
|
+
|
|
17
|
+
--sar-stepper-height-sm: 56rpx;
|
|
18
|
+
--sar-stepper-input-width-sm: 64rpx;
|
|
19
|
+
--sar-stepper-input-font-size-sm: var(--sar-text-sm);
|
|
20
|
+
--sar-stepper-button-font-size-sm: var(--sar-text-base);
|
|
17
21
|
}
|
|
18
22
|
// #endvariables
|
package/global.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ import SarKeyboard from './components/keyboard/keyboard.vue'
|
|
|
35
35
|
import SarList from './components/list/list.vue'
|
|
36
36
|
import SarListItem from './components/list-item/list-item.vue'
|
|
37
37
|
import SarLoading from './components/loading/loading.vue'
|
|
38
|
+
import SarLoadMore from './components/load-more/load-more.vue'
|
|
38
39
|
import SarMenu from './components/menu/menu.vue'
|
|
39
40
|
import SarNavbar from './components/navbar/navbar.vue'
|
|
40
41
|
import SarNavbarItem from './components/navbar-item/navbar-item.vue'
|
|
@@ -118,6 +119,7 @@ declare module '@vue/runtime-core' {
|
|
|
118
119
|
SarList: typeof SarList
|
|
119
120
|
SarListItem: typeof SarListItem
|
|
120
121
|
SarLoading: typeof SarLoading
|
|
122
|
+
SarLoadMore: typeof SarLoadMore
|
|
121
123
|
SarMenu: typeof SarMenu
|
|
122
124
|
SarNavbar: typeof SarNavbar
|
|
123
125
|
SarNavbarItem: typeof SarNavbarItem
|
package/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export * from './components/keyboard';
|
|
|
27
27
|
export * from './components/layout';
|
|
28
28
|
export * from './components/list';
|
|
29
29
|
export * from './components/loading';
|
|
30
|
+
export * from './components/load-more';
|
|
30
31
|
export * from './components/locale';
|
|
31
32
|
export * from './components/menu';
|
|
32
33
|
export * from './components/navbar';
|
package/index.js
CHANGED
|
@@ -27,6 +27,7 @@ export * from './components/keyboard';
|
|
|
27
27
|
export * from './components/layout';
|
|
28
28
|
export * from './components/list';
|
|
29
29
|
export * from './components/loading';
|
|
30
|
+
export * from './components/load-more';
|
|
30
31
|
export * from './components/locale';
|
|
31
32
|
export * from './components/menu';
|
|
32
33
|
export * from './components/navbar';
|
package/index.scss
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
@use './components/keyboard/variables.scss' as *;
|
|
21
21
|
@use './components/list/variables.scss' as *;
|
|
22
22
|
@use './components/loading/variables.scss' as *;
|
|
23
|
+
@use './components/load-more/variables.scss' as *;
|
|
23
24
|
@use './components/menu/variables.scss' as *;
|
|
24
25
|
@use './components/navbar/variables.scss' as *;
|
|
25
26
|
@use './components/notice-bar/variables.scss' as *;
|