@esic-lab/data-core-ui 0.0.63 → 0.0.65

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
@@ -424,7 +424,8 @@ function PrimaryButton({
424
424
  colorPrimary = "#4e61f6",
425
425
  colorPrimaryHover = "#8895f9",
426
426
  textColor = "#ffffff",
427
- icon
427
+ icon,
428
+ className
428
429
  }) {
429
430
  const textClass = size === "large" ? "body-1" : "body-3";
430
431
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -443,7 +444,7 @@ function PrimaryButton({
443
444
  size,
444
445
  onClick,
445
446
  type: "primary",
446
- className: textClass,
447
+ className: `${textClass} ${className ?? ""}`,
447
448
  disabled,
448
449
  icon,
449
450
  iconPosition: iconPlacement,
@@ -467,7 +468,8 @@ function SecondaryButton({
467
468
  defaultHoverBorderColor = "#7181f8",
468
469
  defaultHoverColor = "#7181f8",
469
470
  textColor = "rgba(0,0,0,0.88)",
470
- icon
471
+ icon,
472
+ className
471
473
  }) {
472
474
  const textClass = size === "large" ? "body-1" : "body-3";
473
475
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
@@ -491,7 +493,7 @@ function SecondaryButton({
491
493
  size,
492
494
  onClick,
493
495
  type: "default",
494
- className: textClass,
496
+ className: `${textClass} ${className ?? ""}`,
495
497
  disabled,
496
498
  icon,
497
499
  iconPosition: iconPlacement,
@@ -549,7 +551,8 @@ function TertiaryButton({
549
551
  colorPrimary = "#000",
550
552
  colorPrimaryHover = "#4d5461",
551
553
  textColor = "white",
552
- icon
554
+ icon,
555
+ className
553
556
  }) {
554
557
  const textClass = size === "large" ? "body-1" : "body-3";
555
558
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
@@ -568,7 +571,7 @@ function TertiaryButton({
568
571
  size,
569
572
  onClick,
570
573
  type: "primary",
571
- className: textClass,
574
+ className: `${textClass} ${className ?? ""}`,
572
575
  disabled,
573
576
  icon,
574
577
  iconPosition: iconPlacement,
@@ -618,9 +621,9 @@ function Checkbox({ label, checked, onChange, disabled }) {
618
621
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
619
622
  "div",
620
623
  {
621
- className: `flex justify-center items-center border-[1px] border-black w-[24px] h-[24px] rounded-[8px] transition-colors duration-100
622
- ${checked ? "bg-black text-white" : "bg-white text-black"}
623
- ${disabled ? "pointer-events-none" : ""}`,
624
+ className: `flex justify-center items-center border-[1px] border-gray-400 w-[24px] h-[24px] rounded-[8px] transition-colors duration-100
625
+ ${checked ? "bg-primary-500 text-white border-primary-500" : "bg-white text-black"}
626
+ ${disabled ? "pointer-events-none !bg-gray-300" : ""}`,
624
627
  children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
625
628
  "span",
626
629
  {
@@ -1340,8 +1343,26 @@ function InputFieldNumber({
1340
1343
  size,
1341
1344
  changeOnWheel,
1342
1345
  formatter,
1343
- parser
1346
+ parser,
1347
+ decimal = false,
1348
+ decimalScale = 2,
1349
+ format: format5 = "number"
1344
1350
  }) {
1351
+ const safeScale = Math.max(0, Math.min(decimalScale, 10));
1352
+ const addComma = (s) => s.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1353
+ const defaultFormatter = (v) => {
1354
+ if (v === void 0 || v === null || v === "") return "";
1355
+ const num = Number(v);
1356
+ if (Number.isNaN(num)) return "";
1357
+ const base = !decimal ? Math.trunc(num).toString() : num.toFixed(safeScale);
1358
+ return format5 === "currency" ? addComma(base) : base;
1359
+ };
1360
+ const defaultParser = (v) => {
1361
+ if (!v) return "";
1362
+ const raw = v.replace(/,/g, "").replace(/\s/g, "");
1363
+ if (!decimal) return raw.split(".")[0];
1364
+ return raw.replace(/[^\d.]/g, "");
1365
+ };
1345
1366
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1346
1367
  import_antd7.ConfigProvider,
1347
1368
  {
@@ -1372,17 +1393,9 @@ function InputFieldNumber({
1372
1393
  controls,
1373
1394
  size,
1374
1395
  changeOnWheel,
1375
- formatter: formatter ?? ((value2) => {
1376
- if (value2 === void 0 || value2 === null || value2 === "")
1377
- return "";
1378
- const num = Number(value2);
1379
- if (isNaN(num)) return "";
1380
- return num.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1381
- }),
1382
- parser: parser ?? ((value2) => {
1383
- if (!value2) return "";
1384
- return value2.replace(/,/g, "");
1385
- })
1396
+ formatter: formatter ?? defaultFormatter,
1397
+ parser: parser ?? defaultParser,
1398
+ precision: decimal ? safeScale : 0
1386
1399
  }
1387
1400
  ),
1388
1401
  error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-red-500 caption-1", children: error })
@@ -3953,7 +3966,6 @@ function Indicator({
3953
3966
  ...prev,
3954
3967
  [key]: value
3955
3968
  }));
3956
- console.log(cacheData);
3957
3969
  };
3958
3970
  const handleClick = (active) => {
3959
3971
  handleChangeCashData("inputType", active);
@@ -4005,7 +4017,6 @@ function Indicator({
4005
4017
  ...prev,
4006
4018
  [name]: value
4007
4019
  }));
4008
- console.log(cacheEditData);
4009
4020
  };
4010
4021
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "w-full", children: [
4011
4022
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
@@ -4013,27 +4024,18 @@ function Indicator({
4013
4024
  {
4014
4025
  className: `space-x-2 grid ${valueSwitch === "TEXT" ? `grid-cols-[140px_1fr_50px]` : `grid-cols-[140px_1fr_200px_200px_50px]`} items-start`,
4015
4026
  children: [
4016
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4017
- SwitchSelect,
4018
- {
4019
- option,
4020
- onClick: handleClick,
4021
- value: valueSwitch,
4022
- label: "\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17",
4023
- required: true
4024
- }
4025
- ),
4027
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SwitchSelect, { option, onClick: handleClick, value: valueSwitch, label: "\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17", required: true }),
4026
4028
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4027
4029
  InputField,
4028
4030
  {
4029
- label: `\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
4031
+ label: type === "TARGET" ? "\u0E0A\u0E37\u0E48\u0E2D\u0E01\u0E25\u0E38\u0E48\u0E21\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22" : `\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
4030
4032
  value: cacheData.textValue,
4031
4033
  className: "h-[32px]",
4032
4034
  onChange: (val) => {
4033
4035
  handleChangeCashData("textValue", val ?? "");
4034
4036
  setAddError((p) => ({ ...p, textValue: void 0 }));
4035
4037
  },
4036
- placeholder: `\u0E23\u0E30\u0E1A\u0E38\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
4038
+ placeholder: type === "TARGET" ? "\u0E23\u0E30\u0E1A\u0E38\u0E0A\u0E37\u0E48\u0E2D\u0E01\u0E25\u0E38\u0E48\u0E21\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22" : `\u0E23\u0E30\u0E1A\u0E38\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
4037
4039
  required: true,
4038
4040
  error: addError.textValue
4039
4041
  }
@@ -4042,7 +4044,7 @@ function Indicator({
4042
4044
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4043
4045
  InputFieldNumber,
4044
4046
  {
4045
- label: `\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
4047
+ label: type === "TARGET" ? "\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22" : `\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
4046
4048
  value: cacheData.numberValue ?? 0,
4047
4049
  className: "h-[32px]",
4048
4050
  onChange: (val) => {
@@ -4050,7 +4052,7 @@ function Indicator({
4050
4052
  setAddError((p) => ({ ...p, numberValue: void 0 }));
4051
4053
  },
4052
4054
  min: 0,
4053
- placeholder: `\u0E23\u0E30\u0E1A\u0E38\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
4055
+ placeholder: type === "TARGET" ? "\u0E23\u0E30\u0E1A\u0E38\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22" : `\u0E23\u0E30\u0E1A\u0E38\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
4054
4056
  required: true,
4055
4057
  error: addError.numberValue
4056
4058
  }
@@ -4071,14 +4073,7 @@ function Indicator({
4071
4073
  }
4072
4074
  )
4073
4075
  ] }),
4074
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4075
- import_icons_react12.IconCirclePlus,
4076
- {
4077
- onClick: handleAddIndicator,
4078
- className: "mt-8 cursor-pointer",
4079
- size: 32
4080
- }
4081
- )
4076
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_icons_react12.IconCirclePlus, { onClick: handleAddIndicator, className: "mt-8 cursor-pointer", size: 32 })
4082
4077
  ]
4083
4078
  }
4084
4079
  ),
@@ -4147,20 +4142,8 @@ function Indicator({
4147
4142
  onClick: () => handleConfirmEditIndicator(index)
4148
4143
  }
4149
4144
  ),
4150
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4151
- import_icons_react12.IconX,
4152
- {
4153
- className: "cursor-pointer text-red-600",
4154
- onClick: handleCancelEditIndicator
4155
- }
4156
- )
4157
- ] }) : void 0 : canEdit && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4158
- import_icons_react12.IconPencil,
4159
- {
4160
- className: "cursor-pointer",
4161
- onClick: () => handleEditIndicator(index)
4162
- }
4163
- ) }),
4145
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_icons_react12.IconX, { className: "cursor-pointer text-red-600", onClick: handleCancelEditIndicator })
4146
+ ] }) : void 0 : false }),
4164
4147
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "body-1 mt-2 cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4165
4148
  import_icons_react12.IconTrash,
