@sdata/web-vue 1.1.0 → 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 +2 -5
- package/es/_utils/date.js +15 -15
- package/es/statistic/countdown.vue_vue_type_script_lang.js +5 -5
- package/es/statistic/statistic.vue_vue_type_script_lang.js +2 -2
- package/json/vetur-attributes.json +1279 -1279
- package/json/vetur-tags.json +552 -552
- package/json/web-types.json +2932 -2932
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -87,9 +87,6 @@ pnpm run build:all
|
|
|
87
87
|
# 根目录:仅打包组件库
|
|
88
88
|
pnpm run build:component
|
|
89
89
|
|
|
90
|
-
# 根目录:重新生成组件文档元数据
|
|
91
|
-
pnpm run docgen
|
|
92
|
-
|
|
93
90
|
# 根目录:运行测试
|
|
94
91
|
pnpm run test
|
|
95
92
|
|
|
@@ -118,8 +115,8 @@ pnpm --filter @sdata/web-vue run build
|
|
|
118
115
|
|
|
119
116
|
# 相关链接
|
|
120
117
|
|
|
121
|
-
- [暗黑模式](https://69dcb47c8b4208264c6e77c6--sensational-caramel-b44e12.netlify.app/
|
|
122
|
-
- [主题配置](https://69dcb47c8b4208264c6e77c6--sensational-caramel-b44e12.netlify.app/
|
|
118
|
+
- [暗黑模式](https://69dcb47c8b4208264c6e77c6--sensational-caramel-b44e12.netlify.app/guides/dark)
|
|
119
|
+
- [主题配置](https://69dcb47c8b4208264c6e77c6--sensational-caramel-b44e12.netlify.app/guides/theme)
|
|
123
120
|
- [Figma 设计资源](https://www.figma.com/file/FVu1DydEeXvJqXrkOb90Oi/SD Design%E7%BB%84%E4%BB%B6%E8%AE%BE%E8%AE%A1_2.0?node-id=5472%3A308)
|
|
124
121
|
|
|
125
122
|
# 参与贡献
|
package/es/_utils/date.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../_virtual/_@oxc-project_runtime@0.124.0/helpers/objectSpread2.js";
|
|
2
2
|
import { isArray, isDayjs, isQuarter } from "./is.js";
|
|
3
|
-
import
|
|
3
|
+
import originDayjs from "dayjs";
|
|
4
4
|
import AdvancedFormat from "dayjs/plugin/advancedFormat";
|
|
5
5
|
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
6
6
|
import isBetween from "dayjs/plugin/isBetween";
|
|
@@ -26,14 +26,14 @@ var overwriteIsDayjs = (_, Dayjs, dayjs) => {
|
|
|
26
26
|
};
|
|
27
27
|
dayjs.isDayjs = isDayjs;
|
|
28
28
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var dayjs
|
|
29
|
+
originDayjs.extend(overwriteIsDayjs);
|
|
30
|
+
originDayjs.extend(customParseFormat);
|
|
31
|
+
originDayjs.extend(isBetween);
|
|
32
|
+
originDayjs.extend(weekOfYear);
|
|
33
|
+
originDayjs.extend(AdvancedFormat);
|
|
34
|
+
originDayjs.extend(weekYear);
|
|
35
|
+
originDayjs.extend(QuarterOfYear);
|
|
36
|
+
var dayjs = originDayjs;
|
|
37
37
|
var methods = {
|
|
38
38
|
add(time, value, unit) {
|
|
39
39
|
return time.add(value, unit);
|
|
@@ -66,7 +66,7 @@ var methods = {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
function getNow() {
|
|
69
|
-
return dayjs
|
|
69
|
+
return dayjs();
|
|
70
70
|
}
|
|
71
71
|
function getSortedDayjsArray(values) {
|
|
72
72
|
return [...values].sort((a, b) => a.valueOf() - b.valueOf());
|
|
@@ -97,10 +97,10 @@ function getDayjsValue(time, format) {
|
|
|
97
97
|
const formatValue = (value) => {
|
|
98
98
|
if (!value) return void 0;
|
|
99
99
|
if (typeof value === "string") {
|
|
100
|
-
if (isQuarter(format)) return dayjs
|
|
101
|
-
if (dayjs
|
|
100
|
+
if (isQuarter(format)) return dayjs(parseQuarterToMonth(value), format.replace(/\[Q]Q/, "MM"));
|
|
101
|
+
if (dayjs(value, format).isValid()) return dayjs(value, format);
|
|
102
102
|
}
|
|
103
|
-
return dayjs
|
|
103
|
+
return dayjs(value);
|
|
104
104
|
};
|
|
105
105
|
if (isArray(time)) return time.map(formatValue);
|
|
106
106
|
return formatValue(time);
|
|
@@ -111,7 +111,7 @@ function getDateValue(value) {
|
|
|
111
111
|
return formatValue(value);
|
|
112
112
|
}
|
|
113
113
|
function initializeDateLocale(localeName, weekStart) {
|
|
114
|
-
dayjs
|
|
114
|
+
dayjs.locale(_objectSpread2(_objectSpread2({}, dayjs.Ls[localeName.toLocaleLowerCase()]), {}, { weekStart }));
|
|
115
115
|
}
|
|
116
116
|
function pickDataAttributes(obj) {
|
|
117
117
|
const clone = {};
|
|
@@ -123,4 +123,4 @@ function pickDataAttributes(obj) {
|
|
|
123
123
|
return clone;
|
|
124
124
|
}
|
|
125
125
|
//#endregion
|
|
126
|
-
export { dayjs
|
|
126
|
+
export { dayjs, getDateValue, getDayjsValue, getNow, getSortedDayjsArray, initializeDateLocale, isValueChange, methods, pickDataAttributes };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getPrefixCls } from "../_utils/global-config.js";
|
|
2
2
|
import { getDateString } from "./utils.js";
|
|
3
3
|
import { defineComponent, onBeforeUnmount, onMounted, ref, toRefs, watch } from "vue";
|
|
4
|
-
import
|
|
4
|
+
import originDayjs from "dayjs";
|
|
5
5
|
//#region components/statistic/countdown.vue?vue&type=script&lang.ts
|
|
6
6
|
var countdown_vue_vue_type_script_lang_default = defineComponent({
|
|
7
7
|
name: "Countdown",
|
|
@@ -29,13 +29,13 @@ var countdown_vue_vue_type_script_lang_default = defineComponent({
|
|
|
29
29
|
setup(props, { emit }) {
|
|
30
30
|
const prefixCls = getPrefixCls("statistic");
|
|
31
31
|
const { start, value, now, format } = toRefs(props);
|
|
32
|
-
const displayValue = ref(getDateString(Math.max(
|
|
32
|
+
const displayValue = ref(getDateString(Math.max(originDayjs(props.value).diff(originDayjs(props.now), "millisecond"), 0), props.format));
|
|
33
33
|
watch([
|
|
34
34
|
value,
|
|
35
35
|
now,
|
|
36
36
|
format
|
|
37
37
|
], () => {
|
|
38
|
-
const _value = getDateString(Math.max(
|
|
38
|
+
const _value = getDateString(Math.max(originDayjs(props.value).diff(originDayjs(props.now), "millisecond"), 0), props.format);
|
|
39
39
|
if (_value !== displayValue.value) displayValue.value = _value;
|
|
40
40
|
});
|
|
41
41
|
const timer = ref(0);
|
|
@@ -46,9 +46,9 @@ var countdown_vue_vue_type_script_lang_default = defineComponent({
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
const startTimer = () => {
|
|
49
|
-
if (
|
|
49
|
+
if (originDayjs(props.value).valueOf() < Date.now()) return;
|
|
50
50
|
timer.value = window.setInterval(() => {
|
|
51
|
-
const _value =
|
|
51
|
+
const _value = originDayjs(props.value).diff(originDayjs(), "millisecond");
|
|
52
52
|
if (_value <= 0) {
|
|
53
53
|
stopTimer();
|
|
54
54
|
emit("finish");
|
|
@@ -2,7 +2,7 @@ import { getPrefixCls } from "../_utils/global-config.js";
|
|
|
2
2
|
import { isNumber, isUndefined } from "../_utils/is.js";
|
|
3
3
|
import { computed, defineComponent, onMounted, ref, toRefs, watch } from "vue";
|
|
4
4
|
import BTween from "b-tween";
|
|
5
|
-
import
|
|
5
|
+
import originDayjs from "dayjs";
|
|
6
6
|
import NP from "number-precision";
|
|
7
7
|
//#region components/statistic/statistic.vue?vue&type=script&lang.ts
|
|
8
8
|
var statistic_vue_vue_type_script_lang_default = defineComponent({
|
|
@@ -83,7 +83,7 @@ var statistic_vue_vue_type_script_lang_default = defineComponent({
|
|
|
83
83
|
decimal: splitValue[1]
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
-
if (props.format) _value =
|
|
86
|
+
if (props.format) _value = originDayjs(_value).format(props.format);
|
|
87
87
|
return {
|
|
88
88
|
isNumber: false,
|
|
89
89
|
value: _value
|