@esic-lab/data-core-ui 0.0.44 → 0.0.46
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 +19 -11
- package/dist/index.d.mts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +435 -16
- package/dist/index.mjs +432 -16
- package/package.json +1 -1
- package/dist/index.cjs +0 -4084
- package/dist/index.d.cts +0 -573
package/dist/index.js
CHANGED
|
@@ -377,7 +377,9 @@ __export(index_exports, {
|
|
|
377
377
|
Loader: () => Loader,
|
|
378
378
|
MenuNavBar: () => MenuNavBar,
|
|
379
379
|
PrimaryButton: () => PrimaryButton,
|
|
380
|
+
ProfileSelect: () => ProfileSelect,
|
|
380
381
|
ProgressBar: () => ProgressBar,
|
|
382
|
+
QRCodeGenerator: () => QRCodeGenerator,
|
|
381
383
|
Radio: () => Radio,
|
|
382
384
|
RadioGroup: () => RadioGroup,
|
|
383
385
|
SecondaryButton: () => SecondaryButton,
|
|
@@ -391,6 +393,7 @@ __export(index_exports, {
|
|
|
391
393
|
SortFilter: () => SortFilter,
|
|
392
394
|
Switch: () => Switch,
|
|
393
395
|
SwitchSelect: () => SwitchSelect,
|
|
396
|
+
TabProject: () => TabProject,
|
|
394
397
|
TabSelectionButton: () => TabSelectionButton,
|
|
395
398
|
TextAreaInput: () => TextAreaInput,
|
|
396
399
|
TextInput: () => TextInput,
|
|
@@ -2482,7 +2485,7 @@ function SelectField({
|
|
|
2482
2485
|
import_antd7.Select,
|
|
2483
2486
|
{
|
|
2484
2487
|
showSearch: true,
|
|
2485
|
-
value,
|
|
2488
|
+
value: value ? value : void 0,
|
|
2486
2489
|
defaultValue,
|
|
2487
2490
|
onChange,
|
|
2488
2491
|
className: `body-1 flex justify-center w-full ${className ?? ""}`,
|
|
@@ -2553,7 +2556,7 @@ function SelectFieldGroup({
|
|
|
2553
2556
|
import_antd8.Select,
|
|
2554
2557
|
{
|
|
2555
2558
|
showSearch: true,
|
|
2556
|
-
value,
|
|
2559
|
+
value: value ? value : void 0,
|
|
2557
2560
|
defaultValue,
|
|
2558
2561
|
onChange,
|
|
2559
2562
|
className: `body-1 flex justify-center w-full ${className ?? ""}`,
|
|
@@ -2640,7 +2643,7 @@ function SelectFieldStatus({
|
|
|
2640
2643
|
{
|
|
2641
2644
|
disabled,
|
|
2642
2645
|
suffixIcon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_icons.DownOutlined, { style: { color: value ? "#fff" : "#D9D9D9" } }),
|
|
2643
|
-
value,
|
|
2646
|
+
value: value ? value : void 0,
|
|
2644
2647
|
onChange,
|
|
2645
2648
|
className: `body-3 custom-select flex justify-center w-full ${className ?? ""}`,
|
|
2646
2649
|
placeholder,
|
|
@@ -2707,7 +2710,7 @@ function SelectFieldStatusReport({
|
|
|
2707
2710
|
{
|
|
2708
2711
|
disabled,
|
|
2709
2712
|
suffixIcon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons2.DownOutlined, { style: { color: value ? "#fff" : "#D9D9D9" } }),
|
|
2710
|
-
value,
|
|
2713
|
+
value: value ? value : void 0,
|
|
2711
2714
|
onChange,
|
|
2712
2715
|
className: `body-3 custom-select flex justify-center w-full ${className ?? ""}`,
|
|
2713
2716
|
placeholder,
|
|
@@ -2779,7 +2782,7 @@ function SelectFieldTag({
|
|
|
2779
2782
|
mode: "tags",
|
|
2780
2783
|
className: `body-1 flex justify-center w-full ${className ?? ""}`,
|
|
2781
2784
|
placeholder,
|
|
2782
|
-
value,
|
|
2785
|
+
value: value ? value : void 0,
|
|
2783
2786
|
onChange: handleChange,
|
|
2784
2787
|
onSearch: handleSearch,
|
|
2785
2788
|
filterOption: (input, option) => {
|
|
@@ -2849,7 +2852,7 @@ function SelectCustom({
|
|
|
2849
2852
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2850
2853
|
import_antd12.Select,
|
|
2851
2854
|
{
|
|
2852
|
-
value,
|
|
2855
|
+
value: value ? value : void 0,
|
|
2853
2856
|
onChange: handleChange,
|
|
2854
2857
|
placeholder,
|
|
2855
2858
|
options: filteredOptions,
|
|
@@ -2858,16 +2861,29 @@ function SelectCustom({
|
|
|
2858
2861
|
}
|
|
2859
2862
|
),
|
|
2860
2863
|
error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-red-500 caption-1", children: error }),
|
|
2861
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "w-full p-[2px] overflow-y-auto", children: valueList.map((v, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2864
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "w-full p-[2px] overflow-y-auto", children: valueList.map((v, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2865
|
+
"div",
|
|
2866
|
+
{
|
|
2867
|
+
className: "flex justify-between items-center py-[2px] body-1",
|
|
2868
|
+
children: [
|
|
2869
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-row gap-[8px]", children: [
|
|
2870
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("p", { children: [
|
|
2871
|
+
index + 1,
|
|
2872
|
+
"."
|
|
2873
|
+
] }),
|
|
2874
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { children: v })
|
|
2875
|
+
] }),
|
|
2876
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2877
|
+
import_icons_react8.IconTrash,
|
|
2878
|
+
{
|
|
2879
|
+
className: "cursor-pointer",
|
|
2880
|
+
onClick: () => handleDelete(v)
|
|
2881
|
+
}
|
|
2882
|
+
)
|
|
2883
|
+
]
|
|
2884
|
+
},
|
|
2885
|
+
index
|
|
2886
|
+
)) })
|
|
2871
2887
|
] })
|
|
2872
2888
|
}
|
|
2873
2889
|
);
|
|
@@ -3949,6 +3965,406 @@ var FilterPopUp = (filter) => {
|
|
|
3949
3965
|
] }) : void 0
|
|
3950
3966
|
] });
|
|
3951
3967
|
};
|
|
3968
|
+
|
|
3969
|
+
// src/ProfileSelect/ProfileSelect/ProfileSelect.tsx
|
|
3970
|
+
var import_react19 = require("react");
|
|
3971
|
+
var import_icons_react14 = require("@tabler/icons-react");
|
|
3972
|
+
var import_antd21 = require("antd");
|
|
3973
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3974
|
+
function ProfileSelect({
|
|
3975
|
+
allUser,
|
|
3976
|
+
assignUser,
|
|
3977
|
+
mode,
|
|
3978
|
+
onUpdateAssignUser
|
|
3979
|
+
}) {
|
|
3980
|
+
const [maxVisible, setMaxVisible] = (0, import_react19.useState)(4);
|
|
3981
|
+
const [userNotAssign, setUserNotAssign] = (0, import_react19.useState)([]);
|
|
3982
|
+
const [search, setSearch] = (0, import_react19.useState)("");
|
|
3983
|
+
const [isShowSelect, setIsShowSelect] = (0, import_react19.useState)(false);
|
|
3984
|
+
const containerRef = (0, import_react19.useRef)(null);
|
|
3985
|
+
const selectRef = (0, import_react19.useRef)(null);
|
|
3986
|
+
const avatarSize = 30;
|
|
3987
|
+
const spacing = 8;
|
|
3988
|
+
(0, import_react19.useEffect)(() => {
|
|
3989
|
+
const handler = (e) => {
|
|
3990
|
+
if (!selectRef?.current?.contains(e.target) && !containerRef?.current?.contains(e.target)) {
|
|
3991
|
+
setIsShowSelect(false);
|
|
3992
|
+
}
|
|
3993
|
+
};
|
|
3994
|
+
document.addEventListener("mousedown", handler);
|
|
3995
|
+
return () => {
|
|
3996
|
+
document.removeEventListener("mousedown", handler);
|
|
3997
|
+
};
|
|
3998
|
+
}, []);
|
|
3999
|
+
(0, import_react19.useEffect)(() => {
|
|
4000
|
+
if (!containerRef.current) return;
|
|
4001
|
+
const updateWidth = () => {
|
|
4002
|
+
if (containerRef.current) {
|
|
4003
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
4004
|
+
const count = Math.floor(rect.width / (avatarSize + spacing));
|
|
4005
|
+
setMaxVisible(Math.max(1, count));
|
|
4006
|
+
}
|
|
4007
|
+
};
|
|
4008
|
+
const resizeObserver = new ResizeObserver(updateWidth);
|
|
4009
|
+
resizeObserver.observe(containerRef.current);
|
|
4010
|
+
updateWidth();
|
|
4011
|
+
return () => {
|
|
4012
|
+
resizeObserver.disconnect();
|
|
4013
|
+
};
|
|
4014
|
+
}, [allUser]);
|
|
4015
|
+
(0, import_react19.useEffect)(() => {
|
|
4016
|
+
setUserNotAssign(
|
|
4017
|
+
allUser.filter((u) => !assignUser.some((au) => au.id === u.id))
|
|
4018
|
+
);
|
|
4019
|
+
}, [allUser, assignUser]);
|
|
4020
|
+
const showPlus = assignUser.length > maxVisible;
|
|
4021
|
+
const visibleUsers = showPlus ? assignUser.slice(0, maxVisible - 1) : assignUser;
|
|
4022
|
+
const extraCount = assignUser.length - (maxVisible - 1);
|
|
4023
|
+
const normalizedSearch = search.trim().toLowerCase();
|
|
4024
|
+
const filteredAssigned = normalizedSearch ? assignUser.filter(
|
|
4025
|
+
(u) => u.name.toLowerCase().includes(normalizedSearch)
|
|
4026
|
+
) : assignUser;
|
|
4027
|
+
const filteredUnassigned = normalizedSearch ? userNotAssign.filter(
|
|
4028
|
+
(u) => u.name.toLowerCase().includes(normalizedSearch)
|
|
4029
|
+
) : userNotAssign;
|
|
4030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { ref: containerRef, className: "relative body-1", children: [
|
|
4031
|
+
mode === "icon" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4032
|
+
import_icons_react14.IconUsers,
|
|
4033
|
+
{
|
|
4034
|
+
size: 40,
|
|
4035
|
+
className: "p-2 border rounded cursor-pointer",
|
|
4036
|
+
onClick: () => setIsShowSelect(!isShowSelect)
|
|
4037
|
+
}
|
|
4038
|
+
) }) : mode === "showAssign" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4039
|
+
"button",
|
|
4040
|
+
{
|
|
4041
|
+
className: "w-full h-[40px] flex -space-x-2 p-2 border-1 rounded-sm",
|
|
4042
|
+
onClick: () => setIsShowSelect(!isShowSelect),
|
|
4043
|
+
children: [
|
|
4044
|
+
visibleUsers.map((user) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex items-center cursor-point", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "relative group cursor-pointer", children: [
|
|
4045
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4046
|
+
"img",
|
|
4047
|
+
{
|
|
4048
|
+
src: user.profile,
|
|
4049
|
+
alt: user.name,
|
|
4050
|
+
style: {
|
|
4051
|
+
width: avatarSize,
|
|
4052
|
+
height: avatarSize,
|
|
4053
|
+
borderRadius: "50%"
|
|
4054
|
+
},
|
|
4055
|
+
className: "border border-white group-hover:border-2 group-hover:border-red-500 transition"
|
|
4056
|
+
}
|
|
4057
|
+
),
|
|
4058
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4059
|
+
"span",
|
|
4060
|
+
{
|
|
4061
|
+
className: "absolute top-0 right-0 -translate-y-2 translate-x-2 \r\n rounded-full bg-white opacity-0 group-hover:opacity-100 \r\n border-2 border-red-500 flex items-center justify-center transition",
|
|
4062
|
+
onClick: () => onUpdateAssignUser(user, "remove"),
|
|
4063
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons_react14.IconX, { className: "w-4 h-4 text-red-500" })
|
|
4064
|
+
}
|
|
4065
|
+
)
|
|
4066
|
+
] }) }, user.id)),
|
|
4067
|
+
showPlus && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4068
|
+
"div",
|
|
4069
|
+
{
|
|
4070
|
+
className: "border border-white flex items-center justify-center bg-gray-300 text-black text-sm",
|
|
4071
|
+
style: {
|
|
4072
|
+
width: avatarSize,
|
|
4073
|
+
height: avatarSize,
|
|
4074
|
+
borderRadius: "50%"
|
|
4075
|
+
},
|
|
4076
|
+
children: [
|
|
4077
|
+
"+",
|
|
4078
|
+
extraCount
|
|
4079
|
+
]
|
|
4080
|
+
}
|
|
4081
|
+
)
|
|
4082
|
+
]
|
|
4083
|
+
}
|
|
4084
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "w-full h-[40px] flex -space-x-2 p-2 border-1 rounded-sm", children: [
|
|
4085
|
+
visibleUsers.map((user) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex items-center ", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("label", { className: "relative group ", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4086
|
+
"img",
|
|
4087
|
+
{
|
|
4088
|
+
src: user.profile,
|
|
4089
|
+
alt: user.name,
|
|
4090
|
+
style: {
|
|
4091
|
+
width: avatarSize,
|
|
4092
|
+
height: avatarSize,
|
|
4093
|
+
borderRadius: "50%"
|
|
4094
|
+
},
|
|
4095
|
+
className: "border border-white transition"
|
|
4096
|
+
}
|
|
4097
|
+
) }) }, user.id)),
|
|
4098
|
+
showPlus && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4099
|
+
"div",
|
|
4100
|
+
{
|
|
4101
|
+
className: "border border-white flex items-center justify-center bg-gray-300 text-black text-sm",
|
|
4102
|
+
style: {
|
|
4103
|
+
width: avatarSize,
|
|
4104
|
+
height: avatarSize,
|
|
4105
|
+
borderRadius: "50%"
|
|
4106
|
+
},
|
|
4107
|
+
children: [
|
|
4108
|
+
"+",
|
|
4109
|
+
extraCount
|
|
4110
|
+
]
|
|
4111
|
+
}
|
|
4112
|
+
)
|
|
4113
|
+
] }),
|
|
4114
|
+
isShowSelect ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4115
|
+
"div",
|
|
4116
|
+
{
|
|
4117
|
+
className: "absolute top-12 min-w-[261px] max-w-[400px] w-full h-[314px] p-2 text-xs border-1 rounded-sm ",
|
|
4118
|
+
ref: selectRef,
|
|
4119
|
+
children: [
|
|
4120
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex border-1 rounded-md p-2 gap-2 items-center", children: [
|
|
4121
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons_react14.IconSearch, {}),
|
|
4122
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4123
|
+
import_antd21.Input,
|
|
4124
|
+
{
|
|
4125
|
+
variant: "borderless",
|
|
4126
|
+
placeholder: "\u0E04\u0E49\u0E19\u0E2B\u0E32\u0E0A\u0E37\u0E48\u0E2D",
|
|
4127
|
+
className: "body-3",
|
|
4128
|
+
value: search,
|
|
4129
|
+
onChange: (e) => setSearch(e.target.value)
|
|
4130
|
+
}
|
|
4131
|
+
)
|
|
4132
|
+
] }),
|
|
4133
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "overflow-y-auto h-[250px] pt-2 px-4 body-3", children: [
|
|
4134
|
+
filteredAssigned.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
4135
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: "\u0E2A\u0E21\u0E32\u0E0A\u0E34\u0E01\u0E17\u0E35\u0E48\u0E40\u0E25\u0E37\u0E2D\u0E01" }),
|
|
4136
|
+
filteredAssigned.map((user) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4137
|
+
"button",
|
|
4138
|
+
{
|
|
4139
|
+
className: "flex items-center group my-1 w-full p-1 rounded hover:bg-gray-100",
|
|
4140
|
+
onClick: () => onUpdateAssignUser(user, "remove"),
|
|
4141
|
+
children: [
|
|
4142
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "relative cursor-pointer", children: [
|
|
4143
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4144
|
+
"img",
|
|
4145
|
+
{
|
|
4146
|
+
src: user.profile,
|
|
4147
|
+
alt: user.name,
|
|
4148
|
+
style: {
|
|
4149
|
+
width: avatarSize,
|
|
4150
|
+
height: avatarSize,
|
|
4151
|
+
borderRadius: "50%"
|
|
4152
|
+
},
|
|
4153
|
+
className: "border-2 border-red-500"
|
|
4154
|
+
}
|
|
4155
|
+
),
|
|
4156
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4157
|
+
"span",
|
|
4158
|
+
{
|
|
4159
|
+
className: "absolute top-0 right-0 -translate-y-2 translate-x-2 \r\n rounded-full bg-white opacity-0 group-hover:opacity-100 \r\n border-2 border-red-500 flex items-center justify-center transition",
|
|
4160
|
+
onClick: () => onUpdateAssignUser(user, "remove"),
|
|
4161
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons_react14.IconX, { className: "text-red-500", size: 15 })
|
|
4162
|
+
}
|
|
4163
|
+
)
|
|
4164
|
+
] }),
|
|
4165
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "ml-2", children: user.name })
|
|
4166
|
+
]
|
|
4167
|
+
},
|
|
4168
|
+
user.id
|
|
4169
|
+
))
|
|
4170
|
+
] }),
|
|
4171
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: "\u0E1C\u0E39\u0E49\u0E04\u0E19 " }),
|
|
4172
|
+
filteredUnassigned.map((user) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4173
|
+
"button",
|
|
4174
|
+
{
|
|
4175
|
+
className: "flex items-center my-1 hover:bg-gray-100 w-full p-1 rounded",
|
|
4176
|
+
onClick: () => onUpdateAssignUser(user),
|
|
4177
|
+
children: [
|
|
4178
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4179
|
+
"img",
|
|
4180
|
+
{
|
|
4181
|
+
src: user.profile,
|
|
4182
|
+
alt: user.name,
|
|
4183
|
+
style: {
|
|
4184
|
+
width: avatarSize,
|
|
4185
|
+
height: avatarSize,
|
|
4186
|
+
borderRadius: "50%"
|
|
4187
|
+
},
|
|
4188
|
+
className: "border "
|
|
4189
|
+
}
|
|
4190
|
+
),
|
|
4191
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "ml-2", children: user.name })
|
|
4192
|
+
]
|
|
4193
|
+
},
|
|
4194
|
+
user.id
|
|
4195
|
+
))
|
|
4196
|
+
] })
|
|
4197
|
+
]
|
|
4198
|
+
}
|
|
4199
|
+
) : null
|
|
4200
|
+
] });
|
|
4201
|
+
}
|
|
4202
|
+
|
|
4203
|
+
// src/Button/QRCode/QRCode.tsx
|
|
4204
|
+
var import_react20 = require("react");
|
|
4205
|
+
var import_qrcode = __toESM(require("qrcode"));
|
|
4206
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4207
|
+
var QRCodeGenerator = ({
|
|
4208
|
+
url,
|
|
4209
|
+
previewSize = 200,
|
|
4210
|
+
defaultExportSize = 512,
|
|
4211
|
+
fileBaseName = "qr-code"
|
|
4212
|
+
}) => {
|
|
4213
|
+
const canvasRef = (0, import_react20.useRef)(null);
|
|
4214
|
+
const [format3, setFormat] = (0, import_react20.useState)("png");
|
|
4215
|
+
const [exportSize, setExportSize] = (0, import_react20.useState)(defaultExportSize);
|
|
4216
|
+
const sizeOption = [
|
|
4217
|
+
{
|
|
4218
|
+
label: "64 x 64",
|
|
4219
|
+
value: "64"
|
|
4220
|
+
},
|
|
4221
|
+
{
|
|
4222
|
+
label: "128 x 128",
|
|
4223
|
+
value: "128"
|
|
4224
|
+
},
|
|
4225
|
+
{
|
|
4226
|
+
label: "256 x 256",
|
|
4227
|
+
value: "256"
|
|
4228
|
+
},
|
|
4229
|
+
{
|
|
4230
|
+
label: "512 x 512",
|
|
4231
|
+
value: "512"
|
|
4232
|
+
},
|
|
4233
|
+
{
|
|
4234
|
+
label: "1024 x 1024",
|
|
4235
|
+
value: "1024"
|
|
4236
|
+
},
|
|
4237
|
+
{
|
|
4238
|
+
label: "2048 x 2048",
|
|
4239
|
+
value: "2048"
|
|
4240
|
+
},
|
|
4241
|
+
{
|
|
4242
|
+
label: "4096 x 4096",
|
|
4243
|
+
value: "4096"
|
|
4244
|
+
}
|
|
4245
|
+
];
|
|
4246
|
+
const typeOption = [
|
|
4247
|
+
{
|
|
4248
|
+
label: "PNG",
|
|
4249
|
+
value: "png"
|
|
4250
|
+
},
|
|
4251
|
+
{
|
|
4252
|
+
label: "SVG",
|
|
4253
|
+
value: "svg"
|
|
4254
|
+
},
|
|
4255
|
+
{
|
|
4256
|
+
label: "JPEG",
|
|
4257
|
+
value: "jpeg"
|
|
4258
|
+
}
|
|
4259
|
+
];
|
|
4260
|
+
(0, import_react20.useEffect)(() => {
|
|
4261
|
+
if (!canvasRef.current) return;
|
|
4262
|
+
import_qrcode.default.toCanvas(canvasRef.current, url, { width: previewSize, margin: 1 }, (error) => {
|
|
4263
|
+
if (error) console.error(error);
|
|
4264
|
+
});
|
|
4265
|
+
}, [url, previewSize]);
|
|
4266
|
+
const download = async () => {
|
|
4267
|
+
try {
|
|
4268
|
+
if (format3 === "svg") {
|
|
4269
|
+
const svgString = await import_qrcode.default.toString(url, {
|
|
4270
|
+
type: "svg",
|
|
4271
|
+
width: exportSize,
|
|
4272
|
+
margin: 1
|
|
4273
|
+
});
|
|
4274
|
+
const blob = new Blob([svgString], { type: "image/svg+xml" });
|
|
4275
|
+
const objUrl = URL.createObjectURL(blob);
|
|
4276
|
+
triggerDownload(objUrl, `${fileBaseName}.svg`);
|
|
4277
|
+
URL.revokeObjectURL(objUrl);
|
|
4278
|
+
} else {
|
|
4279
|
+
const offscreen = document.createElement("canvas");
|
|
4280
|
+
await import_qrcode.default.toCanvas(offscreen, url, {
|
|
4281
|
+
width: exportSize,
|
|
4282
|
+
margin: 1
|
|
4283
|
+
});
|
|
4284
|
+
const mime = format3 === "png" ? "image/png" : "image/jpeg";
|
|
4285
|
+
const dataURL = format3 === "jpeg" ? offscreen.toDataURL(mime, 0.92) : offscreen.toDataURL(mime);
|
|
4286
|
+
triggerDownload(dataURL, `${fileBaseName}.${format3}`);
|
|
4287
|
+
}
|
|
4288
|
+
} catch (err) {
|
|
4289
|
+
console.error("Failed to generate QR export:", err);
|
|
4290
|
+
alert("Sorry, something went wrong creating the download.");
|
|
4291
|
+
}
|
|
4292
|
+
};
|
|
4293
|
+
const triggerDownload = (href, filename) => {
|
|
4294
|
+
const a = document.createElement("a");
|
|
4295
|
+
a.href = href;
|
|
4296
|
+
a.download = filename;
|
|
4297
|
+
document.body.appendChild(a);
|
|
4298
|
+
a.click();
|
|
4299
|
+
a.remove();
|
|
4300
|
+
};
|
|
4301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { style: { display: "inline-flex", flexDirection: "column", gap: 8 }, className: "justify-center items-center", children: [
|
|
4302
|
+
url === "" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "border-1 p-2 mb-2", style: { width: `${previewSize}px`, height: `${previewSize}px` } }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("canvas", { ref: canvasRef, className: "border-1 p-2 mb-2" }),
|
|
4303
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
4304
|
+
"div",
|
|
4305
|
+
{
|
|
4306
|
+
style: {
|
|
4307
|
+
display: "flex",
|
|
4308
|
+
gap: 8,
|
|
4309
|
+
alignItems: "center",
|
|
4310
|
+
flexWrap: "wrap"
|
|
4311
|
+
},
|
|
4312
|
+
className: "flex-col",
|
|
4313
|
+
children: [
|
|
4314
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex gap-2 mx-2", children: [
|
|
4315
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { className: "border-1 p-2 rounded-md flex flex-col w-1/2 text-sm text-gray-400", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4316
|
+
SelectField,
|
|
4317
|
+
{
|
|
4318
|
+
label: "\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A",
|
|
4319
|
+
value: format3,
|
|
4320
|
+
onChange: (e) => setFormat(e.target.value),
|
|
4321
|
+
options: typeOption
|
|
4322
|
+
}
|
|
4323
|
+
) }),
|
|
4324
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { className: "border-1 p-2 rounded-md flex flex-col w-1/2 text-sm text-gray-400", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4325
|
+
SelectField,
|
|
4326
|
+
{
|
|
4327
|
+
label: "\u0E02\u0E19\u0E32\u0E14 (px)",
|
|
4328
|
+
value: exportSize,
|
|
4329
|
+
onChange: (e) => setExportSize(Number(e.target.value)),
|
|
4330
|
+
options: sizeOption
|
|
4331
|
+
}
|
|
4332
|
+
) })
|
|
4333
|
+
] }),
|
|
4334
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PrimaryButton, { onClick: download, disabled: url === "", textColor: "white", title: "\u0E14\u0E32\u0E27\u0E42\u0E2B\u0E25\u0E14\u0E23\u0E2B\u0E31\u0E2A QR" })
|
|
4335
|
+
]
|
|
4336
|
+
}
|
|
4337
|
+
)
|
|
4338
|
+
] });
|
|
4339
|
+
};
|
|
4340
|
+
|
|
4341
|
+
// src/TabPropject/Tabproject/TabProject.tsx
|
|
4342
|
+
var import_antd22 = require("antd");
|
|
4343
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
4344
|
+
function TabProject({ tabOption, now, onChange }) {
|
|
4345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4346
|
+
import_antd22.Tabs,
|
|
4347
|
+
{
|
|
4348
|
+
activeKey: now,
|
|
4349
|
+
items: tabOption.map((item, i) => {
|
|
4350
|
+
return {
|
|
4351
|
+
key: item.key,
|
|
4352
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
4353
|
+
"button",
|
|
4354
|
+
{
|
|
4355
|
+
className: "tab-label flex gap-2 items-center body-1",
|
|
4356
|
+
onClick: () => onChange(item.key),
|
|
4357
|
+
children: [
|
|
4358
|
+
item.icon,
|
|
4359
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: item.label })
|
|
4360
|
+
]
|
|
4361
|
+
}
|
|
4362
|
+
)
|
|
4363
|
+
};
|
|
4364
|
+
})
|
|
4365
|
+
}
|
|
4366
|
+
);
|
|
4367
|
+
}
|
|
3952
4368
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3953
4369
|
0 && (module.exports = {
|
|
3954
4370
|
AntDModal,
|
|
@@ -3973,7 +4389,9 @@ var FilterPopUp = (filter) => {
|
|
|
3973
4389
|
Loader,
|
|
3974
4390
|
MenuNavBar,
|
|
3975
4391
|
PrimaryButton,
|
|
4392
|
+
ProfileSelect,
|
|
3976
4393
|
ProgressBar,
|
|
4394
|
+
QRCodeGenerator,
|
|
3977
4395
|
Radio,
|
|
3978
4396
|
RadioGroup,
|
|
3979
4397
|
SecondaryButton,
|
|
@@ -3987,6 +4405,7 @@ var FilterPopUp = (filter) => {
|
|
|
3987
4405
|
SortFilter,
|
|
3988
4406
|
Switch,
|
|
3989
4407
|
SwitchSelect,
|
|
4408
|
+
TabProject,
|
|
3990
4409
|
TabSelectionButton,
|
|
3991
4410
|
TextAreaInput,
|
|
3992
4411
|
TextInput,
|