4166
4149
  {
@@ -4815,6 +4798,8 @@ var PieChart = ({
4815
4798
  var import_react24 = require("react");
4816
4799
  var d33 = __toESM(require("d3"));
4817
4800
  var import_date_fns3 = require("date-fns");
4801
+ var import_locale3 = require("date-fns/locale");
4802
+ var import_icons_react15 = require("@tabler/icons-react");
4818
4803
  var import_jsx_runtime48 = require("react/jsx-runtime");
4819
4804
  var LAYOUT = {
4820
4805
  barHeight: 40,
@@ -4832,31 +4817,33 @@ var VIEW_MODE_SCALE = {
4832
4817
  week: 10
4833
4818
  };
4834
4819
  var STATUS_META = {
4835
- pending: { color: "#F16965", label: "\u0E23\u0E2D\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23" },
4836
- "in-progress": { color: "#FFBB33", label: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23" },
4837
- completed: { color: "#69C57D", label: "\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E2A\u0E34\u0E49\u0E19" }
4838
- };
4839
- var THAI_MONTHS = {
4840
- January: "\u0E21.\u0E04.",
4841
- February: "\u0E01.\u0E1E.",
4842
- March: "\u0E21\u0E35.\u0E04.",
4843
- April: "\u0E40\u0E21.\u0E22.",
4844
- May: "\u0E1E.\u0E04.",
4845
- June: "\u0E21\u0E34.\u0E22.",
4846
- July: "\u0E01.\u0E04.",
4847
- August: "\u0E2A.\u0E04.",
4848
- September: "\u0E01.\u0E22.",
4849
- October: "\u0E15.\u0E04.",
4850
- November: "\u0E1E.\u0E22.",
4851
- December: "\u0E18.\u0E04."
4820
+ IN_PROGRESS: {
4821
+ color: "#FFC654",
4822
+ label: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23",
4823
+ icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons_react15.IconHourglassEmpty, { className: "text-[#FFC654]" })
4824
+ },
4825
+ CANCEL: {
4826
+ color: "#D2D5DB",
4827
+ label: "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01",
4828
+ icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons_react15.IconCircleX, { className: "text-[#D2D5DB]" })
4829
+ },
4830
+ SUCCESS: {
4831
+ color: "#81CF92",
4832
+ label: "\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23\u0E41\u0E25\u0E49\u0E27\u0E40\u0E2A\u0E23\u0E47\u0E08",
4833
+ icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons_react15.IconRosetteDiscountCheck, { className: "text-[#81CF92]" })
4834
+ },
4835
+ COMPLETE: {
4836
+ color: "#81CF92",
4837
+ label: "\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E2A\u0E34\u0E49\u0E19",
4838
+ icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons_react15.IconRosetteDiscountCheck, { className: "text-[#81CF92]" })
4839
+ },
4840
+ DELAY: {
4841
+ color: "#F4827E",
4842
+ label: "\u0E25\u0E48\u0E32\u0E0A\u0E49\u0E32",
4843
+ icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons_react15.IconClockExclamation, { className: "text-[#F4827E]" })
4844
+ }
4852
4845
  };
