pixelize-design-library 2.1.73 → 2.1.75
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/Components/Apexcharts/ApexDonutChart/ApexDonutChart.d.ts +4 -0
- package/dist/Components/Apexcharts/ApexDonutChart/ApexDonutChart.js +58 -0
- package/dist/Components/Apexcharts/ApexDonutChart/ApexDonutChartProps.d.ts +21 -0
- package/dist/Components/Apexcharts/ApexDonutChart/ApexDonutChartProps.js +2 -0
- package/dist/Components/Apexcharts/ApexPieChart/ApexPieChart.d.ts +2 -1
- package/dist/Components/Apexcharts/ApexPieChart/ApexPieChart.js +113 -16
- package/dist/Components/Apexcharts/ApexPieChart/ApexPieChartProps.d.ts +15 -33
- package/dist/Components/KaTable/CustomHeader.d.ts +14 -0
- package/dist/Components/KaTable/CustomHeader.js +69 -0
- package/dist/Components/KaTable/KaTable.d.ts +13 -0
- package/dist/Components/KaTable/KaTable.js +111 -0
- package/dist/Components/KaTable/KaTableProps.d.ts +23 -0
- package/dist/Components/KaTable/KaTableProps.js +2 -0
- package/dist/Components/KaTable/SelectionCell.d.ts +8 -0
- package/dist/Components/KaTable/SelectionCell.js +38 -0
- package/dist/Components/KaTable/SelectionHeader.d.ts +3 -0
- package/dist/Components/KaTable/SelectionHeader.js +56 -0
- package/dist/Components/KaTable/ka-table.css +27 -0
- package/dist/Components/KaTable/useMergedChildComponents.d.ts +14 -0
- package/dist/Components/KaTable/useMergedChildComponents.js +224 -0
- package/dist/Components/NoteTextArea/NoteTextArea.js +0 -381
- package/dist/Components/Table/Table.css +16 -0
- package/dist/Pages/KaTableExample.d.ts +3 -0
- package/dist/Pages/KaTableExample.js +259 -0
- package/dist/Pages/chart.js +11 -7
- package/dist/Theme/Default/fonts.d.ts +35 -0
- package/dist/Theme/Default/fonts.js +37 -0
- package/package.json +1 -1
- package/dist/index.d.mts +0 -1468
- package/dist/index.mjs +0 -263
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.ka-thead-cell {
|
|
2
|
+
padding: 7px 7px;
|
|
3
|
+
}
|
|
4
|
+
.ka-cell {
|
|
5
|
+
padding: 7px 0px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.ka-thead-background {
|
|
9
|
+
background-color: #bfbcbc;
|
|
10
|
+
z-index: 1;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ka-cell-text {
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
text-overflow: ellipsis;
|
|
16
|
+
white-space: nowrap;
|
|
17
|
+
padding-left: 5%;
|
|
18
|
+
}
|
|
19
|
+
.ka-row {
|
|
20
|
+
box-sizing: unset;
|
|
21
|
+
border-bottom: none;
|
|
22
|
+
border-top: none;
|
|
23
|
+
}
|
|
24
|
+
.ka-table-wrapper {
|
|
25
|
+
border-bottom: 2px solid #d8d9db;
|
|
26
|
+
border-right: 2px solid #d8d9db;
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { KaTableProps } from "./KaTableProps";
|
|
2
|
+
type MergedChildComponentsProps = Pick<KaTableProps, "headerBgColor" | "headerTextColor" | "freezedBgColor" | "freezedTextColor"> & {
|
|
3
|
+
childComponents: any;
|
|
4
|
+
onSortChange: any;
|
|
5
|
+
handleSelection: any;
|
|
6
|
+
rowKey: any;
|
|
7
|
+
onRowClick: any;
|
|
8
|
+
selected: any;
|
|
9
|
+
dataLength: number;
|
|
10
|
+
columns: any;
|
|
11
|
+
sortState: any;
|
|
12
|
+
};
|
|
13
|
+
declare const useMergedChildComponents: ({ childComponents, onSortChange, handleSelection, rowKey, onRowClick, selected, dataLength, columns, headerBgColor, freezedBgColor, headerTextColor, freezedTextColor, sortState, }: MergedChildComponentsProps) => any;
|
|
14
|
+
export default useMergedChildComponents;
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
37
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
38
|
+
if (ar || !(i in from)) {
|
|
39
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
40
|
+
ar[i] = from[i];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
44
|
+
};
|
|
45
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
|
+
};
|
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
var react_1 = __importStar(require("react"));
|
|
50
|
+
var CustomHeader_1 = __importDefault(require("./CustomHeader"));
|
|
51
|
+
var SelectionHeader_1 = __importDefault(require("./SelectionHeader"));
|
|
52
|
+
var SelectionCell_1 = __importDefault(require("./SelectionCell"));
|
|
53
|
+
var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
54
|
+
var table_1 = require("../../Utils/table");
|
|
55
|
+
var useMergedChildComponents = function (_a) {
|
|
56
|
+
var childComponents = _a.childComponents, onSortChange = _a.onSortChange, handleSelection = _a.handleSelection, rowKey = _a.rowKey, onRowClick = _a.onRowClick, selected = _a.selected, dataLength = _a.dataLength, columns = _a.columns, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, sortState = _a.sortState;
|
|
57
|
+
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
58
|
+
var handleSortChange = (0, react_1.useCallback)(function (newState, columnKey) {
|
|
59
|
+
var newSortState = __spreadArray([], sortState, true);
|
|
60
|
+
var existingIndex = newSortState.findIndex(function (sort) { return sort.column === columnKey; });
|
|
61
|
+
if (existingIndex === -1) {
|
|
62
|
+
newSortState.push({
|
|
63
|
+
column: columnKey,
|
|
64
|
+
direction: newState, // Default to ascending when adding a column
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
var existingSort = newSortState[existingIndex];
|
|
69
|
+
existingSort.direction = newState;
|
|
70
|
+
}
|
|
71
|
+
var column = columns.find(function (col) { return col.key === columnKey; });
|
|
72
|
+
column.sortDirection = newState;
|
|
73
|
+
onSortChange(newSortState);
|
|
74
|
+
}, [sortState, onSortChange, columns]);
|
|
75
|
+
var _b = react_1.default.useState(selected), selections = _b[0], setSelections = _b[1];
|
|
76
|
+
(0, react_1.useEffect)(function () {
|
|
77
|
+
setSelections(selected);
|
|
78
|
+
}, [selected]);
|
|
79
|
+
var isAllSelected = (0, react_1.useMemo)(function () {
|
|
80
|
+
return {
|
|
81
|
+
checked: (selections === null || selections === void 0 ? void 0 : selections.length) === (dataLength || -1),
|
|
82
|
+
intederminate: (selections === null || selections === void 0 ? void 0 : selections.length) > 0 && (selections === null || selections === void 0 ? void 0 : selections.length) < dataLength,
|
|
83
|
+
};
|
|
84
|
+
}, [selections, dataLength]);
|
|
85
|
+
var cellSelectionHandle = (0, react_1.useCallback)(function (values, type) {
|
|
86
|
+
if (type === "add") {
|
|
87
|
+
setSelections(__spreadArray(__spreadArray([], selections, true), [values], false));
|
|
88
|
+
handleSelection(__spreadArray(__spreadArray([], selections, true), [values], false));
|
|
89
|
+
}
|
|
90
|
+
else if (type === "remove") {
|
|
91
|
+
setSelections(selections.filter(function (value) { return value !== values; }));
|
|
92
|
+
handleSelection(selections.filter(function (value) { return value !== values; }));
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
handleSelection(selections.filter(function (value) { return value !== values; }));
|
|
96
|
+
}
|
|
97
|
+
}, [selections, handleSelection]);
|
|
98
|
+
var headerSelectionHandle = (0, react_1.useCallback)(function (values) {
|
|
99
|
+
setSelections(values);
|
|
100
|
+
handleSelection(values);
|
|
101
|
+
}, [handleSelection]);
|
|
102
|
+
return (0, react_1.useMemo)(function () {
|
|
103
|
+
return __assign(__assign({}, childComponents), { dataRow: {
|
|
104
|
+
elementAttributes: function (props) {
|
|
105
|
+
var _a, _b;
|
|
106
|
+
var existingElementAttributes = (_a = childComponents.dataRow) === null || _a === void 0 ? void 0 : _a.elementAttributes;
|
|
107
|
+
var attributes = existingElementAttributes
|
|
108
|
+
? existingElementAttributes(props)
|
|
109
|
+
: {};
|
|
110
|
+
var isSelected = selections === null || selections === void 0 ? void 0 : selections.includes(props.rowData[rowKey]);
|
|
111
|
+
var className = "".concat(attributes.className || "", " ").concat(isSelected ? "ka-row-selected" : "", " ka-row-hover").trim();
|
|
112
|
+
// const className =
|
|
113
|
+
// `${attributes.className || ""} ${isSelected ? "ka-row-selected" : ""}`.trim();
|
|
114
|
+
return __assign(__assign({}, attributes), { className: className, style: __assign(__assign({}, (attributes.style || {})), { backgroundColor: isSelected
|
|
115
|
+
? theme.colors.backgroundColor.subtle
|
|
116
|
+
: undefined, border: "1px solid ".concat((_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray[200]) }) });
|
|
117
|
+
},
|
|
118
|
+
}, headCell: {
|
|
119
|
+
content: function (props) {
|
|
120
|
+
var _a, _b, _c;
|
|
121
|
+
var existingContent = (_a = childComponents.headCell) === null || _a === void 0 ? void 0 : _a.content;
|
|
122
|
+
if (existingContent) {
|
|
123
|
+
var result = existingContent(props);
|
|
124
|
+
if (result) {
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
var column = props.column;
|
|
129
|
+
if (column.sortable || column.filter) {
|
|
130
|
+
return (react_1.default.createElement(CustomHeader_1.default, __assign({}, props, { onSortChange: handleSortChange, menuItems: (_b = column === null || column === void 0 ? void 0 : column.menu) !== null && _b !== void 0 ? _b : [], isSort: props.column.sortable, sortDirection: (_c = props.column.sortDirection) !== null && _c !== void 0 ? _c : "none" })));
|
|
131
|
+
}
|
|
132
|
+
if (props.column.key === "select-cell") {
|
|
133
|
+
return (react_1.default.createElement(SelectionHeader_1.default, { onSelectionChange: headerSelectionHandle, rowKey: rowKey, selected: isAllSelected }));
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
},
|
|
137
|
+
elementAttributes: function (props) {
|
|
138
|
+
var _a, _b, _c, _d, _e, _f;
|
|
139
|
+
var existingElementAttributes = (_a = childComponents.headCell) === null || _a === void 0 ? void 0 : _a.elementAttributes;
|
|
140
|
+
if (existingElementAttributes) {
|
|
141
|
+
var result = existingElementAttributes(props);
|
|
142
|
+
if (result) {
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (props.column.columnFreeze) {
|
|
147
|
+
var stickyLeft = (0, table_1.getPreviousColumnWidth)(columns, props.column.key);
|
|
148
|
+
return {
|
|
149
|
+
style: __assign(__assign({}, props.column.style), { position: "sticky", left: stickyLeft, zIndex: 3, backgroundColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.backgroundColor.subtle, color: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray[600] }),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
style: {
|
|
154
|
+
backgroundColor: headerBgColor !== null && headerBgColor !== void 0 ? headerBgColor : (_d = theme.colors.backgroundColor) === null || _d === void 0 ? void 0 : _d.subtle,
|
|
155
|
+
color: headerTextColor !== null && headerTextColor !== void 0 ? headerTextColor : (_e = theme.colors) === null || _e === void 0 ? void 0 : _e.gray[600],
|
|
156
|
+
border: "1px solid ".concat((_f = theme.colors) === null || _f === void 0 ? void 0 : _f.gray[200]),
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
}, cell: {
|
|
161
|
+
elementAttributes: function (props) {
|
|
162
|
+
var _a, _b, _c, _d, _e;
|
|
163
|
+
var existingElementAttributes = (_a = childComponents.cell) === null || _a === void 0 ? void 0 : _a.elementAttributes;
|
|
164
|
+
if (existingElementAttributes) {
|
|
165
|
+
var result = existingElementAttributes(props);
|
|
166
|
+
if (result) {
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (props.column.columnFreeze) {
|
|
171
|
+
var stickyLeft = (0, table_1.getPreviousColumnWidth)(columns, props.column.key);
|
|
172
|
+
return {
|
|
173
|
+
style: __assign(__assign({}, props.column.style), { position: "sticky", left: stickyLeft, zIndex: 2, backgroundColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.backgroundColor.subtle, color: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray[600], fontWeight: 600 }),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
style: {
|
|
178
|
+
color: (_d = theme.colors) === null || _d === void 0 ? void 0 : _d.gray[600],
|
|
179
|
+
fontWeight: 500,
|
|
180
|
+
border: "1px solid ".concat((_e = theme.colors) === null || _e === void 0 ? void 0 : _e.gray[200]),
|
|
181
|
+
},
|
|
182
|
+
onClick: function () {
|
|
183
|
+
if (onRowClick) {
|
|
184
|
+
onRowClick(props.rowData, props.column.key);
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
},
|
|
189
|
+
}, tableWrapper: {
|
|
190
|
+
elementAttributes: function () { return ({ style: { maxHeight: 600 } }); },
|
|
191
|
+
}, cellText: {
|
|
192
|
+
content: function (props) {
|
|
193
|
+
var _a;
|
|
194
|
+
var existingContent = (_a = childComponents.cellText) === null || _a === void 0 ? void 0 : _a.content;
|
|
195
|
+
if (existingContent) {
|
|
196
|
+
var result = existingContent(props);
|
|
197
|
+
if (result) {
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (props.column.key === "select-cell") {
|
|
202
|
+
var isSelected = selections === null || selections === void 0 ? void 0 : selections.includes(props.rowData[rowKey]);
|
|
203
|
+
return (react_1.default.createElement(SelectionCell_1.default, __assign({}, props, { selected: isSelected, onSelectionChange: cellSelectionHandle })));
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
} });
|
|
207
|
+
}, [
|
|
208
|
+
childComponents,
|
|
209
|
+
rowKey,
|
|
210
|
+
onRowClick,
|
|
211
|
+
selections,
|
|
212
|
+
columns,
|
|
213
|
+
cellSelectionHandle,
|
|
214
|
+
headerSelectionHandle,
|
|
215
|
+
isAllSelected,
|
|
216
|
+
theme.colors,
|
|
217
|
+
headerBgColor,
|
|
218
|
+
headerTextColor,
|
|
219
|
+
freezedBgColor,
|
|
220
|
+
freezedTextColor,
|
|
221
|
+
handleSortChange,
|
|
222
|
+
]);
|
|
223
|
+
};
|
|
224
|
+
exports.default = useMergedChildComponents;
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// import React, { useEffect, useRef, useState } from "react";
|
|
3
|
-
// import { NoteTextAreaProps } from "./NoteTextAreaProps";
|
|
4
|
-
// import styled from "@emotion/styled";
|
|
5
|
-
// import { Spinner } from "@chakra-ui/react";
|
|
6
|
-
// import { CustomThemeProps } from "../../Theme/themeProps";
|
|
7
|
-
// import { useCustomTheme } from "../../Theme/useCustomTheme";
|
|
8
|
-
// import { Paperclip, X } from "lucide-react";
|
|
9
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
3
|
if (k2 === undefined) k2 = k;
|
|
11
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -39,380 +32,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
39
32
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
40
33
|
};
|
|
41
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
// const Container = styled.div<{ isActive: boolean }>`
|
|
43
|
-
// border: ${({ isActive }) =>
|
|
44
|
-
// isActive ? "1px solid #3182ce" : "1px solid #c0c6cc"};
|
|
45
|
-
// border-radius: 5px;
|
|
46
|
-
// box-shadow: ${({ isActive }) =>
|
|
47
|
-
// isActive
|
|
48
|
-
// ? "-1px 1px 8px 4px rgb(49 130 206 / 24%), 0px 2px 6px 0 rgb(49 130 206 / 19%)"
|
|
49
|
-
// : "none"};
|
|
50
|
-
// `;
|
|
51
|
-
// const TextAreaContainer = styled.div<{ isActive: boolean }>`
|
|
52
|
-
// width: 100%;
|
|
53
|
-
// cursor: text;
|
|
54
|
-
// padding: 12px 15px;
|
|
55
|
-
// display: ${({ isActive }) => (isActive ? "block" : "none")};
|
|
56
|
-
// `;
|
|
57
|
-
// const PlaceholderText = styled.div<{ isActive: boolean }>`
|
|
58
|
-
// color: #c0c6cc;
|
|
59
|
-
// width: 100%;
|
|
60
|
-
// cursor: text;
|
|
61
|
-
// display: ${({ isActive }) => (isActive ? "block" : "none")};
|
|
62
|
-
// padding: 12px 15px;
|
|
63
|
-
// `;
|
|
64
|
-
// const InputTitle = styled.input`
|
|
65
|
-
// width: 100%;
|
|
66
|
-
// height: auto;
|
|
67
|
-
// border: none;
|
|
68
|
-
// outline: none;
|
|
69
|
-
// background: none;
|
|
70
|
-
// color: black;
|
|
71
|
-
// fontsize: 1rem;
|
|
72
|
-
// fontweight: 500;
|
|
73
|
-
// marginbottom: 2px;
|
|
74
|
-
// `;
|
|
75
|
-
// const NotesTextArea = styled.textarea<{ isActive: boolean; noteValue: string }>`
|
|
76
|
-
// color: ${({ isActive, noteValue }) =>
|
|
77
|
-
// isActive && noteValue ? "#000000" : "#c0c6cc"};
|
|
78
|
-
// width: 100%;
|
|
79
|
-
// height: auto;
|
|
80
|
-
// border: none;
|
|
81
|
-
// outline: none;
|
|
82
|
-
// background: none;
|
|
83
|
-
// fontweight: 300;
|
|
84
|
-
// `;
|
|
85
|
-
// const FileUploadLabel = styled.label`
|
|
86
|
-
// cursor: pointer;
|
|
87
|
-
// `;
|
|
88
|
-
// const AddTitleButton = styled.div`
|
|
89
|
-
// color: #616e88;
|
|
90
|
-
// cursor: pointer;
|
|
91
|
-
// fontsize: 0.8rem;
|
|
92
|
-
// `;
|
|
93
|
-
// const Button = styled.button<{
|
|
94
|
-
// noteValue: string;
|
|
95
|
-
// isSaveButton: boolean;
|
|
96
|
-
// isLoading: boolean;
|
|
97
|
-
// theme: CustomThemeProps;
|
|
98
|
-
// disabled: boolean;
|
|
99
|
-
// }>`
|
|
100
|
-
// border: none;
|
|
101
|
-
// padding: 3px 15px;
|
|
102
|
-
// text-align: center;
|
|
103
|
-
// text-decoration: none;
|
|
104
|
-
// background: ${({ isSaveButton, noteValue, isLoading, theme }) =>
|
|
105
|
-
// isSaveButton
|
|
106
|
-
// ? noteValue && !isLoading
|
|
107
|
-
// ? theme.colors.primary[500]
|
|
108
|
-
// : theme.colors.primary[500]
|
|
109
|
-
// : "white"};
|
|
110
|
-
// color: ${({ isSaveButton, isLoading }) =>
|
|
111
|
-
// isSaveButton && !isLoading ? "white" : "white"};
|
|
112
|
-
// font-size: 1rem;
|
|
113
|
-
// margin-right: 5px;
|
|
114
|
-
// border-radius: 5px;
|
|
115
|
-
// opacity: ${({ isSaveButton, noteValue, isLoading, disabled }) =>
|
|
116
|
-
// isSaveButton && (!noteValue || isLoading || disabled) ? "0.5" : "1"};
|
|
117
|
-
// cursor: ${({ isSaveButton, noteValue, isLoading, disabled }) =>
|
|
118
|
-
// isSaveButton && (!noteValue || isLoading || disabled)
|
|
119
|
-
// ? "initial"
|
|
120
|
-
// : "pointer"};
|
|
121
|
-
// pointer-events: ${({ isLoading }) => (isLoading ? "none" : "auto")};
|
|
122
|
-
// `;
|
|
123
|
-
// const CancelButton = styled.button`
|
|
124
|
-
// border: none;
|
|
125
|
-
// color: #5e5c5c;
|
|
126
|
-
// padding: 3px 15px;
|
|
127
|
-
// text-align: center;
|
|
128
|
-
// text-decoration: none;
|
|
129
|
-
// background: white;
|
|
130
|
-
// font-size: 1rem;
|
|
131
|
-
// margin-right: 5px;
|
|
132
|
-
// border-radius: 5px;
|
|
133
|
-
// `;
|
|
134
|
-
// const FileViewer = styled.div`
|
|
135
|
-
// display: flex;
|
|
136
|
-
// align-items: center;
|
|
137
|
-
// justify-content: space-between;
|
|
138
|
-
// width: 300px;
|
|
139
|
-
// `;
|
|
140
|
-
// const FileEdit = styled(X)`
|
|
141
|
-
// cursor: pointer;
|
|
142
|
-
// color: #ff0000;
|
|
143
|
-
// `;
|
|
144
|
-
// const ErrorText = styled.div`
|
|
145
|
-
// color: #ff0000;
|
|
146
|
-
// font-size: 0.8rem;
|
|
147
|
-
// margin-top: 8px;
|
|
148
|
-
// `;
|
|
149
|
-
// const countWords = (text: string) => {
|
|
150
|
-
// return text.trim().split(/\s+/).length;
|
|
151
|
-
// };
|
|
152
|
-
// export default function NoteTextArea({
|
|
153
|
-
// width = "100%",
|
|
154
|
-
// handleSubmit,
|
|
155
|
-
// handleCancel,
|
|
156
|
-
// value,
|
|
157
|
-
// title,
|
|
158
|
-
// file,
|
|
159
|
-
// isEditable = false,
|
|
160
|
-
// saveButtonLoading,
|
|
161
|
-
// maxFileSize = 1 * 1024 * 1024,
|
|
162
|
-
// maxFilesSizeError = "Some files are too large. Maximum allowed size is",
|
|
163
|
-
// maxNoteWordCount = 15,
|
|
164
|
-
// onChange,
|
|
165
|
-
// ref,
|
|
166
|
-
// }: NoteTextAreaProps) {
|
|
167
|
-
// const theme = useCustomTheme();
|
|
168
|
-
// const noteAreaRef = useRef<HTMLTextAreaElement>(null);
|
|
169
|
-
// const [isActive, setIsActive] = useState<boolean>(false);
|
|
170
|
-
// const [noteValue, setNoteValue] = useState<string>("");
|
|
171
|
-
// const [titleValue, setTitleValue] = useState<string>("");
|
|
172
|
-
// const [titleShow, setTitleShow] = useState<boolean>(false);
|
|
173
|
-
// const [files, setFiles] = useState<File[]>([]);
|
|
174
|
-
// const [fileError, setFileError] = useState<string>("");
|
|
175
|
-
// const [isSaveDisabled, setIsSaveDisabled] = useState(false);
|
|
176
|
-
// useEffect(() => {
|
|
177
|
-
// const titleWordCount = countWords(titleValue);
|
|
178
|
-
// setIsSaveDisabled(titleWordCount > maxNoteWordCount);
|
|
179
|
-
// }, [titleValue, maxNoteWordCount]);
|
|
180
|
-
// useEffect(() => {
|
|
181
|
-
// const noteWordCount = countWords(noteValue);
|
|
182
|
-
// setIsSaveDisabled(noteWordCount > maxNoteWordCount);
|
|
183
|
-
// }, [noteValue, maxNoteWordCount]);
|
|
184
|
-
// useEffect(() => {
|
|
185
|
-
// if (isEditable) {
|
|
186
|
-
// setIsActive(true);
|
|
187
|
-
// if (value) {
|
|
188
|
-
// setNoteValue(value);
|
|
189
|
-
// }
|
|
190
|
-
// if (title) {
|
|
191
|
-
// setTitleValue(title);
|
|
192
|
-
// setTitleShow(true);
|
|
193
|
-
// }
|
|
194
|
-
// if (file) {
|
|
195
|
-
// setFiles(file);
|
|
196
|
-
// }
|
|
197
|
-
// }
|
|
198
|
-
// }, [value, title, file, isEditable]);
|
|
199
|
-
// useEffect(() => {
|
|
200
|
-
// if (!saveButtonLoading) {
|
|
201
|
-
// setIsActive(false);
|
|
202
|
-
// if (!isEditable) {
|
|
203
|
-
// setNoteValue("");
|
|
204
|
-
// setTitleValue("");
|
|
205
|
-
// setTitleShow(false);
|
|
206
|
-
// setFiles([]);
|
|
207
|
-
// }
|
|
208
|
-
// }
|
|
209
|
-
// if (isEditable) {
|
|
210
|
-
// setIsActive(true);
|
|
211
|
-
// }
|
|
212
|
-
// }, [saveButtonLoading, isEditable]);
|
|
213
|
-
// const handleTextArea = () => {
|
|
214
|
-
// setIsActive(true);
|
|
215
|
-
// if (!isEditable) {
|
|
216
|
-
// setNoteValue("");
|
|
217
|
-
// setTitleValue("");
|
|
218
|
-
// setTitleShow(false);
|
|
219
|
-
// setFiles([]);
|
|
220
|
-
// }
|
|
221
|
-
// };
|
|
222
|
-
// const handleCloseTextArea = () => {
|
|
223
|
-
// setIsActive(false);
|
|
224
|
-
// if (handleCancel) {
|
|
225
|
-
// handleCancel(!isActive);
|
|
226
|
-
// }
|
|
227
|
-
// if (!isEditable) {
|
|
228
|
-
// setNoteValue("");
|
|
229
|
-
// setTitleValue("");
|
|
230
|
-
// setTitleShow(false);
|
|
231
|
-
// setFiles([]);
|
|
232
|
-
// }
|
|
233
|
-
// setFileError("");
|
|
234
|
-
// };
|
|
235
|
-
// const handleNoteChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
236
|
-
// setNoteValue(event.target.value);
|
|
237
|
-
// onChange?.(event.target.value);
|
|
238
|
-
// adjustHeight();
|
|
239
|
-
// };
|
|
240
|
-
// useEffect(() => {
|
|
241
|
-
// if (isActive && noteAreaRef.current) {
|
|
242
|
-
// noteAreaRef.current.focus();
|
|
243
|
-
// }
|
|
244
|
-
// }, [isActive]);
|
|
245
|
-
// const adjustHeight = () => {
|
|
246
|
-
// const textarea = noteAreaRef.current;
|
|
247
|
-
// if (!textarea) return;
|
|
248
|
-
// textarea.style.height = "auto";
|
|
249
|
-
// textarea.style.height = `${textarea.scrollHeight}px`;
|
|
250
|
-
// };
|
|
251
|
-
// const handleSetTitle = () => {
|
|
252
|
-
// setTitleShow(true);
|
|
253
|
-
// };
|
|
254
|
-
// const handleTitleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
255
|
-
// event.target.value.length === 0 && setTitleShow(false);
|
|
256
|
-
// setTitleValue(event.target.value);
|
|
257
|
-
// };
|
|
258
|
-
// const formatBytes = (bytes: any, decimals = 2) => {
|
|
259
|
-
// if (bytes === 0) return "0 Bytes";
|
|
260
|
-
// const k = 1024;
|
|
261
|
-
// const dm = decimals < 0 ? 0 : decimals;
|
|
262
|
-
// const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
|
263
|
-
// const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
264
|
-
// return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
|
|
265
|
-
// };
|
|
266
|
-
// const shortenFileName = (name: string, maxLength = 20) => {
|
|
267
|
-
// const extension = name.substring(name.lastIndexOf("."));
|
|
268
|
-
// if (name.length <= maxLength) return name;
|
|
269
|
-
// const nameWithoutExtension = name.replace(extension, "");
|
|
270
|
-
// const start = nameWithoutExtension.substring(
|
|
271
|
-
// 0,
|
|
272
|
-
// maxLength - extension.length - 3
|
|
273
|
-
// );
|
|
274
|
-
// return `${start}...${extension} `;
|
|
275
|
-
// };
|
|
276
|
-
// return (
|
|
277
|
-
// <Container style={{ width }} isActive={isActive}>
|
|
278
|
-
// <PlaceholderText isActive={!isActive} onClick={handleTextArea}>
|
|
279
|
-
// <span>Add a note...</span>
|
|
280
|
-
// </PlaceholderText>
|
|
281
|
-
// <TextAreaContainer isActive={isActive}>
|
|
282
|
-
// {titleShow && (
|
|
283
|
-
// <InputTitle
|
|
284
|
-
// value={titleValue}
|
|
285
|
-
// onChange={handleTitleChange}
|
|
286
|
-
// placeholder="Add a title..."
|
|
287
|
-
// ref={ref}
|
|
288
|
-
// />
|
|
289
|
-
// )}
|
|
290
|
-
// <NotesTextArea
|
|
291
|
-
// ref={noteAreaRef}
|
|
292
|
-
// isActive={isActive}
|
|
293
|
-
// noteValue={noteValue}
|
|
294
|
-
// value={noteValue}
|
|
295
|
-
// onChange={handleNoteChange}
|
|
296
|
-
// placeholder="Add a note..."
|
|
297
|
-
// />
|
|
298
|
-
// </TextAreaContainer>
|
|
299
|
-
// {isActive && (
|
|
300
|
-
// <>
|
|
301
|
-
// <hr style={{ margin: 0 }} />
|
|
302
|
-
// <div style={{ padding: "12px 15px" }}>
|
|
303
|
-
// <div style={{ display: "flex", alignItems: "center" }}>
|
|
304
|
-
// <FileUploadLabel htmlFor="file-upload">
|
|
305
|
-
// <Paperclip size={17} />
|
|
306
|
-
// <input
|
|
307
|
-
// id="file-upload"
|
|
308
|
-
// type="file"
|
|
309
|
-
// style={{ display: "none" }}
|
|
310
|
-
// onChange={(e) => {
|
|
311
|
-
// const newFiles = Array.from(e.target.files || []);
|
|
312
|
-
// const validFiles = newFiles.filter(
|
|
313
|
-
// (file) => file.size <= maxFileSize
|
|
314
|
-
// );
|
|
315
|
-
// const invalidFiles = newFiles.filter(
|
|
316
|
-
// (file) => file.size > maxFileSize
|
|
317
|
-
// );
|
|
318
|
-
// if (invalidFiles.length > 0) {
|
|
319
|
-
// setFileError(
|
|
320
|
-
// `${maxFilesSizeError} ${formatBytes(maxFileSize)}.`
|
|
321
|
-
// );
|
|
322
|
-
// } else {
|
|
323
|
-
// setFileError("");
|
|
324
|
-
// }
|
|
325
|
-
// if (validFiles.length > 0) {
|
|
326
|
-
// setFiles((prevFiles) => [...prevFiles, ...validFiles]);
|
|
327
|
-
// }
|
|
328
|
-
// }}
|
|
329
|
-
// multiple
|
|
330
|
-
// // onChange={(event) => {
|
|
331
|
-
// // if (event.target.files && event.target.files.length > 0) {
|
|
332
|
-
// // const filesArray = Array.from(event.target.files);
|
|
333
|
-
// // const validFiles = filesArray.filter(
|
|
334
|
-
// // (file) => file.size <= maxFileSize
|
|
335
|
-
// // );
|
|
336
|
-
// // setFiles([...files, ...validFiles]);
|
|
337
|
-
// // }
|
|
338
|
-
// // }}
|
|
339
|
-
// />
|
|
340
|
-
// </FileUploadLabel>
|
|
341
|
-
// {!titleShow && (
|
|
342
|
-
// <>
|
|
343
|
-
// <div
|
|
344
|
-
// style={{
|
|
345
|
-
// height: "15px",
|
|
346
|
-
// width: "1px",
|
|
347
|
-
// backgroundColor: "#c0c6cc",
|
|
348
|
-
// marginRight: "5px",
|
|
349
|
-
// marginLeft: "5px",
|
|
350
|
-
// }}
|
|
351
|
-
// ></div>
|
|
352
|
-
// <AddTitleButton onClick={handleSetTitle}>
|
|
353
|
-
// Add a Title
|
|
354
|
-
// </AddTitleButton>
|
|
355
|
-
// </>
|
|
356
|
-
// )}
|
|
357
|
-
// <div style={{ marginLeft: "auto" }}>
|
|
358
|
-
// <CancelButton onClick={handleCloseTextArea}>
|
|
359
|
-
// Cancel
|
|
360
|
-
// </CancelButton>
|
|
361
|
-
// <Button
|
|
362
|
-
// isSaveButton={true}
|
|
363
|
-
// noteValue={noteValue}
|
|
364
|
-
// isLoading={saveButtonLoading}
|
|
365
|
-
// disabled={!noteValue || isSaveDisabled}
|
|
366
|
-
// theme={theme}
|
|
367
|
-
// onClick={() => {
|
|
368
|
-
// handleSubmit(noteValue, titleValue, files);
|
|
369
|
-
// // handleCloseTextArea();
|
|
370
|
-
// }}
|
|
371
|
-
// >
|
|
372
|
-
// {saveButtonLoading && (
|
|
373
|
-
// <span style={{ marginRight: "6px" }}>
|
|
374
|
-
// <Spinner
|
|
375
|
-
// thickness="2px"
|
|
376
|
-
// speed="0.75s"
|
|
377
|
-
// emptyColor="gray.200"
|
|
378
|
-
// color="blue.500"
|
|
379
|
-
// size="xs"
|
|
380
|
-
// />
|
|
381
|
-
// </span>
|
|
382
|
-
// )}
|
|
383
|
-
// Save
|
|
384
|
-
// </Button>
|
|
385
|
-
// </div>
|
|
386
|
-
// </div>
|
|
387
|
-
// <div style={{ display: "flex", gap: "10px" }}>
|
|
388
|
-
// <div>Note:</div>
|
|
389
|
-
// <div>You can add up to {maxNoteWordCount} words only</div>
|
|
390
|
-
// </div>
|
|
391
|
-
// {fileError && <ErrorText>{fileError}</ErrorText>}{" "}
|
|
392
|
-
// {/* Display file error */}
|
|
393
|
-
// {files.length > 0 && (
|
|
394
|
-
// <div>
|
|
395
|
-
// {files.map((item, index) => (
|
|
396
|
-
// <FileViewer key={index}>
|
|
397
|
-
// <>
|
|
398
|
-
// <span>{shortenFileName(item.name)}</span>
|
|
399
|
-
// <span>{formatBytes(item.size)}</span>
|
|
400
|
-
// </>
|
|
401
|
-
// <FileEdit
|
|
402
|
-
// onClick={() =>
|
|
403
|
-
// setFiles(files.filter((fileItem) => fileItem !== item))
|
|
404
|
-
// }
|
|
405
|
-
// />
|
|
406
|
-
// </FileViewer>
|
|
407
|
-
// ))}
|
|
408
|
-
// </div>
|
|
409
|
-
// )}
|
|
410
|
-
// </div>
|
|
411
|
-
// </>
|
|
412
|
-
// )}
|
|
413
|
-
// </Container>
|
|
414
|
-
// );
|
|
415
|
-
// }
|
|
416
35
|
var react_1 = __importStar(require("react"));
|
|
417
36
|
var react_2 = require("@chakra-ui/react");
|
|
418
37
|
var lucide_react_1 = require("lucide-react");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.table_wrapper {
|
|
2
|
+
width: 100%;
|
|
3
|
+
border-collapse: collapse;
|
|
4
|
+
/* table-layout: fixed; */
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.table_wrapper th .resize-handle {
|
|
8
|
+
position: absolute;
|
|
9
|
+
top: 0;
|
|
10
|
+
right: 0;
|
|
11
|
+
width: 8px;
|
|
12
|
+
height: 100%;
|
|
13
|
+
cursor: col-resize;
|
|
14
|
+
background-color: transparent;
|
|
15
|
+
z-index: 999;
|
|
16
|
+
}
|