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