@mantine-vue/dates 2.0.1 → 2.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/cjs/index.cjs +13 -4
- package/cjs/index.cjs.map +1 -1
- package/esm/index.mjs +13 -4
- package/esm/index.mjs.map +1 -1
- package/lib/index.d.mts +3 -0
- package/lib/index.d.ts +3 -0
- package/package.json +3 -3
package/cjs/index.cjs
CHANGED
|
@@ -1723,9 +1723,13 @@ var SpinInput = (0, vue.defineComponent)({
|
|
|
1723
1723
|
};
|
|
1724
1724
|
const handleKeydown = (event) => {
|
|
1725
1725
|
if (props.readOnly) return;
|
|
1726
|
-
if (event.key === "0"
|
|
1727
|
-
event.
|
|
1728
|
-
|
|
1726
|
+
if (event.key === "0" || event.key === "Num0") {
|
|
1727
|
+
const { selectionStart, selectionEnd, value: inputValue } = event.currentTarget;
|
|
1728
|
+
const isEntireValueSelected = inputValue.length > 0 && selectionStart === 0 && selectionEnd === inputValue.length;
|
|
1729
|
+
if (props.value === 0 && !isEntireValueSelected) {
|
|
1730
|
+
event.preventDefault();
|
|
1731
|
+
props.onNextInput?.();
|
|
1732
|
+
}
|
|
1729
1733
|
}
|
|
1730
1734
|
if (event.key === "Home") {
|
|
1731
1735
|
event.preventDefault();
|
|
@@ -1878,6 +1882,7 @@ var TimePicker = (0, vue.defineComponent)({
|
|
|
1878
1882
|
default: "sm"
|
|
1879
1883
|
},
|
|
1880
1884
|
presets: Array,
|
|
1885
|
+
closeDropdownOnPresetSelect: Boolean,
|
|
1881
1886
|
hoursRef: Object
|
|
1882
1887
|
},
|
|
1883
1888
|
setup(props, { attrs }) {
|
|
@@ -1964,6 +1969,10 @@ var TimePicker = (0, vue.defineComponent)({
|
|
|
1964
1969
|
};
|
|
1965
1970
|
const isClearable = (0, vue.computed)(() => props.clearable && !props.readOnly && !props.disabled && (hours.value !== null || minutes.value !== null || seconds.value !== null || amPm.value !== null));
|
|
1966
1971
|
const opened = (0, vue.ref)(false);
|
|
1972
|
+
const handlePresetSelect = (timeString) => {
|
|
1973
|
+
setValue(timeString);
|
|
1974
|
+
if (props.closeDropdownOnPresetSelect) opened.value = false;
|
|
1975
|
+
};
|
|
1967
1976
|
return () => (0, vue.h)(_mantine_vue_core.Popover, {
|
|
1968
1977
|
opened: props.withDropdown && opened.value,
|
|
1969
1978
|
position: "bottom-start",
|
|
@@ -2055,7 +2064,7 @@ var TimePicker = (0, vue.defineComponent)({
|
|
|
2055
2064
|
}, () => props.presets?.map((preset) => (0, vue.h)(_mantine_vue_core.Button, {
|
|
2056
2065
|
size: "xs",
|
|
2057
2066
|
variant: "light",
|
|
2058
|
-
onClick: () =>
|
|
2067
|
+
onClick: () => handlePresetSelect(preset.value)
|
|
2059
2068
|
}, () => preset.label))) : (0, vue.h)("div", { class: Dates_module_default.timePickerControlsListGroup }, [
|
|
2060
2069
|
(0, vue.h)(TimeControlsList, {
|
|
2061
2070
|
min: props.format === "12h" ? 1 : 0,
|