@apexcura/ui-components 0.0.15-Beta39 → 0.0.15-Beta40

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/index.js CHANGED
@@ -836,7 +836,6 @@ var import_antd14 = require("antd");
836
836
  var import_dayjs = __toESM(require("dayjs"));
837
837
  var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
838
838
  import_dayjs.default.extend(import_customParseFormat.default);
839
- import_dayjs.default.extend(import_customParseFormat.default);
840
839
  var DatePickerElement = (props) => {
841
840
  const [dateState, setDateState] = (0, import_react20.useState)("");
842
841
  const handleChange = (date, dateString) => {
@@ -845,6 +844,11 @@ var DatePickerElement = (props) => {
845
844
  if (props.onChange) {
846
845
  props.onChange(dateString);
847
846
  }
847
+ } else {
848
+ setDateState("");
849
+ if (props.onChange) {
850
+ props.onChange("");
851
+ }
848
852
  }
849
853
  };
850
854
  const disabledDate = (current) => {
@@ -859,10 +863,10 @@ var DatePickerElement = (props) => {
859
863
  const currentHour = (0, import_dayjs.default)().hour();
860
864
  const currentMinute = (0, import_dayjs.default)().minute();
861
865
  return {
862
- disabledHours: () => [...Array(24).keys()].slice(0, currentHour),
866
+ disabledHours: () => Array.from({ length: currentHour }, (_, i) => i),
863
867
  disabledMinutes: (hour) => {
864
868
  if (hour === currentHour) {
865
- return [...Array(60).keys()].slice(0, currentMinute + 1);
869
+ return Array.from({ length: currentMinute + 1 }, (_, i) => i);
866
870
  }
867
871
  return [];
868
872
  }
@@ -872,10 +876,16 @@ var DatePickerElement = (props) => {
872
876
  const currentHour = (0, import_dayjs.default)().hour();
873
877
  const currentMinute = (0, import_dayjs.default)().minute();
874
878
  return {
875
- disabledHours: () => [...Array(24).keys()].slice(currentHour + 1, 24),
879
+ disabledHours: () => Array.from(
880
+ { length: 24 - currentHour - 1 },
881
+ (_, i) => i + currentHour + 1
882
+ ),
876
883
  disabledMinutes: (hour) => {
877
884
  if (hour === currentHour) {
878
- return [...Array(60).keys()].slice(currentMinute + 1, 60);
885
+ return Array.from(
886
+ { length: 60 - currentMinute - 1 },
887
+ (_, i) => i + currentMinute + 1
888
+ );
879
889
  }
880
890
  return [];
881
891
  }
@@ -890,8 +900,7 @@ var DatePickerElement = (props) => {
890
900
  disabledDate,
891
901
  placeholder: props.placeholder,
892
902
  value: dateState,
893
- showTime: true,
894
- format: "DD-MM-YYYY HH:mm:ss",
903
+ format: "DD-MM-YYYY",
895
904
  onChange: handleChange,
896
905
  picker: props.picker
897
906
  }
package/dist/index.mjs CHANGED
@@ -767,7 +767,6 @@ import { DatePicker } from "antd";
767
767
  import dayjs from "dayjs";
768
768
  import customParseFormat from "dayjs/plugin/customParseFormat.js";
769
769
  dayjs.extend(customParseFormat);
770
- dayjs.extend(customParseFormat);
771
770
  var DatePickerElement = (props) => {
772
771
  const [dateState, setDateState] = useState6("");
773
772
  const handleChange = (date, dateString) => {
@@ -776,6 +775,11 @@ var DatePickerElement = (props) => {
776
775
  if (props.onChange) {
777
776
  props.onChange(dateString);
778
777
  }
778
+ } else {
779
+ setDateState("");
780
+ if (props.onChange) {
781
+ props.onChange("");
782
+ }
779
783
  }
780
784
  };
781
785
  const disabledDate = (current) => {
@@ -790,10 +794,10 @@ var DatePickerElement = (props) => {
790
794
  const currentHour = dayjs().hour();
791
795
  const currentMinute = dayjs().minute();
792
796
  return {
793
- disabledHours: () => [...Array(24).keys()].slice(0, currentHour),
797
+ disabledHours: () => Array.from({ length: currentHour }, (_, i) => i),
794
798
  disabledMinutes: (hour) => {
795
799
  if (hour === currentHour) {
796
- return [...Array(60).keys()].slice(0, currentMinute + 1);
800
+ return Array.from({ length: currentMinute + 1 }, (_, i) => i);
797
801
  }
798
802
  return [];
799
803
  }
@@ -803,10 +807,16 @@ var DatePickerElement = (props) => {
803
807
  const currentHour = dayjs().hour();
804
808
  const currentMinute = dayjs().minute();
805
809
  return {
806
- disabledHours: () => [...Array(24).keys()].slice(currentHour + 1, 24),
810
+ disabledHours: () => Array.from(
811
+ { length: 24 - currentHour - 1 },
812
+ (_, i) => i + currentHour + 1
813
+ ),
807
814
  disabledMinutes: (hour) => {
808
815
  if (hour === currentHour) {
809
- return [...Array(60).keys()].slice(currentMinute + 1, 60);
816
+ return Array.from(
817
+ { length: 60 - currentMinute - 1 },
818
+ (_, i) => i + currentMinute + 1
819
+ );
810
820
  }
811
821
  return [];
812
822
  }
@@ -821,8 +831,7 @@ var DatePickerElement = (props) => {
821
831
  disabledDate,
822
832
  placeholder: props.placeholder,
823
833
  value: dateState,
824
- showTime: true,
825
- format: "DD-MM-YYYY HH:mm:ss",
834
+ format: "DD-MM-YYYY",
826
835
  onChange: handleChange,
827
836
  picker: props.picker
828
837
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.15-Beta39",
3
+ "version": "0.0.15-Beta40",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",