@vendorflow/components 2.0.73 → 2.0.76
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/lib/TempHooks.d.ts +9 -0
- package/lib/TempHooks.js +25 -0
- package/lib/components/InfiniteScroll/InfiniteScroll.d.ts +16 -0
- package/lib/components/InfiniteScroll/InfiniteScroll.js +159 -0
- package/lib/components/InfiniteScroll/index.d.ts +1 -0
- package/lib/components/InfiniteScroll/index.js +8 -0
- package/lib/components/blueprint/InputGroup/InputGroup.d.ts +20 -0
- package/lib/components/blueprint/InputGroup/InputGroup.js +13 -0
- package/lib/components/blueprint/InputGroup/InputGroup.story.d.ts +2 -0
- package/lib/components/blueprint/InputGroup/InputGroup.story.js +11 -0
- package/lib/components/blueprint/InputGroup/index.d.ts +1 -0
- package/lib/components/blueprint/InputGroup/index.js +4 -0
- package/lib/components/blueprint/InputSelect/InputSelect.d.ts +51 -0
- package/lib/components/blueprint/InputSelect/InputSelect.js +98 -0
- package/lib/components/blueprint/InputSelect/InputSelect.story.d.ts +3 -0
- package/lib/components/blueprint/InputSelect/InputSelect.story.js +19 -0
- package/lib/components/blueprint/InputSelect/index.d.ts +1 -0
- package/lib/components/blueprint/InputSelect/index.js +4 -0
- package/lib/components/blueprint/InputTime/InputTime.d.ts +24 -0
- package/lib/components/blueprint/InputTime/InputTime.js +28 -0
- package/lib/components/blueprint/InputTime/InputTime.story.d.ts +2 -0
- package/lib/components/blueprint/InputTime/InputTime.story.js +11 -0
- package/lib/components/blueprint/InputTime/index.d.ts +1 -0
- package/lib/components/blueprint/InputTime/index.js +4 -0
- package/lib/components/material-ui/DataTable/Data.js +1 -1
- package/lib/components/material-ui/DataTable/DataTable.d.ts +90 -7
- package/lib/components/material-ui/DataTable/DataTable.js +92 -67
- package/lib/components/material-ui/DataTable/DataTable.story.js +14 -2
- package/lib/components/material-ui/DataTable/SortIndicator.js +2 -2
- package/lib/components/material-ui/DataTable/TablePieces/AppliedFilters.d.ts +12 -0
- package/lib/components/material-ui/DataTable/TablePieces/AppliedFilters.js +26 -0
- package/lib/components/material-ui/DataTable/TablePieces/BodyCell.d.ts +10 -0
- package/lib/components/material-ui/DataTable/TablePieces/BodyCell.js +49 -0
- package/lib/components/material-ui/DataTable/TablePieces/BodyRow.d.ts +15 -0
- package/lib/components/material-ui/DataTable/TablePieces/BodyRow.js +88 -0
- package/lib/components/material-ui/DataTable/TablePieces/GlobalSearchFilter.d.ts +10 -0
- package/lib/components/material-ui/DataTable/TablePieces/GlobalSearchFilter.js +49 -0
- package/lib/components/material-ui/DataTable/TablePieces/HeaderCell.d.ts +12 -0
- package/lib/components/material-ui/DataTable/TablePieces/HeaderCell.js +55 -0
- package/lib/components/material-ui/DataTable/TablePieces/IndeterminateCheckbox.d.ts +4 -0
- package/lib/components/material-ui/DataTable/TablePieces/IndeterminateCheckbox.js +65 -0
- package/lib/components/material-ui/DataTable/TablePieces/SortIndicator.d.ts +10 -0
- package/lib/components/material-ui/DataTable/TablePieces/SortIndicator.js +33 -0
- package/lib/components/material-ui/DataTable/TablePieces/Table.d.ts +12 -0
- package/lib/components/material-ui/DataTable/TablePieces/Table.js +47 -0
- package/lib/components/material-ui/DataTable/TablePieces/TableBodyContent.d.ts +25 -0
- package/lib/components/material-ui/DataTable/TablePieces/TableBodyContent.js +71 -0
- package/lib/components/material-ui/DataTable/TablePieces/Toolbar.d.ts +24 -0
- package/lib/components/material-ui/DataTable/TablePieces/Toolbar.js +63 -0
- package/lib/components/material-ui/DataTable/TablePieces/ViewColumnTool.d.ts +11 -0
- package/lib/components/material-ui/DataTable/TablePieces/ViewColumnTool.js +76 -0
- package/lib/components/material-ui/DataTable/Utils.d.ts +25 -0
- package/lib/components/material-ui/DataTable/Utils.js +119 -0
- package/lib/components/material-ui/ErrorBoundary/ErrorBoundary.d.ts +7 -0
- package/lib/components/material-ui/ErrorBoundary/ErrorBoundary.js +20 -0
- package/lib/components/material-ui/ErrorBoundary/index.d.ts +1 -0
- package/lib/components/material-ui/ErrorBoundary/index.js +8 -0
- package/lib/services/Select.service.d.ts +5 -0
- package/lib/services/Select.service.js +67 -0
- package/package.json +5 -2
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __assign = (this && this.__assign) || function () {
|
|
7
|
+
__assign = Object.assign || function(t) {
|
|
8
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
+
s = arguments[i];
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
+
t[p] = s[p];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
return __assign.apply(this, arguments);
|
|
16
|
+
};
|
|
17
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
18
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
19
|
+
if (!m) return o;
|
|
20
|
+
var i = m.call(o), r, ar = [], e;
|
|
21
|
+
try {
|
|
22
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
23
|
+
}
|
|
24
|
+
catch (error) { e = { error: error }; }
|
|
25
|
+
finally {
|
|
26
|
+
try {
|
|
27
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
28
|
+
}
|
|
29
|
+
finally { if (e) throw e.error; }
|
|
30
|
+
}
|
|
31
|
+
return ar;
|
|
32
|
+
};
|
|
33
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
34
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
/** @jsxRuntime classic */
|
|
38
|
+
/** @jsx jsx */
|
|
39
|
+
var react_1 = require("@emotion/react");
|
|
40
|
+
var react_2 = require("react");
|
|
41
|
+
var material_1 = require("@mui/material");
|
|
42
|
+
var icons_material_1 = require("@mui/icons-material");
|
|
43
|
+
var nanoid_1 = require("nanoid");
|
|
44
|
+
var IndeterminateCheckbox_1 = __importDefault(require("./IndeterminateCheckbox"));
|
|
45
|
+
function ViewColumnTool(_a) {
|
|
46
|
+
var allColumns = _a.allColumns, columnNameById = _a.columnNameById;
|
|
47
|
+
var id = (0, react_2.useMemo)(function () { return (0, nanoid_1.nanoid)(); }, []);
|
|
48
|
+
var _b = __read((0, react_2.useState)(null), 2), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
49
|
+
var open = !!anchorEl;
|
|
50
|
+
function handleClick(evt) {
|
|
51
|
+
setAnchorEl(evt.currentTarget);
|
|
52
|
+
}
|
|
53
|
+
function handleClose() {
|
|
54
|
+
setAnchorEl(null);
|
|
55
|
+
}
|
|
56
|
+
return ((0, react_1.jsx)(react_2.Fragment, null,
|
|
57
|
+
(0, react_1.jsx)(material_1.Tooltip, { title: "Show Columns" },
|
|
58
|
+
(0, react_1.jsx)(material_1.IconButton, { "aria-describedby": id, onClick: handleClick },
|
|
59
|
+
(0, react_1.jsx)(icons_material_1.ViewColumn, null))),
|
|
60
|
+
(0, react_1.jsx)(material_1.Popover, { id: id, open: open, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: { vertical: 'bottom', horizontal: 'center' } },
|
|
61
|
+
(0, react_1.jsx)("div", { css: (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 0.5rem;\n "], ["\n padding: 0.5rem;\n "]))) },
|
|
62
|
+
(0, react_1.jsx)("div", { css: (0, react_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n "], ["\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n "]))) },
|
|
63
|
+
(0, react_1.jsx)(material_1.Typography, { css: (0, react_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-size: 14px;\n color: rgba(0, 0, 0, 0.54);\n "], ["\n font-size: 14px;\n color: rgba(0, 0, 0, 0.54);\n "]))) }, "Show Columns"),
|
|
64
|
+
(0, react_1.jsx)(material_1.Tooltip, { title: "Close" },
|
|
65
|
+
(0, react_1.jsx)(material_1.IconButton, { onClick: handleClose },
|
|
66
|
+
(0, react_1.jsx)(icons_material_1.Close, null)))),
|
|
67
|
+
(0, react_1.jsx)("div", { css: (0, react_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: flex-start;\n "], ["\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: flex-start;\n "]))) }, allColumns
|
|
68
|
+
.filter(function (column) { return column.id !== 'custom'; })
|
|
69
|
+
.map(function (column) {
|
|
70
|
+
return ((0, react_1.jsx)(material_1.FormControlLabel, { key: column.id, label: columnNameById[column.id],
|
|
71
|
+
// @ts-ignore
|
|
72
|
+
control: (0, react_1.jsx)(IndeterminateCheckbox_1.default, __assign({}, column.getToggleHiddenProps())) }));
|
|
73
|
+
}))))));
|
|
74
|
+
}
|
|
75
|
+
exports.default = ViewColumnTool;
|
|
76
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import short from 'short-uuid';
|
|
3
|
+
import { EnhancedRow } from './DataTable';
|
|
4
|
+
/**
|
|
5
|
+
* This custom hook is designed to replace the `<CellMeasurer />` component in `react-virtualized`
|
|
6
|
+
* in `react-window`
|
|
7
|
+
*
|
|
8
|
+
* This hook returns props to be given to the `<VariableSizeList />` component in `react-window`
|
|
9
|
+
*
|
|
10
|
+
* `items` are react elements
|
|
11
|
+
*/
|
|
12
|
+
export default function useCellMeasurer({ items, renderItem, }: {
|
|
13
|
+
items: any[];
|
|
14
|
+
renderItem: (item: EnhancedRow<any>) => JSX.Element;
|
|
15
|
+
}): {
|
|
16
|
+
innerRef: import("react").RefObject<HTMLDivElement>;
|
|
17
|
+
itemSize: (index: any) => number;
|
|
18
|
+
itemCount: number;
|
|
19
|
+
key: short.SUUID;
|
|
20
|
+
style: {
|
|
21
|
+
visibility?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
visibility: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
18
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
var react_1 = require("react");
|
|
23
|
+
var short_uuid_1 = __importDefault(require("short-uuid"));
|
|
24
|
+
var server_1 = require("react-dom/server");
|
|
25
|
+
var resize_observer_polyfill_1 = __importDefault(require("resize-observer-polyfill"));
|
|
26
|
+
/**
|
|
27
|
+
* This custom hook is designed to replace the `<CellMeasurer />` component in `react-virtualized`
|
|
28
|
+
* in `react-window`
|
|
29
|
+
*
|
|
30
|
+
* This hook returns props to be given to the `<VariableSizeList />` component in `react-window`
|
|
31
|
+
*
|
|
32
|
+
* `items` are react elements
|
|
33
|
+
*/
|
|
34
|
+
function useCellMeasurer(_a) {
|
|
35
|
+
var items = _a.items, renderItem = _a.renderItem;
|
|
36
|
+
// create a ref to get the `div` element the `VariableSizeList` uses
|
|
37
|
+
var innerRef = (0, react_1.useRef)(null);
|
|
38
|
+
// create a unique ID for this cell measurer instance
|
|
39
|
+
var id = (0, react_1.useMemo)(function () { return short_uuid_1.default.generate(); }, []);
|
|
40
|
+
// create a "hidden sizing element" in state.
|
|
41
|
+
//
|
|
42
|
+
// when the innerRef element mounts, the width of the innerRef will be used for width of
|
|
43
|
+
// the hidden sizing element
|
|
44
|
+
var _b = __read((0, react_1.useState)(null), 2), hiddenSizingEl = _b[0], setHiddenSizingEl = _b[1];
|
|
45
|
+
// this width is used to determine whether the list needs to be re-rendered due to a resize
|
|
46
|
+
var _c = __read((0, react_1.useState)(0), 2), width = _c[0], setWidth = _c[1];
|
|
47
|
+
// `itemSize` is a function required by `VariableSizeList`. This function is called when it needs
|
|
48
|
+
// to get the height of the item inside it.
|
|
49
|
+
// note: the result of this function is memoized by `react-window` so it will only be called once
|
|
50
|
+
// to get the item size
|
|
51
|
+
var itemSize = (0, react_1.useCallback)(function (index) {
|
|
52
|
+
if (!hiddenSizingEl)
|
|
53
|
+
return 0;
|
|
54
|
+
// get the item (which is a react node)
|
|
55
|
+
var item = items[index];
|
|
56
|
+
// then render the react node to a string synchronously with `react-dom/server`
|
|
57
|
+
hiddenSizingEl.innerHTML = (0, server_1.renderToString)(renderItem(item));
|
|
58
|
+
// get and return the size of the hidden sizing element
|
|
59
|
+
return hiddenSizingEl.clientHeight || 0;
|
|
60
|
+
}, [hiddenSizingEl, items]);
|
|
61
|
+
// this effects adds the hidden sizing element to the DOM
|
|
62
|
+
(0, react_1.useEffect)(function () {
|
|
63
|
+
/** @type {HTMLElement} */
|
|
64
|
+
var innerEl = innerRef.current;
|
|
65
|
+
if (!innerEl)
|
|
66
|
+
return;
|
|
67
|
+
if (hiddenSizingEl)
|
|
68
|
+
return;
|
|
69
|
+
var newHiddenSizingEl = document.createElement('div');
|
|
70
|
+
var width = innerEl.clientWidth;
|
|
71
|
+
newHiddenSizingEl.classList.add("hidden-sizing-element-" + id);
|
|
72
|
+
newHiddenSizingEl.style.position = 'absolute';
|
|
73
|
+
newHiddenSizingEl.style.top = '0';
|
|
74
|
+
newHiddenSizingEl.style.width = width + "px";
|
|
75
|
+
newHiddenSizingEl.style.pointerEvents = 'none';
|
|
76
|
+
newHiddenSizingEl.style.visibility = 'hidden';
|
|
77
|
+
setHiddenSizingEl(newHiddenSizingEl);
|
|
78
|
+
document.body.appendChild(newHiddenSizingEl);
|
|
79
|
+
}, [hiddenSizingEl, id]);
|
|
80
|
+
// this removes all hidden sizing elements on unmount
|
|
81
|
+
(0, react_1.useEffect)(function () {
|
|
82
|
+
// returning a function from `useEffect` is the "clean-up" phase
|
|
83
|
+
return function () {
|
|
84
|
+
var hiddenSizingElement = document.querySelector(".hidden-sizing-element-" + id);
|
|
85
|
+
if (hiddenSizingElement) {
|
|
86
|
+
document.body.removeChild(hiddenSizingElement);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}, [id]);
|
|
90
|
+
// this is used to watch for changes in the size of the list element and sets the width
|
|
91
|
+
(0, react_1.useEffect)(function () {
|
|
92
|
+
var el = innerRef.current;
|
|
93
|
+
if (!el)
|
|
94
|
+
return;
|
|
95
|
+
function handleResize() {
|
|
96
|
+
var width = ((el === null || el === void 0 ? void 0 : el.getBoundingClientRect()) || { width: 0 }).width;
|
|
97
|
+
setWidth(width);
|
|
98
|
+
}
|
|
99
|
+
var resizeObserver = new resize_observer_polyfill_1.default(handleResize);
|
|
100
|
+
resizeObserver.observe(el);
|
|
101
|
+
return function () { return resizeObserver.disconnect(); };
|
|
102
|
+
}, []);
|
|
103
|
+
// this key is used to re-render the list when the dependencies array changes
|
|
104
|
+
var key = (0, react_1.useMemo)(function () { return short_uuid_1.default.generate(); }, [itemSize, hiddenSizingEl, width]);
|
|
105
|
+
// while there is no hidden sizing element, hide the list element
|
|
106
|
+
var style = hiddenSizingEl
|
|
107
|
+
? {}
|
|
108
|
+
: {
|
|
109
|
+
visibility: 'hidden',
|
|
110
|
+
};
|
|
111
|
+
return {
|
|
112
|
+
innerRef: innerRef,
|
|
113
|
+
itemSize: itemSize,
|
|
114
|
+
itemCount: items.length,
|
|
115
|
+
key: key,
|
|
116
|
+
style: style,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
exports.default = useCellMeasurer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
/** @jsx jsx */
|
|
8
|
+
var react_1 = require("@emotion/react");
|
|
9
|
+
var material_1 = require("@mui/material");
|
|
10
|
+
var react_error_boundary_1 = require("react-error-boundary");
|
|
11
|
+
function ErrorFallback(_a) {
|
|
12
|
+
var resetErrorBoundary = _a.resetErrorBoundary;
|
|
13
|
+
return ((0, react_1.jsx)(material_1.Alert, { css: (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n "], ["\n width: 100%;\n "]))), severity: "error", action: (0, react_1.jsx)(material_1.Button, { color: "inherit", size: "small", onClick: resetErrorBoundary }, "Reload") }, "Something went wrong when trying to load this view's data. Please try to reload the data again."));
|
|
14
|
+
}
|
|
15
|
+
function ErrorBoundary(_a) {
|
|
16
|
+
var children = _a.children, onReset = _a.onReset;
|
|
17
|
+
return ((0, react_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: ErrorFallback, onReset: onReset }, children));
|
|
18
|
+
}
|
|
19
|
+
exports.default = ErrorBoundary;
|
|
20
|
+
var templateObject_1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ErrorBoundary';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var ErrorBoundary_1 = require("./ErrorBoundary");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ErrorBoundary_1).default; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IItemRendererProps } from '@blueprintjs/select';
|
|
3
|
+
import { UniqueKey, InputValueRender } from 'types/Component.types';
|
|
4
|
+
export declare function getFilter<T>(inputValueRenderer: InputValueRender<T>): (query: string, item: T, index?: number | undefined, exactMatch?: boolean | undefined) => boolean;
|
|
5
|
+
export declare function getItemRenderer<T>(uniqueKey: UniqueKey<T>, inputValueRenderer: InputValueRender<T>, isItemSelected?: (item: T) => boolean): (item: T, { handleClick, modifiers, query }: IItemRendererProps) => JSX.Element | null;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var react_1 = __importDefault(require("react"));
|
|
7
|
+
var core_1 = require("@blueprintjs/core");
|
|
8
|
+
function escapeRegExpChars(text) {
|
|
9
|
+
return text.replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1');
|
|
10
|
+
}
|
|
11
|
+
function highlightText(text, query) {
|
|
12
|
+
var lastIndex = 0;
|
|
13
|
+
var words = query
|
|
14
|
+
.split(/\s+/)
|
|
15
|
+
.filter(function (word) { return word.length > 0; })
|
|
16
|
+
.map(escapeRegExpChars);
|
|
17
|
+
if (words.length === 0) {
|
|
18
|
+
return [text];
|
|
19
|
+
}
|
|
20
|
+
var regexp = new RegExp(words.join('|'), 'gi');
|
|
21
|
+
var tokens = [];
|
|
22
|
+
while (true) {
|
|
23
|
+
var match = regexp.exec(text);
|
|
24
|
+
if (!match) {
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
var length_1 = match[0].length;
|
|
28
|
+
var before = text.slice(lastIndex, regexp.lastIndex - length_1);
|
|
29
|
+
if (before.length > 0) {
|
|
30
|
+
tokens.push(before);
|
|
31
|
+
}
|
|
32
|
+
lastIndex = regexp.lastIndex;
|
|
33
|
+
tokens.push(react_1.default.createElement("strong", { key: lastIndex }, match[0]));
|
|
34
|
+
}
|
|
35
|
+
var rest = text.slice(lastIndex);
|
|
36
|
+
if (rest.length > 0) {
|
|
37
|
+
tokens.push(rest);
|
|
38
|
+
}
|
|
39
|
+
return tokens;
|
|
40
|
+
}
|
|
41
|
+
function getFilter(inputValueRenderer) {
|
|
42
|
+
return function filterItems(query, item, index, exactMatch) {
|
|
43
|
+
return exactMatch
|
|
44
|
+
? inputValueRenderer(item).toLowerCase() === query.toLowerCase()
|
|
45
|
+
: inputValueRenderer(item).toLowerCase().includes(query.toLowerCase());
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
exports.getFilter = getFilter;
|
|
49
|
+
function getItemRenderer(uniqueKey, inputValueRenderer, isItemSelected) {
|
|
50
|
+
return function renderItem(item, _a) {
|
|
51
|
+
var handleClick = _a.handleClick, modifiers = _a.modifiers, query = _a.query;
|
|
52
|
+
if (!modifiers.matchesPredicate) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
var text = inputValueRenderer(item);
|
|
56
|
+
var key = null;
|
|
57
|
+
if (typeof uniqueKey === 'string') {
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
key = item[uniqueKey];
|
|
60
|
+
}
|
|
61
|
+
else if (typeof uniqueKey === 'function') {
|
|
62
|
+
key = uniqueKey(item);
|
|
63
|
+
}
|
|
64
|
+
return (react_1.default.createElement(core_1.MenuItem, { active: modifiers.active, icon: isItemSelected && isItemSelected(item) ? 'tick' : 'blank', disabled: modifiers.disabled, label: undefined, key: key, onClick: handleClick, text: highlightText(text, query) }));
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
exports.getItemRenderer = getItemRenderer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendorflow/components",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.76",
|
|
4
4
|
"description": "React components for vendorflow",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@types/react-table": "^7.7.6",
|
|
63
63
|
"@typescript-eslint/eslint-plugin": "^4.32.0",
|
|
64
64
|
"@typescript-eslint/parser": "^4.32.0",
|
|
65
|
-
"@vendorflow/common": "^1.0.
|
|
65
|
+
"@vendorflow/common": "^1.0.44",
|
|
66
66
|
"babel-eslint": "10.1.0",
|
|
67
67
|
"babel-jest": "^24.9.0",
|
|
68
68
|
"babel-loader": "^8.2.2",
|
|
@@ -115,9 +115,11 @@
|
|
|
115
115
|
"react-h5-audio-player": "^3.8.1",
|
|
116
116
|
"react-measure": "^2.5.2",
|
|
117
117
|
"react-scripts": "^4.0.3",
|
|
118
|
+
"react-scrollbar-size": "^4.0.0",
|
|
118
119
|
"react-table": "^7.7.0",
|
|
119
120
|
"react-text-mask": "^5.4.3",
|
|
120
121
|
"react-textarea-autosize": "^8.3.3",
|
|
122
|
+
"react-virtualized": "^9.22.3",
|
|
121
123
|
"resolve": "1.15.0",
|
|
122
124
|
"resolve-url-loader": "3.1.1",
|
|
123
125
|
"sass-loader": "8.0.2",
|
|
@@ -145,6 +147,7 @@
|
|
|
145
147
|
"@types/lodash": "^4.14.150",
|
|
146
148
|
"@types/react-measure": "^2.0.7",
|
|
147
149
|
"@types/react-text-mask": "^5.4.6",
|
|
150
|
+
"@types/react-virtualized": "^9.21.21",
|
|
148
151
|
"eslint-config-prettier": "^8.3.0",
|
|
149
152
|
"eslint-plugin-prettier": "^3.4.0",
|
|
150
153
|
"eslint-webpack-plugin": "^2.5.4",
|