@apexcura/ui-components 0.0.14-Beta278 → 0.0.14-Beta279
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 +21 -22
- package/dist/index.mjs +21 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -874,48 +874,47 @@ var DatePickerElement = (props) => {
|
|
|
874
874
|
var import_react21 = __toESM(require("react"));
|
|
875
875
|
var import_antd15 = require("antd");
|
|
876
876
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
877
|
+
var import_moment2 = __toESM(require("moment"));
|
|
877
878
|
var DateRangePickerElement = (props) => {
|
|
878
879
|
const { value } = props;
|
|
879
880
|
const { RangePicker } = import_antd15.DatePicker;
|
|
880
881
|
const dateValues = value ? value.map((date) => (0, import_dayjs2.default)(date, "DD-MM-YYYY")) : null;
|
|
881
|
-
const today = (0, import_dayjs2.default)();
|
|
882
882
|
const handleChange = (dates, dateStrings) => {
|
|
883
883
|
if (dates) {
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
}
|
|
889
|
-
|
|
884
|
+
let [start, end] = dates;
|
|
885
|
+
const today2 = (0, import_dayjs2.default)();
|
|
886
|
+
if (end && end.isAfter(today2)) {
|
|
887
|
+
start = today2;
|
|
888
|
+
}
|
|
889
|
+
if (start && start.isBefore(today2)) {
|
|
890
|
+
end = today2;
|
|
890
891
|
}
|
|
892
|
+
const adjustedDates = [start, end].map((date) => date ? date.format("DD-MM-YYYY") : null);
|
|
893
|
+
props.onChange && props.onChange(adjustedDates);
|
|
891
894
|
} else {
|
|
892
895
|
props.onChange && props.onChange("");
|
|
893
896
|
}
|
|
894
897
|
};
|
|
898
|
+
const today = (0, import_dayjs2.default)();
|
|
895
899
|
let rangePresets = [
|
|
896
900
|
{ label: "Last 7 Days", value: [(0, import_dayjs2.default)().subtract(6, "d"), today] },
|
|
897
901
|
{ label: "Last 14 Days", value: [(0, import_dayjs2.default)().subtract(13, "d"), today] },
|
|
898
902
|
{ label: "Last 30 Days", value: [(0, import_dayjs2.default)().subtract(29, "d"), today] },
|
|
899
903
|
{ label: "Last 90 Days", value: [(0, import_dayjs2.default)().subtract(89, "d"), today] }
|
|
900
904
|
];
|
|
905
|
+
let disabledDate;
|
|
901
906
|
if (props.weekrange) {
|
|
902
|
-
|
|
903
|
-
{
|
|
904
|
-
|
|
905
|
-
value: [today.startOf("week"), today.endOf("week")]
|
|
906
|
-
},
|
|
907
|
-
{
|
|
908
|
-
label: "Last Week",
|
|
909
|
-
value: [today.startOf("week").subtract(1, "week"), today.endOf("week").subtract(1, "week")]
|
|
907
|
+
disabledDate = (current) => {
|
|
908
|
+
if (props.weekrange) {
|
|
909
|
+
return current && (current < today.subtract(7, "d") || current > today.add(7, "d"));
|
|
910
910
|
}
|
|
911
|
-
|
|
911
|
+
return current && (current > today.add(7, "d") || current < today.subtract(7, "d"));
|
|
912
|
+
};
|
|
913
|
+
} else {
|
|
914
|
+
disabledDate = (current) => {
|
|
915
|
+
return current && current > (0, import_moment2.default)();
|
|
916
|
+
};
|
|
912
917
|
}
|
|
913
|
-
const disabledDate = (current) => {
|
|
914
|
-
if (props.weekrange) {
|
|
915
|
-
return current && (current < today.subtract(7, "d") || current > today.add(7, "d"));
|
|
916
|
-
}
|
|
917
|
-
return current && (current > today.add(7, "d") || current < today.subtract(7, "d"));
|
|
918
|
-
};
|
|
919
918
|
return /* @__PURE__ */ import_react21.default.createElement(import_antd15.Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ import_react21.default.createElement(
|
|
920
919
|
RangePicker,
|
|
921
920
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -807,48 +807,47 @@ var DatePickerElement = (props) => {
|
|
|
807
807
|
import React21 from "react";
|
|
808
808
|
import { DatePicker as DatePicker2, Space } from "antd";
|
|
809
809
|
import dayjs2 from "dayjs";
|
|
810
|
+
import moment2 from "moment";
|
|
810
811
|
var DateRangePickerElement = (props) => {
|
|
811
812
|
const { value } = props;
|
|
812
813
|
const { RangePicker } = DatePicker2;
|
|
813
814
|
const dateValues = value ? value.map((date) => dayjs2(date, "DD-MM-YYYY")) : null;
|
|
814
|
-
const today = dayjs2();
|
|
815
815
|
const handleChange = (dates, dateStrings) => {
|
|
816
816
|
if (dates) {
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
}
|
|
822
|
-
|
|
817
|
+
let [start, end] = dates;
|
|
818
|
+
const today2 = dayjs2();
|
|
819
|
+
if (end && end.isAfter(today2)) {
|
|
820
|
+
start = today2;
|
|
821
|
+
}
|
|
822
|
+
if (start && start.isBefore(today2)) {
|
|
823
|
+
end = today2;
|
|
823
824
|
}
|
|
825
|
+
const adjustedDates = [start, end].map((date) => date ? date.format("DD-MM-YYYY") : null);
|
|
826
|
+
props.onChange && props.onChange(adjustedDates);
|
|
824
827
|
} else {
|
|
825
828
|
props.onChange && props.onChange("");
|
|
826
829
|
}
|
|
827
830
|
};
|
|
831
|
+
const today = dayjs2();
|
|
828
832
|
let rangePresets = [
|
|
829
833
|
{ label: "Last 7 Days", value: [dayjs2().subtract(6, "d"), today] },
|
|
830
834
|
{ label: "Last 14 Days", value: [dayjs2().subtract(13, "d"), today] },
|
|
831
835
|
{ label: "Last 30 Days", value: [dayjs2().subtract(29, "d"), today] },
|
|
832
836
|
{ label: "Last 90 Days", value: [dayjs2().subtract(89, "d"), today] }
|
|
833
837
|
];
|
|
838
|
+
let disabledDate;
|
|
834
839
|
if (props.weekrange) {
|
|
835
|
-
|
|
836
|
-
{
|
|
837
|
-
|
|
838
|
-
value: [today.startOf("week"), today.endOf("week")]
|
|
839
|
-
},
|
|
840
|
-
{
|
|
841
|
-
label: "Last Week",
|
|
842
|
-
value: [today.startOf("week").subtract(1, "week"), today.endOf("week").subtract(1, "week")]
|
|
840
|
+
disabledDate = (current) => {
|
|
841
|
+
if (props.weekrange) {
|
|
842
|
+
return current && (current < today.subtract(7, "d") || current > today.add(7, "d"));
|
|
843
843
|
}
|
|
844
|
-
|
|
844
|
+
return current && (current > today.add(7, "d") || current < today.subtract(7, "d"));
|
|
845
|
+
};
|
|
846
|
+
} else {
|
|
847
|
+
disabledDate = (current) => {
|
|
848
|
+
return current && current > moment2();
|
|
849
|
+
};
|
|
845
850
|
}
|
|
846
|
-
const disabledDate = (current) => {
|
|
847
|
-
if (props.weekrange) {
|
|
848
|
-
return current && (current < today.subtract(7, "d") || current > today.add(7, "d"));
|
|
849
|
-
}
|
|
850
|
-
return current && (current > today.add(7, "d") || current < today.subtract(7, "d"));
|
|
851
|
-
};
|
|
852
851
|
return /* @__PURE__ */ React21.createElement(Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ React21.createElement(
|
|
853
852
|
RangePicker,
|
|
854
853
|
{
|