smoothly 0.1.87 → 0.1.88

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.
Files changed (36) hide show
  1. package/dist/cjs/{index-328edd81.js → index-bc3845e8.js} +253 -182
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/smoothly-accordion_47.cjs.entry.js +291 -198
  4. package/dist/cjs/smoothly-calendar.cjs.entry.js +38 -10
  5. package/dist/cjs/smoothly-display.cjs.entry.js +1 -1
  6. package/dist/cjs/smoothly-input-date-range.cjs.entry.js +8 -9
  7. package/dist/cjs/smoothly-input-date.cjs.entry.js +4 -0
  8. package/dist/cjs/smoothly-input.cjs.entry.js +1 -1
  9. package/dist/cjs/smoothly.cjs.js +1 -1
  10. package/dist/collection/components/calendar/index.js +80 -11
  11. package/dist/collection/components/input-date/index.js +12 -1
  12. package/dist/collection/components/input-date-range/index.js +14 -15
  13. package/dist/custom-elements/index.js +312 -210
  14. package/dist/esm/{index-1be6d668.js → index-37a67c97.js} +253 -182
  15. package/dist/esm/loader.js +1 -1
  16. package/dist/esm/smoothly-accordion_47.entry.js +291 -198
  17. package/dist/esm/smoothly-calendar.entry.js +38 -10
  18. package/dist/esm/smoothly-display.entry.js +1 -1
  19. package/dist/esm/smoothly-input-date-range.entry.js +8 -9
  20. package/dist/esm/smoothly-input-date.entry.js +4 -0
  21. package/dist/esm/smoothly-input.entry.js +1 -1
  22. package/dist/esm/smoothly.js +1 -1
  23. package/dist/smoothly/{index-1be6d668.js → index-37a67c97.js} +253 -182
  24. package/dist/smoothly/p-0286085b.entry.js +1 -0
  25. package/dist/smoothly/smoothly-calendar.entry.js +38 -10
  26. package/dist/smoothly/smoothly-display.entry.js +1 -1
  27. package/dist/smoothly/smoothly-input-date-range.entry.js +8 -9
  28. package/dist/smoothly/smoothly-input-date.entry.js +4 -0
  29. package/dist/smoothly/smoothly-input.entry.js +1 -1
  30. package/dist/smoothly/smoothly.esm.js +1 -1
  31. package/dist/types/components/calendar/index.d.ts +6 -1
  32. package/dist/types/components/input-date/index.d.ts +1 -0
  33. package/dist/types/components/input-date-range/index.d.ts +2 -2
  34. package/dist/types/components.d.ts +3 -1
  35. package/package.json +2 -2
  36. package/dist/smoothly/p-7b43df84.entry.js +0 -1
@@ -18835,6 +18835,8 @@ let Calendar = class {
18835
18835
  this.valueChanged = index.createEvent(this, "valueChanged", 7);
18836
18836
  this.startChanged = index.createEvent(this, "startChanged", 7);
18837
18837
  this.endChanged = index.createEvent(this, "endChanged", 7);
18838
+ this.dateSet = index.createEvent(this, "dateSet", 7);
18839
+ this.dateRangeSet = index.createEvent(this, "dateRangeSet", 7);
18838
18840
  this.value = dist$3.Date.now();
18839
18841
  this.clickCounter = 0;
18840
18842
  }