4853
- var THAI_DAYS = ["\u0E2D\u0E32.", "\u0E08.", "\u0E2D.", "\u0E1E.", "\u0E1E\u0E24.", "\u0E28.", "\u0E2A."];
4854
4846
  var roundedRectPath = (x, y, width, height, radius) => `M${x + radius},${y} H${x + width} V${y + height} H${x + radius} A${radius},${radius},0,0,1,${x},${y + height - radius} V${y + radius} A${radius},${radius},0,0,1,${x + radius},${y}`;
4855
- var formatThaiMonth = (date) => {
4856
- const monthName = (0, import_date_fns3.format)(date, "MMMM");
4857
- return THAI_MONTHS[monthName] || monthName;
4858
- };
4859
- var formatThaiDate = (date) => date ? date.toLocaleDateString("th-TH", { day: "numeric", month: "short" }) : "-";
4860
4847
  var isDateOnlyValue = (dt) => {
4861
4848
  const localZero = dt.getHours() === 0 && dt.getMinutes() === 0 && dt.getSeconds() === 0 && dt.getMilliseconds() === 0;
4862
4849
  const utcZero = dt.getUTCHours() === 0 && dt.getUTCMinutes() === 0 && dt.getUTCSeconds() === 0 && dt.getUTCMilliseconds() === 0;
@@ -4886,60 +4873,46 @@ var getAdjustedEnd = (d) => {
4886
4873
  }
4887
4874
  return (0, import_date_fns3.startOfDay)(/* @__PURE__ */ new Date());
4888
4875
  };
4889
- var getStatusColor = (status2) => STATUS_META[status2]?.color ?? STATUS_META.pending.color;
4890
- var getStatusLabel = (status2) => STATUS_META[status2]?.label ?? STATUS_META.pending.label;
4891
- var ProjectRow = ({ element, barHeight, barSpacing }) => {
4876
+ var getStatusColor = (status2) => STATUS_META[status2]?.color ?? STATUS_META.IN_PROGRESS.color;
4877
+ var getStatusLabel = (status2) => STATUS_META[status2]?.label ?? STATUS_META.IN_PROGRESS.label;
4878
+ var ProjectRow = ({ element, barHeight, barSpacing, mode }) => {
4892
4879
  const safeStartDate = element.startDate instanceof Date ? element.startDate : null;
4893
4880
  const safeEndDate = element.endDate instanceof Date ? element.endDate : null;
4894
4881
  const safeStatus = element.status || "pending";
4895
4882
  const statusColor = getStatusColor(safeStatus);
4896
4883
  const statusLabel = getStatusLabel(safeStatus);
4884
+ const statusIcon = STATUS_META[safeStatus]?.icon;
4885
+ const toBuddhistDate = (d) => new Date(d.getFullYear() + 543, d.getMonth(), d.getDate());
4897
4886
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
4898
4887
  "div",
4899
4888
  {
4900
4889
  style: {
4901
- display: "grid",
4902
- gridTemplateColumns: "200px 100px 100px 100px",
4903
4890
  alignItems: "center",
4904
4891
  height: `${barHeight}px`,
4905
- fontSize: "12px",
4906
- marginBottom: `${barSpacing}px`
4892
+ marginBottom: `${barSpacing}px`,
4893
+ fontSize: "12px"
4907
4894
  },
4895
+ className: "body-1 grid grid-cols-[1fr_100px_130px] px-8 gap-2",
4908
4896
  children: [
4909
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
4910
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
4911
- "span",
4897
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: `grid ${mode === "project" ? "grid-cols-[10px_1fr]" : "grid-cols-[1fr]"} items-center gap-2`, children: [
4898
+ mode === "project" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
4899
+ "div",
4912
4900
  {
4913
4901
  style: {
4914
- display: "inline-block",
4915
- width: "10px",
4916
- height: "10px",
4917
- borderRadius: "50%",
4918
- backgroundColor: element.color || "#999"
4919
- }
4902
+ backgroundColor: element.color || "#E9E9E9"
4903
+ },
4904
+ className: "w-[10px] h-[10px] rounded-full"
4920
4905
  }
4921
4906
  ),
4922
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { style: { color: "#333" }, children: element.label })
4907
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "line-clamp-1 break-words text-[#333]", title: element.label, children: element.label })
4923
4908
  ] }),
4924
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { style: { color: "#666" }, children: formatThaiDate(safeStartDate) }),
4925
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { style: { color: "#666" }, children: formatThaiDate(safeEndDate) }),
4926
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
4927
- "button",
4928
- {
4929
- style: {
4930
- height: `${barHeight}px`,
4931
- minWidth: "100%",
4932
- padding: "4px 8px",
4933
- borderRadius: "4px",
4934
- fontSize: "11px",
4935
- backgroundColor: statusColor,
4936
- color: "#000",
4937
- border: "none",
4938
- cursor: "pointer"
4939
- },
4940
- children: statusLabel
4941
- }
4942
- )
4909
+ mode === "project" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: safeEndDate ? (0, import_date_fns3.format)(toBuddhistDate(safeEndDate), "dd MMM yyyy", { locale: import_locale3.th }) : "-" }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: `Q${(0, import_date_fns3.getQuarter)(
4910
+ safeEndDate ?? /* @__PURE__ */ new Date()
4911
+ )}/${(safeEndDate?.getFullYear() ?? 0) + 543}` }),
4912
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("button", { className: "rounded-md subtitile-1 flex gap-2 align-start", children: [
4913
+ statusIcon,
4914
+ statusLabel
4915
+ ] })
4943
4916
  ]
4944
4917
  },
4945
4918
  element.id
