@v-c/picker 1.0.0 → 1.0.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/package.json +9 -9
- package/dist/PickerInput/Popup/Footer.cjs +0 -115
- package/dist/PickerInput/Popup/PopupPanel.cjs +0 -413
- package/dist/PickerInput/Popup/PresetPanel.cjs +0 -54
- package/dist/PickerInput/Popup/index.cjs +0 -526
- package/dist/PickerInput/RangePicker.cjs +0 -1911
- package/dist/PickerInput/Selector/Icon.cjs +0 -89
- package/dist/PickerInput/Selector/Input.cjs +0 -376
- package/dist/PickerInput/Selector/MaskFormat.cjs +0 -72
- package/dist/PickerInput/Selector/RangeSelector.cjs +0 -1393
- package/dist/PickerInput/Selector/SingleSelector/MultipleDates.cjs +0 -110
- package/dist/PickerInput/Selector/SingleSelector/index.cjs +0 -1361
- package/dist/PickerInput/Selector/hooks/useClearIcon.cjs +0 -17
- package/dist/PickerInput/Selector/hooks/useInputHooks.cjs +0 -125
- package/dist/PickerInput/Selector/hooks/useRootProps.cjs +0 -14
- package/dist/PickerInput/Selector/util.cjs +0 -32
- package/dist/PickerInput/SinglePicker.cjs +0 -1881
- package/dist/PickerInput/context.cjs +0 -12
- package/dist/PickerInput/hooks/useCellRender.cjs +0 -25
- package/dist/PickerInput/hooks/useDelayState.cjs +0 -37
- package/dist/PickerInput/hooks/useDisabledBoundary.cjs +0 -15
- package/dist/PickerInput/hooks/useFieldFormat.cjs +0 -17
- package/dist/PickerInput/hooks/useFieldsInvalidate.cjs +0 -24
- package/dist/PickerInput/hooks/useFilledProps.cjs +0 -103
- package/dist/PickerInput/hooks/useInputReadOnly.cjs +0 -13
- package/dist/PickerInput/hooks/useInvalidate.cjs +0 -34
- package/dist/PickerInput/hooks/useLockEffect.cjs +0 -16
- package/dist/PickerInput/hooks/useOpen.cjs +0 -15
- package/dist/PickerInput/hooks/usePresets.cjs +0 -21
- package/dist/PickerInput/hooks/useRangeActive.cjs +0 -57
- package/dist/PickerInput/hooks/useRangeDisabledDate.cjs +0 -21
- package/dist/PickerInput/hooks/useRangePickerValue.cjs +0 -100
- package/dist/PickerInput/hooks/useRangeValue.cjs +0 -135
- package/dist/PickerInput/hooks/useShowNow.cjs +0 -15
- package/dist/PickerPanel/DatePanel/index.cjs +0 -294
- package/dist/PickerPanel/DateTimePanel/index.cjs +0 -180
- package/dist/PickerPanel/DecadePanel/index.cjs +0 -230
- package/dist/PickerPanel/MonthPanel/index.cjs +0 -219
- package/dist/PickerPanel/PanelBody.cjs +0 -157
- package/dist/PickerPanel/PanelHeader.cjs +0 -132
- package/dist/PickerPanel/QuarterPanel/index.cjs +0 -211
- package/dist/PickerPanel/TimePanel/TimePanelBody/TimeColumn.cjs +0 -145
- package/dist/PickerPanel/TimePanel/TimePanelBody/index.cjs +0 -286
- package/dist/PickerPanel/TimePanel/TimePanelBody/useScrollTo.cjs +0 -65
- package/dist/PickerPanel/TimePanel/index.cjs +0 -173
- package/dist/PickerPanel/WeekPanel/index.cjs +0 -179
- package/dist/PickerPanel/YearPanel/index.cjs +0 -239
- package/dist/PickerPanel/context.cjs +0 -61
- package/dist/PickerPanel/index.cjs +0 -473
- package/dist/PickerTrigger/index.cjs +0 -139
- package/dist/PickerTrigger/util.cjs +0 -13
- package/dist/_virtual/rolldown_runtime.cjs +0 -21
- package/dist/generate/dateFns.cjs +0 -80
- package/dist/generate/dayjs.cjs +0 -117
- package/dist/generate/index.cjs +0 -1
- package/dist/generate/luxon.cjs +0 -75
- package/dist/generate/moment.cjs +0 -107
- package/dist/hooks/useLocale.cjs +0 -45
- package/dist/hooks/useSemantic.cjs +0 -18
- package/dist/hooks/useSyncState.cjs +0 -29
- package/dist/hooks/useTimeConfig.cjs +0 -161
- package/dist/hooks/useTimeInfo.cjs +0 -114
- package/dist/hooks/useToggleDates.cjs +0 -16
- package/dist/index.cjs +0 -12
- package/dist/interface.cjs +0 -1
- package/dist/locale/am_ET.cjs +0 -34
- package/dist/locale/ar_EG.cjs +0 -32
- package/dist/locale/az_AZ.cjs +0 -33
- package/dist/locale/bg_BG.cjs +0 -32
- package/dist/locale/bn_BD.cjs +0 -33
- package/dist/locale/by_BY.cjs +0 -33
- package/dist/locale/ca_ES.cjs +0 -32
- package/dist/locale/common.cjs +0 -8
- package/dist/locale/cs_CZ.cjs +0 -32
- package/dist/locale/da_DK.cjs +0 -32
- package/dist/locale/de_DE.cjs +0 -32
- package/dist/locale/el_GR.cjs +0 -32
- package/dist/locale/en_GB.cjs +0 -32
- package/dist/locale/en_US.cjs +0 -33
- package/dist/locale/es_ES.cjs +0 -32
- package/dist/locale/es_MX.cjs +0 -33
- package/dist/locale/et_EE.cjs +0 -32
- package/dist/locale/eu_ES.cjs +0 -34
- package/dist/locale/fa_IR.cjs +0 -32
- package/dist/locale/fi_FI.cjs +0 -32
- package/dist/locale/fr_BE.cjs +0 -32
- package/dist/locale/fr_CA.cjs +0 -33
- package/dist/locale/fr_FR.cjs +0 -33
- package/dist/locale/ga_IE.cjs +0 -33
- package/dist/locale/gl_ES.cjs +0 -32
- package/dist/locale/he_IL.cjs +0 -33
- package/dist/locale/hi_IN.cjs +0 -33
- package/dist/locale/hr_HR.cjs +0 -33
- package/dist/locale/hu_HU.cjs +0 -33
- package/dist/locale/id_ID.cjs +0 -33
- package/dist/locale/is_IS.cjs +0 -32
- package/dist/locale/it_IT.cjs +0 -55
- package/dist/locale/ja_JP.cjs +0 -35
- package/dist/locale/ka_GE.cjs +0 -33
- package/dist/locale/kk_KZ.cjs +0 -32
- package/dist/locale/km_KH.cjs +0 -34
- package/dist/locale/kmr_IQ.cjs +0 -32
- package/dist/locale/kn_IN.cjs +0 -33
- package/dist/locale/ko_KR.cjs +0 -34
- package/dist/locale/lt_LT.cjs +0 -34
- package/dist/locale/lv_LV.cjs +0 -32
- package/dist/locale/mk_MK.cjs +0 -32
- package/dist/locale/ml_IN.cjs +0 -33
- package/dist/locale/mn_MN.cjs +0 -34
- package/dist/locale/mr_IN.cjs +0 -59
- package/dist/locale/ms_MY.cjs +0 -34
- package/dist/locale/my_MM.cjs +0 -33
- package/dist/locale/nb_NO.cjs +0 -34
- package/dist/locale/ne_NP.cjs +0 -33
- package/dist/locale/nl_BE.cjs +0 -32
- package/dist/locale/nl_NL.cjs +0 -32
- package/dist/locale/pl_PL.cjs +0 -32
- package/dist/locale/pt_BR.cjs +0 -56
- package/dist/locale/pt_PT.cjs +0 -55
- package/dist/locale/ro_RO.cjs +0 -33
- package/dist/locale/ru_RU.cjs +0 -32
- package/dist/locale/si_LK.cjs +0 -34
- package/dist/locale/sk_SK.cjs +0 -32
- package/dist/locale/sl_SI.cjs +0 -32
- package/dist/locale/sr_Cyrl_RS.cjs +0 -32
- package/dist/locale/sr_RS.cjs +0 -32
- package/dist/locale/sv_SE.cjs +0 -32
- package/dist/locale/ta_IN.cjs +0 -33
- package/dist/locale/te_IN.cjs +0 -33
- package/dist/locale/th_TH.cjs +0 -32
- package/dist/locale/tk_TK.cjs +0 -32
- package/dist/locale/tr_TR.cjs +0 -55
- package/dist/locale/ug_CN.cjs +0 -35
- package/dist/locale/uk_UA.cjs +0 -32
- package/dist/locale/ur_PK.cjs +0 -33
- package/dist/locale/uz_UZ.cjs +0 -33
- package/dist/locale/vi_VN.cjs +0 -33
- package/dist/locale/zh_CN.cjs +0 -36
- package/dist/locale/zh_TW.cjs +0 -36
- package/dist/utils/dateUtil.cjs +0 -105
- package/dist/utils/getClearIcon.cjs +0 -7
- package/dist/utils/miscUtil.cjs +0 -46
- package/dist/utils/uiUtil.cjs +0 -6
- package/dist/utils/warnUtil.cjs +0 -8
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_dateUtil = require("../../utils/dateUtil.cjs");
|
|
7
|
-
const require_context = require("../context.cjs");
|
|
8
|
-
const require_PanelBody = require("../PanelBody.cjs");
|
|
9
|
-
const require_PanelHeader = require("../PanelHeader.cjs");
|
|
10
|
-
let vue = require("vue");
|
|
11
|
-
function _isSlot(s) {
|
|
12
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
13
|
-
}
|
|
14
|
-
var QuarterPanel = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
|
|
15
|
-
const sharedContext = require_context.useSharedPanelContext();
|
|
16
|
-
require_context.providePanelContext((0, vue.computed)(() => {
|
|
17
|
-
const [info] = require_context.useInfo(props, "quarter", sharedContext);
|
|
18
|
-
return info;
|
|
19
|
-
}));
|
|
20
|
-
return () => {
|
|
21
|
-
const { prefixCls, locale = {}, generateConfig = {}, pickerValue, onPickerValueChange, onModeChange } = props;
|
|
22
|
-
const panelPrefixCls = `${prefixCls}-quarter-panel`;
|
|
23
|
-
const baseDate = generateConfig.setMonth(pickerValue, 0);
|
|
24
|
-
const cellQuarterFormat = locale.cellQuarterFormat || "[Q]Q";
|
|
25
|
-
const yearFormat = locale.yearFormat || "YYYY";
|
|
26
|
-
const getCellDate = (date, offset) => {
|
|
27
|
-
return generateConfig.addMonth(date, offset * 3);
|
|
28
|
-
};
|
|
29
|
-
const getCellText = (date) => {
|
|
30
|
-
return require_dateUtil.formatValue(date, {
|
|
31
|
-
locale,
|
|
32
|
-
format: cellQuarterFormat,
|
|
33
|
-
generateConfig
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
const getCellClassName = () => ({ [`${prefixCls}-cell-in-view`]: true });
|
|
37
|
-
const yearNode = (0, vue.createVNode)("button", {
|
|
38
|
-
"type": "button",
|
|
39
|
-
"key": "year",
|
|
40
|
-
"aria-label": locale.yearSelect,
|
|
41
|
-
"onClick": () => {
|
|
42
|
-
onModeChange?.("year");
|
|
43
|
-
},
|
|
44
|
-
"tabindex": -1,
|
|
45
|
-
"class": `${prefixCls}-year-btn`
|
|
46
|
-
}, [require_dateUtil.formatValue(pickerValue, {
|
|
47
|
-
locale,
|
|
48
|
-
format: yearFormat,
|
|
49
|
-
generateConfig
|
|
50
|
-
})]);
|
|
51
|
-
return (0, vue.createVNode)("div", { "class": panelPrefixCls }, [(0, vue.createVNode)(require_PanelHeader.default, {
|
|
52
|
-
"superOffset": (distance, date) => generateConfig.addYear(date, distance),
|
|
53
|
-
"onChange": onPickerValueChange,
|
|
54
|
-
"getStart": (date) => generateConfig.setMonth(date, 0),
|
|
55
|
-
"getEnd": (date) => generateConfig.setMonth(date, 11)
|
|
56
|
-
}, _isSlot(yearNode) ? yearNode : { default: () => [yearNode] }), (0, vue.createVNode)(require_PanelBody.default, (0, vue.mergeProps)(props, {
|
|
57
|
-
"titleFormat": locale.fieldQuarterFormat,
|
|
58
|
-
"colNum": 4,
|
|
59
|
-
"rowNum": 1,
|
|
60
|
-
"baseDate": baseDate,
|
|
61
|
-
"getCellDate": getCellDate,
|
|
62
|
-
"getCellText": getCellText,
|
|
63
|
-
"getCellClassName": getCellClassName
|
|
64
|
-
}), null)]);
|
|
65
|
-
};
|
|
66
|
-
}, {
|
|
67
|
-
props: {
|
|
68
|
-
prefixCls: {
|
|
69
|
-
type: String,
|
|
70
|
-
required: true,
|
|
71
|
-
default: void 0
|
|
72
|
-
},
|
|
73
|
-
locale: {
|
|
74
|
-
type: Object,
|
|
75
|
-
required: false,
|
|
76
|
-
default: void 0
|
|
77
|
-
},
|
|
78
|
-
generateConfig: {
|
|
79
|
-
type: Object,
|
|
80
|
-
required: false,
|
|
81
|
-
default: void 0
|
|
82
|
-
},
|
|
83
|
-
pickerValue: {
|
|
84
|
-
required: true,
|
|
85
|
-
default: void 0
|
|
86
|
-
},
|
|
87
|
-
onPickerValueChange: {
|
|
88
|
-
type: Function,
|
|
89
|
-
required: true,
|
|
90
|
-
default: void 0
|
|
91
|
-
},
|
|
92
|
-
value: {
|
|
93
|
-
required: false,
|
|
94
|
-
default: void 0
|
|
95
|
-
},
|
|
96
|
-
onSelect: {
|
|
97
|
-
type: Function,
|
|
98
|
-
required: true,
|
|
99
|
-
default: void 0
|
|
100
|
-
},
|
|
101
|
-
values: {
|
|
102
|
-
type: Array,
|
|
103
|
-
required: false,
|
|
104
|
-
default: void 0
|
|
105
|
-
},
|
|
106
|
-
onModeChange: {
|
|
107
|
-
type: Function,
|
|
108
|
-
required: true,
|
|
109
|
-
default: void 0
|
|
110
|
-
},
|
|
111
|
-
disabledDate: {
|
|
112
|
-
type: Function,
|
|
113
|
-
required: false,
|
|
114
|
-
default: void 0
|
|
115
|
-
},
|
|
116
|
-
minDate: {
|
|
117
|
-
required: false,
|
|
118
|
-
default: void 0
|
|
119
|
-
},
|
|
120
|
-
maxDate: {
|
|
121
|
-
required: false,
|
|
122
|
-
default: void 0
|
|
123
|
-
},
|
|
124
|
-
cellRender: {
|
|
125
|
-
type: Function,
|
|
126
|
-
required: false,
|
|
127
|
-
default: void 0
|
|
128
|
-
},
|
|
129
|
-
hoverRangeValue: {
|
|
130
|
-
type: [Array, null],
|
|
131
|
-
required: true,
|
|
132
|
-
default: void 0
|
|
133
|
-
},
|
|
134
|
-
hoverValue: {
|
|
135
|
-
type: [Array, null],
|
|
136
|
-
required: false,
|
|
137
|
-
default: void 0
|
|
138
|
-
},
|
|
139
|
-
onHover: {
|
|
140
|
-
type: Function,
|
|
141
|
-
required: false,
|
|
142
|
-
default: void 0
|
|
143
|
-
},
|
|
144
|
-
showTime: {
|
|
145
|
-
type: Object,
|
|
146
|
-
required: false,
|
|
147
|
-
default: void 0
|
|
148
|
-
},
|
|
149
|
-
showWeek: {
|
|
150
|
-
type: Boolean,
|
|
151
|
-
required: false,
|
|
152
|
-
default: void 0
|
|
153
|
-
},
|
|
154
|
-
prevIcon: {
|
|
155
|
-
type: [
|
|
156
|
-
Object,
|
|
157
|
-
Function,
|
|
158
|
-
String,
|
|
159
|
-
Number,
|
|
160
|
-
null,
|
|
161
|
-
Boolean,
|
|
162
|
-
Array
|
|
163
|
-
],
|
|
164
|
-
required: false,
|
|
165
|
-
default: void 0
|
|
166
|
-
},
|
|
167
|
-
nextIcon: {
|
|
168
|
-
type: [
|
|
169
|
-
Object,
|
|
170
|
-
Function,
|
|
171
|
-
String,
|
|
172
|
-
Number,
|
|
173
|
-
null,
|
|
174
|
-
Boolean,
|
|
175
|
-
Array
|
|
176
|
-
],
|
|
177
|
-
required: false,
|
|
178
|
-
default: void 0
|
|
179
|
-
},
|
|
180
|
-
superPrevIcon: {
|
|
181
|
-
type: [
|
|
182
|
-
Object,
|
|
183
|
-
Function,
|
|
184
|
-
String,
|
|
185
|
-
Number,
|
|
186
|
-
null,
|
|
187
|
-
Boolean,
|
|
188
|
-
Array
|
|
189
|
-
],
|
|
190
|
-
required: false,
|
|
191
|
-
default: void 0
|
|
192
|
-
},
|
|
193
|
-
superNextIcon: {
|
|
194
|
-
type: [
|
|
195
|
-
Object,
|
|
196
|
-
Function,
|
|
197
|
-
String,
|
|
198
|
-
Number,
|
|
199
|
-
null,
|
|
200
|
-
Boolean,
|
|
201
|
-
Array
|
|
202
|
-
],
|
|
203
|
-
required: false,
|
|
204
|
-
default: void 0
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
name: "QuarterPanel",
|
|
208
|
-
inheritAttrs: false
|
|
209
|
-
});
|
|
210
|
-
var QuarterPanel_default = QuarterPanel;
|
|
211
|
-
exports.default = QuarterPanel_default;
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../../../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_context = require("../../context.cjs");
|
|
7
|
-
const require_useScrollTo = require("./useScrollTo.cjs");
|
|
8
|
-
let vue = require("vue");
|
|
9
|
-
let _v_c_util = require("@v-c/util");
|
|
10
|
-
var SCROLL_DELAY = 300;
|
|
11
|
-
function flattenUnits(units) {
|
|
12
|
-
return units.map(({ value, label, disabled }) => [
|
|
13
|
-
value,
|
|
14
|
-
label,
|
|
15
|
-
disabled
|
|
16
|
-
].join(",")).join(";");
|
|
17
|
-
}
|
|
18
|
-
var TimeColumn = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
|
|
19
|
-
const context = require_context.usePanelContext();
|
|
20
|
-
const ulRef = (0, vue.ref)();
|
|
21
|
-
const checkDelayRef = (0, vue.ref)();
|
|
22
|
-
const clearDelayCheck = () => {
|
|
23
|
-
clearTimeout(checkDelayRef.value);
|
|
24
|
-
};
|
|
25
|
-
const [syncScroll, stopScroll, isScrolling] = require_useScrollTo.default(ulRef, (0, vue.computed)(() => props.value ?? props.optionalValue));
|
|
26
|
-
(0, vue.watch)([
|
|
27
|
-
() => props.value,
|
|
28
|
-
() => props.optionalValue,
|
|
29
|
-
() => flattenUnits(props.units)
|
|
30
|
-
], () => {
|
|
31
|
-
syncScroll();
|
|
32
|
-
clearDelayCheck();
|
|
33
|
-
}, { flush: "post" });
|
|
34
|
-
(0, vue.onMounted)(() => {
|
|
35
|
-
syncScroll();
|
|
36
|
-
});
|
|
37
|
-
(0, vue.onBeforeUnmount)(() => {
|
|
38
|
-
stopScroll();
|
|
39
|
-
clearDelayCheck();
|
|
40
|
-
});
|
|
41
|
-
const onInternalScroll = (event) => {
|
|
42
|
-
clearDelayCheck();
|
|
43
|
-
const target = event.target;
|
|
44
|
-
if (!isScrolling() && props.changeOnScroll) checkDelayRef.value = setTimeout(() => {
|
|
45
|
-
const ul = ulRef.value;
|
|
46
|
-
const firstLiTop = ul.querySelector(`li`).offsetTop;
|
|
47
|
-
const liDistList = Array.from(ul.querySelectorAll(`li`)).map((li) => li.offsetTop - firstLiTop).map((top, index) => {
|
|
48
|
-
if (props.units[index].disabled) return Number.MAX_SAFE_INTEGER;
|
|
49
|
-
return Math.abs(top - target.scrollTop);
|
|
50
|
-
});
|
|
51
|
-
const minDist = Math.min(...liDistList);
|
|
52
|
-
const minDistIndex = liDistList.findIndex((dist) => dist === minDist);
|
|
53
|
-
const targetUnit = props.units[minDistIndex];
|
|
54
|
-
if (targetUnit && !targetUnit.disabled) props.onChange(targetUnit.value);
|
|
55
|
-
}, SCROLL_DELAY);
|
|
56
|
-
};
|
|
57
|
-
return () => {
|
|
58
|
-
const { units, value, type, onChange, onHover, onDblClick } = props;
|
|
59
|
-
const { prefixCls, cellRender, now, locale, classNames: panelClassNames, styles } = context.value;
|
|
60
|
-
const panelPrefixCls = `${prefixCls}-time-panel`;
|
|
61
|
-
const cellPrefixCls = `${prefixCls}-time-panel-cell`;
|
|
62
|
-
const columnPrefixCls = `${panelPrefixCls}-column`;
|
|
63
|
-
return (0, vue.createVNode)("ul", {
|
|
64
|
-
"class": columnPrefixCls,
|
|
65
|
-
"ref": ulRef,
|
|
66
|
-
"data-type": type,
|
|
67
|
-
"onScroll": onInternalScroll
|
|
68
|
-
}, [units.map(({ label, value: unitValue, disabled }) => {
|
|
69
|
-
const inner = (0, vue.createVNode)("div", { "class": `${cellPrefixCls}-inner` }, [label]);
|
|
70
|
-
return (0, vue.createVNode)("li", {
|
|
71
|
-
"key": unitValue,
|
|
72
|
-
"style": styles?.item,
|
|
73
|
-
"class": (0, _v_c_util.clsx)(cellPrefixCls, panelClassNames?.item, {
|
|
74
|
-
[`${cellPrefixCls}-selected`]: value === unitValue,
|
|
75
|
-
[`${cellPrefixCls}-disabled`]: disabled
|
|
76
|
-
}),
|
|
77
|
-
"onClick": () => {
|
|
78
|
-
if (!disabled) onChange(unitValue);
|
|
79
|
-
},
|
|
80
|
-
"onDblclick": () => {
|
|
81
|
-
if (!disabled && onDblClick) onDblClick();
|
|
82
|
-
},
|
|
83
|
-
"onMouseenter": () => {
|
|
84
|
-
onHover(unitValue);
|
|
85
|
-
},
|
|
86
|
-
"onMouseleave": () => {
|
|
87
|
-
onHover(null);
|
|
88
|
-
},
|
|
89
|
-
"data-value": unitValue
|
|
90
|
-
}, [cellRender ? cellRender(unitValue, {
|
|
91
|
-
prefixCls,
|
|
92
|
-
originNode: inner,
|
|
93
|
-
today: now,
|
|
94
|
-
type: "time",
|
|
95
|
-
subType: type,
|
|
96
|
-
locale
|
|
97
|
-
}) : inner]);
|
|
98
|
-
})]);
|
|
99
|
-
};
|
|
100
|
-
}, {
|
|
101
|
-
props: {
|
|
102
|
-
units: {
|
|
103
|
-
type: Array,
|
|
104
|
-
required: true,
|
|
105
|
-
default: void 0
|
|
106
|
-
},
|
|
107
|
-
value: {
|
|
108
|
-
type: [Number, String],
|
|
109
|
-
required: false,
|
|
110
|
-
default: void 0
|
|
111
|
-
},
|
|
112
|
-
optionalValue: {
|
|
113
|
-
type: [Number, String],
|
|
114
|
-
required: false,
|
|
115
|
-
default: void 0
|
|
116
|
-
},
|
|
117
|
-
type: {
|
|
118
|
-
type: String,
|
|
119
|
-
required: true,
|
|
120
|
-
default: void 0
|
|
121
|
-
},
|
|
122
|
-
onChange: {
|
|
123
|
-
type: Function,
|
|
124
|
-
required: true,
|
|
125
|
-
default: void 0
|
|
126
|
-
},
|
|
127
|
-
onHover: {
|
|
128
|
-
type: Function,
|
|
129
|
-
required: true,
|
|
130
|
-
default: void 0
|
|
131
|
-
},
|
|
132
|
-
onDblClick: {
|
|
133
|
-
required: false,
|
|
134
|
-
default: void 0
|
|
135
|
-
},
|
|
136
|
-
changeOnScroll: {
|
|
137
|
-
type: Boolean,
|
|
138
|
-
required: false,
|
|
139
|
-
default: void 0
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
name: "TimeColumn"
|
|
143
|
-
});
|
|
144
|
-
var TimeColumn_default = TimeColumn;
|
|
145
|
-
exports.default = TimeColumn_default;
|
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../../../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_dateUtil = require("../../../utils/dateUtil.cjs");
|
|
7
|
-
const require_useTimeInfo = require("../../../hooks/useTimeInfo.cjs");
|
|
8
|
-
const require_context = require("../../context.cjs");
|
|
9
|
-
const require_TimeColumn = require("./TimeColumn.cjs");
|
|
10
|
-
let vue = require("vue");
|
|
11
|
-
let _v_c_util = require("@v-c/util");
|
|
12
|
-
function isAM(hour) {
|
|
13
|
-
return hour < 12;
|
|
14
|
-
}
|
|
15
|
-
var TimePanelBody = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
|
|
16
|
-
const context = require_context.usePanelContext();
|
|
17
|
-
const pickerHackContext = require_context.usePickerHackContext();
|
|
18
|
-
const value = (0, vue.computed)(() => context.value.values?.[0] || null);
|
|
19
|
-
const generateConfig = (0, vue.computed)(() => context.value.generateConfig);
|
|
20
|
-
const [getValidTime, rowHourUnits, getMinuteUnits, getSecondUnits, getMillisecondUnits] = require_useTimeInfo.default(generateConfig, (0, vue.computed)(() => props), value);
|
|
21
|
-
const getUnitValue = (func) => {
|
|
22
|
-
const val = value.value;
|
|
23
|
-
const pickerVal = context.value.pickerValue;
|
|
24
|
-
return [val && generateConfig.value[func](val), pickerVal && generateConfig.value[func](pickerVal)];
|
|
25
|
-
};
|
|
26
|
-
return () => {
|
|
27
|
-
const { prefixCls, classNames: panelClassNames, styles, locale, onSelect, onHover } = context.value;
|
|
28
|
-
const { showHour, showMinute, showSecond, showMillisecond, use12Hours: showMeridiem, changeOnScroll } = props;
|
|
29
|
-
const { onCellDblClick } = pickerHackContext?.value || {};
|
|
30
|
-
const [hour, pickerHour] = getUnitValue("getHour");
|
|
31
|
-
const [minute, pickerMinute] = getUnitValue("getMinute");
|
|
32
|
-
const [second, pickerSecond] = getUnitValue("getSecond");
|
|
33
|
-
const [millisecond, pickerMillisecond] = getUnitValue("getMillisecond");
|
|
34
|
-
const meridiem = hour === null ? null : isAM(hour) ? "am" : "pm";
|
|
35
|
-
const hourUnits = (() => {
|
|
36
|
-
if (!showMeridiem) return rowHourUnits.value;
|
|
37
|
-
return isAM(hour) ? rowHourUnits.value.filter((h) => isAM(h.value)) : rowHourUnits.value.filter((h) => !isAM(h.value));
|
|
38
|
-
})();
|
|
39
|
-
const getEnabled = (units, val) => {
|
|
40
|
-
const enabledUnits = units.filter((unit) => !unit.disabled);
|
|
41
|
-
return val ?? enabledUnits?.[0]?.value;
|
|
42
|
-
};
|
|
43
|
-
const validHour = getEnabled(rowHourUnits.value, hour);
|
|
44
|
-
const minuteUnits = getMinuteUnits(validHour);
|
|
45
|
-
const validMinute = getEnabled(minuteUnits, minute);
|
|
46
|
-
const secondUnits = getSecondUnits(validHour, validMinute);
|
|
47
|
-
const validSecond = getEnabled(secondUnits, second);
|
|
48
|
-
const millisecondUnits = getMillisecondUnits(validHour, validMinute, validSecond);
|
|
49
|
-
const validMillisecond = getEnabled(millisecondUnits, millisecond);
|
|
50
|
-
const meridiemUnits = (() => {
|
|
51
|
-
if (!showMeridiem) return [];
|
|
52
|
-
const base = generateConfig.value.getNow();
|
|
53
|
-
const amDate = generateConfig.value.setHour(base, 6);
|
|
54
|
-
const pmDate = generateConfig.value.setHour(base, 18);
|
|
55
|
-
const formatMeridiem = (date, defaultLabel) => {
|
|
56
|
-
const { cellMeridiemFormat } = locale ?? {};
|
|
57
|
-
return cellMeridiemFormat ? require_dateUtil.formatValue(date, {
|
|
58
|
-
generateConfig: generateConfig.value,
|
|
59
|
-
locale,
|
|
60
|
-
format: cellMeridiemFormat
|
|
61
|
-
}) : defaultLabel;
|
|
62
|
-
};
|
|
63
|
-
return [{
|
|
64
|
-
label: formatMeridiem(amDate, "AM"),
|
|
65
|
-
value: "am",
|
|
66
|
-
disabled: rowHourUnits.value.every((h) => h.disabled || !isAM(h.value))
|
|
67
|
-
}, {
|
|
68
|
-
label: formatMeridiem(pmDate, "PM"),
|
|
69
|
-
value: "pm",
|
|
70
|
-
disabled: rowHourUnits.value.every((h) => h.disabled || isAM(h.value))
|
|
71
|
-
}];
|
|
72
|
-
})();
|
|
73
|
-
const triggerChange = (nextDate) => {
|
|
74
|
-
onSelect(getValidTime(nextDate));
|
|
75
|
-
};
|
|
76
|
-
const triggerDateTmpl = (() => {
|
|
77
|
-
let tmpl = value.value || context.value.pickerValue || generateConfig.value.getNow();
|
|
78
|
-
const isNotNull = (num) => num !== null && num !== void 0;
|
|
79
|
-
if (isNotNull(hour)) {
|
|
80
|
-
tmpl = generateConfig.value.setHour(tmpl, hour);
|
|
81
|
-
tmpl = generateConfig.value.setMinute(tmpl, minute);
|
|
82
|
-
tmpl = generateConfig.value.setSecond(tmpl, second);
|
|
83
|
-
tmpl = generateConfig.value.setMillisecond(tmpl, millisecond);
|
|
84
|
-
} else if (isNotNull(pickerHour)) {
|
|
85
|
-
tmpl = generateConfig.value.setHour(tmpl, pickerHour);
|
|
86
|
-
tmpl = generateConfig.value.setMinute(tmpl, pickerMinute);
|
|
87
|
-
tmpl = generateConfig.value.setSecond(tmpl, pickerSecond);
|
|
88
|
-
tmpl = generateConfig.value.setMillisecond(tmpl, pickerMillisecond);
|
|
89
|
-
} else if (isNotNull(validHour)) {
|
|
90
|
-
tmpl = generateConfig.value.setHour(tmpl, validHour);
|
|
91
|
-
tmpl = generateConfig.value.setMinute(tmpl, validMinute);
|
|
92
|
-
tmpl = generateConfig.value.setSecond(tmpl, validSecond);
|
|
93
|
-
tmpl = generateConfig.value.setMillisecond(tmpl, validMillisecond);
|
|
94
|
-
}
|
|
95
|
-
return tmpl;
|
|
96
|
-
})();
|
|
97
|
-
const fillColumnValue = (val, func) => {
|
|
98
|
-
if (val === null) return null;
|
|
99
|
-
return generateConfig.value[func](triggerDateTmpl, val);
|
|
100
|
-
};
|
|
101
|
-
const getNextHourTime = (val) => fillColumnValue(val, "setHour");
|
|
102
|
-
const getNextMinuteTime = (val) => fillColumnValue(val, "setMinute");
|
|
103
|
-
const getNextSecondTime = (val) => fillColumnValue(val, "setSecond");
|
|
104
|
-
const getNextMillisecondTime = (val) => fillColumnValue(val, "setMillisecond");
|
|
105
|
-
const getMeridiemTime = (val) => {
|
|
106
|
-
if (val === null) return null;
|
|
107
|
-
if (val === "am" && !isAM(hour)) return generateConfig.value.setHour(triggerDateTmpl, hour - 12);
|
|
108
|
-
else if (val === "pm" && isAM(hour)) return generateConfig.value.setHour(triggerDateTmpl, hour + 12);
|
|
109
|
-
return triggerDateTmpl;
|
|
110
|
-
};
|
|
111
|
-
const onHourChange = (val) => {
|
|
112
|
-
triggerChange(getNextHourTime(val));
|
|
113
|
-
};
|
|
114
|
-
const onMinuteChange = (val) => {
|
|
115
|
-
triggerChange(getNextMinuteTime(val));
|
|
116
|
-
};
|
|
117
|
-
const onSecondChange = (val) => {
|
|
118
|
-
triggerChange(getNextSecondTime(val));
|
|
119
|
-
};
|
|
120
|
-
const onMillisecondChange = (val) => {
|
|
121
|
-
triggerChange(getNextMillisecondTime(val));
|
|
122
|
-
};
|
|
123
|
-
const onMeridiemChange = (val) => {
|
|
124
|
-
triggerChange(getMeridiemTime(val));
|
|
125
|
-
};
|
|
126
|
-
const onHourHover = (val) => {
|
|
127
|
-
onHover?.(getNextHourTime(val));
|
|
128
|
-
};
|
|
129
|
-
const onMinuteHover = (val) => {
|
|
130
|
-
onHover?.(getNextMinuteTime(val));
|
|
131
|
-
};
|
|
132
|
-
const onSecondHover = (val) => {
|
|
133
|
-
onHover?.(getNextSecondTime(val));
|
|
134
|
-
};
|
|
135
|
-
const onMillisecondHover = (val) => {
|
|
136
|
-
onHover?.(getNextMillisecondTime(val));
|
|
137
|
-
};
|
|
138
|
-
const onMeridiemHover = (val) => {
|
|
139
|
-
onHover?.(getMeridiemTime(val));
|
|
140
|
-
};
|
|
141
|
-
const sharedColumnProps = {
|
|
142
|
-
onDblClick: onCellDblClick,
|
|
143
|
-
changeOnScroll
|
|
144
|
-
};
|
|
145
|
-
return (0, vue.createVNode)("div", {
|
|
146
|
-
"class": (0, _v_c_util.clsx)(`${prefixCls}-content`, panelClassNames?.content),
|
|
147
|
-
"style": styles?.content
|
|
148
|
-
}, [
|
|
149
|
-
showHour && (0, vue.createVNode)(require_TimeColumn.default, (0, vue.mergeProps)({
|
|
150
|
-
"units": hourUnits,
|
|
151
|
-
"value": hour,
|
|
152
|
-
"optionalValue": pickerHour,
|
|
153
|
-
"type": "hour",
|
|
154
|
-
"onChange": onHourChange,
|
|
155
|
-
"onHover": onHourHover
|
|
156
|
-
}, sharedColumnProps), null),
|
|
157
|
-
showMinute && (0, vue.createVNode)(require_TimeColumn.default, (0, vue.mergeProps)({
|
|
158
|
-
"units": minuteUnits,
|
|
159
|
-
"value": minute,
|
|
160
|
-
"optionalValue": pickerMinute,
|
|
161
|
-
"type": "minute",
|
|
162
|
-
"onChange": onMinuteChange,
|
|
163
|
-
"onHover": onMinuteHover
|
|
164
|
-
}, sharedColumnProps), null),
|
|
165
|
-
showSecond && (0, vue.createVNode)(require_TimeColumn.default, (0, vue.mergeProps)({
|
|
166
|
-
"units": secondUnits,
|
|
167
|
-
"value": second,
|
|
168
|
-
"optionalValue": pickerSecond,
|
|
169
|
-
"type": "second",
|
|
170
|
-
"onChange": onSecondChange,
|
|
171
|
-
"onHover": onSecondHover
|
|
172
|
-
}, sharedColumnProps), null),
|
|
173
|
-
showMillisecond && (0, vue.createVNode)(require_TimeColumn.default, (0, vue.mergeProps)({
|
|
174
|
-
"units": millisecondUnits,
|
|
175
|
-
"value": millisecond,
|
|
176
|
-
"optionalValue": pickerMillisecond,
|
|
177
|
-
"type": "millisecond",
|
|
178
|
-
"onChange": onMillisecondChange,
|
|
179
|
-
"onHover": onMillisecondHover
|
|
180
|
-
}, sharedColumnProps), null),
|
|
181
|
-
showMeridiem && (0, vue.createVNode)(require_TimeColumn.default, (0, vue.mergeProps)({
|
|
182
|
-
"units": meridiemUnits,
|
|
183
|
-
"value": meridiem,
|
|
184
|
-
"type": "meridiem",
|
|
185
|
-
"onChange": onMeridiemChange,
|
|
186
|
-
"onHover": onMeridiemHover
|
|
187
|
-
}, sharedColumnProps), null)
|
|
188
|
-
]);
|
|
189
|
-
};
|
|
190
|
-
}, {
|
|
191
|
-
props: {
|
|
192
|
-
format: {
|
|
193
|
-
type: String,
|
|
194
|
-
required: false,
|
|
195
|
-
default: void 0
|
|
196
|
-
},
|
|
197
|
-
showNow: {
|
|
198
|
-
type: Boolean,
|
|
199
|
-
required: false,
|
|
200
|
-
default: void 0
|
|
201
|
-
},
|
|
202
|
-
showHour: {
|
|
203
|
-
type: Boolean,
|
|
204
|
-
required: false,
|
|
205
|
-
default: void 0
|
|
206
|
-
},
|
|
207
|
-
showMinute: {
|
|
208
|
-
type: Boolean,
|
|
209
|
-
required: false,
|
|
210
|
-
default: void 0
|
|
211
|
-
},
|
|
212
|
-
showSecond: {
|
|
213
|
-
type: Boolean,
|
|
214
|
-
required: false,
|
|
215
|
-
default: void 0
|
|
216
|
-
},
|
|
217
|
-
showMillisecond: {
|
|
218
|
-
type: Boolean,
|
|
219
|
-
required: false,
|
|
220
|
-
default: void 0
|
|
221
|
-
},
|
|
222
|
-
use12Hours: {
|
|
223
|
-
type: Boolean,
|
|
224
|
-
required: false,
|
|
225
|
-
default: void 0
|
|
226
|
-
},
|
|
227
|
-
hourStep: {
|
|
228
|
-
required: false,
|
|
229
|
-
default: void 0
|
|
230
|
-
},
|
|
231
|
-
minuteStep: {
|
|
232
|
-
required: false,
|
|
233
|
-
default: void 0
|
|
234
|
-
},
|
|
235
|
-
secondStep: {
|
|
236
|
-
required: false,
|
|
237
|
-
default: void 0
|
|
238
|
-
},
|
|
239
|
-
millisecondStep: {
|
|
240
|
-
required: false,
|
|
241
|
-
default: void 0
|
|
242
|
-
},
|
|
243
|
-
hideDisabledOptions: {
|
|
244
|
-
type: Boolean,
|
|
245
|
-
required: false,
|
|
246
|
-
default: void 0
|
|
247
|
-
},
|
|
248
|
-
defaultValue: {
|
|
249
|
-
required: false,
|
|
250
|
-
default: void 0
|
|
251
|
-
},
|
|
252
|
-
defaultOpenValue: {
|
|
253
|
-
required: false,
|
|
254
|
-
default: void 0
|
|
255
|
-
},
|
|
256
|
-
disabledHours: {
|
|
257
|
-
type: Function,
|
|
258
|
-
required: false,
|
|
259
|
-
default: void 0
|
|
260
|
-
},
|
|
261
|
-
disabledMinutes: {
|
|
262
|
-
type: Function,
|
|
263
|
-
required: false,
|
|
264
|
-
default: void 0
|
|
265
|
-
},
|
|
266
|
-
disabledSeconds: {
|
|
267
|
-
type: Function,
|
|
268
|
-
required: false,
|
|
269
|
-
default: void 0
|
|
270
|
-
},
|
|
271
|
-
disabledTime: {
|
|
272
|
-
type: Function,
|
|
273
|
-
required: false,
|
|
274
|
-
default: void 0
|
|
275
|
-
},
|
|
276
|
-
changeOnScroll: {
|
|
277
|
-
type: Boolean,
|
|
278
|
-
required: false,
|
|
279
|
-
default: void 0
|
|
280
|
-
}
|
|
281
|
-
},
|
|
282
|
-
name: "TimePanelBody",
|
|
283
|
-
inheritAttrs: false
|
|
284
|
-
});
|
|
285
|
-
var TimePanelBody_default = TimePanelBody;
|
|
286
|
-
exports.default = TimePanelBody_default;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../../../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
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);
|
|
9
|
-
var SPEED_PTG = 1 / 3;
|
|
10
|
-
function useScrollTo(ulRef, value) {
|
|
11
|
-
const scrollingRef = (0, vue.ref)(false);
|
|
12
|
-
const scrollRafRef = (0, vue.ref)(null);
|
|
13
|
-
const scrollDistRef = (0, vue.ref)(null);
|
|
14
|
-
const scrollRafTimesRef = (0, vue.ref)(0);
|
|
15
|
-
const isScrolling = () => scrollingRef.value;
|
|
16
|
-
const stopScroll = () => {
|
|
17
|
-
if (scrollRafRef.value) _v_c_util_dist_raf.default.cancel(scrollRafRef.value);
|
|
18
|
-
scrollingRef.value = false;
|
|
19
|
-
};
|
|
20
|
-
const startScroll = () => {
|
|
21
|
-
const ul = (0, vue.unref)(ulRef);
|
|
22
|
-
const val = (0, vue.unref)(value);
|
|
23
|
-
scrollDistRef.value = null;
|
|
24
|
-
scrollRafTimesRef.value = 0;
|
|
25
|
-
if (ul) {
|
|
26
|
-
const targetLi = ul.querySelector(`[data-value="${val}"]`);
|
|
27
|
-
const firstLi = ul.querySelector(`li`);
|
|
28
|
-
const doScroll = () => {
|
|
29
|
-
stopScroll();
|
|
30
|
-
scrollingRef.value = true;
|
|
31
|
-
scrollRafTimesRef.value += 1;
|
|
32
|
-
const { scrollTop: currentTop } = ul;
|
|
33
|
-
const firstLiTop = firstLi.offsetTop;
|
|
34
|
-
const targetLiTop = targetLi?.offsetTop || 0;
|
|
35
|
-
const targetTop = targetLiTop - firstLiTop;
|
|
36
|
-
const isVisible = ul.offsetParent !== null;
|
|
37
|
-
if (targetLiTop === 0 && targetLi !== firstLi || !isVisible) {
|
|
38
|
-
if (scrollRafTimesRef.value <= 5) scrollRafRef.value = (0, _v_c_util_dist_raf.default)(doScroll);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const nextTop = currentTop + (targetTop - currentTop) * SPEED_PTG;
|
|
42
|
-
const dist = Math.abs(targetTop - nextTop);
|
|
43
|
-
if (scrollDistRef.value !== null && scrollDistRef.value < dist) {
|
|
44
|
-
stopScroll();
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
scrollDistRef.value = dist;
|
|
48
|
-
if (dist <= 1) {
|
|
49
|
-
ul.scrollTop = targetTop;
|
|
50
|
-
stopScroll();
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
ul.scrollTop = nextTop;
|
|
54
|
-
scrollRafRef.value = (0, _v_c_util_dist_raf.default)(doScroll);
|
|
55
|
-
};
|
|
56
|
-
if (targetLi && firstLi) doScroll();
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
return [
|
|
60
|
-
startScroll,
|
|
61
|
-
stopScroll,
|
|
62
|
-
isScrolling
|
|
63
|
-
];
|
|
64
|
-
}
|
|
65
|
-
exports.default = useScrollTo;
|