@@ -18847,13 +18849,33 @@ let Calendar = class {
18847
18849
  onClick(date) {
18848
18850
  this.valueChanged.emit((this.value = date));
18849
18851
  this.clickCounter += 1;
18850
- if (this.clickCounter % 2 == 1)
18851
- this.start = this.end = date;
18852
- else {
18853
- if (this.start && date > this.start)
18854
- this.end = date;
18855
- else
18852
+ if (this.doubleInput) {
18853
+ if (this.clickCounter % 2 == 1)
18854
+ this.start = this.end = this.frozenDate = date;
18855
+ else {
18856
+ if (this.start && date > this.start)
18857
+ this.end = date;
18858
+ else
18859
+ this.start = date;
18860
+ }
18861
+ }
18862
+ !this.doubleInput && this.dateSet.emit(this.value);
18863
+ this.doubleInput &&
18864
+ this.clickCounter % 2 == 0 &&
18865
+ this.start &&
18866
+ this.end &&
18867
+ this.dateRangeSet.emit({ start: this.start, end: this.end });
18868
+ }
18869
+ onHover(date) {
18870
+ if (this.doubleInput && this.clickCounter % 2 == 1) {
18871
+ if (date < this.frozenDate) {
18856
18872
  this.start = date;
18873
+ this.end = this.frozenDate;
18874
+ }
18875
+ else {
18876
+ this.start = this.frozenDate;
18877
+ this.end = date;
18878
+ }
18857
18879
  }
18858
18880
  }
18859
18881
  render() {
@@ -18865,11 +18887,17 @@ let Calendar = class {
18865
18887
  } }),
18866
18888
  index.h("table", null, index.h("thead", null, index.h("tr", null, weekdays().map(day => (index.h("th", null, day))))), month((_b = this.month) !== null && _b !== void 0 ? _b : this.value).map(week => (index.h("tr", null, week.map(date => {
18867
18889
  var _a, _b, _c;
18868
- return (index.h("td", { tabindex: 1, onClick: (this.min || this.max) && (date < this.min || date > this.max) ? undefined : () => this.onClick(date), class: (date == this.value ? ["selected"] : [])
18890
+ return (index.h("td", { tabindex: 1, onMouseOver: () => {
18891
+ !this.doubleInput && (this.min || this.max) && (date < this.min || date > this.max)
18892
+ ? undefined
18893
+ : this.onHover(date);
18894
+ }, onClick: (this.min || this.max) && (date < this.min || date > this.max) ? undefined : () => this.onClick(date), class: (date == this.value ? ["selected"] : [])
18869
18895
  .concat(...(date == dist$3.Date.now() ? ["today"] : []), dist$3.Date.firstOfMonth((_a = this.month) !== null && _a !== void 0 ? _a : this.value) == dist$3.Date.firstOfMonth(date) ? ["currentMonth"] : [], this.doubleInput
18870
- ? date >= ((_b = this.start) !== null && _b !== void 0 ? _b : "") && date <= ((_c = this.end) !== null && _c !== void 0 ? _c : "")
18871
- ? ["dateRange"]
18872
- : []
18896
+ ? this.start == date || this.end == date
18897
+ ? ["selected"]
18898
+ : date >= ((_b = this.start) !== null && _b !== void 0 ? _b : "") && date <= ((_c = this.end) !== null && _c !== void 0 ? _c : "")
18899
+ ? ["dateRange"]
18900
+ : []
18873
18901
  : "")
18874
18902
  .concat(...(this.min || this.max ? (date < this.min || date > this.max ? ["disable"] : []) : ""))
18875
18903
  .join(" ") }, date.substring(8, 10)));
@@ -37837,17 +37865,31 @@ exports.DateFormat = void 0;
37837
37865
  function fromLocale(locale) {
37838
37866
  let result;
37839
37867
  switch (locale) {
37868
+ case "sq-AL":
37869
+ case "es-AR":
37870
+ case "it-IT":
37840
37871
  case "en-GB":
37872
+ case "fr-FR":
37841
37873
  result = "dd/mm/YYYY";
37842
37874
  break;
37843
37875
  case "en-US":
37844
37876
  result = "mm/dd/YYYY";
37845
37877
  break;
37878
+ case "et-EE":
37879
+ case "de-AT":
37846
37880
  case "de-DE":
37881
+ case "he-IL":
37882
+ case "is-IS":
37883
+ case "lv-LV":
37847
37884
  case "pl-PL":
37848
37885
  case "ru-RU":
37886
+ case "fi-FI":
37849
37887
  result = "dd.mm.YYYY";
37850
37888
  break;
37889
+ case "hi-IN":
37890
+ case "en-IN":
37891
+ result = "dd-mm-YYYY";
37892
+ break;
37851
37893
  default:
37852
37894
  result = "YYYY-mm-dd";
37853
37895
  break;
@@ -37883,146 +37925,254 @@ exports.DateFormat = void 0;
37883
37925
  //# sourceMappingURL=DateFormat.js.map
37884
37926
  });
37885
37927
 
37886
- var helper = createCommonjsModule(function (module, exports) {
37928
+ var Base_1 = createCommonjsModule(function (module, exports) {
37887
37929
  Object.defineProperty(exports, "__esModule", { value: true });
37888
- exports.validFormat = exports.validSymbol = exports.validYear = exports.validMonth = exports.validDay = void 0;
37889
- function validDay(symbol, state, startIndex, endIndex) {
37890
- let result = false;
37891
- if (state.value.length == startIndex)
37892
- result = symbol <= "3" && symbol >= "0";
37893
- else if (state.value.length == endIndex) {
37894
- if (state.value.substring(startIndex, startIndex + 1) == "2" ||
37895
- state.value.substring(startIndex, startIndex + 1) == "1")
37896
- result = symbol <= "9" && symbol >= "0";
37897
- else if (state.value.substring(startIndex, startIndex + 1) == "0")
37898
- result = symbol <= "9" && symbol >= "1";
37899
- else
37900
- result = symbol == "1" || symbol == "0";
37930
+ exports.register = exports.Base = void 0;
37931
+
37932
+
37933
+
37934
+ class Base {
37935
+ constructor(seperator) {
37936
+ this.seperator = seperator;
37901
37937
  }
37902
- return result;
37903
- }
37904
- exports.validDay = validDay;
37905
- function validMonth(symbol, state, startIndex, endIndex) {
37906
- let result = false;
37907
- if (state.value.length == startIndex)
37908
- result = symbol == "1" || symbol == "0";
37909
- else if (state.value.length == endIndex) {
37910
- if (state.value.substring(startIndex, startIndex + 1) != "1")
37911
- result = symbol <= "9" && symbol >= "1";
37912
- else
37913
- result = symbol < "3" && symbol >= "0";
37938
+ unformat(formated) {
37939
+ return formated.delete(this.seperator);
37940
+ }
37941
+ daysInMonth(value) {
37942
+ var _a;
37943
+ return (32 -
37944
+ Number.parseInt(dist$3.Date.next(((_a = this.fromString(value.padEnd(8, "1"))) !== null && _a !== void 0 ? _a : "1970-01-01").substring(0, 8) + "28", 4).substring(8, 10)));
37945
+ }
37946
+ validMonth(day, month, year) {
37947
+ return (new Date(Number.parseInt(year !== null && year !== void 0 ? year : "2004"), Number.parseInt(month), 0).getDate() >=
37948
+ Number.parseInt(day));
37914
37949
  }
37915
- return result;
37916
- }
37917
- exports.validMonth = validMonth;
37918
- function validYear(symbol, state, startIndex, endIndex) {
37919
- return state.value.length < endIndex && state.value.length >= startIndex && symbol >= "0" && symbol <= "9";
37920
37950
  }
37921
- exports.validYear = validYear;
37922
- function validSymbol(symbol, state, firstSplitter, lastSplitter, character) {
37923
- return (state.value.length == firstSplitter || state.value.length == lastSplitter) && symbol == character;
37951
+ exports.Base = Base;
37952
+ const handlers = {};
37953
+ function register(format, create) {
37954
+ handlers[format] = create;
37924
37955
  }
37925
- exports.validSymbol = validSymbol;
37926
- function validFormat(symbol, state, format) {
37927
- let result;
37928
- switch (format) {
37929
- case "dd/mm/YYYY":
37930
- result =
37931
- validDay(symbol, state, 0, 1) ||
37932
- validSymbol(symbol, state, 2, 5, "/") ||
37933
- validMonth(symbol, state, 3, 4) ||
37934
- validYear(symbol, state, 6, 10);
37935
- break;
37936
- case "dd.mm.YYYY":
37937
- result =
37938
- validDay(symbol, state, 0, 1) ||
37939
- validSymbol(symbol, state, 2, 5, ".") ||
37940
- validMonth(symbol, state, 3, 4) ||
37941
- validYear(symbol, state, 6, 10);
37942
- break;
37943
- case "mm/dd/YYYY":
37944
- result =
37945
- validDay(symbol, state, 3, 4) ||
37946
- validSymbol(symbol, state, 2, 5, "/") ||
37947
- validMonth(symbol, state, 0, 1) ||
37948
- validYear(symbol, state, 6, 10);
37949
- break;
37950
- default:
37951
- result =
37952
- validDay(symbol, state, 8, 9) ||
37953
- validSymbol(symbol, state, 4, 7, "-") ||
37954
- validMonth(symbol, state, 5, 6) ||
37955
- validYear(symbol, state, 0, 4);
37956
- break;
37956
+ exports.register = register;
37957
+ base.add("date", (parameters) => {
37958
+ var _a;
37959
+ const argument = parameters && parameters.length > 0 ? parameters[0] : undefined;
37960
+ const format = DateFormat_1.DateFormat.is(argument) ? argument : DateFormat_1.DateFormat.fromLocale(argument);
37961
+ const create = (_a = handlers[format]) !== null && _a !== void 0 ? _a : handlers["YYYY-mm-dd"];
37962
+ return create();
37963
+ });
37964
+ //# sourceMappingURL=Base.js.map
37965
+ });
37966
+
37967
+ createCommonjsModule(function (module, exports) {
37968
+ Object.defineProperty(exports, "__esModule", { value: true });
37969
+
37970
+
37971
+ class Handler extends Base_1.Base {
37972
+ constructor(seperator) {
37973
+ super(seperator);
37974
+ }
37975
+ toString(data) {
37976
+ return data.length == 10
37977
+ ? [data.substring(8, 10), data.substring(5, 7), data.substring(0, 4)].join(this.seperator)
37978
+ : "";
37979
+ }
37980
+ fromString(value) {
37981
+ const result = value.length == 8 ? `${value.substring(4, 8)}-${value.substring(2, 4)}-${value.substring(0, 2)}` : undefined;
37982
+ return dist$3.Date.is(result) ? result : undefined;
37983
+ }
37984
+ format(unformatted) {
37985
+ let result = unformatted;
37986
+ if (result.get(0, 1) > "3")
37987
+ result = result.insert(0, "0");
37988
+ if (result.value.length > 1)
37989
+ result = result.insert(2, this.seperator);
37990
+ if (result.get(3, 1) > "1")
37991
+ result = result.insert(3, "0");
37992
+ if (result.value.length > 4)
37993
+ result = result.insert(5, this.seperator);
37994
+ return Object.assign(Object.assign({}, result), { type: "text", length: [0, 10], pattern: new RegExp(["^(0[1-9]|[12][0-9]|3[01])", "(0[1-9]|1[012])", "\\d{4}$"].join(this.seperator)) });
37995
+ }
37996
+ allowed(symbol, state) {
37997
+ return state.selection.start == 1 && state.value[0] == "3"
37998
+ ? symbol >= "0" && symbol <= "1"
37999
+ : state.selection.start == 1 && state.value[0] == "0"
38000
+ ? symbol >= "1" && symbol <= "9"
38001
+ : state.selection.start == 2
38002
+ ? symbol >= "0" &&
38003
+ symbol <= "9" &&
38004
+ (symbol == "0" || symbol == "1" || this.validMonth(state.value.substring(0, 2), symbol))
38005
+ : state.selection.start == 3
38006
+ ? symbol >= "0" && symbol <= "9" && this.validMonth(state.value.substring(0, 2), state.value[2] + symbol)
38007
+ : state.selection.start == 7
38008
+ ? symbol >= "0" &&
38009
+ symbol <= "9" &&
38010
+ this.validMonth(state.value.substring(0, 2), state.value.substring(2, 4), state.value.substring(4, 7) + symbol)
38011
+ : state.selection.start < 8 && symbol >= "0" && symbol <= "9";
37957
38012
  }
37958
- return result;
37959
38013
  }
37960
- exports.validFormat = validFormat;
37961
- //# sourceMappingURL=helper.js.map
38014
+ Base_1.register("dd.mm.YYYY", () => new Handler("."));
38015
+ Base_1.register("dd/mm/YYYY", () => new Handler("/"));
38016
+ Base_1.register("dd-mm-YYYY", () => new Handler("-"));
38017
+ //# sourceMappingURL=dmy.js.map
37962
38018
  });
37963
38019
 
37964
- var date = createCommonjsModule(function (module, exports) {
38020
+ createCommonjsModule(function (module, exports) {
37965
38021
  Object.defineProperty(exports, "__esModule", { value: true });
37966
- exports.formatDate = void 0;
37967
38022
 
37968
38023
 
38024
+ class Handler extends Base_1.Base {
38025
+ constructor(seperator) {
38026
+ super(seperator);
38027
+ }
38028
+ toString(data) {
38029
+ return data.length == 10
38030
+ ? [data.substring(5, 7), data.substring(8, 10), data.substring(0, 4)].join(this.seperator)
38031
+ : "";
38032
+ }
38033
+ fromString(value) {
38034
+ const result = value.length == 8 ? `${value.substring(4, 8)}-${value.substring(0, 2)}-${value.substring(2, 4)}` : undefined;
38035
+ return dist$3.Date.is(result) ? result : undefined;
38036
+ }
38037
+ format(unformatted) {
38038
+ let result = unformatted;
38039
+ if (result.get(0, 1) > "1")
38040
+ result = result.insert(0, "0");
38041
+ if (result.value.length > 1)
38042
+ result = result.insert(2, this.seperator);
38043
+ if (result.get(3, 1) > (result.get(0, 2) == "02" ? "2" : "3"))
38044
+ result = result.insert(3, "0");
38045
+ if (result.value.length > 4)
38046
+ result = result.insert(5, this.seperator);
38047
+ return Object.assign(Object.assign({}, result), { type: "text", length: [0, 10], pattern: new RegExp(["^(0[1-9]|1[012])", "(0[1-9]|[12][0-9]|3[01])", "\\d{4}$"].join(this.seperator)) });
38048
+ }
38049
+ allowed(symbol, state) {
38050
+ const result = state.selection.start == 1 && state.value[0] == "1"
38051
+ ? symbol >= "0" && symbol <= "2"
38052
+ : state.selection.start == 1 && state.value[0] == "0"
38053
+ ? symbol >= "1" && symbol <= "9"
38054
+ : state.selection.start == 3
38055
+ ? symbol >= "0" && symbol <= "9" && this.validMonth(state.value[2] + symbol, state.value.substring(0, 2))
38056
+ : state.selection.start == 7
38057
+ ? symbol >= "0" &&
38058
+ symbol <= "9" &&
38059
+ this.validMonth(state.value.substring(2, 4), state.value.substring(0, 2), state.value.substring(4, 7) + symbol)
38060
+ : state.selection.start < 8 && symbol >= "0" && symbol <= "9";
38061
+ return result;
38062
+ }
38063
+ }
38064
+ Base_1.register("mm/dd/YYYY", () => new Handler("/"));
38065
+ //# sourceMappingURL=mdy.js.map
38066
+ });
38067
+
38068
+ createCommonjsModule(function (module, exports) {
38069
+ Object.defineProperty(exports, "__esModule", { value: true });
37969
38070
 
37970
38071
 
37971
- class Handler {
37972
- constructor(formatting) {
37973
- this.formatting = DateFormat_1.DateFormat.is(formatting) ? formatting : DateFormat_1.DateFormat.fromLocale(formatting);
37974
- this.locale = dist$3.Locale.is(formatting)
37975
- ? formatting
37976
- : DateFormat_1.DateFormat.is(formatting)
37977
- ? DateFormat_1.DateFormat.toLocale(formatting)
37978
- : undefined;
38072
+ class Handler extends Base_1.Base {
38073
+ constructor(seperator) {
38074
+ super(seperator);
37979
38075
  }
37980
38076
  toString(data) {
37981
- return typeof data != "string" ? "" : dist$3.Date.is(data) ? dist$3.Date.localize(data, this.locale) : data;
38077
+ return typeof data != "string" ? "" : data;
37982
38078
  }
37983
38079
  fromString(value) {
37984
- let result;
37985
- switch (this.formatting) {
37986
- case "dd/mm/YYYY":
37987
- case "dd.mm.YYYY":
37988
- result = `${value.substring(6, 10)}-${value.substring(3, 5)}-${value.substring(0, 2)}`;
37989
- break;
37990
- case "mm/dd/YYYY":
37991
- result = `${value.substring(6, 10)}-${value.substring(0, 2)}-${value.substring(3, 5)}`;
37992
- break;
37993
- default:
37994
- result = value;
37995
- break;
37996
- }
38080
+ const result = value.length == 8 ? `${value.substring(0, 4)}-${value.substring(4, 6)}-${value.substring(6, 8)}` : undefined;
37997
38081
  return dist$3.Date.is(result) ? result : undefined;
37998
38082
  }
37999
- format(unformated) {
38000
- let result;
38001
- switch (this.formatting) {
38002
- case "dd/mm/YYYY":
38003
- result = Object.assign(Object.assign({}, formatDate(unformated, "dd/mm/YYYY")), { type: "text", length: [0, 10], pattern: /^([0-2][0-9]|(3)[0-1])(\/)(((0)[0-9])|((1)[0-2]))(\/)\d{4}$/ });
38004
- break;
38005
- case "dd.mm.YYYY":
38006
- result = Object.assign(Object.assign({}, formatDate(unformated, "dd.mm.YYYY")), { type: "text", length: [0, 10], pattern: /^([0-2][0-9]|(3)[0-1])(\.)(((0)[0-9])|((1)[0-2]))(\.)\d{4}$/ });
38007
- break;
38008
- case "mm/dd/YYYY":
38009
- result = Object.assign(Object.assign({}, formatDate(unformated, "mm/dd/YYYY")), { type: "text", length: [0, 10], pattern: /^(((0)[0-9])|((1)[0-2]))(\/)([0-2][0-9]|(3)[0-1])(\/)\d{4}$/ });
38010
- break;
38011
- default:
38012
- result = Object.assign(Object.assign({}, formatDate(unformated)), { type: "text", length: [0, 10], pattern: /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/ });
38013
- break;
38083
+ format(unformatted) {
38084
+ let result = unformatted;
38085
+ if (result.value.length > 3) {
38086
+ result = result.insert(4, this.seperator);
38087
+ if (result.get(5, 1) > "1")
38088
+ result = result.insert(5, "0");
38089
+ if (result.value.length > 6) {
38090
+ result = result.insert(7, this.seperator);
38091
+ if (result.get(8, 1) > this.daysInMonth(unformatted.value).toString().substring(0, 1))
38092
+ result = result.insert(8, "0");
38093
+ }
38014
38094
  }
38015
- return result;
38095
+ return Object.assign(Object.assign({}, result), { type: "text", length: [0, 10], pattern: new RegExp(["^\\d{4}", "(0[1-9]|1[012])", "(0[1-9]|[12][0-9]|3[01])$"].join(this.seperator)) });
38096
+ }
38097
+ allowed(symbol, state) {
38098
+ const daysInMonth = this.daysInMonth(state.value);
38099
+ return state.selection.start == 5 && state.value[4] == "0"
38100
+ ? symbol >= "1" && symbol <= "9"
38101
+ : state.selection.start == 5 && state.value[4] == "1"
38102
+ ? symbol >= "0" && symbol <= "2"
38103
+ : state.selection.start == 7 && state.value[6] == "0"
38104
+ ? symbol >= "1" && symbol <= "9"
38105
+ : state.selection.start == 7 && ((state.value[6] == "2" && daysInMonth < 30) || state.value[6] == "3")
38106
+ ? symbol >= "0" && symbol <= daysInMonth.toString().substring(1)
38107
+ : state.selection.start < 8 && symbol >= "0" && symbol <= "9";
38108
+ }
38109
+ }
38110
+ Base_1.register("YYYY-mm-dd", () => new Handler("-"));
38111
+ //# sourceMappingURL=ymd.js.map
38112
+ });
38113
+
38114
+ createCommonjsModule(function (module, exports) {
38115
+ Object.defineProperty(exports, "__esModule", { value: true });
38116
+
38117
+
38118
+
38119
+ //# sourceMappingURL=index.js.map
38120
+ });
38121
+
38122
+ createCommonjsModule(function (module, exports) {
38123
+ Object.defineProperty(exports, "__esModule", { value: true });
38124
+ exports.formatDate = void 0;
38125
+
38126
+
38127
+ class Handler {
38128
+ toString(data) {
38129
+ return typeof data == "string" ? data : "";
38130
+ }
38131
+ fromString(value) {
38132
+ let result = value.replace(" ", "T");
38133
+ const fillerDate = "0000-01-01T00:00:00.000Z";
38134
+ if (result === null || result === void 0 ? void 0 : result.match(/-\d$/))
38135
+ result = result.substring(0, result.length - 1) + "0" + result.substring(result.length - 1, result.length);
38136
+ result = !result.match(/^\d{4}-(0[1-9]|1[012])/)
38137
+ ? undefined
38138
+ : result + fillerDate.substring(result.length, fillerDate.length);
38139
+ return dist$3.DateTime.is(result) ? result : undefined;
38140
+ }
38141
+ format(unformated) {
38142
+ let result = formatDate(unformated);
38143
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[\d:.-]$/))
38144
+ result = result.insert(10, " ");
38145
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 3$/))
38146
+ result = result.replace(11, 12, "23:");
38147
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) [45]$/))
38148
+ result = result.insert(11, "23:");
38149
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) [6-9]$/))
38150
+ result = result.insert(11, "23:5");
38151
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 24$/))
38152
+ result = result.replace(10, 13, "00:");
38153
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 25$/))
38154
+ result = result.insert(12, "3:");
38155
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 2[6-9]$/))
38156
+ result = result.insert(12, "3:5").append(":");
38157
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3])\d[\s\S]$/))
38158
+ result = result.insert(13, ":");
38159
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[6-9]$/))
38160
+ result = result.insert(14, "5");
38161
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[0-5]\d\d$/))
38162
+ result = result.insert(16, ":");
38163
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[0-5]\d:[6-9]$/))
38164
+ result = result.insert(17, "5");
38165
+ return Object.assign(Object.assign({}, result), { type: "text", length: [0, 19], pattern: /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3])(:[0-5]\d){2}$/ });
38016
38166
  }
