@codezee/sixtify-brahma 0.2.51 → 0.2.52
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/package.json +1 -1
- package/packages/shared-components/dist/ColumnArranger/ColumnArrangerDialog.d.ts +1 -1
- package/packages/shared-components/dist/ColumnArranger/ColumnArrangerDialog.d.ts.map +1 -1
- package/packages/shared-components/dist/ColumnArranger/ColumnArrangerDialog.js +1 -3
- package/packages/shared-components/dist/ColumnArranger/ColumnArrangerForm.d.ts.map +1 -1
- package/packages/shared-components/dist/ColumnArranger/ColumnArrangerForm.js +14 -7
- package/packages/shared-components/dist/ColumnArranger/ColumnItem.d.ts +1 -1
- package/packages/shared-components/dist/ColumnArranger/ColumnItem.d.ts.map +1 -1
- package/packages/shared-components/dist/ColumnArranger/ColumnItem.js +39 -3
- package/packages/shared-components/dist/FormFields/SwitchField/SwitchField.d.ts.map +1 -1
- package/packages/shared-components/dist/FormFields/SwitchField/SwitchField.js +2 -1
- package/packages/shared-components/dist/TabBar/Tab.d.ts +4 -2
- package/packages/shared-components/dist/TabBar/Tab.d.ts.map +1 -1
- package/packages/shared-components/dist/TabBar/Tab.js +15 -13
- package/packages/shared-components/dist/TabBar/TabBar.d.ts +3 -1
- package/packages/shared-components/dist/TabBar/TabBar.d.ts.map +1 -1
- package/packages/shared-components/dist/TabBar/TabBar.js +7 -2
- package/packages/shared-components/dist/utils/hooks/useDialogActions.d.ts +1 -1
- package/packages/shared-components/dist/utils/hooks/useDialogActions.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ColDef } from "ag-grid-community";
|
|
2
|
-
export type SimpleColDef = Pick<ColDef, "field" | "headerName" | "hide" | "minWidth" | "filter" | "sortable" | "lockPosition">;
|
|
2
|
+
export type SimpleColDef = Pick<ColDef, "field" | "headerName" | "hide" | "minWidth" | "filter" | "sortable" | "lockPosition" | "pinned">;
|
|
3
3
|
export type ColumnArrangerDialogProps = {
|
|
4
4
|
open: boolean;
|
|
5
5
|
columns: SimpleColDef[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnArrangerDialog.d.ts","sourceRoot":"","sources":["../../src/ColumnArranger/ColumnArrangerDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ColumnArrangerDialog.d.ts","sourceRoot":"","sources":["../../src/ColumnArranger/ColumnArrangerDialog.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAKhD,MAAM,MAAM,YAAY,GAAG,IAAI,CAC7B,MAAM,EACJ,OAAO,GACP,YAAY,GACZ,MAAM,GACN,UAAU,GACV,QAAQ,GACR,UAAU,GACV,cAAc,GACd,QAAQ,CACX,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,OAAO,EAAE,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,YAAY,EAAE,CAAA;KAAE,KAAK,IAAI,CAAC;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,EAAE,CAAC,IAAI,EAAE;QACf,aAAa,EAAE,YAAY,EAAE,CAAC;QAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;QACjE,SAAS,EAAE,MAAM;YAAE,OAAO,EAAE,YAAY,EAAE,CAAA;SAAE,CAAC;KAC9C,KAAK,GAAG,CAAC,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,IAAI,EACJ,OAAO,EACP,KAAyB,GAC1B,EAAE,QAAQ,CAAC,yBAAyB,CAAC,2CAuCrC"}
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ColumnArrangerDialog = ColumnArrangerDialog;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
// components/ColumnArrangerDialog.tsx
|
|
6
5
|
const material_1 = require("@mui/material");
|
|
7
6
|
const Button_1 = require("../Button");
|
|
8
7
|
const Dialog_1 = require("../Dialog");
|
|
9
8
|
const ColumnArrangerForm_1 = require("./ColumnArrangerForm");
|
|
10
|
-
function ColumnArrangerDialog({ columns, open, onClose, title = "Arrange Columns",
|
|
11
|
-
}) {
|
|
9
|
+
function ColumnArrangerDialog({ columns, open, onClose, title = "Arrange Columns", }) {
|
|
12
10
|
return ((0, jsx_runtime_1.jsx)(ColumnArrangerForm_1.ColumnArrangerForm, { columns: columns, children: ({ arranger, reset, getValues, lockedColumns }) => ((0, jsx_runtime_1.jsx)(Dialog_1.Dialog, { title: title, open: open, onClose: () => onClose({ columns }), maxWidth: "xs", actions: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", sx: { width: "100%" }, children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "outlined", onClick: () => reset(), children: "Reset" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { "data-ptag": "submit", "data-cy": "submit", onClick: () => {
|
|
13
11
|
const values = getValues();
|
|
14
12
|
onClose({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnArrangerForm.d.ts","sourceRoot":"","sources":["../../src/ColumnArranger/ColumnArrangerForm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EAExB,MAAM,wBAAwB,CAAC;AAMhC,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,QAAQ,GACT,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"ColumnArrangerForm.d.ts","sourceRoot":"","sources":["../../src/ColumnArranger/ColumnArrangerForm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EAExB,MAAM,wBAAwB,CAAC;AAMhC,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,QAAQ,GACT,EAAE,uBAAuB,eAiDzB"}
|
|
@@ -8,19 +8,26 @@ const ColumnArranger_1 = require("./ColumnArranger");
|
|
|
8
8
|
function ColumnArrangerForm({ columns, children, }) {
|
|
9
9
|
const lockedColumns = (0, react_1.useMemo)(() => columns.filter((col) => "lockPosition" in col), [columns]);
|
|
10
10
|
const unlockedColumns = (0, react_1.useMemo)(() => columns.filter((col) => "hide" in col), [columns]);
|
|
11
|
-
const
|
|
11
|
+
const initialUnlockedColumnsRef = (0, react_1.useRef)(unlockedColumns);
|
|
12
12
|
const { control, reset, getValues } = (0, react_hook_form_1.useForm)({
|
|
13
|
-
defaultValues
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
name: "columns",
|
|
17
|
-
control,
|
|
13
|
+
defaultValues: {
|
|
14
|
+
columns: initialUnlockedColumnsRef.current,
|
|
15
|
+
},
|
|
18
16
|
});
|
|
19
17
|
const wrappedReset = (values) => {
|
|
20
18
|
reset({
|
|
21
|
-
columns:
|
|
19
|
+
columns: values
|
|
20
|
+
? // eslint-disable-next-line sonarjs/no-nested-conditional
|
|
21
|
+
Array.isArray(values)
|
|
22
|
+
? values
|
|
23
|
+
: [values]
|
|
24
|
+
: initialUnlockedColumnsRef.current,
|
|
22
25
|
});
|
|
23
26
|
};
|
|
27
|
+
const { fields } = (0, react_hook_form_1.useFieldArray)({
|
|
28
|
+
name: "columns",
|
|
29
|
+
control,
|
|
30
|
+
});
|
|
24
31
|
return children({
|
|
25
32
|
lockedColumns,
|
|
26
33
|
reset: wrappedReset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnItem.d.ts","sourceRoot":"","sources":["../../src/ColumnArranger/ColumnItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ColumnItem.d.ts","sourceRoot":"","sources":["../../src/ColumnArranger/ColumnItem.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,gBAAgB,CAAC;QAAE,OAAO,EAAE,YAAY,EAAE,CAAA;KAAE,EAAE,SAAS,CAAC,CAAC;IAChE,OAAO,EAAE,OAAO,CAAC;QAAE,OAAO,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC,CAAC;IAC9C,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,OAAO,EACP,KAAK,GACN,EAAE,QAAQ,CAAC,eAAe,CAAC,2CAoE3B"}
|
|
@@ -4,10 +4,46 @@ exports.ColumnItem = ColumnItem;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const styles_1 = require("@mui/material/styles");
|
|
7
|
-
const
|
|
7
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
8
8
|
const PadBox_1 = require("../PadBox");
|
|
9
9
|
function ColumnItem({ field, control, index, }) {
|
|
10
10
|
const theme = (0, styles_1.useTheme)();
|
|
11
|
-
const { iron } = theme.palette.app.color;
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "row", component: "li", children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", border: "1px solid", flexGrow: 1, borderColor: iron[700], children: [(0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { paddingLeft: "24px" }, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: { flexGrow: 1 }, children: field.headerName }) }), (0, jsx_runtime_1.jsx)(
|
|
11
|
+
const { iron, butterflyBlue } = theme.palette.app.color;
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "row", component: "li", children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", border: "1px solid", flexGrow: 1, borderColor: iron[700], children: [(0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { paddingLeft: "24px" }, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: { flexGrow: 1 }, children: field.headerName }) }), (0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: control, name: `columns.${index}.hide`, render: ({ field }) => ((0, jsx_runtime_1.jsx)(material_1.Switch, { checked: !field.value, onChange: (e) => field.onChange(!e.target.checked), sx: {
|
|
13
|
+
padding: 1,
|
|
14
|
+
"& .MuiSwitch-track": {
|
|
15
|
+
borderRadius: 11,
|
|
16
|
+
backgroundColor: iron[900],
|
|
17
|
+
position: "relative",
|
|
18
|
+
"&::before": {
|
|
19
|
+
content: "unset",
|
|
20
|
+
position: "absolute",
|
|
21
|
+
top: "50%",
|
|
22
|
+
transform: "translateY(-50%)",
|
|
23
|
+
width: 16,
|
|
24
|
+
height: 16,
|
|
25
|
+
left: 12,
|
|
26
|
+
},
|
|
27
|
+
"&::after": {
|
|
28
|
+
content: "unset",
|
|
29
|
+
position: "absolute",
|
|
30
|
+
top: "50%",
|
|
31
|
+
transform: "translateY(-50%)",
|
|
32
|
+
width: 16,
|
|
33
|
+
height: 16,
|
|
34
|
+
right: 12,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
"& .MuiSwitch-thumb": {
|
|
38
|
+
boxShadow: "none",
|
|
39
|
+
width: 16,
|
|
40
|
+
height: 16,
|
|
41
|
+
margin: 0.15,
|
|
42
|
+
color: "white",
|
|
43
|
+
},
|
|
44
|
+
"& .Mui-checked + .MuiSwitch-track": {
|
|
45
|
+
backgroundColor: `${butterflyBlue[900]} !important`,
|
|
46
|
+
opacity: `${1} !important`,
|
|
47
|
+
},
|
|
48
|
+
} })) })] }) }));
|
|
13
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwitchField.d.ts","sourceRoot":"","sources":["../../../src/FormFields/SwitchField/SwitchField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,WAAW,IAAI,kBAAkB,CAAC,CAAC,CAAC,GACzE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM,qBAAqB,CAAC,CAAC,CAAC,CAAC,GAAG;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEJ,wBAAgB,WAAW,CAAC,CAAC,SAAS,WAAW,EAAE,EACjD,IAAI,EACJ,KAAK,EACL,OAAO,EACP,YAAY,EACZ,OAAe,EACf,GAAG,eAAe,EACnB,EAAE,gBAAgB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"SwitchField.d.ts","sourceRoot":"","sources":["../../../src/FormFields/SwitchField/SwitchField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,WAAW,IAAI,kBAAkB,CAAC,CAAC,CAAC,GACzE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM,qBAAqB,CAAC,CAAC,CAAC,CAAC,GAAG;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEJ,wBAAgB,WAAW,CAAC,CAAC,SAAS,WAAW,EAAE,EACjD,IAAI,EACJ,KAAK,EACL,OAAO,EACP,YAAY,EACZ,OAAe,EACf,GAAG,eAAe,EACnB,EAAE,gBAAgB,CAAC,CAAC,CAAC,2CAyDrB"}
|
|
@@ -45,7 +45,8 @@ function SwitchField({ name, rules, control, defaultValue, loading = false, ...r
|
|
|
45
45
|
color: "white",
|
|
46
46
|
},
|
|
47
47
|
"& .Mui-checked + .MuiSwitch-track": {
|
|
48
|
-
backgroundColor: butterflyBlue[900]
|
|
48
|
+
backgroundColor: `${butterflyBlue[900]} !important`,
|
|
49
|
+
opacity: `${1} !important`,
|
|
49
50
|
},
|
|
50
51
|
} }));
|
|
51
52
|
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { TabProps as MuiTabProps } from "@mui/material";
|
|
2
2
|
import type { MouseEvent } from "react";
|
|
3
|
+
import type { DialogTypes } from "../utils";
|
|
3
4
|
import type { MenuProps } from "./TabsMenus";
|
|
4
5
|
export type OnArrowClickFunction = (e: MouseEvent<SVGElement>) => void;
|
|
5
6
|
export type TabModel = {
|
|
7
|
+
id?: string;
|
|
6
8
|
label: string;
|
|
7
9
|
value: string | number;
|
|
8
10
|
hint?: string;
|
|
9
11
|
showDot?: boolean;
|
|
10
12
|
menu?: MenuProps[];
|
|
11
13
|
trimLabel?: boolean;
|
|
12
|
-
|
|
14
|
+
onAction?: (actionType: DialogTypes, tabData: TabModel) => void;
|
|
13
15
|
};
|
|
14
16
|
export type TabProps = MuiTabProps & TabModel & {
|
|
15
17
|
activeTab: TabModel;
|
|
@@ -17,5 +19,5 @@ export type TabProps = MuiTabProps & TabModel & {
|
|
|
17
19
|
onArrowClick: OnArrowClickFunction;
|
|
18
20
|
menuAnchor: HTMLElement | null;
|
|
19
21
|
};
|
|
20
|
-
export declare function Tab({ label, value,
|
|
22
|
+
export declare function Tab({ id, label, value, menu, trimLabel, activeTab, index, onArrowClick, menuAnchor, onAction, ...rest }: TabProps): import("react/jsx-runtime").JSX.Element;
|
|
21
23
|
//# sourceMappingURL=Tab.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../src/TabBar/Tab.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AAS7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;AAEvE,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,
|
|
1
|
+
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../src/TabBar/Tab.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AAS7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;AAEvE,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC;CACjE,CAAC;AAIF,MAAM,MAAM,QAAQ,GAAG,WAAW,GAChC,QAAQ,GAAG;IACT,SAAS,EAAE,QAAQ,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,oBAAoB,CAAC;IACnC,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;CAChC,CAAC;AAGJ,wBAAgB,GAAG,CAAC,EAClB,EAAE,EACF,KAAK,EACL,KAAK,EACL,IAAI,EACJ,SAAgB,EAChB,SAAS,EACT,KAAK,EACL,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,QAAQ,2CAmFV"}
|
|
@@ -8,10 +8,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
8
8
|
const ArrowDropDown_1 = __importDefault(require("@mui/icons-material/ArrowDropDown"));
|
|
9
9
|
const material_1 = require("@mui/material");
|
|
10
10
|
const truncate_1 = __importDefault(require("lodash/truncate"));
|
|
11
|
-
const
|
|
11
|
+
const AgGrid_1 = require("../AgGrid");
|
|
12
12
|
const TRIM_LABEL_LENGTH = 15;
|
|
13
13
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
14
|
-
function Tab({ label, value,
|
|
14
|
+
function Tab({ id, label, value, menu, trimLabel = true, activeTab, index, onArrowClick, menuAnchor, onAction, ...rest }) {
|
|
15
15
|
const theme = (0, material_1.useTheme)();
|
|
16
16
|
const { butterflyBlue } = theme.palette.app.color;
|
|
17
17
|
const isActive = value === activeTab.value;
|
|
@@ -21,13 +21,21 @@ function Tab({ label, value, showDot, menu, trimLabel = true, activeTab, index,
|
|
|
21
21
|
omission: trimLabel ? "..." : "",
|
|
22
22
|
});
|
|
23
23
|
const labelText = isActive ? label : trimmed;
|
|
24
|
+
const editTab = {
|
|
25
|
+
title: "Edit",
|
|
26
|
+
onClick: () => onAction && onAction("editTemplate", activeTab),
|
|
27
|
+
};
|
|
28
|
+
const deleteTab = {
|
|
29
|
+
title: "Delete",
|
|
30
|
+
onClick: () => onAction && onAction("deleteTemplate", activeTab),
|
|
31
|
+
};
|
|
24
32
|
const props = {
|
|
25
|
-
key:
|
|
33
|
+
key: id,
|
|
26
34
|
iconPosition: "end",
|
|
27
35
|
"data-cy": fallbackTag,
|
|
28
36
|
"data-ptag": fallbackTag,
|
|
29
37
|
value: value ?? index,
|
|
30
|
-
label: ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "6px", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body1", children: labelText }), (0, jsx_runtime_1.jsx)(
|
|
38
|
+
label: ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "6px", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body1", sx: { whiteSpace: "nowrap" }, children: labelText }), isActive && index > 0 && (0, jsx_runtime_1.jsx)(AgGrid_1.ActionCell, { items: [editTab, deleteTab] })] })),
|
|
31
39
|
};
|
|
32
40
|
if (label.length > TRIM_LABEL_LENGTH && !isActive) {
|
|
33
41
|
props.title = label;
|
|
@@ -35,7 +43,7 @@ function Tab({ label, value, showDot, menu, trimLabel = true, activeTab, index,
|
|
|
35
43
|
if (value === activeTab.value && menu?.length) {
|
|
36
44
|
props.icon = ((0, jsx_runtime_1.jsx)(ArrowDropDown_1.default, { onClick: onArrowClick, id: `tabDropDown-${value}`, "aria-controls": menuAnchor !== null ? `dropDownMenu-${value}` : undefined, "aria-expanded": menuAnchor !== null ? "true" : undefined, "aria-haspopup": "true", "data-cy": `${fallbackTag}-arrowicon`, "data-ptag": `${fallbackTag}-arrowicon` }));
|
|
37
45
|
}
|
|
38
|
-
return
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Tab, { disableFocusRipple: true, disableRipple: true, sx: {
|
|
39
47
|
borderRadius: "5px",
|
|
40
48
|
borderBottom: "2px solid",
|
|
41
49
|
borderBottomColor: isActive ? butterflyBlue[900] : "white",
|
|
@@ -43,14 +51,8 @@ function Tab({ label, value, showDot, menu, trimLabel = true, activeTab, index,
|
|
|
43
51
|
[`&.${material_1.tabClasses.root}`]: {
|
|
44
52
|
minHeight: "40px",
|
|
45
53
|
height: "40px",
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
borderRadius: "5px",
|
|
49
|
-
borderBottom: "2px solid",
|
|
50
|
-
borderBottomColor: isActive ? butterflyBlue[900] : "white",
|
|
51
|
-
[`&.${material_1.tabClasses.root}`]: {
|
|
52
|
-
minHeight: "40px",
|
|
53
|
-
height: "40px",
|
|
54
|
+
// padding: 0,
|
|
55
|
+
paddingLeft: isActive && index > 0 ? "15px" : "10px",
|
|
54
56
|
},
|
|
55
57
|
}, ...props, ...rest }));
|
|
56
58
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import type { DialogTypes } from "../utils";
|
|
2
3
|
import type { TabModel } from "./Tab";
|
|
3
4
|
export type TabBarProps = {
|
|
4
5
|
tabs: TabModel[];
|
|
@@ -7,6 +8,7 @@ export type TabBarProps = {
|
|
|
7
8
|
addButton?: ReactNode;
|
|
8
9
|
actionButton?: ReactNode;
|
|
9
10
|
onChange?: (value: TabModel) => void;
|
|
11
|
+
onAction?: (actionType: DialogTypes, tabData: TabModel) => void;
|
|
10
12
|
};
|
|
11
|
-
export declare function TabBar({ tabs, onChange, addButton, actionButton, ariaLabel, activeIndex, }: Readonly<TabBarProps>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function TabBar({ tabs, onChange, addButton, actionButton, ariaLabel, activeIndex, onAction, }: Readonly<TabBarProps>): import("react/jsx-runtime").JSX.Element;
|
|
12
14
|
//# sourceMappingURL=TabBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../src/TabBar/TabBar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,SAAS,EAAkB,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAItC,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../src/TabBar/TabBar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,SAAS,EAAkB,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAItC,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC;CACjE,CAAC;AAEF,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,SAAS,EACT,WAAe,EACf,QAAQ,GACT,EAAE,QAAQ,CAAC,WAAW,CAAC,2CA6FvB"}
|
|
@@ -6,7 +6,7 @@ const material_1 = require("@mui/material");
|
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const Tab_1 = require("./Tab");
|
|
8
8
|
const TabsMenus_1 = require("./TabsMenus");
|
|
9
|
-
function TabBar({ tabs, onChange, addButton, actionButton, ariaLabel, activeIndex = 0, }) {
|
|
9
|
+
function TabBar({ tabs, onChange, addButton, actionButton, ariaLabel, activeIndex = 0, onAction, }) {
|
|
10
10
|
const [activeTab, setActiveTab] = (0, react_1.useState)(tabs[activeIndex]);
|
|
11
11
|
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
12
12
|
(0, react_1.useEffect)(() => {
|
|
@@ -35,7 +35,12 @@ function TabBar({ tabs, onChange, addButton, actionButton, ariaLabel, activeInde
|
|
|
35
35
|
sx: {
|
|
36
36
|
display: "none",
|
|
37
37
|
},
|
|
38
|
+
}, sx: {
|
|
39
|
+
[`&.${material_1.tabsClasses.root}`]: {
|
|
40
|
+
minHeight: "40px",
|
|
41
|
+
height: "40px",
|
|
42
|
+
},
|
|
38
43
|
}, variant: "scrollable", scrollButtons: "auto", ScrollButtonComponent: material_1.TabScrollButton, "aria-label": ariaLabel ?? "Tabs", children: tabs.map((tab, index) => ((0, jsx_runtime_1.jsx)(Tab_1.Tab, { index: index, activeTab: activeTab, onArrowClick: (event) => {
|
|
39
44
|
setAnchorEl(event.target);
|
|
40
|
-
}, menuAnchor: anchorEl, ...tab }, tab.value))) }) }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "10px", alignItems: "center", children: [addButton, actionButton] })] })] }));
|
|
45
|
+
}, onAction: onAction, menuAnchor: anchorEl, ...tab }, tab.value))) }) }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "10px", alignItems: "center", children: [addButton, actionButton] })] })] }));
|
|
41
46
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
export type DialogTypes = "add" | "edit" | "delete" | "viewAttachment";
|
|
2
|
+
export type DialogTypes = "add" | "edit" | "delete" | "viewAttachment" | "deleteTemplate" | "editTemplate" | "addTemplate";
|
|
3
3
|
export type DialogRenderer = {
|
|
4
4
|
[key in DialogTypes]?: ReactNode;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDialogActions.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useDialogActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAEjD,MAAM,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"useDialogActions.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useDialogActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAEjD,MAAM,MAAM,WAAW,GACnB,KAAK,GACL,MAAM,GACN,QAAQ,GACR,gBAAgB,GAChB,gBAAgB,GAChB,cAAc,GACd,aAAa,CAAC;AAElB,MAAM,MAAM,cAAc,GAAG;KAAG,GAAG,IAAI,WAAW,CAAC,CAAC,EAAE,SAAS;CAAE,CAAC;AAElE,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC5C,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B,CAAC;AAEF,wBAAgB,gBAAgB;;gCAGK,WAAW;;EAU/C"}
|