@daracl/form 0.0.15 → 0.0.17
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/commonVender.d.ts +1 -0
- package/dist/daracl.form.js +2 -2
- package/dist/daracl.form.min.js +2 -2
- package/dist/daracl.form.min.js.LICENSE.txt +1 -1
- package/dist/daracl.vender.min.js +1 -1
- package/dist/index.cjs +29 -1450
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +27 -1455
- package/dist/index.js.map +4 -4
- package/dist/main.css +1 -1
- package/package.json +1 -1
- package/dist/types/DateTimePicker.d.ts +0 -5
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
2
24
|
|
|
3
25
|
// src/util/utils.ts
|
|
4
26
|
var xssFilter = {
|
|
@@ -1632,1451 +1654,8 @@ var RangeRender = class extends Render {
|
|
|
1632
1654
|
}
|
|
1633
1655
|
};
|
|
1634
1656
|
|
|
1635
|
-
// node_modules/@daracl/datetimepicker/dist/index.js
|
|
1636
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1637
|
-
var __esm = (fn, res) => function __init() {
|
|
1638
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
1639
|
-
};
|
|
1640
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
1641
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
1642
|
-
};
|
|
1643
|
-
var localeMessage;
|
|
1644
|
-
var Language;
|
|
1645
|
-
var Lanauage_default2;
|
|
1646
|
-
var init_Lanauage = __esm({
|
|
1647
|
-
"src/Lanauage.ts"() {
|
|
1648
|
-
"use strict";
|
|
1649
|
-
localeMessage = {
|
|
1650
|
-
year: "Year",
|
|
1651
|
-
month: "Month",
|
|
1652
|
-
day: "Day",
|
|
1653
|
-
am: "AM",
|
|
1654
|
-
pm: "PM",
|
|
1655
|
-
today: "Today",
|
|
1656
|
-
ok: "Ok",
|
|
1657
|
-
months: {
|
|
1658
|
-
full: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
|
1659
|
-
abbr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
|
1660
|
-
},
|
|
1661
|
-
weeks: {
|
|
1662
|
-
full: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
|
1663
|
-
abbr: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
|
|
1664
|
-
}
|
|
1665
|
-
};
|
|
1666
|
-
Language = class {
|
|
1667
|
-
constructor() {
|
|
1668
|
-
this.lang = localeMessage;
|
|
1669
|
-
}
|
|
1670
|
-
setDefaultMessage(lang) {
|
|
1671
|
-
localeMessage = Object.assign(localeMessage, lang);
|
|
1672
|
-
}
|
|
1673
|
-
/**
|
|
1674
|
-
* 다국어 메시지 등록
|
|
1675
|
-
*
|
|
1676
|
-
* @public
|
|
1677
|
-
* @param {?Message} [lang] 둥록할 메시지
|
|
1678
|
-
*/
|
|
1679
|
-
set(lang) {
|
|
1680
|
-
this.lang = Object.assign({}, localeMessage, lang);
|
|
1681
|
-
}
|
|
1682
|
-
/**
|
|
1683
|
-
* 메시지 얻기
|
|
1684
|
-
*
|
|
1685
|
-
* @public
|
|
1686
|
-
* @param {string} messageKey 메시지 키
|
|
1687
|
-
* @returns {*}
|
|
1688
|
-
*/
|
|
1689
|
-
getMessage(messageKey) {
|
|
1690
|
-
return this.lang[messageKey];
|
|
1691
|
-
}
|
|
1692
|
-
getMonthsMessage(idx, mode = "abbr") {
|
|
1693
|
-
return this.lang.months[mode][idx] || "";
|
|
1694
|
-
}
|
|
1695
|
-
getWeeksMessage(idx, mode = "abbr") {
|
|
1696
|
-
return this.lang.weeks[mode][idx] || "";
|
|
1697
|
-
}
|
|
1698
|
-
getMonthsIdx(val, mode = "abbr") {
|
|
1699
|
-
return mode == "full" ? this.lang.months.full.indexOf(val) : this.lang.months.abbr.indexOf(val);
|
|
1700
|
-
}
|
|
1701
|
-
getWeeksIdx(val, mode = "abbr") {
|
|
1702
|
-
return mode == "full" ? this.lang.weeks.full.indexOf(val) : this.lang.weeks.abbr.indexOf(val);
|
|
1703
|
-
}
|
|
1704
|
-
};
|
|
1705
|
-
Lanauage_default2 = new Language();
|
|
1706
|
-
}
|
|
1707
|
-
});
|
|
1708
|
-
var EXPRESSIONS_FORMAT;
|
|
1709
|
-
var MAX_CHAR_LENGTH;
|
|
1710
|
-
var DEFAULT_FORMAT;
|
|
1711
|
-
var DAY_STYLE_CLASS;
|
|
1712
|
-
var DateViewMode;
|
|
1713
|
-
var init_constants = __esm({
|
|
1714
|
-
"src/constants.ts"() {
|
|
1715
|
-
"use strict";
|
|
1716
|
-
EXPRESSIONS_FORMAT = ["YY", "YYYY", "MMMM", "MMM", "MM", "M", "dddd", "ddd", "dd", "d", "DD", "D", "S", "HH", "H", "hh", "h", "mm", "m", "ss", "s", "SSS", "zzzz", "zzz", "zz", "z", "a", "A"];
|
|
1717
|
-
MAX_CHAR_LENGTH = 0;
|
|
1718
|
-
DEFAULT_FORMAT = {
|
|
1719
|
-
year: "YYYY",
|
|
1720
|
-
month: "YYYY-MM",
|
|
1721
|
-
date: "YYYY-MM-DD",
|
|
1722
|
-
time: "HH:mm",
|
|
1723
|
-
datetime: "YYYY-MM-DD HH:mm"
|
|
1724
|
-
};
|
|
1725
|
-
DAY_STYLE_CLASS = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
|
|
1726
|
-
DateViewMode = /* @__PURE__ */ ((DateViewMode2) => {
|
|
1727
|
-
DateViewMode2["year"] = "year";
|
|
1728
|
-
DateViewMode2["month"] = "month";
|
|
1729
|
-
DateViewMode2["date"] = "date";
|
|
1730
|
-
DateViewMode2["datetime"] = "datetime";
|
|
1731
|
-
DateViewMode2["time"] = "time";
|
|
1732
|
-
return DateViewMode2;
|
|
1733
|
-
})(DateViewMode || {});
|
|
1734
|
-
EXPRESSIONS_FORMAT.forEach((item) => {
|
|
1735
|
-
MAX_CHAR_LENGTH = Math.max(item.length, MAX_CHAR_LENGTH);
|
|
1736
|
-
});
|
|
1737
|
-
}
|
|
1738
|
-
});
|
|
1739
|
-
var xssFilter2;
|
|
1740
|
-
var utils_default;
|
|
1741
|
-
var init_utils = __esm({
|
|
1742
|
-
"src/util/utils.ts"() {
|
|
1743
|
-
"use strict";
|
|
1744
|
-
xssFilter2 = {
|
|
1745
|
-
"&": "&",
|
|
1746
|
-
"<": "<",
|
|
1747
|
-
">": ">",
|
|
1748
|
-
'"': """,
|
|
1749
|
-
"'": "'"
|
|
1750
|
-
};
|
|
1751
|
-
utils_default = {
|
|
1752
|
-
replace(str) {
|
|
1753
|
-
let returnText = str;
|
|
1754
|
-
if (returnText) {
|
|
1755
|
-
Object.keys(xssFilter2).forEach((key) => {
|
|
1756
|
-
returnText = returnText.replaceAll(key, xssFilter2[key]);
|
|
1757
|
-
});
|
|
1758
|
-
}
|
|
1759
|
-
return returnText;
|
|
1760
|
-
},
|
|
1761
|
-
unReplace(inputText) {
|
|
1762
|
-
let returnText = inputText;
|
|
1763
|
-
if (returnText) {
|
|
1764
|
-
Object.keys(xssFilter2).forEach((key) => {
|
|
1765
|
-
returnText = returnText.replaceAll(xssFilter2[key], key);
|
|
1766
|
-
});
|
|
1767
|
-
}
|
|
1768
|
-
return returnText;
|
|
1769
|
-
},
|
|
1770
|
-
unFieldName(fieldName) {
|
|
1771
|
-
if (fieldName) {
|
|
1772
|
-
return this.unReplace(fieldName).replaceAll('"', '\\"');
|
|
1773
|
-
}
|
|
1774
|
-
return "";
|
|
1775
|
-
},
|
|
1776
|
-
isBlank(value) {
|
|
1777
|
-
if (value === null)
|
|
1778
|
-
return true;
|
|
1779
|
-
if (value === "")
|
|
1780
|
-
return true;
|
|
1781
|
-
if (typeof value === "undefined")
|
|
1782
|
-
return true;
|
|
1783
|
-
if (typeof value === "string" && (value === "" || value.replace(/\s/g, "") === ""))
|
|
1784
|
-
return true;
|
|
1785
|
-
return false;
|
|
1786
|
-
},
|
|
1787
|
-
isUndefined(value) {
|
|
1788
|
-
return typeof value === "undefined";
|
|
1789
|
-
},
|
|
1790
|
-
isFunction(value) {
|
|
1791
|
-
return typeof value === "function";
|
|
1792
|
-
},
|
|
1793
|
-
isString(value) {
|
|
1794
|
-
return typeof value === "string";
|
|
1795
|
-
},
|
|
1796
|
-
isNumber(value) {
|
|
1797
|
-
if (this.isBlank(value)) {
|
|
1798
|
-
return false;
|
|
1799
|
-
}
|
|
1800
|
-
return !isNaN(value);
|
|
1801
|
-
},
|
|
1802
|
-
isArray(value) {
|
|
1803
|
-
return Array.isArray(value);
|
|
1804
|
-
},
|
|
1805
|
-
getHashCode(str) {
|
|
1806
|
-
let hash = 0;
|
|
1807
|
-
if (str.length == 0)
|
|
1808
|
-
return hash;
|
|
1809
|
-
for (let i = 0; i < str.length; i++) {
|
|
1810
|
-
let tmpChar = str.charCodeAt(i);
|
|
1811
|
-
hash = (hash << 5) - hash + tmpChar;
|
|
1812
|
-
hash = hash & hash;
|
|
1813
|
-
}
|
|
1814
|
-
return hash;
|
|
1815
|
-
},
|
|
1816
|
-
pad(str, length) {
|
|
1817
|
-
str = String(str);
|
|
1818
|
-
while (str.length < length) {
|
|
1819
|
-
str = "0" + str;
|
|
1820
|
-
}
|
|
1821
|
-
return str;
|
|
1822
|
-
},
|
|
1823
|
-
closestElement(el, checkElement) {
|
|
1824
|
-
let currentEl = el;
|
|
1825
|
-
while (currentEl) {
|
|
1826
|
-
if (currentEl == checkElement) {
|
|
1827
|
-
return true;
|
|
1828
|
-
}
|
|
1829
|
-
currentEl = currentEl.parentElement;
|
|
1830
|
-
}
|
|
1831
|
-
return false;
|
|
1832
|
-
}
|
|
1833
|
-
};
|
|
1834
|
-
}
|
|
1835
|
-
});
|
|
1836
|
-
function getH(date) {
|
|
1837
|
-
let hour = date.getHours();
|
|
1838
|
-
if (hour > 12) {
|
|
1839
|
-
hour -= 12;
|
|
1840
|
-
} else if (hour < 1) {
|
|
1841
|
-
hour = 12;
|
|
1842
|
-
}
|
|
1843
|
-
return hour;
|
|
1844
|
-
}
|
|
1845
|
-
function getMeridiem(date, isUpper, isShort) {
|
|
1846
|
-
const hour = date.getHours();
|
|
1847
|
-
let m = hour < 12 ? "am" : "pm";
|
|
1848
|
-
m = Lanauage_default2.getMessage(m);
|
|
1849
|
-
m = isUpper ? m.toUpperCase() : m;
|
|
1850
|
-
return m;
|
|
1851
|
-
}
|
|
1852
|
-
var format_default;
|
|
1853
|
-
var expressionsFunction;
|
|
1854
|
-
var init_format = __esm({
|
|
1855
|
-
"src/format/index.ts"() {
|
|
1856
|
-
"use strict";
|
|
1857
|
-
init_Lanauage();
|
|
1858
|
-
init_constants();
|
|
1859
|
-
init_utils();
|
|
1860
|
-
format_default = (date, format) => {
|
|
1861
|
-
format = format || "YYYY-MM-DD";
|
|
1862
|
-
const len = format.length;
|
|
1863
|
-
let result = [];
|
|
1864
|
-
for (let i = 0; i < len; ) {
|
|
1865
|
-
let minLen = Math.min(MAX_CHAR_LENGTH, len - i);
|
|
1866
|
-
let j = minLen;
|
|
1867
|
-
for (; j > 0; j--) {
|
|
1868
|
-
const v = format.substring(i, i + j);
|
|
1869
|
-
if (EXPRESSIONS_FORMAT.includes(v)) {
|
|
1870
|
-
try {
|
|
1871
|
-
result.push(expressionsFunction[v](date));
|
|
1872
|
-
} catch (e) {
|
|
1873
|
-
console.log(EXPRESSIONS_FORMAT.includes(v), v, e);
|
|
1874
|
-
}
|
|
1875
|
-
break;
|
|
1876
|
-
}
|
|
1877
|
-
}
|
|
1878
|
-
if (j < 1) {
|
|
1879
|
-
result.push(format.substring(i, i + 1));
|
|
1880
|
-
i += 1;
|
|
1881
|
-
} else {
|
|
1882
|
-
i += j;
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
return result.join("");
|
|
1886
|
-
};
|
|
1887
|
-
expressionsFunction = {
|
|
1888
|
-
YY: (date) => {
|
|
1889
|
-
return String(date.getFullYear()).slice(-2);
|
|
1890
|
-
},
|
|
1891
|
-
YYYY: (date) => {
|
|
1892
|
-
return String(date.getFullYear());
|
|
1893
|
-
},
|
|
1894
|
-
M: (date) => {
|
|
1895
|
-
return String(date.getMonth() + 1);
|
|
1896
|
-
},
|
|
1897
|
-
MM: (date) => {
|
|
1898
|
-
return utils_default.pad(date.getMonth() + 1, 2);
|
|
1899
|
-
},
|
|
1900
|
-
MMM: (date) => {
|
|
1901
|
-
return Lanauage_default2.getMonthsMessage(date.getMonth());
|
|
1902
|
-
},
|
|
1903
|
-
MMMM: (date) => {
|
|
1904
|
-
return Lanauage_default2.getMonthsMessage(date.getMonth(), "full");
|
|
1905
|
-
},
|
|
1906
|
-
D: (date) => {
|
|
1907
|
-
return String(date.getDate());
|
|
1908
|
-
},
|
|
1909
|
-
DD: (date) => {
|
|
1910
|
-
return utils_default.pad(date.getDate(), 2);
|
|
1911
|
-
},
|
|
1912
|
-
d: (date) => {
|
|
1913
|
-
return String(date.getDate());
|
|
1914
|
-
},
|
|
1915
|
-
dd: (date) => {
|
|
1916
|
-
return utils_default.pad(date.getDate(), 2);
|
|
1917
|
-
},
|
|
1918
|
-
ddd: (date) => {
|
|
1919
|
-
return Lanauage_default2.getWeeksMessage(date.getDay());
|
|
1920
|
-
},
|
|
1921
|
-
dddd: (date) => {
|
|
1922
|
-
return Lanauage_default2.getWeeksMessage(date.getDay(), "full");
|
|
1923
|
-
},
|
|
1924
|
-
H: (date) => {
|
|
1925
|
-
return String(date.getHours());
|
|
1926
|
-
},
|
|
1927
|
-
HH: (date) => {
|
|
1928
|
-
return utils_default.pad(date.getHours(), 2);
|
|
1929
|
-
},
|
|
1930
|
-
h: (date) => {
|
|
1931
|
-
return getH(date);
|
|
1932
|
-
},
|
|
1933
|
-
hh: (date) => {
|
|
1934
|
-
return utils_default.pad(getH(date), 2);
|
|
1935
|
-
},
|
|
1936
|
-
a: (date) => {
|
|
1937
|
-
return String(date.getFullYear()).slice(-2);
|
|
1938
|
-
},
|
|
1939
|
-
A: (date) => {
|
|
1940
|
-
return getMeridiem(date, true, true);
|
|
1941
|
-
},
|
|
1942
|
-
m: (date) => {
|
|
1943
|
-
return String(date.getMinutes());
|
|
1944
|
-
},
|
|
1945
|
-
mm: (date) => {
|
|
1946
|
-
return utils_default.pad(date.getMinutes(), 2);
|
|
1947
|
-
},
|
|
1948
|
-
s: (date) => {
|
|
1949
|
-
return String(date.getSeconds());
|
|
1950
|
-
},
|
|
1951
|
-
ss: (date) => {
|
|
1952
|
-
return utils_default.pad(date.getSeconds(), 2);
|
|
1953
|
-
},
|
|
1954
|
-
SSS: (date) => {
|
|
1955
|
-
return utils_default.pad(date.getMilliseconds(), 3);
|
|
1956
|
-
}
|
|
1957
|
-
};
|
|
1958
|
-
}
|
|
1959
|
-
});
|
|
1960
|
-
var parser_default;
|
|
1961
|
-
var matchFind;
|
|
1962
|
-
var digitsCheck;
|
|
1963
|
-
var word;
|
|
1964
|
-
var expressionsFunction2;
|
|
1965
|
-
var init_parser = __esm({
|
|
1966
|
-
"src/util/parser.ts"() {
|
|
1967
|
-
"use strict";
|
|
1968
|
-
init_Lanauage();
|
|
1969
|
-
init_constants();
|
|
1970
|
-
parser_default = (dateStr, format) => {
|
|
1971
|
-
if (dateStr.length > 1e3) {
|
|
1972
|
-
return null;
|
|
1973
|
-
}
|
|
1974
|
-
format = format || DEFAULT_FORMAT.date;
|
|
1975
|
-
const dateInfo = {
|
|
1976
|
-
year: (/* @__PURE__ */ new Date()).getFullYear(),
|
|
1977
|
-
month: 0,
|
|
1978
|
-
day: 1,
|
|
1979
|
-
hour: 0,
|
|
1980
|
-
minute: 0,
|
|
1981
|
-
second: 0,
|
|
1982
|
-
millisecond: 0,
|
|
1983
|
-
isPm: false,
|
|
1984
|
-
isH: false,
|
|
1985
|
-
charIdx: 0
|
|
1986
|
-
};
|
|
1987
|
-
const len = format.length;
|
|
1988
|
-
let startIdx = 0;
|
|
1989
|
-
for (let i = 0; i < len; ) {
|
|
1990
|
-
let minLen = Math.min(MAX_CHAR_LENGTH, len - i);
|
|
1991
|
-
let j = minLen;
|
|
1992
|
-
for (; j > 0; j--) {
|
|
1993
|
-
const v = format.substring(i, i + j);
|
|
1994
|
-
if (EXPRESSIONS_FORMAT.includes(v)) {
|
|
1995
|
-
const expInfo = expressionsFunction2[v];
|
|
1996
|
-
const val = matchFind(dateStr.substring(startIdx), expInfo[0]);
|
|
1997
|
-
expInfo[1](dateInfo, val);
|
|
1998
|
-
startIdx += val.length;
|
|
1999
|
-
break;
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
if (j < 1) {
|
|
2003
|
-
i += 1;
|
|
2004
|
-
startIdx += 1;
|
|
2005
|
-
} else {
|
|
2006
|
-
i += j;
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
if (dateInfo.hour != null && !dateInfo.isH) {
|
|
2010
|
-
if (dateInfo.isPm && +dateInfo.hour !== 12) {
|
|
2011
|
-
dateInfo.hour = +dateInfo.hour + 12;
|
|
2012
|
-
} else if (!dateInfo.isPm && +dateInfo.hour === 12) {
|
|
2013
|
-
dateInfo.hour = 0;
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
let date;
|
|
2017
|
-
date = new Date(dateInfo.year, dateInfo.month, dateInfo.day, dateInfo.hour, dateInfo.minute, dateInfo.second, dateInfo.millisecond);
|
|
2018
|
-
return date;
|
|
2019
|
-
};
|
|
2020
|
-
matchFind = (val, regexp2) => {
|
|
2021
|
-
const match = regexp2.exec(val);
|
|
2022
|
-
return match == null ? "" : match[0];
|
|
2023
|
-
};
|
|
2024
|
-
digitsCheck = {
|
|
2025
|
-
twoOptional: /\d\d?/,
|
|
2026
|
-
two: /\d\d/,
|
|
2027
|
-
three: /\d{3}/,
|
|
2028
|
-
four: /\d{4}/
|
|
2029
|
-
};
|
|
2030
|
-
word = /[^\s]+/;
|
|
2031
|
-
expressionsFunction2 = {
|
|
2032
|
-
YY: [
|
|
2033
|
-
digitsCheck["two"],
|
|
2034
|
-
(dateInfo, val) => {
|
|
2035
|
-
dateInfo.year = +(("" + (/* @__PURE__ */ new Date()).getFullYear()).substring(0, 2) + val);
|
|
2036
|
-
return dateInfo;
|
|
2037
|
-
}
|
|
2038
|
-
],
|
|
2039
|
-
YYYY: [
|
|
2040
|
-
digitsCheck["four"],
|
|
2041
|
-
(dateInfo, val) => {
|
|
2042
|
-
dateInfo.year = +val;
|
|
2043
|
-
return dateInfo;
|
|
2044
|
-
}
|
|
2045
|
-
],
|
|
2046
|
-
M: [
|
|
2047
|
-
digitsCheck["twoOptional"],
|
|
2048
|
-
(dateInfo, val) => {
|
|
2049
|
-
dateInfo.month = +val - 1;
|
|
2050
|
-
return dateInfo;
|
|
2051
|
-
}
|
|
2052
|
-
],
|
|
2053
|
-
MM: [
|
|
2054
|
-
digitsCheck["two"],
|
|
2055
|
-
(dateInfo, val) => {
|
|
2056
|
-
dateInfo.month = +val - 1;
|
|
2057
|
-
return dateInfo;
|
|
2058
|
-
}
|
|
2059
|
-
],
|
|
2060
|
-
MMM: [
|
|
2061
|
-
word,
|
|
2062
|
-
(dateInfo, val) => {
|
|
2063
|
-
dateInfo.month = Lanauage_default2.getMonthsIdx(val, "abbr");
|
|
2064
|
-
return dateInfo;
|
|
2065
|
-
}
|
|
2066
|
-
],
|
|
2067
|
-
MMMM: [
|
|
2068
|
-
word,
|
|
2069
|
-
(dateInfo, val) => {
|
|
2070
|
-
dateInfo.month = Lanauage_default2.getMonthsIdx(val, "full");
|
|
2071
|
-
return dateInfo;
|
|
2072
|
-
}
|
|
2073
|
-
],
|
|
2074
|
-
D: [
|
|
2075
|
-
digitsCheck["twoOptional"],
|
|
2076
|
-
(dateInfo, val) => {
|
|
2077
|
-
dateInfo.day = +val;
|
|
2078
|
-
return dateInfo;
|
|
2079
|
-
}
|
|
2080
|
-
],
|
|
2081
|
-
DD: [
|
|
2082
|
-
digitsCheck["two"],
|
|
2083
|
-
(dateInfo, val) => {
|
|
2084
|
-
dateInfo.day = +val;
|
|
2085
|
-
return dateInfo;
|
|
2086
|
-
}
|
|
2087
|
-
],
|
|
2088
|
-
d: [
|
|
2089
|
-
digitsCheck["twoOptional"],
|
|
2090
|
-
(dateInfo, val) => {
|
|
2091
|
-
dateInfo.day = +val;
|
|
2092
|
-
return dateInfo;
|
|
2093
|
-
}
|
|
2094
|
-
],
|
|
2095
|
-
dd: [
|
|
2096
|
-
digitsCheck["two"],
|
|
2097
|
-
(dateInfo, val) => {
|
|
2098
|
-
dateInfo.day = +val;
|
|
2099
|
-
return dateInfo;
|
|
2100
|
-
}
|
|
2101
|
-
],
|
|
2102
|
-
ddd: [
|
|
2103
|
-
word,
|
|
2104
|
-
(dateInfo, val) => {
|
|
2105
|
-
return dateInfo;
|
|
2106
|
-
}
|
|
2107
|
-
],
|
|
2108
|
-
dddd: [
|
|
2109
|
-
word,
|
|
2110
|
-
(dateInfo, val) => {
|
|
2111
|
-
return dateInfo;
|
|
2112
|
-
}
|
|
2113
|
-
],
|
|
2114
|
-
H: [
|
|
2115
|
-
digitsCheck["twoOptional"],
|
|
2116
|
-
(dateInfo, val) => {
|
|
2117
|
-
dateInfo.hour = +val;
|
|
2118
|
-
dateInfo.isH = true;
|
|
2119
|
-
return dateInfo;
|
|
2120
|
-
}
|
|
2121
|
-
],
|
|
2122
|
-
HH: [
|
|
2123
|
-
digitsCheck["two"],
|
|
2124
|
-
(dateInfo, val) => {
|
|
2125
|
-
dateInfo.hour = +val;
|
|
2126
|
-
dateInfo.isH = true;
|
|
2127
|
-
return dateInfo;
|
|
2128
|
-
}
|
|
2129
|
-
],
|
|
2130
|
-
h: [
|
|
2131
|
-
digitsCheck["twoOptional"],
|
|
2132
|
-
(dateInfo, val) => {
|
|
2133
|
-
dateInfo.hour = +val;
|
|
2134
|
-
return dateInfo;
|
|
2135
|
-
}
|
|
2136
|
-
],
|
|
2137
|
-
hh: [
|
|
2138
|
-
digitsCheck["two"],
|
|
2139
|
-
(dateInfo, val) => {
|
|
2140
|
-
dateInfo.hour = +val;
|
|
2141
|
-
return dateInfo;
|
|
2142
|
-
}
|
|
2143
|
-
],
|
|
2144
|
-
a: [
|
|
2145
|
-
word,
|
|
2146
|
-
(dateInfo, val) => {
|
|
2147
|
-
if (Lanauage_default2.getMessage("am") != val.toLowerCase()) {
|
|
2148
|
-
dateInfo.isPm = true;
|
|
2149
|
-
}
|
|
2150
|
-
return dateInfo;
|
|
2151
|
-
}
|
|
2152
|
-
],
|
|
2153
|
-
A: [
|
|
2154
|
-
word,
|
|
2155
|
-
(dateInfo, val) => {
|
|
2156
|
-
if (Lanauage_default2.getMessage("am") != val.toLowerCase()) {
|
|
2157
|
-
dateInfo.isPm = true;
|
|
2158
|
-
}
|
|
2159
|
-
return dateInfo;
|
|
2160
|
-
}
|
|
2161
|
-
],
|
|
2162
|
-
m: [
|
|
2163
|
-
digitsCheck["twoOptional"],
|
|
2164
|
-
(dateInfo, val) => {
|
|
2165
|
-
dateInfo.minute = +val;
|
|
2166
|
-
return dateInfo;
|
|
2167
|
-
}
|
|
2168
|
-
],
|
|
2169
|
-
mm: [
|
|
2170
|
-
digitsCheck["two"],
|
|
2171
|
-
(dateInfo, val) => {
|
|
2172
|
-
dateInfo.minute = +val;
|
|
2173
|
-
return dateInfo;
|
|
2174
|
-
}
|
|
2175
|
-
],
|
|
2176
|
-
s: [
|
|
2177
|
-
digitsCheck["twoOptional"],
|
|
2178
|
-
(dateInfo, val) => {
|
|
2179
|
-
dateInfo.second = +val;
|
|
2180
|
-
return dateInfo;
|
|
2181
|
-
}
|
|
2182
|
-
],
|
|
2183
|
-
ss: [
|
|
2184
|
-
digitsCheck["two"],
|
|
2185
|
-
(dateInfo, val) => {
|
|
2186
|
-
dateInfo.second = +val;
|
|
2187
|
-
return dateInfo;
|
|
2188
|
-
}
|
|
2189
|
-
],
|
|
2190
|
-
SSS: [
|
|
2191
|
-
digitsCheck["three"],
|
|
2192
|
-
(dateInfo, val) => {
|
|
2193
|
-
dateInfo.millisecond = +val;
|
|
2194
|
-
return dateInfo;
|
|
2195
|
-
}
|
|
2196
|
-
]
|
|
2197
|
-
};
|
|
2198
|
-
}
|
|
2199
|
-
});
|
|
2200
|
-
var DaraDate;
|
|
2201
|
-
var init_DaraDate = __esm({
|
|
2202
|
-
"src/DaraDate.ts"() {
|
|
2203
|
-
"use strict";
|
|
2204
|
-
init_format();
|
|
2205
|
-
DaraDate = class _DaraDate {
|
|
2206
|
-
constructor(dt) {
|
|
2207
|
-
this.date = dt;
|
|
2208
|
-
}
|
|
2209
|
-
setYear(num) {
|
|
2210
|
-
this.date.setFullYear(num);
|
|
2211
|
-
return this;
|
|
2212
|
-
}
|
|
2213
|
-
addYear(num) {
|
|
2214
|
-
this.date.setFullYear(this.date.getFullYear() + num);
|
|
2215
|
-
return this;
|
|
2216
|
-
}
|
|
2217
|
-
addMonth(num) {
|
|
2218
|
-
this.date.setMonth(this.date.getMonth() + num);
|
|
2219
|
-
return this;
|
|
2220
|
-
}
|
|
2221
|
-
setMonth(num) {
|
|
2222
|
-
this.date.setMonth(num);
|
|
2223
|
-
return this;
|
|
2224
|
-
}
|
|
2225
|
-
setDate(num) {
|
|
2226
|
-
this.date.setDate(num);
|
|
2227
|
-
return this;
|
|
2228
|
-
}
|
|
2229
|
-
addDate(num) {
|
|
2230
|
-
this.date.setDate(this.date.getDate() + num);
|
|
2231
|
-
return this;
|
|
2232
|
-
}
|
|
2233
|
-
addWeek(num) {
|
|
2234
|
-
this.date.setDate(this.date.getDate() + num * 7);
|
|
2235
|
-
return this;
|
|
2236
|
-
}
|
|
2237
|
-
addHours(num) {
|
|
2238
|
-
this.date.setHours(this.date.getHours() + num);
|
|
2239
|
-
return this;
|
|
2240
|
-
}
|
|
2241
|
-
setHour(num) {
|
|
2242
|
-
this.date.setHours(num);
|
|
2243
|
-
return this;
|
|
2244
|
-
}
|
|
2245
|
-
addMinutes(num) {
|
|
2246
|
-
this.date.setMinutes(this.date.getMinutes() + num);
|
|
2247
|
-
return this;
|
|
2248
|
-
}
|
|
2249
|
-
setMinutes(num) {
|
|
2250
|
-
this.date.setMinutes(num);
|
|
2251
|
-
return this;
|
|
2252
|
-
}
|
|
2253
|
-
addSeconds(num) {
|
|
2254
|
-
this.date.setSeconds(this.date.getSeconds() + num);
|
|
2255
|
-
return this;
|
|
2256
|
-
}
|
|
2257
|
-
addMilliseconds(num) {
|
|
2258
|
-
this.date.setMilliseconds(this.date.getMilliseconds() + num);
|
|
2259
|
-
return this;
|
|
2260
|
-
}
|
|
2261
|
-
compare(date) {
|
|
2262
|
-
if (this.date.valueOf() < date.valueOf()) {
|
|
2263
|
-
return -1;
|
|
2264
|
-
} else if (this.date.valueOf() > date.valueOf()) {
|
|
2265
|
-
return 1;
|
|
2266
|
-
}
|
|
2267
|
-
return 0;
|
|
2268
|
-
}
|
|
2269
|
-
getYear() {
|
|
2270
|
-
return this.date.getFullYear();
|
|
2271
|
-
}
|
|
2272
|
-
getMonth() {
|
|
2273
|
-
return this.date.getMonth() + 1;
|
|
2274
|
-
}
|
|
2275
|
-
getDate() {
|
|
2276
|
-
return this.date.getDate();
|
|
2277
|
-
}
|
|
2278
|
-
getDay() {
|
|
2279
|
-
return this.date.getDay();
|
|
2280
|
-
}
|
|
2281
|
-
getTime() {
|
|
2282
|
-
return this.date.getTime();
|
|
2283
|
-
}
|
|
2284
|
-
format(format) {
|
|
2285
|
-
return format_default(this.date, format);
|
|
2286
|
-
}
|
|
2287
|
-
clone() {
|
|
2288
|
-
return new _DaraDate(new Date(this.date.valueOf()));
|
|
2289
|
-
}
|
|
2290
|
-
};
|
|
2291
|
-
}
|
|
2292
|
-
});
|
|
2293
|
-
function hiddenElement() {
|
|
2294
|
-
if (document.getElementById("hiddenDaraDatetimeElement") == null) {
|
|
2295
|
-
document.querySelector("body")?.insertAdjacentHTML("beforeend", `<div id="hiddenDaraDatetimeElement" class="daracl-datetime-hidden"></div>`);
|
|
2296
|
-
}
|
|
2297
|
-
return document.getElementById("hiddenDaraDatetimeElement");
|
|
2298
|
-
}
|
|
2299
|
-
function getDocSize() {
|
|
2300
|
-
return {
|
|
2301
|
-
clientHeight: Math.max(document.documentElement.clientHeight, window.innerHeight || 0),
|
|
2302
|
-
clientWidth: Math.max(document.documentElement.clientWidth, window.innerWidth || 0)
|
|
2303
|
-
};
|
|
2304
|
-
}
|
|
2305
|
-
var DEFAULT_OPTIONS;
|
|
2306
|
-
var daraDatetimeIdx;
|
|
2307
|
-
var DateTimePicker;
|
|
2308
|
-
var init_DateTimePicker = __esm({
|
|
2309
|
-
"src/DateTimePicker.ts"() {
|
|
2310
|
-
"use strict";
|
|
2311
|
-
init_format();
|
|
2312
|
-
init_parser();
|
|
2313
|
-
init_Lanauage();
|
|
2314
|
-
init_utils();
|
|
2315
|
-
init_DaraDate();
|
|
2316
|
-
init_constants();
|
|
2317
|
-
DEFAULT_OPTIONS = {
|
|
2318
|
-
inline: false,
|
|
2319
|
-
// layer or innerhtml
|
|
2320
|
-
weekStartDay: 0,
|
|
2321
|
-
initialDate: "",
|
|
2322
|
-
autoClose: true,
|
|
2323
|
-
isRTL: false,
|
|
2324
|
-
mode: "date",
|
|
2325
|
-
enableTodayBtn: true,
|
|
2326
|
-
showMonthAfterYear: false,
|
|
2327
|
-
isPositionFixed: false,
|
|
2328
|
-
format: "",
|
|
2329
|
-
zIndex: 1e3,
|
|
2330
|
-
minDate: "",
|
|
2331
|
-
maxDate: "",
|
|
2332
|
-
beforeDrawDate: (dt) => {
|
|
2333
|
-
return {
|
|
2334
|
-
check: false,
|
|
2335
|
-
style: "",
|
|
2336
|
-
tooltip: ""
|
|
2337
|
-
};
|
|
2338
|
-
}
|
|
2339
|
-
};
|
|
2340
|
-
daraDatetimeIdx = 0;
|
|
2341
|
-
DateTimePicker = class _DateTimePicker {
|
|
2342
|
-
constructor(selector, options, message2) {
|
|
2343
|
-
this.isInput = false;
|
|
2344
|
-
this.isVisible = false;
|
|
2345
|
-
this.minYear = -1;
|
|
2346
|
-
this.maxYear = -1;
|
|
2347
|
-
this.minMonth = -1;
|
|
2348
|
-
this.maxMonth = -1;
|
|
2349
|
-
this.dayOrder = [0, 1, 2, 3, 4, 5, 6];
|
|
2350
|
-
this._documentClickEvent = (e) => {
|
|
2351
|
-
if (this.isVisible && e.target != this.targetElement && !utils_default.closestElement(e.target, this.datetimeElement)) {
|
|
2352
|
-
this.hide();
|
|
2353
|
-
}
|
|
2354
|
-
};
|
|
2355
|
-
this.options = Object.assign({}, DEFAULT_OPTIONS, options);
|
|
2356
|
-
daraDatetimeIdx += 1;
|
|
2357
|
-
let selectorElement;
|
|
2358
|
-
if (typeof selector === "string") {
|
|
2359
|
-
selectorElement = document.querySelector(selector);
|
|
2360
|
-
} else {
|
|
2361
|
-
selectorElement = selector;
|
|
2362
|
-
}
|
|
2363
|
-
if (!selectorElement) {
|
|
2364
|
-
throw new Error(`${selector} datetimepicker element not found`);
|
|
2365
|
-
}
|
|
2366
|
-
this._viewMode = Object.keys(DateViewMode).includes(this.options.mode) ? this.options.mode : "date";
|
|
2367
|
-
this.initMode = this._viewMode;
|
|
2368
|
-
Lanauage_default2.set(message2);
|
|
2369
|
-
if (this.initMode == "year") {
|
|
2370
|
-
this.dateFormat = this.options.format || DEFAULT_FORMAT.year;
|
|
2371
|
-
} else if (this.initMode == "month") {
|
|
2372
|
-
this.dateFormat = this.options.format || DEFAULT_FORMAT.month;
|
|
2373
|
-
} else if (this.initMode == "time") {
|
|
2374
|
-
this.dateFormat = this.options.format || DEFAULT_FORMAT.time;
|
|
2375
|
-
} else if (this.initMode == "datetime") {
|
|
2376
|
-
this.dateFormat = this.options.format || DEFAULT_FORMAT.datetime;
|
|
2377
|
-
} else {
|
|
2378
|
-
this.dateFormat = this.options.format || DEFAULT_FORMAT.date;
|
|
2379
|
-
}
|
|
2380
|
-
let viewDate;
|
|
2381
|
-
if (this.options.initialDate) {
|
|
2382
|
-
if (typeof this.options.initialDate === "string") {
|
|
2383
|
-
viewDate = new DaraDate(parser_default(this.options.initialDate, this.dateFormat) || /* @__PURE__ */ new Date());
|
|
2384
|
-
} else {
|
|
2385
|
-
viewDate = new DaraDate(this.options.initialDate);
|
|
2386
|
-
}
|
|
2387
|
-
} else {
|
|
2388
|
-
viewDate = new DaraDate(/* @__PURE__ */ new Date());
|
|
2389
|
-
this.options.initialDate = viewDate.format(this.dateFormat);
|
|
2390
|
-
}
|
|
2391
|
-
this.setWeekDays();
|
|
2392
|
-
this.todayDate = viewDate.format(DEFAULT_FORMAT.date);
|
|
2393
|
-
this.currentDate = viewDate;
|
|
2394
|
-
this.targetElement = selectorElement;
|
|
2395
|
-
this.minDate = this._minDate();
|
|
2396
|
-
this.maxDate = this._maxDate();
|
|
2397
|
-
if (this.options.inline) {
|
|
2398
|
-
this.datetimeElement = selectorElement;
|
|
2399
|
-
this.datetimeElement.className = `daracl-datetime-wrapper ddtp-${daraDatetimeIdx} embed`;
|
|
2400
|
-
} else {
|
|
2401
|
-
this.isInput = true;
|
|
2402
|
-
this.targetElement.setAttribute("value", viewDate.format(this.dateFormat));
|
|
2403
|
-
const datetimeElement = document.createElement("div");
|
|
2404
|
-
datetimeElement.className = `daracl-datetime-wrapper ddtp-${daraDatetimeIdx} layer`;
|
|
2405
|
-
datetimeElement.setAttribute("style", `z-index:${this.options.zIndex};`);
|
|
2406
|
-
hiddenElement()?.appendChild(datetimeElement);
|
|
2407
|
-
this.datetimeElement = datetimeElement;
|
|
2408
|
-
this.initTargetEvent();
|
|
2409
|
-
}
|
|
2410
|
-
this.createDatetimeTemplate();
|
|
2411
|
-
if (this.isTimeMode()) {
|
|
2412
|
-
this.hourInputEle = this.datetimeElement.querySelector(".ddtp-hour");
|
|
2413
|
-
this.minuteInputEle = this.datetimeElement.querySelector(".ddtp-minute");
|
|
2414
|
-
} else {
|
|
2415
|
-
this.hourInputEle = {};
|
|
2416
|
-
this.minuteInputEle = {};
|
|
2417
|
-
}
|
|
2418
|
-
this.changeViewMode(this._viewMode);
|
|
2419
|
-
this.initHeaderEvent();
|
|
2420
|
-
this.initDateEvent();
|
|
2421
|
-
this.initTimeEvent();
|
|
2422
|
-
}
|
|
2423
|
-
static {
|
|
2424
|
-
this.VERSION = `${APP_VERSION}`;
|
|
2425
|
-
}
|
|
2426
|
-
static {
|
|
2427
|
-
this.format = format_default;
|
|
2428
|
-
}
|
|
2429
|
-
static {
|
|
2430
|
-
this.parser = parser_default;
|
|
2431
|
-
}
|
|
2432
|
-
setWeekDays() {
|
|
2433
|
-
let weekStartDay = this.options.weekStartDay;
|
|
2434
|
-
if (weekStartDay == 0)
|
|
2435
|
-
return;
|
|
2436
|
-
if (weekStartDay < 0 || weekStartDay > 6) {
|
|
2437
|
-
weekStartDay = 0;
|
|
2438
|
-
}
|
|
2439
|
-
for (let i = 0; i < 7; i++) {
|
|
2440
|
-
let day = weekStartDay + i;
|
|
2441
|
-
this.dayOrder[i] = day < 7 ? day : day - 7;
|
|
2442
|
-
}
|
|
2443
|
-
}
|
|
2444
|
-
static create(selector, options, message2) {
|
|
2445
|
-
return new _DateTimePicker(selector, options, message2);
|
|
2446
|
-
}
|
|
2447
|
-
/**
|
|
2448
|
-
* default date format setting
|
|
2449
|
-
* @example
|
|
2450
|
-
```
|
|
2451
|
-
setDefaultFormat({
|
|
2452
|
-
year: "YYYY",
|
|
2453
|
-
month: "YYYY-MM",
|
|
2454
|
-
date: "YYYY-MM-DD",
|
|
2455
|
-
time: "HH:mm",
|
|
2456
|
-
datetime: "YYYY-MM-DD HH:mm",
|
|
2457
|
-
});
|
|
2458
|
-
```
|
|
2459
|
-
* @public
|
|
2460
|
-
* @static
|
|
2461
|
-
* @param {*} dateFormat
|
|
2462
|
-
*/
|
|
2463
|
-
static setDefaultFormat(dateFormat) {
|
|
2464
|
-
Object.assign(DEFAULT_FORMAT, dateFormat);
|
|
2465
|
-
}
|
|
2466
|
-
_minDate() {
|
|
2467
|
-
let minDate = this.options.minDate;
|
|
2468
|
-
if (minDate != "") {
|
|
2469
|
-
if (typeof minDate === "string") {
|
|
2470
|
-
const dt = parser_default(minDate, this.dateFormat);
|
|
2471
|
-
if (!dt) {
|
|
2472
|
-
return -1;
|
|
2473
|
-
}
|
|
2474
|
-
minDate = dt;
|
|
2475
|
-
}
|
|
2476
|
-
this.minYear = minDate.getFullYear();
|
|
2477
|
-
this.minMonth = +(this.minYear + utils_default.pad(minDate.getMonth(), 2));
|
|
2478
|
-
return new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate(), 0, 0).getTime();
|
|
2479
|
-
}
|
|
2480
|
-
return -1;
|
|
2481
|
-
}
|
|
2482
|
-
_maxDate() {
|
|
2483
|
-
let maxDate = this.options.maxDate;
|
|
2484
|
-
if (maxDate != "") {
|
|
2485
|
-
if (typeof maxDate === "string") {
|
|
2486
|
-
const dt = parser_default(maxDate, this.dateFormat);
|
|
2487
|
-
if (!dt) {
|
|
2488
|
-
return -1;
|
|
2489
|
-
}
|
|
2490
|
-
maxDate = dt;
|
|
2491
|
-
}
|
|
2492
|
-
this.maxYear = maxDate.getFullYear();
|
|
2493
|
-
this.maxMonth = +(this.maxYear + utils_default.pad(maxDate.getMonth(), 2));
|
|
2494
|
-
return new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59).getTime();
|
|
2495
|
-
}
|
|
2496
|
-
return -1;
|
|
2497
|
-
}
|
|
2498
|
-
set viewMode(mode) {
|
|
2499
|
-
if (this._viewMode === mode) {
|
|
2500
|
-
return;
|
|
2501
|
-
}
|
|
2502
|
-
this._viewMode = mode;
|
|
2503
|
-
this.changeViewMode(mode);
|
|
2504
|
-
}
|
|
2505
|
-
get viewMode() {
|
|
2506
|
-
return this._viewMode;
|
|
2507
|
-
}
|
|
2508
|
-
/**
|
|
2509
|
-
* 모드 change
|
|
2510
|
-
* @param mode
|
|
2511
|
-
*/
|
|
2512
|
-
changeViewMode(mode) {
|
|
2513
|
-
this.datetimeElement.querySelector(".ddtp-datetime")?.setAttribute("view-mode", mode);
|
|
2514
|
-
if (mode === "year") {
|
|
2515
|
-
this.yearDraw();
|
|
2516
|
-
} else if (mode === "month") {
|
|
2517
|
-
this.monthDraw();
|
|
2518
|
-
} else {
|
|
2519
|
-
this.dayDraw();
|
|
2520
|
-
}
|
|
2521
|
-
}
|
|
2522
|
-
/**
|
|
2523
|
-
* init header event
|
|
2524
|
-
*
|
|
2525
|
-
* @public
|
|
2526
|
-
*/
|
|
2527
|
-
initHeaderEvent() {
|
|
2528
|
-
const isRTL = this.options.isRTL;
|
|
2529
|
-
this.datetimeElement.querySelector(".ddtp-move-btn.prev")?.addEventListener("click", (e) => {
|
|
2530
|
-
this.moveDate(isRTL ? "next" : "prev", e);
|
|
2531
|
-
});
|
|
2532
|
-
this.datetimeElement.querySelector(".ddtp-move-btn.next")?.addEventListener("click", (e) => {
|
|
2533
|
-
this.moveDate(isRTL ? "prev" : "next", e);
|
|
2534
|
-
});
|
|
2535
|
-
this.datetimeElement.querySelector(".ddtp-header-year")?.addEventListener("click", (e) => {
|
|
2536
|
-
this.viewMode = "year";
|
|
2537
|
-
});
|
|
2538
|
-
this.datetimeElement.querySelector(".ddtp-header-month")?.addEventListener("click", (e) => {
|
|
2539
|
-
this.viewMode = "month";
|
|
2540
|
-
});
|
|
2541
|
-
}
|
|
2542
|
-
/**
|
|
2543
|
-
* 날짜 달력 이벤트처리.
|
|
2544
|
-
*/
|
|
2545
|
-
initDateEvent() {
|
|
2546
|
-
this.datetimeElement.querySelector(".ddtp-day-body")?.addEventListener("click", (e) => {
|
|
2547
|
-
const targetEle = e.target;
|
|
2548
|
-
if (targetEle.classList.contains("ddtp-day") || targetEle.closest(".ddtp-day")) {
|
|
2549
|
-
const selectDate = targetEle.getAttribute("data-day") || "1";
|
|
2550
|
-
const mmDD = selectDate.split(",");
|
|
2551
|
-
this.currentDate.setMonth(+mmDD[0] - 1);
|
|
2552
|
-
this.currentDate.setDate(+mmDD[1]);
|
|
2553
|
-
if (this.isDayDisabled(this.currentDate)) {
|
|
2554
|
-
return;
|
|
2555
|
-
}
|
|
2556
|
-
this.datetimeElement.querySelector(".select")?.classList.remove("select");
|
|
2557
|
-
targetEle.classList.add("select");
|
|
2558
|
-
if (this.isTimeMode()) {
|
|
2559
|
-
this.currentDate.setHour(+this.hourInputEle.value);
|
|
2560
|
-
this.currentDate.setMinutes(+this.minuteInputEle.value);
|
|
2561
|
-
}
|
|
2562
|
-
this.dateChangeEvent(e);
|
|
2563
|
-
}
|
|
2564
|
-
});
|
|
2565
|
-
this.datetimeElement.querySelector(".time-today")?.addEventListener("click", (e) => {
|
|
2566
|
-
const initDate = new DaraDate(parser_default(this.todayDate, DEFAULT_FORMAT.date) || /* @__PURE__ */ new Date());
|
|
2567
|
-
this.currentDate.setYear(initDate.getYear());
|
|
2568
|
-
this.currentDate.setMonth(initDate.getMonth() - 1);
|
|
2569
|
-
this.currentDate.setDate(initDate.getDate());
|
|
2570
|
-
this.changeViewMode(this.initMode);
|
|
2571
|
-
});
|
|
2572
|
-
}
|
|
2573
|
-
isTimeMode() {
|
|
2574
|
-
return this._viewMode === "time" || this._viewMode === "datetime";
|
|
2575
|
-
}
|
|
2576
|
-
/**
|
|
2577
|
-
* 시간 분 설정 이벤트 처리.
|
|
2578
|
-
*
|
|
2579
|
-
* @public
|
|
2580
|
-
*/
|
|
2581
|
-
initTimeEvent() {
|
|
2582
|
-
if (!this.isTimeMode())
|
|
2583
|
-
return;
|
|
2584
|
-
let hh = this.currentDate.format("HH");
|
|
2585
|
-
const hourInputEle = this.datetimeElement.querySelector(".ddtp-hour");
|
|
2586
|
-
const hourRangeEle = this.datetimeElement.querySelector(".ddtp-hour-range");
|
|
2587
|
-
hourInputEle.value = hh;
|
|
2588
|
-
hourRangeEle.value = hh;
|
|
2589
|
-
hourInputEle.addEventListener("input", (e) => {
|
|
2590
|
-
const targetElement = e.target;
|
|
2591
|
-
const addVal = utils_default.pad(targetElement.value, 2);
|
|
2592
|
-
hourInputEle.value = addVal;
|
|
2593
|
-
hourRangeEle.value = addVal;
|
|
2594
|
-
});
|
|
2595
|
-
hourRangeEle.addEventListener("input", (e) => {
|
|
2596
|
-
const targetElement = e.target;
|
|
2597
|
-
hourInputEle.value = utils_default.pad(targetElement.value, 2);
|
|
2598
|
-
});
|
|
2599
|
-
let mm = this.currentDate.format("mm");
|
|
2600
|
-
const minuteInputEle = this.datetimeElement.querySelector(".ddtp-minute");
|
|
2601
|
-
const minuteRangeEle = this.datetimeElement.querySelector(".ddtp-minute-range");
|
|
2602
|
-
minuteInputEle.value = mm;
|
|
2603
|
-
minuteRangeEle.value = mm;
|
|
2604
|
-
minuteInputEle.addEventListener("input", (e) => {
|
|
2605
|
-
const targetElement = e.target;
|
|
2606
|
-
const addVal = utils_default.pad(targetElement.value, 2);
|
|
2607
|
-
minuteInputEle.value = addVal;
|
|
2608
|
-
minuteRangeEle.value = addVal;
|
|
2609
|
-
});
|
|
2610
|
-
minuteRangeEle.addEventListener("input", (e) => {
|
|
2611
|
-
const targetElement = e.target;
|
|
2612
|
-
minuteInputEle.value = utils_default.pad(targetElement.value, 2);
|
|
2613
|
-
});
|
|
2614
|
-
this.datetimeElement.querySelector(".time-select")?.addEventListener("click", (e) => {
|
|
2615
|
-
this.currentDate.setHour(+hourInputEle.value);
|
|
2616
|
-
this.currentDate.setMinutes(+minuteInputEle.value);
|
|
2617
|
-
this.dateChangeEvent(e);
|
|
2618
|
-
});
|
|
2619
|
-
}
|
|
2620
|
-
/**
|
|
2621
|
-
* 날짜 이동
|
|
2622
|
-
* @param moveMode // 앞뒤 이동 prev, next
|
|
2623
|
-
* @returns
|
|
2624
|
-
*/
|
|
2625
|
-
moveDate(moveMode, e) {
|
|
2626
|
-
if (this._viewMode === "date" || this._viewMode === "datetime") {
|
|
2627
|
-
this.currentDate.setDate(1);
|
|
2628
|
-
this.currentDate.addMonth("prev" === moveMode ? -1 : 1);
|
|
2629
|
-
this.dayDraw();
|
|
2630
|
-
return;
|
|
2631
|
-
}
|
|
2632
|
-
if (this._viewMode === "month") {
|
|
2633
|
-
this.currentDate.setDate(1);
|
|
2634
|
-
this.currentDate.addYear("prev" === moveMode ? -1 : 1);
|
|
2635
|
-
this.monthDraw();
|
|
2636
|
-
return;
|
|
2637
|
-
}
|
|
2638
|
-
if (this._viewMode === "year") {
|
|
2639
|
-
this.currentDate.setDate(1);
|
|
2640
|
-
this.currentDate.addYear("prev" === moveMode ? -16 : 16);
|
|
2641
|
-
this.yearDraw();
|
|
2642
|
-
}
|
|
2643
|
-
}
|
|
2644
|
-
/**
|
|
2645
|
-
* get date value
|
|
2646
|
-
*
|
|
2647
|
-
* @returns
|
|
2648
|
-
*/
|
|
2649
|
-
getDateValue() {
|
|
2650
|
-
return this.currentDate.format(this.dateFormat);
|
|
2651
|
-
}
|
|
2652
|
-
/**
|
|
2653
|
-
* 옵션 셋팅
|
|
2654
|
-
* @static
|
|
2655
|
-
* @param {DateTimePickerOptions} options
|
|
2656
|
-
*/
|
|
2657
|
-
static setOptions(options) {
|
|
2658
|
-
DEFAULT_OPTIONS = Object.assign({}, DEFAULT_OPTIONS, options);
|
|
2659
|
-
}
|
|
2660
|
-
/**
|
|
2661
|
-
* 달력 보이기 처리.
|
|
2662
|
-
*
|
|
2663
|
-
* @returns
|
|
2664
|
-
*/
|
|
2665
|
-
show() {
|
|
2666
|
-
if (this.isVisible) {
|
|
2667
|
-
return;
|
|
2668
|
-
}
|
|
2669
|
-
this.isVisible = true;
|
|
2670
|
-
const docSize = getDocSize();
|
|
2671
|
-
this.datetimeElement.classList.remove("hide");
|
|
2672
|
-
this.datetimeElement.classList.add("show");
|
|
2673
|
-
const rect = this.targetElement.getBoundingClientRect();
|
|
2674
|
-
const scrollTop = window.scrollY || document.documentElement.scrollTop;
|
|
2675
|
-
const scrollLeft = window.scrollX || document.documentElement.scrollLeft;
|
|
2676
|
-
const elementHeight = this.datetimeElement.offsetHeight;
|
|
2677
|
-
const targetElementHeight = this.targetElement.offsetHeight + 2;
|
|
2678
|
-
let left = rect.left + scrollLeft;
|
|
2679
|
-
let top = 0;
|
|
2680
|
-
if (this.options.isPositionFixed) {
|
|
2681
|
-
top = rect.top + targetElementHeight;
|
|
2682
|
-
left = rect.left;
|
|
2683
|
-
} else {
|
|
2684
|
-
if (rect.top + targetElementHeight + elementHeight > docSize.clientHeight && rect.top >= elementHeight) {
|
|
2685
|
-
top = scrollTop + rect.top - elementHeight - 2;
|
|
2686
|
-
} else {
|
|
2687
|
-
top = scrollTop + rect.top + targetElementHeight;
|
|
2688
|
-
}
|
|
2689
|
-
}
|
|
2690
|
-
this.datetimeElement.setAttribute("style", `${this.options.isPositionFixed ? "position:fixed;" : ""}top:${top}px;left:${left}px;z-index:${this.options.zIndex}`);
|
|
2691
|
-
document.addEventListener("click", this._documentClickEvent);
|
|
2692
|
-
}
|
|
2693
|
-
/**
|
|
2694
|
-
* 달력 숨기기
|
|
2695
|
-
*/
|
|
2696
|
-
hide() {
|
|
2697
|
-
this.isVisible = false;
|
|
2698
|
-
if (this.options.onClose) {
|
|
2699
|
-
if (this.options.onClose() === false) {
|
|
2700
|
-
return;
|
|
2701
|
-
}
|
|
2702
|
-
}
|
|
2703
|
-
this.datetimeElement.classList.remove("show");
|
|
2704
|
-
this.datetimeElement.classList.add("hide");
|
|
2705
|
-
document.removeEventListener("click", this._documentClickEvent);
|
|
2706
|
-
}
|
|
2707
|
-
/**
|
|
2708
|
-
* 타켓 이벤트 처리.
|
|
2709
|
-
*/
|
|
2710
|
-
initTargetEvent() {
|
|
2711
|
-
if (this.targetElement) {
|
|
2712
|
-
this.targetElement.addEventListener("click", (e) => {
|
|
2713
|
-
this.show();
|
|
2714
|
-
});
|
|
2715
|
-
}
|
|
2716
|
-
}
|
|
2717
|
-
/**
|
|
2718
|
-
* 날짜 변경후 이벤트
|
|
2719
|
-
*/
|
|
2720
|
-
afterChangeDatepicker() {
|
|
2721
|
-
const formatValue = this.currentDate.format(this.dateFormat);
|
|
2722
|
-
if (this.options.afterChangeDatepicker && utils_default.isFunction(this.options.afterChangeDatepicker)) {
|
|
2723
|
-
this.options.afterChangeDatepicker(formatValue, this.viewMode);
|
|
2724
|
-
}
|
|
2725
|
-
}
|
|
2726
|
-
/**
|
|
2727
|
-
* 날짜 변경 전 이벤트.
|
|
2728
|
-
* @returns void
|
|
2729
|
-
*/
|
|
2730
|
-
beforeChangeDatepicker() {
|
|
2731
|
-
const formatValue = this.currentDate.format(this.dateFormat);
|
|
2732
|
-
if (this.options.beforeChangeDatepicker && utils_default.isFunction(this.options.beforeChangeDatepicker)) {
|
|
2733
|
-
const reval = this.options.beforeChangeDatepicker(formatValue, (result) => {
|
|
2734
|
-
if (result === false) {
|
|
2735
|
-
return;
|
|
2736
|
-
}
|
|
2737
|
-
this.refresh(false);
|
|
2738
|
-
});
|
|
2739
|
-
if (reval === false) {
|
|
2740
|
-
return;
|
|
2741
|
-
}
|
|
2742
|
-
this.refresh(false);
|
|
2743
|
-
return;
|
|
2744
|
-
}
|
|
2745
|
-
this.refresh(false);
|
|
2746
|
-
}
|
|
2747
|
-
dateChangeEvent(e) {
|
|
2748
|
-
const formatValue = this.currentDate.format(this.dateFormat);
|
|
2749
|
-
if (this.options.onSelect) {
|
|
2750
|
-
if (this.options.onSelect(formatValue, this.viewMode, e) === false) {
|
|
2751
|
-
return;
|
|
2752
|
-
}
|
|
2753
|
-
}
|
|
2754
|
-
if (this.isInput) {
|
|
2755
|
-
this.targetElement.setAttribute("value", formatValue);
|
|
2756
|
-
}
|
|
2757
|
-
if (!this.options.inline && this.options.autoClose) {
|
|
2758
|
-
this.hide();
|
|
2759
|
-
}
|
|
2760
|
-
}
|
|
2761
|
-
/**
|
|
2762
|
-
* datepicker template 그리기
|
|
2763
|
-
*/
|
|
2764
|
-
createDatetimeTemplate() {
|
|
2765
|
-
const showMonthAfterYear = this.options.showMonthAfterYear;
|
|
2766
|
-
let datetimeTemplate = `<div class="ddtp-datetime ${this.options.isRTL ? "rtl" : ""}" view-mode="${this._viewMode}">
|
|
2767
|
-
<div class="ddtp-header">
|
|
2768
|
-
<span class="${showMonthAfterYear ? "ddtp-header-year" : "ddtp-header-month"}"></span>
|
|
2769
|
-
<span class="${showMonthAfterYear ? "ddtp-header-month" : "ddtp-header-year"}"></span>
|
|
2770
|
-
|
|
2771
|
-
<span class="ddtp-date-move">
|
|
2772
|
-
<a href="javascript:;" class="ddtp-move-btn prev">
|
|
2773
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>
|
|
2774
|
-
</a>
|
|
2775
|
-
<a href="javascript:;" class="ddtp-move-btn next">
|
|
2776
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
|
|
2777
|
-
</a>
|
|
2778
|
-
</span>
|
|
2779
|
-
</div>
|
|
2780
|
-
<div class="ddtp-body">
|
|
2781
|
-
<table class="ddtp-days">
|
|
2782
|
-
<thead class="ddtp-day-header">
|
|
2783
|
-
<tr>
|
|
2784
|
-
<td class="ddtp-day-label ${DAY_STYLE_CLASS[this.dayOrder[0]]}">${Lanauage_default2.getWeeksMessage(this.dayOrder[0])}</td>
|
|
2785
|
-
<td class="ddtp-day-label ${DAY_STYLE_CLASS[this.dayOrder[1]]}">${Lanauage_default2.getWeeksMessage(this.dayOrder[1])}</td>
|
|
2786
|
-
<td class="ddtp-day-label ${DAY_STYLE_CLASS[this.dayOrder[2]]}">${Lanauage_default2.getWeeksMessage(this.dayOrder[2])}</td>
|
|
2787
|
-
<td class="ddtp-day-label ${DAY_STYLE_CLASS[this.dayOrder[3]]}">${Lanauage_default2.getWeeksMessage(this.dayOrder[3])}</td>
|
|
2788
|
-
<td class="ddtp-day-label ${DAY_STYLE_CLASS[this.dayOrder[4]]}">${Lanauage_default2.getWeeksMessage(this.dayOrder[4])}</td>
|
|
2789
|
-
<td class="ddtp-day-label ${DAY_STYLE_CLASS[this.dayOrder[5]]}">${Lanauage_default2.getWeeksMessage(this.dayOrder[5])}</td>
|
|
2790
|
-
<td class="ddtp-day-label ${DAY_STYLE_CLASS[this.dayOrder[6]]}">${Lanauage_default2.getWeeksMessage(this.dayOrder[6])}</td>
|
|
2791
|
-
</tr>
|
|
2792
|
-
</thead>
|
|
2793
|
-
<tbody class="ddtp-day-body">
|
|
2794
|
-
</tbody>
|
|
2795
|
-
|
|
2796
|
-
<tfoot class="ddtp-day-footer">
|
|
2797
|
-
<td colspan="7">
|
|
2798
|
-
<div style="text-align:center;margin-top: 5px;${this.options.enableTodayBtn ? "" : "display:none;"}"><button type="button" class="time-today">${Lanauage_default2.getMessage("today")}</button></div>
|
|
2799
|
-
<div class="footer-tooltip"></div>
|
|
2800
|
-
</td>
|
|
2801
|
-
</tfoot>
|
|
2802
|
-
</table>
|
|
2803
|
-
|
|
2804
|
-
<div class="ddtp-times">
|
|
2805
|
-
<div class="time-container">
|
|
2806
|
-
<div class="ddtp-time">
|
|
2807
|
-
<span>H: </span><input type="number" class="ddtp-hour" min="0" max="23">
|
|
2808
|
-
<input type="range" min="0" max="23" class="ddtp-hour-range">
|
|
2809
|
-
</div>
|
|
2810
|
-
<div class="ddtp-time">
|
|
2811
|
-
<span>M: </span><input type="number" class="ddtp-minute" min="0" max="59">
|
|
2812
|
-
<input type="range" min="0" max="59" class="ddtp-minute-range">
|
|
2813
|
-
</div>
|
|
2814
|
-
</div>
|
|
2815
|
-
<div class="time-btn">
|
|
2816
|
-
<button type="button" class="time-select">${Lanauage_default2.getMessage("ok")}</button>
|
|
2817
|
-
</div>
|
|
2818
|
-
</div>
|
|
2819
|
-
|
|
2820
|
-
<div class="ddtp-months">
|
|
2821
|
-
</div>
|
|
2822
|
-
|
|
2823
|
-
<div class="ddtp-years">
|
|
2824
|
-
</div>
|
|
2825
|
-
</div>
|
|
2826
|
-
</div>`;
|
|
2827
|
-
this.datetimeElement.innerHTML = datetimeTemplate;
|
|
2828
|
-
}
|
|
2829
|
-
refresh(beforeChangeDatepickerCheck) {
|
|
2830
|
-
if (this._viewMode === "date" || this._viewMode === "datetime") {
|
|
2831
|
-
this.dayDraw(beforeChangeDatepickerCheck);
|
|
2832
|
-
return;
|
|
2833
|
-
}
|
|
2834
|
-
if (this._viewMode === "month") {
|
|
2835
|
-
this.monthDraw(beforeChangeDatepickerCheck);
|
|
2836
|
-
return;
|
|
2837
|
-
}
|
|
2838
|
-
if (this._viewMode === "year") {
|
|
2839
|
-
this.yearDraw(beforeChangeDatepickerCheck);
|
|
2840
|
-
}
|
|
2841
|
-
}
|
|
2842
|
-
/**
|
|
2843
|
-
* 년 달력 그리기
|
|
2844
|
-
*/
|
|
2845
|
-
yearDraw(beforeChangeDatepickerCheck) {
|
|
2846
|
-
const currentYear = this.currentDate.format("YYYY");
|
|
2847
|
-
if (beforeChangeDatepickerCheck !== false && this.initMode == "year") {
|
|
2848
|
-
this.beforeChangeDatepicker();
|
|
2849
|
-
return;
|
|
2850
|
-
}
|
|
2851
|
-
const startYear = +currentYear - 8;
|
|
2852
|
-
this.datetimeElement.querySelector(".ddtp-header-year").textContent = `${startYear} ~ ${startYear + 15}`;
|
|
2853
|
-
const beforeDrawDateFlag = utils_default.isFunction(this.options.beforeDrawDate);
|
|
2854
|
-
const beforeDrawDateFn = beforeDrawDateFlag ? this.options.beforeDrawDate : false;
|
|
2855
|
-
const calHTML = [];
|
|
2856
|
-
for (let i = 0; i < 16; i++) {
|
|
2857
|
-
const year = startYear + i;
|
|
2858
|
-
const disabled = this.isYearDisabled(year);
|
|
2859
|
-
let addStylceClass = disabled ? " disabled" : "";
|
|
2860
|
-
let tooltip = "";
|
|
2861
|
-
if (beforeDrawDateFlag && beforeDrawDateFn) {
|
|
2862
|
-
const reval = beforeDrawDateFn({ mode: this._viewMode, date: year });
|
|
2863
|
-
addStylceClass += reval.style ? " " + reval.style : "";
|
|
2864
|
-
tooltip = reval.tooltip;
|
|
2865
|
-
tooltip = tooltip ? `title="${tooltip}"` : "";
|
|
2866
|
-
}
|
|
2867
|
-
calHTML.push(`<div class="ddtp-year ${addStylceClass}" data-year="${year}" ${tooltip}>${year}</div>`);
|
|
2868
|
-
}
|
|
2869
|
-
this.datetimeElement.querySelector(".ddtp-years").innerHTML = calHTML.join("");
|
|
2870
|
-
if (this.initMode == "year") {
|
|
2871
|
-
this.afterChangeDatepicker();
|
|
2872
|
-
}
|
|
2873
|
-
this.datetimeElement.querySelectorAll(".ddtp-year")?.forEach((yearEle) => {
|
|
2874
|
-
yearEle.addEventListener("click", (e) => {
|
|
2875
|
-
const targetEle = e.target;
|
|
2876
|
-
if (targetEle) {
|
|
2877
|
-
const year = targetEle.getAttribute("data-year");
|
|
2878
|
-
if (year) {
|
|
2879
|
-
const numYear = +year;
|
|
2880
|
-
if (this.isYearDisabled(numYear)) {
|
|
2881
|
-
return;
|
|
2882
|
-
}
|
|
2883
|
-
if (this.initMode == "year") {
|
|
2884
|
-
if (this.isYearDisabled(numYear)) {
|
|
2885
|
-
return;
|
|
2886
|
-
}
|
|
2887
|
-
this.currentDate.setYear(numYear);
|
|
2888
|
-
this.dateChangeEvent(e);
|
|
2889
|
-
return;
|
|
2890
|
-
}
|
|
2891
|
-
this.currentDate.setYear(numYear);
|
|
2892
|
-
this.viewMode = this.initMode;
|
|
2893
|
-
}
|
|
2894
|
-
}
|
|
2895
|
-
});
|
|
2896
|
-
});
|
|
2897
|
-
}
|
|
2898
|
-
/**
|
|
2899
|
-
* 월 달력 그리기
|
|
2900
|
-
*/
|
|
2901
|
-
monthDraw(beforeChangeDatepickerCheck) {
|
|
2902
|
-
if (beforeChangeDatepickerCheck !== false && this.initMode == "month") {
|
|
2903
|
-
this.beforeChangeDatepicker();
|
|
2904
|
-
return;
|
|
2905
|
-
}
|
|
2906
|
-
const year = this.currentDate.format("YYYY");
|
|
2907
|
-
this.datetimeElement.querySelector(".ddtp-header-year").textContent = `${year}`;
|
|
2908
|
-
const monthElements = this.datetimeElement.querySelectorAll(".ddtp-months > .ddtp-month");
|
|
2909
|
-
if (monthElements.length > 0) {
|
|
2910
|
-
if (this.isYearDisabled(+year)) {
|
|
2911
|
-
monthElements.forEach((monthEle) => {
|
|
2912
|
-
if (!monthEle.classList.contains("disabled")) {
|
|
2913
|
-
monthEle.classList.add("disabled");
|
|
2914
|
-
}
|
|
2915
|
-
});
|
|
2916
|
-
return;
|
|
2917
|
-
}
|
|
2918
|
-
monthElements.forEach((monthEle, idx) => {
|
|
2919
|
-
if (this.isMonthDisabled(+year, idx)) {
|
|
2920
|
-
if (!monthEle.classList.contains("disabled")) {
|
|
2921
|
-
monthEle.classList.add("disabled");
|
|
2922
|
-
}
|
|
2923
|
-
} else {
|
|
2924
|
-
monthEle.classList.remove("disabled");
|
|
2925
|
-
}
|
|
2926
|
-
});
|
|
2927
|
-
if (this.initMode == "month") {
|
|
2928
|
-
this.afterChangeDatepicker();
|
|
2929
|
-
}
|
|
2930
|
-
return;
|
|
2931
|
-
}
|
|
2932
|
-
this.datetimeElement.querySelector(".ddtp-header-month").textContent = this.currentDate.format("MMMM");
|
|
2933
|
-
const beforeDrawDateFlag = utils_default.isFunction(this.options.beforeDrawDate);
|
|
2934
|
-
const beforeDrawDateFn = beforeDrawDateFlag ? this.options.beforeDrawDate : false;
|
|
2935
|
-
const calHTML = [];
|
|
2936
|
-
for (let i = 0; i < 12; i++) {
|
|
2937
|
-
const disabled = this.isMonthDisabled(+year, i);
|
|
2938
|
-
let addStylceClass = disabled ? " disabled" : "";
|
|
2939
|
-
let tooltip = "";
|
|
2940
|
-
if (beforeDrawDateFlag && beforeDrawDateFn) {
|
|
2941
|
-
const reval = beforeDrawDateFn({ mode: this._viewMode, date: year + "/" + (i + 1) });
|
|
2942
|
-
addStylceClass += reval.style ? " " + reval.style : "";
|
|
2943
|
-
tooltip = reval.tooltip;
|
|
2944
|
-
tooltip = tooltip ? `title="${tooltip}"` : "";
|
|
2945
|
-
}
|
|
2946
|
-
calHTML.push(`<div class="ddtp-month ${addStylceClass}" data-month="${i}" ${tooltip}>${Lanauage_default2.getMonthsMessage(i, "abbr")}</div>`);
|
|
2947
|
-
}
|
|
2948
|
-
this.datetimeElement.querySelector(".ddtp-months").innerHTML = calHTML.join("");
|
|
2949
|
-
if (this.initMode == "month") {
|
|
2950
|
-
this.afterChangeDatepicker();
|
|
2951
|
-
}
|
|
2952
|
-
this.datetimeElement.querySelectorAll(".ddtp-month")?.forEach((monthEle) => {
|
|
2953
|
-
monthEle.addEventListener("click", (e) => {
|
|
2954
|
-
const targetEle = e.target;
|
|
2955
|
-
if (targetEle) {
|
|
2956
|
-
const month = targetEle.getAttribute("data-month");
|
|
2957
|
-
if (month) {
|
|
2958
|
-
if (this.isMonthDisabled(this.currentDate.getYear(), +month)) {
|
|
2959
|
-
return false;
|
|
2960
|
-
}
|
|
2961
|
-
if (this.initMode == "month") {
|
|
2962
|
-
this.currentDate.setMonth(+month);
|
|
2963
|
-
this.dateChangeEvent(e);
|
|
2964
|
-
return;
|
|
2965
|
-
}
|
|
2966
|
-
this.currentDate.setMonth(+month);
|
|
2967
|
-
this.viewMode = this.initMode;
|
|
2968
|
-
this.dayDraw();
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
});
|
|
2972
|
-
});
|
|
2973
|
-
}
|
|
2974
|
-
/**
|
|
2975
|
-
* 날짜 그리기
|
|
2976
|
-
*/
|
|
2977
|
-
dayDraw(beforeChangeDatepickerCheck) {
|
|
2978
|
-
if (beforeChangeDatepickerCheck !== false && (this.initMode == "date" || this.initMode == "datetime")) {
|
|
2979
|
-
this.beforeChangeDatepicker();
|
|
2980
|
-
return;
|
|
2981
|
-
}
|
|
2982
|
-
let monthFirstDate = this.currentDate.clone();
|
|
2983
|
-
const currentMonth = monthFirstDate.getMonth();
|
|
2984
|
-
monthFirstDate.setDate(1);
|
|
2985
|
-
this.datetimeElement.querySelector(".ddtp-header-year").textContent = monthFirstDate.format("YYYY");
|
|
2986
|
-
this.datetimeElement.querySelector(".ddtp-header-month").textContent = monthFirstDate.format("MMMM");
|
|
2987
|
-
let day = monthFirstDate.getDay();
|
|
2988
|
-
day = day - this.dayOrder[0];
|
|
2989
|
-
if (day >= 0) {
|
|
2990
|
-
monthFirstDate.addDate(-day);
|
|
2991
|
-
} else {
|
|
2992
|
-
monthFirstDate.addDate(-(7 + day));
|
|
2993
|
-
}
|
|
2994
|
-
const beforeDrawDateFlag = utils_default.isFunction(this.options.beforeDrawDate);
|
|
2995
|
-
const beforeDrawDateFn = beforeDrawDateFlag ? this.options.beforeDrawDate : false;
|
|
2996
|
-
const calHTML = [];
|
|
2997
|
-
for (let i = 0; i < 42; i++) {
|
|
2998
|
-
let dateItem;
|
|
2999
|
-
if (i == 0) {
|
|
3000
|
-
dateItem = monthFirstDate;
|
|
3001
|
-
} else {
|
|
3002
|
-
dateItem = monthFirstDate.clone().addDate(i);
|
|
3003
|
-
}
|
|
3004
|
-
const dateItemFormat = dateItem.format(DEFAULT_FORMAT.date);
|
|
3005
|
-
if (i % 7 == 0) {
|
|
3006
|
-
calHTML.push((i == 0 ? "" : "</tr>") + "<tr>");
|
|
3007
|
-
}
|
|
3008
|
-
let disabled = this.isDayDisabled(dateItem);
|
|
3009
|
-
let addStylceClass = DAY_STYLE_CLASS[this.dayOrder[i % 7]];
|
|
3010
|
-
const dateItemMonth = dateItem.getMonth();
|
|
3011
|
-
if (dateItemMonth != currentMonth) {
|
|
3012
|
-
if (dateItemMonth < currentMonth) {
|
|
3013
|
-
addStylceClass += dateItemMonth == 1 ? " new" : " old";
|
|
3014
|
-
} else {
|
|
3015
|
-
addStylceClass += currentMonth == 1 && dateItemMonth == 12 ? " old" : " new";
|
|
3016
|
-
}
|
|
3017
|
-
}
|
|
3018
|
-
addStylceClass += this.todayDate == dateItemFormat ? " today" : "";
|
|
3019
|
-
addStylceClass += disabled ? " disabled" : "";
|
|
3020
|
-
let tooltip = "";
|
|
3021
|
-
if (beforeDrawDateFlag && beforeDrawDateFn) {
|
|
3022
|
-
const reval = beforeDrawDateFn({ mode: this._viewMode, item: dateItem, date: dateItem.format(this.dateFormat) });
|
|
3023
|
-
addStylceClass += reval.style ? " " + reval.style : "";
|
|
3024
|
-
addStylceClass += reval.check ? " event" : "";
|
|
3025
|
-
tooltip = reval.tooltip;
|
|
3026
|
-
tooltip = tooltip ? `title="${tooltip}"` : "";
|
|
3027
|
-
}
|
|
3028
|
-
calHTML.push(`<td class="ddtp-day ${addStylceClass}" data-day="${dateItem.format("M,D")}" ${tooltip}>`);
|
|
3029
|
-
calHTML.push(`<span>${dateItem.format("d")}</span>`);
|
|
3030
|
-
calHTML.push("</td>");
|
|
3031
|
-
}
|
|
3032
|
-
calHTML.push("</tr>");
|
|
3033
|
-
this.datetimeElement.querySelector(".ddtp-day-body").innerHTML = calHTML.join("");
|
|
3034
|
-
if (this.initMode == "date" || this.initMode == "datetime") {
|
|
3035
|
-
this.afterChangeDatepicker();
|
|
3036
|
-
}
|
|
3037
|
-
}
|
|
3038
|
-
isDayDisabled(dateItem) {
|
|
3039
|
-
if (this.minDate != -1 && this.minDate > dateItem.getTime() || this.maxDate != -1 && this.maxDate < dateItem.getTime()) {
|
|
3040
|
-
return true;
|
|
3041
|
-
}
|
|
3042
|
-
return false;
|
|
3043
|
-
}
|
|
3044
|
-
isYearDisabled(year) {
|
|
3045
|
-
if (this.minYear != -1 && this.minYear > year || this.maxYear != -1 && this.maxYear < year) {
|
|
3046
|
-
return true;
|
|
3047
|
-
}
|
|
3048
|
-
return false;
|
|
3049
|
-
}
|
|
3050
|
-
isMonthDisabled(year, month) {
|
|
3051
|
-
if (this.isYearDisabled(year)) {
|
|
3052
|
-
return true;
|
|
3053
|
-
}
|
|
3054
|
-
let yearMonth = +(year + utils_default.pad(month, 2));
|
|
3055
|
-
if (this.minMonth != -1 && this.minMonth > yearMonth || this.maxMonth != -1 && this.maxMonth < yearMonth) {
|
|
3056
|
-
return true;
|
|
3057
|
-
}
|
|
3058
|
-
return false;
|
|
3059
|
-
}
|
|
3060
|
-
static setMessage(message2) {
|
|
3061
|
-
Lanauage_default2.setDefaultMessage(message2);
|
|
3062
|
-
}
|
|
3063
|
-
};
|
|
3064
|
-
}
|
|
3065
|
-
});
|
|
3066
|
-
var init_daracl_datetimepicker = __esm({
|
|
3067
|
-
"style/daracl.datetimepicker.scss"() {
|
|
3068
|
-
}
|
|
3069
|
-
});
|
|
3070
|
-
var require_src = __commonJS({
|
|
3071
|
-
"src/index.ts"(exports2, module2) {
|
|
3072
|
-
init_DateTimePicker();
|
|
3073
|
-
init_daracl_datetimepicker();
|
|
3074
|
-
module2.exports = DateTimePicker;
|
|
3075
|
-
}
|
|
3076
|
-
});
|
|
3077
|
-
var dist_default = require_src();
|
|
3078
|
-
|
|
3079
1657
|
// src/renderer/DateRender.ts
|
|
1658
|
+
var import_datetimepicker = __toESM(require("@daracl/datetimepicker"));
|
|
3080
1659
|
var DateRender = class extends Render {
|
|
3081
1660
|
constructor(field, rowElement, daraForm) {
|
|
3082
1661
|
super(daraForm, field, rowElement);
|
|
@@ -3104,7 +1683,7 @@ var DateRender = class extends Render {
|
|
|
3104
1683
|
this.setValue(dt);
|
|
3105
1684
|
this.valid();
|
|
3106
1685
|
};
|
|
3107
|
-
this.dateObj = new
|
|
1686
|
+
this.dateObj = new import_datetimepicker.default(this.element, this.field.customOptions, {});
|
|
3108
1687
|
}
|
|
3109
1688
|
// async loadDate() {
|
|
3110
1689
|
// const DateTimePicker = await import("@daracl/datetimepicker");
|
|
@@ -3669,7 +2248,7 @@ FIELD_POSITION_STYLE["left"] = FIELD_POSITION_STYLE["left-left"];
|
|
|
3669
2248
|
FIELD_POSITION_STYLE["bottom"] = FIELD_POSITION_STYLE["bottom-left"];
|
|
3670
2249
|
|
|
3671
2250
|
// src/util/Lanauage.ts
|
|
3672
|
-
var
|
|
2251
|
+
var localeMessage = {
|
|
3673
2252
|
required: "{label} \uD544\uC218 \uC785\uB825\uC0AC\uD56D\uC785\uB2C8\uB2E4.",
|
|
3674
2253
|
fileButton: "\uD30C\uC77C\uCC3E\uAE30",
|
|
3675
2254
|
selection: "\uC120\uD0DD",
|
|
@@ -3703,9 +2282,9 @@ var localeMessage2 = {
|
|
|
3703
2282
|
"upper-char-special-number": "\uB300\uBB38\uC790,\uC18C\uBB38\uC790,\uD2B9\uC218\uBB38\uC790,\uC22B\uC790 \uAC01\uAC01 \uD558\uB098 \uC774\uC0C1 \uD3EC\uD568 \uB418\uC5B4\uC57C\uD569\uB2C8\uB2E4."
|
|
3704
2283
|
}
|
|
3705
2284
|
};
|
|
3706
|
-
var
|
|
2285
|
+
var Language = class {
|
|
3707
2286
|
constructor() {
|
|
3708
|
-
this.lang =
|
|
2287
|
+
this.lang = localeMessage;
|
|
3709
2288
|
}
|
|
3710
2289
|
/**
|
|
3711
2290
|
* 다국어 메시지 등록
|
|
@@ -3714,7 +2293,7 @@ var Language2 = class {
|
|
|
3714
2293
|
* @param {?Message} [lang] 둥록할 메시지
|
|
3715
2294
|
*/
|
|
3716
2295
|
set(lang) {
|
|
3717
|
-
this.lang = Object.assign({},
|
|
2296
|
+
this.lang = Object.assign({}, localeMessage, lang);
|
|
3718
2297
|
}
|
|
3719
2298
|
/**
|
|
3720
2299
|
* 메시지 얻기
|
|
@@ -3772,7 +2351,7 @@ function message(msgFormat, msgParam) {
|
|
|
3772
2351
|
return typeof msgParam[key] !== "undefined" ? msgParam[key] : match;
|
|
3773
2352
|
});
|
|
3774
2353
|
}
|
|
3775
|
-
var Lanauage_default = new
|
|
2354
|
+
var Lanauage_default = new Language();
|
|
3776
2355
|
|
|
3777
2356
|
// src/util/renderFactory.ts
|
|
3778
2357
|
var getRenderer = (field) => {
|