38017
38167
  unformat(formated) {
38018
38168
  return formated;
38019
38169
  }
38020
38170
  allowed(symbol, state) {
38021
- var _a;
38022
- return helper.validFormat(symbol, state, (_a = this.formatting) !== null && _a !== void 0 ? _a : "YYYY-mm-dd");
38171
+ return (state.value.length < 19 &&
38172
+ ((symbol >= "0" && symbol <= "9") || symbol == "-" || symbol == ":" || symbol == "." || symbol == " "));
38023
38173
  }
38024
38174
  }
38025
- base.add("date", (argument) => new Handler(argument && argument.length > 0 ? argument[0] : undefined));
38175
+ base.add("date-time", () => new Handler());
38026
38176
  function formatDate(unformated, format) {
38027
38177
  let result = unformated;
38028
38178
  switch (format) {
@@ -38053,7 +38203,7 @@ function formatDate(unformated, format) {
38053
38203
  break;
38054
38204
  default:
38055
38205
  if (unformated.value.length == 10) {
38056
- if (!validDate(result.value))
38206
+ if (!validDate(result.value)) {
38057
38207
  result = result.replace(0, 10, validDate(result.value.substring(0, 8) + "31")
38058
38208
  ? result.value.substring(0, 8) + "31"
38059
38209
  : validDate(result.value.substring(0, 8) + "30")
@@ -38063,7 +38213,9 @@ function formatDate(unformated, format) {
38063
38213
  : validDate(result.value.substring(0, 8) + "28")
38064
38214
  ? result.value.substring(0, 8) + "28"
38065
38215
  : result.value);
38066
- break;
38216
+ break;
38217
+ }
38218
+ return unformated;
38067
38219
  }
38068
38220
  }
38069
38221
  return result;
@@ -38073,29 +38225,24 @@ function validDate(date, format) {
38073
38225
  let year;
38074
38226
  let month;
38075
38227
  let day;
38076
- let result;
38077
38228
  switch (format) {
38078
38229
  case "dd/mm/YYYY":
38079
38230
  case "dd.mm.YYYY":
38080
38231
  year = parseInt(date.substring(6, 10));
38081
38232
  month = parseInt(date.substring(3, 5));
38082
38233
  day = parseInt(date.substring(0, 2));
38083
- result = year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
38084
- break;
38234
+ return year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
38085
38235
  case "mm/dd/YYYY":
38086
38236
  year = parseInt(date.substring(6, 10));
38087
38237
  month = parseInt(date.substring(0, 2));
38088
38238
  day = parseInt(date.substring(3, 5));
38089
- result = year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
38090
- break;
38239
+ return year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
38091
38240
  default:
38092
38241
  year = parseInt(date.substring(0, 4));
38093
38242
  month = parseInt(date.substring(5, 7));
38094
38243
  day = parseInt(date.substring(8, 10));
38095
- result = year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
38096
- break;
38244
+ return year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
38097
38245
  }
38098
- return result;
38099
38246
  }
38100
38247
  function daysPerMonth(year, month) {
38101
38248
  let result;
@@ -38122,63 +38269,6 @@ function daysPerMonth(year, month) {
38122
38269
  }
38123
38270
  return result;
38124
38271
  }
38125
- //# sourceMappingURL=index.js.map
38126
- });
38127
-
38128
- createCommonjsModule(function (module, exports) {
38129
- Object.defineProperty(exports, "__esModule", { value: true });
38130
-
38131
-
38132
-
38133
- class Handler {
38134
- toString(data) {
38135
- return typeof data == "string" ? data : "";
38136
- }
38137
- fromString(value) {
38138
- let result = value.replace(" ", "T");
38139
- const fillerDate = "0000-01-01T00:00:00.000Z";
38140
- if (result === null || result === void 0 ? void 0 : result.match(/-\d$/))
38141
- result = result.substring(0, result.length - 1) + "0" + result.substring(result.length - 1, result.length);
38142
- result = !result.match(/^\d{4}-(0[1-9]|1[012])/)
38143
- ? undefined
38144
- : result + fillerDate.substring(result.length, fillerDate.length);
38145
- return dist$3.DateTime.is(result) ? result : undefined;
38146
- }
38147
- format(unformated) {
38148
- let result = date.formatDate(unformated);
38149
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[\d:.-]$/))
38150
- result = result.insert(10, " ");
38151
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 3$/))
38152
- result = result.replace(11, 12, "23:");
38153
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) [45]$/))
38154
- result = result.insert(11, "23:");
38155
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) [6-9]$/))
38156
- result = result.insert(11, "23:5");
38157
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 24$/))
38158
- result = result.replace(10, 13, "00:");
38159
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 25$/))
38160
- result = result.insert(12, "3:");
38161
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 2[6-9]$/))
38162
- result = result.insert(12, "3:5").append(":");
38163
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3])\d[\s\S]$/))
38164
- result = result.insert(13, ":");
38165
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[6-9]$/))
38166
- result = result.insert(14, "5");
38167
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[0-5]\d\d$/))
38168
- result = result.insert(16, ":");
38169
- if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[0-5]\d:[6-9]$/))
38170
- result = result.insert(17, "5");
38171
- return Object.assign(Object.assign({}, result), { type: "text", length: [0, 19], pattern: /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3])(:[0-5]\d){2}$/ });
38172
- }
38173
- unformat(formated) {
38174
- return formated;
38175
- }
38176
- allowed(symbol, state) {
38177
- return (state.value.length < 19 &&
38178
- ((symbol >= "0" && symbol <= "9") || symbol == "-" || symbol == ":" || symbol == "." || symbol == " "));
38179
- }
38180
- }
38181
- base.add("date-time", () => new Handler());
38182
38272
  //# sourceMappingURL=date-time.js.map
