pixelize-design-library 1.1.52 → 1.1.54
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { NoteTextAreaProps } from "./NoteTextAreaProps";
|
|
3
|
-
export default function NoteTextArea({ width, handleSubmit, handleCancel, value, title, file, isEditable, saveButtonLoading, maxFileSize, maxFilesSizeError, maxNoteWordCount, }: NoteTextAreaProps): React.JSX.Element;
|
|
3
|
+
export default function NoteTextArea({ width, handleSubmit, handleCancel, value, title, file, isEditable, saveButtonLoading, maxFileSize, maxFilesSizeError, maxNoteWordCount, onChange, ref, }: NoteTextAreaProps): React.JSX.Element;
|
|
@@ -98,7 +98,7 @@ var countWords = function (text) {
|
|
|
98
98
|
return text.trim().split(/\s+/).length;
|
|
99
99
|
};
|
|
100
100
|
function NoteTextArea(_a) {
|
|
101
|
-
var _b = _a.width, width = _b === void 0 ? "100%" : _b, handleSubmit = _a.handleSubmit, handleCancel = _a.handleCancel, value = _a.value, title = _a.title, file = _a.file, _c = _a.isEditable, isEditable = _c === void 0 ? false : _c, saveButtonLoading = _a.saveButtonLoading, _d = _a.maxFileSize, maxFileSize = _d === void 0 ? 1 * 1024 * 1024 : _d, _e = _a.maxFilesSizeError, maxFilesSizeError = _e === void 0 ? "Some files are too large. Maximum allowed size is" : _e, _f = _a.maxNoteWordCount, maxNoteWordCount = _f === void 0 ? 15 : _f;
|
|
101
|
+
var _b = _a.width, width = _b === void 0 ? "100%" : _b, handleSubmit = _a.handleSubmit, handleCancel = _a.handleCancel, value = _a.value, title = _a.title, file = _a.file, _c = _a.isEditable, isEditable = _c === void 0 ? false : _c, saveButtonLoading = _a.saveButtonLoading, _d = _a.maxFileSize, maxFileSize = _d === void 0 ? 1 * 1024 * 1024 : _d, _e = _a.maxFilesSizeError, maxFilesSizeError = _e === void 0 ? "Some files are too large. Maximum allowed size is" : _e, _f = _a.maxNoteWordCount, maxNoteWordCount = _f === void 0 ? 15 : _f, onChange = _a.onChange, ref = _a.ref;
|
|
102
102
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
103
103
|
var noteAreaRef = (0, react_1.useRef)(null);
|
|
104
104
|
var _g = (0, react_1.useState)(false), isActive = _g[0], setIsActive = _g[1];
|
|
@@ -169,6 +169,7 @@ function NoteTextArea(_a) {
|
|
|
169
169
|
};
|
|
170
170
|
var handleNoteChange = function (event) {
|
|
171
171
|
setNoteValue(event.target.value);
|
|
172
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event.target.value);
|
|
172
173
|
adjustHeight();
|
|
173
174
|
};
|
|
174
175
|
(0, react_1.useEffect)(function () {
|
|
@@ -209,7 +210,7 @@ function NoteTextArea(_a) {
|
|
|
209
210
|
var start = nameWithoutExtension.substring(0, maxLength - extension.length - 3);
|
|
210
211
|
return "".concat(start, "...").concat(extension, " ");
|
|
211
212
|
};
|
|
212
|
-
return (react_1.default.createElement(Container, { style: { width: width }, isActive: isActive },
|
|
213
|
+
return (react_1.default.createElement(Container, { style: { width: width }, isActive: isActive, ref: ref },
|
|
213
214
|
react_1.default.createElement(PlaceholderText, { isActive: !isActive, onClick: handleTextArea },
|
|
214
215
|
react_1.default.createElement("span", null, "Add a note...")),
|
|
215
216
|
react_1.default.createElement(TextAreaContainer, { isActive: isActive },
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LegacyRef } from "react";
|
|
1
2
|
export type NoteTextAreaProps = {
|
|
2
3
|
width: number | string;
|
|
3
4
|
handleSubmit: (noteValue: string, titleValue: string, file: File[], resetState: void) => void;
|
|
@@ -10,4 +11,6 @@ export type NoteTextAreaProps = {
|
|
|
10
11
|
maxFileSize?: number;
|
|
11
12
|
maxFilesSizeError?: string;
|
|
12
13
|
maxNoteWordCount?: number;
|
|
14
|
+
onChange?: (value: string) => void;
|
|
15
|
+
ref?: LegacyRef<HTMLDivElement>;
|
|
13
16
|
};
|
|
@@ -102,20 +102,37 @@ var TableBody = function (_a) {
|
|
|
102
102
|
backgroundColor: theme.colors.gray[100],
|
|
103
103
|
},
|
|
104
104
|
}
|
|
105
|
-
: {},
|
|
106
|
-
"& > td": {
|
|
107
|
-
backgroundColor: theme.colors.gray[100],
|
|
108
|
-
},
|
|
109
|
-
} },
|
|
105
|
+
: {} },
|
|
110
106
|
isContent && (react_2.default.createElement(RenderContent, { rowIndex: rowIndex, isExpanded: isExpanded, isContent: !!row.content })),
|
|
111
107
|
isCheckbox && react_2.default.createElement(RenderCheckbox, { row: row, isChecked: isChecked }),
|
|
112
108
|
columns.map(function (header, headerIndex) {
|
|
113
|
-
var _a;
|
|
109
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
114
110
|
var isFrozen = header.isFreeze;
|
|
115
111
|
var leftOffset = isFrozen
|
|
116
112
|
? (0, table_1.calculateLeftOffset)(columnWidths, headerIndex) +
|
|
117
113
|
(isCheckbox ? 50 : 0)
|
|
118
114
|
: 0;
|
|
115
|
+
var cellBgColor = undefined;
|
|
116
|
+
var cellTextColor = undefined;
|
|
117
|
+
if ((_a = row.cellStyle) === null || _a === void 0 ? void 0 : _a[header.id]) {
|
|
118
|
+
cellBgColor =
|
|
119
|
+
(_d = (_c = (_b = row.cellStyle) === null || _b === void 0 ? void 0 : _b[header.id]) === null || _c === void 0 ? void 0 : _c.bg) !== null && _d !== void 0 ? _d : theme.colors.backgroundColor.light;
|
|
120
|
+
cellTextColor =
|
|
121
|
+
(_g = (_f = (_e = row.cellStyle) === null || _e === void 0 ? void 0 : _e[header.id]) === null || _f === void 0 ? void 0 : _f.color) !== null && _g !== void 0 ? _g : undefined;
|
|
122
|
+
}
|
|
123
|
+
else if (isFrozen) {
|
|
124
|
+
cellBgColor = freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : undefined;
|
|
125
|
+
cellTextColor = freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : undefined;
|
|
126
|
+
}
|
|
127
|
+
else if (index % 2 === 1) {
|
|
128
|
+
cellBgColor = theme.colors.backgroundColor.light;
|
|
129
|
+
}
|
|
130
|
+
var rowBgColor = undefined;
|
|
131
|
+
var rowTextColor = undefined;
|
|
132
|
+
if (row.rowStyle) {
|
|
133
|
+
rowBgColor = (_h = row.rowStyle) === null || _h === void 0 ? void 0 : _h.bg;
|
|
134
|
+
rowTextColor = (_j = row.rowStyle) === null || _j === void 0 ? void 0 : _j.color;
|
|
135
|
+
}
|
|
119
136
|
return (visibleColumns[header.label] && (react_2.default.createElement(react_1.Td, { maxWidth: 500, minWidth: 120, key: headerIndex + 1, onClick: function () {
|
|
120
137
|
return !header.node
|
|
121
138
|
? handleRowClick(row, {
|
|
@@ -123,13 +140,13 @@ var TableBody = function (_a) {
|
|
|
123
140
|
id: header.id,
|
|
124
141
|
})
|
|
125
142
|
: null;
|
|
126
|
-
}, fontSize: 14, fontWeight: 400, position: isFrozen ? "sticky" : undefined, left: isFrozen ? leftOffset : undefined, zIndex: isFrozen ? 1 : 0, backgroundColor:
|
|
127
|
-
? freezedBgColor
|
|
128
|
-
: index % 2 === 1
|
|
129
|
-
? theme.colors.backgroundColor.light
|
|
130
|
-
: "white", textOverflow: "ellipsis", border: noBorders
|
|
143
|
+
}, fontSize: 14, fontWeight: 400, position: isFrozen ? "sticky" : undefined, left: isFrozen ? leftOffset : undefined, zIndex: isFrozen ? 1 : 0, backgroundColor: cellBgColor !== null && cellBgColor !== void 0 ? cellBgColor : rowBgColor, textOverflow: "ellipsis", border: noBorders
|
|
131
144
|
? "none"
|
|
132
|
-
: "1px solid ".concat((
|
|
145
|
+
: "1px solid ".concat((_k = theme.colors) === null || _k === void 0 ? void 0 : _k.gray[isFrozen || isChecked ? 300 : 200]), className: "columns ".concat(isFrozen ? "sticky-columns" : "scrollable-columns"), boxSizing: "border-box", color: cellTextColor !== null && cellTextColor !== void 0 ? cellTextColor : rowTextColor, _hover: ((_l = row.cellStyle) === null || _l === void 0 ? void 0 : _l[header.id]) || row.rowStyle
|
|
146
|
+
? {}
|
|
147
|
+
: {
|
|
148
|
+
backgroundColor: theme.colors.gray[100],
|
|
149
|
+
} },
|
|
133
150
|
react_2.default.createElement(react_1.Box, { textOverflow: "ellipsis", whiteSpace: "nowrap", display: "block", overflow: "hidden" }, header.node ? header.node(row) : row[header.id]))));
|
|
134
151
|
}),
|
|
135
152
|
isLink && react_2.default.createElement(RenderView, { row: row, bgcolor: freezeViewColor })),
|