@mantine-vue/dates 2.4.0 → 3.0.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 +179 -48
- package/cjs/index.cjs.map +1 -1
- package/esm/index.mjs +179 -48
- package/esm/index.mjs.map +1 -1
- package/lib/index.d.mts +151 -42
- package/lib/index.d.ts +151 -42
- package/package.json +3 -3
package/cjs/index.cjs
CHANGED
|
@@ -1024,6 +1024,11 @@ var DatePicker = (0, vue.defineComponent)({
|
|
|
1024
1024
|
type: String,
|
|
1025
1025
|
default: "default"
|
|
1026
1026
|
},
|
|
1027
|
+
modelValue: [
|
|
1028
|
+
String,
|
|
1029
|
+
Array,
|
|
1030
|
+
null
|
|
1031
|
+
],
|
|
1027
1032
|
value: [
|
|
1028
1033
|
String,
|
|
1029
1034
|
Array,
|
|
@@ -1047,13 +1052,17 @@ var DatePicker = (0, vue.defineComponent)({
|
|
|
1047
1052
|
withNativeLevelSelect: Boolean,
|
|
1048
1053
|
yearsSelectRange: Array
|
|
1049
1054
|
},
|
|
1050
|
-
|
|
1055
|
+
emits: ["update:modelValue", "change"],
|
|
1056
|
+
setup(props, { attrs, slots, emit }) {
|
|
1051
1057
|
const finalValue = (0, vue.computed)(() => props.type === "multiple" ? [] : props.type === "range" ? [null, null] : null);
|
|
1052
1058
|
const [_value, setValue] = (0, _mantine_vue_hooks.useUncontrolled)({
|
|
1053
|
-
value: (0, vue.computed)(() => props.value),
|
|
1059
|
+
value: (0, vue.computed)(() => props.modelValue !== void 0 ? props.modelValue : props.value),
|
|
1054
1060
|
defaultValue: props.defaultValue,
|
|
1055
1061
|
finalValue: finalValue.value,
|
|
1056
|
-
onChange: (value) =>
|
|
1062
|
+
onChange: (value) => {
|
|
1063
|
+
emit("update:modelValue", value);
|
|
1064
|
+
emit("change", value);
|
|
1065
|
+
}
|
|
1057
1066
|
});
|
|
1058
1067
|
const selectDate = (date) => {
|
|
1059
1068
|
if (props.type === "default" && props.allowDeselect && isSameDate(_value.value, date)) setValue(null);
|
|
@@ -1102,6 +1111,11 @@ var YearPicker = (0, vue.defineComponent)({
|
|
|
1102
1111
|
type: String,
|
|
1103
1112
|
default: "default"
|
|
1104
1113
|
},
|
|
1114
|
+
modelValue: [
|
|
1115
|
+
String,
|
|
1116
|
+
Array,
|
|
1117
|
+
null
|
|
1118
|
+
],
|
|
1105
1119
|
value: [
|
|
1106
1120
|
String,
|
|
1107
1121
|
Array,
|
|
@@ -1126,13 +1140,17 @@ var YearPicker = (0, vue.defineComponent)({
|
|
|
1126
1140
|
withNativeLevelSelect: Boolean,
|
|
1127
1141
|
yearsSelectRange: Array
|
|
1128
1142
|
},
|
|
1129
|
-
|
|
1143
|
+
emits: ["update:modelValue", "change"],
|
|
1144
|
+
setup(props, { attrs, emit }) {
|
|
1130
1145
|
const finalValue = (0, vue.computed)(() => props.type === "multiple" ? [] : props.type === "range" ? [null, null] : null);
|
|
1131
1146
|
const [_value, setValue] = (0, _mantine_vue_hooks.useUncontrolled)({
|
|
1132
|
-
value: (0, vue.computed)(() => props.value),
|
|
1147
|
+
value: (0, vue.computed)(() => props.modelValue !== void 0 ? props.modelValue : props.value),
|
|
1133
1148
|
defaultValue: props.defaultValue,
|
|
1134
1149
|
finalValue: finalValue.value,
|
|
1135
|
-
onChange: (value) =>
|
|
1150
|
+
onChange: (value) => {
|
|
1151
|
+
emit("update:modelValue", value);
|
|
1152
|
+
emit("change", value);
|
|
1153
|
+
}
|
|
1136
1154
|
});
|
|
1137
1155
|
const hoveredDate = (0, vue.ref)(null);
|
|
1138
1156
|
const selectYear = (date) => {
|
|
@@ -1197,6 +1215,11 @@ var MonthPicker = (0, vue.defineComponent)({
|
|
|
1197
1215
|
type: String,
|
|
1198
1216
|
default: "default"
|
|
1199
1217
|
},
|
|
1218
|
+
modelValue: [
|
|
1219
|
+
String,
|
|
1220
|
+
Array,
|
|
1221
|
+
null
|
|
1222
|
+
],
|
|
1200
1223
|
value: [
|
|
1201
1224
|
String,
|
|
1202
1225
|
Array,
|
|
@@ -1221,13 +1244,17 @@ var MonthPicker = (0, vue.defineComponent)({
|
|
|
1221
1244
|
withNativeLevelSelect: Boolean,
|
|
1222
1245
|
yearsSelectRange: Array
|
|
1223
1246
|
},
|
|
1224
|
-
|
|
1247
|
+
emits: ["update:modelValue", "change"],
|
|
1248
|
+
setup(props, { attrs, emit }) {
|
|
1225
1249
|
const finalValue = (0, vue.computed)(() => props.type === "multiple" ? [] : props.type === "range" ? [null, null] : null);
|
|
1226
1250
|
const [_value, setValue] = (0, _mantine_vue_hooks.useUncontrolled)({
|
|
1227
|
-
value: (0, vue.computed)(() => props.value),
|
|
1251
|
+
value: (0, vue.computed)(() => props.modelValue !== void 0 ? props.modelValue : props.value),
|
|
1228
1252
|
defaultValue: props.defaultValue,
|
|
1229
1253
|
finalValue: finalValue.value,
|
|
1230
|
-
onChange: (value) =>
|
|
1254
|
+
onChange: (value) => {
|
|
1255
|
+
emit("update:modelValue", value);
|
|
1256
|
+
emit("change", value);
|
|
1257
|
+
}
|
|
1231
1258
|
});
|
|
1232
1259
|
const hoveredDate = (0, vue.ref)(null);
|
|
1233
1260
|
const selectMonth = (date) => {
|
|
@@ -1382,6 +1409,11 @@ function createPickerInput(name, Picker, defaultLevel, defaultValueFormat = "MMM
|
|
|
1382
1409
|
type: String,
|
|
1383
1410
|
default: "default"
|
|
1384
1411
|
},
|
|
1412
|
+
modelValue: [
|
|
1413
|
+
String,
|
|
1414
|
+
Array,
|
|
1415
|
+
null
|
|
1416
|
+
],
|
|
1385
1417
|
value: [
|
|
1386
1418
|
String,
|
|
1387
1419
|
Array,
|
|
@@ -1422,13 +1454,17 @@ function createPickerInput(name, Picker, defaultLevel, defaultValueFormat = "MMM
|
|
|
1422
1454
|
withNativeLevelSelect: Boolean,
|
|
1423
1455
|
yearsSelectRange: Array
|
|
1424
1456
|
},
|
|
1425
|
-
|
|
1457
|
+
emits: ["update:modelValue", "change"],
|
|
1458
|
+
setup(props, { attrs, emit }) {
|
|
1426
1459
|
const finalValue = (0, vue.computed)(() => props.type === "multiple" ? [] : props.type === "range" ? [null, null] : null);
|
|
1427
1460
|
const [_value, setValue] = (0, _mantine_vue_hooks.useUncontrolled)({
|
|
1428
|
-
value: (0, vue.computed)(() => props.value),
|
|
1461
|
+
value: (0, vue.computed)(() => props.modelValue !== void 0 ? props.modelValue : props.value),
|
|
1429
1462
|
defaultValue: props.defaultValue,
|
|
1430
1463
|
finalValue: finalValue.value,
|
|
1431
|
-
onChange: (value) =>
|
|
1464
|
+
onChange: (value) => {
|
|
1465
|
+
emit("update:modelValue", value);
|
|
1466
|
+
emit("change", value);
|
|
1467
|
+
}
|
|
1432
1468
|
});
|
|
1433
1469
|
const opened = (0, vue.ref)(false);
|
|
1434
1470
|
const formattedValue = (0, vue.computed)(() => formatValue(_value.value, props.type, props.valueFormat, props.locale, props.labelSeparator, props.valueFormatter));
|
|
@@ -1494,6 +1530,11 @@ var DateInput = (0, vue.defineComponent)({
|
|
|
1494
1530
|
name: "DateInput",
|
|
1495
1531
|
inheritAttrs: false,
|
|
1496
1532
|
props: {
|
|
1533
|
+
modelValue: [
|
|
1534
|
+
String,
|
|
1535
|
+
Date,
|
|
1536
|
+
null
|
|
1537
|
+
],
|
|
1497
1538
|
value: [
|
|
1498
1539
|
String,
|
|
1499
1540
|
Date,
|
|
@@ -1516,12 +1557,19 @@ var DateInput = (0, vue.defineComponent)({
|
|
|
1516
1557
|
maxDate: [String, Date],
|
|
1517
1558
|
presets: Array
|
|
1518
1559
|
},
|
|
1519
|
-
|
|
1560
|
+
emits: ["update:modelValue", "change"],
|
|
1561
|
+
setup(props, { attrs, emit }) {
|
|
1520
1562
|
const [_value, setValue] = (0, _mantine_vue_hooks.useUncontrolled)({
|
|
1521
|
-
value: (0, vue.computed)(() =>
|
|
1563
|
+
value: (0, vue.computed)(() => {
|
|
1564
|
+
const controlledValue = props.modelValue !== void 0 ? props.modelValue : props.value;
|
|
1565
|
+
return controlledValue === void 0 ? void 0 : normalizeDate(controlledValue);
|
|
1566
|
+
}),
|
|
1522
1567
|
defaultValue: normalizeDate(props.defaultValue),
|
|
1523
1568
|
finalValue: null,
|
|
1524
|
-
onChange: (value) =>
|
|
1569
|
+
onChange: (value) => {
|
|
1570
|
+
emit("update:modelValue", value);
|
|
1571
|
+
emit("change", value);
|
|
1572
|
+
}
|
|
1525
1573
|
});
|
|
1526
1574
|
const formatValue = (value) => value ? (0, dayjs.default)(value).locale(props.locale || "en").format(props.valueFormat) : "";
|
|
1527
1575
|
const inputValue = (0, vue.ref)(formatValue(_value.value));
|
|
@@ -1693,18 +1741,22 @@ var TimeInput = (0, vue.defineComponent)({
|
|
|
1693
1741
|
name: "TimeInput",
|
|
1694
1742
|
props: {
|
|
1695
1743
|
withSeconds: Boolean,
|
|
1744
|
+
modelValue: String,
|
|
1696
1745
|
value: String,
|
|
1697
1746
|
defaultValue: String,
|
|
1698
1747
|
onChange: Function
|
|
1699
1748
|
},
|
|
1700
|
-
|
|
1749
|
+
emits: ["update:modelValue", "change"],
|
|
1750
|
+
setup(props, { attrs, emit }) {
|
|
1701
1751
|
return () => (0, vue.h)(_mantine_vue_core.InputBase, {
|
|
1702
1752
|
...attrs,
|
|
1703
1753
|
type: "time",
|
|
1704
1754
|
step: props.withSeconds ? 1 : 60,
|
|
1755
|
+
modelValue: props.modelValue,
|
|
1705
1756
|
value: props.value,
|
|
1706
1757
|
defaultValue: props.defaultValue,
|
|
1707
|
-
|
|
1758
|
+
"onUpdate:modelValue": (value) => emit("update:modelValue", value),
|
|
1759
|
+
onChange: (value) => emit("change", value)
|
|
1708
1760
|
});
|
|
1709
1761
|
}
|
|
1710
1762
|
});
|
|
@@ -1715,6 +1767,7 @@ var TimeGrid = (0, vue.defineComponent)({
|
|
|
1715
1767
|
type: Array,
|
|
1716
1768
|
default: () => []
|
|
1717
1769
|
},
|
|
1770
|
+
modelValue: String,
|
|
1718
1771
|
value: String,
|
|
1719
1772
|
defaultValue: String,
|
|
1720
1773
|
minTime: String,
|
|
@@ -1724,12 +1777,16 @@ var TimeGrid = (0, vue.defineComponent)({
|
|
|
1724
1777
|
onChange: Function,
|
|
1725
1778
|
getControlProps: Function
|
|
1726
1779
|
},
|
|
1727
|
-
|
|
1780
|
+
emits: ["update:modelValue", "change"],
|
|
1781
|
+
setup(props, { attrs, emit }) {
|
|
1728
1782
|
const [_value, setValue] = (0, _mantine_vue_hooks.useUncontrolled)({
|
|
1729
|
-
value: (0, vue.computed)(() => props.value),
|
|
1783
|
+
value: (0, vue.computed)(() => props.modelValue !== void 0 ? props.modelValue : props.value),
|
|
1730
1784
|
defaultValue: props.defaultValue,
|
|
1731
1785
|
finalValue: null,
|
|
1732
|
-
onChange: (value) =>
|
|
1786
|
+
onChange: (value) => {
|
|
1787
|
+
emit("update:modelValue", value);
|
|
1788
|
+
emit("change", value);
|
|
1789
|
+
}
|
|
1733
1790
|
});
|
|
1734
1791
|
return () => (0, vue.h)(_mantine_vue_core.Box, {
|
|
1735
1792
|
...attrs,
|
|
@@ -1762,9 +1819,17 @@ var SpinInput = (0, vue.defineComponent)({
|
|
|
1762
1819
|
name: "SpinInput",
|
|
1763
1820
|
inheritAttrs: false,
|
|
1764
1821
|
props: {
|
|
1822
|
+
modelValue: {
|
|
1823
|
+
type: Number,
|
|
1824
|
+
default: void 0
|
|
1825
|
+
},
|
|
1765
1826
|
value: {
|
|
1766
1827
|
type: Number,
|
|
1767
|
-
default:
|
|
1828
|
+
default: void 0
|
|
1829
|
+
},
|
|
1830
|
+
defaultValue: {
|
|
1831
|
+
type: Number,
|
|
1832
|
+
default: void 0
|
|
1768
1833
|
},
|
|
1769
1834
|
min: {
|
|
1770
1835
|
type: Number,
|
|
@@ -1790,7 +1855,17 @@ var SpinInput = (0, vue.defineComponent)({
|
|
|
1790
1855
|
disabled: Boolean,
|
|
1791
1856
|
readOnly: Boolean
|
|
1792
1857
|
},
|
|
1793
|
-
|
|
1858
|
+
emits: ["update:modelValue", "change"],
|
|
1859
|
+
setup(props, { attrs, emit }) {
|
|
1860
|
+
const [value, setValue] = (0, _mantine_vue_hooks.useUncontrolled)({
|
|
1861
|
+
value: (0, vue.computed)(() => props.modelValue !== void 0 ? props.modelValue : props.value),
|
|
1862
|
+
defaultValue: props.defaultValue,
|
|
1863
|
+
finalValue: null,
|
|
1864
|
+
onChange: (nextValue) => {
|
|
1865
|
+
emit("update:modelValue", nextValue);
|
|
1866
|
+
emit("change", nextValue);
|
|
1867
|
+
}
|
|
1868
|
+
});
|
|
1794
1869
|
const finiteMax = () => Number.isFinite(props.max);
|
|
1795
1870
|
const maxDigit = () => finiteMax() ? Number(props.max.toFixed(0)[0]) : Infinity;
|
|
1796
1871
|
const arrowsMax = () => props.max + 1 - props.step;
|
|
@@ -1805,7 +1880,7 @@ var SpinInput = (0, vue.defineComponent)({
|
|
|
1805
1880
|
parsedValue = finiteMax() && next > props.max ? digit : next;
|
|
1806
1881
|
}
|
|
1807
1882
|
const clampedValue = props.allowTemporaryZero && parsedValue === 0 && props.min > 0 ? 0 : finiteMax() ? Math.min(Math.max(parsedValue, props.min), props.max) : Math.max(parsedValue, props.min);
|
|
1808
|
-
|
|
1883
|
+
setValue(clampedValue);
|
|
1809
1884
|
if (!props.disableAutoAdvance && (clampedValue > maxDigit() || raw.startsWith("00"))) props.onNextInput?.();
|
|
1810
1885
|
};
|
|
1811
1886
|
const handleKeydown = (event) => {
|
|
@@ -1813,22 +1888,22 @@ var SpinInput = (0, vue.defineComponent)({
|
|
|
1813
1888
|
if (event.key === "0" || event.key === "Num0") {
|
|
1814
1889
|
const { selectionStart, selectionEnd, value: inputValue } = event.currentTarget;
|
|
1815
1890
|
const isEntireValueSelected = inputValue.length > 0 && selectionStart === 0 && selectionEnd === inputValue.length;
|
|
1816
|
-
if (
|
|
1891
|
+
if (value.value === 0 && !isEntireValueSelected) {
|
|
1817
1892
|
event.preventDefault();
|
|
1818
1893
|
props.onNextInput?.();
|
|
1819
1894
|
}
|
|
1820
1895
|
}
|
|
1821
1896
|
if (event.key === "Home") {
|
|
1822
1897
|
event.preventDefault();
|
|
1823
|
-
|
|
1898
|
+
setValue(props.min);
|
|
1824
1899
|
}
|
|
1825
1900
|
if (event.key === "End") {
|
|
1826
1901
|
event.preventDefault();
|
|
1827
|
-
if (finiteMax())
|
|
1902
|
+
if (finiteMax()) setValue(props.max);
|
|
1828
1903
|
}
|
|
1829
1904
|
if (event.key === "Backspace" || event.key === "Delete") {
|
|
1830
1905
|
event.preventDefault();
|
|
1831
|
-
if (
|
|
1906
|
+
if (value.value !== null) setValue(null);
|
|
1832
1907
|
else props.onPreviousInput?.();
|
|
1833
1908
|
}
|
|
1834
1909
|
if (event.key === "ArrowRight") {
|
|
@@ -1841,13 +1916,11 @@ var SpinInput = (0, vue.defineComponent)({
|
|
|
1841
1916
|
}
|
|
1842
1917
|
if (event.key === "ArrowUp") {
|
|
1843
1918
|
event.preventDefault();
|
|
1844
|
-
|
|
1845
|
-
props.onChange?.(newValue);
|
|
1919
|
+
setValue(value.value === null ? props.min : finiteMax() ? Math.min(Math.max(value.value + props.step, props.min), arrowsMax()) : Math.max(value.value + props.step, props.min));
|
|
1846
1920
|
}
|
|
1847
1921
|
if (event.key === "ArrowDown") {
|
|
1848
1922
|
event.preventDefault();
|
|
1849
|
-
|
|
1850
|
-
props.onChange?.(newValue);
|
|
1923
|
+
setValue(value.value === null ? finiteMax() ? arrowsMax() : props.min : Math.min(Math.max(value.value - props.step, props.min), arrowsMax()));
|
|
1851
1924
|
}
|
|
1852
1925
|
};
|
|
1853
1926
|
return () => (0, vue.h)("input", {
|
|
@@ -1856,13 +1929,13 @@ var SpinInput = (0, vue.defineComponent)({
|
|
|
1856
1929
|
role: "spinbutton",
|
|
1857
1930
|
"aria-valuemin": props.min,
|
|
1858
1931
|
"aria-valuemax": finiteMax() ? props.max : void 0,
|
|
1859
|
-
"aria-valuenow":
|
|
1860
|
-
"data-empty":
|
|
1932
|
+
"aria-valuenow": value.value === null ? 0 : value.value,
|
|
1933
|
+
"data-empty": value.value === null || void 0,
|
|
1861
1934
|
inputmode: "numeric",
|
|
1862
1935
|
placeholder: props.placeholder,
|
|
1863
1936
|
disabled: props.disabled,
|
|
1864
1937
|
readonly: props.readOnly,
|
|
1865
|
-
value:
|
|
1938
|
+
value: value.value === null ? "" : padTime(value.value),
|
|
1866
1939
|
onInput: (event) => handleChange(event.target.value),
|
|
1867
1940
|
onKeydown: handleKeydown,
|
|
1868
1941
|
onFocus: (event) => event.target.select(),
|
|
@@ -1877,9 +1950,17 @@ var SpinInput = (0, vue.defineComponent)({
|
|
|
1877
1950
|
var AmPmInput = (0, vue.defineComponent)({
|
|
1878
1951
|
name: "AmPmInput",
|
|
1879
1952
|
props: {
|
|
1953
|
+
modelValue: {
|
|
1954
|
+
type: String,
|
|
1955
|
+
default: void 0
|
|
1956
|
+
},
|
|
1880
1957
|
value: {
|
|
1881
1958
|
type: String,
|
|
1882
|
-
default:
|
|
1959
|
+
default: void 0
|
|
1960
|
+
},
|
|
1961
|
+
defaultValue: {
|
|
1962
|
+
type: String,
|
|
1963
|
+
default: void 0
|
|
1883
1964
|
},
|
|
1884
1965
|
labels: {
|
|
1885
1966
|
type: Object,
|
|
@@ -1889,14 +1970,24 @@ var AmPmInput = (0, vue.defineComponent)({
|
|
|
1889
1970
|
disabled: Boolean,
|
|
1890
1971
|
readOnly: Boolean
|
|
1891
1972
|
},
|
|
1892
|
-
|
|
1973
|
+
emits: ["update:modelValue", "change"],
|
|
1974
|
+
setup(props, { attrs, emit }) {
|
|
1975
|
+
const [value, setValue] = (0, _mantine_vue_hooks.useUncontrolled)({
|
|
1976
|
+
value: (0, vue.computed)(() => props.modelValue !== void 0 ? props.modelValue : props.value),
|
|
1977
|
+
defaultValue: props.defaultValue,
|
|
1978
|
+
finalValue: null,
|
|
1979
|
+
onChange: (nextValue) => {
|
|
1980
|
+
emit("update:modelValue", nextValue);
|
|
1981
|
+
emit("change", nextValue);
|
|
1982
|
+
}
|
|
1983
|
+
});
|
|
1893
1984
|
return () => (0, vue.h)("select", {
|
|
1894
1985
|
...attrs,
|
|
1895
1986
|
class: Dates_module_default.timePickerField,
|
|
1896
1987
|
"data-am-pm": true,
|
|
1897
1988
|
disabled: props.disabled,
|
|
1898
|
-
value:
|
|
1899
|
-
onChange: (event) =>
|
|
1989
|
+
value: value.value ?? props.labels.am,
|
|
1990
|
+
onChange: (event) => setValue(event.target.value)
|
|
1900
1991
|
}, [(0, vue.h)("option", { value: props.labels.am }, props.labels.am), (0, vue.h)("option", { value: props.labels.pm }, props.labels.pm)]);
|
|
1901
1992
|
}
|
|
1902
1993
|
});
|
|
@@ -1934,6 +2025,7 @@ var TimeControlsList = (0, vue.defineComponent)({
|
|
|
1934
2025
|
var TimePicker = (0, vue.defineComponent)({
|
|
1935
2026
|
name: "TimePicker",
|
|
1936
2027
|
props: {
|
|
2028
|
+
modelValue: String,
|
|
1937
2029
|
value: String,
|
|
1938
2030
|
defaultValue: String,
|
|
1939
2031
|
onChange: Function,
|
|
@@ -1976,13 +2068,17 @@ var TimePicker = (0, vue.defineComponent)({
|
|
|
1976
2068
|
closeDropdownOnPresetSelect: Boolean,
|
|
1977
2069
|
hoursRef: Object
|
|
1978
2070
|
},
|
|
1979
|
-
|
|
2071
|
+
emits: ["update:modelValue", "change"],
|
|
2072
|
+
setup(props, { attrs, emit }) {
|
|
1980
2073
|
const effectiveFormat = (0, vue.computed)(() => props.type === "duration" ? "24h" : props.format);
|
|
1981
2074
|
const [_value, setValue] = (0, _mantine_vue_hooks.useUncontrolled)({
|
|
1982
|
-
value: (0, vue.computed)(() => props.value),
|
|
2075
|
+
value: (0, vue.computed)(() => props.modelValue !== void 0 ? props.modelValue : props.value),
|
|
1983
2076
|
defaultValue: props.defaultValue,
|
|
1984
2077
|
finalValue: "",
|
|
1985
|
-
onChange: (value) =>
|
|
2078
|
+
onChange: (value) => {
|
|
2079
|
+
emit("update:modelValue", value);
|
|
2080
|
+
emit("change", value);
|
|
2081
|
+
}
|
|
1986
2082
|
});
|
|
1987
2083
|
const parsed = (0, vue.computed)(() => getParsedTime({
|
|
1988
2084
|
time: _value.value,
|
|
@@ -2228,6 +2324,11 @@ var TimeValue = (0, vue.defineComponent)({
|
|
|
2228
2324
|
var DateTimePicker = (0, vue.defineComponent)({
|
|
2229
2325
|
name: "DateTimePicker",
|
|
2230
2326
|
props: {
|
|
2327
|
+
modelValue: [
|
|
2328
|
+
String,
|
|
2329
|
+
Date,
|
|
2330
|
+
null
|
|
2331
|
+
],
|
|
2231
2332
|
value: [
|
|
2232
2333
|
String,
|
|
2233
2334
|
Date,
|
|
@@ -2251,13 +2352,20 @@ var DateTimePicker = (0, vue.defineComponent)({
|
|
|
2251
2352
|
},
|
|
2252
2353
|
submitButtonProps: Object
|
|
2253
2354
|
},
|
|
2254
|
-
|
|
2355
|
+
emits: ["update:modelValue", "change"],
|
|
2356
|
+
setup(props, { attrs, emit }) {
|
|
2255
2357
|
const hoursRef = (0, vue.ref)();
|
|
2256
2358
|
const [_value, setValue] = (0, _mantine_vue_hooks.useUncontrolled)({
|
|
2257
|
-
value: (0, vue.computed)(() =>
|
|
2359
|
+
value: (0, vue.computed)(() => {
|
|
2360
|
+
const controlledValue = props.modelValue !== void 0 ? props.modelValue : props.value;
|
|
2361
|
+
return controlledValue === void 0 ? void 0 : controlledValue === null ? null : new Date(controlledValue);
|
|
2362
|
+
}),
|
|
2258
2363
|
defaultValue: props.defaultValue ? new Date(props.defaultValue) : null,
|
|
2259
2364
|
finalValue: null,
|
|
2260
|
-
onChange: (value) =>
|
|
2365
|
+
onChange: (value) => {
|
|
2366
|
+
emit("update:modelValue", value);
|
|
2367
|
+
emit("change", value);
|
|
2368
|
+
}
|
|
2261
2369
|
});
|
|
2262
2370
|
const date = (0, vue.computed)(() => _value.value ? (0, dayjs.default)(_value.value).format("YYYY-MM-DD") : null);
|
|
2263
2371
|
const time = (0, vue.computed)(() => _value.value ? (0, dayjs.default)(_value.value).format(props.withSeconds ? "HH:mm:ss" : "HH:mm") : "");
|
|
@@ -2303,11 +2411,21 @@ var MiniCalendar = (0, vue.defineComponent)({
|
|
|
2303
2411
|
date: [String, Date],
|
|
2304
2412
|
defaultDate: [String, Date],
|
|
2305
2413
|
onDateChange: Function,
|
|
2414
|
+
modelValue: [
|
|
2415
|
+
String,
|
|
2416
|
+
Date,
|
|
2417
|
+
null
|
|
2418
|
+
],
|
|
2306
2419
|
value: [
|
|
2307
2420
|
String,
|
|
2308
2421
|
Date,
|
|
2309
2422
|
null
|
|
2310
2423
|
],
|
|
2424
|
+
defaultValue: [
|
|
2425
|
+
String,
|
|
2426
|
+
Date,
|
|
2427
|
+
null
|
|
2428
|
+
],
|
|
2311
2429
|
onChange: Function,
|
|
2312
2430
|
maxDate: [String, Date],
|
|
2313
2431
|
minDate: [String, Date],
|
|
@@ -2330,12 +2448,25 @@ var MiniCalendar = (0, vue.defineComponent)({
|
|
|
2330
2448
|
nextControlProps: Object,
|
|
2331
2449
|
locale: String
|
|
2332
2450
|
},
|
|
2333
|
-
|
|
2451
|
+
emits: ["update:modelValue", "change"],
|
|
2452
|
+
setup(props, { attrs, emit }) {
|
|
2334
2453
|
const ctx = useDatesContext();
|
|
2454
|
+
const [value, setValue] = (0, _mantine_vue_hooks.useUncontrolled)({
|
|
2455
|
+
value: (0, vue.computed)(() => {
|
|
2456
|
+
const controlledValue = props.modelValue !== void 0 ? props.modelValue : props.value;
|
|
2457
|
+
return controlledValue === void 0 ? void 0 : toDateString(controlledValue);
|
|
2458
|
+
}),
|
|
2459
|
+
defaultValue: toDateString(props.defaultValue ?? null),
|
|
2460
|
+
finalValue: null,
|
|
2461
|
+
onChange: (nextValue) => {
|
|
2462
|
+
emit("update:modelValue", nextValue);
|
|
2463
|
+
emit("change", nextValue);
|
|
2464
|
+
}
|
|
2465
|
+
});
|
|
2335
2466
|
const [_date, setDate] = (0, _mantine_vue_hooks.useUncontrolled)({
|
|
2336
2467
|
value: (0, vue.computed)(() => toDateString(props.date ?? null) ?? void 0),
|
|
2337
2468
|
defaultValue: toDateString(props.defaultDate ?? null) ?? void 0,
|
|
2338
|
-
finalValue:
|
|
2469
|
+
finalValue: value.value || (0, dayjs.default)().format("YYYY-MM-DD"),
|
|
2339
2470
|
onChange: (value) => props.onDateChange?.(value)
|
|
2340
2471
|
});
|
|
2341
2472
|
const handleNext = () => {
|
|
@@ -2357,12 +2488,12 @@ var MiniCalendar = (0, vue.defineComponent)({
|
|
|
2357
2488
|
disabled,
|
|
2358
2489
|
"aria-label": date.format("YYYY-MM-DD"),
|
|
2359
2490
|
"data-disabled": disabled || void 0,
|
|
2360
|
-
"data-selected":
|
|
2491
|
+
"data-selected": value.value && (0, dayjs.default)(date).isSame(value.value, "day") || void 0,
|
|
2361
2492
|
...dayProps,
|
|
2362
2493
|
class: [Dates_module_default.miniCalendarDay, dayProps.class],
|
|
2363
2494
|
onClick: (event) => {
|
|
2364
2495
|
dayProps.onClick?.(event);
|
|
2365
|
-
|
|
2496
|
+
setValue(toDateString(date.format("YYYY-MM-DD")));
|
|
2366
2497
|
}
|
|
2367
2498
|
}, () => [(0, vue.h)("span", { class: Dates_module_default.miniCalendarDayMonth }, date.locale(props.locale || ctx.locale).format(props.monthLabelFormat)), (0, vue.h)("span", { class: Dates_module_default.miniCalendarDayNumber }, String(date.date()))]);
|
|
2368
2499
|
});
|