@codezee/sixtify-brahma 0.2.193 → 0.2.194
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 -55
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridSelection.d.ts.map +1 -1
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridSelection.js +108 -24
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArranger.d.ts +20 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArranger.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArranger.js +49 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerDialog.d.ts +17 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerDialog.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerDialog.js +117 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerForm.d.ts +17 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerForm.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerForm.js +47 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnItem.d.ts +16 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnItem.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnItem.js +122 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/LockedColumnItem.d.ts +6 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/LockedColumnItem.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/LockedColumnItem.js +17 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/hooks/useRefinedColumns.d.ts +13 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/hooks/useRefinedColumns.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/hooks/useRefinedColumns.js +24 -0
- package/packages/shared-components/dist/SmartGrid/Components/FacetedFilter/FacetedFilter.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/Components/FacetedFilter/FacetedFilter.js +11 -5
- package/packages/shared-components/dist/SmartGrid/Components/Grouped/GroupAreaOverlay.d.ts +3 -1
- package/packages/shared-components/dist/SmartGrid/Components/Grouped/GroupAreaOverlay.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/Components/Grouped/GroupAreaOverlay.js +25 -6
- package/packages/shared-components/dist/SmartGrid/Components/Grouped/GroupedPanel.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/Components/Grouped/GroupedPanel.js +14 -5
- package/packages/shared-components/dist/SmartGrid/Components/HeaderCells/HeaderCell.js +2 -2
- package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/SearchFilterRow.js +2 -2
- package/packages/shared-components/dist/SmartGrid/Components/SmartAlignments.d.ts +9 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartAlignments.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartAlignments.js +63 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartButton.d.ts +7 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartButton.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartButton.js +21 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartDialog.d.ts +12 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartDialog.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartDialog.js +42 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartSwitch.d.ts +7 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartSwitch.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartSwitch.js +53 -0
- package/packages/shared-components/dist/SmartGrid/Components/Svgs/HideIcon.d.ts +3 -0
- package/packages/shared-components/dist/SmartGrid/Components/Svgs/HideIcon.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/Svgs/HideIcon.js +6 -0
- package/packages/shared-components/dist/SmartGrid/Components/TableRowComponent.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/Components/TableRowComponent.js +48 -3
- package/packages/shared-components/dist/SmartGrid/SmartGrid.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/SmartGrid.js +221 -70
- package/packages/shared-components/dist/SmartGrid/hooks/useGetColumnWidth.d.ts +2 -1
- package/packages/shared-components/dist/SmartGrid/hooks/useGetColumnWidth.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/hooks/useGetGroupedColumn.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/hooks/useGetGroupedColumn.js +4 -0
- package/packages/shared-components/dist/SmartGrid/hooks/useTableState.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/hooks/useTableState.js +1 -7
- package/packages/shared-components/dist/SmartGrid/index.d.ts +0 -1
- package/packages/shared-components/dist/SmartGrid/index.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/index.js +0 -1
- package/packages/shared-components/dist/SmartGrid/types/index.d.ts +9 -0
- package/packages/shared-components/dist/SmartGrid/types/index.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/utils/summaryCalculations.d.ts.map +1 -1
- package/packages/shared-components/dist/Svgs/BookMarkSvg.d.ts +3 -0
- package/packages/shared-components/dist/Svgs/BookMarkSvg.d.ts.map +1 -0
- package/packages/shared-components/dist/Svgs/BookMarkSvg.js +6 -0
- package/packages/shared-components/dist/Svgs/index.d.ts +1 -0
- package/packages/shared-components/dist/Svgs/index.d.ts.map +1 -1
- package/packages/shared-components/dist/Svgs/index.js +1 -0
- package/packages/shared-components/dist/index.d.ts +0 -1
- package/packages/shared-components/dist/index.d.ts.map +1 -1
- package/packages/shared-components/dist/index.js +0 -1
- package/packages/shared-components/dist/RichTextEditor/EditorMenuControls.d.ts +0 -2
- package/packages/shared-components/dist/RichTextEditor/EditorMenuControls.d.ts.map +0 -1
- package/packages/shared-components/dist/RichTextEditor/EditorMenuControls.js +0 -12
- package/packages/shared-components/dist/RichTextEditor/RichTextEditor.d.ts +0 -19
- package/packages/shared-components/dist/RichTextEditor/RichTextEditor.d.ts.map +0 -1
- package/packages/shared-components/dist/RichTextEditor/RichTextEditor.js +0 -88
- package/packages/shared-components/dist/RichTextEditor/index.d.ts +0 -2
- package/packages/shared-components/dist/RichTextEditor/index.d.ts.map +0 -1
- package/packages/shared-components/dist/RichTextEditor/index.js +0 -17
- package/packages/shared-components/dist/RichTextEditor/useExtensions.d.ts +0 -13
- package/packages/shared-components/dist/RichTextEditor/useExtensions.d.ts.map +0 -1
- package/packages/shared-components/dist/RichTextEditor/useExtensions.js +0 -169
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartSelectField.d.ts +0 -7
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartSelectField.d.ts.map +0 -1
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartSelectField.js +0 -58
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTextField.d.ts +0 -5
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTextField.d.ts.map +0 -1
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTextField.js +0 -59
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTooltip.d.ts +0 -9
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTooltip.d.ts.map +0 -1
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTooltip.js +0 -113
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/index.d.ts +0 -4
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/index.d.ts.map +0 -1
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/index.js +0 -19
- package/packages/shared-components/dist/SmartGrid/Components/HeaderCells/GroupingIcons.d.ts +0 -8
- package/packages/shared-components/dist/SmartGrid/Components/HeaderCells/GroupingIcons.d.ts.map +0 -1
- package/packages/shared-components/dist/SmartGrid/Components/HeaderCells/GroupingIcons.js +0 -41
- package/packages/shared-components/dist/SmartGrid/Components/index.d.ts +0 -2
- package/packages/shared-components/dist/SmartGrid/Components/index.d.ts.map +0 -1
- package/packages/shared-components/dist/SmartGrid/Components/index.js +0 -17
- package/packages/shared-components/dist/SmartGrid/hooks/useProcessColumnsForGroupDisplay.d.ts +0 -11
- package/packages/shared-components/dist/SmartGrid/hooks/useProcessColumnsForGroupDisplay.d.ts.map +0 -1
- package/packages/shared-components/dist/SmartGrid/hooks/useProcessColumnsForGroupDisplay.js +0 -30
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColumnItem = ColumnItem;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const iconoir_react_1 = require("iconoir-react");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
9
|
+
const DebouncedInput_1 = require("../SearchFilterRow/DebouncedInput");
|
|
10
|
+
const SmartAlignments_1 = require("../SmartAlignments");
|
|
11
|
+
const SmartSwitch_1 = require("../SmartSwitch");
|
|
12
|
+
function ColumnItem({ field, control, index, setValue, }) {
|
|
13
|
+
const theme = (0, styles_1.useTheme)();
|
|
14
|
+
const { iron } = theme.palette.app.color;
|
|
15
|
+
// State for editing mode
|
|
16
|
+
const [isEditing, setIsEditing] = (0, react_1.useState)(false);
|
|
17
|
+
const [editedHeaderName, setEditedHeaderName] = (0, react_1.useState)("");
|
|
18
|
+
const [previousHeaderName, setPreviousHeaderName] = (0, react_1.useState)("");
|
|
19
|
+
const inputContainerRef = (0, react_1.useRef)(null);
|
|
20
|
+
// Watch the actual form value for the header to get real-time updates
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
const watchedHeader = (0, react_hook_form_1.useWatch)({
|
|
23
|
+
control,
|
|
24
|
+
name: `columns.${index}.header`,
|
|
25
|
+
});
|
|
26
|
+
// Watch the hide value to determine if Edit and Align should be disabled
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
const watchedHide = (0, react_hook_form_1.useWatch)({
|
|
29
|
+
control,
|
|
30
|
+
name: `columns.${index}.hide`,
|
|
31
|
+
});
|
|
32
|
+
// Column is hidden when hide is true, so Edit and Align should be disabled
|
|
33
|
+
const isColumnHidden = Boolean(!watchedHide);
|
|
34
|
+
// Get current header name as string - use watched value if available, otherwise fallback to field
|
|
35
|
+
const currentHeaderName = typeof watchedHeader === "string"
|
|
36
|
+
? watchedHeader
|
|
37
|
+
: // eslint-disable-next-line sonarjs/no-nested-conditional
|
|
38
|
+
typeof field.header === "string"
|
|
39
|
+
? field.header
|
|
40
|
+
: (field.header?.toString() ?? "");
|
|
41
|
+
// Initialize edited header name when entering edit mode
|
|
42
|
+
(0, react_1.useEffect)(() => {
|
|
43
|
+
if (isEditing) {
|
|
44
|
+
const headerName = currentHeaderName;
|
|
45
|
+
setEditedHeaderName(headerName);
|
|
46
|
+
setPreviousHeaderName(headerName);
|
|
47
|
+
// Focus input after a brief delay to ensure it's rendered
|
|
48
|
+
setTimeout(() => {
|
|
49
|
+
const input = inputContainerRef.current?.querySelector("input");
|
|
50
|
+
if (input) {
|
|
51
|
+
input.focus();
|
|
52
|
+
input.select();
|
|
53
|
+
}
|
|
54
|
+
}, 0);
|
|
55
|
+
}
|
|
56
|
+
}, [isEditing, currentHeaderName]);
|
|
57
|
+
// Exit edit mode if column becomes hidden
|
|
58
|
+
(0, react_1.useEffect)(() => {
|
|
59
|
+
if (isColumnHidden && isEditing) {
|
|
60
|
+
setIsEditing(false);
|
|
61
|
+
setEditedHeaderName(previousHeaderName);
|
|
62
|
+
}
|
|
63
|
+
}, [isColumnHidden, isEditing, previousHeaderName]);
|
|
64
|
+
const handleEditAction = (e) => {
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
// Prevent editing if column is hidden
|
|
67
|
+
if (isColumnHidden) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
setIsEditing(true);
|
|
71
|
+
};
|
|
72
|
+
const handleSave = (value) => {
|
|
73
|
+
const trimmedValue = value.trim();
|
|
74
|
+
// If empty, revert to previous value
|
|
75
|
+
if (trimmedValue === "") {
|
|
76
|
+
setEditedHeaderName(previousHeaderName);
|
|
77
|
+
setIsEditing(false);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
// Update the header in the form using setValue
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
82
|
+
setValue(`columns.${index}.header`, trimmedValue, {
|
|
83
|
+
shouldValidate: true,
|
|
84
|
+
shouldDirty: true,
|
|
85
|
+
});
|
|
86
|
+
setPreviousHeaderName(trimmedValue);
|
|
87
|
+
setIsEditing(false);
|
|
88
|
+
};
|
|
89
|
+
const handleKeyDown = (e) => {
|
|
90
|
+
if (e.key === "Enter") {
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
e.stopPropagation();
|
|
93
|
+
handleSave(editedHeaderName);
|
|
94
|
+
}
|
|
95
|
+
else if (e.key === "Escape") {
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
e.stopPropagation();
|
|
98
|
+
setEditedHeaderName(previousHeaderName);
|
|
99
|
+
setIsEditing(false);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const handleBlur = () => {
|
|
103
|
+
handleSave(editedHeaderName);
|
|
104
|
+
};
|
|
105
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { padding: "0px 20px", border: `1px solid ${iron[700]}` }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
106
|
+
display: "flex",
|
|
107
|
+
flexDirection: "row",
|
|
108
|
+
alignItems: "center",
|
|
109
|
+
justifyContent: "space-between",
|
|
110
|
+
height: "45px",
|
|
111
|
+
}, children: [isEditing ? ((0, jsx_runtime_1.jsx)("div", { ref: inputContainerRef, style: { flex: 1, minWidth: 0 }, children: (0, jsx_runtime_1.jsx)(DebouncedInput_1.DebouncedInput, { value: editedHeaderName, onChange: (value) => setEditedHeaderName(value), onKeyDown: handleKeyDown, onBlur: handleBlur, debounce: 0, inputFontSize: "12px", inputHeight: "14px", style: { width: "200px" }, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), placeholder: "Enter header name" }) })) : ((0, jsx_runtime_1.jsx)("p", { style: {
|
|
112
|
+
fontSize: "13px",
|
|
113
|
+
fontWeight: 500,
|
|
114
|
+
cursor: "pointer",
|
|
115
|
+
}, onDoubleClick: handleEditAction, children: currentHeaderName })), (0, jsx_runtime_1.jsxs)("div", { style: { display: "flex", gap: "10px", alignItems: "center" }, children: [!isEditing && ((0, jsx_runtime_1.jsx)(iconoir_react_1.EditPencil, { width: 18, height: 18, onClick: handleEditAction, style: {
|
|
116
|
+
border: `1px solid ${iron[700]}`,
|
|
117
|
+
borderRadius: "4px",
|
|
118
|
+
padding: "4px",
|
|
119
|
+
cursor: isColumnHidden ? "not-allowed" : "pointer",
|
|
120
|
+
opacity: isColumnHidden ? 0.5 : 1,
|
|
121
|
+
} })), (0, jsx_runtime_1.jsx)(SmartAlignments_1.SmartAlignments, { control: control, name: `columns.${index}.align`, defaultValue: field.align ?? "left", disabled: isColumnHidden }), (0, jsx_runtime_1.jsx)(SmartSwitch_1.SmartSwitch, { control: control, name: `columns.${index}.hide` })] })] }) }));
|
|
122
|
+
}
|
package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/LockedColumnItem.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AppColumnDef } from "../../types";
|
|
2
|
+
export type LockedColumnItemProps<T> = {
|
|
3
|
+
column: AppColumnDef<T>;
|
|
4
|
+
};
|
|
5
|
+
export declare function LockedColumnItem<T>({ column, }: Readonly<LockedColumnItemProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=LockedColumnItem.d.ts.map
|
package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/LockedColumnItem.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LockedColumnItem.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/ColumnChooser/LockedColumnItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI;IAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC;AAEnE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,EAClC,MAAM,GACP,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,2CAsBpC"}
|
package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/LockedColumnItem.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LockedColumnItem = LockedColumnItem;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const iconoir_react_1 = require("iconoir-react");
|
|
7
|
+
function LockedColumnItem({ column, }) {
|
|
8
|
+
const theme = (0, material_1.useTheme)();
|
|
9
|
+
const { iron } = theme.palette.app.color;
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { padding: "0px 20px", border: `1px solid ${iron[700]}` }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
11
|
+
display: "flex",
|
|
12
|
+
flexDirection: "row",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
justifyContent: "space-between",
|
|
15
|
+
height: "38px",
|
|
16
|
+
}, children: [(0, jsx_runtime_1.jsx)("p", { style: { fontSize: "14px" }, children: column.header?.toString() }), (0, jsx_runtime_1.jsx)(iconoir_react_1.Lock, { color: iron[800] })] }) }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AppColumnDef } from "../../../types";
|
|
2
|
+
type RefinedColumn = {
|
|
3
|
+
accessorKey: string;
|
|
4
|
+
hide?: boolean;
|
|
5
|
+
header: string;
|
|
6
|
+
align?: "left" | "center" | "right";
|
|
7
|
+
};
|
|
8
|
+
type useRefinedColumnsArgs<T> = {
|
|
9
|
+
columns: AppColumnDef<T>[];
|
|
10
|
+
};
|
|
11
|
+
export declare const useRefinedColumns: <T>({ columns }: useRefinedColumnsArgs<T>) => RefinedColumn[];
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=useRefinedColumns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRefinedColumns.d.ts","sourceRoot":"","sources":["../../../../../src/SmartGrid/Components/ColumnChooser/hooks/useRefinedColumns.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,KAAK,aAAa,GAAG;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;CACrC,CAAC;AAEF,KAAK,qBAAqB,CAAC,CAAC,IAAI;IAC9B,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;CAC5B,CAAC;AACF,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAE,aAAa,qBAAqB,CAAC,CAAC,CAAC,oBAqBzE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRefinedColumns = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useRefinedColumns = ({ columns }) => {
|
|
6
|
+
return (0, react_1.useMemo)(() => {
|
|
7
|
+
return columns
|
|
8
|
+
.filter((col) => !!col.accessorKey)
|
|
9
|
+
.map(({ accessorKey, hide, header, align }) => {
|
|
10
|
+
const result = {
|
|
11
|
+
accessorKey: accessorKey ?? "",
|
|
12
|
+
header: header,
|
|
13
|
+
};
|
|
14
|
+
if (hide !== undefined) {
|
|
15
|
+
result.hide = hide;
|
|
16
|
+
}
|
|
17
|
+
if (align !== undefined) {
|
|
18
|
+
result.align = align;
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
});
|
|
22
|
+
}, [columns]);
|
|
23
|
+
};
|
|
24
|
+
exports.useRefinedColumns = useRefinedColumns;
|
package/packages/shared-components/dist/SmartGrid/Components/FacetedFilter/FacetedFilter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FacetedFilter.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/FacetedFilter/FacetedFilter.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AASpD,KAAK,kBAAkB,CAAC,CAAC,IAAI;IAC3B,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,CAAC,EAAG,8BAG/B,kBAAkB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"FacetedFilter.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/FacetedFilter/FacetedFilter.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AASpD,KAAK,kBAAkB,CAAC,CAAC,IAAI;IAC3B,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,CAAC,EAAG,8BAG/B,kBAAkB,CAAC,CAAC,CAAC,4CAgVvB,CAAC"}
|
|
@@ -45,7 +45,9 @@ const FacetedFilter = ({ header, resetAllFilters, }) => {
|
|
|
45
45
|
if (valueToUse.length === 0) {
|
|
46
46
|
return false;
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
// Use Set for O(1) lookups instead of O(n) array.includes()
|
|
49
|
+
const valueSet = new Set(valueToUse);
|
|
50
|
+
return filteredOptions.every((opt) => valueSet.has(String(opt)));
|
|
49
51
|
}, [filterValue, localFilterData, filteredOptions, isOptionsEmpty]);
|
|
50
52
|
const manageIntermidiate = (0, react_1.useMemo)(() => {
|
|
51
53
|
const valueToUse = localFilterData ?? filterValue;
|
|
@@ -53,7 +55,9 @@ const FacetedFilter = ({ header, resetAllFilters, }) => {
|
|
|
53
55
|
if (isOptionsEmpty || isCurrentNoneMode || allSelected) {
|
|
54
56
|
return false;
|
|
55
57
|
}
|
|
56
|
-
|
|
58
|
+
// Use Set for O(1) lookups instead of O(n) array.includes()
|
|
59
|
+
const valueSet = new Set(valueToUse);
|
|
60
|
+
const selectedFilteredCount = filteredOptions.filter((opt) => valueSet.has(String(opt))).length;
|
|
57
61
|
return (selectedFilteredCount > 0 &&
|
|
58
62
|
selectedFilteredCount < filteredOptions.length);
|
|
59
63
|
}, [
|
|
@@ -84,8 +88,10 @@ const FacetedFilter = ({ header, resetAllFilters, }) => {
|
|
|
84
88
|
const handleSelectAll = () => {
|
|
85
89
|
const allOptions = filteredOptions.map(String);
|
|
86
90
|
const valueToUse = localFilterData ?? filterValue;
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
// Use Set for O(1) lookups instead of O(n*m) array operations
|
|
92
|
+
const valueSet = new Set(valueToUse);
|
|
93
|
+
const isAllSelected = valueToUse.length > 0 && allOptions.every((opt) => valueSet.has(opt));
|
|
94
|
+
// Use startTransition to make state updates non-blocking for large datasets
|
|
89
95
|
if (isAllSelected) {
|
|
90
96
|
setLocalFilterData([]);
|
|
91
97
|
}
|
|
@@ -140,7 +146,7 @@ const FacetedFilter = ({ header, resetAllFilters, }) => {
|
|
|
140
146
|
return ((0, jsx_runtime_1.jsxs)("div", { style: { position: "relative" }, children: [(0, jsx_runtime_1.jsxs)(material_1.IconButton, { ref: buttonRef, onClick: (e) => {
|
|
141
147
|
e.stopPropagation();
|
|
142
148
|
setIsOpen(!isOpen);
|
|
143
|
-
}, sx: { padding: 0, position: "relative" }, children: [(0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { toolTipLabel: "Faceted Filter", children: (0, jsx_runtime_1.jsx)(icons_material_1.FilterListRounded, {}) }), activeFilterCount > 0 && ((0, jsx_runtime_1.jsx)("span", { style: {
|
|
149
|
+
}, sx: { padding: 0, position: "relative" }, children: [(0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { toolTipLabel: "Faceted Filter", children: (0, jsx_runtime_1.jsx)(icons_material_1.FilterListRounded, { sx: { fontSize: "20px" } }) }), activeFilterCount > 0 && ((0, jsx_runtime_1.jsx)("span", { style: {
|
|
144
150
|
backgroundColor: butterflyBlue[900],
|
|
145
151
|
border: `2px solid ${iron[600]}`,
|
|
146
152
|
borderRadius: "50%",
|
|
@@ -4,7 +4,9 @@ type GroupAreaOverlayProps<T> = {
|
|
|
4
4
|
activeDragOver: string | null;
|
|
5
5
|
table: Table<T>;
|
|
6
6
|
defaultGrouping: Array<keyof T>;
|
|
7
|
+
isOutsideGrid?: boolean;
|
|
8
|
+
currentGrouping?: string[];
|
|
7
9
|
};
|
|
8
|
-
export declare const GroupAreaOverlay: <T>({ activeDragId, activeDragOver, table, defaultGrouping, }: GroupAreaOverlayProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const GroupAreaOverlay: <T>({ activeDragId, activeDragOver, table, defaultGrouping, isOutsideGrid, currentGrouping, }: GroupAreaOverlayProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export {};
|
|
10
12
|
//# sourceMappingURL=GroupAreaOverlay.d.ts.map
|
package/packages/shared-components/dist/SmartGrid/Components/Grouped/GroupAreaOverlay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupAreaOverlay.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/Grouped/GroupAreaOverlay.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"GroupAreaOverlay.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/Grouped/GroupAreaOverlay.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAInD,KAAK,qBAAqB,CAAC,CAAC,IAAI;IAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAG,2FAOlC,qBAAqB,CAAC,CAAC,CAAC,4CA4I1B,CAAC"}
|
|
@@ -5,7 +5,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const core_1 = require("@dnd-kit/core");
|
|
6
6
|
const material_1 = require("@mui/material");
|
|
7
7
|
const iconoir_react_1 = require("iconoir-react");
|
|
8
|
-
const
|
|
8
|
+
const HideIcon_1 = require("../Svgs/HideIcon");
|
|
9
|
+
const GroupAreaOverlay = ({ activeDragId, activeDragOver, table, defaultGrouping = [], isOutsideGrid = false, currentGrouping = [], }) => {
|
|
9
10
|
const theme = (0, material_1.useTheme)();
|
|
10
11
|
const { iron, lipstickRed, slate } = theme.palette.app.color;
|
|
11
12
|
const { getColumn, getHeaderGroups } = table;
|
|
@@ -33,16 +34,34 @@ const GroupAreaOverlay = ({ activeDragId, activeDragOver, table, defaultGrouping
|
|
|
33
34
|
const isGroupable = enableGrouping === true;
|
|
34
35
|
// Check if dragging over the group panel
|
|
35
36
|
const isOverGroupPanel = activeDragOver === "grouping-panel";
|
|
37
|
+
// Check if this is a grouped chip being dragged
|
|
38
|
+
const isGroupedChip = currentGrouping.includes(activeDragId);
|
|
39
|
+
// Check if outside grid and should show hide icon (only for column headers, not grouped chips)
|
|
40
|
+
const shouldShowHideIcon = isOutsideGrid && !isGroupedChip;
|
|
41
|
+
// Check if already at max grouping limit (4 columns)
|
|
42
|
+
const MAX_GROUPING_COLUMNS = 4;
|
|
43
|
+
const isAtMaxLimit = !isGroupedChip &&
|
|
44
|
+
isGroupable &&
|
|
45
|
+
currentGrouping.length >= MAX_GROUPING_COLUMNS &&
|
|
46
|
+
isOverGroupPanel;
|
|
36
47
|
// If defaultGrouping exists and enableGrouping is true, prohibit dragging to group area
|
|
37
|
-
const shouldProhibit = defaultGrouping.length > 0 && isGroupable && isOverGroupPanel
|
|
48
|
+
const shouldProhibit = (defaultGrouping.length > 0 && isGroupable && isOverGroupPanel) ||
|
|
49
|
+
isAtMaxLimit;
|
|
38
50
|
// Determine border color and icon based on groupability and drag location
|
|
39
|
-
const borderColor =
|
|
40
|
-
? lipstickRed[
|
|
51
|
+
const borderColor = shouldShowHideIcon
|
|
52
|
+
? lipstickRed[700]
|
|
41
53
|
: // eslint-disable-next-line sonarjs/no-nested-conditional
|
|
42
|
-
|
|
54
|
+
shouldProhibit
|
|
43
55
|
? lipstickRed[900]
|
|
44
|
-
:
|
|
56
|
+
: // eslint-disable-next-line sonarjs/no-nested-conditional
|
|
57
|
+
isOverGroupPanel && !isGroupable
|
|
58
|
+
? lipstickRed[900]
|
|
59
|
+
: iron[700];
|
|
45
60
|
const manageIcon = () => {
|
|
61
|
+
// Show hide icon when dragging outside grid (only for column headers)
|
|
62
|
+
if (shouldShowHideIcon) {
|
|
63
|
+
return (0, jsx_runtime_1.jsx)(HideIcon_1.HideIcon, { width: 20, height: 20 });
|
|
64
|
+
}
|
|
46
65
|
if (shouldProhibit) {
|
|
47
66
|
return (0, jsx_runtime_1.jsx)(iconoir_react_1.Prohibition, { width: 18, height: 18 });
|
|
48
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupedPanel.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/Grouped/GroupedPanel.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,KAAK,kBAAkB,CAAC,CAAC,IAAI;IAC3B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,KAAK,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACpD,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,CAAC,EAAG,4DAK9B,kBAAkB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"GroupedPanel.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/Grouped/GroupedPanel.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,KAAK,kBAAkB,CAAC,CAAC,IAAI;IAC3B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,KAAK,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACpD,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,CAAC,EAAG,4DAK9B,kBAAkB,CAAC,CAAC,CAAC,4CA2GvB,CAAC"}
|
|
@@ -44,10 +44,19 @@ const GroupedPanel = ({ groupedColumns, onRemoveGroup, table, defaultGrouping =
|
|
|
44
44
|
lineHeight: 1.5,
|
|
45
45
|
margin: 0,
|
|
46
46
|
padding: 0,
|
|
47
|
-
}, children: "Grouped By:" }), (0, jsx_runtime_1.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
}, children: "Grouped By:" }), (0, jsx_runtime_1.jsxs)(sortable_1.SortableContext, { items: groupedColumns, strategy: sortable_1.horizontalListSortingStrategy, children: [groupedColumns.map((columnId, index) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GroupChip_1.GroupChip, { columnId: columnId, onRemove: onRemoveGroup, table: table, defaultGrouping: defaultGrouping }), index < groupedColumns.length - 1 && ((0, jsx_runtime_1.jsx)("span", { style: {
|
|
48
|
+
color: iron[400],
|
|
49
|
+
fontSize: "12px",
|
|
50
|
+
fontWeight: 600,
|
|
51
|
+
}, children: ">" }))] }, columnId))), groupedColumns.length >= 4 && ((0, jsx_runtime_1.jsx)("p", { style: {
|
|
52
|
+
color: iron[400],
|
|
53
|
+
fontSize: 12,
|
|
54
|
+
fontWeight: 400,
|
|
55
|
+
lineHeight: 1.5,
|
|
56
|
+
margin: 0,
|
|
57
|
+
marginLeft: "auto",
|
|
58
|
+
padding: 0,
|
|
59
|
+
fontStyle: "italic",
|
|
60
|
+
}, children: "(Maximum 4 columns)" }))] })] })) }));
|
|
52
61
|
};
|
|
53
62
|
exports.GroupedPanel = GroupedPanel;
|
|
@@ -20,7 +20,7 @@ const HeaderCell = ({ dragAttributes, dragListeners, dragRef, dragTransform, dra
|
|
|
20
20
|
const transformStyle = dragTransform
|
|
21
21
|
? utilities_1.CSS.Transform.toString(dragTransform)
|
|
22
22
|
: undefined;
|
|
23
|
-
const backgroundColor = isReorderable && isDragOver ? slate[700] :
|
|
23
|
+
const backgroundColor = isReorderable && isDragOver ? slate[700] : "#fafafb";
|
|
24
24
|
const draggableAttributes = dragAttributes ?? {};
|
|
25
25
|
const draggableListeners = dragListeners ?? {};
|
|
26
26
|
const manageZIndex = () => {
|
|
@@ -89,7 +89,7 @@ const HeaderCell = ({ dragAttributes, dragListeners, dragRef, dragTransform, dra
|
|
|
89
89
|
}, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
90
90
|
color: iron[400],
|
|
91
91
|
fontFamily: "Poppins",
|
|
92
|
-
fontSize: "
|
|
92
|
+
fontSize: "13px",
|
|
93
93
|
fontWeight: 600,
|
|
94
94
|
lineHeight: "20px",
|
|
95
95
|
overflow: "hidden",
|
package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/SearchFilterRow.js
CHANGED
|
@@ -6,14 +6,14 @@ const material_1 = require("@mui/material");
|
|
|
6
6
|
const GetRenderInputs_1 = require("./GetRenderInputs");
|
|
7
7
|
const SearchFilterRow = ({ header, resetAllFilters, }) => {
|
|
8
8
|
const theme = (0, material_1.useTheme)();
|
|
9
|
-
const { iron
|
|
9
|
+
const { iron } = theme.palette.app.color;
|
|
10
10
|
const headerDyanmicWidth = header.column.getIsPinned()
|
|
11
11
|
? header.getSize() - 8
|
|
12
12
|
: header.getSize();
|
|
13
13
|
const columnDef = header.column.columnDef;
|
|
14
14
|
const filterVariant = columnDef.filterVariant;
|
|
15
15
|
return ((0, jsx_runtime_1.jsx)("th", { style: {
|
|
16
|
-
backgroundColor:
|
|
16
|
+
backgroundColor: "#fafafb",
|
|
17
17
|
borderBottom: `1px solid ${iron[700]}`,
|
|
18
18
|
height: "40px",
|
|
19
19
|
left: header.column.getIsPinned() === "left"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type FieldValues, type UseControllerProps } from "react-hook-form";
|
|
2
|
+
import type { SmartColumnAlignmentType } from "../types";
|
|
3
|
+
type SmartAlignmentsProps<P extends FieldValues> = Omit<UseControllerProps<P>, "defaultValue"> & {
|
|
4
|
+
defaultValue?: SmartColumnAlignmentType;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const SmartAlignments: <P extends FieldValues>({ name, control, defaultValue, rules, disabled, }: SmartAlignmentsProps<P>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=SmartAlignments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartAlignments.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/Components/SmartAlignments.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAQzD,KAAK,oBAAoB,CAAC,CAAC,SAAS,WAAW,IAAI,IAAI,CACrD,kBAAkB,CAAC,CAAC,CAAC,EACrB,cAAc,CACf,GAAG;IACF,YAAY,CAAC,EAAE,wBAAwB,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,WAAW,EAAE,mDAMpD,oBAAoB,CAAC,CAAC,CAAC,4CAgFzB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SmartAlignments = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const iconoir_react_1 = require("iconoir-react");
|
|
6
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
7
|
+
const SmartAlignments = ({ name, control, defaultValue, rules, disabled = false, }) => {
|
|
8
|
+
const { field: { value = defaultValue ?? "left", onChange }, } = (0, react_hook_form_1.useController)({
|
|
9
|
+
name,
|
|
10
|
+
control,
|
|
11
|
+
rules,
|
|
12
|
+
});
|
|
13
|
+
const alignments = [
|
|
14
|
+
{
|
|
15
|
+
value: "left",
|
|
16
|
+
icon: (0, jsx_runtime_1.jsx)(iconoir_react_1.AlignLeft, { width: 18, height: 18 }),
|
|
17
|
+
label: "Left",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
value: "center",
|
|
21
|
+
icon: (0, jsx_runtime_1.jsx)(iconoir_react_1.AlignCenter, { width: 18, height: 18 }),
|
|
22
|
+
label: "Center",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "right",
|
|
26
|
+
icon: (0, jsx_runtime_1.jsx)(iconoir_react_1.AlignRight, { width: 18, height: 18 }),
|
|
27
|
+
label: "Right",
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
31
|
+
display: "inline-flex",
|
|
32
|
+
backgroundColor: " #FFFFFF",
|
|
33
|
+
borderRadius: "6px",
|
|
34
|
+
border: "1px solid #E1E3E5",
|
|
35
|
+
}, children: alignments.map(({ value: alignmentValue, icon }) => {
|
|
36
|
+
const Icon = icon;
|
|
37
|
+
const isSelected = value === alignmentValue;
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
39
|
+
if (!disabled) {
|
|
40
|
+
onChange(alignmentValue);
|
|
41
|
+
}
|
|
42
|
+
}, disabled: disabled, style: {
|
|
43
|
+
padding: "4.5px 10px",
|
|
44
|
+
backgroundColor: "transparent",
|
|
45
|
+
border: "none",
|
|
46
|
+
borderRadius: "4px",
|
|
47
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
48
|
+
transition: "background-color 0.15s",
|
|
49
|
+
color: disabled ? "rgb(0, 0, 0, 0.5)" : "rgb(0, 0, 0)",
|
|
50
|
+
display: "flex",
|
|
51
|
+
alignItems: "center",
|
|
52
|
+
justifyContent: "center",
|
|
53
|
+
margin: "0px",
|
|
54
|
+
opacity: disabled ? 0.5 : 1,
|
|
55
|
+
...(isSelected
|
|
56
|
+
? {
|
|
57
|
+
backgroundColor: "rgb(229, 231, 231)",
|
|
58
|
+
}
|
|
59
|
+
: {}),
|
|
60
|
+
}, "aria-label": `Align ${alignmentValue}`, type: "button", children: Icon }, alignmentValue));
|
|
61
|
+
}) }));
|
|
62
|
+
};
|
|
63
|
+
exports.SmartAlignments = SmartAlignments;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
type SmartButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
export declare const SmartButton: ({ children, style, ...props }: SmartButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=SmartButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartButton.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/Components/SmartButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7D,KAAK,gBAAgB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAChE,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,+BAIzB,gBAAgB,4CAsBlB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SmartButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const SmartButton = ({ children, style, ...props }) => {
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("button", { ...props, style: {
|
|
7
|
+
flex: 1,
|
|
8
|
+
cursor: "pointer",
|
|
9
|
+
padding: "8px",
|
|
10
|
+
backgroundColor: "white",
|
|
11
|
+
color: "#333",
|
|
12
|
+
border: "1px solid #ddd",
|
|
13
|
+
borderRadius: "4px",
|
|
14
|
+
fontSize: "14px",
|
|
15
|
+
fontWeight: 500,
|
|
16
|
+
transition: "all 0.2s",
|
|
17
|
+
maxWidth: "80px",
|
|
18
|
+
...style,
|
|
19
|
+
}, children: children }));
|
|
20
|
+
};
|
|
21
|
+
exports.SmartButton = SmartButton;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
type SmartDialogProps = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
width?: number | string;
|
|
8
|
+
actions?: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export declare function SmartDialog({ open, onClose, children, width, actions, }: Readonly<SmartDialogProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=SmartDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartDialog.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/Components/SmartDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,KAAW,EACX,OAAO,GACR,EAAE,QAAQ,CAAC,gBAAgB,CAAC,2CAuD5B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SmartDialog = SmartDialog;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
function SmartDialog({ open, onClose, children, width = 420, actions, }) {
|
|
7
|
+
const dialogRef = (0, react_1.useRef)(null);
|
|
8
|
+
// Sync React state with native dialog
|
|
9
|
+
(0, react_1.useEffect)(() => {
|
|
10
|
+
const dialog = dialogRef.current;
|
|
11
|
+
if (!dialog) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (open && !dialog.open) {
|
|
15
|
+
dialog.showModal();
|
|
16
|
+
}
|
|
17
|
+
if (!open && dialog.open) {
|
|
18
|
+
dialog.close();
|
|
19
|
+
}
|
|
20
|
+
}, [open]);
|
|
21
|
+
return (
|
|
22
|
+
// eslint-disable-next-line sonarjs/mouse-events-a11y
|
|
23
|
+
(0, jsx_runtime_1.jsx)("dialog", { ref: dialogRef, onCancel: (e) => {
|
|
24
|
+
e.preventDefault(); // prevent native auto-close
|
|
25
|
+
onClose();
|
|
26
|
+
}, onClick: (e) => {
|
|
27
|
+
if (e.target == dialogRef.current) {
|
|
28
|
+
onClose();
|
|
29
|
+
}
|
|
30
|
+
}, style: {
|
|
31
|
+
border: "none",
|
|
32
|
+
background: "transparent",
|
|
33
|
+
outline: "none",
|
|
34
|
+
width,
|
|
35
|
+
padding: 0,
|
|
36
|
+
borderRadius: 2,
|
|
37
|
+
backgroundColor: "white",
|
|
38
|
+
boxShadow: "0 0 10px 0 rgba(0, 0, 0, 0.1)",
|
|
39
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
40
|
+
padding: 0,
|
|
41
|
+
}, children: [children, actions] }) }));
|
|
42
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type FieldValues, type UseControllerProps } from "react-hook-form";
|
|
2
|
+
type SmartSwitchProps<P extends FieldValues> = UseControllerProps<P> & {
|
|
3
|
+
label?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const SmartSwitch: <P extends FieldValues>({ name, control, defaultValue, rules, label, }: SmartSwitchProps<P>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=SmartSwitch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartSwitch.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/Components/SmartSwitch.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,iBAAiB,CAAC;AAEzB,KAAK,gBAAgB,CAAC,CAAC,SAAS,WAAW,IAAI,kBAAkB,CAAC,CAAC,CAAC,GAAG;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,WAAW,EAAE,gDAMhD,gBAAgB,CAAC,CAAC,CAAC,4CAqErB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SmartSwitch = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
6
|
+
const SmartSwitch = ({ name, control, defaultValue, rules, label, }) => {
|
|
7
|
+
const { field: { value = false, onChange }, } = (0, react_hook_form_1.useController)({ name, control, defaultValue, rules });
|
|
8
|
+
const handleToggle = () => {
|
|
9
|
+
onChange(!value);
|
|
10
|
+
};
|
|
11
|
+
const containerStyle = {
|
|
12
|
+
display: "flex",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
gap: "12px",
|
|
15
|
+
};
|
|
16
|
+
const labelStyle = {
|
|
17
|
+
color: "#374151",
|
|
18
|
+
fontWeight: "500",
|
|
19
|
+
};
|
|
20
|
+
const buttonStyle = {
|
|
21
|
+
position: "relative",
|
|
22
|
+
width: "42px",
|
|
23
|
+
height: "20px",
|
|
24
|
+
background: "transparent",
|
|
25
|
+
border: "none",
|
|
26
|
+
cursor: "pointer",
|
|
27
|
+
outline: "none",
|
|
28
|
+
padding: "0",
|
|
29
|
+
};
|
|
30
|
+
const trackStyle = {
|
|
31
|
+
position: "absolute",
|
|
32
|
+
top: "0",
|
|
33
|
+
left: "0",
|
|
34
|
+
width: "100%",
|
|
35
|
+
height: "100%",
|
|
36
|
+
borderRadius: "11px",
|
|
37
|
+
backgroundColor: value ? "#38bdf8" : "#e5e7eb",
|
|
38
|
+
transition: "background-color 0.25s ease",
|
|
39
|
+
};
|
|
40
|
+
const circleStyle = {
|
|
41
|
+
position: "absolute",
|
|
42
|
+
top: "2px",
|
|
43
|
+
left: value ? "23px" : "3px",
|
|
44
|
+
width: "18px",
|
|
45
|
+
height: "16px",
|
|
46
|
+
borderRadius: "50%",
|
|
47
|
+
backgroundColor: "#ffffff",
|
|
48
|
+
transition: "left 0.25s ease",
|
|
49
|
+
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.2)",
|
|
50
|
+
};
|
|
51
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: containerStyle, children: [label && (0, jsx_runtime_1.jsx)("span", { style: labelStyle, children: label }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleToggle, style: buttonStyle, role: "switch", "aria-checked": value, type: "button", children: [(0, jsx_runtime_1.jsx)("span", { style: trackStyle }), (0, jsx_runtime_1.jsx)("span", { style: circleStyle })] })] }));
|
|
52
|
+
};
|
|
53
|
+
exports.SmartSwitch = SmartSwitch;
|