grep-components 1.18.0 → 1.19.0-GREPF-1798.1
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.
|
@@ -11,6 +11,7 @@ export interface TableColumn<T> extends Pick<TableCellProps, 'padding' | 'sx'> {
|
|
|
11
11
|
getTooltip?: (row: T) => string;
|
|
12
12
|
getCell: (row: T) => string | number | boolean | JSX.Element;
|
|
13
13
|
lines?: (row: T) => number;
|
|
14
|
+
lang?: string | ((row: T) => string);
|
|
14
15
|
}
|
|
15
16
|
export interface GrepTableProps<T> extends Pick<TableProps, 'size' | 'stickyHeader' | 'padding'> {
|
|
16
17
|
data: T[];
|
package/dist/index.js
CHANGED
|
@@ -2065,6 +2065,11 @@ var weakMemoize = function weakMemoize(func) {
|
|
|
2065
2065
|
};
|
|
2066
2066
|
};
|
|
2067
2067
|
|
|
2068
|
+
var last = function last(arr) {
|
|
2069
|
+
return arr.length ? arr[arr.length - 1] : null;
|
|
2070
|
+
}; // based on https://github.com/thysultan/stylis.js/blob/e6843c373ebcbbfade25ebcc23f540ed8508da0a/src/Tokenizer.js#L239-L244
|
|
2071
|
+
|
|
2072
|
+
|
|
2068
2073
|
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
|
2069
2074
|
var previous = 0;
|
|
2070
2075
|
var character = 0;
|
|
@@ -2192,64 +2197,19 @@ var removeLabel = function removeLabel(element) {
|
|
|
2192
2197
|
var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
|
|
2193
2198
|
|
|
2194
2199
|
var isIgnoringComment = function isIgnoringComment(element) {
|
|
2195
|
-
return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
|
|
2200
|
+
return !!element && element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
|
|
2196
2201
|
};
|
|
2197
2202
|
|
|
2198
2203
|
var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
|
|
2199
2204
|
return function (element, index, children) {
|
|
2200
|
-
if (element.type !== 'rule'
|
|
2205
|
+
if (element.type !== 'rule') return;
|
|
2201
2206
|
var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
|
|
2202
2207
|
|
|
2203
|
-
if (unsafePseudoClasses) {
|
|
2204
|
-
var
|
|
2205
|
-
//
|
|
2206
|
-
// considering this input:
|
|
2207
|
-
// .a {
|
|
2208
|
-
// .b /* comm */ {}
|
|
2209
|
-
// color: hotpink;
|
|
2210
|
-
// }
|
|
2211
|
-
// we get output corresponding to this:
|
|
2212
|
-
// .a {
|
|
2213
|
-
// & {
|
|
2214
|
-
// /* comm */
|
|
2215
|
-
// color: hotpink;
|
|
2216
|
-
// }
|
|
2217
|
-
// .b {}
|
|
2218
|
-
// }
|
|
2219
|
-
|
|
2220
|
-
var commentContainer = isNested ? children[0].children : // global rule at the root level
|
|
2221
|
-
children;
|
|
2222
|
-
|
|
2223
|
-
for (var i = commentContainer.length - 1; i >= 0; i--) {
|
|
2224
|
-
var node = commentContainer[i];
|
|
2225
|
-
|
|
2226
|
-
if (node.line < element.line) {
|
|
2227
|
-
break;
|
|
2228
|
-
} // it is quite weird but comments are *usually* put at `column: element.column - 1`
|
|
2229
|
-
// so we seek *from the end* for the node that is earlier than the rule's `element` and check that
|
|
2230
|
-
// this will also match inputs like this:
|
|
2231
|
-
// .a {
|
|
2232
|
-
// /* comm */
|
|
2233
|
-
// .b {}
|
|
2234
|
-
// }
|
|
2235
|
-
//
|
|
2236
|
-
// but that is fine
|
|
2237
|
-
//
|
|
2238
|
-
// it would be the easiest to change the placement of the comment to be the first child of the rule:
|
|
2239
|
-
// .a {
|
|
2240
|
-
// .b { /* comm */ }
|
|
2241
|
-
// }
|
|
2242
|
-
// with such inputs we wouldn't have to search for the comment at all
|
|
2243
|
-
// TODO: consider changing this comment placement in the next major version
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
if (node.column < element.column) {
|
|
2247
|
-
if (isIgnoringComment(node)) {
|
|
2248
|
-
return;
|
|
2249
|
-
}
|
|
2208
|
+
if (unsafePseudoClasses && cache.compat !== true) {
|
|
2209
|
+
var prevElement = index > 0 ? children[index - 1] : null;
|
|
2250
2210
|
|
|
2251
|
-
|
|
2252
|
-
|
|
2211
|
+
if (prevElement && isIgnoringComment(last(prevElement.children))) {
|
|
2212
|
+
return;
|
|
2253
2213
|
}
|
|
2254
2214
|
|
|
2255
2215
|
unsafePseudoClasses.forEach(function (unsafePseudoClass) {
|
|
@@ -2499,12 +2459,14 @@ function _extends() {
|
|
|
2499
2459
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
2500
2460
|
for (var i = 1; i < arguments.length; i++) {
|
|
2501
2461
|
var source = arguments[i];
|
|
2462
|
+
|
|
2502
2463
|
for (var key in source) {
|
|
2503
2464
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
2504
2465
|
target[key] = source[key];
|
|
2505
2466
|
}
|
|
2506
2467
|
}
|
|
2507
2468
|
}
|
|
2469
|
+
|
|
2508
2470
|
return target;
|
|
2509
2471
|
};
|
|
2510
2472
|
return _extends.apply(this, arguments);
|
|
@@ -3177,7 +3139,7 @@ var CollapsableMenuItem = function (_a) {
|
|
|
3177
3139
|
return window.dispatchEvent(new Event('resize'));
|
|
3178
3140
|
});
|
|
3179
3141
|
} }, items)))); };
|
|
3180
|
-
return tooltipText ? (React__default.createElement(TooltipMenuItem, { className: classes.root, tooltipText: tooltipText, onMouseOver: function (e) { return e.currentTarget.focus(); }, disabled: disabled, selected: open, onClick: handleClick, onKeyDown: handleKey }, renderInner())) : (React__default.createElement(MenuItem, __assign({ className: classes.root, ref: listItemRef, selected: open, onClick: handleClick, onKeyDown: handleKey }, props), renderInner()));
|
|
3142
|
+
return tooltipText ? (React__default.createElement(TooltipMenuItem, { className: classes.root, tooltipText: tooltipText, onMouseOver: function (e) { return e.currentTarget.focus(); }, disabled: disabled, selected: open, onClick: handleClick, onKeyDown: handleKey }, renderInner())) : (React__default.createElement(MenuItem, __assign({ className: classes.root, ref: listItemRef, selected: open, disabled: disabled, onClick: handleClick, onKeyDown: handleKey }, props), renderInner()));
|
|
3181
3143
|
};
|
|
3182
3144
|
|
|
3183
3145
|
var useStyles$f = makeStyles()(function (_a) {
|
|
@@ -3406,9 +3368,9 @@ var CellValue = styled('span')({
|
|
|
3406
3368
|
});
|
|
3407
3369
|
var GrepTableRow$1 = function (_a) {
|
|
3408
3370
|
var row = _a.row, column = _a.column, selected = _a.selected, props = __rest$1(_a, ["row", "column", "selected"]);
|
|
3409
|
-
var forceTooltip = column.forceTooltip, getTooltip = column.getTooltip, getCell = column.getCell, _b = column.lines, lines = _b === void 0 ? function () { return (selected ? undefined : 1); } : _b;
|
|
3371
|
+
var forceTooltip = column.forceTooltip, getTooltip = column.getTooltip, getCell = column.getCell, lang = column.lang, _b = column.lines, lines = _b === void 0 ? function () { return (selected ? undefined : 1); } : _b;
|
|
3410
3372
|
var padding = column.padding;
|
|
3411
|
-
var value = (React__default.createElement(CellValue, { style: { WebkitLineClamp: lines(row) } }, getCell(row)));
|
|
3373
|
+
var value = (React__default.createElement(CellValue, { style: { WebkitLineClamp: lines(row) }, lang: typeof lang === 'string' ? lang : lang ? lang(row) : '' }, getCell(row)));
|
|
3412
3374
|
if (forceTooltip || getTooltip) {
|
|
3413
3375
|
return (React__default.createElement(TableCell, __assign({ padding: padding }, props),
|
|
3414
3376
|
React__default.createElement(OverflowTooltip, { force: forceTooltip, title: getTooltip ? getTooltip(row) : value }, value)));
|
|
@@ -20524,7 +20486,7 @@ var getCharCount = function (editorState) {
|
|
|
20524
20486
|
return editorState.getCurrentContent().getPlainText('').length;
|
|
20525
20487
|
};
|
|
20526
20488
|
var EditorComponent = function (_a) {
|
|
20527
|
-
var label = _a.label, classes = _a.classes, autoFocus = _a.autoFocus, helperText = _a.helperText, showCharCount = _a.showCharCount, allowedStyles = _a.allowedStyles, disableNewlines = _a.disableNewlines, onContentChange = _a.onContentChange, _b = _a.Toolbar, Toolbar = _b === void 0 ? FloatingToolbar : _b, blockPasting = _a.blockPasting, props = __rest$1(_a, ["label", "classes", "autoFocus", "helperText", "showCharCount", "allowedStyles", "disableNewlines", "onContentChange", "Toolbar", "blockPasting"]);
|
|
20489
|
+
var label = _a.label, classes = _a.classes, autoFocus = _a.autoFocus, helperText = _a.helperText, showCharCount = _a.showCharCount, allowedStyles = _a.allowedStyles, disableNewlines = _a.disableNewlines, onContentChange = _a.onContentChange, _b = _a.Toolbar, Toolbar = _b === void 0 ? FloatingToolbar : _b, blockPasting = _a.blockPasting, lang = _a.lang, props = __rest$1(_a, ["label", "classes", "autoFocus", "helperText", "showCharCount", "allowedStyles", "disableNewlines", "onContentChange", "Toolbar", "blockPasting", "lang"]);
|
|
20528
20490
|
var _c = useContext(EditorContext), state = _c.state, setState = _c.setState, setSelection = _c.setSelection;
|
|
20529
20491
|
var ref = useRef();
|
|
20530
20492
|
var canStyle = allowedStyles === undefined || allowedStyles.length > 0;
|
|
@@ -20593,7 +20555,7 @@ var EditorComponent = function (_a) {
|
|
|
20593
20555
|
React__default.createElement("span", { dangerouslySetInnerHTML: { __html: '​' } })),
|
|
20594
20556
|
label && (React__default.createElement("label", { className: clsx(styles.label, classes === null || classes === void 0 ? void 0 : classes.label) }, label)),
|
|
20595
20557
|
canStyle && (React__default.createElement(Toolbar, { editor: ref, buttons: buttons })),
|
|
20596
|
-
React__default.createElement(Box, { className: clsx(styles.editor, classes === null || classes === void 0 ? void 0 : classes.editor) },
|
|
20558
|
+
React__default.createElement(Box, { className: clsx(styles.editor, classes === null || classes === void 0 ? void 0 : classes.editor), lang: lang },
|
|
20597
20559
|
React__default.createElement(Editor, __assign({ ref: ref }, __assign({ editorState: state, onChange: onChange, onFocus: onFocus, onBlur: onBlur, blockStyleFn: blockStyleFn, handleKeyCommand: handleKeyCommand, keyBindingFn: keyBindingFn, handlePastedText: handlePastedText }, props)))),
|
|
20598
20560
|
(showCharCount || helperText) && (React__default.createElement(Box, { margin: ".5rem" },
|
|
20599
20561
|
showCharCount && (React__default.createElement(FormHelperText, { className: styles.charcount }, "Antall tegn: ".concat(charCount))),
|