sard-uniapp 1.9.2 → 1.10.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/README.md +39 -1
- package/changelog.md +18 -0
- package/components/back-top/back-top.vue +1 -1
- package/components/back-top/common.d.ts +1 -1
- package/components/back-top/common.js +2 -2
- package/components/calendar/calendar.d.ts +4 -4
- package/components/calendar/calendar.vue +33 -10
- package/components/calendar/common.d.ts +4 -3
- package/components/calendar-input/calendar-input.d.ts +5 -4
- package/components/calendar-input/calendar-input.vue +22 -11
- package/components/calendar-input/common.d.ts +5 -3
- package/components/calendar-input/common.js +2 -2
- package/components/cascader-input/cascader-input.vue +1 -1
- package/components/checkbox-input/checkbox-input.vue +2 -2
- package/components/checkbox-input/common.d.ts +1 -1
- package/components/checkbox-input/common.js +2 -2
- package/components/config/index.d.ts +6 -0
- package/components/config/index.js +5 -0
- package/components/datetime-picker/common.d.ts +4 -3
- package/components/datetime-picker/datetime-picker.d.ts +4 -4
- package/components/datetime-picker/datetime-picker.vue +28 -12
- package/components/datetime-picker-input/common.d.ts +5 -3
- package/components/datetime-picker-input/common.js +3 -2
- package/components/datetime-picker-input/datetime-picker-input.d.ts +4 -4
- package/components/datetime-picker-input/datetime-picker-input.vue +16 -11
- package/components/dialog/common.d.ts +4 -0
- package/components/dialog/dialog.vue +6 -1
- package/components/dialog-agent/common.d.ts +1 -1
- package/components/dialog-agent/common.js +2 -2
- package/components/dialog-agent/dialog-agent.vue +5 -17
- package/components/fab/common.d.ts +1 -1
- package/components/fab/common.js +2 -2
- package/components/fab/fab.vue +1 -1
- package/components/form/common.d.ts +1 -1
- package/components/form/common.js +2 -2
- package/components/form-item/form-item.vue +1 -1
- package/components/input/input.vue +11 -3
- package/components/loading/common.d.ts +1 -1
- package/components/loading/common.js +2 -2
- package/components/loading/loading.vue +1 -1
- package/components/notify-agent/common.d.ts +1 -1
- package/components/notify-agent/common.js +2 -2
- package/components/notify-agent/notify-agent.vue +1 -1
- package/components/picker/common.d.ts +1 -1
- package/components/picker/common.js +2 -2
- package/components/picker/picker.vue +1 -1
- package/components/picker-input/common.d.ts +1 -1
- package/components/picker-input/common.js +3 -3
- package/components/picker-input/picker-input.vue +2 -2
- package/components/popout-input/popout-input.vue +1 -1
- package/components/pull-down-refresh/common.d.ts +1 -1
- package/components/pull-down-refresh/common.js +2 -2
- package/components/pull-down-refresh/pull-down-refresh.vue +1 -1
- package/components/radio-input/common.d.ts +1 -1
- package/components/radio-input/common.js +2 -2
- package/components/radio-input/radio-input.vue +2 -2
- package/components/space/common.d.ts +20 -0
- package/components/space/common.js +7 -0
- package/components/space/index.d.ts +1 -0
- package/components/space/index.js +1 -0
- package/components/space/index.scss +38 -0
- package/components/space/space.d.ts +13 -0
- package/components/space/space.vue +65 -0
- package/components/space/variables.scss +7 -0
- package/components/toast-agent/common.d.ts +1 -1
- package/components/toast-agent/common.js +2 -2
- package/components/toast-agent/toast-agent.vue +1 -1
- package/components/tree/common.d.ts +1 -1
- package/components/tree/common.js +2 -2
- package/components/tree/tree.vue +1 -1
- package/global.d.ts +2 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.scss +1 -0
- package/package.json +4 -5
- package/utils/date.d.ts +2 -1
- package/utils/date.js +72 -21
- package/utils/regexp.d.ts +1 -0
- package/utils/regexp.js +3 -0
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
## 特性
|
|
23
23
|
|
|
24
|
-
- 🧩
|
|
24
|
+
- 🧩 74+个高质量组件,覆盖移动端主流场景
|
|
25
25
|
- 💪 支持一套代码同时开发 H5 / 小程序 / App
|
|
26
26
|
- 🌿 支持按需引入和 `Tree Shaking`
|
|
27
27
|
- 📖 详尽的文档和案例展示
|
|
@@ -100,3 +100,41 @@ npm run deploy
|
|
|
100
100
|
```bash
|
|
101
101
|
npm run release
|
|
102
102
|
```
|
|
103
|
+
|
|
104
|
+
## 修复问题流程
|
|
105
|
+
|
|
106
|
+
- 修复问题
|
|
107
|
+
- 测试
|
|
108
|
+
- 修改版本号
|
|
109
|
+
- 暂存
|
|
110
|
+
- 提交
|
|
111
|
+
- 给提交打标签
|
|
112
|
+
- 运行 `npm run buildAndRelease` 打包组件库并发布到 npm
|
|
113
|
+
- 发布到 uniapp 插件市场
|
|
114
|
+
- 运行 `npm run push` 推送代码和标签
|
|
115
|
+
- 运行 `npm run build:site` 打包文档(如果文档有修改)
|
|
116
|
+
- 运行 `npm run deploy` 部署文档(如果文档有修改)
|
|
117
|
+
- 更新 gitee 上的文档(如果文档有修改)
|
|
118
|
+
|
|
119
|
+
## 新增组件流程
|
|
120
|
+
|
|
121
|
+
- 运行 `npm run newComponent` 命令自动创建组件
|
|
122
|
+
- 编写组件代码
|
|
123
|
+
- 编写案例代码
|
|
124
|
+
- 编写组件文档
|
|
125
|
+
- 编写测试用例
|
|
126
|
+
- 使用实际项目本地安装测试 `pnpm link ../sard-uniapp`
|
|
127
|
+
- 从上面的“修复问题流程”第三部“修改版本号”开始走一遍
|
|
128
|
+
|
|
129
|
+
## 打包安卓包流程
|
|
130
|
+
|
|
131
|
+
- 在 `HBuilder` 中打开 `sard-uniapp` 项目
|
|
132
|
+
- 点击 发行->App-Android/iOS-云打包
|
|
133
|
+
- 勾选“android(apk 包)” 、“使用云端证书”、“打正式包”、“快速安心打包”
|
|
134
|
+
- 点击“打包“按钮开始打包
|
|
135
|
+
- 注意:如果控制台出现错误:`[ERROR] Cannot start service: Host version "_._._" does not match - binary version "_._._"`,需安装和 Host version 一样版本的 `@esbuild/darwin-x64`
|
|
136
|
+
- 等待云端打包完成
|
|
137
|
+
- 到 `gitee` 仓库创建发行版:[resource 发行版 - Gitee.com](https://gitee.com/sutras/resource/releases/new)
|
|
138
|
+
- 将 gitee 发行版 apk 资源链接转换为二维码图片
|
|
139
|
+
- 将图片更新到 `sard-assets` 项目,并发布到 npm
|
|
140
|
+
- 最后等待 http://fastly.jsdelivr.net 链接生效
|
package/changelog.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [1.10.1](https://github.com/sutras/sard-uniapp/compare/v1.10.0...v1.10.1) (2025-01-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 修复全局配置问题 ([dcd319c](https://github.com/sutras/sard-uniapp/commit/dcd319c51453c6aa7c13dfedfbc2bf47eb3bb409))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# [1.10.0](https://github.com/sutras/sard-uniapp/compare/v1.9.2...v1.10.0) (2025-01-01)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* 新增 Space 组件, 新增 Dialog 组件的按钮配置, 新增 valueFormat 属性, 修复已知问题 ([7648ea6](https://github.com/sutras/sard-uniapp/commit/7648ea65937c5af9a2b6a8cfa9c5b70ade14ef65))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
1
19
|
## [1.9.2](https://github.com/sutras/sard-uniapp/compare/v1.9.1...v1.9.2) (2024-12-22)
|
|
2
20
|
|
|
3
21
|
|
|
@@ -32,7 +32,7 @@ export default _defineComponent({
|
|
|
32
32
|
visibleHeight: { type: Number, required: false },
|
|
33
33
|
right: { type: String, required: false },
|
|
34
34
|
bottom: { type: String, required: false }
|
|
35
|
-
}, defaultBackTopProps),
|
|
35
|
+
}, defaultBackTopProps()),
|
|
36
36
|
emits: ["click"],
|
|
37
37
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
38
38
|
__expose();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type CalendarProps } from './common';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<CalendarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
3
|
-
"update:model-value": (value: Date | Date[]) => any;
|
|
4
|
-
change: (value: Date | Date[]) => any;
|
|
3
|
+
"update:model-value": (value: string | string[] | Date | Date[]) => any;
|
|
4
|
+
change: (value: string | string[] | Date | Date[]) => any;
|
|
5
5
|
}, string, import("vue").PublicProps, Readonly<CalendarProps> & Readonly<{
|
|
6
|
-
"onUpdate:model-value"?: ((value: Date | Date[]) => any) | undefined;
|
|
7
|
-
onChange?: ((value: Date | Date[]) => any) | undefined;
|
|
6
|
+
"onUpdate:model-value"?: ((value: string | string[] | Date | Date[]) => any) | undefined;
|
|
7
|
+
onChange?: ((value: string | string[] | Date | Date[]) => any) | undefined;
|
|
8
8
|
}>, {
|
|
9
9
|
type: import("./common").CalendarType;
|
|
10
10
|
maxDays: number;
|
|
@@ -88,7 +88,9 @@ import {
|
|
|
88
88
|
toMonthNumber,
|
|
89
89
|
getPrevMonthDate,
|
|
90
90
|
getNextMonthDate,
|
|
91
|
-
toArray
|
|
91
|
+
toArray,
|
|
92
|
+
parseDate,
|
|
93
|
+
formatDate
|
|
92
94
|
} from "../../utils";
|
|
93
95
|
import {
|
|
94
96
|
defaultCalendarProps,
|
|
@@ -123,7 +125,7 @@ export default _defineComponent({
|
|
|
123
125
|
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
124
126
|
rootClass: { type: String, required: false },
|
|
125
127
|
type: { type: String, required: false },
|
|
126
|
-
modelValue: { type: [Date, Array], required: false },
|
|
128
|
+
modelValue: { type: [Date, Array, String], required: false },
|
|
127
129
|
min: { type: Date, required: false },
|
|
128
130
|
max: { type: Date, required: false },
|
|
129
131
|
currentDate: { type: Date, required: false },
|
|
@@ -133,7 +135,8 @@ export default _defineComponent({
|
|
|
133
135
|
weekStartsOn: { type: Number, required: false },
|
|
134
136
|
formatter: { type: Function, required: false },
|
|
135
137
|
allowSameDay: { type: Boolean, required: false },
|
|
136
|
-
severalMonths: { type: Boolean, required: false }
|
|
138
|
+
severalMonths: { type: Boolean, required: false },
|
|
139
|
+
valueFormat: { type: String, required: false }
|
|
137
140
|
}, defaultCalendarProps),
|
|
138
141
|
emits: ["update:model-value", "change"],
|
|
139
142
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -149,20 +152,34 @@ export default _defineComponent({
|
|
|
149
152
|
const maxDate2 = props.max || getMaxDate(props.severalMonths);
|
|
150
153
|
return maxDate2.getTime() < minDate.value.getTime() ? new Date(minDate.value) : maxDate2;
|
|
151
154
|
});
|
|
155
|
+
const toDate = (date) => {
|
|
156
|
+
if (date instanceof Date) {
|
|
157
|
+
return date;
|
|
158
|
+
}
|
|
159
|
+
return parseDate(date, props.valueFormat);
|
|
160
|
+
};
|
|
161
|
+
const makeDate = (date) => {
|
|
162
|
+
return Array.isArray(date) ? date.map((item) => toDate(item)) : toDate(date);
|
|
163
|
+
};
|
|
164
|
+
const normalizeValue = (value) => {
|
|
165
|
+
return value ? makeDate(value) : props.type === "single" ? void 0 : [];
|
|
166
|
+
};
|
|
152
167
|
const innerValue = ref(
|
|
153
|
-
props.modelValue
|
|
168
|
+
normalizeValue(props.modelValue)
|
|
154
169
|
);
|
|
170
|
+
let currentEmitValue = innerValue.value;
|
|
155
171
|
watch(
|
|
156
172
|
() => props.modelValue,
|
|
157
173
|
() => {
|
|
158
|
-
if (
|
|
159
|
-
innerValue.value = props.modelValue
|
|
174
|
+
if (currentEmitValue !== props.modelValue) {
|
|
175
|
+
innerValue.value = normalizeValue(props.modelValue);
|
|
176
|
+
currentEmitValue = props.modelValue;
|
|
160
177
|
}
|
|
161
178
|
}
|
|
162
179
|
);
|
|
163
180
|
const getInitialCurrentDate = () => {
|
|
164
181
|
let date = new Date();
|
|
165
|
-
const value = toArray(
|
|
182
|
+
const value = toArray(innerValue.value)[0];
|
|
166
183
|
if (value) {
|
|
167
184
|
date = value;
|
|
168
185
|
}
|
|
@@ -286,8 +303,10 @@ export default _defineComponent({
|
|
|
286
303
|
}
|
|
287
304
|
if (nextValue !== void 0) {
|
|
288
305
|
innerValue.value = nextValue;
|
|
289
|
-
|
|
290
|
-
|
|
306
|
+
const emitValue = props.valueFormat ? Array.isArray(nextValue) ? nextValue.map((item) => formatDate(item, props.valueFormat)) : formatDate(nextValue, props.valueFormat) : nextValue;
|
|
307
|
+
currentEmitValue = emitValue;
|
|
308
|
+
emit("update:model-value", emitValue);
|
|
309
|
+
emit("change", emitValue);
|
|
291
310
|
}
|
|
292
311
|
};
|
|
293
312
|
const inPopup = useInPopup();
|
|
@@ -305,7 +324,11 @@ export default _defineComponent({
|
|
|
305
324
|
const calendarStyle = computed(() => {
|
|
306
325
|
return stringifyStyle(props.rootStyle);
|
|
307
326
|
});
|
|
308
|
-
const __returned__ = { props, emit, bem, t, minDate, maxDate,
|
|
327
|
+
const __returned__ = { props, emit, bem, t, minDate, maxDate, toDate, makeDate, normalizeValue, innerValue, get currentEmitValue() {
|
|
328
|
+
return currentEmitValue;
|
|
329
|
+
}, set currentEmitValue(v) {
|
|
330
|
+
currentEmitValue = v;
|
|
331
|
+
}, getInitialCurrentDate, innerCurrentDate, startDate, onPrevMonthClick, onNextMonthClick, pickerVisible, pickerValue, onMonthClick, onPickerConfirm, weeks, months, todayNumber, currentDates, onDayClick, inPopup, preventPageScroll, calendarClass, calendarStyle, get toMonthNumber() {
|
|
309
332
|
return toMonthNumber;
|
|
310
333
|
}, SarButton, SarIcon, SarCalendarMonth, SarPopout, SarDatetimePicker };
|
|
311
334
|
return __returned__;
|
|
@@ -16,7 +16,7 @@ export interface CalendarProps {
|
|
|
16
16
|
rootStyle?: StyleValue;
|
|
17
17
|
rootClass?: string;
|
|
18
18
|
type?: CalendarType;
|
|
19
|
-
modelValue?: Date | Date[];
|
|
19
|
+
modelValue?: Date | Date[] | string | string[];
|
|
20
20
|
min?: Date;
|
|
21
21
|
max?: Date;
|
|
22
22
|
currentDate?: Date;
|
|
@@ -27,6 +27,7 @@ export interface CalendarProps {
|
|
|
27
27
|
formatter?: (day: CalendarDay) => void;
|
|
28
28
|
allowSameDay?: boolean;
|
|
29
29
|
severalMonths?: boolean;
|
|
30
|
+
valueFormat?: string;
|
|
30
31
|
}
|
|
31
32
|
export declare const defaultCalendarProps: {
|
|
32
33
|
type: CalendarProps["type"];
|
|
@@ -34,8 +35,8 @@ export declare const defaultCalendarProps: {
|
|
|
34
35
|
weekStartsOn: number;
|
|
35
36
|
};
|
|
36
37
|
export interface CalendarEmits {
|
|
37
|
-
(e: 'update:model-value', value: Date | Date[]): void;
|
|
38
|
-
(e: 'change', value: Date | Date[]): void;
|
|
38
|
+
(e: 'update:model-value', value: Date | Date[] | string | string[]): void;
|
|
39
|
+
(e: 'change', value: Date | Date[] | string | string[]): void;
|
|
39
40
|
}
|
|
40
41
|
export interface CalendarMonthProps {
|
|
41
42
|
year: number;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type CalendarType } from '../calendar/common';
|
|
2
2
|
import { type CalendarInputProps } from './common';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<CalendarInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
4
|
-
"update:model-value": (value: Date | Date[] | undefined) => any;
|
|
5
|
-
change: (value: Date | Date[] | undefined) => any;
|
|
4
|
+
"update:model-value": (value: string | string[] | Date | Date[] | undefined) => any;
|
|
5
|
+
change: (value: string | string[] | Date | Date[] | undefined) => any;
|
|
6
6
|
"update:visible": (visible: boolean) => any;
|
|
7
7
|
}, string, import("vue").PublicProps, Readonly<CalendarInputProps> & Readonly<{
|
|
8
|
-
"onUpdate:model-value"?: ((value: Date | Date[] | undefined) => any) | undefined;
|
|
9
|
-
onChange?: ((value: Date | Date[] | undefined) => any) | undefined;
|
|
8
|
+
"onUpdate:model-value"?: ((value: string | string[] | Date | Date[] | undefined) => any) | undefined;
|
|
9
|
+
onChange?: ((value: string | string[] | Date | Date[] | undefined) => any) | undefined;
|
|
10
10
|
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
11
11
|
}>, {
|
|
12
12
|
type: CalendarType;
|
|
@@ -14,5 +14,6 @@ declare const _default: import("vue").DefineComponent<CalendarInputProps, {}, {}
|
|
|
14
14
|
maxDays: number;
|
|
15
15
|
weekStartsOn: number;
|
|
16
16
|
showConfirm: boolean;
|
|
17
|
+
outletFormat: string;
|
|
17
18
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
19
|
export default _default;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<sar-calendar
|
|
24
24
|
v-if="already"
|
|
25
25
|
:model-value="popoutValue"
|
|
26
|
-
@
|
|
26
|
+
@change="onChange"
|
|
27
27
|
:type="type"
|
|
28
28
|
:min="min"
|
|
29
29
|
:max="max"
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
:formatter="formatter"
|
|
36
36
|
:allow-same-day="allowSameDay"
|
|
37
37
|
:several-months="severalMonths"
|
|
38
|
+
:value-format="valueFormat"
|
|
38
39
|
/>
|
|
39
40
|
</template>
|
|
40
41
|
</sar-popout>
|
|
@@ -46,13 +47,12 @@ import { ref, watch, computed } from "vue";
|
|
|
46
47
|
import SarPopoutInput from "../popout-input/popout-input.vue";
|
|
47
48
|
import SarCalendar from "../calendar/calendar.vue";
|
|
48
49
|
import SarPopout from "../popout/popout.vue";
|
|
49
|
-
import { formatDate } from "../../utils";
|
|
50
|
+
import { formatDate, isString, parseDate } from "../../utils";
|
|
50
51
|
import { useTranslate } from "../locale";
|
|
51
52
|
import {
|
|
52
53
|
defaultCalendarInputProps
|
|
53
54
|
} from "./common";
|
|
54
55
|
import { useFormItemContext } from "../form/common";
|
|
55
|
-
const format = "YYYY-MM-DD";
|
|
56
56
|
export default _defineComponent({
|
|
57
57
|
components: {
|
|
58
58
|
SarPopoutInput,
|
|
@@ -70,11 +70,12 @@ export default _defineComponent({
|
|
|
70
70
|
visible: { type: Boolean, required: false },
|
|
71
71
|
title: { type: String, required: false },
|
|
72
72
|
showConfirm: { type: Boolean, required: false },
|
|
73
|
+
outletFormat: { type: String, required: false },
|
|
73
74
|
validateEvent: { type: Boolean, required: false },
|
|
74
75
|
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
75
76
|
rootClass: { type: String, required: false },
|
|
76
77
|
type: { type: String, required: false },
|
|
77
|
-
modelValue: { type: [Date, Array], required: false },
|
|
78
|
+
modelValue: { type: [Date, Array, String], required: false },
|
|
78
79
|
min: { type: Date, required: false },
|
|
79
80
|
max: { type: Date, required: false },
|
|
80
81
|
currentDate: { type: Date, required: false },
|
|
@@ -85,12 +86,13 @@ export default _defineComponent({
|
|
|
85
86
|
formatter: { type: Function, required: false },
|
|
86
87
|
allowSameDay: { type: Boolean, required: false },
|
|
87
88
|
severalMonths: { type: Boolean, required: false },
|
|
89
|
+
valueFormat: { type: String, required: false },
|
|
88
90
|
placeholder: { type: String, required: false },
|
|
89
91
|
readonly: { type: Boolean, required: false },
|
|
90
92
|
disabled: { type: Boolean, required: false },
|
|
91
93
|
clearable: { type: Boolean, required: false },
|
|
92
94
|
multiline: { type: Boolean, required: false }
|
|
93
|
-
}, defaultCalendarInputProps),
|
|
95
|
+
}, defaultCalendarInputProps()),
|
|
94
96
|
emits: ["update:visible", "update:model-value", "change"],
|
|
95
97
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
96
98
|
__expose();
|
|
@@ -130,15 +132,23 @@ export default _defineComponent({
|
|
|
130
132
|
};
|
|
131
133
|
const inputValue = ref("");
|
|
132
134
|
const { t } = useTranslate("calendar");
|
|
135
|
+
function getOutletTextMayByStr(date) {
|
|
136
|
+
if (isString(date) && props.valueFormat) {
|
|
137
|
+
date = parseDate(date, props.valueFormat);
|
|
138
|
+
}
|
|
139
|
+
if (date instanceof Date) {
|
|
140
|
+
return formatDate(date, props.outletFormat);
|
|
141
|
+
}
|
|
142
|
+
return date;
|
|
143
|
+
}
|
|
133
144
|
function getOutletText(date, type) {
|
|
134
145
|
if (type === "single") {
|
|
135
|
-
return
|
|
146
|
+
return getOutletTextMayByStr(date);
|
|
136
147
|
}
|
|
137
148
|
if (type === "range") {
|
|
138
|
-
return `${
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
)}`;
|
|
149
|
+
return `${getOutletTextMayByStr(date[0])} ${t(
|
|
150
|
+
"to"
|
|
151
|
+
)} ${getOutletTextMayByStr(date[1])}`;
|
|
142
152
|
}
|
|
143
153
|
if (type === "multiple") {
|
|
144
154
|
return t("multipleOutlet", {
|
|
@@ -166,6 +176,7 @@ export default _defineComponent({
|
|
|
166
176
|
inputValue.value = "";
|
|
167
177
|
innerValue.value = void 0;
|
|
168
178
|
emit("update:model-value", void 0);
|
|
179
|
+
emit("change", void 0);
|
|
169
180
|
};
|
|
170
181
|
const innerVisible = ref(props.visible);
|
|
171
182
|
watch(
|
|
@@ -182,7 +193,7 @@ export default _defineComponent({
|
|
|
182
193
|
innerVisible.value = true;
|
|
183
194
|
emit("update:visible", true);
|
|
184
195
|
};
|
|
185
|
-
const __returned__ = { props, emit, formItemContext, innerValue, popoutValue, confirmDisabled, onChange, onConfirm, inputValue,
|
|
196
|
+
const __returned__ = { props, emit, formItemContext, innerValue, popoutValue, confirmDisabled, onChange, onConfirm, inputValue, t, getOutletTextMayByStr, getOutletText, getInputValue, onClear, innerVisible, onVisible, onInputClick, SarPopoutInput, SarCalendar, SarPopout };
|
|
186
197
|
return __returned__;
|
|
187
198
|
}
|
|
188
199
|
});
|
|
@@ -4,17 +4,19 @@ export interface CalendarInputProps extends CalendarProps, Omit<PopoutInputProps
|
|
|
4
4
|
visible?: boolean;
|
|
5
5
|
title?: string;
|
|
6
6
|
showConfirm?: boolean;
|
|
7
|
+
outletFormat?: string;
|
|
7
8
|
validateEvent?: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare const defaultCalendarInputProps: {
|
|
10
|
+
export declare const defaultCalendarInputProps: () => {
|
|
10
11
|
type: CalendarProps["type"];
|
|
11
12
|
maxDays: number;
|
|
12
13
|
weekStartsOn: number;
|
|
13
14
|
showConfirm: boolean;
|
|
14
15
|
validateEvent: boolean;
|
|
16
|
+
outletFormat: string;
|
|
15
17
|
};
|
|
16
18
|
export interface CalendarInputEmits {
|
|
17
19
|
(e: 'update:visible', visible: boolean): void;
|
|
18
|
-
(e: 'update:model-value', value: Date | Date[] | undefined): void;
|
|
19
|
-
(e: 'change', value: Date | Date[] | undefined): void;
|
|
20
|
+
(e: 'update:model-value', value: Date | Date[] | string | string[] | undefined): void;
|
|
21
|
+
(e: 'change', value: Date | Date[] | string | string[] | undefined): void;
|
|
20
22
|
}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
:direction="direction"
|
|
28
28
|
:validate-event="false"
|
|
29
29
|
:model-value="popoutValue"
|
|
30
|
-
@
|
|
30
|
+
@change="onChange"
|
|
31
31
|
>
|
|
32
32
|
<template #custom="{ toggle }">
|
|
33
33
|
<sar-list inlaid>
|
|
@@ -106,7 +106,7 @@ export default _defineComponent({
|
|
|
106
106
|
clearable: { type: Boolean, required: false },
|
|
107
107
|
loading: { type: Boolean, required: false },
|
|
108
108
|
multiline: { type: Boolean, required: false }
|
|
109
|
-
}, defaultCheckboxInputProps),
|
|
109
|
+
}, defaultCheckboxInputProps()),
|
|
110
110
|
emits: ["update:visible", "update:model-value", "change"],
|
|
111
111
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
112
112
|
__expose();
|
|
@@ -5,7 +5,7 @@ export interface CheckboxInputProps extends CheckboxGroupProps, Omit<PopoutInput
|
|
|
5
5
|
visible?: boolean;
|
|
6
6
|
title?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare const defaultCheckboxInputProps: {
|
|
8
|
+
export declare const defaultCheckboxInputProps: () => {
|
|
9
9
|
options: () => never[];
|
|
10
10
|
validateEvent: boolean;
|
|
11
11
|
};
|
|
@@ -25,6 +25,7 @@ import { type RadioGroupProps } from '../radio';
|
|
|
25
25
|
import { type RadioInputProps } from '../radio-input';
|
|
26
26
|
import { type ResultProps } from '../result';
|
|
27
27
|
import { type SearchProps } from '../search';
|
|
28
|
+
import { type SpaceProps } from '../space';
|
|
28
29
|
import { type StepperProps } from '../stepper';
|
|
29
30
|
import { type StepsProps } from '../steps';
|
|
30
31
|
import { type SwiperDotProps } from '../swiper-dot';
|
|
@@ -70,6 +71,7 @@ export declare const defaultConfig: {
|
|
|
70
71
|
calendarInput: {
|
|
71
72
|
showConfirm: boolean;
|
|
72
73
|
validateEvent: boolean;
|
|
74
|
+
outletFormat: string;
|
|
73
75
|
};
|
|
74
76
|
cascaderInput: {
|
|
75
77
|
showConfirm: boolean;
|
|
@@ -304,6 +306,10 @@ export declare const defaultConfig: {
|
|
|
304
306
|
step: number;
|
|
305
307
|
validateEvent: boolean;
|
|
306
308
|
};
|
|
309
|
+
space: {
|
|
310
|
+
direction: SpaceProps["direction"];
|
|
311
|
+
size: SpaceProps["size"];
|
|
312
|
+
};
|
|
307
313
|
stepper: {
|
|
308
314
|
min: number;
|
|
309
315
|
max: number;
|
|
@@ -32,6 +32,7 @@ export const defaultConfig = {
|
|
|
32
32
|
calendarInput: {
|
|
33
33
|
showConfirm: true,
|
|
34
34
|
validateEvent: true,
|
|
35
|
+
outletFormat: 'YYYY-MM-DD',
|
|
35
36
|
},
|
|
36
37
|
cascaderInput: {
|
|
37
38
|
showConfirm: true,
|
|
@@ -266,6 +267,10 @@ export const defaultConfig = {
|
|
|
266
267
|
step: 1,
|
|
267
268
|
validateEvent: true,
|
|
268
269
|
},
|
|
270
|
+
space: {
|
|
271
|
+
direction: 'horizontal',
|
|
272
|
+
size: 'middle',
|
|
273
|
+
},
|
|
269
274
|
stepper: {
|
|
270
275
|
min: Number.MIN_SAFE_INTEGER,
|
|
271
276
|
max: Number.MAX_SAFE_INTEGER,
|
|
@@ -5,16 +5,17 @@ export interface DatetimePickerProps {
|
|
|
5
5
|
type?: string;
|
|
6
6
|
min?: Date;
|
|
7
7
|
max?: Date;
|
|
8
|
-
modelValue?: Date;
|
|
8
|
+
modelValue?: Date | string;
|
|
9
9
|
filter?: (letter: DatetimeLetter, value: number, date: Date, index: number) => boolean;
|
|
10
10
|
formatter?: (letter: DatetimeLetter, option: DatetimeColumnOption, date: Date, index: number) => string | void | undefined;
|
|
11
|
+
valueFormat?: string;
|
|
11
12
|
}
|
|
12
13
|
export declare const defaultDatetimePickerProps: {
|
|
13
14
|
type: string;
|
|
14
15
|
};
|
|
15
16
|
export interface DatetimePickerEmits {
|
|
16
|
-
(e: 'update:model-value', date: Date): void;
|
|
17
|
-
(e: 'change', date: Date): void;
|
|
17
|
+
(e: 'update:model-value', date: Date | string): void;
|
|
18
|
+
(e: 'change', date: Date | string): void;
|
|
18
19
|
}
|
|
19
20
|
export interface DatetimeColumnOption {
|
|
20
21
|
value: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type DatetimePickerProps } from './common';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<DatetimePickerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
3
|
-
"update:model-value": (date: Date) => any;
|
|
4
|
-
change: (date: Date) => any;
|
|
3
|
+
"update:model-value": (date: string | Date) => any;
|
|
4
|
+
change: (date: string | Date) => any;
|
|
5
5
|
}, string, import("vue").PublicProps, Readonly<DatetimePickerProps> & Readonly<{
|
|
6
|
-
"onUpdate:model-value"?: ((date: Date) => any) | undefined;
|
|
7
|
-
onChange?: ((date: Date) => any) | undefined;
|
|
6
|
+
"onUpdate:model-value"?: ((date: string | Date) => any) | undefined;
|
|
7
|
+
onChange?: ((date: string | Date) => any) | undefined;
|
|
8
8
|
}>, {
|
|
9
9
|
type: string;
|
|
10
10
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
:root-style="stringifyStyle(rootStyle)"
|
|
5
5
|
:columns="columns"
|
|
6
6
|
:model-value="pickerValue"
|
|
7
|
-
@
|
|
7
|
+
@change="onChange"
|
|
8
8
|
/>
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script>
|
|
12
12
|
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
13
13
|
import { computed, ref, watch } from "vue";
|
|
14
|
-
import { classNames, stringifyStyle } from "../../utils";
|
|
14
|
+
import { classNames, formatDate, parseDate, stringifyStyle } from "../../utils";
|
|
15
15
|
import SarPicker from "../picker/picker.vue";
|
|
16
16
|
import {
|
|
17
17
|
correctDate,
|
|
@@ -41,9 +41,10 @@ export default _defineComponent({
|
|
|
41
41
|
type: { type: String, required: false },
|
|
42
42
|
min: { type: Date, required: false },
|
|
43
43
|
max: { type: Date, required: false },
|
|
44
|
-
modelValue: { type: Date, required: false },
|
|
44
|
+
modelValue: { type: [Date, String], required: false },
|
|
45
45
|
filter: { type: Function, required: false },
|
|
46
|
-
formatter: { type: Function, required: false }
|
|
46
|
+
formatter: { type: Function, required: false },
|
|
47
|
+
valueFormat: { type: String, required: false }
|
|
47
48
|
}, defaultDatetimePickerProps),
|
|
48
49
|
emits: ["update:model-value", "change"],
|
|
49
50
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -109,9 +110,15 @@ export default _defineComponent({
|
|
|
109
110
|
const date = new Date(...currEvery);
|
|
110
111
|
return date;
|
|
111
112
|
};
|
|
113
|
+
const toDate = (date) => {
|
|
114
|
+
if (date instanceof Date) {
|
|
115
|
+
return date;
|
|
116
|
+
}
|
|
117
|
+
return parseDate(date, props.valueFormat);
|
|
118
|
+
};
|
|
112
119
|
const normalizeValue = (value) => {
|
|
113
|
-
|
|
114
|
-
return
|
|
120
|
+
const date = value ? toDate(value) : new Date();
|
|
121
|
+
return date.getTime() < minDate.value.getTime() ? minDate.value : date.getTime() > maxDate.value.getTime() ? maxDate.value : date;
|
|
115
122
|
};
|
|
116
123
|
const innerType = computed(() => {
|
|
117
124
|
return props.type.split("");
|
|
@@ -122,12 +129,15 @@ export default _defineComponent({
|
|
|
122
129
|
return maxDate2 < minDate.value ? new Date(minDate.value) : maxDate2;
|
|
123
130
|
});
|
|
124
131
|
const innerValue = ref(normalizeValue(props.modelValue));
|
|
132
|
+
let currentEmitValue = innerValue.value;
|
|
125
133
|
watch(
|
|
126
134
|
() => props.modelValue,
|
|
127
135
|
() => {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
136
|
+
if (currentEmitValue !== props.modelValue) {
|
|
137
|
+
innerValue.value = normalizeValue(props.modelValue);
|
|
138
|
+
if (props.modelValue) {
|
|
139
|
+
updateColumns(innerValue.value);
|
|
140
|
+
}
|
|
131
141
|
}
|
|
132
142
|
}
|
|
133
143
|
);
|
|
@@ -143,11 +153,17 @@ export default _defineComponent({
|
|
|
143
153
|
const onChange = (value) => {
|
|
144
154
|
const nextValue = getDateByPickerValue(value);
|
|
145
155
|
innerValue.value = nextValue;
|
|
156
|
+
const emitValue = props.valueFormat ? formatDate(nextValue, props.valueFormat) : nextValue;
|
|
157
|
+
currentEmitValue = emitValue;
|
|
146
158
|
updateColumns(nextValue);
|
|
147
|
-
emit("update:model-value",
|
|
148
|
-
emit("change",
|
|
159
|
+
emit("update:model-value", emitValue);
|
|
160
|
+
emit("change", emitValue);
|
|
149
161
|
};
|
|
150
|
-
const __returned__ = { props, emit, t, createColumnData, getChangedLetter, updateColumns, getDateByPickerValue, normalizeValue, innerType, minDate, maxDate, innerValue,
|
|
162
|
+
const __returned__ = { props, emit, t, createColumnData, getChangedLetter, updateColumns, getDateByPickerValue, toDate, normalizeValue, innerType, minDate, maxDate, innerValue, get currentEmitValue() {
|
|
163
|
+
return currentEmitValue;
|
|
164
|
+
}, set currentEmitValue(v) {
|
|
165
|
+
currentEmitValue = v;
|
|
166
|
+
}, pickerValue, columnsMap, get minValues() {
|
|
151
167
|
return minValues;
|
|
152
168
|
}, set minValues(v) {
|
|
153
169
|
minValues = v;
|
|
@@ -4,21 +4,23 @@ export interface DatetimePickerInputProps extends DatetimePickerProps, Omit<Popo
|
|
|
4
4
|
visible?: boolean;
|
|
5
5
|
title?: string;
|
|
6
6
|
outletFormat?: string;
|
|
7
|
+
valueFormat?: string;
|
|
7
8
|
validateEvent?: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare const defaultDatetimePickerInputProps: {
|
|
10
|
+
export declare const defaultDatetimePickerInputProps: () => {
|
|
10
11
|
validateEvent: boolean;
|
|
11
12
|
type: string;
|
|
12
13
|
};
|
|
13
14
|
export interface DatetimePickerInputEmits {
|
|
14
15
|
(e: 'update:visible', visible: boolean): void;
|
|
15
|
-
(e: 'update:model-value', date: Date | undefined): void;
|
|
16
|
-
(e: 'change', date: Date | undefined): void;
|
|
16
|
+
(e: 'update:model-value', date: Date | string | undefined): void;
|
|
17
|
+
(e: 'change', date: Date | string | undefined): void;
|
|
17
18
|
}
|
|
18
19
|
export declare const mapTypeFormat: {
|
|
19
20
|
y: string;
|
|
20
21
|
yM: string;
|
|
21
22
|
yMd: string;
|
|
23
|
+
yMdh: string;
|
|
22
24
|
yMdhm: string;
|
|
23
25
|
yMdhms: string;
|
|
24
26
|
hm: string;
|