@apexcura/ui-components 0.0.11-Beta166 → 0.0.11-Beta168

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