@v-c/picker 0.0.1 → 0.0.3
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/dist/PickerInput/RangePicker.cjs +0 -1
- package/dist/PickerInput/RangePicker.js +0 -1
- package/dist/PickerInput/Selector/Input.js +3 -3
- package/dist/PickerInput/Selector/RangeSelector.cjs +5 -2
- package/dist/PickerInput/Selector/RangeSelector.js +5 -2
- package/dist/PickerInput/Selector/SingleSelector/index.cjs +5 -2
- package/dist/PickerInput/Selector/SingleSelector/index.js +5 -2
- package/dist/PickerInput/SinglePicker.cjs +6 -6
- package/dist/PickerInput/SinglePicker.js +6 -6
- package/dist/PickerInput/hooks/useDelayState.cjs +4 -3
- package/dist/PickerInput/hooks/useDelayState.js +1 -1
- package/dist/PickerInput/hooks/useRangeValue.cjs +2 -1
- package/dist/PickerInput/hooks/useRangeValue.js +2 -1
- package/dist/PickerPanel/TimePanel/TimePanelBody/useScrollTo.cjs +5 -4
- package/dist/PickerPanel/TimePanel/TimePanelBody/useScrollTo.js +1 -1
- package/dist/generate/dayjs.cjs +28 -28
- package/dist/generate/dayjs.js +7 -7
- package/package.json +10 -4
|
@@ -166,7 +166,6 @@ var RangePicker = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose }) =
|
|
|
166
166
|
};
|
|
167
167
|
const onSelectorClick = (event) => {
|
|
168
168
|
const rootNode = event.target.getRootNode();
|
|
169
|
-
console.log(rootNode);
|
|
170
169
|
if (!selectorRef.value?.nativeElement?.contains(rootNode.activeElement ?? document.activeElement)) {
|
|
171
170
|
const enabledIndex = disabled.value.findIndex((d) => !d);
|
|
172
171
|
if (enabledIndex >= 0) selectorRef.value?.focus({ index: enabledIndex });
|
|
@@ -158,7 +158,6 @@ var RangePicker_default = /* @__PURE__ */ defineComponent((props, { expose }) =>
|
|
|
158
158
|
};
|
|
159
159
|
const onSelectorClick = (event) => {
|
|
160
160
|
const rootNode = event.target.getRootNode();
|
|
161
|
-
console.log(rootNode);
|
|
162
161
|
if (!selectorRef.value?.nativeElement?.contains(rootNode.activeElement ?? document.activeElement)) {
|
|
163
162
|
const enabledIndex = disabled.value.findIndex((d) => !d);
|
|
164
163
|
if (enabledIndex >= 0) selectorRef.value?.focus({ index: enabledIndex });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { usePickerContext } from "../context.js";
|
|
2
2
|
import { leftPad } from "../../utils/miscUtil.js";
|
|
3
|
-
import { getMaskRange, raf
|
|
3
|
+
import { getMaskRange, raf } from "./util.js";
|
|
4
4
|
import useLockEffect from "../hooks/useLockEffect.js";
|
|
5
5
|
import Icon_default from "./Icon.js";
|
|
6
6
|
import MaskFormat from "./MaskFormat.js";
|
|
@@ -174,12 +174,12 @@ var Input_default = /* @__PURE__ */ defineComponent((props, { attrs, expose }) =
|
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
176
|
inputRef.value?.setSelectionRange(selectionStart.value, selectionEnd.value);
|
|
177
|
-
rafRef.value = raf
|
|
177
|
+
rafRef.value = raf(() => {
|
|
178
178
|
inputRef.value?.setSelectionRange(selectionStart.value, selectionEnd.value);
|
|
179
179
|
});
|
|
180
180
|
}, { flush: "post" });
|
|
181
181
|
onBeforeUnmount(() => {
|
|
182
|
-
raf
|
|
182
|
+
raf.cancel(rafRef.value);
|
|
183
183
|
});
|
|
184
184
|
return () => {
|
|
185
185
|
const { className, active, showActiveCls, suffixIcon, format, validateFormat, onChange, onInput, helped, onHelp, onSubmit, onKeyDown, preserveInvalidOnBlur, invalid, clearIcon, ...restProps } = props;
|
|
@@ -86,8 +86,11 @@ var RangeSelector = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, ex
|
|
|
86
86
|
[`${prefixCls.value}-disabled`]: disabled?.every((i) => i),
|
|
87
87
|
[`${prefixCls.value}-invalid`]: invalid?.some((i) => i),
|
|
88
88
|
[`${prefixCls.value}-rtl`]: rtl.value
|
|
89
|
-
}, attrs.class),
|
|
90
|
-
style:
|
|
89
|
+
}, attrs.class, props.class),
|
|
90
|
+
style: {
|
|
91
|
+
...attrs.style,
|
|
92
|
+
...props.style
|
|
93
|
+
},
|
|
91
94
|
onClick: (event) => {
|
|
92
95
|
if (Array.isArray(onClick)) onClick.forEach((fn) => fn?.(event));
|
|
93
96
|
else onClick?.(event);
|
|
@@ -80,8 +80,11 @@ var RangeSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, exp
|
|
|
80
80
|
[`${prefixCls.value}-disabled`]: disabled?.every((i) => i),
|
|
81
81
|
[`${prefixCls.value}-invalid`]: invalid?.some((i) => i),
|
|
82
82
|
[`${prefixCls.value}-rtl`]: rtl.value
|
|
83
|
-
}, attrs.class),
|
|
84
|
-
style:
|
|
83
|
+
}, attrs.class, props.class),
|
|
84
|
+
style: {
|
|
85
|
+
...attrs.style,
|
|
86
|
+
...props.style
|
|
87
|
+
},
|
|
85
88
|
onClick: (event) => {
|
|
86
89
|
if (Array.isArray(onClick)) onClick.forEach((fn) => fn?.(event));
|
|
87
90
|
else onClick?.(event);
|
|
@@ -93,8 +93,11 @@ var SingleSelector = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, e
|
|
|
93
93
|
[`${prefixCls.value}-disabled`]: disabled,
|
|
94
94
|
[`${prefixCls.value}-invalid`]: invalid,
|
|
95
95
|
[`${prefixCls.value}-rtl`]: rtl.value
|
|
96
|
-
}, attrs.class),
|
|
97
|
-
"style": {
|
|
96
|
+
}, props.class, attrs.class),
|
|
97
|
+
"style": {
|
|
98
|
+
...attrs.style,
|
|
99
|
+
...props.style
|
|
100
|
+
},
|
|
98
101
|
"ref": rootRef,
|
|
99
102
|
"onClick": onClick,
|
|
100
103
|
"onMousedown": (e) => {
|
|
@@ -88,8 +88,11 @@ var SingleSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, ex
|
|
|
88
88
|
[`${prefixCls.value}-disabled`]: disabled,
|
|
89
89
|
[`${prefixCls.value}-invalid`]: invalid,
|
|
90
90
|
[`${prefixCls.value}-rtl`]: rtl.value
|
|
91
|
-
}, attrs.class),
|
|
92
|
-
"style": {
|
|
91
|
+
}, props.class, attrs.class),
|
|
92
|
+
"style": {
|
|
93
|
+
...attrs.style,
|
|
94
|
+
...props.style
|
|
95
|
+
},
|
|
93
96
|
"ref": rootRef,
|
|
94
97
|
"onClick": onClick,
|
|
95
98
|
"onMousedown": (e) => {
|
|
@@ -38,7 +38,6 @@ var SinglePicker = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose })
|
|
|
38
38
|
const defaultValue = (0, vue.computed)(() => fp.value.defaultValue);
|
|
39
39
|
const value = (0, vue.computed)(() => fp.value.value);
|
|
40
40
|
const needConfirm = (0, vue.computed)(() => fp.value.needConfirm);
|
|
41
|
-
const onChange = (0, vue.computed)(() => fp.value.onChange);
|
|
42
41
|
const onKeyDown = (0, vue.computed)(() => fp.value.onKeyDown);
|
|
43
42
|
const disabled = (0, vue.computed)(() => fp.value.disabled);
|
|
44
43
|
const disabledDate = (0, vue.computed)(() => fp.value.disabledDate);
|
|
@@ -121,15 +120,17 @@ var SinglePicker = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose })
|
|
|
121
120
|
triggerFocus(false);
|
|
122
121
|
onBlur.value?.(event, {});
|
|
123
122
|
};
|
|
124
|
-
const
|
|
125
|
-
|
|
123
|
+
const mergedMode = (0, vue.ref)(picker.value ?? mode.value);
|
|
124
|
+
(0, vue.watch)(picker, () => {
|
|
125
|
+
mergedMode.value = picker.value;
|
|
126
|
+
});
|
|
126
127
|
const setMode = (val) => {
|
|
127
|
-
|
|
128
|
+
mergedMode.value = val;
|
|
128
129
|
};
|
|
129
130
|
const internalMode = (0, vue.computed)(() => mergedMode.value === "date" && showTime.value ? "datetime" : mergedMode.value);
|
|
130
131
|
const mergedShowNow = require_useShowNow.default(picker, mergedMode, showNow, showToday);
|
|
131
132
|
const onInternalChange = (dates, dateStrings) => {
|
|
132
|
-
if (onChange
|
|
133
|
+
if (props?.onChange) props?.onChange?.(pickerParam(dates), pickerParam(dateStrings));
|
|
133
134
|
};
|
|
134
135
|
const [, triggerSubmitChange] = require_useRangeValue.default((0, vue.computed)(() => {
|
|
135
136
|
return {
|
|
@@ -199,7 +200,6 @@ var SinglePicker = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose })
|
|
|
199
200
|
onPresetSubmit(now);
|
|
200
201
|
};
|
|
201
202
|
const onPanelHover = (date) => {
|
|
202
|
-
console.log(date);
|
|
203
203
|
onSetHover(date, "cell");
|
|
204
204
|
};
|
|
205
205
|
const onPanelFocus = (event) => {
|
|
@@ -31,7 +31,6 @@ var SinglePicker_default = /* @__PURE__ */ defineComponent((props, { expose }) =
|
|
|
31
31
|
const defaultValue = computed(() => fp.value.defaultValue);
|
|
32
32
|
const value = computed(() => fp.value.value);
|
|
33
33
|
const needConfirm = computed(() => fp.value.needConfirm);
|
|
34
|
-
const onChange = computed(() => fp.value.onChange);
|
|
35
34
|
const onKeyDown = computed(() => fp.value.onKeyDown);
|
|
36
35
|
const disabled = computed(() => fp.value.disabled);
|
|
37
36
|
const disabledDate = computed(() => fp.value.disabledDate);
|
|
@@ -114,15 +113,17 @@ var SinglePicker_default = /* @__PURE__ */ defineComponent((props, { expose }) =
|
|
|
114
113
|
triggerFocus(false);
|
|
115
114
|
onBlur.value?.(event, {});
|
|
116
115
|
};
|
|
117
|
-
const
|
|
118
|
-
|
|
116
|
+
const mergedMode = ref(picker.value ?? mode.value);
|
|
117
|
+
watch(picker, () => {
|
|
118
|
+
mergedMode.value = picker.value;
|
|
119
|
+
});
|
|
119
120
|
const setMode = (val) => {
|
|
120
|
-
|
|
121
|
+
mergedMode.value = val;
|
|
121
122
|
};
|
|
122
123
|
const internalMode = computed(() => mergedMode.value === "date" && showTime.value ? "datetime" : mergedMode.value);
|
|
123
124
|
const mergedShowNow = useShowNow(picker, mergedMode, showNow, showToday);
|
|
124
125
|
const onInternalChange = (dates, dateStrings) => {
|
|
125
|
-
if (onChange
|
|
126
|
+
if (props?.onChange) props?.onChange?.(pickerParam(dates), pickerParam(dateStrings));
|
|
126
127
|
};
|
|
127
128
|
const [, triggerSubmitChange] = useRangeValue(computed(() => {
|
|
128
129
|
return {
|
|
@@ -192,7 +193,6 @@ var SinglePicker_default = /* @__PURE__ */ defineComponent((props, { expose }) =
|
|
|
192
193
|
onPresetSubmit(now);
|
|
193
194
|
};
|
|
194
195
|
const onPanelHover = (date) => {
|
|
195
|
-
console.log(date);
|
|
196
196
|
onSetHover(date, "cell");
|
|
197
197
|
};
|
|
198
198
|
const onPanelFocus = (event) => {
|
|
@@ -4,14 +4,15 @@ Object.defineProperties(exports, {
|
|
|
4
4
|
});
|
|
5
5
|
const require_rolldown_runtime = require("../../_virtual/rolldown_runtime.cjs");
|
|
6
6
|
let vue = require("vue");
|
|
7
|
-
let
|
|
7
|
+
let _v_c_util_dist_raf = require("@v-c/util/dist/raf");
|
|
8
|
+
_v_c_util_dist_raf = require_rolldown_runtime.__toESM(_v_c_util_dist_raf);
|
|
8
9
|
function useDelayState(value, defaultValue, onChange) {
|
|
9
10
|
const internalValue = (0, vue.ref)(defaultValue);
|
|
10
11
|
const state = (0, vue.computed)(() => value.value !== void 0 ? value.value : internalValue.value);
|
|
11
12
|
const nextValueRef = (0, vue.ref)(state.value);
|
|
12
13
|
const rafRef = (0, vue.ref)();
|
|
13
14
|
const cancelRaf = () => {
|
|
14
|
-
if (rafRef.value)
|
|
15
|
+
if (rafRef.value) _v_c_util_dist_raf.default.cancel(rafRef.value);
|
|
15
16
|
};
|
|
16
17
|
const doUpdate = () => {
|
|
17
18
|
if (value.value === void 0) internalValue.value = nextValueRef.value;
|
|
@@ -21,7 +22,7 @@ function useDelayState(value, defaultValue, onChange) {
|
|
|
21
22
|
cancelRaf();
|
|
22
23
|
nextValueRef.value = next;
|
|
23
24
|
if (next || immediately) doUpdate();
|
|
24
|
-
else rafRef.value = (0,
|
|
25
|
+
else rafRef.value = (0, _v_c_util_dist_raf.default)(doUpdate);
|
|
25
26
|
};
|
|
26
27
|
(0, vue.watch)(value, () => {
|
|
27
28
|
if (value.value !== void 0) nextValueRef.value = value.value;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed, onBeforeUnmount, ref, watch } from "vue";
|
|
2
|
-
import
|
|
2
|
+
import raf from "@v-c/util/dist/raf";
|
|
3
3
|
function useDelayState(value, defaultValue, onChange) {
|
|
4
4
|
const internalValue = ref(defaultValue);
|
|
5
5
|
const state = computed(() => value.value !== void 0 ? value.value : internalValue.value);
|
|
@@ -105,8 +105,9 @@ function useRangeValue(info, mergedValue, setInnerValue, getCalendarValue, trigg
|
|
|
105
105
|
}));
|
|
106
106
|
const allPassed = isNullValue || validateEmptyDateRange && validateOrder && validateDates;
|
|
107
107
|
if (allPassed) {
|
|
108
|
+
const oldValue = mergedValue.value;
|
|
108
109
|
setInnerValue(clone);
|
|
109
|
-
const [isSameMergedDates] = isSameDates(clone,
|
|
110
|
+
const [isSameMergedDates] = isSameDates(clone, oldValue);
|
|
110
111
|
if (onChange && !isSameMergedDates) {
|
|
111
112
|
const everyEmpty = clone.every((val) => !val);
|
|
112
113
|
onChange(isNullValue && everyEmpty ? null : clone, everyEmpty ? null : getDateTexts(clone));
|
|
@@ -100,8 +100,9 @@ function useRangeValue(info, mergedValue, setInnerValue, getCalendarValue, trigg
|
|
|
100
100
|
}));
|
|
101
101
|
const allPassed = isNullValue || validateEmptyDateRange && validateOrder && validateDates;
|
|
102
102
|
if (allPassed) {
|
|
103
|
+
const oldValue = mergedValue.value;
|
|
103
104
|
setInnerValue(clone);
|
|
104
|
-
const [isSameMergedDates] = isSameDates(clone,
|
|
105
|
+
const [isSameMergedDates] = isSameDates(clone, oldValue);
|
|
105
106
|
if (onChange && !isSameMergedDates) {
|
|
106
107
|
const everyEmpty = clone.every((val) => !val);
|
|
107
108
|
onChange(isNullValue && everyEmpty ? null : clone, everyEmpty ? null : getDateTexts(clone));
|
|
@@ -4,7 +4,8 @@ Object.defineProperties(exports, {
|
|
|
4
4
|
});
|
|
5
5
|
const require_rolldown_runtime = require("../../../_virtual/rolldown_runtime.cjs");
|
|
6
6
|
let vue = require("vue");
|
|
7
|
-
let
|
|
7
|
+
let _v_c_util_dist_raf = require("@v-c/util/dist/raf");
|
|
8
|
+
_v_c_util_dist_raf = require_rolldown_runtime.__toESM(_v_c_util_dist_raf);
|
|
8
9
|
var SPEED_PTG = 1 / 3;
|
|
9
10
|
function useScrollTo(ulRef, value) {
|
|
10
11
|
const scrollingRef = (0, vue.ref)(false);
|
|
@@ -13,7 +14,7 @@ function useScrollTo(ulRef, value) {
|
|
|
13
14
|
const scrollRafTimesRef = (0, vue.ref)(0);
|
|
14
15
|
const isScrolling = () => scrollingRef.value;
|
|
15
16
|
const stopScroll = () => {
|
|
16
|
-
if (scrollRafRef.value)
|
|
17
|
+
if (scrollRafRef.value) _v_c_util_dist_raf.default.cancel(scrollRafRef.value);
|
|
17
18
|
scrollingRef.value = false;
|
|
18
19
|
};
|
|
19
20
|
const startScroll = () => {
|
|
@@ -35,7 +36,7 @@ function useScrollTo(ulRef, value) {
|
|
|
35
36
|
const targetTop = targetLiTop - firstLiTop;
|
|
36
37
|
const isVisible = ul.offsetParent !== null;
|
|
37
38
|
if (targetLiTop === 0 && targetLi !== firstLi || !isVisible) {
|
|
38
|
-
if (scrollRafTimesRef.value <= 5) scrollRafRef.value = (0,
|
|
39
|
+
if (scrollRafTimesRef.value <= 5) scrollRafRef.value = (0, _v_c_util_dist_raf.default)(doScroll);
|
|
39
40
|
return;
|
|
40
41
|
}
|
|
41
42
|
const nextTop = currentTop + (targetTop - currentTop) * SPEED_PTG;
|
|
@@ -51,7 +52,7 @@ function useScrollTo(ulRef, value) {
|
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
54
|
ul.scrollTop = nextTop;
|
|
54
|
-
scrollRafRef.value = (0,
|
|
55
|
+
scrollRafRef.value = (0, _v_c_util_dist_raf.default)(doScroll);
|
|
55
56
|
};
|
|
56
57
|
if (targetLi && firstLi) doScroll();
|
|
57
58
|
}
|
package/dist/generate/dayjs.cjs
CHANGED
|
@@ -3,27 +3,27 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let
|
|
7
|
-
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
let
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
6
|
+
let dayjs = require("dayjs");
|
|
7
|
+
dayjs = require_rolldown_runtime.__toESM(dayjs);
|
|
8
|
+
let dayjs_plugin_advancedFormat = require("dayjs/plugin/advancedFormat");
|
|
9
|
+
dayjs_plugin_advancedFormat = require_rolldown_runtime.__toESM(dayjs_plugin_advancedFormat);
|
|
10
|
+
let dayjs_plugin_customParseFormat = require("dayjs/plugin/customParseFormat");
|
|
11
|
+
dayjs_plugin_customParseFormat = require_rolldown_runtime.__toESM(dayjs_plugin_customParseFormat);
|
|
12
|
+
let dayjs_plugin_localeData = require("dayjs/plugin/localeData");
|
|
13
|
+
dayjs_plugin_localeData = require_rolldown_runtime.__toESM(dayjs_plugin_localeData);
|
|
14
|
+
let dayjs_plugin_weekday = require("dayjs/plugin/weekday");
|
|
15
|
+
dayjs_plugin_weekday = require_rolldown_runtime.__toESM(dayjs_plugin_weekday);
|
|
16
|
+
let dayjs_plugin_weekOfYear = require("dayjs/plugin/weekOfYear");
|
|
17
|
+
dayjs_plugin_weekOfYear = require_rolldown_runtime.__toESM(dayjs_plugin_weekOfYear);
|
|
18
|
+
let dayjs_plugin_weekYear = require("dayjs/plugin/weekYear");
|
|
19
|
+
dayjs_plugin_weekYear = require_rolldown_runtime.__toESM(dayjs_plugin_weekYear);
|
|
20
|
+
dayjs.default.extend(dayjs_plugin_customParseFormat.default);
|
|
21
|
+
dayjs.default.extend(dayjs_plugin_advancedFormat.default);
|
|
22
|
+
dayjs.default.extend(dayjs_plugin_weekday.default);
|
|
23
|
+
dayjs.default.extend(dayjs_plugin_localeData.default);
|
|
24
|
+
dayjs.default.extend(dayjs_plugin_weekOfYear.default);
|
|
25
|
+
dayjs.default.extend(dayjs_plugin_weekYear.default);
|
|
26
|
+
dayjs.default.extend((_, c) => {
|
|
27
27
|
const proto = c.prototype;
|
|
28
28
|
const oldFormat = proto.format;
|
|
29
29
|
proto.format = function f(formatStr) {
|
|
@@ -53,11 +53,11 @@ function parseLocale(locale) {
|
|
|
53
53
|
function parseNoMatchNotice() {}
|
|
54
54
|
var generateConfig = {
|
|
55
55
|
getNow: () => {
|
|
56
|
-
const now = (0,
|
|
56
|
+
const now = (0, dayjs.default)();
|
|
57
57
|
if ("tz" in now && typeof now.tz === "function") return now.tz();
|
|
58
58
|
return now;
|
|
59
59
|
},
|
|
60
|
-
getFixedDate: (string) => (0,
|
|
60
|
+
getFixedDate: (string) => (0, dayjs.default)(string, ["YYYY-M-DD", "YYYY-MM-DD"]),
|
|
61
61
|
getEndDate: (date) => date.endOf("month"),
|
|
62
62
|
getWeekDay: (date) => {
|
|
63
63
|
const clone = date.locale("en");
|
|
@@ -83,11 +83,11 @@ var generateConfig = {
|
|
|
83
83
|
isAfter: (date1, date2) => date1.isAfter(date2),
|
|
84
84
|
isValidate: (date) => date.isValid(),
|
|
85
85
|
locale: {
|
|
86
|
-
getWeekFirstDay: (locale) => (0,
|
|
86
|
+
getWeekFirstDay: (locale) => (0, dayjs.default)().locale(parseLocale(locale)).localeData().firstDayOfWeek(),
|
|
87
87
|
getWeekFirstDate: (locale, date) => date.locale(parseLocale(locale)).weekday(0),
|
|
88
88
|
getWeek: (locale, date) => date.locale(parseLocale(locale)).week(),
|
|
89
|
-
getShortWeekDays: (locale) => (0,
|
|
90
|
-
getShortMonths: (locale) => (0,
|
|
89
|
+
getShortWeekDays: (locale) => (0, dayjs.default)().locale(parseLocale(locale)).localeData().weekdaysMin(),
|
|
90
|
+
getShortMonths: (locale) => (0, dayjs.default)().locale(parseLocale(locale)).localeData().monthsShort(),
|
|
91
91
|
format: (locale, date, format) => date.locale(parseLocale(locale)).format(format),
|
|
92
92
|
parse: (locale, text, formats) => {
|
|
93
93
|
const localeStr = parseLocale(locale);
|
|
@@ -97,7 +97,7 @@ var generateConfig = {
|
|
|
97
97
|
if (format.includes("wo") || format.includes("Wo")) {
|
|
98
98
|
const year = formatText.split("-")[0];
|
|
99
99
|
const weekStr = formatText.split("-")[1];
|
|
100
|
-
const firstWeek = (0,
|
|
100
|
+
const firstWeek = (0, dayjs.default)(year, "YYYY").startOf("year").locale(localeStr);
|
|
101
101
|
for (let j = 0; j <= 52; j += 1) {
|
|
102
102
|
const nextWeek = firstWeek.add(j, "week");
|
|
103
103
|
if (nextWeek.format("Wo") === weekStr) return nextWeek;
|
|
@@ -105,7 +105,7 @@ var generateConfig = {
|
|
|
105
105
|
parseNoMatchNotice();
|
|
106
106
|
return null;
|
|
107
107
|
}
|
|
108
|
-
const date = (0,
|
|
108
|
+
const date = (0, dayjs.default)(formatText, format, true).locale(localeStr);
|
|
109
109
|
if (date.isValid()) return date;
|
|
110
110
|
}
|
|
111
111
|
if (text) parseNoMatchNotice();
|
package/dist/generate/dayjs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import dayjs from "dayjs
|
|
2
|
-
import advancedFormat from "dayjs/
|
|
3
|
-
import customParseFormat from "dayjs/
|
|
4
|
-
import localeData from "dayjs/
|
|
5
|
-
import weekday from "dayjs/
|
|
6
|
-
import weekOfYear from "dayjs/
|
|
7
|
-
import weekYear from "dayjs/
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import advancedFormat from "dayjs/plugin/advancedFormat";
|
|
3
|
+
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
4
|
+
import localeData from "dayjs/plugin/localeData";
|
|
5
|
+
import weekday from "dayjs/plugin/weekday";
|
|
6
|
+
import weekOfYear from "dayjs/plugin/weekOfYear";
|
|
7
|
+
import weekYear from "dayjs/plugin/weekYear";
|
|
8
8
|
dayjs.extend(customParseFormat);
|
|
9
9
|
dayjs.extend(advancedFormat);
|
|
10
10
|
dayjs.extend(weekday);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/picker",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"description": "picker ui component for vue",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -28,10 +28,15 @@
|
|
|
28
28
|
"import": "./dist/locale/*.js",
|
|
29
29
|
"require": "./dist/locale/*.cjs"
|
|
30
30
|
},
|
|
31
|
+
"./generate": {
|
|
32
|
+
"types": "./dist/generate/index.d.ts",
|
|
33
|
+
"import": "./dist/generate/index.js",
|
|
34
|
+
"require": "./dist/generate/index.cjs"
|
|
35
|
+
},
|
|
31
36
|
"./generate/*": {
|
|
37
|
+
"types": "./dist/generate/*.d.ts",
|
|
32
38
|
"import": "./dist/generate/*.js",
|
|
33
|
-
"require": "./dist/generate/*.cjs"
|
|
34
|
-
"types": "./dist/generate/*.d.ts"
|
|
39
|
+
"require": "./dist/generate/*.cjs"
|
|
35
40
|
},
|
|
36
41
|
"./dist/*": {
|
|
37
42
|
"types": "./dist/*.d.ts",
|
|
@@ -68,7 +73,8 @@
|
|
|
68
73
|
},
|
|
69
74
|
"dependencies": {
|
|
70
75
|
"@v-c/overflow": "^1.0.1",
|
|
71
|
-
"@v-c/util": "^1.0.6"
|
|
76
|
+
"@v-c/util": "^1.0.6",
|
|
77
|
+
"@v-c/trigger": "^1.0.2"
|
|
72
78
|
},
|
|
73
79
|
"devDependencies": {
|
|
74
80
|
"@types/luxon": "^3.7.1"
|