sard-uniapp 1.19.3 → 1.19.4
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 +9 -0
- package/components/calendar/README.md +20 -17
- package/components/calendar/calendar.vue +10 -1
- package/components/calendar/common.d.ts +6 -0
- package/components/calendar-input/calendar-input.vue +9 -0
- package/components/calendar-month/calendar-month.vue +5 -2
- package/components/calendar-popout/calendar-popout.vue +10 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [1.19.4](https://github.com/sutras/sard-uniapp/compare/v1.19.3...v1.19.4) (2025-06-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* calendar 允许修改范围文案 ([ba4debe](https://github.com/sutras/sard-uniapp/commit/ba4debefe74e8a7e9f9ea42141dd421ccc00a082))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
## [1.19.3](https://github.com/sutras/sard-uniapp/compare/v1.19.2...v1.19.3) (2025-06-17)
|
|
2
11
|
|
|
3
12
|
|
|
@@ -31,23 +31,26 @@ import Calendar from 'sard-uniapp/components/calendar/calendar.vue'
|
|
|
31
31
|
|
|
32
32
|
### CalendarProps
|
|
33
33
|
|
|
34
|
-
| 属性
|
|
35
|
-
|
|
|
36
|
-
| root-class
|
|
37
|
-
| root-style
|
|
38
|
-
| type
|
|
39
|
-
| model-value
|
|
40
|
-
| min
|
|
41
|
-
| max
|
|
42
|
-
| current-date
|
|
43
|
-
| disabled-date
|
|
44
|
-
| max-days
|
|
45
|
-
| over-max-days
|
|
46
|
-
| week-starts-on
|
|
47
|
-
| formatter
|
|
48
|
-
| allow-same-day
|
|
49
|
-
| several-months
|
|
50
|
-
| value-format <sup>1.10+</sup>
|
|
34
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
35
|
+
| ---------------------------------- | -------------------------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------- |
|
|
36
|
+
| root-class | 组件根元素类名 | string | - |
|
|
37
|
+
| root-style | 组件根元素样式 | StyleValue | - |
|
|
38
|
+
| type | 日历类型 | CalendarType | 'single' |
|
|
39
|
+
| model-value | 选中的日期,单选时为当个日期,多选时为日期数组,范围时为两个日期数组 | Date \| Date[] \| string \| string[] | - |
|
|
40
|
+
| min | 可选择的最小日期 | Date | 前十年,或者当前月(设置了 `several-months`) |
|
|
41
|
+
| max | 可选择的最大日期 | Date | 后十年,或者三个月后(设置了 `several-months`) |
|
|
42
|
+
| current-date | 当前展示月份的日期 | Date | - |
|
|
43
|
+
| disabled-date | 指定禁选日期,返回 `true` 表示禁选 | (date: Date) => boolean | - |
|
|
44
|
+
| max-days | 最多可选天数,用于多选和范围 | number | Number.MAX_SAFE_INTEGER |
|
|
45
|
+
| over-max-days | 超出最多可选天数时触发 | () => void | - |
|
|
46
|
+
| week-starts-on | 指定一周以周几开始,`0` 表示周日,`1-6` 分别表示周一至周六 | number | 0 |
|
|
47
|
+
| formatter | 通过修改 `CalendarDay` 对象属性值,来自定义日期的文案和样式 | (day: CalendarDay) => void | - |
|
|
48
|
+
| allow-same-day | 范围选择中,是否允许起始和结束为同一天 | boolean | false |
|
|
49
|
+
| several-months | 是否显示多个月 | boolean | false |
|
|
50
|
+
| value-format <sup>1.10+</sup> | 绑定值的格式,不指定则绑定值为 Date 对象 | string [详见特殊符号](../guide/date#日期格式特殊符号) | - |
|
|
51
|
+
| start-date-text <sup>1.19.4+</sup> | 开始日期文字 | string | '开始' |
|
|
52
|
+
| end-date-text <sup>1.19.4+</sup> | 结束日期文字 | string | '结束' |
|
|
53
|
+
| same-date-text <sup>1.19.4+</sup> | 选择同一天日期文字 | string | '开始/结束' |
|
|
51
54
|
|
|
52
55
|
### CalendarEmits
|
|
53
56
|
|
|
@@ -72,6 +72,9 @@
|
|
|
72
72
|
:today-number="todayNumber"
|
|
73
73
|
:week-starts-on="weekStartsOn"
|
|
74
74
|
:several-months="severalMonths"
|
|
75
|
+
:start-date-text="startDateText"
|
|
76
|
+
:end-date-text="endDateText"
|
|
77
|
+
:same-date-text="sameDateText"
|
|
75
78
|
:t="t"
|
|
76
79
|
:bem="bem"
|
|
77
80
|
@day-click="onDayClick"
|
|
@@ -144,6 +147,9 @@ import SarDatetimePicker from "../datetime-picker/datetime-picker.vue";
|
|
|
144
147
|
* @property {boolean} allowSameDay 范围选择中,是否允许起始和结束为同一天,默认值:false。
|
|
145
148
|
* @property {boolean} severalMonths 是否显示多个月,默认值:false。
|
|
146
149
|
* @property {string [详见特殊符号](../guide/date#日期格式特殊符号)} valueFormat 绑定值的格式,不指定则绑定值为 Date 对象,默认值:-。
|
|
150
|
+
* @property {string} startDateText 开始日期文字,默认值:'开始'。
|
|
151
|
+
* @property {string} endDateText 结束日期文字,默认值:'结束'。
|
|
152
|
+
* @property {string} sameDateText 选择同一天日期文字,默认值:'开始/结束'。
|
|
147
153
|
* @event {(value: Date | Date[] | string | string[]) => void} update 点击并选中任意日期时触发
|
|
148
154
|
* @event {(value: Date | Date[] | string | string[]) => void} change 点击并选中任意日期时触发
|
|
149
155
|
*/
|
|
@@ -177,7 +183,10 @@ export default _defineComponent({
|
|
|
177
183
|
formatter: { type: Function, required: false },
|
|
178
184
|
allowSameDay: { type: Boolean, required: false },
|
|
179
185
|
severalMonths: { type: Boolean, required: false },
|
|
180
|
-
valueFormat: { type: String, required: false }
|
|
186
|
+
valueFormat: { type: String, required: false },
|
|
187
|
+
startDateText: { type: String, required: false },
|
|
188
|
+
endDateText: { type: String, required: false },
|
|
189
|
+
sameDateText: { type: String, required: false }
|
|
181
190
|
}, defaultCalendarProps),
|
|
182
191
|
emits: ["update:model-value", "change"],
|
|
183
192
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -28,6 +28,9 @@ export interface CalendarProps {
|
|
|
28
28
|
allowSameDay?: boolean;
|
|
29
29
|
severalMonths?: boolean;
|
|
30
30
|
valueFormat?: string;
|
|
31
|
+
startDateText?: string;
|
|
32
|
+
endDateText?: string;
|
|
33
|
+
sameDateText?: string;
|
|
31
34
|
}
|
|
32
35
|
export declare const defaultCalendarProps: {
|
|
33
36
|
type: CalendarProps["type"];
|
|
@@ -52,6 +55,9 @@ export interface CalendarMonthProps {
|
|
|
52
55
|
severalMonths?: boolean;
|
|
53
56
|
t: LocaleTranslate;
|
|
54
57
|
bem: Bem;
|
|
58
|
+
startDateText?: string;
|
|
59
|
+
endDateText?: string;
|
|
60
|
+
sameDateText?: string;
|
|
55
61
|
}
|
|
56
62
|
export interface CalendarMonthEmits {
|
|
57
63
|
(e: 'day-click', date: Date): void;
|
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
:week-starts-on="weekStartsOn"
|
|
28
28
|
:formatter="formatter"
|
|
29
29
|
:allow-same-day="allowSameDay"
|
|
30
|
+
:start-date-text="startDateText"
|
|
31
|
+
:end-date-text="endDateText"
|
|
32
|
+
:same-date-text="sameDateText"
|
|
30
33
|
:several-months="severalMonths"
|
|
31
34
|
:value-format="valueFormat"
|
|
32
35
|
:validate-event="validateEvent"
|
|
@@ -62,6 +65,9 @@ import {
|
|
|
62
65
|
* @property {boolean} allowSameDay 范围选择中,是否允许起始和结束为同一天,默认值:false。
|
|
63
66
|
* @property {boolean} severalMonths 是否显示多个月,默认值:false。
|
|
64
67
|
* @property {string [详见特殊符号](../guide/date#日期格式特殊符号)} valueFormat 绑定值的格式,不指定则绑定值为 Date 对象,默认值:-。
|
|
68
|
+
* @property {string} startDateText 开始日期文字,默认值:'开始'。
|
|
69
|
+
* @property {string} endDateText 结束日期文字,默认值:'结束'。
|
|
70
|
+
* @property {string} sameDateText 选择同一天日期文字,默认值:'开始/结束'。
|
|
65
71
|
* @property {string} popoutClass 弹窗框根元素类名,默认值:-。
|
|
66
72
|
* @property {StyleValue} popoutStyle 弹窗框根元素样式,默认值:-。
|
|
67
73
|
* @property {boolean} visible 是否显示弹出框,默认值:-。
|
|
@@ -113,6 +119,9 @@ export default _defineComponent({
|
|
|
113
119
|
allowSameDay: { type: Boolean, required: false },
|
|
114
120
|
severalMonths: { type: Boolean, required: false },
|
|
115
121
|
valueFormat: { type: String, required: false },
|
|
122
|
+
startDateText: { type: String, required: false },
|
|
123
|
+
endDateText: { type: String, required: false },
|
|
124
|
+
sameDateText: { type: String, required: false },
|
|
116
125
|
placeholder: { type: String, required: false },
|
|
117
126
|
readonly: { type: Boolean, required: false },
|
|
118
127
|
disabled: { type: Boolean, required: false },
|
|
@@ -64,7 +64,10 @@ export default _defineComponent({
|
|
|
64
64
|
weekStartsOn: { type: Number, required: true },
|
|
65
65
|
severalMonths: { type: Boolean, required: false },
|
|
66
66
|
t: { type: Function, required: true },
|
|
67
|
-
bem: { type: null, required: true }
|
|
67
|
+
bem: { type: null, required: true },
|
|
68
|
+
startDateText: { type: String, required: false },
|
|
69
|
+
endDateText: { type: String, required: false },
|
|
70
|
+
sameDateText: { type: String, required: false }
|
|
68
71
|
},
|
|
69
72
|
emits: ["day-click"],
|
|
70
73
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -132,7 +135,7 @@ export default _defineComponent({
|
|
|
132
135
|
disabled,
|
|
133
136
|
top: "",
|
|
134
137
|
text: date.getDate() + "",
|
|
135
|
-
bottom: isStart && isEnd ? `${props.t("start")}/${props.t("end")}` : isStart ? props.t("start") : isEnd ? props.t("end") : "",
|
|
138
|
+
bottom: isStart && isEnd ? props.sameDateText || `${props.t("start")}/${props.t("end")}` : isStart ? props.startDateText || props.t("start") : isEnd ? props.endDateText || props.t("end") : "",
|
|
136
139
|
type: isStart && isEnd ? "same" : isStart ? "start" : isMiddle ? "middle" : isEnd ? "end" : selected ? "selected" : "normal"
|
|
137
140
|
};
|
|
138
141
|
if (within && props.formatter) {
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
:week-starts-on="weekStartsOn"
|
|
29
29
|
:formatter="formatter"
|
|
30
30
|
:allow-same-day="allowSameDay"
|
|
31
|
+
:start-date-text="startDateText"
|
|
32
|
+
:end-date-text="endDateText"
|
|
33
|
+
:same-date-text="sameDateText"
|
|
31
34
|
:several-months="severalMonths"
|
|
32
35
|
:value-format="valueFormat"
|
|
33
36
|
@change="onChange"
|
|
@@ -61,6 +64,9 @@ import { useFormPopout } from "../../use";
|
|
|
61
64
|
* @property {boolean} allowSameDay 范围选择中,是否允许起始和结束为同一天,默认值:false。
|
|
62
65
|
* @property {boolean} severalMonths 是否显示多个月,默认值:false。
|
|
63
66
|
* @property {string [详见特殊符号](../guide/date#日期格式特殊符号)} valueFormat 绑定值的格式,不指定则绑定值为 Date 对象,默认值:-。
|
|
67
|
+
* @property {string} startDateText 开始日期文字,默认值:'开始'。
|
|
68
|
+
* @property {string} endDateText 结束日期文字,默认值:'结束'。
|
|
69
|
+
* @property {string} sameDateText 选择同一天日期文字,默认值:'开始/结束'。
|
|
64
70
|
* @property {string} popoutClass 弹窗框根元素类名,默认值:-。
|
|
65
71
|
* @property {StyleValue} popoutStyle 弹窗框根元素样式,默认值:-。
|
|
66
72
|
* @property {boolean} visible 是否显示弹出框,默认值:-。
|
|
@@ -103,7 +109,10 @@ export default _defineComponent({
|
|
|
103
109
|
formatter: { type: Function, required: false },
|
|
104
110
|
allowSameDay: { type: Boolean, required: false },
|
|
105
111
|
severalMonths: { type: Boolean, required: false },
|
|
106
|
-
valueFormat: { type: String, required: false }
|
|
112
|
+
valueFormat: { type: String, required: false },
|
|
113
|
+
startDateText: { type: String, required: false },
|
|
114
|
+
endDateText: { type: String, required: false },
|
|
115
|
+
sameDateText: { type: String, required: false }
|
|
107
116
|
}, defaultCalendarPopoutProps()),
|
|
108
117
|
emits: ["update:visible", "update:model-value", "change"],
|
|
109
118
|
setup(__props, { expose: __expose, emit: __emit }) {
|