38183
38273
  });
38184
38274
 
@@ -39725,6 +39815,10 @@ let InputDate = class {
39725
39815
  onStart(next) {
39726
39816
  this.valueChanged.emit(next);
39727
39817
  }
39818
+ dateSetHandler(e) {
39819
+ this.open = false;
39820
+ e.stopPropagation();
39821
+ }
39728
39822
  render() {
39729
39823
  var _a;
39730
39824
  return [
@@ -39753,16 +39847,18 @@ let InputDateRange = class {
39753
39847
  onValue(next) {
39754
39848
  this.valueChanged.emit(next);
39755
39849
  }
39756
- onClose(open) {
39757
- if (open == false && dist$3.Date.is(this.start) && dist$3.Date.is(this.end))
39758
- this.dateRangeSelected.emit({ start: this.start, end: this.end });
39759
- }
39760
39850
  onStartChanged(event) {
39761
39851
  this.start = event.detail;
39762
39852
  }
39763
39853
  onEndChanged(event) {
39764
39854
  this.end = event.detail;
39765
39855
  }
39856
+ onDateRangeSet(event) {
39857
+ console.log("dateRangeSet", event.detail);
39858
+ this.open = false;
39859
+ event.stopPropagation();
39860
+ dist$3.DateRange.is(event.detail) && this.dateRangeSelected.emit(event.detail);
39861
+ }
39766
39862
  render() {
39767
39863
  var _a;
39768
39864
  return [
@@ -39771,14 +39867,11 @@ let InputDateRange = class {
39771
39867
  this.open ? (index.h("nav", null, index.h("div", { class: "arrow" }), index.h("smoothly-calendar", { doubleInput: true, value: (_a = this.value) !== null && _a !== void 0 ? _a : dist$3.Date.now(), onValueChanged: event => {
39772
39868
  this.value = event.detail;
39773
39869
  event.stopPropagation();
39774
- }, max: this.max, min: this.min }))) : ([]),
39870
+ }, start: this.start, end: this.end, max: this.max, min: this.min }))) : ([]),
39775
39871
  ];
39776
39872
  }
39777
39873
  static get watchers() { return {
39778
- "value": ["onValue"],
39779
- "open": ["onClose"],
39780
- "start": ["onClose"],
39781
- "end": ["onClose"]
39874
+ "value": ["onValue"]
39782
39875
  }; }
39783
39876
  };
39784
39877
  InputDateRange.style = styleCss$p;