@@ -4954,42 +4927,52 @@ var RowOverlay = ({ data, barHeight, barSpacing, totalHeaderHeight }) => /* @__P
4954
4927
  left: 0,
4955
4928
  right: 0,
4956
4929
  height: `${data.length * (barHeight + barSpacing)}px`,
4957
- pointerEvents: "none",
4958
- zIndex: 5
4930
+ pointerEvents: "none"
4959
4931
  },
4960
- children: data.map((d, i) => {
4932
+ children: data.map((_, i) => {
4961
4933
  if (i === 0) return null;
4934
+ console.log("rendering row line", i);
4962
4935
  const yPos = i * (barHeight + barSpacing) - barSpacing / 2;
4963
4936
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
4964
4937
  "div",
4965
4938
  {
4939
+ className: "",
4966
4940
  style: {
4967
4941
  position: "absolute",
4968
4942
  top: `${yPos}px`,
4969
4943
  left: 0,
4970
4944
  right: 0,
4971
4945
  height: "1px",
4972
- backgroundColor: "#d0d0d0"
4946
+ backgroundColor: "#E9E9E9"
4973
4947
  }
4974
4948
  },
4975
- `row-line-${d.id}`
4949
+ `row-line-${i}`
4976
4950
  );
4977
4951
  })
4978
4952
  }
4979
4953
  );
4980
- var GanttChart = ({ data, width, height }) => {
4954
+ var GanttChart = ({
4955
+ data,
4956
+ width,
4957
+ mode
4958
+ }) => {
4981
4959
  const svgRef = (0, import_react24.useRef)(null);
4982
4960
  const leftPanelRef = (0, import_react24.useRef)(null);
4983
4961
  const dataContainerRef = (0, import_react24.useRef)(null);
4984
4962
  const [viewMode] = (0, import_react24.useState)("year");
4985
- const { barHeight, barSpacing, headersGroupLayer1Height, headersGroupLayer2Height } = LAYOUT;
4963
+ const {
4964
+ barHeight,
4965
+ barSpacing,
4966
+ headersGroupLayer1Height,
4967
+ headersGroupLayer2Height
4968
+ } = LAYOUT;
4986
4969
  const totalHeaderHeight = headersGroupLayer1Height + headersGroupLayer2Height;
4987
4970
  (0, import_react24.useEffect)(() => {
4988
4971
  if (!data || !svgRef.current) return;
4989
4972
  const margin = { top: 0, right: 20, bottom: 20, left: 20 };
4990
4973
  const chartHeight = data.length * (barHeight + barSpacing) + margin.top + margin.bottom;
4991
4974
  const containerWidth = width * 2;
4992
- const containerHeight = totalHeaderHeight + chartHeight;
4975
+ const containerHeight = totalHeaderHeight + chartHeight > 590 ? totalHeaderHeight + chartHeight : 590;
4993
4976
  const borderRadius = 5;
4994
4977
  if (leftPanelRef.current) {
4995
4978
  leftPanelRef.current.style.height = `${containerHeight}px`;
@@ -5002,23 +4985,31 @@ var GanttChart = ({ data, width, height }) => {
5002
4985
  const chartGroup = svg.append("g").attr("transform", `translate(${margin.left}, ${totalHeaderHeight})`);
5003
4986
  const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
5004
4987
  const domainStart = (0, import_date_fns3.startOfDay)((0, import_date_fns3.startOfYear)(new Date(currentYear, 0, 1)));
5005
- const domainEnd = (0, import_date_fns3.startOfDay)((0, import_date_fns3.addDays)((0, import_date_fns3.endOfYear)(new Date(currentYear, 0, 1)), 1));
4988
+ const domainEnd = (0, import_date_fns3.startOfDay)(
4989
+ (0, import_date_fns3.addDays)((0, import_date_fns3.endOfYear)(new Date(currentYear, 0, 1)), 1)
4990
+ );
5006
4991
  const xScale = d33.scaleTime().domain([domainStart, domainEnd]).range([0, containerWidth - margin.left - margin.right]);
5007
4992
  const buildTimeBuckets = (domain) => ({
5008
4993
  uniqueYears: d33.timeYear.every(1)?.range(domain[0], domain[1]) || [],
5009
4994
  uniqueMonths: d33.timeMonth.every(1)?.range(domain[0], domain[1]) || [],
5010
- uniqueWeeks: (0, import_date_fns3.eachWeekOfInterval)({ start: domain[0], end: domain[1] }, { weekStartsOn: 1 }),
5011
- uniqueDays: d33.timeDay.range((0, import_date_fns3.startOfDay)(domain[0]), (0, import_date_fns3.startOfDay)((0, import_date_fns3.addDays)(domain[1], 1))) || []
4995
+ uniqueWeeks: (0, import_date_fns3.eachWeekOfInterval)(
4996
+ { start: domain[0], end: domain[1] },
4997
+ { weekStartsOn: 1 }
4998
+ ),
4999
+ uniqueDays: d33.timeDay.range(
5000
+ (0, import_date_fns3.startOfDay)(domain[0]),
5001
+ (0, import_date_fns3.startOfDay)((0, import_date_fns3.addDays)(domain[1], 1))
5002
+ ) || []
5012
5003
  });
5013
5004
  const renderYearHeaders = (layer1, layer2, newXScale, buckets) => {
5014
5005
  layer1.selectAll(".year-bg").data(buckets.uniqueYears).enter().append("rect").attr("class", "year-bg").attr("x", (d) => newXScale(d)).attr("y", -totalHeaderHeight).attr("width", (d) => {
5015
5006
  const nextYearStart = (0, import_date_fns3.startOfDay)(new Date(d.getFullYear() + 1, 0, 1));
5016
5007
  return newXScale(nextYearStart) - newXScale(d);
5017
- }).attr("height", headersGroupLayer1Height).style("fill", "#fff").style("stroke", "#999").style("stroke-width", 1);
5008
+ }).attr("height", headersGroupLayer1Height).style("fill", "#fff").style("stroke", "#E9E9E9").style("stroke-width", 1);
5018
5009
  layer1.selectAll(".year-label").data(buckets.uniqueYears).enter().append("text").attr("class", "year-label").attr("x", (d) => {
5019
5010
  const nextYear = new Date(d.getFullYear() + 1, 0, 1);
5020
5011
  return newXScale(d) + (newXScale(nextYear) - newXScale(d)) / 2;
5021
- }).attr("y", -totalHeaderHeight + headersGroupLayer1Height / 2).attr("dy", "0.35em").attr("text-anchor", "middle").style("font-size", `${HEADER_FONTS.layer1}px`).style("font-weight", "bold").style("fill", "#0066cc").text((d) => `${d.getFullYear() + 543}`);
5012
+ }).attr("y", -totalHeaderHeight + headersGroupLayer1Height / 2).attr("dy", "0.35em").attr("text-anchor", "middle").style("font-size", `${HEADER_FONTS.layer1 + 2}px`).style("font-weight", "regular").style("fill", "#000").text((d) => `${d.getFullYear() + 543}`);
5022
5013
  const quarters2 = [];
5023
5014
  buckets.uniqueYears.forEach((year) => {
5024
5015
  for (let q = 0; q < 4; q++) {
@@ -5026,75 +5017,36 @@ var GanttChart = ({ data, width, height }) => {
5026
5017
  }
5027
5018
  });
5028
5019
  layer2.selectAll(".quarter-bg").data(quarters2).enter().append("rect").attr("class", "quarter-bg").attr("x", (d) => newXScale(d)).attr("y", -headersGroupLayer2Height).attr("width", (d) => {
5029
- const nextQuarter = (0, import_date_fns3.startOfDay)(new Date(d.getFullYear(), d.getMonth() + 3, 1));
5020
+ const nextQuarter = (0, import_date_fns3.startOfDay)(
5021
+ new Date(d.getFullYear(), d.getMonth() + 3, 1)
5022
+ );
5030
5023
  return newXScale(nextQuarter) - newXScale(d);
5031
- }).attr("height", headersGroupLayer2Height).style("fill", "#fff").style("stroke", "#999").style("stroke-width", 1);
5024
+ }).attr("height", headersGroupLayer2Height).style("fill", "#fff").style("stroke", "#E9E9E9").style("stroke-width", 1);
5032
5025
  layer2.selectAll(".quarter-label").data(quarters2).enter().append("text").attr("class", "quarter-label").attr("x", (d) => {
5033
- const nextQuarter = (0, import_date_fns3.startOfDay)(new Date(d.getFullYear(), d.getMonth() + 3, 1));
5026
+ const nextQuarter = (0, import_date_fns3.startOfDay)(
5027
+ new Date(d.getFullYear(), d.getMonth() + 3, 1)
5028
+ );
5034
5029
  return newXScale(d) + (newXScale(nextQuarter) - newXScale(d)) / 2;
5035
- }).attr("y", -headersGroupLayer2Height / 2).attr("dy", "0.35em").attr("text-anchor", "middle").style("font-size", `${HEADER_FONTS.layer2}px`).style("font-weight", "bold").style("fill", "#0088cc").text((d) => `\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A ${Math.floor(d.getMonth() / 3) + 1}`);
5036
- };
5037
- const renderMonthHeaders = (layer1, layer2, newXScale, buckets) => {
5038
- layer1.selectAll(".month-bg").data(buckets.uniqueMonths).enter().append("rect").attr("class", "month-bg").attr("x", (d) => newXScale(d)).attr("y", -totalHeaderHeight).attr("width", (d) => {
5039
- const nextMonth = (0, import_date_fns3.startOfDay)(new Date(d.getFullYear(), d.getMonth() + 1, 1));
5040
- return newXScale(nextMonth) - newXScale(d) + 11;
5041
- }).attr("height", headersGroupLayer1Height).style("fill", "#fff").style("stroke", "#999").style("stroke-width", 1);
5042
- layer1.selectAll(".month-label").data(buckets.uniqueMonths).enter().append("text").attr("class", "month-label").attr("x", (d) => {
5043
- const nextMonth = (0, import_date_fns3.startOfDay)(new Date(d.getFullYear(), d.getMonth() + 1, 1));
5044
- return newXScale(d) + (newXScale(nextMonth) - newXScale(d)) / 2;
5045
- }).attr("y", -totalHeaderHeight + headersGroupLayer1Height / 2).attr("dy", "0.35em").attr("text-anchor", "middle").style("font-size", `${HEADER_FONTS.layer1}px`).style("font-weight", "bold").style("fill", "#0066cc").text((d) => `${formatThaiMonth(d)} ${d.getFullYear() + 543}`);
5046
- layer2.selectAll(".week-bg").data(buckets.uniqueWeeks).enter().append("rect").attr("class", "week-bg").attr("x", (d) => newXScale(d)).attr("y", -headersGroupLayer2Height).attr("width", (d) => {
5047
- const weekEnd = (0, import_date_fns3.startOfDay)((0, import_date_fns3.addDays)(d, 7));
5048
- return newXScale(weekEnd) - newXScale(d) + 1;
5049
- }).attr("height", headersGroupLayer2Height).style("fill", "#fff").style("stroke", "#999").style("stroke-width", 1);
5050
- layer2.selectAll(".week-label").data(buckets.uniqueWeeks).enter().append("text").attr("class", "week-label").attr("x", (d) => {
5051
- const weekEnd = (0, import_date_fns3.startOfDay)((0, import_date_fns3.addDays)(d, 7));
5052
- return newXScale(d) + (newXScale(weekEnd) - newXScale(d)) / 2;
5053
- }).attr("y", -headersGroupLayer2Height / 2).attr("dy", "0.35em").attr("text-anchor", "middle").style("font-size", `${HEADER_FONTS.layer2}px`).style("font-weight", "bold").style("fill", "#0088cc").text((d) => `\u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C\u0E17\u0E35\u0E48 ${(0, import_date_fns3.getWeek)(d, { weekStartsOn: 1 })}`);
5054
- };
5055
- const renderWeekHeaders = (layer1, layer2, newXScale, buckets) => {
5056
- layer1.selectAll(".week-bg").data(buckets.uniqueWeeks).enter().append("rect").attr("class", "week-bg").attr("x", (d) => newXScale(d)).attr("y", -totalHeaderHeight).attr("width", (d) => {
5057
- const weekEnd = (0, import_date_fns3.startOfDay)((0, import_date_fns3.addDays)(d, 7));
5058
- return newXScale(weekEnd) - newXScale(d);
5059
- }).attr("height", headersGroupLayer1Height).style("fill", "#fff").style("stroke", "#999").style("stroke-width", 1);
5060
- layer1.selectAll(".week-label").data(buckets.uniqueWeeks).enter().append("text").attr("class", "week-label").attr("x", (d) => {
5061
- const weekEnd = (0, import_date_fns3.startOfDay)((0, import_date_fns3.addDays)(d, 7));
5062
- return newXScale(d) + (newXScale(weekEnd) - newXScale(d)) / 2;
5063
- }).attr("y", -totalHeaderHeight + headersGroupLayer1Height / 2).attr("dy", "0.35em").attr("text-anchor", "middle").style("font-size", `${HEADER_FONTS.layer1}px`).style("font-weight", "bold").style("fill", "#0066cc").text((d) => `\u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C\u0E17\u0E35\u0E48 ${(0, import_date_fns3.getWeek)(d, { weekStartsOn: 1 })}`);
5064
- layer2.selectAll(".day-bg").data(buckets.uniqueDays).enter().append("rect").attr("class", "day-bg").attr("x", (d) => newXScale(d)).attr("y", -headersGroupLayer2Height).attr("width", (d) => {
5065
- const nextDay = (0, import_date_fns3.startOfDay)((0, import_date_fns3.addDays)(d, 1));
5066
- return newXScale(nextDay) - newXScale(d);
5067
- }).attr("height", headersGroupLayer2Height).style("fill", "#fff").style("stroke", "#999").style("stroke-width", 1);
5068
- layer2.selectAll(".day-of-week").data(buckets.uniqueDays).enter().append("text").attr("class", "day-of-week").attr("x", (d) => {
5069
- const nextDay = (0, import_date_fns3.startOfDay)((0, import_date_fns3.addDays)(d, 1));
5070
- return newXScale(d) + (newXScale(nextDay) - newXScale(d)) / 2;
5071
- }).attr("y", -headersGroupLayer2Height / 2).attr("text-anchor", "middle").style("font-size", `${HEADER_FONTS.layer2}px`).style("font-weight", "bold").style("fill", "#0088cc").each(function(d) {
5072
- const textElement = d33.select(this);
5073
- textElement.text("");
5074
- textElement.append("tspan").text(THAI_DAYS[d.getDay()]).attr("x", textElement.attr("x")).attr("dy", "-0.3em");
5075
- textElement.append("tspan").text((0, import_date_fns3.format)(d, "d")).attr("x", textElement.attr("x")).attr("dy", "1.2em");
5076
- });
5030
+ }).attr("y", -headersGroupLayer2Height / 2).attr("dy", "0.35em").attr("text-anchor", "middle").style("font-size", `${HEADER_FONTS.layer2 + 3}px`).style("font-weight", "regular").style("fill", "#000").text((d) => `\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A ${Math.floor(d.getMonth() / 3) + 1}`);
5077
5031
  };
5078
5032
  const drawHeaders = (layer1, layer2, newXScale, buckets) => {
5079
- if (viewMode === "year") return renderYearHeaders(layer1, layer2, newXScale, buckets);
5080
- if (viewMode === "month") return renderMonthHeaders(layer1, layer2, newXScale, buckets);
5081
- return renderWeekHeaders(layer1, layer2, newXScale, buckets);
5033
+ return renderYearHeaders(layer1, layer2, newXScale, buckets);
5082
5034
  };
5083
- const getGridlineData = (mode, buckets, domain) => {
5084
- if (mode === "year") return buckets.uniqueMonths;
5085
- if (mode === "month") return buckets.uniqueWeeks;
5086
- if (mode === "week") return buckets.uniqueDays;
5035
+ const getGridlineData = (mode2, buckets, domain) => {
5036
+ if (mode2 === "year") return buckets.uniqueMonths;
5037
+ if (mode2 === "month") return buckets.uniqueWeeks;
5038
+ if (mode2 === "week") return buckets.uniqueDays;
5087
5039
  return (0, import_date_fns3.eachHourOfInterval)({ start: domain[0], end: domain[1] });
5088
5040
  };
5089
5041
  const drawGridlines = (group, gridlineData, newXScale) => {
5090
- group.selectAll(".gridline").data(gridlineData).enter().append("line").attr("class", "gridline").attr("x1", (d) => newXScale(d)).attr("x2", (d) => newXScale(d)).attr("y1", 0).attr("y2", chartHeight - margin.top - margin.bottom).attr("stroke", "#000").attr("stroke-width", 1).style("opacity", 0.3);
5042
+ group.selectAll(".gridline").data(gridlineData).enter().append("line").attr("class", "gridline").attr("x1", (d) => newXScale(d)).attr("x2", (d) => newXScale(d)).attr("y1", 0).attr("y2", containerHeight).attr("stroke", "#E9E9E9").attr("stroke-width", 1);
5091
5043
  };
5092
5044
  const drawRowSeparators = (group, getYPosition) => {
5093
5045
  const rowSeparatorGroup = group.append("g").attr("class", "row-separators");
5094
5046
  data.forEach((_d, i) => {
5095
5047
  if (i === 0) return;
5096
5048
  const y = getYPosition(i) - barSpacing / 2;
5097
- rowSeparatorGroup.append("line").attr("x1", 0).attr("x2", containerWidth - margin.left - margin.right).attr("y1", y).attr("y2", y).attr("stroke", "#d0d0d0").attr("stroke-width", 1).style("pointer-events", "none");
5049
+ rowSeparatorGroup.append("line").attr("x1", 0).attr("x2", containerWidth - margin.left - margin.right).attr("y1", y).attr("y2", y).attr("stroke", "#E9E9E9").attr("stroke-width", 1).style("pointer-events", "none");
5098
5050
  });
5099
5051
  rowSeparatorGroup.lower();
5100
5052
  };
@@ -5102,16 +5054,27 @@ var GanttChart = ({ data, width, height }) => {
5102
5054
  const barsGroup = group.append("g").attr("class", "bars-group");
5103
5055
  const renderBarHeight = barHeight;
5104
5056
  const labelPadding = 10;
5105
- barsGroup.selectAll(".bar-background").data(data).enter().append("rect").attr("class", "bar-background").attr("x", (d) => newXScale(getAdjustedStart(d))).attr("y", (_d, i) => getYPosition(i)).attr("height", renderBarHeight).attr("width", (d) => newXScale(getAdjustedEnd(d)) - newXScale(getAdjustedStart(d))).attr("fill", (d) => getStatusColor(d.status)).attr("rx", borderRadius).attr("ry", borderRadius);
5106
- barsGroup.selectAll(".bar-head").data(data).enter().append("path").attr("class", "bar-head").attr("fill", (d) => d.color).attr("d", (d, i) => {
5107
- const x = newXScale(getAdjustedStart(d));
5108
- const y = getYPosition(i);
5109
- const barWidth = newXScale(getAdjustedEnd(d)) - newXScale(getAdjustedStart(d));
5110
- const headWidth = Math.min(barWidth * 0.5, 20);
5111
- return roundedRectPath(x, y, headWidth, renderBarHeight, borderRadius);
5112
- });
5057
+ barsGroup.selectAll(".bar-background").data(data).enter().append("rect").attr("class", "bar-background").attr("x", (d) => newXScale(getAdjustedStart(d))).attr("y", (_d, i) => getYPosition(i)).attr("height", renderBarHeight).attr(
5058
+ "width",
5059
+ (d) => newXScale(getAdjustedEnd(d)) - newXScale(getAdjustedStart(d))
5060
+ ).attr("fill", (d) => getStatusColor(d.status)).attr("rx", borderRadius).attr("ry", borderRadius);
5061
+ {
5062
+ mode === "project" && barsGroup.selectAll(".bar-head").data(data).enter().append("path").attr("class", "bar-head").attr("fill", (d) => d.color).attr("d", (d, i) => {
5063
+ const x = newXScale(getAdjustedStart(d));
5064
+ const y = getYPosition(i);
5065
+ const barWidth = newXScale(getAdjustedEnd(d)) - newXScale(getAdjustedStart(d));
5066
+ const headWidth = Math.min(barWidth * 0.5, 20);
5067
+ return roundedRectPath(
5068
+ x,
5069
+ y,
5070
+ headWidth,
5071
+ renderBarHeight,
5072
+ borderRadius
5073
+ );
5074
+ });
5075
+ }
5113
5076
  const labels = group.append("g").attr("class", "labels");
5114
- const labelSelection = labels.selectAll(".label").data(data).enter().append("text").attr("class", "label").attr("y", (_d, i) => getYPosition(i) + renderBarHeight / 2).attr("dy", "0.35em").text((d) => d.label).style("fill", "black").style("font-size", "12px").style("pointer-events", "none");
5077
+ const labelSelection = labels.selectAll(".label").data(data).enter().append("text").attr("class", "label").attr("y", (_d, i) => getYPosition(i) + renderBarHeight / 2).attr("dy", "0.35em").text((d) => d.label).style("fill", "black").style("font-weight", "400").style("pointer-events", "none");
5115
5078
  labelSelection.each(function(d) {
5116
5079
  const barWidth = newXScale(getAdjustedEnd(d)) - newXScale(getAdjustedStart(d));
5117
5080
  const headWidth = Math.min(barWidth * 0.5, 20);
@@ -5134,8 +5097,17 @@ var GanttChart = ({ data, width, height }) => {
5134
5097
  const timeBuckets = buildTimeBuckets(newXScale.domain());
5135
5098
  const headersGroupLayer1 = chartGroup.append("g");
5136
5099
  const headersGroupLayer2 = chartGroup.append("g");
5137
- drawHeaders(headersGroupLayer1, headersGroupLayer2, newXScale, timeBuckets);
5138
- const gridlineData = getGridlineData(viewMode, timeBuckets, newXScale.domain());
5100
+ drawHeaders(
5101
+ headersGroupLayer1,
5102
+ headersGroupLayer2,
5103
+ newXScale,
5104
+ timeBuckets
5105
+ );
5106
+ const gridlineData = getGridlineData(
5107
+ viewMode,
5108
+ timeBuckets,
5109
+ newXScale.domain()
5110
+ );
5139
5111
  drawGridlines(headersGroupLayer2, gridlineData, newXScale);
5140
5112
  drawRowSeparators(chartGroup, getYPosition);
5141
5113
  drawBarsAndLabels(chartGroup, newXScale, getYPosition);
@@ -5153,7 +5125,6 @@ var GanttChart = ({ data, width, height }) => {
5153
5125
  }, [
5154
5126
  data,
5155
5127
  width,
5156
- height,
5157
5128
  viewMode,
5158
5129
  barHeight,
5159
5130
  barSpacing,
@@ -5164,13 +5135,13 @@ var GanttChart = ({ data, width, height }) => {
5164
5135
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5165
5136
  "div",
5166
5137
  {
5138
+ className: "body-1",
5167
5139
  style: {
5168
5140
  display: "flex",
5169
5141
  flexDirection: "column",
5170
- padding: "20px",
5171
5142
  width: `${width}px`,
5172
- height: `${height}px`,
5173
- border: "1px solid #ccc",
5143
+ height: `590px`,
5144
+ border: "1px solid #E9E9E9",
5174
5145
  borderRadius: "10px",
5175
5146
  backgroundColor: "#fff",
5176
5147
  overflow: "hidden"
@@ -5186,49 +5157,69 @@ var GanttChart = ({ data, width, height }) => {
5186
5157
  position: "relative"
5187
5158
  },
5188
5159
  children: [
5189
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(RowOverlay, { data, barHeight, barSpacing, totalHeaderHeight }),
5160
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "z-1", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5161
+ RowOverlay,
5162
+ {
5163
+ data: data.length > 10 ? data : ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"],
5164
+ barHeight,
5165
+ barSpacing,
5166
+ totalHeaderHeight
5167
+ }
5168
+ ) }),
5190
5169
  /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
5191
5170
  "div",
5192
5171
  {
5193
5172
  ref: leftPanelRef,
5173
+ className: "border-r",
5194
5174
  style: {
5195
5175
  width: "520px",
5196
5176
  minWidth: "500px",
5197
5177
  display: "flex",
5198
5178
  flexDirection: "column",
5199
5179
  backgroundColor: "#fff",
5200
- borderRight: "1px solid #ddd",
5201
5180
  zIndex: 2
5202
5181
  },
5203
5182
  children: [
5204
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
5205
- "div",
5206
- {
5207
- style: {
5208
- display: "grid",
5209
- gridTemplateColumns: "200px 100px 100px 100px",
5210
- fontSize: "12px",
5211
- fontWeight: "bold",
5212
- color: "#666",
5213
- backgroundColor: "#fafafa",
5214
- borderBottom: "2px solid #ddd",
5215
- padding: "0 8px",
5216
- height: `${totalHeaderHeight}px`,
5217
- marginBottom: "10px",
5218
- position: "sticky",
5219
- top: 0,
5220
- alignItems: "center",
5221
- boxSizing: "border-box"
5183
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { ref: dataContainerRef, children: [
5184
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
5185
+ "div",
5186
+ {
5187
+ className: "grid body-2 grid-cols-[1fr_100px_130px] gap-2 px-8 border-b bg-white",
5188
+ style: {
5189
+ height: `${totalHeaderHeight}px`,
5190
+ marginBottom: "10px",
5191
+ position: "sticky",
5192
+ top: 0,
5193
+ alignItems: "center",
5194
+ zIndex: 5
5195
+ },
5196
+ children: [
5197
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: "\u0E42\u0E04\u0E23\u0E07\u0E01\u0E32\u0E23" }),
5198
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: "\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E2A\u0E48\u0E07" }),
5199
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: "\u0E2A\u0E16\u0E32\u0E19\u0E30" })
5200
+ ]
5201
+ }
5202
+ ),
5203
+ data.map((element) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5204
+ ProjectRow,
5205
+ {
5206
+ mode,
5207
+ element,
5208
+ barHeight,
5209
+ barSpacing
5222
5210
  },
5223
- children: [
5224
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: "\u0E42\u0E04\u0E23\u0E07\u0E01\u0E32\u0E23" }),
5225
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: "\u0E27\u0E31\u0E19\u0E40\u0E23\u0E34\u0E48\u0E21" }),
5226
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: "\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E2A\u0E48\u0E07" }),
5227
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: "\u0E2A\u0E16\u0E32\u0E19\u0E30" })
5228
- ]
5211
+ element.id
5212
+ ))
5213
+ ] }),
5214
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "z-3", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5215
+ RowOverlay,
5216
+ {
5217
+ data,
5218
+ barHeight,
5219
+ barSpacing,
5220
+ totalHeaderHeight
5229
5221
  }
5230
- ),
5231
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { ref: dataContainerRef, children: data.map((element) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ProjectRow, { element, barHeight, barSpacing }, element.id)) })
5222
+ ) })
5232
5223
  ]
5233
5224
  }
5234
5225
  ),
@@ -5263,7 +5254,7 @@ var GanttChart = ({ data, width, height }) => {
5263
5254
  };
5264
5255
 
5265
5256
  // src/CardKPI/CardKPI/CardKPI.tsx
5266
- var import_icons_react15 = require("@tabler/icons-react");
5257
+ var import_icons_react16 = require("@tabler/icons-react");
5267
5258
  var import_react25 = require("react");
5268
5259
  var import_jsx_runtime49 = require("react/jsx-runtime");
5269
5260
  function KPIRow({ item }) {
@@ -5274,7 +5265,7 @@ function KPIRow({ item }) {
5274
5265
  children: [
5275
5266
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "line-clamp-2", children: item.textValue }),
5276
5267
  item.inputType === "NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "flex", children: `${item.currentValue}/${item.numberValue} ${item.unit}` }),
5277
- item.inputType === "NUMBER" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ProgressBar, { percent: Math.floor(item.currentValue * 100 / (item.numberValue ?? 1)), type: "circle", checkpoints: [0] }) }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx_runtime49.Fragment, { children: item.currentValue !== 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_icons_react15.IconCheckbox, { className: "text-green-500 flex justify-center w-full", size: 30 }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_icons_react15.IconSquare, { className: "text-gray-200 flex justify-center w-full", size: 30 }) })
5268
+ item.inputType === "NUMBER" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ProgressBar, { percent: Math.floor(item.currentValue * 100 / (item.numberValue ?? 1)), type: "circle", checkpoints: [0] }) }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx_runtime49.Fragment, { children: item.currentValue !== 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_icons_react16.IconCheckbox, { className: "text-green-500 flex justify-center w-full", size: 30 }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_icons_react16.IconSquare, { className: "text-gray-200 flex justify-center w-full", size: 30 }) })
5278
5269
  ]
5279
5270
  }
5280
5271
  );
@@ -5310,7 +5301,7 @@ function CardKPI({
5310
5301
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ProgressBar, { percent: overallPercent, type: "line", checkpoints: [0] })
5311
5302
  ] }),
5312
5303
  /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "border-b", children: [
5313
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "body-2 ", children: "\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C" }),
5304
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "body-2 ", children: "\u0E01\u0E25\u0E38\u0E48\u0E21\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22" }),
5314
5305
  indicator.filter((ind) => ind.indicatorType === "TARGET").map((item, index) => {
5315
5306
  if (index === 2) return;
5316
5307
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(KPIRow, { item });
@@ -5323,9 +5314,8 @@ function CardKPI({
5323
5314
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(KPIRow, { item });
5324
5315
  })
5325
5316
  ] }),
5326
- indicator.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "text-sm text-gray-500 italic", children: "\u0E44\u0E21\u0E48\u0E21\u0E35\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E42\u0E04\u0E23\u0E07\u0E01\u0E32\u0E23" }),
5327
5317
  indicator.filter((item) => item.indicatorType === "TARGET").length > 2 || indicator.filter((item) => item.indicatorType === "OUTPUT").length > 2 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "bottom-0 right-1/2 absolute text-gray-300", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5328
- import_icons_react15.IconDots,
5318
+ import_icons_react16.IconDots,
5329
5319
  {
5330
5320
  className: "cursor-pointer",
5331
5321
  onClick: () => setIsOpen(true)