@esic-lab/data-core-ui 0.0.63 → 0.0.64
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.d.mts +12 -6
- package/dist/index.d.ts +12 -6
- package/dist/index.js +39 -56
- package/dist/index.mjs +40 -63
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -19,8 +19,9 @@ interface PrimaryButtonProps {
|
|
|
19
19
|
colorPrimary?: string;
|
|
20
20
|
colorPrimaryHover?: string;
|
|
21
21
|
textColor?: string;
|
|
22
|
+
className?: string;
|
|
22
23
|
}
|
|
23
|
-
declare function PrimaryButton({ title, onClick, disabled, iconPlacement, size, colorPrimary, colorPrimaryHover, textColor, icon, }: PrimaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
declare function PrimaryButton({ title, onClick, disabled, iconPlacement, size, colorPrimary, colorPrimaryHover, textColor, icon, className, }: PrimaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
24
25
|
|
|
25
26
|
interface SecondaryButtonProps {
|
|
26
27
|
title: string;
|
|
@@ -33,8 +34,9 @@ interface SecondaryButtonProps {
|
|
|
33
34
|
defaultHoverBorderColor?: string;
|
|
34
35
|
defaultHoverColor?: string;
|
|
35
36
|
textColor?: string;
|
|
37
|
+
className?: string;
|
|
36
38
|
}
|
|
37
|
-
declare function SecondaryButton({ title, onClick, disabled, iconPlacement, size, colorBgContainer, defaultHoverBorderColor, defaultHoverColor, textColor, icon, }: SecondaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
39
|
+
declare function SecondaryButton({ title, onClick, disabled, iconPlacement, size, colorBgContainer, defaultHoverBorderColor, defaultHoverColor, textColor, icon, className, }: SecondaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
38
40
|
|
|
39
41
|
interface GhostButtonProps {
|
|
40
42
|
title: string;
|
|
@@ -66,8 +68,9 @@ interface TertiaryButtonProps {
|
|
|
66
68
|
colorPrimary?: string;
|
|
67
69
|
colorPrimaryHover?: string;
|
|
68
70
|
textColor?: string;
|
|
71
|
+
className?: string;
|
|
69
72
|
}
|
|
70
|
-
declare function TertiaryButton({ title, onClick, disabled, iconPlacement, size, colorPrimary, colorPrimaryHover, textColor, icon, }: TertiaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
73
|
+
declare function TertiaryButton({ title, onClick, disabled, iconPlacement, size, colorPrimary, colorPrimaryHover, textColor, icon, className, }: TertiaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
71
74
|
|
|
72
75
|
interface LoaderProps {
|
|
73
76
|
size?: number;
|
|
@@ -271,8 +274,11 @@ interface InputFieldNumberProps {
|
|
|
271
274
|
changeOnWheel?: boolean;
|
|
272
275
|
formatter?: InputNumberProps["formatter"];
|
|
273
276
|
parser?: InputNumberProps["parser"];
|
|
277
|
+
decimal?: boolean;
|
|
278
|
+
decimalScale?: number;
|
|
279
|
+
format?: "number" | "currency";
|
|
274
280
|
}
|
|
275
|
-
declare function InputFieldNumber({ value, onChange, placeholder, label, required, disabled, error, addonBefore, addonAfter, defaultValue, className, max, min, controls, size, changeOnWheel, formatter, parser, }: InputFieldNumberProps): react_jsx_runtime.JSX.Element;
|
|
281
|
+
declare function InputFieldNumber({ value, onChange, placeholder, label, required, disabled, error, addonBefore, addonAfter, defaultValue, className, max, min, controls, size, changeOnWheel, formatter, parser, decimal, decimalScale, format, }: InputFieldNumberProps): react_jsx_runtime.JSX.Element;
|
|
276
282
|
|
|
277
283
|
interface DatePickerBasicProps {
|
|
278
284
|
value: Date | null;
|
|
@@ -555,7 +561,7 @@ interface IndicatorProps {
|
|
|
555
561
|
value: string;
|
|
556
562
|
label: string;
|
|
557
563
|
}[];
|
|
558
|
-
type: "OUTPUT" | "OUTCOME";
|
|
564
|
+
type: "OUTPUT" | "OUTCOME" | "TARGET";
|
|
559
565
|
arrayData: IndicatorArray[];
|
|
560
566
|
canEdit?: boolean;
|
|
561
567
|
setArrayData: (data: IndicatorArray[]) => void;
|
|
@@ -566,7 +572,7 @@ interface IndicatorProps {
|
|
|
566
572
|
}) => void;
|
|
567
573
|
}
|
|
568
574
|
interface IndicatorArray {
|
|
569
|
-
indicatorType: "OUTPUT" | "OUTCOME";
|
|
575
|
+
indicatorType: "OUTPUT" | "OUTCOME" | "TARGET";
|
|
570
576
|
inputType: "TEXT" | "NUMBER";
|
|
571
577
|
textValue: string;
|
|
572
578
|
numberValue?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -19,8 +19,9 @@ interface PrimaryButtonProps {
|
|
|
19
19
|
colorPrimary?: string;
|
|
20
20
|
colorPrimaryHover?: string;
|
|
21
21
|
textColor?: string;
|
|
22
|
+
className?: string;
|
|
22
23
|
}
|
|
23
|
-
declare function PrimaryButton({ title, onClick, disabled, iconPlacement, size, colorPrimary, colorPrimaryHover, textColor, icon, }: PrimaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
declare function PrimaryButton({ title, onClick, disabled, iconPlacement, size, colorPrimary, colorPrimaryHover, textColor, icon, className, }: PrimaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
24
25
|
|
|
25
26
|
interface SecondaryButtonProps {
|
|
26
27
|
title: string;
|
|
@@ -33,8 +34,9 @@ interface SecondaryButtonProps {
|
|
|
33
34
|
defaultHoverBorderColor?: string;
|
|
34
35
|
defaultHoverColor?: string;
|
|
35
36
|
textColor?: string;
|
|
37
|
+
className?: string;
|
|
36
38
|
}
|
|
37
|
-
declare function SecondaryButton({ title, onClick, disabled, iconPlacement, size, colorBgContainer, defaultHoverBorderColor, defaultHoverColor, textColor, icon, }: SecondaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
39
|
+
declare function SecondaryButton({ title, onClick, disabled, iconPlacement, size, colorBgContainer, defaultHoverBorderColor, defaultHoverColor, textColor, icon, className, }: SecondaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
38
40
|
|
|
39
41
|
interface GhostButtonProps {
|
|
40
42
|
title: string;
|
|
@@ -66,8 +68,9 @@ interface TertiaryButtonProps {
|
|
|
66
68
|
colorPrimary?: string;
|
|
67
69
|
colorPrimaryHover?: string;
|
|
68
70
|
textColor?: string;
|
|
71
|
+
className?: string;
|
|
69
72
|
}
|
|
70
|
-
declare function TertiaryButton({ title, onClick, disabled, iconPlacement, size, colorPrimary, colorPrimaryHover, textColor, icon, }: TertiaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
73
|
+
declare function TertiaryButton({ title, onClick, disabled, iconPlacement, size, colorPrimary, colorPrimaryHover, textColor, icon, className, }: TertiaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
71
74
|
|
|
72
75
|
interface LoaderProps {
|
|
73
76
|
size?: number;
|
|
@@ -271,8 +274,11 @@ interface InputFieldNumberProps {
|
|
|
271
274
|
changeOnWheel?: boolean;
|
|
272
275
|
formatter?: InputNumberProps["formatter"];
|
|
273
276
|
parser?: InputNumberProps["parser"];
|
|
277
|
+
decimal?: boolean;
|
|
278
|
+
decimalScale?: number;
|
|
279
|
+
format?: "number" | "currency";
|
|
274
280
|
}
|
|
275
|
-
declare function InputFieldNumber({ value, onChange, placeholder, label, required, disabled, error, addonBefore, addonAfter, defaultValue, className, max, min, controls, size, changeOnWheel, formatter, parser, }: InputFieldNumberProps): react_jsx_runtime.JSX.Element;
|
|
281
|
+
declare function InputFieldNumber({ value, onChange, placeholder, label, required, disabled, error, addonBefore, addonAfter, defaultValue, className, max, min, controls, size, changeOnWheel, formatter, parser, decimal, decimalScale, format, }: InputFieldNumberProps): react_jsx_runtime.JSX.Element;
|
|
276
282
|
|
|
277
283
|
interface DatePickerBasicProps {
|
|
278
284
|
value: Date | null;
|
|
@@ -555,7 +561,7 @@ interface IndicatorProps {
|
|
|
555
561
|
value: string;
|
|
556
562
|
label: string;
|
|
557
563
|
}[];
|
|
558
|
-
type: "OUTPUT" | "OUTCOME";
|
|
564
|
+
type: "OUTPUT" | "OUTCOME" | "TARGET";
|
|
559
565
|
arrayData: IndicatorArray[];
|
|
560
566
|
canEdit?: boolean;
|
|
561
567
|
setArrayData: (data: IndicatorArray[]) => void;
|
|
@@ -566,7 +572,7 @@ interface IndicatorProps {
|
|
|
566
572
|
}) => void;
|
|
567
573
|
}
|
|
568
574
|
interface IndicatorArray {
|
|
569
|
-
indicatorType: "OUTPUT" | "OUTCOME";
|
|
575
|
+
indicatorType: "OUTPUT" | "OUTCOME" | "TARGET";
|
|
570
576
|
inputType: "TEXT" | "NUMBER";
|
|
571
577
|
textValue: string;
|
|
572
578
|
numberValue?: number;
|
package/dist/index.js
CHANGED
|
@@ -424,7 +424,8 @@ function PrimaryButton({
|
|
|
424
424
|
colorPrimary = "#4e61f6",
|
|
425
425
|
colorPrimaryHover = "#8895f9",
|
|
426
426
|
textColor = "#ffffff",
|
|
427
|
-
icon
|
|
427
|
+
icon,
|
|
428
|
+
className
|
|
428
429
|
}) {
|
|
429
430
|
const textClass = size === "large" ? "body-1" : "body-3";
|
|
430
431
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -443,7 +444,7 @@ function PrimaryButton({
|
|
|
443
444
|
size,
|
|
444
445
|
onClick,
|
|
445
446
|
type: "primary",
|
|
446
|
-
className: textClass
|
|
447
|
+
className: `${textClass} ${className ?? ""}`,
|
|
447
448
|
disabled,
|
|
448
449
|
icon,
|
|
449
450
|
iconPosition: iconPlacement,
|
|
@@ -467,7 +468,8 @@ function SecondaryButton({
|
|
|
467
468
|
defaultHoverBorderColor = "#7181f8",
|
|
468
469
|
defaultHoverColor = "#7181f8",
|
|
469
470
|
textColor = "rgba(0,0,0,0.88)",
|
|
470
|
-
icon
|
|
471
|
+
icon,
|
|
472
|
+
className
|
|
471
473
|
}) {
|
|
472
474
|
const textClass = size === "large" ? "body-1" : "body-3";
|
|
473
475
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
@@ -491,7 +493,7 @@ function SecondaryButton({
|
|
|
491
493
|
size,
|
|
492
494
|
onClick,
|
|
493
495
|
type: "default",
|
|
494
|
-
className: textClass
|
|
496
|
+
className: `${textClass} ${className ?? ""}`,
|
|
495
497
|
disabled,
|
|
496
498
|
icon,
|
|
497
499
|
iconPosition: iconPlacement,
|
|
@@ -549,7 +551,8 @@ function TertiaryButton({
|
|
|
549
551
|
colorPrimary = "#000",
|
|
550
552
|
colorPrimaryHover = "#4d5461",
|
|
551
553
|
textColor = "white",
|
|
552
|
-
icon
|
|
554
|
+
icon,
|
|
555
|
+
className
|
|
553
556
|
}) {
|
|
554
557
|
const textClass = size === "large" ? "body-1" : "body-3";
|
|
555
558
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -568,7 +571,7 @@ function TertiaryButton({
|
|
|
568
571
|
size,
|
|
569
572
|
onClick,
|
|
570
573
|
type: "primary",
|
|
571
|
-
className: textClass
|
|
574
|
+
className: `${textClass} ${className ?? ""}`,
|
|
572
575
|
disabled,
|
|
573
576
|
icon,
|
|
574
577
|
iconPosition: iconPlacement,
|
|
@@ -1340,8 +1343,26 @@ function InputFieldNumber({
|
|
|
1340
1343
|
size,
|
|
1341
1344
|
changeOnWheel,
|
|
1342
1345
|
formatter,
|
|
1343
|
-
parser
|
|
1346
|
+
parser,
|
|
1347
|
+
decimal = false,
|
|
1348
|
+
decimalScale = 2,
|
|
1349
|
+
format: format5 = "number"
|
|
1344
1350
|
}) {
|
|
1351
|
+
const safeScale = Math.max(0, Math.min(decimalScale, 10));
|
|
1352
|
+
const addComma = (s) => s.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
1353
|
+
const defaultFormatter = (v) => {
|
|
1354
|
+
if (v === void 0 || v === null || v === "") return "";
|
|
1355
|
+
const num = Number(v);
|
|
1356
|
+
if (Number.isNaN(num)) return "";
|
|
1357
|
+
const base = !decimal ? Math.trunc(num).toString() : num.toFixed(safeScale);
|
|
1358
|
+
return format5 === "currency" ? addComma(base) : base;
|
|
1359
|
+
};
|
|
1360
|
+
const defaultParser = (v) => {
|
|
1361
|
+
if (!v) return "";
|
|
1362
|
+
const raw = v.replace(/,/g, "").replace(/\s/g, "");
|
|
1363
|
+
if (!decimal) return raw.split(".")[0];
|
|
1364
|
+
return raw.replace(/[^\d.]/g, "");
|
|
1365
|
+
};
|
|
1345
1366
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1346
1367
|
import_antd7.ConfigProvider,
|
|
1347
1368
|
{
|
|
@@ -1372,17 +1393,9 @@ function InputFieldNumber({
|
|
|
1372
1393
|
controls,
|
|
1373
1394
|
size,
|
|
1374
1395
|
changeOnWheel,
|
|
1375
|
-
formatter: formatter ??
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
const num = Number(value2);
|
|
1379
|
-
if (isNaN(num)) return "";
|
|
1380
|
-
return num.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
1381
|
-
}),
|
|
1382
|
-
parser: parser ?? ((value2) => {
|
|
1383
|
-
if (!value2) return "";
|
|
1384
|
-
return value2.replace(/,/g, "");
|
|
1385
|
-
})
|
|
1396
|
+
formatter: formatter ?? defaultFormatter,
|
|
1397
|
+
parser: parser ?? defaultParser,
|
|
1398
|
+
precision: decimal ? safeScale : 0
|
|
1386
1399
|
}
|
|
1387
1400
|
),
|
|
1388
1401
|
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-red-500 caption-1", children: error })
|
|
@@ -3953,7 +3966,6 @@ function Indicator({
|
|
|
3953
3966
|
...prev,
|
|
3954
3967
|
[key]: value
|
|
3955
3968
|
}));
|
|
3956
|
-
console.log(cacheData);
|
|
3957
3969
|
};
|
|
3958
3970
|
const handleClick = (active) => {
|
|
3959
3971
|
handleChangeCashData("inputType", active);
|
|
@@ -4005,7 +4017,6 @@ function Indicator({
|
|
|
4005
4017
|
...prev,
|
|
4006
4018
|
[name]: value
|
|
4007
4019
|
}));
|
|
4008
|
-
console.log(cacheEditData);
|
|
4009
4020
|
};
|
|
4010
4021
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "w-full", children: [
|
|
4011
4022
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
@@ -4013,27 +4024,18 @@ function Indicator({
|
|
|
4013
4024
|
{
|
|
4014
4025
|
className: `space-x-2 grid ${valueSwitch === "TEXT" ? `grid-cols-[140px_1fr_50px]` : `grid-cols-[140px_1fr_200px_200px_50px]`} items-start`,
|
|
4015
4026
|
children: [
|
|
4016
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4017
|
-
SwitchSelect,
|
|
4018
|
-
{
|
|
4019
|
-
option,
|
|
4020
|
-
onClick: handleClick,
|
|
4021
|
-
value: valueSwitch,
|
|
4022
|
-
label: "\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17",
|
|
4023
|
-
required: true
|
|
4024
|
-
}
|
|
4025
|
-
),
|
|
4027
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SwitchSelect, { option, onClick: handleClick, value: valueSwitch, label: "\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17", required: true }),
|
|
4026
4028
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4027
4029
|
InputField,
|
|
4028
4030
|
{
|
|
4029
|
-
label: `\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
|
|
4031
|
+
label: type === "TARGET" ? "\u0E0A\u0E37\u0E48\u0E2D\u0E01\u0E25\u0E38\u0E48\u0E21\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22" : `\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
|
|
4030
4032
|
value: cacheData.textValue,
|
|
4031
4033
|
className: "h-[32px]",
|
|
4032
4034
|
onChange: (val) => {
|
|
4033
4035
|
handleChangeCashData("textValue", val ?? "");
|
|
4034
4036
|
setAddError((p) => ({ ...p, textValue: void 0 }));
|
|
4035
4037
|
},
|
|
4036
|
-
placeholder: `\u0E23\u0E30\u0E1A\u0E38\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
|
|
4038
|
+
placeholder: type === "TARGET" ? "\u0E23\u0E30\u0E1A\u0E38\u0E0A\u0E37\u0E48\u0E2D\u0E01\u0E25\u0E38\u0E48\u0E21\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22" : `\u0E23\u0E30\u0E1A\u0E38\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
|
|
4037
4039
|
required: true,
|
|
4038
4040
|
error: addError.textValue
|
|
4039
4041
|
}
|
|
@@ -4042,7 +4044,7 @@ function Indicator({
|
|
|
4042
4044
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4043
4045
|
InputFieldNumber,
|
|
4044
4046
|
{
|
|
4045
|
-
label: `\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
|
|
4047
|
+
label: type === "TARGET" ? "\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22" : `\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
|
|
4046
4048
|
value: cacheData.numberValue ?? 0,
|
|
4047
4049
|
className: "h-[32px]",
|
|
4048
4050
|
onChange: (val) => {
|
|
@@ -4050,7 +4052,7 @@ function Indicator({
|
|
|
4050
4052
|
setAddError((p) => ({ ...p, numberValue: void 0 }));
|
|
4051
4053
|
},
|
|
4052
4054
|
min: 0,
|
|
4053
|
-
placeholder: `\u0E23\u0E30\u0E1A\u0E38\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
|
|
4055
|
+
placeholder: type === "TARGET" ? "\u0E23\u0E30\u0E1A\u0E38\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22" : `\u0E23\u0E30\u0E1A\u0E38\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
|
|
4054
4056
|
required: true,
|
|
4055
4057
|
error: addError.numberValue
|
|
4056
4058
|
}
|
|
@@ -4071,14 +4073,7 @@ function Indicator({
|
|
|
4071
4073
|
}
|
|
4072
4074
|
)
|
|
4073
4075
|
] }),
|
|
4074
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4075
|
-
import_icons_react12.IconCirclePlus,
|
|
4076
|
-
{
|
|
4077
|
-
onClick: handleAddIndicator,
|
|
4078
|
-
className: "mt-8 cursor-pointer",
|
|
4079
|
-
size: 32
|
|
4080
|
-
}
|
|
4081
|
-
)
|
|
4076
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_icons_react12.IconCirclePlus, { onClick: handleAddIndicator, className: "mt-8 cursor-pointer", size: 32 })
|
|
4082
4077
|
]
|
|
4083
4078
|
}
|
|
4084
4079
|
),
|
|
@@ -4147,20 +4142,8 @@ function Indicator({
|
|
|
4147
4142
|
onClick: () => handleConfirmEditIndicator(index)
|
|
4148
4143
|
}
|
|
4149
4144
|
),
|
|
4150
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4151
|
-
|
|
4152
|
-
{
|
|
4153
|
-
className: "cursor-pointer text-red-600",
|
|
4154
|
-
onClick: handleCancelEditIndicator
|
|
4155
|
-
}
|
|
4156
|
-
)
|
|
4157
|
-
] }) : void 0 : canEdit && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4158
|
-
import_icons_react12.IconPencil,
|
|
4159
|
-
{
|
|
4160
|
-
className: "cursor-pointer",
|
|
4161
|
-
onClick: () => handleEditIndicator(index)
|
|
4162
|
-
}
|
|
4163
|
-
) }),
|
|
4145
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_icons_react12.IconX, { className: "cursor-pointer text-red-600", onClick: handleCancelEditIndicator })
|
|
4146
|
+
] }) : void 0 : canEdit && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_icons_react12.IconPencil, { className: "cursor-pointer", onClick: () => handleEditIndicator(index) }) }),
|
|
4164
4147
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "body-1 mt-2 cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4165
4148
|
import_icons_react12.IconTrash,
|
|
4166
4149
|
{
|
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,
|
|
@@ -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, IconPencil as IconPencil2, 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 : canEdit && /* @__PURE__ */ jsx41(IconPencil2, { className: "cursor-pointer", onClick: () => handleEditIndicator(index) }) }),
|
|
4104
4081
|
/* @__PURE__ */ jsx41("div", { className: "body-1 mt-2 cursor-pointer", children: /* @__PURE__ */ jsx41(
|
|
4105
4082
|
IconTrash4,
|
|
4106
4083
|
{
|