@v-c/picker 1.2.0 → 1.2.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/dist/PickerInput/Popup/index.js +2 -1
- package/dist/PickerInput/RangePicker.js +14 -3
- package/dist/PickerInput/Selector/Input.js +6 -2
- package/dist/PickerInput/Selector/RangeSelector.js +7 -0
- package/dist/PickerInput/Selector/SingleSelector/index.js +7 -0
- package/dist/PickerInput/Selector/hooks/useClearIcon.d.ts +1 -1
- package/dist/PickerInput/SinglePicker.js +11 -2
- package/dist/PickerInput/hooks/useRangeValue.js +2 -1
- package/dist/PickerPanel/TimePanel/TimePanelBody/TimeColumn.js +1 -2
- package/dist/PickerPanel/TimePanel/TimePanelBody/index.js +2 -1
- package/dist/PickerPanel/TimePanel/index.js +1 -2
- package/dist/PickerPanel/index.js +4 -1
- package/dist/generate/dayjs.js +1 -4
- package/package.json +5 -5
|
@@ -45,7 +45,8 @@ var Popup = /* @__PURE__ */ defineComponent((props) => {
|
|
|
45
45
|
}
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
const nextArrowOffset = (rtl.value ? activeInputRight - arrowWidth : activeInputLeft) - wrapperRect.left;
|
|
49
|
+
arrowOffset.value = nextArrowOffset;
|
|
49
50
|
if (containerWidth.value && containerWidth.value < selectorWidth) {
|
|
50
51
|
const offset = rtl.value ? wrapperRect.right - (activeInputRight - arrowWidth + containerWidth.value) : activeInputLeft + arrowWidth - wrapperRect.left - containerWidth.value;
|
|
51
52
|
containerOffset.value = Math.max(0, offset);
|
|
@@ -128,7 +128,9 @@ var RangePicker = /* @__PURE__ */ defineComponent((props, { expose }) => {
|
|
|
128
128
|
if (!showTime.value) return null;
|
|
129
129
|
const { disabledTime } = showTime.value;
|
|
130
130
|
const proxyDisabledTime = disabledTime ? (date) => {
|
|
131
|
-
|
|
131
|
+
const range = getActiveRange(activeIndex.value);
|
|
132
|
+
const fromDate = getFromDate(calendarValue.value, activeIndexList.value, activeIndex.value);
|
|
133
|
+
return disabledTime(date, range, { from: fromDate });
|
|
132
134
|
} : void 0;
|
|
133
135
|
return {
|
|
134
136
|
...showTime.value,
|
|
@@ -239,7 +241,8 @@ var RangePicker = /* @__PURE__ */ defineComponent((props, { expose }) => {
|
|
|
239
241
|
lastOperation("panel");
|
|
240
242
|
};
|
|
241
243
|
const onSelectorChange = (date, index) => {
|
|
242
|
-
|
|
244
|
+
const clone = fillCalendarValue(date, index);
|
|
245
|
+
triggerCalendarChange(clone);
|
|
243
246
|
};
|
|
244
247
|
const onSelectorInputChange = () => {
|
|
245
248
|
lastOperation("input");
|
|
@@ -257,7 +260,8 @@ var RangePicker = /* @__PURE__ */ defineComponent((props, { expose }) => {
|
|
|
257
260
|
onKeyDown.value?.(event, preventDefault);
|
|
258
261
|
};
|
|
259
262
|
const onPanelSelect = (date) => {
|
|
260
|
-
|
|
263
|
+
const clone = fillIndex(calendarValue.value, activeIndex.value, date);
|
|
264
|
+
triggerCalendarChange(clone);
|
|
261
265
|
if (!needConfirm.value && !complexPicker.value && internalPicker.value === internalMode.value) triggerPartConfirm(date);
|
|
262
266
|
};
|
|
263
267
|
const onPopupClose = () => {
|
|
@@ -779,6 +783,13 @@ var RangePicker = /* @__PURE__ */ defineComponent((props, { expose }) => {
|
|
|
779
783
|
default: void 0
|
|
780
784
|
},
|
|
781
785
|
class: {
|
|
786
|
+
type: [
|
|
787
|
+
Boolean,
|
|
788
|
+
null,
|
|
789
|
+
String,
|
|
790
|
+
Object,
|
|
791
|
+
Array
|
|
792
|
+
],
|
|
782
793
|
required: false,
|
|
783
794
|
default: void 0
|
|
784
795
|
},
|
|
@@ -75,7 +75,8 @@ var Input = /* @__PURE__ */ defineComponent((props, { attrs, expose }) => {
|
|
|
75
75
|
};
|
|
76
76
|
const onFormatMouseUp = (event) => {
|
|
77
77
|
const { selectionStart: start } = event.target;
|
|
78
|
-
|
|
78
|
+
const closeMaskIndex = maskFormat.value.getMaskCellIndex(start);
|
|
79
|
+
focusCellIndex.value = closeMaskIndex;
|
|
79
80
|
forceSelectionSyncMark.value = {};
|
|
80
81
|
props.onMouseUp?.(event);
|
|
81
82
|
mouseDownRef.value = false;
|
|
@@ -158,7 +159,10 @@ var Input = /* @__PURE__ */ defineComponent((props, { attrs, expose }) => {
|
|
|
158
159
|
focusCellText.value = "";
|
|
159
160
|
}
|
|
160
161
|
}
|
|
161
|
-
if (nextFillText !== null)
|
|
162
|
+
if (nextFillText !== null) {
|
|
163
|
+
const nextFocusValue = inputValue.value.slice(0, selectionStart.value) + leftPad(nextFillText, maskCellLen) + inputValue.value.slice(selectionEnd.value);
|
|
164
|
+
triggerInputChange(nextFocusValue.slice(0, props.format.length));
|
|
165
|
+
}
|
|
162
166
|
forceSelectionSyncMark.value = {};
|
|
163
167
|
};
|
|
164
168
|
const rafRef = ref();
|
|
@@ -334,6 +334,13 @@ var RangeSelector = /* @__PURE__ */ defineComponent((props, { attrs, expose }) =
|
|
|
334
334
|
default: void 0
|
|
335
335
|
},
|
|
336
336
|
class: {
|
|
337
|
+
type: [
|
|
338
|
+
Boolean,
|
|
339
|
+
null,
|
|
340
|
+
String,
|
|
341
|
+
Object,
|
|
342
|
+
Array
|
|
343
|
+
],
|
|
337
344
|
required: false,
|
|
338
345
|
default: void 0
|
|
339
346
|
},
|
|
@@ -313,6 +313,13 @@ var SingleSelector = /* @__PURE__ */ defineComponent((props, { attrs, expose })
|
|
|
313
313
|
default: void 0
|
|
314
314
|
},
|
|
315
315
|
class: {
|
|
316
|
+
type: [
|
|
317
|
+
Boolean,
|
|
318
|
+
null,
|
|
319
|
+
String,
|
|
320
|
+
Object,
|
|
321
|
+
Array
|
|
322
|
+
],
|
|
316
323
|
required: false,
|
|
317
324
|
default: void 0
|
|
318
325
|
},
|
|
@@ -11,7 +11,7 @@ export declare function fillClearIcon(prefixCls: string, allowClear?: boolean |
|
|
|
11
11
|
[key: string]: any;
|
|
12
12
|
}> | (string | number | boolean | void | import('vue').Component | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
13
13
|
[key: string]: any;
|
|
14
|
-
}> | null | undefined)[] |
|
|
14
|
+
}> | null | undefined)[] | null;
|
|
15
15
|
export default function useClearIcon(prefixCls: Ref<string>, allowClear?: Ref<boolean | {
|
|
16
16
|
clearIcon?: VueNode;
|
|
17
17
|
}>, clearIcon?: ComputedRef<VueNode>): ComputedRef<VueNode>;
|
|
@@ -206,7 +206,8 @@ var SinglePicker = /* @__PURE__ */ defineComponent((props, { expose }) => {
|
|
|
206
206
|
onSetHover(nextValue, "preset");
|
|
207
207
|
};
|
|
208
208
|
const onPresetSubmit = (nextValue) => {
|
|
209
|
-
|
|
209
|
+
const nextCalendarValues = multiple.value ? toggleDates(getCalendarValue.value, nextValue) : [nextValue];
|
|
210
|
+
if (triggerSubmitChange(nextCalendarValues) && !multiple.value) triggerOpen(false, { force: true });
|
|
210
211
|
};
|
|
211
212
|
const onNow = (now) => {
|
|
212
213
|
onPresetSubmit(now);
|
|
@@ -221,7 +222,8 @@ var SinglePicker = /* @__PURE__ */ defineComponent((props, { expose }) => {
|
|
|
221
222
|
const onPanelSelect = (date) => {
|
|
222
223
|
lastOperation("panel");
|
|
223
224
|
if (multiple.value && internalMode.value !== picker.value) return;
|
|
224
|
-
|
|
225
|
+
const nextValues = multiple.value ? toggleDates(getCalendarValue.value, date) : [date];
|
|
226
|
+
triggerCalendarChange(nextValues);
|
|
225
227
|
if (!needConfirm.value && !complexPicker.value && internalPicker.value === internalMode.value) triggerConfirm();
|
|
226
228
|
};
|
|
227
229
|
const onPopupClose = () => {
|
|
@@ -750,6 +752,13 @@ var SinglePicker = /* @__PURE__ */ defineComponent((props, { expose }) => {
|
|
|
750
752
|
default: void 0
|
|
751
753
|
},
|
|
752
754
|
class: {
|
|
755
|
+
type: [
|
|
756
|
+
Boolean,
|
|
757
|
+
null,
|
|
758
|
+
String,
|
|
759
|
+
Object,
|
|
760
|
+
Array
|
|
761
|
+
],
|
|
753
762
|
required: false,
|
|
754
763
|
default: void 0
|
|
755
764
|
},
|
|
@@ -117,7 +117,8 @@ function useRangeValue(info, mergedValue, setInnerValue, getCalendarValue, trigg
|
|
|
117
117
|
return allPassed;
|
|
118
118
|
};
|
|
119
119
|
const flushSubmit = (index, needTriggerChange) => {
|
|
120
|
-
|
|
120
|
+
const nextSubmitValue = fillIndex(submitValue.value, index, getCalendarValue()[index]);
|
|
121
|
+
setSubmitValue(nextSubmitValue);
|
|
121
122
|
if (needTriggerChange) triggerSubmit();
|
|
122
123
|
};
|
|
123
124
|
const interactiveFinished = computed(() => !focused.value && !open.value);
|
|
@@ -55,9 +55,8 @@ var TimeColumn = /* @__PURE__ */ defineComponent((props) => {
|
|
|
55
55
|
const { prefixCls, cellRender, now, locale, classNames: panelClassNames, styles } = context.value;
|
|
56
56
|
const panelPrefixCls = `${prefixCls}-time-panel`;
|
|
57
57
|
const cellPrefixCls = `${prefixCls}-time-panel-cell`;
|
|
58
|
-
const columnPrefixCls = `${panelPrefixCls}-column`;
|
|
59
58
|
return createVNode("ul", {
|
|
60
|
-
"class":
|
|
59
|
+
"class": `${panelPrefixCls}-column`,
|
|
61
60
|
"ref": ulRef,
|
|
62
61
|
"data-type": type,
|
|
63
62
|
"onScroll": onInternalScroll
|
|
@@ -67,7 +67,8 @@ var TimePanelBody = /* @__PURE__ */ defineComponent((props) => {
|
|
|
67
67
|
}];
|
|
68
68
|
})();
|
|
69
69
|
const triggerChange = (nextDate) => {
|
|
70
|
-
|
|
70
|
+
const validateDate = getValidTime(nextDate);
|
|
71
|
+
onSelect(validateDate);
|
|
71
72
|
};
|
|
72
73
|
const triggerDateTmpl = (() => {
|
|
73
74
|
let tmpl = value.value || context.value.pickerValue || generateConfig.value.getNow();
|
|
@@ -14,8 +14,7 @@ var TimePanel = /* @__PURE__ */ defineComponent((props) => {
|
|
|
14
14
|
return () => {
|
|
15
15
|
const { prefixCls, value, locale, generateConfig, showTime } = props;
|
|
16
16
|
const format = typeof showTime === "object" && showTime && showTime.format ? showTime.format : locale?.fieldTimeFormat || "HH:mm:ss";
|
|
17
|
-
|
|
18
|
-
return createVNode("div", { "class": clsx(panelPrefixCls) }, [createVNode(PanelHeader, null, { default: () => [value ? formatValue(value, {
|
|
17
|
+
return createVNode("div", { "class": clsx(`${prefixCls}-time-panel`) }, [createVNode(PanelHeader, null, { default: () => [value ? formatValue(value, {
|
|
19
18
|
locale,
|
|
20
19
|
format,
|
|
21
20
|
generateConfig
|
|
@@ -73,7 +73,10 @@ var PickerPanel = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
73
73
|
};
|
|
74
74
|
const onInternalSelect = (newDate) => {
|
|
75
75
|
props.onSelect?.(newDate);
|
|
76
|
-
if (mergedMode.value === props.picker)
|
|
76
|
+
if (mergedMode.value === props.picker) {
|
|
77
|
+
const nextValues = props.multiple ? toggleDates(mergedValue.value, newDate) : [newDate];
|
|
78
|
+
triggerChange(nextValues);
|
|
79
|
+
}
|
|
77
80
|
};
|
|
78
81
|
const internalPickerValueState = ref(props.defaultPickerValue || mergedValue.value[0] || now.value);
|
|
79
82
|
const mergedPickerValue = computed(() => props.pickerValue !== void 0 ? props.pickerValue : internalPickerValueState.value);
|
package/dist/generate/dayjs.js
CHANGED
|
@@ -38,8 +38,6 @@ var localeMap = {
|
|
|
38
38
|
function parseLocale(locale) {
|
|
39
39
|
return localeMap[locale] || locale.split("_")[0];
|
|
40
40
|
}
|
|
41
|
-
/* istanbul ignore next */
|
|
42
|
-
function parseNoMatchNotice() {}
|
|
43
41
|
var generateConfig = {
|
|
44
42
|
getNow: () => {
|
|
45
43
|
const now = dayjs();
|
|
@@ -91,13 +89,12 @@ var generateConfig = {
|
|
|
91
89
|
const nextWeek = firstWeek.add(j, "week");
|
|
92
90
|
if (nextWeek.format("Wo") === weekStr) return nextWeek;
|
|
93
91
|
}
|
|
94
|
-
parseNoMatchNotice();
|
|
95
92
|
return null;
|
|
96
93
|
}
|
|
97
94
|
const date = dayjs(formatText, format, true).locale(localeStr);
|
|
98
95
|
if (date.isValid()) return date;
|
|
99
96
|
}
|
|
100
|
-
if (text)
|
|
97
|
+
if (text) {}
|
|
101
98
|
return null;
|
|
102
99
|
}
|
|
103
100
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/picker",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.1",
|
|
5
5
|
"description": "picker ui component for vue",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@v-c/overflow": "^1.1.0",
|
|
81
|
-
"@v-c/
|
|
82
|
-
"@v-c/trigger": "^1.0.
|
|
83
|
-
"@v-c/
|
|
81
|
+
"@v-c/util": "^1.0.19",
|
|
82
|
+
"@v-c/trigger": "^1.0.17",
|
|
83
|
+
"@v-c/resize-observer": "^1.1.2"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"@types/luxon": "^3.7.
|
|
86
|
+
"@types/luxon": "^3.7.2"
|
|
87
87
|
},
|
|
88
88
|
"scripts": {
|
|
89
89
|
"build": "vite build",
|