@esic-lab/data-core-ui 0.0.80 → 0.0.82
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.css +11 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +123 -37
- package/dist/index.mjs +128 -42
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -1145,6 +1145,10 @@
|
|
|
1145
1145
|
.text-\[20px\] {
|
|
1146
1146
|
font-size: 20px;
|
|
1147
1147
|
}
|
|
1148
|
+
.leading-3 {
|
|
1149
|
+
--tw-leading: calc(var(--spacing) * 3);
|
|
1150
|
+
line-height: calc(var(--spacing) * 3);
|
|
1151
|
+
}
|
|
1148
1152
|
.font-bold {
|
|
1149
1153
|
--tw-font-weight: var(--font-weight-bold);
|
|
1150
1154
|
font-weight: var(--font-weight-bold);
|
|
@@ -1643,6 +1647,11 @@
|
|
|
1643
1647
|
margin-inline: calc(var(--spacing) * 0);
|
|
1644
1648
|
}
|
|
1645
1649
|
}
|
|
1650
|
+
.\[\&_\.ant-collapse-content-box\]\:\!py-\[2px\] {
|
|
1651
|
+
& .ant-collapse-content-box {
|
|
1652
|
+
padding-block: 2px !important;
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1646
1655
|
}
|
|
1647
1656
|
@layer base {
|
|
1648
1657
|
*,
|
|
@@ -1880,6 +1889,7 @@
|
|
|
1880
1889
|
@property --tw-space-y-reverse { syntax: "*"; inherits: false; initial-value: 0; }
|
|
1881
1890
|
@property --tw-space-x-reverse { syntax: "*"; inherits: false; initial-value: 0; }
|
|
1882
1891
|
@property --tw-border-style { syntax: "*"; inherits: false; initial-value: solid; }
|
|
1892
|
+
@property --tw-leading { syntax: "*"; inherits: false; }
|
|
1883
1893
|
@property --tw-font-weight { syntax: "*"; inherits: false; }
|
|
1884
1894
|
@property --tw-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }
|
|
1885
1895
|
@property --tw-shadow-color { syntax: "*"; inherits: false; }
|
|
@@ -1935,6 +1945,7 @@
|
|
|
1935
1945
|
--tw-space-y-reverse: 0;
|
|
1936
1946
|
--tw-space-x-reverse: 0;
|
|
1937
1947
|
--tw-border-style: solid;
|
|
1948
|
+
--tw-leading: initial;
|
|
1938
1949
|
--tw-font-weight: initial;
|
|
1939
1950
|
--tw-shadow: 0 0 #0000;
|
|
1940
1951
|
--tw-shadow-color: initial;
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -4316,12 +4316,29 @@ function ProfileSelect({
|
|
|
4316
4316
|
const extraCount = assignUser.length - (maxVisible - 1);
|
|
4317
4317
|
const normalizedSearch = search.trim().toLowerCase();
|
|
4318
4318
|
const filteredAssigned = normalizedSearch ? assignUser.filter((u) => u.name.toLowerCase().includes(normalizedSearch)) : assignUser;
|
|
4319
|
-
const filteredUnassigned =
|
|
4320
|
-
|
|
4321
|
-
|
|
4319
|
+
const filteredUnassigned = (0, import_react19.useMemo)(() => {
|
|
4320
|
+
const searchLower = search.trim().toLowerCase();
|
|
4321
|
+
if (!searchLower) return userNotAssign;
|
|
4322
|
+
return userNotAssign.filter(
|
|
4323
|
+
(u) => u.name.toLowerCase().includes(searchLower)
|
|
4324
|
+
);
|
|
4325
|
+
}, [userNotAssign, search]);
|
|
4322
4326
|
const isSearching = normalizedSearch.length > 0;
|
|
4323
4327
|
const noResult = filteredAssigned.length === 0 && filteredUnassigned.length === 0;
|
|
4324
4328
|
const noUserOption = allUser.length === 0 && !isSearching;
|
|
4329
|
+
const groupedUsers = (0, import_react19.useMemo)(() => {
|
|
4330
|
+
return filteredUnassigned.reduce(
|
|
4331
|
+
(acc, user) => {
|
|
4332
|
+
const groupName = user.institute || "\u0E44\u0E21\u0E48\u0E23\u0E30\u0E1A\u0E38\u0E2B\u0E19\u0E48\u0E27\u0E22\u0E07\u0E32\u0E19";
|
|
4333
|
+
if (!acc[groupName]) {
|
|
4334
|
+
acc[groupName] = [];
|
|
4335
|
+
}
|
|
4336
|
+
acc[groupName].push(user);
|
|
4337
|
+
return acc;
|
|
4338
|
+
},
|
|
4339
|
+
{}
|
|
4340
|
+
);
|
|
4341
|
+
}, [filteredUnassigned]);
|
|
4325
4342
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { ref: containerRef, className: "relative body-1", children: [
|
|
4326
4343
|
mode === "icon" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4327
4344
|
import_icons_react14.IconUsers,
|
|
@@ -4459,7 +4476,10 @@ function ProfileSelect({
|
|
|
4459
4476
|
}
|
|
4460
4477
|
)
|
|
4461
4478
|
] }),
|
|
4462
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.
|
|
4479
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col justify-start items-start", children: [
|
|
4480
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ml-2 body-3", children: user.name }),
|
|
4481
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ml-2 body-3 text-gray-400", children: user.institute })
|
|
4482
|
+
] })
|
|
4463
4483
|
]
|
|
4464
4484
|
},
|
|
4465
4485
|
user.id
|
|
@@ -4467,30 +4487,79 @@ function ProfileSelect({
|
|
|
4467
4487
|
] }),
|
|
4468
4488
|
filteredUnassigned.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
4469
4489
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "mt-2", children: "\u0E1C\u0E39\u0E49\u0E04\u0E19" }),
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
{
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4490
|
+
isSearching ? (
|
|
4491
|
+
// === โหมดค้นหา: แสดงเป็น List ธรรมดา ไม่มี Collapse ===
|
|
4492
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex flex-col gap-1", children: filteredUnassigned.map((user) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
4493
|
+
"button",
|
|
4494
|
+
{
|
|
4495
|
+
className: "flex items-center hover:bg-gray-100 w-full p-1 rounded transition-colors text-left",
|
|
4496
|
+
onClick: () => onUpdateAssignUser(user, "add"),
|
|
4497
|
+
children: [
|
|
4498
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4499
|
+
"img",
|
|
4500
|
+
{
|
|
4501
|
+
src: user.profile,
|
|
4502
|
+
style: {
|
|
4503
|
+
width: avatarSize,
|
|
4504
|
+
height: avatarSize,
|
|
4505
|
+
borderRadius: "50%"
|
|
4506
|
+
},
|
|
4507
|
+
className: "border"
|
|
4508
|
+
}
|
|
4509
|
+
),
|
|
4510
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col ml-2", children: [
|
|
4511
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "body-3", children: user.name }),
|
|
4512
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "body-3 text-gray-400 leading-3", children: user.institute })
|
|
4513
|
+
] })
|
|
4514
|
+
]
|
|
4515
|
+
},
|
|
4516
|
+
user.id
|
|
4517
|
+
)) })
|
|
4518
|
+
) : (
|
|
4519
|
+
// === โหมดปกติ: แสดงเป็น Group ด้วย Collapse ===
|
|
4520
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4521
|
+
import_antd24.Collapse,
|
|
4522
|
+
{
|
|
4523
|
+
ghost: true,
|
|
4524
|
+
size: "small",
|
|
4525
|
+
className: "[&_.ant-collapse-content-box]:!py-[2px]",
|
|
4526
|
+
items: Object.entries(groupedUsers).map(
|
|
4527
|
+
([company, users], index) => ({
|
|
4528
|
+
key: index.toString(),
|
|
4529
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "font-semibold body-3", children: [
|
|
4530
|
+
company,
|
|
4531
|
+
" (",
|
|
4532
|
+
users.length,
|
|
4533
|
+
")"
|
|
4534
|
+
] }),
|
|
4535
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex flex-col gap-1 pl-2", children: users.map((user) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
4536
|
+
"button",
|
|
4537
|
+
{
|
|
4538
|
+
className: "flex items-center hover:bg-gray-100 w-full p-1 rounded text-left",
|
|
4539
|
+
onClick: () => onUpdateAssignUser(user, "add"),
|
|
4540
|
+
children: [
|
|
4541
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4542
|
+
"img",
|
|
4543
|
+
{
|
|
4544
|
+
src: user.profile,
|
|
4545
|
+
style: {
|
|
4546
|
+
width: avatarSize,
|
|
4547
|
+
height: avatarSize,
|
|
4548
|
+
borderRadius: "50%"
|
|
4549
|
+
},
|
|
4550
|
+
className: "border"
|
|
4551
|
+
}
|
|
4552
|
+
),
|
|
4553
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ml-2 body-3", children: user.name })
|
|
4554
|
+
]
|
|
4555
|
+
},
|
|
4556
|
+
user.id
|
|
4557
|
+
)) })
|
|
4558
|
+
})
|
|
4559
|
+
)
|
|
4560
|
+
}
|
|
4561
|
+
)
|
|
4562
|
+
)
|
|
4494
4563
|
] })
|
|
4495
4564
|
] }) })
|
|
4496
4565
|
]
|
|
@@ -5034,16 +5103,25 @@ var getAdjustedEnd = (d) => {
|
|
|
5034
5103
|
}
|
|
5035
5104
|
return (0, import_date_fns3.startOfDay)(/* @__PURE__ */ new Date());
|
|
5036
5105
|
};
|
|
5106
|
+
var getMonthByQuarter = (quarter) => {
|
|
5107
|
+
if (quarter === 1) {
|
|
5108
|
+
return "\u0E21.\u0E04. - \u0E21\u0E35.\u0E04.";
|
|
5109
|
+
} else if (quarter === 2) {
|
|
5110
|
+
return "\u0E40\u0E21.\u0E22. - \u0E21\u0E34.\u0E22.";
|
|
5111
|
+
} else if (quarter === 3) {
|
|
5112
|
+
return "\u0E01.\u0E04. - \u0E01.\u0E22.";
|
|
5113
|
+
} else {
|
|
5114
|
+
return "\u0E15.\u0E04. - \u0E18.\u0E04.";
|
|
5115
|
+
}
|
|
5116
|
+
};
|
|
5037
5117
|
var getStatusColor = (status2) => STATUS_META[status2]?.color ?? STATUS_META.IN_PROGRESS.color;
|
|
5038
5118
|
var getStatusLabel = (status2) => STATUS_META[status2]?.label ?? STATUS_META.IN_PROGRESS.label;
|
|
5119
|
+
var toBuddhistDate = (d) => new Date(d.getFullYear() + 543, d.getMonth(), d.getDate());
|
|
5039
5120
|
var ProjectRow = ({ element, barHeight, barSpacing, mode }) => {
|
|
5040
|
-
const safeStartDate = element.startDate instanceof Date ? element.startDate : null;
|
|
5041
5121
|
const safeEndDate = element.endDate instanceof Date ? element.endDate : null;
|
|
5042
|
-
const safeStatus = element.status || "
|
|
5043
|
-
const statusColor = getStatusColor(safeStatus);
|
|
5122
|
+
const safeStatus = element.status || "IN_PROGRESS";
|
|
5044
5123
|
const statusLabel = getStatusLabel(safeStatus);
|
|
5045
5124
|
const statusIcon = STATUS_META[safeStatus]?.icon;
|
|
5046
|
-
const toBuddhistDate = (d) => new Date(d.getFullYear() + 543, d.getMonth(), d.getDate());
|
|
5047
5125
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
5048
5126
|
"div",
|
|
5049
5127
|
{
|
|
@@ -5161,7 +5239,7 @@ var GanttChart = ({
|
|
|
5161
5239
|
(0, import_date_fns3.startOfDay)((0, import_date_fns3.addDays)(domain[1], 1))
|
|
5162
5240
|
) || []
|
|
5163
5241
|
});
|
|
5164
|
-
const renderYearHeaders = (layer1, layer2, newXScale, buckets) => {
|
|
5242
|
+
const renderYearHeaders = (layer1, layer2, layer3, newXScale, buckets) => {
|
|
5165
5243
|
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) => {
|
|
5166
5244
|
const nextYearStart = (0, import_date_fns3.startOfDay)(new Date(d.getFullYear() + 1, 0, 1));
|
|
5167
5245
|
return newXScale(nextYearStart) - newXScale(d);
|
|
@@ -5188,9 +5266,15 @@ var GanttChart = ({
|
|
|
5188
5266
|
);
|
|
5189
5267
|
return newXScale(d) + (newXScale(nextQuarter) - newXScale(d)) / 2;
|
|
5190
5268
|
}).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}`);
|
|
5269
|
+
layer3.selectAll(".quarter-label").data(quarters2).enter().append("text").attr("class", "quarter-label").attr("x", (d) => {
|
|
5270
|
+
const nextQuarter = (0, import_date_fns3.startOfDay)(
|
|
5271
|
+
new Date(d.getFullYear(), d.getMonth() + 3, 1)
|
|
5272
|
+
);
|
|
5273
|
+
return newXScale(d) + (newXScale(nextQuarter) - newXScale(d)) - 30;
|
|
5274
|
+
}).attr("y", -headersGroupLayer2Height / 2 + 10).attr("dy", "0.35em").attr("text-anchor", "middle").style("font-size", `${HEADER_FONTS.layer2}px`).style("font-weight", "light").style("fill", "#b9b9b9").text((d) => `${getMonthByQuarter(Math.floor(d.getMonth() / 3) + 1)}`);
|
|
5191
5275
|
};
|
|
5192
|
-
const drawHeaders = (layer1, layer2, newXScale, buckets) => {
|
|
5193
|
-
return renderYearHeaders(layer1, layer2, newXScale, buckets);
|
|
5276
|
+
const drawHeaders = (layer1, layer2, layer3, newXScale, buckets) => {
|
|
5277
|
+
return renderYearHeaders(layer1, layer2, layer3, newXScale, buckets);
|
|
5194
5278
|
};
|
|
5195
5279
|
const getGridlineData = (mode2, buckets, domain) => {
|
|
5196
5280
|
if (mode2 === "year") return buckets.uniqueMonths;
|
|
@@ -5257,9 +5341,11 @@ var GanttChart = ({
|
|
|
5257
5341
|
const timeBuckets = buildTimeBuckets(newXScale.domain());
|
|
5258
5342
|
const headersGroupLayer1 = chartGroup.append("g");
|
|
5259
5343
|
const headersGroupLayer2 = chartGroup.append("g");
|
|
5344
|
+
const headersGroupLayer3 = chartGroup.append("g");
|
|
5260
5345
|
drawHeaders(
|
|
5261
5346
|
headersGroupLayer1,
|
|
5262
5347
|
headersGroupLayer2,
|
|
5348
|
+
headersGroupLayer3,
|
|
5263
5349
|
newXScale,
|
|
5264
5350
|
timeBuckets
|
|
5265
5351
|
);
|
|
@@ -5463,14 +5549,14 @@ function CardKPI({
|
|
|
5463
5549
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "border-b", children: [
|
|
5464
5550
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "body-2 ", children: "\u0E01\u0E25\u0E38\u0E48\u0E21\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22" }),
|
|
5465
5551
|
indicator.filter((ind) => ind.indicatorType === "TARGET").map((item, index) => {
|
|
5466
|
-
if (index
|
|
5552
|
+
if (index >= 2) return;
|
|
5467
5553
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(KPIRow, { item });
|
|
5468
5554
|
})
|
|
5469
5555
|
] }),
|
|
5470
5556
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "pt-2", children: [
|
|
5471
5557
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "body-2 ", children: "\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" }),
|
|
5472
5558
|
indicator.filter((ind) => ind.indicatorType === "OUTPUT").map((item, index) => {
|
|
5473
|
-
if (index
|
|
5559
|
+
if (index >= 2) return;
|
|
5474
5560
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(KPIRow, { item });
|
|
5475
5561
|
})
|
|
5476
5562
|
] }),
|
package/dist/index.mjs
CHANGED
|
@@ -4193,9 +4193,9 @@ var FilterPopUp = (filter) => {
|
|
|
4193
4193
|
};
|
|
4194
4194
|
|
|
4195
4195
|
// src/ProfileSelect/ProfileSelect/ProfileSelect.tsx
|
|
4196
|
-
import { useEffect as useEffect7, useRef as useRef6, useState as useState17 } from "react";
|
|
4196
|
+
import { useEffect as useEffect7, useMemo as useMemo2, useRef as useRef6, useState as useState17 } from "react";
|
|
4197
4197
|
import { IconSearch, IconUsers, IconX as IconX4 } from "@tabler/icons-react";
|
|
4198
|
-
import { Input as Input5 } from "antd";
|
|
4198
|
+
import { Collapse, Input as Input5 } from "antd";
|
|
4199
4199
|
import { Fragment as Fragment8, jsx as jsx43, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4200
4200
|
function ProfileSelect({
|
|
4201
4201
|
allUser,
|
|
@@ -4250,12 +4250,29 @@ function ProfileSelect({
|
|
|
4250
4250
|
const extraCount = assignUser.length - (maxVisible - 1);
|
|
4251
4251
|
const normalizedSearch = search.trim().toLowerCase();
|
|
4252
4252
|
const filteredAssigned = normalizedSearch ? assignUser.filter((u) => u.name.toLowerCase().includes(normalizedSearch)) : assignUser;
|
|
4253
|
-
const filteredUnassigned =
|
|
4254
|
-
|
|
4255
|
-
|
|
4253
|
+
const filteredUnassigned = useMemo2(() => {
|
|
4254
|
+
const searchLower = search.trim().toLowerCase();
|
|
4255
|
+
if (!searchLower) return userNotAssign;
|
|
4256
|
+
return userNotAssign.filter(
|
|
4257
|
+
(u) => u.name.toLowerCase().includes(searchLower)
|
|
4258
|
+
);
|
|
4259
|
+
}, [userNotAssign, search]);
|
|
4256
4260
|
const isSearching = normalizedSearch.length > 0;
|
|
4257
4261
|
const noResult = filteredAssigned.length === 0 && filteredUnassigned.length === 0;
|
|
4258
4262
|
const noUserOption = allUser.length === 0 && !isSearching;
|
|
4263
|
+
const groupedUsers = useMemo2(() => {
|
|
4264
|
+
return filteredUnassigned.reduce(
|
|
4265
|
+
(acc, user) => {
|
|
4266
|
+
const groupName = user.institute || "\u0E44\u0E21\u0E48\u0E23\u0E30\u0E1A\u0E38\u0E2B\u0E19\u0E48\u0E27\u0E22\u0E07\u0E32\u0E19";
|
|
4267
|
+
if (!acc[groupName]) {
|
|
4268
|
+
acc[groupName] = [];
|
|
4269
|
+
}
|
|
4270
|
+
acc[groupName].push(user);
|
|
4271
|
+
return acc;
|
|
4272
|
+
},
|
|
4273
|
+
{}
|
|
4274
|
+
);
|
|
4275
|
+
}, [filteredUnassigned]);
|
|
4259
4276
|
return /* @__PURE__ */ jsxs34("div", { ref: containerRef, className: "relative body-1", children: [
|
|
4260
4277
|
mode === "icon" ? /* @__PURE__ */ jsx43("div", { children: /* @__PURE__ */ jsx43(
|
|
4261
4278
|
IconUsers,
|
|
@@ -4393,7 +4410,10 @@ function ProfileSelect({
|
|
|
4393
4410
|
}
|
|
4394
4411
|
)
|
|
4395
4412
|
] }),
|
|
4396
|
-
/* @__PURE__ */
|
|
4413
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex flex-col justify-start items-start", children: [
|
|
4414
|
+
/* @__PURE__ */ jsx43("span", { className: "ml-2 body-3", children: user.name }),
|
|
4415
|
+
/* @__PURE__ */ jsx43("span", { className: "ml-2 body-3 text-gray-400", children: user.institute })
|
|
4416
|
+
] })
|
|
4397
4417
|
]
|
|
4398
4418
|
},
|
|
4399
4419
|
user.id
|
|
@@ -4401,30 +4421,79 @@ function ProfileSelect({
|
|
|
4401
4421
|
] }),
|
|
4402
4422
|
filteredUnassigned.length > 0 && /* @__PURE__ */ jsxs34(Fragment8, { children: [
|
|
4403
4423
|
/* @__PURE__ */ jsx43("div", { className: "mt-2", children: "\u0E1C\u0E39\u0E49\u0E04\u0E19" }),
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
{
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4424
|
+
isSearching ? (
|
|
4425
|
+
// === โหมดค้นหา: แสดงเป็น List ธรรมดา ไม่มี Collapse ===
|
|
4426
|
+
/* @__PURE__ */ jsx43("div", { className: "flex flex-col gap-1", children: filteredUnassigned.map((user) => /* @__PURE__ */ jsxs34(
|
|
4427
|
+
"button",
|
|
4428
|
+
{
|
|
4429
|
+
className: "flex items-center hover:bg-gray-100 w-full p-1 rounded transition-colors text-left",
|
|
4430
|
+
onClick: () => onUpdateAssignUser(user, "add"),
|
|
4431
|
+
children: [
|
|
4432
|
+
/* @__PURE__ */ jsx43(
|
|
4433
|
+
"img",
|
|
4434
|
+
{
|
|
4435
|
+
src: user.profile,
|
|
4436
|
+
style: {
|
|
4437
|
+
width: avatarSize,
|
|
4438
|
+
height: avatarSize,
|
|
4439
|
+
borderRadius: "50%"
|
|
4440
|
+
},
|
|
4441
|
+
className: "border"
|
|
4442
|
+
}
|
|
4443
|
+
),
|
|
4444
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex flex-col ml-2", children: [
|
|
4445
|
+
/* @__PURE__ */ jsx43("span", { className: "body-3", children: user.name }),
|
|
4446
|
+
/* @__PURE__ */ jsx43("span", { className: "body-3 text-gray-400 leading-3", children: user.institute })
|
|
4447
|
+
] })
|
|
4448
|
+
]
|
|
4449
|
+
},
|
|
4450
|
+
user.id
|
|
4451
|
+
)) })
|
|
4452
|
+
) : (
|
|
4453
|
+
// === โหมดปกติ: แสดงเป็น Group ด้วย Collapse ===
|
|
4454
|
+
/* @__PURE__ */ jsx43(
|
|
4455
|
+
Collapse,
|
|
4456
|
+
{
|
|
4457
|
+
ghost: true,
|
|
4458
|
+
size: "small",
|
|
4459
|
+
className: "[&_.ant-collapse-content-box]:!py-[2px]",
|
|
4460
|
+
items: Object.entries(groupedUsers).map(
|
|
4461
|
+
([company, users], index) => ({
|
|
4462
|
+
key: index.toString(),
|
|
4463
|
+
label: /* @__PURE__ */ jsxs34("span", { className: "font-semibold body-3", children: [
|
|
4464
|
+
company,
|
|
4465
|
+
" (",
|
|
4466
|
+
users.length,
|
|
4467
|
+
")"
|
|
4468
|
+
] }),
|
|
4469
|
+
children: /* @__PURE__ */ jsx43("div", { className: "flex flex-col gap-1 pl-2", children: users.map((user) => /* @__PURE__ */ jsxs34(
|
|
4470
|
+
"button",
|
|
4471
|
+
{
|
|
4472
|
+
className: "flex items-center hover:bg-gray-100 w-full p-1 rounded text-left",
|
|
4473
|
+
onClick: () => onUpdateAssignUser(user, "add"),
|
|
4474
|
+
children: [
|
|
4475
|
+
/* @__PURE__ */ jsx43(
|
|
4476
|
+
"img",
|
|
4477
|
+
{
|
|
4478
|
+
src: user.profile,
|
|
4479
|
+
style: {
|
|
4480
|
+
width: avatarSize,
|
|
4481
|
+
height: avatarSize,
|
|
4482
|
+
borderRadius: "50%"
|
|
4483
|
+
},
|
|
4484
|
+
className: "border"
|
|
4485
|
+
}
|
|
4486
|
+
),
|
|
4487
|
+
/* @__PURE__ */ jsx43("span", { className: "ml-2 body-3", children: user.name })
|
|
4488
|
+
]
|
|
4489
|
+
},
|
|
4490
|
+
user.id
|
|
4491
|
+
)) })
|
|
4492
|
+
})
|
|
4493
|
+
)
|
|
4494
|
+
}
|
|
4495
|
+
)
|
|
4496
|
+
)
|
|
4428
4497
|
] })
|
|
4429
4498
|
] }) })
|
|
4430
4499
|
]
|
|
@@ -4637,7 +4706,7 @@ function TabProject({ tabOption, now, onChange }) {
|
|
|
4637
4706
|
}
|
|
4638
4707
|
|
|
4639
4708
|
// src/Chart/BarChart/BarChart.tsx
|
|
4640
|
-
import { useEffect as useEffect9, useMemo as
|
|
4709
|
+
import { useEffect as useEffect9, useMemo as useMemo3, useRef as useRef8 } from "react";
|
|
4641
4710
|
import * as d3 from "d3";
|
|
4642
4711
|
import { jsx as jsx46, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4643
4712
|
var defaultMargin = { top: 30, right: 200, bottom: 36, left: 50 };
|
|
@@ -4697,8 +4766,8 @@ var BarChart = ({
|
|
|
4697
4766
|
ro.observe(containerRef.current);
|
|
4698
4767
|
return () => ro.disconnect();
|
|
4699
4768
|
}, []);
|
|
4700
|
-
const xDomain =
|
|
4701
|
-
const yDomain =
|
|
4769
|
+
const xDomain = useMemo3(() => data.map((d) => d.x), [data]);
|
|
4770
|
+
const yDomain = useMemo3(() => {
|
|
4702
4771
|
const maxY = d3.max(data, (d) => d.y);
|
|
4703
4772
|
return [
|
|
4704
4773
|
0,
|
|
@@ -4982,16 +5051,25 @@ var getAdjustedEnd = (d) => {
|
|
|
4982
5051
|
}
|
|
4983
5052
|
return startOfDay(/* @__PURE__ */ new Date());
|
|
4984
5053
|
};
|
|
5054
|
+
var getMonthByQuarter = (quarter) => {
|
|
5055
|
+
if (quarter === 1) {
|
|
5056
|
+
return "\u0E21.\u0E04. - \u0E21\u0E35.\u0E04.";
|
|
5057
|
+
} else if (quarter === 2) {
|
|
5058
|
+
return "\u0E40\u0E21.\u0E22. - \u0E21\u0E34.\u0E22.";
|
|
5059
|
+
} else if (quarter === 3) {
|
|
5060
|
+
return "\u0E01.\u0E04. - \u0E01.\u0E22.";
|
|
5061
|
+
} else {
|
|
5062
|
+
return "\u0E15.\u0E04. - \u0E18.\u0E04.";
|
|
5063
|
+
}
|
|
5064
|
+
};
|
|
4985
5065
|
var getStatusColor = (status2) => STATUS_META[status2]?.color ?? STATUS_META.IN_PROGRESS.color;
|
|
4986
5066
|
var getStatusLabel = (status2) => STATUS_META[status2]?.label ?? STATUS_META.IN_PROGRESS.label;
|
|
5067
|
+
var toBuddhistDate = (d) => new Date(d.getFullYear() + 543, d.getMonth(), d.getDate());
|
|
4987
5068
|
var ProjectRow = ({ element, barHeight, barSpacing, mode }) => {
|
|
4988
|
-
const safeStartDate = element.startDate instanceof Date ? element.startDate : null;
|
|
4989
5069
|
const safeEndDate = element.endDate instanceof Date ? element.endDate : null;
|
|
4990
|
-
const safeStatus = element.status || "
|
|
4991
|
-
const statusColor = getStatusColor(safeStatus);
|
|
5070
|
+
const safeStatus = element.status || "IN_PROGRESS";
|
|
4992
5071
|
const statusLabel = getStatusLabel(safeStatus);
|
|
4993
5072
|
const statusIcon = STATUS_META[safeStatus]?.icon;
|
|
4994
|
-
const toBuddhistDate = (d) => new Date(d.getFullYear() + 543, d.getMonth(), d.getDate());
|
|
4995
5073
|
return /* @__PURE__ */ jsxs39(
|
|
4996
5074
|
"div",
|
|
4997
5075
|
{
|
|
@@ -5109,7 +5187,7 @@ var GanttChart = ({
|
|
|
5109
5187
|
startOfDay(addDays(domain[1], 1))
|
|
5110
5188
|
) || []
|
|
5111
5189
|
});
|
|
5112
|
-
const renderYearHeaders = (layer1, layer2, newXScale, buckets) => {
|
|
5190
|
+
const renderYearHeaders = (layer1, layer2, layer3, newXScale, buckets) => {
|
|
5113
5191
|
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) => {
|
|
5114
5192
|
const nextYearStart = startOfDay(new Date(d.getFullYear() + 1, 0, 1));
|
|
5115
5193
|
return newXScale(nextYearStart) - newXScale(d);
|
|
@@ -5136,9 +5214,15 @@ var GanttChart = ({
|
|
|
5136
5214
|
);
|
|
5137
5215
|
return newXScale(d) + (newXScale(nextQuarter) - newXScale(d)) / 2;
|
|
5138
5216
|
}).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}`);
|
|
5217
|
+
layer3.selectAll(".quarter-label").data(quarters2).enter().append("text").attr("class", "quarter-label").attr("x", (d) => {
|
|
5218
|
+
const nextQuarter = startOfDay(
|
|
5219
|
+
new Date(d.getFullYear(), d.getMonth() + 3, 1)
|
|
5220
|
+
);
|
|
5221
|
+
return newXScale(d) + (newXScale(nextQuarter) - newXScale(d)) - 30;
|
|
5222
|
+
}).attr("y", -headersGroupLayer2Height / 2 + 10).attr("dy", "0.35em").attr("text-anchor", "middle").style("font-size", `${HEADER_FONTS.layer2}px`).style("font-weight", "light").style("fill", "#b9b9b9").text((d) => `${getMonthByQuarter(Math.floor(d.getMonth() / 3) + 1)}`);
|
|
5139
5223
|
};
|
|
5140
|
-
const drawHeaders = (layer1, layer2, newXScale, buckets) => {
|
|
5141
|
-
return renderYearHeaders(layer1, layer2, newXScale, buckets);
|
|
5224
|
+
const drawHeaders = (layer1, layer2, layer3, newXScale, buckets) => {
|
|
5225
|
+
return renderYearHeaders(layer1, layer2, layer3, newXScale, buckets);
|
|
5142
5226
|
};
|
|
5143
5227
|
const getGridlineData = (mode2, buckets, domain) => {
|
|
5144
5228
|
if (mode2 === "year") return buckets.uniqueMonths;
|
|
@@ -5205,9 +5289,11 @@ var GanttChart = ({
|
|
|
5205
5289
|
const timeBuckets = buildTimeBuckets(newXScale.domain());
|
|
5206
5290
|
const headersGroupLayer1 = chartGroup.append("g");
|
|
5207
5291
|
const headersGroupLayer2 = chartGroup.append("g");
|
|
5292
|
+
const headersGroupLayer3 = chartGroup.append("g");
|
|
5208
5293
|
drawHeaders(
|
|
5209
5294
|
headersGroupLayer1,
|
|
5210
5295
|
headersGroupLayer2,
|
|
5296
|
+
headersGroupLayer3,
|
|
5211
5297
|
newXScale,
|
|
5212
5298
|
timeBuckets
|
|
5213
5299
|
);
|
|
@@ -5411,14 +5497,14 @@ function CardKPI({
|
|
|
5411
5497
|
/* @__PURE__ */ jsxs40("div", { className: "border-b", children: [
|
|
5412
5498
|
/* @__PURE__ */ jsx49("span", { className: "body-2 ", children: "\u0E01\u0E25\u0E38\u0E48\u0E21\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22" }),
|
|
5413
5499
|
indicator.filter((ind) => ind.indicatorType === "TARGET").map((item, index) => {
|
|
5414
|
-
if (index
|
|
5500
|
+
if (index >= 2) return;
|
|
5415
5501
|
return /* @__PURE__ */ jsx49(KPIRow, { item });
|
|
5416
5502
|
})
|
|
5417
5503
|
] }),
|
|
5418
5504
|
/* @__PURE__ */ jsxs40("div", { className: "pt-2", children: [
|
|
5419
5505
|
/* @__PURE__ */ jsx49("span", { className: "body-2 ", children: "\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" }),
|
|
5420
5506
|
indicator.filter((ind) => ind.indicatorType === "OUTPUT").map((item, index) => {
|
|
5421
|
-
if (index
|
|
5507
|
+
if (index >= 2) return;
|
|
5422
5508
|
return /* @__PURE__ */ jsx49(KPIRow, { item });
|
|
5423
5509
|
})
|
|
5424
5510
|
] }),
|