@v-c/picker 1.0.0 → 1.0.2
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/hooks/useRangeValue.js +1 -0
- 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,17 +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 = require("@v-c/util");
|
|
8
|
-
function fillClearIcon(prefixCls, allowClear, clearIcon) {
|
|
9
|
-
if (process.env.NODE_ENV !== "production" && clearIcon) (0, _v_c_util.warning)(false, "`clearIcon` will be removed in future. Please use `allowClear` instead.");
|
|
10
|
-
if (allowClear === false) return null;
|
|
11
|
-
return (allowClear && typeof allowClear === "object" ? allowClear : {}).clearIcon || clearIcon || (0, vue.createVNode)("span", { "class": `${prefixCls}-clear-btn` }, null);
|
|
12
|
-
}
|
|
13
|
-
function useClearIcon(prefixCls, allowClear, clearIcon) {
|
|
14
|
-
return (0, vue.computed)(() => fillClearIcon(prefixCls.value, allowClear?.value, clearIcon?.value));
|
|
15
|
-
}
|
|
16
|
-
exports.default = useClearIcon;
|
|
17
|
-
exports.fillClearIcon = fillClearIcon;
|
|
@@ -1,125 +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 = require("@v-c/util");
|
|
8
|
-
function formatValue(value, { generateConfig, locale, format }) {
|
|
9
|
-
if (!value) return "";
|
|
10
|
-
if (typeof format === "function") return format(value);
|
|
11
|
-
return generateConfig.locale.format(locale.locale, value, format) || String(value);
|
|
12
|
-
}
|
|
13
|
-
function pickAttrs(props, { aria, data }) {
|
|
14
|
-
const result = {};
|
|
15
|
-
Object.keys(props).forEach((key) => {
|
|
16
|
-
if (aria && (key.startsWith("aria-") || key === "role")) result[key] = props[key];
|
|
17
|
-
if (data && key.startsWith("data-")) result[key] = props[key];
|
|
18
|
-
});
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
function useInputProps(props, postProps) {
|
|
22
|
-
const parseDate = (str, formatStr) => {
|
|
23
|
-
const { generateConfig, locale } = props.value;
|
|
24
|
-
const parsed = generateConfig.locale.parse(locale.locale, str, [formatStr]);
|
|
25
|
-
return parsed && generateConfig.isValidate(parsed) ? parsed : null;
|
|
26
|
-
};
|
|
27
|
-
const firstFormat = (0, vue.computed)(() => props.value.format[0]);
|
|
28
|
-
const getText = (date) => {
|
|
29
|
-
const { locale, generateConfig } = props.value;
|
|
30
|
-
return formatValue(date, {
|
|
31
|
-
locale,
|
|
32
|
-
format: firstFormat.value,
|
|
33
|
-
generateConfig
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
const valueTexts = (0, vue.computed)(() => (props.value.value || []).map(getText));
|
|
37
|
-
const size = (0, vue.computed)(() => {
|
|
38
|
-
const { picker, generateConfig } = props.value;
|
|
39
|
-
const defaultSize = picker === "time" ? 8 : 10;
|
|
40
|
-
const length = typeof firstFormat.value === "function" ? firstFormat.value(generateConfig.getNow()).length : firstFormat.value.length;
|
|
41
|
-
return Math.max(defaultSize, length) + 2;
|
|
42
|
-
});
|
|
43
|
-
const validateFormat = (text) => {
|
|
44
|
-
const { format } = props.value;
|
|
45
|
-
for (let i = 0; i < format.length; i += 1) {
|
|
46
|
-
const singleFormat = format[i];
|
|
47
|
-
if (typeof singleFormat === "string") {
|
|
48
|
-
const parsed = parseDate(text, singleFormat);
|
|
49
|
-
if (parsed) return parsed;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return false;
|
|
53
|
-
};
|
|
54
|
-
const getInputProps = (index) => {
|
|
55
|
-
function getProp(propValue) {
|
|
56
|
-
return index !== void 0 ? propValue[index] : propValue;
|
|
57
|
-
}
|
|
58
|
-
const pickedAttrs = pickAttrs(props.value, {
|
|
59
|
-
aria: true,
|
|
60
|
-
data: true
|
|
61
|
-
});
|
|
62
|
-
const { maskFormat, preserveInvalidOnBlur, inputReadOnly, required, "aria-required": ariaRequired, name, autoComplete, id, invalid, placeholder, activeHelp, activeIndex, allHelp, disabled, onFocus, onBlur, onSubmit, onInputChange, onInvalid, onChange, onOpenChange, onKeyDown, open } = props.value;
|
|
63
|
-
const inputProps = {
|
|
64
|
-
...pickedAttrs,
|
|
65
|
-
"format": maskFormat,
|
|
66
|
-
"validateFormat": (text) => !!validateFormat(text),
|
|
67
|
-
preserveInvalidOnBlur,
|
|
68
|
-
"readOnly": inputReadOnly,
|
|
69
|
-
required,
|
|
70
|
-
"aria-required": ariaRequired,
|
|
71
|
-
name,
|
|
72
|
-
autoComplete,
|
|
73
|
-
"size": size.value,
|
|
74
|
-
"id": getProp(id),
|
|
75
|
-
"value": getProp(valueTexts.value) || "",
|
|
76
|
-
"invalid": getProp(invalid),
|
|
77
|
-
"placeholder": getProp(placeholder),
|
|
78
|
-
"active": activeIndex === index,
|
|
79
|
-
"helped": allHelp || activeHelp && activeIndex === index,
|
|
80
|
-
"disabled": getProp(disabled),
|
|
81
|
-
"onFocus": (event) => {
|
|
82
|
-
onFocus(event, index);
|
|
83
|
-
},
|
|
84
|
-
"onBlur": (event) => {
|
|
85
|
-
onBlur(event, index);
|
|
86
|
-
},
|
|
87
|
-
onSubmit,
|
|
88
|
-
"onChange": (text) => {
|
|
89
|
-
onInputChange();
|
|
90
|
-
const parsed = validateFormat(text);
|
|
91
|
-
if (parsed) {
|
|
92
|
-
onInvalid(false, index);
|
|
93
|
-
onChange(parsed, index);
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
onInvalid(!!text, index);
|
|
97
|
-
},
|
|
98
|
-
"onHelp": () => {
|
|
99
|
-
onOpenChange(true, { index });
|
|
100
|
-
},
|
|
101
|
-
"onKeyDown": (event) => {
|
|
102
|
-
let prevented = false;
|
|
103
|
-
onKeyDown?.(event, () => {
|
|
104
|
-
if (process.env.NODE_ENV !== "production") (0, _v_c_util.warning)(false, "`preventDefault` callback is deprecated. Please call `event.preventDefault` directly.");
|
|
105
|
-
prevented = true;
|
|
106
|
-
});
|
|
107
|
-
if (!event.defaultPrevented && !prevented) switch (event.key) {
|
|
108
|
-
case "Escape":
|
|
109
|
-
onOpenChange(false, { index });
|
|
110
|
-
break;
|
|
111
|
-
case "Enter":
|
|
112
|
-
if (!open) onOpenChange(true);
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
...postProps?.({ valueTexts: valueTexts.value })
|
|
117
|
-
};
|
|
118
|
-
Object.keys(inputProps).forEach((key) => {
|
|
119
|
-
if (inputProps[key] === void 0) delete inputProps[key];
|
|
120
|
-
});
|
|
121
|
-
return inputProps;
|
|
122
|
-
};
|
|
123
|
-
return [getInputProps, getText];
|
|
124
|
-
}
|
|
125
|
-
exports.default = useInputProps;
|
|
@@ -1,14 +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_miscUtil = require("../../../utils/miscUtil.cjs");
|
|
7
|
-
let vue = require("vue");
|
|
8
|
-
var propNames = ["onMouseEnter", "onMouseLeave"];
|
|
9
|
-
function useRootProps(props) {
|
|
10
|
-
return (0, vue.computed)(() => {
|
|
11
|
-
return require_miscUtil.pickProps(props, propNames);
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
exports.default = useRootProps;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
function getMaskRange(key) {
|
|
3
|
-
return {
|
|
4
|
-
YYYY: [
|
|
5
|
-
0,
|
|
6
|
-
9999,
|
|
7
|
-
(/* @__PURE__ */ new Date()).getFullYear()
|
|
8
|
-
],
|
|
9
|
-
MM: [1, 12],
|
|
10
|
-
DD: [1, 31],
|
|
11
|
-
HH: [0, 23],
|
|
12
|
-
mm: [0, 59],
|
|
13
|
-
ss: [0, 59],
|
|
14
|
-
SSS: [0, 999]
|
|
15
|
-
}[key];
|
|
16
|
-
}
|
|
17
|
-
function raf(callback, delayFrames = 1) {
|
|
18
|
-
let id;
|
|
19
|
-
let remainingFrames = delayFrames;
|
|
20
|
-
function internalCallback() {
|
|
21
|
-
remainingFrames -= 1;
|
|
22
|
-
if (remainingFrames <= 0) callback();
|
|
23
|
-
else id = requestAnimationFrame(internalCallback);
|
|
24
|
-
}
|
|
25
|
-
id = requestAnimationFrame(internalCallback);
|
|
26
|
-
return id;
|
|
27
|
-
}
|
|
28
|
-
raf.cancel = (id) => {
|
|
29
|
-
cancelAnimationFrame(id);
|
|
30
|
-
};
|
|
31
|
-
exports.getMaskRange = getMaskRange;
|
|
32
|
-
exports.raf = raf;
|