@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/assets/STO-logo.svg +92 -92
- package/dist/index.css +49 -2
- package/dist/index.d.mts +14 -8
- package/dist/index.d.ts +14 -8
- package/dist/index.js +223 -233
- package/dist/index.mjs +228 -239
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -358,7 +358,8 @@ function PrimaryButton({
|
|
|
358
358
|
colorPrimary = "#4e61f6",
|
|
359
359
|
colorPrimaryHover = "#8895f9",
|
|
360
360
|
textColor = "#ffffff",
|
|
361
|
-
icon
|
|
361
|
+
icon,
|
|
362
|
+
className
|
|
362
363
|
}) {
|
|
363
364
|
const textClass = size === "large" ? "body-1" : "body-3";
|
|
364
365
|
return /* @__PURE__ */ jsx(
|
|
@@ -377,7 +378,7 @@ function PrimaryButton({
|
|
|
377
378
|
size,
|
|
378
379
|
onClick,
|
|
379
380
|
type: "primary",
|
|
380
|
-
className: textClass
|
|
381
|
+
className: `${textClass} ${className ?? ""}`,
|
|
381
382
|
disabled,
|
|
382
383
|
icon,
|
|
383
384
|
iconPosition: iconPlacement,
|
|
@@ -401,7 +402,8 @@ function SecondaryButton({
|
|
|
401
402
|
defaultHoverBorderColor = "#7181f8",
|
|
402
403
|
defaultHoverColor = "#7181f8",
|
|
403
404
|
textColor = "rgba(0,0,0,0.88)",
|
|
404
|
-
icon
|
|
405
|
+
icon,
|
|
406
|
+
className
|
|
405
407
|
}) {
|
|
406
408
|
const textClass = size === "large" ? "body-1" : "body-3";
|
|
407
409
|
return /* @__PURE__ */ jsx2(
|
|
@@ -425,7 +427,7 @@ function SecondaryButton({
|
|
|
425
427
|
size,
|
|
426
428
|
onClick,
|
|
427
429
|
type: "default",
|
|
428
|
-
className: textClass
|
|
430
|
+
className: `${textClass} ${className ?? ""}`,
|
|
429
431
|
disabled,
|
|
430
432
|
icon,
|
|
431
433
|
iconPosition: iconPlacement,
|
|
@@ -483,7 +485,8 @@ function TertiaryButton({
|
|
|
483
485
|
colorPrimary = "#000",
|
|
484
486
|
colorPrimaryHover = "#4d5461",
|
|
485
487
|
textColor = "white",
|
|
486
|
-
icon
|
|
488
|
+
icon,
|
|
489
|
+
className
|
|
487
490
|
}) {
|
|
488
491
|
const textClass = size === "large" ? "body-1" : "body-3";
|
|
489
492
|
return /* @__PURE__ */ jsx5(
|
|
@@ -502,7 +505,7 @@ function TertiaryButton({
|
|
|
502
505
|
size,
|
|
503
506
|
onClick,
|
|
504
507
|
type: "primary",
|
|
505
|
-
className: textClass
|
|
508
|
+
className: `${textClass} ${className ?? ""}`,
|
|
506
509
|
disabled,
|
|
507
510
|
icon,
|
|
508
511
|
iconPosition: iconPlacement,
|
|
@@ -552,9 +555,9 @@ function Checkbox({ label, checked, onChange, disabled }) {
|
|
|
552
555
|
/* @__PURE__ */ jsx7(
|
|
553
556
|
"div",
|
|
554
557
|
{
|
|
555
|
-
className: `flex justify-center items-center border-[1px] border-
|
|
556
|
-
${checked ? "bg-
|
|
557
|
-
${disabled ? "pointer-events-none" : ""}`,
|
|
558
|
+
className: `flex justify-center items-center border-[1px] border-gray-400 w-[24px] h-[24px] rounded-[8px] transition-colors duration-100
|
|
559
|
+
${checked ? "bg-primary-500 text-white border-primary-500" : "bg-white text-black"}
|
|
560
|
+
${disabled ? "pointer-events-none !bg-gray-300" : ""}`,
|
|
558
561
|
children: /* @__PURE__ */ jsx7(
|
|
559
562
|
"span",
|
|
560
563
|
{
|
|
@@ -1274,8 +1277,26 @@ function InputFieldNumber({
|
|
|
1274
1277
|
size,
|
|
1275
1278
|
changeOnWheel,
|
|
1276
1279
|
formatter,
|
|
1277
|
-
parser
|
|
1280
|
+
parser,
|
|
1281
|
+
decimal = false,
|
|
1282
|
+
decimalScale = 2,
|
|
1283
|
+
format: format5 = "number"
|
|
1278
1284
|
}) {
|
|
1285
|
+
const safeScale = Math.max(0, Math.min(decimalScale, 10));
|
|
1286
|
+
const addComma = (s) => s.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
1287
|
+
const defaultFormatter = (v) => {
|
|
1288
|
+
if (v === void 0 || v === null || v === "") return "";
|
|
1289
|
+
const num = Number(v);
|
|
1290
|
+
if (Number.isNaN(num)) return "";
|
|
1291
|
+
const base = !decimal ? Math.trunc(num).toString() : num.toFixed(safeScale);
|
|
1292
|
+
return format5 === "currency" ? addComma(base) : base;
|
|
1293
|
+
};
|
|
1294
|
+
const defaultParser = (v) => {
|
|
1295
|
+
if (!v) return "";
|
|
1296
|
+
const raw = v.replace(/,/g, "").replace(/\s/g, "");
|
|
1297
|
+
if (!decimal) return raw.split(".")[0];
|
|
1298
|
+
return raw.replace(/[^\d.]/g, "");
|
|
1299
|
+
};
|
|
1279
1300
|
return /* @__PURE__ */ jsx23(
|
|
1280
1301
|
ConfigProvider7,
|
|
1281
1302
|
{
|
|
@@ -1306,17 +1327,9 @@ function InputFieldNumber({
|
|
|
1306
1327
|
controls,
|
|
1307
1328
|
size,
|
|
1308
1329
|
changeOnWheel,
|
|
1309
|
-
formatter: formatter ??
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
const num = Number(value2);
|
|
1313
|
-
if (isNaN(num)) return "";
|
|
1314
|
-
return num.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
1315
|
-
}),
|
|
1316
|
-
parser: parser ?? ((value2) => {
|
|
1317
|
-
if (!value2) return "";
|
|
1318
|
-
return value2.replace(/,/g, "");
|
|
1319
|
-
})
|
|
1330
|
+
formatter: formatter ?? defaultFormatter,
|
|
1331
|
+
parser: parser ?? defaultParser,
|
|
1332
|
+
precision: decimal ? safeScale : 0
|
|
1320
1333
|
}
|
|
1321
1334
|
),
|
|
1322
1335
|
error && /* @__PURE__ */ jsx23("p", { className: "text-red-500 caption-1", children: error })
|
|
@@ -3810,13 +3823,7 @@ function AntDModal({ children, isOpen, width, onCancel }) {
|
|
|
3810
3823
|
}
|
|
3811
3824
|
|
|
3812
3825
|
// src/Indicator/Indicator/Indicator.tsx
|
|
3813
|
-
import {
|
|
3814
|
-
IconCheck as IconCheck3,
|
|
3815
|
-
IconCirclePlus as IconCirclePlus2,
|
|
3816
|
-
IconPencil as IconPencil2,
|
|
3817
|
-
IconTrash as IconTrash4,
|
|
3818
|
-
IconX as IconX3
|
|
3819
|
-
} from "@tabler/icons-react";
|
|
3826
|
+
import { IconCheck as IconCheck3, IconCirclePlus as IconCirclePlus2, IconTrash as IconTrash4, IconX as IconX3 } from "@tabler/icons-react";
|
|
3820
3827
|
import { useState as useState16 } from "react";
|
|
3821
3828
|
import { Input as Input4 } from "antd";
|
|
3822
3829
|
import { Fragment as Fragment7, jsx as jsx41, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
@@ -3893,7 +3900,6 @@ function Indicator({
|
|
|
3893
3900
|
...prev,
|
|
3894
3901
|
[key]: value
|
|
3895
3902
|
}));
|
|
3896
|
-
console.log(cacheData);
|
|
3897
3903
|
};
|
|
3898
3904
|
const handleClick = (active) => {
|
|
3899
3905
|
handleChangeCashData("inputType", active);
|
|
@@ -3945,7 +3951,6 @@ function Indicator({
|
|
|
3945
3951
|
...prev,
|
|
3946
3952
|
[name]: value
|
|
3947
3953
|
}));
|
|
3948
|
-
console.log(cacheEditData);
|
|
3949
3954
|
};
|
|
3950
3955
|
return /* @__PURE__ */ jsxs32("div", { className: "w-full", children: [
|
|
3951
3956
|
/* @__PURE__ */ jsxs32(
|
|
@@ -3953,27 +3958,18 @@ function Indicator({
|
|
|
3953
3958
|
{
|
|
3954
3959
|
className: `space-x-2 grid ${valueSwitch === "TEXT" ? `grid-cols-[140px_1fr_50px]` : `grid-cols-[140px_1fr_200px_200px_50px]`} items-start`,
|
|
3955
3960
|
children: [
|
|
3956
|
-
/* @__PURE__ */ jsx41(
|
|
3957
|
-
SwitchSelect,
|
|
3958
|
-
{
|
|
3959
|
-
option,
|
|
3960
|
-
onClick: handleClick,
|
|
3961
|
-
value: valueSwitch,
|
|
3962
|
-
label: "\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17",
|
|
3963
|
-
required: true
|
|
3964
|
-
}
|
|
3965
|
-
),
|
|
3961
|
+
/* @__PURE__ */ jsx41(SwitchSelect, { option, onClick: handleClick, value: valueSwitch, label: "\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17", required: true }),
|
|
3966
3962
|
/* @__PURE__ */ jsx41(
|
|
3967
3963
|
InputField,
|
|
3968
3964
|
{
|
|
3969
|
-
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"}`,
|
|
3965
|
+
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"}`,
|
|
3970
3966
|
value: cacheData.textValue,
|
|
3971
3967
|
className: "h-[32px]",
|
|
3972
3968
|
onChange: (val) => {
|
|
3973
3969
|
handleChangeCashData("textValue", val ?? "");
|
|
3974
3970
|
setAddError((p) => ({ ...p, textValue: void 0 }));
|
|
3975
3971
|
},
|
|
3976
|
-
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"}`,
|
|
3972
|
+
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"}`,
|
|
3977
3973
|
required: true,
|
|
3978
3974
|
error: addError.textValue
|
|
3979
3975
|
}
|
|
@@ -3982,7 +3978,7 @@ function Indicator({
|
|
|
3982
3978
|
/* @__PURE__ */ jsx41(
|
|
3983
3979
|
InputFieldNumber,
|
|
3984
3980
|
{
|
|
3985
|
-
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"}`,
|
|
3981
|
+
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"}`,
|
|
3986
3982
|
value: cacheData.numberValue ?? 0,
|
|
3987
3983
|
className: "h-[32px]",
|
|
3988
3984
|
onChange: (val) => {
|
|
@@ -3990,7 +3986,7 @@ function Indicator({
|
|
|
3990
3986
|
setAddError((p) => ({ ...p, numberValue: void 0 }));
|
|
3991
3987
|
},
|
|
3992
3988
|
min: 0,
|
|
3993
|
-
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"}`,
|
|
3989
|
+
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"}`,
|
|
3994
3990
|
required: true,
|
|
3995
3991
|
error: addError.numberValue
|
|
3996
3992
|
}
|
|
@@ -4011,14 +4007,7 @@ function Indicator({
|
|
|
4011
4007
|
}
|
|
4012
4008
|
)
|
|
4013
4009
|
] }),
|
|
4014
|
-
/* @__PURE__ */ jsx41(
|
|
4015
|
-
IconCirclePlus2,
|
|
4016
|
-
{
|
|
4017
|
-
onClick: handleAddIndicator,
|
|
4018
|
-
className: "mt-8 cursor-pointer",
|
|
4019
|
-
size: 32
|
|
4020
|
-
}
|
|
4021
|
-
)
|
|
4010
|
+
/* @__PURE__ */ jsx41(IconCirclePlus2, { onClick: handleAddIndicator, className: "mt-8 cursor-pointer", size: 32 })
|
|
4022
4011
|
]
|
|
4023
4012
|
}
|
|
4024
4013
|
),
|
|
@@ -4087,20 +4076,8 @@ function Indicator({
|
|
|
4087
4076
|
onClick: () => handleConfirmEditIndicator(index)
|
|
4088
4077
|
}
|
|
4089
4078
|
),
|
|
4090
|
-
/* @__PURE__ */ jsx41(
|
|
4091
|
-
|
|
4092
|
-
{
|
|
4093
|
-
className: "cursor-pointer text-red-600",
|
|
4094
|
-
onClick: handleCancelEditIndicator
|
|
4095
|
-
}
|
|
4096
|
-
)
|
|
4097
|
-
] }) : void 0 : canEdit && /* @__PURE__ */ jsx41(
|
|
4098
|
-
IconPencil2,
|
|
4099
|
-
{
|
|
4100
|
-
className: "cursor-pointer",
|
|
4101
|
-
onClick: () => handleEditIndicator(index)
|
|
4102
|
-
}
|
|
4103
|
-
) }),
|
|
4079
|
+
/* @__PURE__ */ jsx41(IconX3, { className: "cursor-pointer text-red-600", onClick: handleCancelEditIndicator })
|
|
4080
|
+
] }) : void 0 : false }),
|
|
4104
4081
|
/* @__PURE__ */ jsx41("div", { className: "body-1 mt-2 cursor-pointer", children: /* @__PURE__ */ jsx41(
|
|
4105
4082
|
IconTrash4,
|
|
4106
4083
|
{
|
|
@@ -4756,14 +4733,21 @@ import { useEffect as useEffect11, useRef as useRef10, useState as useState20 }
|
|
|
4756
4733
|
import * as d33 from "d3";
|
|
4757
4734
|
import {
|
|
4758
4735
|
format as format4,
|
|
4759
|
-
getWeek,
|
|
4760
4736
|
eachWeekOfInterval,
|
|
4761
4737
|
startOfYear,
|
|
4762
4738
|
endOfYear,
|
|
4763
4739
|
startOfDay,
|
|
4764
4740
|
addDays,
|
|
4765
|
-
eachHourOfInterval
|
|
4741
|
+
eachHourOfInterval,
|
|
4742
|
+
getQuarter
|
|
4766
4743
|
} from "date-fns";
|
|
4744
|
+
import { th } from "date-fns/locale";
|
|
4745
|
+
import {
|
|
4746
|
+
IconCircleX,
|
|
4747
|
+
IconClockExclamation,
|
|
4748
|
+
IconHourglassEmpty,
|
|
4749
|
+
IconRosetteDiscountCheck
|
|
4750
|
+
} from "@tabler/icons-react";
|
|
4767
4751
|
import { jsx as jsx48, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
4768
4752
|
var LAYOUT = {
|
|
4769
4753
|
barHeight: 40,
|
|
@@ -4781,31 +4765,33 @@ var VIEW_MODE_SCALE = {
|
|
|
4781
4765
|
week: 10
|
|
4782
4766
|
};
|
|
4783
4767
|
var STATUS_META = {
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
}
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4768
|
+
IN_PROGRESS: {
|
|
4769
|
+
color: "#FFC654",
|
|
4770
|
+
label: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23",
|
|
4771
|
+
icon: /* @__PURE__ */ jsx48(IconHourglassEmpty, { className: "text-[#FFC654]" })
|
|
4772
|
+
},
|
|
4773
|
+
CANCEL: {
|
|
4774
|
+
color: "#D2D5DB",
|
|
4775
|
+
label: "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01",
|
|
4776
|
+
icon: /* @__PURE__ */ jsx48(IconCircleX, { className: "text-[#D2D5DB]" })
|
|
4777
|
+
},
|
|
4778
|
+
SUCCESS: {
|
|
4779
|
+
color: "#81CF92",
|
|
4780
|
+
label: "\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23\u0E41\u0E25\u0E49\u0E27\u0E40\u0E2A\u0E23\u0E47\u0E08",
|
|
4781
|
+
icon: /* @__PURE__ */ jsx48(IconRosetteDiscountCheck, { className: "text-[#81CF92]" })
|
|
4782
|
+
},
|
|
4783
|
+
COMPLETE: {
|
|
4784
|
+
color: "#81CF92",
|
|
4785
|
+
label: "\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E2A\u0E34\u0E49\u0E19",
|
|
4786
|
+
icon: /* @__PURE__ */ jsx48(IconRosetteDiscountCheck, { className: "text-[#81CF92]" })
|
|
4787
|
+
},
|
|
4788
|
+
DELAY: {
|
|
4789
|
+
color: "#F4827E",
|
|
4790
|
+
label: "\u0E25\u0E48\u0E32\u0E0A\u0E49\u0E32",
|
|
4791
|
+
icon: /* @__PURE__ */ jsx48(IconClockExclamation, { className: "text-[#F4827E]" })
|
|
4792
|
+
}
|
|
4801
4793
|
};
|
|
4802
|
-
var THAI_DAYS = ["\u0E2D\u0E32.", "\u0E08.", "\u0E2D.", "\u0E1E.", "\u0E1E\u0E24.", "\u0E28.", "\u0E2A."];
|
|
4803
4794
|
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}`;
|
|
4804
|
-
var formatThaiMonth = (date) => {
|
|
4805
|
-
const monthName = format4(date, "MMMM");
|
|
4806
|
-
return THAI_MONTHS[monthName] || monthName;
|
|
4807
|
-
};
|
|
4808
|
-
var formatThaiDate = (date) => date ? date.toLocaleDateString("th-TH", { day: "numeric", month: "short" }) : "-";
|
|
4809
4795
|
var isDateOnlyValue = (dt) => {
|
|
4810
4796
|
const localZero = dt.getHours() === 0 && dt.getMinutes() === 0 && dt.getSeconds() === 0 && dt.getMilliseconds() === 0;
|
|
4811
4797
|
const utcZero = dt.getUTCHours() === 0 && dt.getUTCMinutes() === 0 && dt.getUTCSeconds() === 0 && dt.getUTCMilliseconds() === 0;
|
|
@@ -4835,60 +4821,46 @@ var getAdjustedEnd = (d) => {
|
|
|
4835
4821
|
}
|
|
4836
4822
|
return startOfDay(/* @__PURE__ */ new Date());
|
|
4837
4823
|
};
|
|
4838
|
-
var getStatusColor = (status2) => STATUS_META[status2]?.color ?? STATUS_META.
|
|
4839
|
-
var getStatusLabel = (status2) => STATUS_META[status2]?.label ?? STATUS_META.
|
|
4840
|
-
var ProjectRow = ({ element, barHeight, barSpacing }) => {
|
|
4824
|
+
var getStatusColor = (status2) => STATUS_META[status2]?.color ?? STATUS_META.IN_PROGRESS.color;
|
|
4825
|
+
var getStatusLabel = (status2) => STATUS_META[status2]?.label ?? STATUS_META.IN_PROGRESS.label;
|
|
4826
|
+
var ProjectRow = ({ element, barHeight, barSpacing, mode }) => {
|
|
4841
4827
|
const safeStartDate = element.startDate instanceof Date ? element.startDate : null;
|
|
4842
4828
|
const safeEndDate = element.endDate instanceof Date ? element.endDate : null;
|
|
4843
4829
|
const safeStatus = element.status || "pending";
|
|
4844
4830
|
const statusColor = getStatusColor(safeStatus);
|
|
4845
4831
|
const statusLabel = getStatusLabel(safeStatus);
|
|
4832
|
+
const statusIcon = STATUS_META[safeStatus]?.icon;
|
|
4833
|
+
const toBuddhistDate = (d) => new Date(d.getFullYear() + 543, d.getMonth(), d.getDate());
|
|
4846
4834
|
return /* @__PURE__ */ jsxs39(
|
|
4847
4835
|
"div",
|
|
4848
4836
|
{
|
|
4849
4837
|
style: {
|
|
4850
|
-
display: "grid",
|
|
4851
|
-
gridTemplateColumns: "200px 100px 100px 100px",
|
|
4852
4838
|
alignItems: "center",
|
|
4853
4839
|
height: `${barHeight}px`,
|
|
4854
|
-
|
|
4855
|
-
|
|
4840
|
+
marginBottom: `${barSpacing}px`,
|
|
4841
|
+
fontSize: "12px"
|
|
4856
4842
|
},
|
|
4843
|
+
className: "body-1 grid grid-cols-[1fr_100px_130px] px-8 gap-2",
|
|
4857
4844
|
children: [
|
|
4858
|
-
/* @__PURE__ */ jsxs39("div", {
|
|
4859
|
-
/* @__PURE__ */ jsx48(
|
|
4860
|
-
"
|
|
4845
|
+
/* @__PURE__ */ jsxs39("div", { className: `grid ${mode === "project" ? "grid-cols-[10px_1fr]" : "grid-cols-[1fr]"} items-center gap-2`, children: [
|
|
4846
|
+
mode === "project" && /* @__PURE__ */ jsx48(
|
|
4847
|
+
"div",
|
|
4861
4848
|
{
|
|
4862
4849
|
style: {
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
borderRadius: "50%",
|
|
4867
|
-
backgroundColor: element.color || "#999"
|
|
4868
|
-
}
|
|
4850
|
+
backgroundColor: element.color || "#E9E9E9"
|
|
4851
|
+
},
|
|
4852
|
+
className: "w-[10px] h-[10px] rounded-full"
|
|
4869
4853
|
}
|
|
4870
4854
|
),
|
|
4871
|
-
/* @__PURE__ */ jsx48("
|
|
4855
|
+
/* @__PURE__ */ jsx48("div", { className: "line-clamp-1 break-words text-[#333]", title: element.label, children: element.label })
|
|
4872
4856
|
] }),
|
|
4873
|
-
/* @__PURE__ */ jsx48("div", {
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
minWidth: "100%",
|
|
4881
|
-
padding: "4px 8px",
|
|
4882
|
-
borderRadius: "4px",
|
|
4883
|
-
fontSize: "11px",
|
|
4884
|
-
backgroundColor: statusColor,
|
|
4885
|
-
color: "#000",
|
|
4886
|
-
border: "none",
|
|
4887
|
-
cursor: "pointer"
|
|
4888
|
-
},
|
|
4889
|
-
children: statusLabel
|
|
4890
|
-
}
|
|
4891
|
-
)
|
|
4857
|
+
mode === "project" ? /* @__PURE__ */ jsx48("div", { children: safeEndDate ? format4(toBuddhistDate(safeEndDate), "dd MMM yyyy", { locale: th }) : "-" }) : /* @__PURE__ */ jsx48("div", { children: `Q${getQuarter(
|
|
4858
|
+
safeEndDate ?? /* @__PURE__ */ new Date()
|
|
4859
|
+
)}/${(safeEndDate?.getFullYear() ?? 0) + 543}` }),
|
|
4860
|
+
/* @__PURE__ */ jsxs39("button", { className: "rounded-md subtitile-1 flex gap-2 align-start", children: [
|
|
4861
|
+
statusIcon,
|
|
4862
|
+
statusLabel
|
|
4863
|
+
] })
|
|
4892
4864
|
]
|
|
4893
4865
|
},
|
|
4894
4866
|
element.id
|
|
@@ -4903,42 +4875,52 @@ var RowOverlay = ({ data, barHeight, barSpacing, totalHeaderHeight }) => /* @__P
|
|
|
4903
4875
|
left: 0,
|
|
4904
4876
|
right: 0,
|
|
4905
4877
|
height: `${data.length * (barHeight + barSpacing)}px`,
|
|
4906
|
-
pointerEvents: "none"
|
|
4907
|
-
zIndex: 5
|
|
4878
|
+
pointerEvents: "none"
|
|
4908
4879
|
},
|
|
4909
|
-
children: data.map((
|
|
4880
|
+
children: data.map((_, i) => {
|
|
4910
4881
|
if (i === 0) return null;
|
|
4882
|
+
console.log("rendering row line", i);
|
|
4911
4883
|
const yPos = i * (barHeight + barSpacing) - barSpacing / 2;
|
|
4912
4884
|
return /* @__PURE__ */ jsx48(
|
|
4913
4885
|
"div",
|
|
4914
4886
|
{
|
|
4887
|
+
className: "",
|
|
4915
4888
|
style: {
|
|
4916
4889
|
position: "absolute",
|
|
4917
4890
|
top: `${yPos}px`,
|
|
4918
4891
|
left: 0,
|
|
4919
4892
|
right: 0,
|
|
4920
4893
|
height: "1px",
|
|
4921
|
-
backgroundColor: "#
|
|
4894
|
+
backgroundColor: "#E9E9E9"
|
|
4922
4895
|
}
|
|
4923
4896
|
},
|
|
4924
|
-
`row-line-${
|
|
4897
|
+
`row-line-${i}`
|
|
4925
4898
|
);
|
|
4926
4899
|
})
|
|
4927
4900
|
}
|
|
4928
4901
|
);
|
|
4929
|
-
var GanttChart = ({
|
|
4902
|
+
var GanttChart = ({
|
|
4903
|
+
data,
|
|
4904
|
+
width,
|
|
4905
|
+
mode
|
|
4906
|
+
}) => {
|
|
4930
4907
|
const svgRef = useRef10(null);
|
|
4931
4908
|
const leftPanelRef = useRef10(null);
|
|
4932
4909
|
const dataContainerRef = useRef10(null);
|
|
4933
4910
|
const [viewMode] = useState20("year");
|
|
4934
|
-
const {
|
|
4911
|
+
const {
|
|
4912
|
+
barHeight,
|
|
4913
|
+
barSpacing,
|
|
4914
|
+
headersGroupLayer1Height,
|
|
4915
|
+
headersGroupLayer2Height
|
|
4916
|
+
} = LAYOUT;
|
|
4935
4917
|
const totalHeaderHeight = headersGroupLayer1Height + headersGroupLayer2Height;
|
|
4936
4918
|
useEffect11(() => {
|
|
4937
4919
|
if (!data || !svgRef.current) return;
|
|
4938
4920
|
const margin = { top: 0, right: 20, bottom: 20, left: 20 };
|
|
4939
4921
|
const chartHeight = data.length * (barHeight + barSpacing) + margin.top + margin.bottom;
|
|
4940
4922
|
const containerWidth = width * 2;
|
|
4941
|
-
const containerHeight = totalHeaderHeight + chartHeight;
|
|
4923
|
+
const containerHeight = totalHeaderHeight + chartHeight > 590 ? totalHeaderHeight + chartHeight : 590;
|
|
4942
4924
|
const borderRadius = 5;
|
|
4943
4925
|
if (leftPanelRef.current) {
|
|
4944
4926
|
leftPanelRef.current.style.height = `${containerHeight}px`;
|
|
@@ -4951,23 +4933,31 @@ var GanttChart = ({ data, width, height }) => {
|
|
|
4951
4933
|
const chartGroup = svg.append("g").attr("transform", `translate(${margin.left}, ${totalHeaderHeight})`);
|
|
4952
4934
|
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
4953
4935
|
const domainStart = startOfDay(startOfYear(new Date(currentYear, 0, 1)));
|
|
4954
|
-
const domainEnd = startOfDay(
|
|
4936
|
+
const domainEnd = startOfDay(
|
|
4937
|
+
addDays(endOfYear(new Date(currentYear, 0, 1)), 1)
|
|
4938
|
+
);
|
|
4955
4939
|
const xScale = d33.scaleTime().domain([domainStart, domainEnd]).range([0, containerWidth - margin.left - margin.right]);
|
|
4956
4940
|
const buildTimeBuckets = (domain) => ({
|
|
4957
4941
|
uniqueYears: d33.timeYear.every(1)?.range(domain[0], domain[1]) || [],
|
|
4958
4942
|
uniqueMonths: d33.timeMonth.every(1)?.range(domain[0], domain[1]) || [],
|
|
4959
|
-
uniqueWeeks: eachWeekOfInterval(
|
|
4960
|
-
|
|
4943
|
+
uniqueWeeks: eachWeekOfInterval(
|
|
4944
|
+
{ start: domain[0], end: domain[1] },
|
|
4945
|
+
{ weekStartsOn: 1 }
|
|
4946
|
+
),
|
|
4947
|
+
uniqueDays: d33.timeDay.range(
|
|
4948
|
+
startOfDay(domain[0]),
|
|
4949
|
+
startOfDay(addDays(domain[1], 1))
|
|
4950
|
+
) || []
|
|
4961
4951
|
});
|
|
4962
4952
|
const renderYearHeaders = (layer1, layer2, newXScale, buckets) => {
|
|
4963
4953
|
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) => {
|
|
4964
4954
|
const nextYearStart = startOfDay(new Date(d.getFullYear() + 1, 0, 1));
|
|
4965
4955
|
return newXScale(nextYearStart) - newXScale(d);
|
|
4966
|
-
}).attr("height", headersGroupLayer1Height).style("fill", "#fff").style("stroke", "#
|
|
4956
|
+
}).attr("height", headersGroupLayer1Height).style("fill", "#fff").style("stroke", "#E9E9E9").style("stroke-width", 1);
|
|
4967
4957
|
layer1.selectAll(".year-label").data(buckets.uniqueYears).enter().append("text").attr("class", "year-label").attr("x", (d) => {
|
|
4968
4958
|
const nextYear = new Date(d.getFullYear() + 1, 0, 1);
|
|
4969
4959
|
return newXScale(d) + (newXScale(nextYear) - newXScale(d)) / 2;
|
|
4970
|
-
}).attr("y", -totalHeaderHeight + headersGroupLayer1Height / 2).attr("dy", "0.35em").attr("text-anchor", "middle").style("font-size", `${HEADER_FONTS.layer1}px`).style("font-weight", "
|
|
4960
|
+
}).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}`);
|
|
4971
4961
|
const quarters2 = [];
|
|
4972
4962
|
buckets.uniqueYears.forEach((year) => {
|
|
4973
4963
|
for (let q = 0; q < 4; q++) {
|
|
@@ -4975,75 +4965,36 @@ var GanttChart = ({ data, width, height }) => {
|
|
|
4975
4965
|
}
|
|
4976
4966
|
});
|
|
4977
4967
|
layer2.selectAll(".quarter-bg").data(quarters2).enter().append("rect").attr("class", "quarter-bg").attr("x", (d) => newXScale(d)).attr("y", -headersGroupLayer2Height).attr("width", (d) => {
|
|
4978
|
-
const nextQuarter = startOfDay(
|
|
4968
|
+
const nextQuarter = startOfDay(
|
|
4969
|
+
new Date(d.getFullYear(), d.getMonth() + 3, 1)
|
|
4970
|
+
);
|
|
4979
4971
|
return newXScale(nextQuarter) - newXScale(d);
|
|
4980
|
-
}).attr("height", headersGroupLayer2Height).style("fill", "#fff").style("stroke", "#
|
|
4972
|
+
}).attr("height", headersGroupLayer2Height).style("fill", "#fff").style("stroke", "#E9E9E9").style("stroke-width", 1);
|
|
4981
4973
|
layer2.selectAll(".quarter-label").data(quarters2).enter().append("text").attr("class", "quarter-label").attr("x", (d) => {
|
|
4982
|
-
const nextQuarter = startOfDay(
|
|
4974
|
+
const nextQuarter = startOfDay(
|
|
4975
|
+
new Date(d.getFullYear(), d.getMonth() + 3, 1)
|
|
4976
|
+
);
|
|
4983
4977
|
return newXScale(d) + (newXScale(nextQuarter) - newXScale(d)) / 2;
|
|
4984
|
-
}).attr("y", -headersGroupLayer2Height / 2).attr("dy", "0.35em").attr("text-anchor", "middle").style("font-size", `${HEADER_FONTS.layer2}px`).style("font-weight", "
|
|
4985
|
-
};
|
|
4986
|
-
const renderMonthHeaders = (layer1, layer2, newXScale, buckets) => {
|
|
4987
|
-
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) => {
|
|
4988
|
-
const nextMonth = startOfDay(new Date(d.getFullYear(), d.getMonth() + 1, 1));
|
|
4989
|
-
return newXScale(nextMonth) - newXScale(d) + 11;
|
|
4990
|
-
}).attr("height", headersGroupLayer1Height).style("fill", "#fff").style("stroke", "#999").style("stroke-width", 1);
|
|
4991
|
-
layer1.selectAll(".month-label").data(buckets.uniqueMonths).enter().append("text").attr("class", "month-label").attr("x", (d) => {
|
|
4992
|
-
const nextMonth = startOfDay(new Date(d.getFullYear(), d.getMonth() + 1, 1));
|
|
4993
|
-
return newXScale(d) + (newXScale(nextMonth) - newXScale(d)) / 2;
|
|
4994
|
-
}).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}`);
|
|
4995
|
-
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) => {
|
|
4996
|
-
const weekEnd = startOfDay(addDays(d, 7));
|
|
4997
|
-
return newXScale(weekEnd) - newXScale(d) + 1;
|
|
4998
|
-
}).attr("height", headersGroupLayer2Height).style("fill", "#fff").style("stroke", "#999").style("stroke-width", 1);
|
|
4999
|
-
layer2.selectAll(".week-label").data(buckets.uniqueWeeks).enter().append("text").attr("class", "week-label").attr("x", (d) => {
|
|
5000
|
-
const weekEnd = startOfDay(addDays(d, 7));
|
|
5001
|
-
return newXScale(d) + (newXScale(weekEnd) - newXScale(d)) / 2;
|
|
5002
|
-
}).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 ${getWeek(d, { weekStartsOn: 1 })}`);
|
|
5003
|
-
};
|
|
5004
|
-
const renderWeekHeaders = (layer1, layer2, newXScale, buckets) => {
|
|
5005
|
-
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) => {
|
|
5006
|
-
const weekEnd = startOfDay(addDays(d, 7));
|
|
5007
|
-
return newXScale(weekEnd) - newXScale(d);
|
|
5008
|
-
}).attr("height", headersGroupLayer1Height).style("fill", "#fff").style("stroke", "#999").style("stroke-width", 1);
|
|
5009
|
-
layer1.selectAll(".week-label").data(buckets.uniqueWeeks).enter().append("text").attr("class", "week-label").attr("x", (d) => {
|
|
5010
|
-
const weekEnd = startOfDay(addDays(d, 7));
|
|
5011
|
-
return newXScale(d) + (newXScale(weekEnd) - newXScale(d)) / 2;
|
|
5012
|
-
}).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 ${getWeek(d, { weekStartsOn: 1 })}`);
|
|
5013
|
-
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) => {
|
|
5014
|
-
const nextDay = startOfDay(addDays(d, 1));
|
|
5015
|
-
return newXScale(nextDay) - newXScale(d);
|
|
5016
|
-
}).attr("height", headersGroupLayer2Height).style("fill", "#fff").style("stroke", "#999").style("stroke-width", 1);
|
|
5017
|
-
layer2.selectAll(".day-of-week").data(buckets.uniqueDays).enter().append("text").attr("class", "day-of-week").attr("x", (d) => {
|
|
5018
|
-
const nextDay = startOfDay(addDays(d, 1));
|
|
5019
|
-
return newXScale(d) + (newXScale(nextDay) - newXScale(d)) / 2;
|
|
5020
|
-
}).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) {
|
|
5021
|
-
const textElement = d33.select(this);
|
|
5022
|
-
textElement.text("");
|
|
5023
|
-
textElement.append("tspan").text(THAI_DAYS[d.getDay()]).attr("x", textElement.attr("x")).attr("dy", "-0.3em");
|
|
5024
|
-
textElement.append("tspan").text(format4(d, "d")).attr("x", textElement.attr("x")).attr("dy", "1.2em");
|
|
5025
|
-
});
|
|
4978
|
+
}).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}`);
|
|
5026
4979
|
};
|
|
5027
4980
|
const drawHeaders = (layer1, layer2, newXScale, buckets) => {
|
|
5028
|
-
|
|
5029
|
-
if (viewMode === "month") return renderMonthHeaders(layer1, layer2, newXScale, buckets);
|
|
5030
|
-
return renderWeekHeaders(layer1, layer2, newXScale, buckets);
|
|
4981
|
+
return renderYearHeaders(layer1, layer2, newXScale, buckets);
|
|
5031
4982
|
};
|
|
5032
|
-
const getGridlineData = (
|
|
5033
|
-
if (
|
|
5034
|
-
if (
|
|
5035
|
-
if (
|
|
4983
|
+
const getGridlineData = (mode2, buckets, domain) => {
|
|
4984
|
+
if (mode2 === "year") return buckets.uniqueMonths;
|
|
4985
|
+
if (mode2 === "month") return buckets.uniqueWeeks;
|
|
4986
|
+
if (mode2 === "week") return buckets.uniqueDays;
|
|
5036
4987
|
return eachHourOfInterval({ start: domain[0], end: domain[1] });
|
|
5037
4988
|
};
|
|
5038
4989
|
const drawGridlines = (group, gridlineData, newXScale) => {
|
|
5039
|
-
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",
|
|
4990
|
+
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);
|
|
5040
4991
|
};
|
|
5041
4992
|
const drawRowSeparators = (group, getYPosition) => {
|
|
5042
4993
|
const rowSeparatorGroup = group.append("g").attr("class", "row-separators");
|
|
5043
4994
|
data.forEach((_d, i) => {
|
|
5044
4995
|
if (i === 0) return;
|
|
5045
4996
|
const y = getYPosition(i) - barSpacing / 2;
|
|
5046
|
-
rowSeparatorGroup.append("line").attr("x1", 0).attr("x2", containerWidth - margin.left - margin.right).attr("y1", y).attr("y2", y).attr("stroke", "#
|
|
4997
|
+
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");
|
|
5047
4998
|
});
|
|
5048
4999
|
rowSeparatorGroup.lower();
|
|
5049
5000
|
};
|
|
@@ -5051,16 +5002,27 @@ var GanttChart = ({ data, width, height }) => {
|
|
|
5051
5002
|
const barsGroup = group.append("g").attr("class", "bars-group");
|
|
5052
5003
|
const renderBarHeight = barHeight;
|
|
5053
5004
|
const labelPadding = 10;
|
|
5054
|
-
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(
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5005
|
+
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(
|
|
5006
|
+
"width",
|
|
5007
|
+
(d) => newXScale(getAdjustedEnd(d)) - newXScale(getAdjustedStart(d))
|
|
5008
|
+
).attr("fill", (d) => getStatusColor(d.status)).attr("rx", borderRadius).attr("ry", borderRadius);
|
|
5009
|
+
{
|
|
5010
|
+
mode === "project" && barsGroup.selectAll(".bar-head").data(data).enter().append("path").attr("class", "bar-head").attr("fill", (d) => d.color).attr("d", (d, i) => {
|
|
5011
|
+
const x = newXScale(getAdjustedStart(d));
|
|
5012
|
+
const y = getYPosition(i);
|
|
5013
|
+
const barWidth = newXScale(getAdjustedEnd(d)) - newXScale(getAdjustedStart(d));
|
|
5014
|
+
const headWidth = Math.min(barWidth * 0.5, 20);
|
|
5015
|
+
return roundedRectPath(
|
|
5016
|
+
x,
|
|
5017
|
+
y,
|
|
5018
|
+
headWidth,
|
|
5019
|
+
renderBarHeight,
|
|
5020
|
+
borderRadius
|
|
5021
|
+
);
|
|
5022
|
+
});
|
|
5023
|
+
}
|
|
5062
5024
|
const labels = group.append("g").attr("class", "labels");
|
|
5063
|
-
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-
|
|
5025
|
+
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");
|
|
5064
5026
|
labelSelection.each(function(d) {
|
|
5065
5027
|
const barWidth = newXScale(getAdjustedEnd(d)) - newXScale(getAdjustedStart(d));
|
|
5066
5028
|
const headWidth = Math.min(barWidth * 0.5, 20);
|
|
@@ -5083,8 +5045,17 @@ var GanttChart = ({ data, width, height }) => {
|
|
|
5083
5045
|
const timeBuckets = buildTimeBuckets(newXScale.domain());
|
|
5084
5046
|
const headersGroupLayer1 = chartGroup.append("g");
|
|
5085
5047
|
const headersGroupLayer2 = chartGroup.append("g");
|
|
5086
|
-
drawHeaders(
|
|
5087
|
-
|
|
5048
|
+
drawHeaders(
|
|
5049
|
+
headersGroupLayer1,
|
|
5050
|
+
headersGroupLayer2,
|
|
5051
|
+
newXScale,
|
|
5052
|
+
timeBuckets
|
|
5053
|
+
);
|
|
5054
|
+
const gridlineData = getGridlineData(
|
|
5055
|
+
viewMode,
|
|
5056
|
+
timeBuckets,
|
|
5057
|
+
newXScale.domain()
|
|
5058
|
+
);
|
|
5088
5059
|
drawGridlines(headersGroupLayer2, gridlineData, newXScale);
|
|
5089
5060
|
drawRowSeparators(chartGroup, getYPosition);
|
|
5090
5061
|
drawBarsAndLabels(chartGroup, newXScale, getYPosition);
|
|
@@ -5102,7 +5073,6 @@ var GanttChart = ({ data, width, height }) => {
|
|
|
5102
5073
|
}, [
|
|
5103
5074
|
data,
|
|
5104
5075
|
width,
|
|
5105
|
-
height,
|
|
5106
5076
|
viewMode,
|
|
5107
5077
|
barHeight,
|
|
5108
5078
|
barSpacing,
|
|
@@ -5113,13 +5083,13 @@ var GanttChart = ({ data, width, height }) => {
|
|
|
5113
5083
|
return /* @__PURE__ */ jsx48(
|
|
5114
5084
|
"div",
|
|
5115
5085
|
{
|
|
5086
|
+
className: "body-1",
|
|
5116
5087
|
style: {
|
|
5117
5088
|
display: "flex",
|
|
5118
5089
|
flexDirection: "column",
|
|
5119
|
-
padding: "20px",
|
|
5120
5090
|
width: `${width}px`,
|
|
5121
|
-
height:
|
|
5122
|
-
border: "1px solid #
|
|
5091
|
+
height: `590px`,
|
|
5092
|
+
border: "1px solid #E9E9E9",
|
|
5123
5093
|
borderRadius: "10px",
|
|
5124
5094
|
backgroundColor: "#fff",
|
|
5125
5095
|
overflow: "hidden"
|
|
@@ -5135,49 +5105,69 @@ var GanttChart = ({ data, width, height }) => {
|
|
|
5135
5105
|
position: "relative"
|
|
5136
5106
|
},
|
|
5137
5107
|
children: [
|
|
5138
|
-
/* @__PURE__ */ jsx48(
|
|
5108
|
+
/* @__PURE__ */ jsx48("div", { className: "z-1", children: /* @__PURE__ */ jsx48(
|
|
5109
|
+
RowOverlay,
|
|
5110
|
+
{
|
|
5111
|
+
data: data.length > 10 ? data : ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"],
|
|
5112
|
+
barHeight,
|
|
5113
|
+
barSpacing,
|
|
5114
|
+
totalHeaderHeight
|
|
5115
|
+
}
|
|
5116
|
+
) }),
|
|
5139
5117
|
/* @__PURE__ */ jsxs39(
|
|
5140
5118
|
"div",
|
|
5141
5119
|
{
|
|
5142
5120
|
ref: leftPanelRef,
|
|
5121
|
+
className: "border-r",
|
|
5143
5122
|
style: {
|
|
5144
5123
|
width: "520px",
|
|
5145
5124
|
minWidth: "500px",
|
|
5146
5125
|
display: "flex",
|
|
5147
5126
|
flexDirection: "column",
|
|
5148
5127
|
backgroundColor: "#fff",
|
|
5149
|
-
borderRight: "1px solid #ddd",
|
|
5150
5128
|
zIndex: 2
|
|
5151
5129
|
},
|
|
5152
5130
|
children: [
|
|
5153
|
-
/* @__PURE__ */ jsxs39(
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5131
|
+
/* @__PURE__ */ jsxs39("div", { ref: dataContainerRef, children: [
|
|
5132
|
+
/* @__PURE__ */ jsxs39(
|
|
5133
|
+
"div",
|
|
5134
|
+
{
|
|
5135
|
+
className: "grid body-2 grid-cols-[1fr_100px_130px] gap-2 px-8 border-b bg-white",
|
|
5136
|
+
style: {
|
|
5137
|
+
height: `${totalHeaderHeight}px`,
|
|
5138
|
+
marginBottom: "10px",
|
|
5139
|
+
position: "sticky",
|
|
5140
|
+
top: 0,
|
|
5141
|
+
alignItems: "center",
|
|
5142
|
+
zIndex: 5
|
|
5143
|
+
},
|
|
5144
|
+
children: [
|
|
5145
|
+
/* @__PURE__ */ jsx48("div", { children: "\u0E42\u0E04\u0E23\u0E07\u0E01\u0E32\u0E23" }),
|
|
5146
|
+
/* @__PURE__ */ jsx48("div", { children: "\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E2A\u0E48\u0E07" }),
|
|
5147
|
+
/* @__PURE__ */ jsx48("div", { children: "\u0E2A\u0E16\u0E32\u0E19\u0E30" })
|
|
5148
|
+
]
|
|
5149
|
+
}
|
|
5150
|
+
),
|
|
5151
|
+
data.map((element) => /* @__PURE__ */ jsx48(
|
|
5152
|
+
ProjectRow,
|
|
5153
|
+
{
|
|
5154
|
+
mode,
|
|
5155
|
+
element,
|
|
5156
|
+
barHeight,
|
|
5157
|
+
barSpacing
|
|
5171
5158
|
},
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5159
|
+
element.id
|
|
5160
|
+
))
|
|
5161
|
+
] }),
|
|
5162
|
+
/* @__PURE__ */ jsx48("div", { className: "z-3", children: /* @__PURE__ */ jsx48(
|
|
5163
|
+
RowOverlay,
|
|
5164
|
+
{
|
|
5165
|
+
data,
|
|
5166
|
+
barHeight,
|
|
5167
|
+
barSpacing,
|
|
5168
|
+
totalHeaderHeight
|
|
5178
5169
|
}
|
|
5179
|
-
)
|
|
5180
|
-
/* @__PURE__ */ jsx48("div", { ref: dataContainerRef, children: data.map((element) => /* @__PURE__ */ jsx48(ProjectRow, { element, barHeight, barSpacing }, element.id)) })
|
|
5170
|
+
) })
|
|
5181
5171
|
]
|
|
5182
5172
|
}
|
|
5183
5173
|
),
|
|
@@ -5259,7 +5249,7 @@ function CardKPI({
|
|
|
5259
5249
|
/* @__PURE__ */ jsx49(ProgressBar, { percent: overallPercent, type: "line", checkpoints: [0] })
|
|
5260
5250
|
] }),
|
|
5261
5251
|
/* @__PURE__ */ jsxs40("div", { className: "border-b", children: [
|
|
5262
|
-
/* @__PURE__ */ jsx49("span", { className: "body-2 ", children: "\
|
|
5252
|
+
/* @__PURE__ */ jsx49("span", { className: "body-2 ", children: "\u0E01\u0E25\u0E38\u0E48\u0E21\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22" }),
|
|
5263
5253
|
indicator.filter((ind) => ind.indicatorType === "TARGET").map((item, index) => {
|
|
5264
5254
|
if (index === 2) return;
|
|
5265
5255
|
return /* @__PURE__ */ jsx49(KPIRow, { item });
|
|
@@ -5272,7 +5262,6 @@ function CardKPI({
|
|
|
5272
5262
|
return /* @__PURE__ */ jsx49(KPIRow, { item });
|
|
5273
5263
|
})
|
|
5274
5264
|
] }),
|
|
5275
|
-
indicator.length === 0 && /* @__PURE__ */ jsx49("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" }),
|
|
5276
5265
|
indicator.filter((item) => item.indicatorType === "TARGET").length > 2 || indicator.filter((item) => item.indicatorType === "OUTPUT").length > 2 ? /* @__PURE__ */ jsx49("div", { className: "bottom-0 right-1/2 absolute text-gray-300", children: /* @__PURE__ */ jsx49(
|
|
5277
5266
|
IconDots,
|
|
5278
5267
|
{
|