@apexcura/ui-components 0.0.11-Beta160 → 0.0.11-Beta162
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 +24 -4
- package/dist/index.mjs +24 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -650,15 +650,35 @@ var import_antd15 = require("antd");
|
|
|
650
650
|
var import_icons4 = require("@ant-design/icons");
|
|
651
651
|
var import_moment = __toESM(require("moment"));
|
|
652
652
|
var DatePickerElement = (props) => {
|
|
653
|
-
const [date, setDate] = (0, import_react20.useState)();
|
|
653
|
+
const [date, setDate] = (0, import_react20.useState)("");
|
|
654
654
|
const handleChange = (value, datestring) => {
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
655
|
+
if (value) {
|
|
656
|
+
const formattedDate = (0, import_moment.default)(datestring).format("lll");
|
|
657
|
+
setDate(formattedDate);
|
|
658
|
+
if (props.onChange) {
|
|
659
|
+
props.onChange(formattedDate);
|
|
660
|
+
}
|
|
661
|
+
} else {
|
|
662
|
+
setDate("");
|
|
663
|
+
}
|
|
658
664
|
};
|
|
659
665
|
const onHandleDecrement = () => {
|
|
666
|
+
if (date) {
|
|
667
|
+
const newDate = (0, import_moment.default)(date).subtract(1, "days");
|
|
668
|
+
setDate(newDate.format("lll"));
|
|
669
|
+
if (props.onChange) {
|
|
670
|
+
props.onChange(newDate.format("lll"));
|
|
671
|
+
}
|
|
672
|
+
}
|
|
660
673
|
};
|
|
661
674
|
const onHandleIncrement = () => {
|
|
675
|
+
if (date) {
|
|
676
|
+
const newDate = (0, import_moment.default)(date).add(1, "days");
|
|
677
|
+
setDate(newDate.format("lll"));
|
|
678
|
+
if (props.onChange) {
|
|
679
|
+
props.onChange(newDate.format("lll"));
|
|
680
|
+
}
|
|
681
|
+
}
|
|
662
682
|
};
|
|
663
683
|
return /* @__PURE__ */ import_react20.default.createElement("div", null, /* @__PURE__ */ import_react20.default.createElement("button", { onClick: onHandleDecrement }, /* @__PURE__ */ import_react20.default.createElement(import_icons4.LeftOutlined, null)), /* @__PURE__ */ import_react20.default.createElement(import_antd15.DatePicker, { placeholder: props.placeholder, variant: "borderless", value: props.value, defaultValue: true, onChange: handleChange }), /* @__PURE__ */ import_react20.default.createElement("button", { onClick: onHandleIncrement }, /* @__PURE__ */ import_react20.default.createElement(import_icons4.RightOutlined, null)));
|
|
664
684
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -599,15 +599,35 @@ import { DatePicker } from "antd";
|
|
|
599
599
|
import { LeftOutlined, RightOutlined } from "@ant-design/icons";
|
|
600
600
|
import moment from "moment";
|
|
601
601
|
var DatePickerElement = (props) => {
|
|
602
|
-
const [date, setDate] = useState5();
|
|
602
|
+
const [date, setDate] = useState5("");
|
|
603
603
|
const handleChange = (value, datestring) => {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
604
|
+
if (value) {
|
|
605
|
+
const formattedDate = moment(datestring).format("lll");
|
|
606
|
+
setDate(formattedDate);
|
|
607
|
+
if (props.onChange) {
|
|
608
|
+
props.onChange(formattedDate);
|
|
609
|
+
}
|
|
610
|
+
} else {
|
|
611
|
+
setDate("");
|
|
612
|
+
}
|
|
607
613
|
};
|
|
608
614
|
const onHandleDecrement = () => {
|
|
615
|
+
if (date) {
|
|
616
|
+
const newDate = moment(date).subtract(1, "days");
|
|
617
|
+
setDate(newDate.format("lll"));
|
|
618
|
+
if (props.onChange) {
|
|
619
|
+
props.onChange(newDate.format("lll"));
|
|
620
|
+
}
|
|
621
|
+
}
|
|
609
622
|
};
|
|
610
623
|
const onHandleIncrement = () => {
|
|
624
|
+
if (date) {
|
|
625
|
+
const newDate = moment(date).add(1, "days");
|
|
626
|
+
setDate(newDate.format("lll"));
|
|
627
|
+
if (props.onChange) {
|
|
628
|
+
props.onChange(newDate.format("lll"));
|
|
629
|
+
}
|
|
630
|
+
}
|
|
611
631
|
};
|
|
612
632
|
return /* @__PURE__ */ React19.createElement("div", null, /* @__PURE__ */ React19.createElement("button", { onClick: onHandleDecrement }, /* @__PURE__ */ React19.createElement(LeftOutlined, null)), /* @__PURE__ */ React19.createElement(DatePicker, { placeholder: props.placeholder, variant: "borderless", value: props.value, defaultValue: true, onChange: handleChange }), /* @__PURE__ */ React19.createElement("button", { onClick: onHandleIncrement }, /* @__PURE__ */ React19.createElement(RightOutlined, null)));
|
|
613
633
|
};
|