@vendorflow/components 2.1.0 → 3.0.4

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.
Files changed (139) hide show
  1. package/lib/components/index.d.ts +1 -1
  2. package/lib/components/material-ui/DataTable/Data.d.ts +1 -1
  3. package/lib/components/material-ui/DataTable/DataTable.d.ts +9 -76
  4. package/lib/components/material-ui/DataTable/FilterTool/Filters/MultiSelectFilter.d.ts +1 -1
  5. package/lib/components/material-ui/DataTable/FilterTool/Filters/RangeFilter.d.ts +1 -1
  6. package/lib/components/material-ui/DataTable/FilterTool/Filters/SingleSelectFilter.d.ts +1 -1
  7. package/lib/components/material-ui/DataTable/FilterTool/Filters/TextFilter.d.ts +1 -1
  8. package/lib/components/material-ui/DataTable/FilterTool/index.d.ts +2 -2
  9. package/lib/components/material-ui/DataTable/TablePieces/BodyRow.d.ts +1 -1
  10. package/lib/components/material-ui/DataTable/TablePieces/HeaderCell.d.ts +1 -1
  11. package/lib/components/material-ui/DataTable/TablePieces/Toolbar.d.ts +1 -1
  12. package/lib/components/material-ui/DataTable/index.d.ts +1 -1
  13. package/lib/index.js +3 -14
  14. package/lib/index.js.LICENSE.txt +35 -0
  15. package/lib/index.js.map +1 -0
  16. package/lib/types/DataTable.types.d.ts +69 -0
  17. package/lib/types/index.d.ts +1 -0
  18. package/package.json +20 -99
  19. package/lib/TempHooks.d.ts +0 -9
  20. package/lib/TempHooks.js +0 -25
  21. package/lib/components/InfiniteScroll/InfiniteScroll.d.ts +0 -16
  22. package/lib/components/InfiniteScroll/InfiniteScroll.js +0 -159
  23. package/lib/components/InfiniteScroll/index.d.ts +0 -1
  24. package/lib/components/InfiniteScroll/index.js +0 -8
  25. package/lib/components/blueprint/InputGroup/InputGroup.d.ts +0 -20
  26. package/lib/components/blueprint/InputGroup/InputGroup.js +0 -13
  27. package/lib/components/blueprint/InputGroup/InputGroup.story.d.ts +0 -2
  28. package/lib/components/blueprint/InputGroup/InputGroup.story.js +0 -11
  29. package/lib/components/blueprint/InputGroup/index.d.ts +0 -1
  30. package/lib/components/blueprint/InputGroup/index.js +0 -4
  31. package/lib/components/blueprint/InputSelect/InputSelect.d.ts +0 -51
  32. package/lib/components/blueprint/InputSelect/InputSelect.js +0 -98
  33. package/lib/components/blueprint/InputSelect/InputSelect.story.d.ts +0 -3
  34. package/lib/components/blueprint/InputSelect/InputSelect.story.js +0 -19
  35. package/lib/components/blueprint/InputSelect/index.d.ts +0 -1
  36. package/lib/components/blueprint/InputSelect/index.js +0 -4
  37. package/lib/components/blueprint/InputTime/InputTime.d.ts +0 -24
  38. package/lib/components/blueprint/InputTime/InputTime.js +0 -28
  39. package/lib/components/blueprint/InputTime/InputTime.story.d.ts +0 -2
  40. package/lib/components/blueprint/InputTime/InputTime.story.js +0 -11
  41. package/lib/components/blueprint/InputTime/index.d.ts +0 -1
  42. package/lib/components/blueprint/InputTime/index.js +0 -4
  43. package/lib/components/index.js +0 -32
  44. package/lib/components/material-ui/AudioPlayer/AudioPlayer.js +0 -111
  45. package/lib/components/material-ui/AudioPlayer/AudioPlayer.story.js +0 -9
  46. package/lib/components/material-ui/AudioPlayer/index.js +0 -8
  47. package/lib/components/material-ui/Button/Button.js +0 -38
  48. package/lib/components/material-ui/Button/Button.story.js +0 -9
  49. package/lib/components/material-ui/Button/index.js +0 -8
  50. package/lib/components/material-ui/ButtonMenu/ButtonMenu.js +0 -115
  51. package/lib/components/material-ui/ButtonMenu/ButtonMenu.story.js +0 -79
  52. package/lib/components/material-ui/ButtonMenu/index.js +0 -8
  53. package/lib/components/material-ui/ChatInterface/ActionsMenu.d.ts +0 -4
  54. package/lib/components/material-ui/ChatInterface/ActionsMenu.js +0 -37
  55. package/lib/components/material-ui/ChatInterface/ChatInterface.d.ts +0 -33
  56. package/lib/components/material-ui/ChatInterface/ChatInterface.js +0 -109
  57. package/lib/components/material-ui/ChatInterface/ChatInterface.story.d.ts +0 -1
  58. package/lib/components/material-ui/ChatInterface/ChatInterface.story.js +0 -134
  59. package/lib/components/material-ui/ChatInterface/MessageInput.d.ts +0 -9
  60. package/lib/components/material-ui/ChatInterface/MessageInput.js +0 -53
  61. package/lib/components/material-ui/ChatInterface/MessageItem.d.ts +0 -8
  62. package/lib/components/material-ui/ChatInterface/MessageItem.js +0 -71
  63. package/lib/components/material-ui/ChatInterface/MessageThread.d.ts +0 -6
  64. package/lib/components/material-ui/ChatInterface/MessageThread.js +0 -119
  65. package/lib/components/material-ui/ChatInterface/index.d.ts +0 -1
  66. package/lib/components/material-ui/ChatInterface/index.js +0 -8
  67. package/lib/components/material-ui/ColorPicker/ColorPicker.js +0 -86
  68. package/lib/components/material-ui/ColorPicker/ColorPicker.story.js +0 -47
  69. package/lib/components/material-ui/ColorPicker/index.js +0 -8
  70. package/lib/components/material-ui/ColorPicker/styles.js +0 -24
  71. package/lib/components/material-ui/DataTable/AppliedFilters.d.ts +0 -12
  72. package/lib/components/material-ui/DataTable/AppliedFilters.js +0 -26
  73. package/lib/components/material-ui/DataTable/Data.js +0 -42
  74. package/lib/components/material-ui/DataTable/DataTable.js +0 -363
  75. package/lib/components/material-ui/DataTable/DataTable.story.js +0 -76
  76. package/lib/components/material-ui/DataTable/FilterTool/Filters/MultiSelectFilter.js +0 -63
  77. package/lib/components/material-ui/DataTable/FilterTool/Filters/RangeFilter.js +0 -76
  78. package/lib/components/material-ui/DataTable/FilterTool/Filters/SingleSelectFilter.js +0 -69
  79. package/lib/components/material-ui/DataTable/FilterTool/Filters/TextFilter.js +0 -52
  80. package/lib/components/material-ui/DataTable/FilterTool/index.js +0 -78
  81. package/lib/components/material-ui/DataTable/GlobalSearchFilter.d.ts +0 -10
  82. package/lib/components/material-ui/DataTable/GlobalSearchFilter.js +0 -49
  83. package/lib/components/material-ui/DataTable/IndeterminateCheckbox.d.ts +0 -4
  84. package/lib/components/material-ui/DataTable/IndeterminateCheckbox.js +0 -65
  85. package/lib/components/material-ui/DataTable/SortIndicator.d.ts +0 -10
  86. package/lib/components/material-ui/DataTable/SortIndicator.js +0 -33
  87. package/lib/components/material-ui/DataTable/TablePieces/AppliedFilters.js +0 -26
  88. package/lib/components/material-ui/DataTable/TablePieces/BodyCell.js +0 -50
  89. package/lib/components/material-ui/DataTable/TablePieces/BodyRow.js +0 -88
  90. package/lib/components/material-ui/DataTable/TablePieces/GlobalSearchFilter.js +0 -49
  91. package/lib/components/material-ui/DataTable/TablePieces/HeaderCell.js +0 -57
  92. package/lib/components/material-ui/DataTable/TablePieces/IndeterminateCheckbox.js +0 -65
  93. package/lib/components/material-ui/DataTable/TablePieces/SortIndicator.js +0 -33
  94. package/lib/components/material-ui/DataTable/TablePieces/Table.js +0 -47
  95. package/lib/components/material-ui/DataTable/TablePieces/TableBodyContent.js +0 -89
  96. package/lib/components/material-ui/DataTable/TablePieces/Toolbar.js +0 -59
  97. package/lib/components/material-ui/DataTable/TablePieces/ViewColumnTool.js +0 -77
  98. package/lib/components/material-ui/DataTable/Toolbar.d.ts +0 -24
  99. package/lib/components/material-ui/DataTable/Toolbar.js +0 -63
  100. package/lib/components/material-ui/DataTable/Utils.d.ts +0 -25
  101. package/lib/components/material-ui/DataTable/Utils.js +0 -119
  102. package/lib/components/material-ui/DataTable/ViewColumnTool.d.ts +0 -11
  103. package/lib/components/material-ui/DataTable/ViewColumnTool.js +0 -76
  104. package/lib/components/material-ui/DataTable/index.js +0 -8
  105. package/lib/components/material-ui/ErrorBoundary/ErrorBoundary.d.ts +0 -7
  106. package/lib/components/material-ui/ErrorBoundary/ErrorBoundary.js +0 -20
  107. package/lib/components/material-ui/ErrorBoundary/index.d.ts +0 -1
  108. package/lib/components/material-ui/ErrorBoundary/index.js +0 -8
  109. package/lib/components/material-ui/InputCheckboxGroup/InputCheckboxGroup.js +0 -99
  110. package/lib/components/material-ui/InputCheckboxGroup/InputCheckboxGroup.story.js +0 -52
  111. package/lib/components/material-ui/InputCheckboxGroup/index.js +0 -8
  112. package/lib/components/material-ui/InputDate/InputDate.js +0 -93
  113. package/lib/components/material-ui/InputDate/InputDate.story.js +0 -53
  114. package/lib/components/material-ui/InputDate/index.js +0 -8
  115. package/lib/components/material-ui/InputDateTime/InputDateTime.js +0 -82
  116. package/lib/components/material-ui/InputDateTime/InputDateTime.story.js +0 -53
  117. package/lib/components/material-ui/InputDateTime/index.js +0 -8
  118. package/lib/components/material-ui/InputGroup/InputGroup.js +0 -91
  119. package/lib/components/material-ui/InputGroup/InputGroup.story.js +0 -50
  120. package/lib/components/material-ui/InputGroup/index.js +0 -8
  121. package/lib/components/material-ui/InputRadioGroup/InputRadioGroup.js +0 -82
  122. package/lib/components/material-ui/InputRadioGroup/InputRadioGroup.story.js +0 -52
  123. package/lib/components/material-ui/InputRadioGroup/index.js +0 -8
  124. package/lib/components/material-ui/InputSearchDropdown/InputSearchDropdown.js +0 -146
  125. package/lib/components/material-ui/InputSearchDropdown/InputSearchDropdown.story.js +0 -66
  126. package/lib/components/material-ui/InputSearchDropdown/index.js +0 -8
  127. package/lib/components/material-ui/InputTime/InputTime.js +0 -82
  128. package/lib/components/material-ui/InputTime/InputTime.story.js +0 -53
  129. package/lib/components/material-ui/InputTime/index.js +0 -8
  130. package/lib/components/material-ui/Modal/Modal.js +0 -57
  131. package/lib/components/material-ui/Modal/Modal.story.js +0 -83
  132. package/lib/components/material-ui/Modal/index.js +0 -8
  133. package/lib/services/Select.service.d.ts +0 -5
  134. package/lib/services/Select.service.js +0 -67
  135. package/lib/stories/0-Inputs.stories.d.ts +0 -17
  136. package/lib/stories/0-Inputs.stories.js +0 -38
  137. package/lib/types/Component.types.js +0 -2
  138. package/lib/types/Internal.types.js +0 -2
  139. package/lib/types/index.js +0 -13
