@apexcura/ui-components 0.0.11-Beta165 → 0.0.11-Beta167
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 +36 -7
- package/dist/index.mjs +36 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -650,18 +650,47 @@ var import_antd14 = 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)(
|
|
654
|
-
const handleChange = (
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
653
|
+
const [date, setDate] = (0, import_react20.useState)(null);
|
|
654
|
+
const handleChange = (date2) => {
|
|
655
|
+
if (date2) {
|
|
656
|
+
const formattedDate = date2.format("lll");
|
|
657
|
+
setDate(date2);
|
|
658
|
+
if (props.onChange) {
|
|
659
|
+
props.onChange(formattedDate);
|
|
660
|
+
}
|
|
661
|
+
} else {
|
|
662
|
+
setDate(null);
|
|
663
|
+
if (props.onChange) {
|
|
664
|
+
props.onChange("");
|
|
665
|
+
}
|
|
666
|
+
}
|
|
659
667
|
};
|
|
660
668
|
const onHandleDecrement = () => {
|
|
669
|
+
if (date) {
|
|
670
|
+
const newDate = (0, import_moment.default)(date).subtract(1, "days");
|
|
671
|
+
setDate(newDate);
|
|
672
|
+
if (props.onChange) {
|
|
673
|
+
props.onChange(newDate.format("lll"));
|
|
674
|
+
}
|
|
675
|
+
}
|
|
661
676
|
};
|
|
662
677
|
const onHandleIncrement = () => {
|
|
678
|
+
if (date) {
|
|
679
|
+
const newDate = (0, import_moment.default)(date).add(1, "days");
|
|
680
|
+
setDate(newDate);
|
|
681
|
+
if (props.onChange) {
|
|
682
|
+
props.onChange(newDate.format("lll"));
|
|
683
|
+
}
|
|
684
|
+
}
|
|
663
685
|
};
|
|
664
|
-
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(
|
|
686
|
+
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(
|
|
687
|
+
import_antd14.DatePicker,
|
|
688
|
+
{
|
|
689
|
+
placeholder: props.placeholder,
|
|
690
|
+
value: date,
|
|
691
|
+
onChange: handleChange
|
|
692
|
+
}
|
|
693
|
+
), /* @__PURE__ */ import_react20.default.createElement("button", { onClick: onHandleIncrement }, /* @__PURE__ */ import_react20.default.createElement(import_icons4.RightOutlined, null)));
|
|
665
694
|
};
|
|
666
695
|
// Annotate the CommonJS export names for ESM import in node:
|
|
667
696
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -599,18 +599,47 @@ 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(
|
|
603
|
-
const handleChange = (
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
602
|
+
const [date, setDate] = useState5(null);
|
|
603
|
+
const handleChange = (date2) => {
|
|
604
|
+
if (date2) {
|
|
605
|
+
const formattedDate = date2.format("lll");
|
|
606
|
+
setDate(date2);
|
|
607
|
+
if (props.onChange) {
|
|
608
|
+
props.onChange(formattedDate);
|
|
609
|
+
}
|
|
610
|
+
} else {
|
|
611
|
+
setDate(null);
|
|
612
|
+
if (props.onChange) {
|
|
613
|
+
props.onChange("");
|
|
614
|
+
}
|
|
615
|
+
}
|
|
608
616
|
};
|
|
609
617
|
const onHandleDecrement = () => {
|
|
618
|
+
if (date) {
|
|
619
|
+
const newDate = moment(date).subtract(1, "days");
|
|
620
|
+
setDate(newDate);
|
|
621
|
+
if (props.onChange) {
|
|
622
|
+
props.onChange(newDate.format("lll"));
|
|
623
|
+
}
|
|
624
|
+
}
|
|
610
625
|
};
|
|
611
626
|
const onHandleIncrement = () => {
|
|
627
|
+
if (date) {
|
|
628
|
+
const newDate = moment(date).add(1, "days");
|
|
629
|
+
setDate(newDate);
|
|
630
|
+
if (props.onChange) {
|
|
631
|
+
props.onChange(newDate.format("lll"));
|
|
632
|
+
}
|
|
633
|
+
}
|
|
612
634
|
};
|
|
613
|
-
return /* @__PURE__ */ React19.createElement("div", null, /* @__PURE__ */ React19.createElement("button", { onClick: onHandleDecrement }, /* @__PURE__ */ React19.createElement(LeftOutlined, null)), /* @__PURE__ */ React19.createElement(
|
|
635
|
+
return /* @__PURE__ */ React19.createElement("div", null, /* @__PURE__ */ React19.createElement("button", { onClick: onHandleDecrement }, /* @__PURE__ */ React19.createElement(LeftOutlined, null)), /* @__PURE__ */ React19.createElement(
|
|
636
|
+
DatePicker,
|
|
637
|
+
{
|
|
638
|
+
placeholder: props.placeholder,
|
|
639
|
+
value: date,
|
|
640
|
+
onChange: handleChange
|
|
641
|
+
}
|
|
642
|
+
), /* @__PURE__ */ React19.createElement("button", { onClick: onHandleIncrement }, /* @__PURE__ */ React19.createElement(RightOutlined, null)));
|
|
614
643
|
};
|
|
615
644
|
export {
|
|
616
645
|
AddMoreTable,
|