sard-uniapp 1.1.6 → 1.2.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/README.md +42 -1
- package/changelog.md +18 -0
- package/components/_template/_template.d.ts +6 -4
- package/components/_template/_template.vue +4 -1
- package/components/_template/common.d.ts +3 -0
- package/components/_template/index.d.ts +1 -1
- package/components/button/button.vue +1 -1
- package/components/checkbox/checkbox.d.ts +0 -6
- package/components/checkbox/checkbox.vue +2 -2
- package/components/checkbox/common.d.ts +0 -2
- package/components/checkbox/common.js +1 -5
- package/components/config/index.d.ts +30 -0
- package/components/config/index.js +15 -0
- package/components/count-to/common.d.ts +13 -0
- package/components/count-to/common.js +2 -0
- package/components/count-to/count-to.d.ts +35 -0
- package/components/count-to/count-to.vue +67 -0
- package/components/count-to/index.d.ts +1 -0
- package/components/count-to/index.js +1 -0
- package/components/form/common.d.ts +4 -3
- package/components/form/common.js +1 -2
- package/components/form/form.vue +2 -0
- package/components/form-item/form-item.d.ts +2 -5
- package/components/form-item/form-item.vue +3 -3
- package/components/grid/common.d.ts +2 -0
- package/components/grid-item/grid-item.vue +14 -3
- package/components/indexes/common.d.ts +1 -0
- package/components/indexes/indexes.d.ts +1 -0
- package/components/indexes/indexes.vue +16 -10
- package/components/input/index.scss +6 -0
- package/components/input/input.vue +2 -2
- package/components/marquee/common.d.ts +19 -0
- package/components/marquee/common.js +2 -0
- package/components/marquee/index.d.ts +1 -0
- package/components/marquee/index.js +1 -0
- package/components/marquee/index.scss +43 -0
- package/components/marquee/marquee.d.ts +39 -0
- package/components/marquee/marquee.vue +81 -0
- package/components/marquee/variables.scss +2 -0
- package/components/notice-bar/common.d.ts +3 -0
- package/components/notice-bar/index.d.ts +1 -1
- package/components/notice-bar/notice-bar.d.ts +3 -1
- package/components/notice-bar/notice-bar.vue +10 -5
- package/components/password-input/password-input.vue +2 -2
- package/components/popout-input/popout-input.vue +2 -2
- package/components/radio/common.d.ts +0 -4
- package/components/radio/common.js +0 -4
- package/components/radio/radio.d.ts +3 -12
- package/components/radio/radio.vue +6 -7
- package/components/rate/rate.vue +2 -2
- package/components/search/common.d.ts +3 -0
- package/components/search/search.d.ts +5 -0
- package/components/search/search.vue +10 -5
- package/components/slider/slider.vue +2 -2
- package/components/stepper/index.scss +1 -0
- package/components/stepper/stepper.vue +2 -2
- package/components/style/variables.scss +1 -1
- package/components/switch/switch.vue +2 -2
- package/components/upload/upload.vue +2 -2
- package/global.d.ts +4 -0
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/index.scss +1 -0
- package/package.json +4 -1
- package/use/index.d.ts +4 -0
- package/use/index.js +4 -0
- package/use/useImperative.d.ts +1 -1
- package/use/useLuckyDraw.d.ts +22 -0
- package/use/useLuckyDraw.js +160 -0
- package/use/useLuckyGrid.d.ts +26 -0
- package/use/useLuckyGrid.js +62 -0
- package/use/useLuckyWheel.d.ts +15 -0
- package/use/useLuckyWheel.js +25 -0
- package/use/useSlotMachine.d.ts +16 -0
- package/use/useSlotMachine.js +87 -0
- package/use/useTransition.d.ts +2 -2
- package/utils/utils.d.ts +2 -0
- package/utils/utils.js +8 -0
package/README.md
CHANGED
|
@@ -38,4 +38,45 @@
|
|
|
38
38
|
|
|
39
39
|
## 开源协议
|
|
40
40
|
|
|
41
|
-
本项目基于
|
|
41
|
+
本项目基于 [MIT](https://zh.wikipedia.org/wiki/MIT%E8%A8%B1%E5%8F%AF%E8%AD%89) 协议,请自由地享受和参与开源。
|
|
42
|
+
|
|
43
|
+
## 如何维护
|
|
44
|
+
|
|
45
|
+
### 克隆仓库到本地
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
git clone https://github.com/sutras/sard-uniapp.git
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 全局安装 pnpm(如果未安装)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install -g pnpm
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 使用 pnpm 安装依赖
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pnpm install
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 修改 @dcloudio 源码
|
|
64
|
+
|
|
65
|
+
安装完依赖,需要修改@dcloudio 里面的一个地方,具体参考以下文档中的第一个问题(“热更新无效”):
|
|
66
|
+
|
|
67
|
+
[https://zhuanlan.zhihu.com/p/665000866](https://zhuanlan.zhihu.com/p/665000866)
|
|
68
|
+
|
|
69
|
+
### 运行开发环境
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pnpm run dev
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
运行上面命令后会生成四个链接:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
Local: http://localhost:5173/sard-uniapp-docs/mobile/ (演示)
|
|
79
|
+
Network: http://192.168.1.121:5173/sard-uniapp-docs/mobile/ (局域网演示)
|
|
80
|
+
Local: http://localhost:7761/sard-uniapp-docs/ (文档)
|
|
81
|
+
Network: http://192.168.1.121:7761/sard-uniapp-docs/ (局域网文档)
|
|
82
|
+
```
|
package/changelog.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
# [1.2.0](https://github.com/sutras/sard-uniapp/compare/v1.1.7...v1.2.0) (2024-07-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* 新增Marquee, LuckyDraw, CountTo组件 ([61db992](https://github.com/sutras/sard-uniapp/commit/61db992aea95658b714ae4182526dff10ad54491))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [1.1.7](https://github.com/sutras/sard-uniapp/compare/v1.1.6...v1.1.7) (2024-05-20)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* 修复表单内组件的禁用和只读问题 close [#27](https://github.com/sutras/sard-uniapp/issues/27) ([eee674c](https://github.com/sutras/sard-uniapp/commit/eee674c156687b25893cd0456b7050440ea1ad4d))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
1
19
|
## [1.1.6](https://github.com/sutras/sard-uniapp/compare/v1.1.5...v1.1.6) (2024-05-19)
|
|
2
20
|
|
|
3
21
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<_TemplateProps>, {}>, {
|
|
3
|
-
|
|
1
|
+
import { type _TemplateProps, type _TemplateSlots } from './common';
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<_TemplateProps>, {}>, {
|
|
3
|
+
reset: () => void;
|
|
4
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
5
|
+
click: (event: any) => void;
|
|
4
6
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<_TemplateProps>, {}>>> & {
|
|
5
|
-
onClick?: ((
|
|
7
|
+
onClick?: ((event: any) => any) | undefined;
|
|
6
8
|
}, {}, {}>, Readonly<_TemplateSlots> & _TemplateSlots>;
|
|
7
9
|
export default _default;
|
|
8
10
|
type __VLS_WithDefaults<P, D> = {
|
|
@@ -22,9 +22,12 @@ export default _defineComponent({
|
|
|
22
22
|
},
|
|
23
23
|
emits: ["click"],
|
|
24
24
|
setup(__props, { expose: __expose }) {
|
|
25
|
-
__expose();
|
|
26
25
|
const props = __props;
|
|
27
26
|
const bem = createBem("_template");
|
|
27
|
+
__expose({
|
|
28
|
+
reset: () => {
|
|
29
|
+
}
|
|
30
|
+
});
|
|
28
31
|
const _templateClass = computed(() => {
|
|
29
32
|
return classNames(bem.b(), props.rootClass);
|
|
30
33
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {} from './common';
|
|
1
|
+
export type { _TemplateProps, _TemplateSlots, _TemplateEmits, _TemplateExpose, } from './common';
|
|
@@ -59,7 +59,7 @@ export default _defineComponent({
|
|
|
59
59
|
const bem = createBem("button");
|
|
60
60
|
const formContext = useFormContext();
|
|
61
61
|
const isDisabled = computed(() => {
|
|
62
|
-
return formContext?.disabled
|
|
62
|
+
return formContext?.disabled || props.disabled;
|
|
63
63
|
});
|
|
64
64
|
const onClick = (event) => {
|
|
65
65
|
emit("click", event);
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
import { type CheckboxProps, type CheckboxSlots } from './common';
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<CheckboxProps>, {
|
|
3
|
-
disabled: undefined;
|
|
4
|
-
readonly: undefined;
|
|
5
3
|
validateEvent: boolean;
|
|
6
4
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
5
|
click: (event: any) => void;
|
|
8
6
|
"update:checked": (checked: boolean) => void;
|
|
9
7
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<CheckboxProps>, {
|
|
10
|
-
disabled: undefined;
|
|
11
|
-
readonly: undefined;
|
|
12
8
|
validateEvent: boolean;
|
|
13
9
|
}>>> & {
|
|
14
10
|
onClick?: ((event: any) => any) | undefined;
|
|
15
11
|
"onUpdate:checked"?: ((checked: boolean) => any) | undefined;
|
|
16
12
|
}, {
|
|
17
|
-
readonly: boolean;
|
|
18
13
|
validateEvent: boolean;
|
|
19
|
-
disabled: boolean;
|
|
20
14
|
}, {}>, Readonly<CheckboxSlots> & CheckboxSlots>;
|
|
21
15
|
export default _default;
|
|
22
16
|
type __VLS_WithDefaults<P, D> = {
|
|
@@ -53,10 +53,10 @@ export default _defineComponent({
|
|
|
53
53
|
const formContext = useFormContext();
|
|
54
54
|
const formItemContext = useFormItemContext();
|
|
55
55
|
const isDisabled = computed(() => {
|
|
56
|
-
return formContext?.disabled
|
|
56
|
+
return formContext?.disabled || groupContext?.disabled || props.disabled;
|
|
57
57
|
});
|
|
58
58
|
const isReadonly = computed(() => {
|
|
59
|
-
return formContext?.readonly
|
|
59
|
+
return formContext?.readonly || groupContext?.readonly || props.readonly;
|
|
60
60
|
});
|
|
61
61
|
const innerChecked = ref(
|
|
62
62
|
groupContext ? groupContext.value.includes(props.value) : props.checked
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { defaultConfig } from '../config';
|
|
2
|
-
export const checkboxPropsDefaults =
|
|
3
|
-
...defaultConfig.checkbox,
|
|
4
|
-
disabled: undefined,
|
|
5
|
-
readonly: undefined,
|
|
6
|
-
};
|
|
2
|
+
export const checkboxPropsDefaults = defaultConfig.checkbox;
|
|
7
3
|
export const checkboxGroupPropsDefaults = defaultConfig.checkboxGroup;
|
|
8
4
|
export const checkboxContextSymbol = Symbol('checkbox-context');
|
|
9
5
|
export const mapTypeIcon = {
|
|
@@ -41,6 +41,12 @@ export declare const defaultConfig: {
|
|
|
41
41
|
autoStart: boolean;
|
|
42
42
|
format: string;
|
|
43
43
|
};
|
|
44
|
+
countTo: {
|
|
45
|
+
value: number;
|
|
46
|
+
precision: number;
|
|
47
|
+
separatorDigit: number;
|
|
48
|
+
duration: number;
|
|
49
|
+
};
|
|
44
50
|
datetimePicker: {
|
|
45
51
|
type: string;
|
|
46
52
|
};
|
|
@@ -78,6 +84,9 @@ export declare const defaultConfig: {
|
|
|
78
84
|
showError: boolean;
|
|
79
85
|
scrollDuration: number;
|
|
80
86
|
};
|
|
87
|
+
formItem: {
|
|
88
|
+
showError: boolean;
|
|
89
|
+
};
|
|
81
90
|
grid: {
|
|
82
91
|
columns: number;
|
|
83
92
|
direction: "vertical";
|
|
@@ -107,6 +116,11 @@ export declare const defaultConfig: {
|
|
|
107
116
|
loading: {
|
|
108
117
|
type: "circular";
|
|
109
118
|
};
|
|
119
|
+
marquee: {
|
|
120
|
+
direction: "vertical";
|
|
121
|
+
delay: number;
|
|
122
|
+
speed: number;
|
|
123
|
+
};
|
|
110
124
|
noticeBar: {
|
|
111
125
|
delay: number;
|
|
112
126
|
speed: number;
|
|
@@ -195,6 +209,7 @@ export declare const defaultConfig: {
|
|
|
195
209
|
};
|
|
196
210
|
search: {
|
|
197
211
|
shape: "square";
|
|
212
|
+
focus: boolean;
|
|
198
213
|
};
|
|
199
214
|
shareSheet: {
|
|
200
215
|
overlayClosable: boolean;
|
|
@@ -354,6 +369,12 @@ export declare function useConfigContext(): DeepPartial<{
|
|
|
354
369
|
autoStart: boolean;
|
|
355
370
|
format: string;
|
|
356
371
|
};
|
|
372
|
+
countTo: {
|
|
373
|
+
value: number;
|
|
374
|
+
precision: number;
|
|
375
|
+
separatorDigit: number;
|
|
376
|
+
duration: number;
|
|
377
|
+
};
|
|
357
378
|
datetimePicker: {
|
|
358
379
|
type: string;
|
|
359
380
|
};
|
|
@@ -391,6 +412,9 @@ export declare function useConfigContext(): DeepPartial<{
|
|
|
391
412
|
showError: boolean;
|
|
392
413
|
scrollDuration: number;
|
|
393
414
|
};
|
|
415
|
+
formItem: {
|
|
416
|
+
showError: boolean;
|
|
417
|
+
};
|
|
394
418
|
grid: {
|
|
395
419
|
columns: number;
|
|
396
420
|
direction: "vertical";
|
|
@@ -420,6 +444,11 @@ export declare function useConfigContext(): DeepPartial<{
|
|
|
420
444
|
loading: {
|
|
421
445
|
type: "circular";
|
|
422
446
|
};
|
|
447
|
+
marquee: {
|
|
448
|
+
direction: "vertical";
|
|
449
|
+
delay: number;
|
|
450
|
+
speed: number;
|
|
451
|
+
};
|
|
423
452
|
noticeBar: {
|
|
424
453
|
delay: number;
|
|
425
454
|
speed: number;
|
|
@@ -508,6 +537,7 @@ export declare function useConfigContext(): DeepPartial<{
|
|
|
508
537
|
};
|
|
509
538
|
search: {
|
|
510
539
|
shape: "square";
|
|
540
|
+
focus: boolean;
|
|
511
541
|
};
|
|
512
542
|
shareSheet: {
|
|
513
543
|
overlayClosable: boolean;
|
|
@@ -42,6 +42,12 @@ export const defaultConfig = {
|
|
|
42
42
|
autoStart: true,
|
|
43
43
|
format: 'HH:mm:ss',
|
|
44
44
|
},
|
|
45
|
+
countTo: {
|
|
46
|
+
value: 0,
|
|
47
|
+
precision: 0,
|
|
48
|
+
separatorDigit: 3,
|
|
49
|
+
duration: 2000,
|
|
50
|
+
},
|
|
45
51
|
datetimePicker: {
|
|
46
52
|
type: 'yMd',
|
|
47
53
|
},
|
|
@@ -79,6 +85,9 @@ export const defaultConfig = {
|
|
|
79
85
|
showError: true,
|
|
80
86
|
scrollDuration: 150,
|
|
81
87
|
},
|
|
88
|
+
formItem: {
|
|
89
|
+
showError: true,
|
|
90
|
+
},
|
|
82
91
|
grid: {
|
|
83
92
|
columns: 4,
|
|
84
93
|
direction: 'vertical',
|
|
@@ -108,6 +117,11 @@ export const defaultConfig = {
|
|
|
108
117
|
loading: {
|
|
109
118
|
type: 'circular',
|
|
110
119
|
},
|
|
120
|
+
marquee: {
|
|
121
|
+
direction: 'vertical',
|
|
122
|
+
delay: 1000,
|
|
123
|
+
speed: 50,
|
|
124
|
+
},
|
|
111
125
|
noticeBar: {
|
|
112
126
|
delay: 1000,
|
|
113
127
|
speed: 50,
|
|
@@ -196,6 +210,7 @@ export const defaultConfig = {
|
|
|
196
210
|
},
|
|
197
211
|
search: {
|
|
198
212
|
shape: 'square',
|
|
213
|
+
focus: false,
|
|
199
214
|
},
|
|
200
215
|
shareSheet: {
|
|
201
216
|
overlayClosable: true,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface CountToProps {
|
|
2
|
+
value?: number;
|
|
3
|
+
precision?: number;
|
|
4
|
+
separator?: string;
|
|
5
|
+
separatorDigit?: number;
|
|
6
|
+
duration?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const countToPropsDefaults: {
|
|
9
|
+
value: number;
|
|
10
|
+
precision: number;
|
|
11
|
+
separatorDigit: number;
|
|
12
|
+
duration: number;
|
|
13
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type CountToProps } from './common';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<CountToProps>, {
|
|
3
|
+
value: number;
|
|
4
|
+
precision: number;
|
|
5
|
+
separatorDigit: number;
|
|
6
|
+
duration: number;
|
|
7
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<CountToProps>, {
|
|
8
|
+
value: number;
|
|
9
|
+
precision: number;
|
|
10
|
+
separatorDigit: number;
|
|
11
|
+
duration: number;
|
|
12
|
+
}>>>, {
|
|
13
|
+
value: number;
|
|
14
|
+
duration: number;
|
|
15
|
+
precision: number;
|
|
16
|
+
separatorDigit: number;
|
|
17
|
+
}, {}>;
|
|
18
|
+
export default _default;
|
|
19
|
+
type __VLS_WithDefaults<P, D> = {
|
|
20
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
21
|
+
default: D[K];
|
|
22
|
+
}> : P[K];
|
|
23
|
+
};
|
|
24
|
+
type __VLS_Prettify<T> = {
|
|
25
|
+
[K in keyof T]: T[K];
|
|
26
|
+
} & {};
|
|
27
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
28
|
+
type __VLS_TypePropsToOption<T> = {
|
|
29
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
30
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
31
|
+
} : {
|
|
32
|
+
type: import('vue').PropType<T[K]>;
|
|
33
|
+
required: true;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
{{ renderedNumer }}
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
7
|
+
import { computed, onUnmounted, ref, watch } from "vue";
|
|
8
|
+
import { addSeparator } from "../../utils";
|
|
9
|
+
import { countToPropsDefaults } from "./common";
|
|
10
|
+
import { createAnimation } from "lwa";
|
|
11
|
+
export default _defineComponent({
|
|
12
|
+
...{
|
|
13
|
+
options: {
|
|
14
|
+
virtualHost: true,
|
|
15
|
+
styleIsolation: "shared"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
__name: "count-to",
|
|
19
|
+
props: _mergeDefaults({
|
|
20
|
+
value: { type: Number, required: false },
|
|
21
|
+
precision: { type: Number, required: false },
|
|
22
|
+
separator: { type: String, required: false },
|
|
23
|
+
separatorDigit: { type: Number, required: false },
|
|
24
|
+
duration: { type: Number, required: false }
|
|
25
|
+
}, countToPropsDefaults),
|
|
26
|
+
setup(__props, { expose: __expose }) {
|
|
27
|
+
__expose();
|
|
28
|
+
const props = __props;
|
|
29
|
+
const number = ref(0);
|
|
30
|
+
let tl;
|
|
31
|
+
const renderedNumer = computed(() => {
|
|
32
|
+
const fixedNum = number.value.toFixed(props.precision);
|
|
33
|
+
return props.separator ? addSeparator(fixedNum, props.separator, props.separatorDigit) : fixedNum;
|
|
34
|
+
});
|
|
35
|
+
watch(
|
|
36
|
+
() => props.value,
|
|
37
|
+
() => {
|
|
38
|
+
tl?.pause();
|
|
39
|
+
tl = createAnimation(
|
|
40
|
+
number,
|
|
41
|
+
{
|
|
42
|
+
value: props.value
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
duration: props.duration,
|
|
46
|
+
easing: "easeOutQuint",
|
|
47
|
+
round: Math.pow(10, props.precision)
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
flush: "post",
|
|
53
|
+
immediate: true
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
onUnmounted(() => {
|
|
57
|
+
tl?.pause();
|
|
58
|
+
});
|
|
59
|
+
const __returned__ = { props, number, get tl() {
|
|
60
|
+
return tl;
|
|
61
|
+
}, set tl(v) {
|
|
62
|
+
tl = v;
|
|
63
|
+
}, renderedNumer };
|
|
64
|
+
return __returned__;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { CountToProps } from './common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -24,6 +24,7 @@ export interface FormProps {
|
|
|
24
24
|
labelAlign?: 'start' | 'center' | 'end';
|
|
25
25
|
labelValign?: 'start' | 'center' | 'end';
|
|
26
26
|
starPosition?: 'left' | 'right';
|
|
27
|
+
hideStar?: boolean;
|
|
27
28
|
showError?: boolean;
|
|
28
29
|
scrollToFirstError?: boolean;
|
|
29
30
|
scrollIntoViewOptions?: ScrollIntoViewOptions;
|
|
@@ -58,8 +59,8 @@ export interface FormItemProps {
|
|
|
58
59
|
labelAlign?: 'start' | 'center' | 'end';
|
|
59
60
|
labelValign?: 'start' | 'center' | 'end';
|
|
60
61
|
starPosition?: 'left' | 'right';
|
|
61
|
-
showStar?: boolean;
|
|
62
62
|
label?: string;
|
|
63
|
+
hideStar?: boolean;
|
|
63
64
|
required?: boolean | undefined;
|
|
64
65
|
name?: FieldName;
|
|
65
66
|
rules?: Rule | Rule[];
|
|
@@ -70,8 +71,7 @@ export interface FormItemProps {
|
|
|
70
71
|
}
|
|
71
72
|
export declare const formItemPropsDefaults: {
|
|
72
73
|
required: undefined;
|
|
73
|
-
showError:
|
|
74
|
-
showStar: undefined;
|
|
74
|
+
showError: boolean;
|
|
75
75
|
};
|
|
76
76
|
export interface FormItemSlots {
|
|
77
77
|
default?(props: Record<string, never>): any;
|
|
@@ -97,6 +97,7 @@ export interface FormContext {
|
|
|
97
97
|
labelAlign: FormProps['labelAlign'];
|
|
98
98
|
labelValign: FormProps['labelValign'];
|
|
99
99
|
starPosition: FormProps['starPosition'];
|
|
100
|
+
hideStar: FormProps['hideStar'];
|
|
100
101
|
showError: FormProps['showError'];
|
|
101
102
|
scrollIntoViewOptions: FormProps['scrollIntoViewOptions'];
|
|
102
103
|
disabled: FormProps['disabled'];
|
|
@@ -2,9 +2,8 @@ import { inject } from 'vue';
|
|
|
2
2
|
import { defaultConfig } from '../config';
|
|
3
3
|
export const formPropsDefaults = defaultConfig.form;
|
|
4
4
|
export const formItemPropsDefaults = {
|
|
5
|
+
...defaultConfig.formItem,
|
|
5
6
|
required: undefined,
|
|
6
|
-
showError: undefined,
|
|
7
|
-
showStar: undefined,
|
|
8
7
|
};
|
|
9
8
|
export const formContextSymbol = Symbol('form-context');
|
|
10
9
|
export const formItemContextSymbol = Symbol('form-item-context');
|
package/components/form/form.vue
CHANGED
|
@@ -41,6 +41,7 @@ export default _defineComponent({
|
|
|
41
41
|
labelAlign: { type: String, required: false },
|
|
42
42
|
labelValign: { type: String, required: false },
|
|
43
43
|
starPosition: { type: String, required: false },
|
|
44
|
+
hideStar: { type: Boolean, required: false },
|
|
44
45
|
showError: { type: Boolean, required: false },
|
|
45
46
|
scrollToFirstError: { type: Boolean, required: false },
|
|
46
47
|
scrollIntoViewOptions: { type: Object, required: false },
|
|
@@ -141,6 +142,7 @@ export default _defineComponent({
|
|
|
141
142
|
labelAlign: toRef(props, "labelAlign"),
|
|
142
143
|
labelValign: toRef(props, "labelValign"),
|
|
143
144
|
starPosition: toRef(props, "starPosition"),
|
|
145
|
+
hideStar: toRef(props, "hideStar"),
|
|
144
146
|
showError: toRef(props, "showError"),
|
|
145
147
|
scrollIntoViewOptions: toRef(props, "scrollIntoViewOptions"),
|
|
146
148
|
disabled: toRef(props, "disabled"),
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type FormItemProps, type FormItemSlots, type ValidateState } from '../form/common';
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<FormItemProps>, {
|
|
3
3
|
required: undefined;
|
|
4
|
-
showError:
|
|
5
|
-
showStar: undefined;
|
|
4
|
+
showError: boolean;
|
|
6
5
|
}>, {
|
|
7
6
|
validate: (trigger?: string | string[] | undefined) => Promise<void>;
|
|
8
7
|
reset: () => Promise<void>;
|
|
@@ -12,12 +11,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
12
11
|
validateState: import("vue").Ref<ValidateState>;
|
|
13
12
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<FormItemProps>, {
|
|
14
13
|
required: undefined;
|
|
15
|
-
showError:
|
|
16
|
-
showStar: undefined;
|
|
14
|
+
showError: boolean;
|
|
17
15
|
}>>>, {
|
|
18
16
|
showError: boolean;
|
|
19
17
|
required: boolean;
|
|
20
|
-
showStar: boolean;
|
|
21
18
|
}, {}>, Readonly<FormItemSlots> & FormItemSlots>;
|
|
22
19
|
export default _default;
|
|
23
20
|
type __VLS_WithDefaults<P, D> = {
|
|
@@ -70,8 +70,8 @@ export default _defineComponent({
|
|
|
70
70
|
labelAlign: { type: String, required: false },
|
|
71
71
|
labelValign: { type: String, required: false },
|
|
72
72
|
starPosition: { type: String, required: false },
|
|
73
|
-
showStar: { type: Boolean, required: false },
|
|
74
73
|
label: { type: String, required: false },
|
|
74
|
+
hideStar: { type: Boolean, required: false },
|
|
75
75
|
required: { type: Boolean, required: false, skipCheck: true },
|
|
76
76
|
name: { type: [String, Number, Array], required: false },
|
|
77
77
|
rules: { type: [Object, Array], required: false },
|
|
@@ -114,7 +114,7 @@ export default _defineComponent({
|
|
|
114
114
|
}
|
|
115
115
|
);
|
|
116
116
|
const shouldShowError = computed(() => {
|
|
117
|
-
return
|
|
117
|
+
return props.showError && formContext.showError && validateMessage.value;
|
|
118
118
|
});
|
|
119
119
|
const validateState = ref("");
|
|
120
120
|
const mergedValidateTrigger = computed(() => {
|
|
@@ -163,7 +163,7 @@ export default _defineComponent({
|
|
|
163
163
|
return mergedRules.value.some((rule) => rule.required);
|
|
164
164
|
});
|
|
165
165
|
const shouldShowStar = computed(() => {
|
|
166
|
-
return
|
|
166
|
+
return !formContext.hideStar && !props.hideStar && isRequired.value;
|
|
167
167
|
});
|
|
168
168
|
const validate = async (trigger) => {
|
|
169
169
|
if (isResetting || !props.name) {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view :class="
|
|
2
|
+
<view :class="itemClass" :style="itemStyle">
|
|
3
3
|
<view :class="bem.e('wrapper')">
|
|
4
|
-
<view
|
|
4
|
+
<view
|
|
5
|
+
:class="classNames(bem.e('content'), contentClass)"
|
|
6
|
+
:style="stringifyStyle(contentStyle)"
|
|
7
|
+
@click="onClick"
|
|
8
|
+
>
|
|
5
9
|
<slot>
|
|
6
10
|
<view :class="bem.e('icon')">
|
|
7
11
|
<slot name="icon">
|
|
@@ -41,6 +45,8 @@ export default _defineComponent({
|
|
|
41
45
|
props: {
|
|
42
46
|
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
43
47
|
rootClass: { type: String, required: false },
|
|
48
|
+
contentStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
49
|
+
contentClass: { type: String, required: false },
|
|
44
50
|
text: { type: String, required: false },
|
|
45
51
|
icon: { type: String, required: false },
|
|
46
52
|
iconSize: { type: String, required: false },
|
|
@@ -60,6 +66,9 @@ export default _defineComponent({
|
|
|
60
66
|
const onClick = (event) => {
|
|
61
67
|
emit("click", event);
|
|
62
68
|
};
|
|
69
|
+
const itemClass = computed(() => {
|
|
70
|
+
return classNames(bem.e("item"), props.rootClass);
|
|
71
|
+
});
|
|
63
72
|
const itemStyle = computed(() => {
|
|
64
73
|
const width = 1 / context.columns * 100 + "%";
|
|
65
74
|
const gutter = context.gutter;
|
|
@@ -75,7 +84,9 @@ export default _defineComponent({
|
|
|
75
84
|
props.rootStyle
|
|
76
85
|
);
|
|
77
86
|
});
|
|
78
|
-
const __returned__ = { props, emit, bem, context, onClick, itemStyle, get
|
|
87
|
+
const __returned__ = { props, emit, bem, context, onClick, itemClass, itemStyle, get stringifyStyle() {
|
|
88
|
+
return stringifyStyle;
|
|
89
|
+
}, get classNames() {
|
|
79
90
|
return classNames;
|
|
80
91
|
}, SarIcon };
|
|
81
92
|
return __returned__;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type IndexesProps, type IndexesSlots } from './common';
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<IndexesProps>, {}>, {
|
|
3
3
|
scrollTo: (name: string | number) => void;
|
|
4
|
+
update: () => void;
|
|
4
5
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
5
6
|
change: (name: string | number) => void;
|
|
6
7
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<IndexesProps>, {}>>> & {
|