@@ -1,86 +0,0 @@
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 __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
- var __read = (this && this.__read) || function (o, n) {
25
- var m = typeof Symbol === "function" && o[Symbol.iterator];
26
- if (!m) return o;
27
- var i = m.call(o), r, ar = [], e;
28
- try {
29
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
30
- }
31
- catch (error) { e = { error: error }; }
32
- finally {
33
- try {
34
- if (r && !r.done && (m = i["return"])) m.call(i);
35
- }
36
- finally { if (e) throw e.error; }
37
- }
38
- return ar;
39
- };
40
- var __importDefault = (this && this.__importDefault) || function (mod) {
41
- return (mod && mod.__esModule) ? mod : { "default": mod };
42
- };
43
- Object.defineProperty(exports, "__esModule", { value: true });
44
- /** @jsxRuntime classic */
45
- /** @jsx jsx */
46
- var react_1 = require("@emotion/react");
47
- var lodash_1 = require("lodash");
48
- var react_2 = require("react");
49
- var react_color_palette_1 = require("react-color-palette");
50
- var material_1 = require("@mui/material");
51
- var styles_1 = require("./styles");
52
- var InputGroup_1 = __importDefault(require("../InputGroup/InputGroup"));
53
- function ColorPicker(_a) {
54
- var name = _a.name, value = _a.value, onChange = _a.onChange, restOfProps = __rest(_a, ["name", "value", "onChange"]);
55
- var _b = __read((0, react_2.useState)(null), 2), anchorEl = _b[0], setAnchorEl = _b[1];
56
- var _c = __read((0, react_color_palette_1.useColor)('hex', value || '#000'), 2), color = _c[0], setColor = _c[1];
57
- var id = (0, react_2.useMemo)(function () { return "color-picker-popover-" + (0, lodash_1.random)(0, 9999999); }, []);
58
- var open = !!anchorEl;
59
- (0, react_2.useEffect)(function () {
60
- if (value && value != color.hex) {
61
- setColor((0, react_color_palette_1.toColor)('hex', value));
62
- }
63
- }, [value, setColor]);
64
- var debouncedOnChange = (0, react_2.useCallback)((0, lodash_1.debounce)(function (value) {
65
- if (onChange) {
66
- // @ts-ignore
67
- onChange({ target: { name: name, value: value } });
68
- }
69
- }, 300), [onChange, name]);
70
- function handleColorChange(color) {
71
- setColor(color);
72
- debouncedOnChange(color.hex);
73
- }
74
- return ((0, react_1.jsx)(react_2.Fragment, null,
75
- (0, react_1.jsx)(InputGroup_1.default, __assign({}, restOfProps, { "area-describedby": id, onClick: function (evt) {
76
- setAnchorEl(evt.currentTarget);
77
- }, onFocus: function (evt) {
78
- setAnchorEl(evt.currentTarget);
79
- }, value: color.hex, onChange: onChange })),
80
- (0, react_1.jsx)(material_1.Popover, { id: id, open: open, anchorEl: anchorEl, anchorOrigin: { vertical: 'bottom', horizontal: 'left' }, disableAutoFocus: true, disableEnforceFocus: true, onClose: function () { return setAnchorEl(null); } },
81
- (0, react_1.jsx)("div", { css: styles_1.colorPaletteStyles },
82
- (0, react_1.jsx)(react_color_palette_1.ColorPicker, { width: 280, height: 200, color: color,
83
- // @ts-ignore
84
- onChange: handleColorChange, hideHSV: true, hideRGB: true, alpha: false })))));
85
- }
86
- exports.default = ColorPicker;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __read = (this && this.__read) || function (o, n) {
22
- var m = typeof Symbol === "function" && o[Symbol.iterator];
23
- if (!m) return o;
24
- var i = m.call(o), r, ar = [], e;
25
- try {
26
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
27
- }
28
- catch (error) { e = { error: error }; }
29
- finally {
30
- try {
31
- if (r && !r.done && (m = i["return"])) m.call(i);
32
- }
33
- finally { if (e) throw e.error; }
34
- }
35
- return ar;
36
- };
37
- var __importDefault = (this && this.__importDefault) || function (mod) {
38
- return (mod && mod.__esModule) ? mod : { "default": mod };
39
- };
40
- Object.defineProperty(exports, "__esModule", { value: true });
41
- var react_1 = __importStar(require("react"));
42
- var ColorPicker_1 = __importDefault(require("./ColorPicker"));
43
- function ColorPicker() {
44
- var _a = __read((0, react_1.useState)(null), 2), value = _a[0], setValue = _a[1];
45
- return react_1.default.createElement(ColorPicker_1.default, { label: "Color Picker", value: value, onChange: function (evt) { return setValue(evt.target.value); } });
46
- }
47
- exports.default = ColorPicker;
@@ -1,8 +0,0 @@
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 ColorPicker_1 = require("./ColorPicker");
8
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ColorPicker_1).default; } });
@@ -1,24 +0,0 @@
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
- exports.colorPaletteStyles = void 0;
8
- var react_1 = require("@emotion/react");
9
- var Colors = {
10
- light: {
11
- background: '#ffffff',
12
- inputText: '#111111',
13
- inputBorder: 'rgba(0, 0, 0, 0.1)',
14
- inputLabel: '#717171',
15
- },
16
- dark: {
17
- background: '#181818',
18
- inputText: '#f3f3f3',
19
- inputBorder: 'rgba(255, 255, 255, 0.1)',
20
- inputLabel: '#999999',
21
- },
22
- };
23
- exports.colorPaletteStyles = (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .rcp {\n display: flex;\n flex-direction: column;\n align-items: center;\n border-radius: 10px;\n box-sizing: border-box;\n }\n\n .rcp.rcp-light {\n background-color: ", ";\n }\n\n .rcp.rcp-dark {\n background-color: ", ";\n }\n\n .rcp-body {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 20px;\n width: 100%;\n padding: 20px;\n }\n\n .rcp-saturation {\n position: relative;\n width: 100%;\n background-image: linear-gradient(transparent, black), linear-gradient(to right, white, transparent);\n border-radius: 10px 10px 0 0;\n user-select: none;\n }\n\n .rcp-saturation-cursor {\n position: absolute;\n width: 20px;\n height: 20px;\n border: 2px solid #ffffff;\n border-radius: 50%;\n box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.15);\n box-sizing: border-box;\n transform: translate(-10px, -10px);\n }\n\n .rcp-hue {\n position: relative;\n width: 100%;\n height: 12px;\n background-image: linear-gradient(\n to right,\n rgb(255, 0, 0),\n rgb(255, 255, 0),\n rgb(0, 255, 0),\n rgb(0, 255, 255),\n rgb(0, 0, 255),\n rgb(255, 0, 255),\n rgb(255, 0, 0)\n );\n border-radius: 10px;\n user-select: none;\n }\n\n .rcp-hue-cursor {\n position: absolute;\n width: 20px;\n height: 20px;\n border: 2px solid #ffffff;\n border-radius: 50%;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px 0.5px;\n box-sizing: border-box;\n transform: translate(-10px, -4px);\n }\n\n .rcp-alpha {\n position: relative;\n width: 100%;\n height: 12px;\n border-radius: 10px;\n user-select: none;\n }\n\n .rcp-alpha-cursor {\n position: absolute;\n width: 20px;\n height: 20px;\n border: 2px solid #ffffff;\n border-radius: 50%;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px 0.5px;\n box-sizing: border-box;\n transform: translate(-10px, -4px);\n }\n\n .rcp-fields {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));\n gap: 10px;\n width: 100%;\n }\n\n .rcp-fields-element {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 5px;\n width: 100%;\n }\n\n .hex-element {\n grid-row: 1;\n }\n\n .hex-element:nth-of-type(3n) {\n grid-column: 1 / -1;\n }\n\n .rcp-fields-element-input {\n width: 100%;\n font-size: 14px;\n font-weight: 600;\n text-align: center;\n background: none;\n border: 2px solid;\n border-radius: 5px;\n box-sizing: border-box;\n outline: none;\n padding: 10px;\n }\n\n .rcp-light .rcp-fields-element-input {\n color: ", ";\n border-color: ", ";\n }\n\n .rcp-dark .rcp-fields-element-input {\n color: ", ";\n border-color: ", ";\n }\n\n .rcp-fields-element-label {\n font-size: 14px;\n font-weight: 600;\n text-transform: uppercase;\n }\n\n .rcp-light .rcp-fields-element-label {\n color: ", ";\n }\n\n .rcp-dark .rcp-fields-element-label {\n color: ", ";\n }\n"], ["\n .rcp {\n display: flex;\n flex-direction: column;\n align-items: center;\n border-radius: 10px;\n box-sizing: border-box;\n }\n\n .rcp.rcp-light {\n background-color: ", ";\n }\n\n .rcp.rcp-dark {\n background-color: ", ";\n }\n\n .rcp-body {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 20px;\n width: 100%;\n padding: 20px;\n }\n\n .rcp-saturation {\n position: relative;\n width: 100%;\n background-image: linear-gradient(transparent, black), linear-gradient(to right, white, transparent);\n border-radius: 10px 10px 0 0;\n user-select: none;\n }\n\n .rcp-saturation-cursor {\n position: absolute;\n width: 20px;\n height: 20px;\n border: 2px solid #ffffff;\n border-radius: 50%;\n box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.15);\n box-sizing: border-box;\n transform: translate(-10px, -10px);\n }\n\n .rcp-hue {\n position: relative;\n width: 100%;\n height: 12px;\n background-image: linear-gradient(\n to right,\n rgb(255, 0, 0),\n rgb(255, 255, 0),\n rgb(0, 255, 0),\n rgb(0, 255, 255),\n rgb(0, 0, 255),\n rgb(255, 0, 255),\n rgb(255, 0, 0)\n );\n border-radius: 10px;\n user-select: none;\n }\n\n .rcp-hue-cursor {\n position: absolute;\n width: 20px;\n height: 20px;\n border: 2px solid #ffffff;\n border-radius: 50%;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px 0.5px;\n box-sizing: border-box;\n transform: translate(-10px, -4px);\n }\n\n .rcp-alpha {\n position: relative;\n width: 100%;\n height: 12px;\n border-radius: 10px;\n user-select: none;\n }\n\n .rcp-alpha-cursor {\n position: absolute;\n width: 20px;\n height: 20px;\n border: 2px solid #ffffff;\n border-radius: 50%;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px 0.5px;\n box-sizing: border-box;\n transform: translate(-10px, -4px);\n }\n\n .rcp-fields {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));\n gap: 10px;\n width: 100%;\n }\n\n .rcp-fields-element {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 5px;\n width: 100%;\n }\n\n .hex-element {\n grid-row: 1;\n }\n\n .hex-element:nth-of-type(3n) {\n grid-column: 1 / -1;\n }\n\n .rcp-fields-element-input {\n width: 100%;\n font-size: 14px;\n font-weight: 600;\n text-align: center;\n background: none;\n border: 2px solid;\n border-radius: 5px;\n box-sizing: border-box;\n outline: none;\n padding: 10px;\n }\n\n .rcp-light .rcp-fields-element-input {\n color: ", ";\n border-color: ", ";\n }\n\n .rcp-dark .rcp-fields-element-input {\n color: ", ";\n border-color: ", ";\n }\n\n .rcp-fields-element-label {\n font-size: 14px;\n font-weight: 600;\n text-transform: uppercase;\n }\n\n .rcp-light .rcp-fields-element-label {\n color: ", ";\n }\n\n .rcp-dark .rcp-fields-element-label {\n color: ", ";\n }\n"])), Colors.light.background, Colors.dark.background, Colors.light.inputText, Colors.light.inputBorder, Colors.dark.inputText, Colors.dark.inputBorder, Colors.light.inputLabel, Colors.dark.inputLabel);
24
- var templateObject_1;
@@ -1,12 +0,0 @@
1
- /** @jsxRuntime classic */
2
- /** @jsx jsx */
3
- import { jsx } from '@emotion/react';
4
- import { Filters, UseFiltersInstanceProps } from 'react-table';
5
- import { SimpleMap } from '../../../types/Internal.types';
6
- interface Props<D extends object> {
7
- columnNameById: SimpleMap<string>;
8
- filters: Filters<D>;
9
- setFilter: UseFiltersInstanceProps<D>['setFilter'];
10
- }
11
- export default function AppliedFilters<D extends object>({ columnNameById, filters, setFilter }: Props<D>): jsx.JSX.Element | null;
12
- export {};
@@ -1,26 +0,0 @@
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
- /** @jsxRuntime classic */
8
- /** @jsx jsx */
9
- var react_1 = require("@emotion/react");
10
- var material_1 = require("@mui/material");
11
- var SingleSelectFilter_1 = require("./FilterTool/Filters/SingleSelectFilter");
12
- var PADDING = 24;
13
- function AppliedFilters(_a) {
14
- var columnNameById = _a.columnNameById, filters = _a.filters, setFilter = _a.setFilter;
15
- if (!filters.length) {
16
- return null;
17
- }
18
- return ((0, react_1.jsx)(material_1.Stack, { direction: "row", overflow: "none", css: (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: calc(100% - ", "px);\n padding: 8px ", "px;\n flex-wrap: wrap;\n gap: 0.25rem 0.25rem;\n "], ["\n width: calc(100% - ", "px);\n padding: 8px ", "px;\n flex-wrap: wrap;\n gap: 0.25rem 0.25rem;\n "])), PADDING * 2, PADDING) }, filters
19
- .filter(function (filter) {
20
- return (Array.isArray(filter.value) && !!filter.value.length) ||
21
- (!Array.isArray(filter.value) && filter.value != null);
22
- })
23
- .map(function (filter) { return ((0, react_1.jsx)(material_1.Chip, { key: filter.id, label: columnNameById[filter.id] + ": " + (filter.value === '' ? SingleSelectFilter_1.BLANK_VALUE_LABEL : filter.value), onDelete: function () { return setFilter(filter.id, null); } })); })));
24
- }
25
- exports.default = AppliedFilters;
26
- var templateObject_1;
@@ -1,42 +0,0 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Data = exports.Columns = void 0;
18
- var faker_1 = __importDefault(require("faker"));
19
- var DataTable_1 = require("./DataTable");
20
- exports.Columns = [
21
- {
22
- id: 'fullName',
23
- Header: 'Full Name',
24
- columns: [
25
- __assign({ Header: 'First Name', accessor: 'firstName' }, (0, DataTable_1.getColumnFilterConfig)('text')),
26
- __assign({ Header: 'Last Name', accessor: 'lastName', filterName: 'Custom LN' }, (0, DataTable_1.getColumnFilterConfig)('multi-select')),
27
- ],
28
- },
29
- __assign(__assign({ Header: 'Age', accessor: 'age', sortType: 'number', disableFilters: false }, (0, DataTable_1.getColumnFilterConfig)('range')), { width: 100 }),
30
- __assign({ Header: 'Occupation', accessor: 'occupation', disableFilters: false }, (0, DataTable_1.getColumnFilterConfig)('select')),
31
- __assign({ Header: 'Company', id: 'company', accessor: function (originalRow) { return originalRow.company.name; }, disableFilters: false }, (0, DataTable_1.getColumnFilterConfig)('select')),
32
- ];
33
- exports.Data = new Array(20).fill(null).map(function () { return ({
34
- id: faker_1.default.datatype.uuid(),
35
- firstName: faker_1.default.name.firstName(),
36
- lastName: faker_1.default.name.lastName(),
37
- age: faker_1.default.datatype.number(60),
38
- occupation: faker_1.default.name.jobTitle(),
39
- company: {
40
- name: faker_1.default.company.companyName(),
41
- },
42
- }); });
@@ -1,363 +0,0 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
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 __rest = (this && this.__rest) || function (s, e) {
37
- var t = {};
38
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
39
- t[p] = s[p];
40
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
41
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
42
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
43
- t[p[i]] = s[p[i]];
44
- }
45
- return t;
46
- };
47
- var __read = (this && this.__read) || function (o, n) {
48
- var m = typeof Symbol === "function" && o[Symbol.iterator];
49
- if (!m) return o;
50
- var i = m.call(o), r, ar = [], e;
51
- try {
52
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
53
- }
54
- catch (error) { e = { error: error }; }
55
- finally {
56
- try {
57
- if (r && !r.done && (m = i["return"])) m.call(i);
58
- }
59
- finally { if (e) throw e.error; }
60
- }
61
- return ar;
62
- };
63
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
64
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
65
- if (ar || !(i in from)) {
66
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
67
- ar[i] = from[i];
68
- }
69
- }
70
- return to.concat(ar || Array.prototype.slice.call(from));
71
- };
72
- var __importDefault = (this && this.__importDefault) || function (mod) {
73
- return (mod && mod.__esModule) ? mod : { "default": mod };
74
- };
75
- Object.defineProperty(exports, "__esModule", { value: true });
76
- exports.getColumnFilterConfig = exports.renderSingleLineCell = exports.useDefaultTableInstance = exports.usePluginConfig = exports.CELL_PADDING = exports.ACTION_COLUMN_ID = void 0;
77
- /** @jsxRuntime classic */
78
- /** @jsx jsx */
79
- var react_1 = require("@emotion/react");
80
- var immer_1 = __importDefault(require("immer"));
81
- var material_1 = require("@mui/material");
82
- var icons_material_1 = require("@mui/icons-material");
83
- var react_table_1 = require("react-table");
84
- var IndeterminateCheckbox_1 = __importStar(require("./TablePieces/IndeterminateCheckbox"));
85
- var Toolbar_1 = __importDefault(require("./TablePieces/Toolbar"));
86
- var react_2 = require("react");
87
- var AppliedFilters_1 = __importDefault(require("./TablePieces/AppliedFilters"));
88
- var lodash_1 = require("lodash");
89
- var SingleSelectFilter_1 = __importDefault(require("./FilterTool/Filters/SingleSelectFilter"));
90
- var MultiSelectFilter_1 = __importDefault(require("./FilterTool/Filters/MultiSelectFilter"));
91
- var RangeFilter_1 = __importDefault(require("./FilterTool/Filters/RangeFilter"));
92
- var TextFilter_1 = __importDefault(require("./FilterTool/Filters/TextFilter"));
93
- var hooks_1 = require("@vendorflow/common/lib/hooks");
94
- var react_scrollbar_size_1 = __importDefault(require("react-scrollbar-size"));
95
- var Table_1 = __importDefault(require("./TablePieces/Table"));
96
- var HeaderCell_1 = __importDefault(require("./TablePieces/HeaderCell"));
97
- var TableBodyContent_1 = __importDefault(require("./TablePieces/TableBodyContent"));
98
- exports.ACTION_COLUMN_ID = 'action-column';
99
- exports.CELL_PADDING = 4;
100
- var EXPAND_BTN_WIDTH = 24;
101
- var NO_MATCH_TEXT = 'Sorry, no matching records found';
102
- function DataTable(_a) {
103
- var _b;
104
- var title = _a.title, labels = _a.labels, columns = _a.columns, instance = _a.instance, options = _a.options, renderActions = _a.renderActions, renderRowSelectActions = _a.renderRowSelectActions, ExpandedRow = _a.ExpandedRow, restOfProps = __rest(_a, ["title", "labels", "columns", "instance", "options", "renderActions", "renderRowSelectActions", "ExpandedRow"]);
105
- var tableHeadRef = (0, react_2.useRef)(null);
106
- var tableBodyRef = (0, react_2.useRef)(null);
107
- var scrollContainerRef = (0, react_2.useRef)(null);
108
- var _c = (0, hooks_1.useMeasure)(), tableBodyMeasureRefCallback = _c.ref, tableBodyContentRect = _c.contentRect;
109
- var _d = (0, hooks_1.useMeasure)(), rootRef = _d.ref, rootContentRect = _d.contentRect;
110
- var _e = (0, hooks_1.useMeasure)(), toolbarRef = _e.ref, toolbarContentRect = _e.contentRect;
111
- var _f = (0, hooks_1.useMeasure)(), paginationRef = _f.ref, paginationContentRect = _f.contentRect;
112
- var _g = (0, hooks_1.useHasScrollbar)(), hasScrollbarRefCallback = _g.ref, hasScrollbar = _g.hasScrollbar;
113
- var scrollbarWidth = (0, react_scrollbar_size_1.default)().width;
114
- var _h = __read((0, react_2.useState)(0), 2), scrollLeft = _h[0], setScrollLeft = _h[1];
115
- var _j = (labels || { noMatchLabel: NO_MATCH_TEXT }).noMatchLabel, noMatchLabel = _j === void 0 ? NO_MATCH_TEXT : _j;
116
- var _k = options || {}, rowExpandingConfig = _k.rowExpanding, filtersConfig = _k.filters, globalSearchConfig = _k.globalSearch, columnHidingConfig = _k.columnHiding, paginationConfig = _k.pagination, sortingConfig = _k.sorting, tableConfig = _k.table, virtualizeConfig = _k.virtualize;
117
- var ExpandedComponent = ExpandedRow || (rowExpandingConfig === null || rowExpandingConfig === void 0 ? void 0 : rowExpandingConfig.Component) || null;
118
- var allColumns = instance.allColumns, getTableProps = instance.getTableProps, gotoPage = instance.gotoPage, headerGroups = instance.headerGroups, page = instance.page, prepareRow = instance.prepareRow, rows = instance.rows, setAllFilters = instance.setAllFilters, setPageSize = instance.setPageSize, setFilter = instance.setFilter, setGlobalFilter = instance.setGlobalFilter, state = instance.state, totalColumnsWidth = instance.totalColumnsWidth;
119
- var pageOptions = ((_b = options === null || options === void 0 ? void 0 : options.pagination) === null || _b === void 0 ? void 0 : _b.rowsPerPageOptions) || instance.pageOptions;
120
- var columnNameById = (0, react_2.useMemo)(function () {
121
- var result = {};
122
- function addNamesToMap(cols, result) {
123
- cols.forEach(function (col, index) {
124
- var id = col.id != null ? col.id : typeof col.accessor === 'string' ? col.accessor : null;
125
- if (!id) {
126
- throw new Error("Please provide an id for column " + (typeof col.Header === 'string' && !!col.Header ? col.Header : col.name ? col.name : "at index " + index));
127
- }
128
- if (col.filterName) {
129
- result[id] = col.filterName;
130
- }
131
- else if (typeof col.Header === 'string') {
132
- result[id] = col.Header;
133
- }
134
- else if (!col.name) {
135
- throw new Error("Please provide a name for column with id = " + col.id + ".");
136
- }
137
- else {
138
- result[id] = col.name;
139
- }
140
- if (Array.isArray(col === null || col === void 0 ? void 0 : col.columns)) {
141
- addNamesToMap(col.columns, result);
142
- }
143
- });
144
- }
145
- addNamesToMap(columns, result);
146
- return result;
147
- }, [columns]);
148
- var _l = state, filters = _l.filters, globalFilter = _l.globalFilter, pageIndex = _l.pageIndex, pageSize = _l.pageSize, selectedRowIds = _l.selectedRowIds;
149
- var _m = (0, react_2.useMemo)(function () {
150
- var hasRowsSelected = lodash_1.values != null ? (0, lodash_1.values)(selectedRowIds).some(Boolean) : false;
151
- var numRowsSelected = lodash_1.values != null ? (0, lodash_1.values)(selectedRowIds).filter(Boolean).length : 0;
152
- return { hasRowsSelected: hasRowsSelected, numRowsSelected: numRowsSelected };
153
- }, [selectedRowIds]), hasRowsSelected = _m.hasRowsSelected, numRowsSelected = _m.numRowsSelected;
154
- var tableRows = (paginationConfig === null || paginationConfig === void 0 ? void 0 : paginationConfig.enabled) ? page : rows;
155
- var containerHeight = (rootContentRect.height || 0) - (toolbarContentRect.height || 0) - (paginationContentRect.height || 0);
156
- var defaultRowHeight = (virtualizeConfig === null || virtualizeConfig === void 0 ? void 0 : virtualizeConfig.defaultRowHeight) || 50;
157
- var getRowClassName = ((options === null || options === void 0 ? void 0 : options.table) || {}).getRowClassName;
158
- (0, react_2.useEffect)(function () {
159
- if (tableHeadRef.current) {
160
- tableHeadRef.current.scrollTo({ left: scrollLeft, behavior: 'auto' });
161
- }
162
- if (scrollContainerRef.current) {
163
- scrollContainerRef.current.scrollTo({ left: scrollLeft, behavior: 'auto' });
164
- }
165
- }, [scrollLeft]);
166
- return ((0, react_1.jsx)(material_1.Paper, __assign({ ref: rootRef, css: (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: calc(100% - ", "px);\n height: 100%;\n position: relative;\n "], ["\n width: calc(100% - ", "px);\n height: 100%;\n position: relative;\n "])), hasScrollbar.vertical ? scrollbarWidth : 0), className: "DataTable" }, restOfProps),
167
- !(tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.hideToolbar) && ((0, react_1.jsx)("div", { ref: toolbarRef, className: "DataTable__Toolbar" },
168
- (0, react_1.jsx)(Toolbar_1.default, { title: title, allColumns: allColumns, columnNameById: columnNameById, globalFilter: globalFilter, enableFilters: filtersConfig === null || filtersConfig === void 0 ? void 0 : filtersConfig.enabled, enableGlobalSearch: globalSearchConfig === null || globalSearchConfig === void 0 ? void 0 : globalSearchConfig.enabled, enableHideColumns: columnHidingConfig === null || columnHidingConfig === void 0 ? void 0 : columnHidingConfig.enabled, hasRowsSelected: hasRowsSelected, numRowsSelected: numRowsSelected, setAllFilters: setAllFilters, setGlobalFilter: (globalSearchConfig === null || globalSearchConfig === void 0 ? void 0 : globalSearchConfig.setGlobalFilter) ? globalSearchConfig === null || globalSearchConfig === void 0 ? void 0 : globalSearchConfig.setGlobalFilter : setGlobalFilter, renderActions: renderActions, renderRowSelectActions: renderRowSelectActions }),
169
- (filtersConfig === null || filtersConfig === void 0 ? void 0 : filtersConfig.enabled) && ((0, react_1.jsx)(AppliedFilters_1.default, { columnNameById: columnNameById, filters: filters, setFilter: setFilter })))),
170
- (0, react_1.jsx)("div", { className: "DataTable__TableContainer", css: (0, react_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: ", "px;\n "], ["\n height: ", "px;\n "])), containerHeight) },
171
- (0, react_1.jsx)(Table_1.default, { getTableProps: getTableProps, css: (0, react_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 100%;\n display: grid;\n grid-template-rows: auto 1fr;\n grid-template-columns: calc(100% + ", "px);\n "], ["\n width: 100%;\n display: grid;\n grid-template-rows: auto 1fr;\n grid-template-columns: calc(100% + ", "px);\n "])), hasScrollbar.vertical ? scrollbarWidth : 0) },
172
- (0, react_1.jsx)(material_1.TableHead, { ref: tableHeadRef, className: "DataTable__TableHead", component: "div", css: (0, react_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n && {\n display: block;\n height: auto;\n width: calc(100% - ", "px);\n overflow-x: auto;\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n\n &::-webkit-scrollbar {\n /* Hide scrollbar for Chrome, Safari and Opera */\n display: none;\n }\n }\n "], ["\n && {\n display: block;\n height: auto;\n width: calc(100% - ", "px);\n overflow-x: auto;\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n\n &::-webkit-scrollbar {\n /* Hide scrollbar for Chrome, Safari and Opera */\n display: none;\n }\n }\n "])), hasScrollbar.vertical ? scrollbarWidth : 0), onScroll: function (evt) {
173
- var scrollLeft = evt.target.scrollLeft;
174
- setScrollLeft(scrollLeft);
175
- } }, headerGroups.map(function (headerGroup) {
176
- return (
177
- // @ts-ignore
178
- // eslint-disable-next-line react/jsx-key
179
- (0, react_1.jsx)(material_1.TableRow, __assign({}, headerGroup.getHeaderGroupProps(), { component: "div" }), headerGroup.headers.map(function (header) {
180
- var _a = header.getHeaderProps((sortingConfig === null || sortingConfig === void 0 ? void 0 : sortingConfig.enabled) ? header.getSortByToggleProps() : undefined), key = _a.key, restOfHeaderProps = __rest(_a, ["key"]);
181
- return ((0, react_1.jsx)(HeaderCell_1.default, { key: key, header: header, headerProps: restOfHeaderProps, flexLayoutEnabled: (tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.flexLayoutEnabled) || false }));
182
- })));
183
- })),
184
- (0, react_1.jsx)(TableBodyContent_1.default, { defaultRowHeight: defaultRowHeight, ExpandedComponent: ExpandedComponent, flexLayoutEnabled: (tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.flexLayoutEnabled) || false, hasScrollbar: hasScrollbar, hasScrollbarRefCallback: hasScrollbarRefCallback, height: tableBodyContentRect.height, isVirtualizeEnabled: !!(virtualizeConfig === null || virtualizeConfig === void 0 ? void 0 : virtualizeConfig.enabled), noMatchLabel: noMatchLabel, prepareRow: prepareRow, scrollContainerRef: scrollContainerRef, scrollbarWidth: scrollbarWidth, setScrollLeft: setScrollLeft, tableBodyRef: tableBodyRef, tableBodyMeasureRefCallback: tableBodyMeasureRefCallback, tableRows: tableRows, totalColumnsWidth: totalColumnsWidth, width: tableBodyContentRect.width, getRowClassName: getRowClassName }))),
185
- (paginationConfig === null || paginationConfig === void 0 ? void 0 : paginationConfig.enabled) && ((0, react_1.jsx)(material_1.TablePagination, { ref: paginationRef, className: "DataTable__Pagination", component: "div", count: rows.length, page: pageIndex, onPageChange: function (evt, newPage) { return gotoPage(newPage); }, onRowsPerPageChange: function (evt) { return setPageSize(Number(evt.target.value)); }, rowsPerPage: pageSize, rowsPerPageOptions: pageOptions }))));
186
- }
187
- exports.default = DataTable;
188
- function usePluginConfig(options) {
189
- var filters = options.filters, globalSearch = options.globalSearch, pagination = options.pagination, rowExpanding = options.rowExpanding, sorting = options.sorting, rowSelect = options.rowSelect, columnHiding = options.columnHiding, columnResizing = options.columnResizing, virtualize = options.virtualize;
190
- var actionColumnCellWidth = (rowExpanding === null || rowExpanding === void 0 ? void 0 : rowExpanding.enabled) && (rowSelect === null || rowSelect === void 0 ? void 0 : rowSelect.enabled)
191
- ? exports.CELL_PADDING * 2 + EXPAND_BTN_WIDTH + IndeterminateCheckbox_1.CHECKBOX_WIDTH
192
- : Math.max(EXPAND_BTN_WIDTH, IndeterminateCheckbox_1.CHECKBOX_WIDTH) + exports.CELL_PADDING * 2;
193
- return (0, react_2.useMemo)(function () {
194
- var _a;
195
- var result = [];
196
- if ((_a = options.table) === null || _a === void 0 ? void 0 : _a.flexLayoutEnabled) {
197
- result.push(react_table_1.useFlexLayout);
198
- }
199
- else {
200
- result.push(react_table_1.useBlockLayout);
201
- }
202
- if (filters === null || filters === void 0 ? void 0 : filters.enabled) {
203
- result.push(react_table_1.useFilters);
204
- }
205
- if (globalSearch === null || globalSearch === void 0 ? void 0 : globalSearch.enabled) {
206
- result.push(react_table_1.useGlobalFilter);
207
- }
208
- if (sorting === null || sorting === void 0 ? void 0 : sorting.enabled) {
209
- result.push(react_table_1.useSortBy);
210
- }
211
- if (rowExpanding === null || rowExpanding === void 0 ? void 0 : rowExpanding.enabled) {
212
- result.push(react_table_1.useExpanded);
213
- }
214
- if (pagination === null || pagination === void 0 ? void 0 : pagination.enabled) {
215
- result.push(react_table_1.usePagination);
216
- }
217
- if (rowSelect === null || rowSelect === void 0 ? void 0 : rowSelect.enabled) {
218
- result.push(react_table_1.useRowSelect);
219
- }
220
- if (columnResizing === null || columnResizing === void 0 ? void 0 : columnResizing.enabled) {
221
- result.push(react_table_1.useResizeColumns);
222
- }
223
- // column customizations
224
- if ((rowSelect === null || rowSelect === void 0 ? void 0 : rowSelect.enabled) || (rowExpanding === null || rowExpanding === void 0 ? void 0 : rowExpanding.enabled)) {
225
- result.push(function (hooks) {
226
- hooks.visibleColumns.push(function (columns) { return __spreadArray([
227
- {
228
- id: exports.ACTION_COLUMN_ID,
229
- width: actionColumnCellWidth,
230
- minWidth: actionColumnCellWidth,
231
- maxWidth: actionColumnCellWidth,
232
- Header: function (props) {
233
- var _a = props, getToggleAllRowsSelectedProps = _a.getToggleAllRowsSelectedProps, getToggleAllPageRowsSelectedProps = _a.getToggleAllPageRowsSelectedProps;
234
- return ((0, react_1.jsx)(react_2.Fragment, null,
235
- (rowExpanding === null || rowExpanding === void 0 ? void 0 : rowExpanding.enabled) && ((0, react_1.jsx)("span", { css: (0, react_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding: ", "px;\n "], ["\n padding: ", "px;\n "])), EXPAND_BTN_WIDTH / 2) })),
236
- (rowSelect === null || rowSelect === void 0 ? void 0 : rowSelect.enabled) && (rowSelect === null || rowSelect === void 0 ? void 0 : rowSelect.mode) === 'multi' ? (
237
- // @ts-ignore
238
- (0, react_1.jsx)(IndeterminateCheckbox_1.default, __assign({}, ((pagination === null || pagination === void 0 ? void 0 : pagination.enabled) ? getToggleAllPageRowsSelectedProps() : getToggleAllRowsSelectedProps()), {
239
- // @ts-ignore
240
- size: "small" }))) : null));
241
- },
242
- Cell: function (props) {
243
- var _a = props.row, getToggleRowSelectedProps = _a.getToggleRowSelectedProps, getToggleRowExpandedProps = _a.getToggleRowExpandedProps, isExpanded = _a.isExpanded, index = _a.index;
244
- return ((0, react_1.jsx)(react_2.Fragment, null,
245
- (rowExpanding === null || rowExpanding === void 0 ? void 0 : rowExpanding.enabled) && (
246
- // @ts-ignore
247
- (0, react_1.jsx)(material_1.IconButton, __assign({}, getToggleRowExpandedProps(), { css: (0, react_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n &.MuiIconButton-root {\n padding: 0;\n }\n "], ["\n &.MuiIconButton-root {\n padding: 0;\n }\n "]))), size: "small" }),
248
- (0, react_1.jsx)(icons_material_1.KeyboardArrowRight, { css: (0, react_1.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n transform: rotate3d(0, 0, 1, ", ");\n transition: transform 0.25s;\n "], ["\n transform: rotate3d(0, 0, 1, ", ");\n transition: transform 0.25s;\n "])), isExpanded ? '90deg' : '0deg') }))),
249
- (rowSelect === null || rowSelect === void 0 ? void 0 : rowSelect.enabled) && ((0, react_1.jsx)(IndeterminateCheckbox_1.default, __assign({ name: index.toString() }, getToggleRowSelectedProps(), {
250
- // @ts-ignore
251
- size: "small" })))));
252
- },
253
- }
254
- ], __read(columns), false); });
255
- });
256
- }
257
- return result;
258
- }, [rowExpanding, rowSelect, columnHiding, sorting, filters, globalSearch, pagination, virtualize]);
259
- }
260
- exports.usePluginConfig = usePluginConfig;
261
- function useDefaultTableInstance(_a) {
262
- var columns = _a.columns, data = _a.data, _b = _a.options, options = _b === void 0 ? {} : _b, _c = _a.initialState, initialState = _c === void 0 ? {} : _c, defaultColumn = _a.defaultColumn;
263
- var filterTypes = (0, react_2.useMemo)(function () { return ({
264
- equalsOneOf: function (rows, ids, filterValue) {
265
- return rows.filter(function (row) {
266
- var rowValue = row.values[ids[0]];
267
- return !!filterValue && filterValue.length ? filterValue.includes(rowValue) : true;
268
- });
269
- },
270
- }); }, []);
271
- function stateReducer(newState, action) {
272
- var _a, _b;
273
- if (action.type === 'toggleRowExpanded') {
274
- if (((_a = options === null || options === void 0 ? void 0 : options.rowExpanding) === null || _a === void 0 ? void 0 : _a.mode) === 'single') {
275
- newState = (0, immer_1.default)(newState, function (draft) {
276
- var _a;
277
- // @ts-ignore
278
- ;
279
- draft.expanded = (_a = {},
280
- // since we are acting on the newState, we will just set this to its current value.
281
- // what's important is that no other expanded value will be set since this overwrites
282
- // the expanded object, so that it only contains this single entry.
283
- _a[action.id] = draft.expanded[action.id],
284
- _a);
285
- });
286
- }
287
- }
288
- if (action.type === 'toggleRowSelected') {
289
- if (((_b = options === null || options === void 0 ? void 0 : options.rowSelect) === null || _b === void 0 ? void 0 : _b.mode) === 'single') {
290
- newState = (0, immer_1.default)(newState, function (draft) {
291
- var _a;
292
- // @ts-ignore
293
- ;
294
- draft.selectedRowIds = (_a = {},
295
- _a[action.id] = action.value,
296
- _a);
297
- });
298
- }
299
- }
300
- if (action.type === 'manuallySetColumnWidth') {
301
- var _c = action, columnId_1 = _c.columnId, width_1 = _c.width;
302
- newState = (0, immer_1.default)(newState, function (draft) {
303
- // @ts-ignore
304
- ;
305
- draft.columnResizing.columnWidths[columnId_1] = width_1;
306
- });
307
- }
308
- return newState;
309
- }
310
- var plugins = usePluginConfig(options);
311
- var _d = (options === null || options === void 0 ? void 0 : options.pagination) || {}, enabled = _d.enabled, pageSize = _d.pageSize, rowsPerPageOptions = _d.rowsPerPageOptions;
312
- var state = initialState;
313
- if (enabled) {
314
- var initPageSize_1 = pageSize
315
- ? pageSize
316
- : rowsPerPageOptions && rowsPerPageOptions.length
317
- ? rowsPerPageOptions[0]
318
- : undefined;
319
- if (initPageSize_1) {
320
- state = (0, immer_1.default)(state, function (draft) {
321
- draft.pageSize = initPageSize_1;
322
- });
323
- }
324
- }
325
- var getRowId = ((options === null || options === void 0 ? void 0 : options.table) || {}).getRowId;
326
- var _e = ((options === null || options === void 0 ? void 0 : options.rowExpanding) || {}).autoResetExpanded, autoResetExpanded = _e === void 0 ? true : _e;
327
- var instance = react_table_1.useTable.apply(void 0, __spreadArray([{
328
- autoResetExpanded: autoResetExpanded,
329
- autoResetGlobalFilter: false,
330
- getRowId: getRowId,
331
- columns: columns,
332
- data: data,
333
- defaultColumn: defaultColumn,
334
- filterTypes: filterTypes,
335
- stateReducer: stateReducer,
336
- initialState: state,
337
- }], __read(plugins), false));
338
- function setColumnWidth(columnId, width) {
339
- instance.dispatch({ type: 'manuallySetColumnWidth', columnId: columnId, width: width });
340
- }
341
- return __assign(__assign({}, instance), { setColumnWidth: setColumnWidth });
342
- }
343
- exports.useDefaultTableInstance = useDefaultTableInstance;
344
- function renderSingleLineCell(value) {
345
- return ((0, react_1.jsx)(material_1.Tooltip, { title: value },
346
- (0, react_1.jsx)("div", { css: (0, react_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n text-overflow: ellipsis;\n overflow: hidden;\n "], ["\n text-overflow: ellipsis;\n overflow: hidden;\n "]))) }, value)));
347
- }
348
- exports.renderSingleLineCell = renderSingleLineCell;
349
- function getColumnFilterConfig(filterType) {
350
- switch (filterType) {
351
- case 'select':
352
- return { filter: 'equals', Filter: SingleSelectFilter_1.default };
353
- case 'multi-select':
354
- return { filter: 'equalsOneOf', Filter: MultiSelectFilter_1.default };
355
- case 'range':
356
- return { filter: 'between', Filter: RangeFilter_1.default };
357
- case 'text':
358
- default:
359
- return { filter: 'text', Filter: TextFilter_1.default };
360
- }
361
- }
362
- exports.getColumnFilterConfig = getColumnFilterConfig;
363
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;