@desynova-digital/components 9.3.6 → 9.3.8
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/atoms/cardV2/cardV2.js +8 -1
- package/atoms/cardV2/contentV2.js +33 -8
- package/atoms/icon/icons.json +30 -0
- package/molecules/table/table-header.js +148 -11
- package/molecules/table/table.js +706 -137
- package/package.json +2 -2
package/molecules/table/table.js
CHANGED
|
@@ -34,17 +34,129 @@ var _permissionIconMap = _interopRequireDefault(require("../../../tokens/permiss
|
|
|
34
34
|
var _TableErrorScreen = _interopRequireDefault(require("../../molecules/errorScreen/TableErrorScreen"));
|
|
35
35
|
var _inputText = _interopRequireDefault(require("../../atoms/inputText"));
|
|
36
36
|
var _Shimmer = _interopRequireDefault(require("../../atoms/loader/ShimmerComponent/Shimmer"));
|
|
37
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0, _templateObject1, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
|
|
37
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0, _templateObject1, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19;
|
|
38
38
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
39
39
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
40
40
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
41
41
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
42
42
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
43
|
+
/**
|
|
44
|
+
* Width used for a resizable column that carries no width of its own.
|
|
45
|
+
*/
|
|
46
|
+
var DEFAULT_COLUMN_WIDTH = "175px";
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Structural columns that own a fixed slot and are never user-resizable.
|
|
50
|
+
*/
|
|
51
|
+
var FIXED_COLUMN_WIDTHS = {
|
|
52
|
+
extra_columns: "40px",
|
|
53
|
+
rowChecked: "50px"
|
|
54
|
+
};
|
|
55
|
+
var NESTED_REVEAL_MS = 260;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Normalises a column width into a valid CSS length.
|
|
59
|
+
* @param {number|string} value raw width from the column definition
|
|
60
|
+
* @returns {string|undefined} a CSS length, or undefined when unusable
|
|
61
|
+
*/
|
|
62
|
+
var toCssWidth = function toCssWidth(value) {
|
|
63
|
+
if (value === null || value === undefined || value === "") {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
if (typeof value === "number") {
|
|
67
|
+
return Number.isFinite(value) ? "".concat(value, "px") : undefined;
|
|
68
|
+
}
|
|
69
|
+
var trimmed = String(value).trim();
|
|
70
|
+
if (!trimmed || trimmed === "undefined" || trimmed === "null") {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
return /^-?\d*\.?\d+$/.test(trimmed) ? "".concat(trimmed, "px") : trimmed;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Reads a column width back as a plain px number, for comparing
|
|
78
|
+
* @param {number|string} value raw width from the column definition
|
|
79
|
+
* @returns {number|undefined} rounded px value, or undefined when not in px
|
|
80
|
+
*/
|
|
81
|
+
var toPxNumber = function toPxNumber(value) {
|
|
82
|
+
var css = toCssWidth(value);
|
|
83
|
+
if (!css) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
var match = /^(-?\d*\.?\d+)px$/.exec(css);
|
|
87
|
+
return match ? Math.round(parseFloat(match[1])) : undefined;
|
|
88
|
+
};
|
|
89
|
+
var STRUCTURAL_LEFT_FIELDS = ["rowChecked", "extra_columns"];
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Reads a pinned flag off a column definition.
|
|
93
|
+
* @param {boolean} value raw pinned_left / pinned_right value
|
|
94
|
+
* @returns {boolean} true when the column should be frozen
|
|
95
|
+
*/
|
|
96
|
+
var isPinned = function isPinned(value) {
|
|
97
|
+
return value === true;
|
|
98
|
+
};
|
|
43
99
|
var Table = /*#__PURE__*/function (_Component) {
|
|
44
100
|
function Table(props) {
|
|
45
101
|
var _this;
|
|
46
102
|
(0, _classCallCheck2["default"])(this, Table);
|
|
47
103
|
_this = _callSuper(this, Table, [props]);
|
|
104
|
+
(0, _defineProperty2["default"])(_this, "syncScrollContainer", function () {
|
|
105
|
+
var tableElement = _this.tableElementRef.current;
|
|
106
|
+
var container = tableElement ? tableElement.parentElement : null;
|
|
107
|
+
if (container !== _this.scrollContainer) {
|
|
108
|
+
if (_this.scrollObserver) {
|
|
109
|
+
_this.scrollObserver.disconnect();
|
|
110
|
+
_this.scrollObserver = null;
|
|
111
|
+
}
|
|
112
|
+
if (_this.scrollContainer) {
|
|
113
|
+
_this.scrollContainer.removeEventListener("scroll", _this.handleCardScroll);
|
|
114
|
+
}
|
|
115
|
+
_this.scrollContainer = container;
|
|
116
|
+
if (container) {
|
|
117
|
+
container.addEventListener("scroll", _this.handleCardScroll);
|
|
118
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
119
|
+
_this.scrollObserver = new ResizeObserver(_this.measureScrollContainer);
|
|
120
|
+
_this.scrollObserver.observe(container);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
_this.measureScrollContainer();
|
|
125
|
+
});
|
|
126
|
+
(0, _defineProperty2["default"])(_this, "measureScrollContainer", function () {
|
|
127
|
+
if (!_this.scrollContainer) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
var width = _this.scrollContainer.clientWidth;
|
|
131
|
+
var contentWidth = _this.scrollContainer.scrollWidth;
|
|
132
|
+
if (!width) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (width !== _this.state.viewportWidth || contentWidth !== _this.state.scrollContentWidth) {
|
|
136
|
+
_this.setState({
|
|
137
|
+
viewportWidth: width,
|
|
138
|
+
scrollContentWidth: contentWidth
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
(0, _defineProperty2["default"])(_this, "handleCardScroll", function () {
|
|
143
|
+
var proxy = _this.scrollProxyRef.current;
|
|
144
|
+
if (!proxy || !_this.scrollContainer) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (proxy.scrollLeft !== _this.scrollContainer.scrollLeft) {
|
|
148
|
+
proxy.scrollLeft = _this.scrollContainer.scrollLeft;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
(0, _defineProperty2["default"])(_this, "handleProxyScroll", function () {
|
|
152
|
+
var proxy = _this.scrollProxyRef.current;
|
|
153
|
+
if (!proxy || !_this.scrollContainer) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (_this.scrollContainer.scrollLeft !== proxy.scrollLeft) {
|
|
157
|
+
_this.scrollContainer.scrollLeft = proxy.scrollLeft;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
48
160
|
(0, _defineProperty2["default"])(_this, "spiltColumns", function () {
|
|
49
161
|
_this.defaultShowColumns = [];
|
|
50
162
|
_this.extraColumns = [];
|
|
@@ -56,6 +168,7 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
56
168
|
type: "extra_columns"
|
|
57
169
|
};
|
|
58
170
|
if (_this.props.preserveActionPosition) {
|
|
171
|
+
var _this$defaultShowColu;
|
|
59
172
|
_this.columns = _this.columns.filter(function (item) {
|
|
60
173
|
if (item.type === "table") {
|
|
61
174
|
_this.nestedTable.push(item);
|
|
@@ -63,16 +176,30 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
63
176
|
}
|
|
64
177
|
return true;
|
|
65
178
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
179
|
+
|
|
180
|
+
/*
|
|
181
|
+
* Every selected column belongs to one list and renders in the main row;
|
|
182
|
+
* Table.Card scrolls horizontally once they overflow.
|
|
183
|
+
*/
|
|
184
|
+
_this.defaultShowColumns = (0, _toConsumableArray2["default"])(_this.columns);
|
|
185
|
+
_this.extraColumns = [];
|
|
186
|
+
|
|
187
|
+
/*
|
|
188
|
+
* Row actions own the right-most slot whatever order the saved column
|
|
189
|
+
*/
|
|
190
|
+
var actionIndex = _this.defaultShowColumns.findIndex(function (item) {
|
|
191
|
+
return item.type === "action_icon";
|
|
192
|
+
});
|
|
193
|
+
if (actionIndex > -1) {
|
|
194
|
+
_this.actionIconCol = _this.defaultShowColumns.splice(actionIndex, 1);
|
|
75
195
|
}
|
|
196
|
+
if (_this.nestedTable.length > 0) {
|
|
197
|
+
var rowCheckedIndex = _this.defaultShowColumns.findIndex(function (item) {
|
|
198
|
+
return item.field === "rowChecked";
|
|
199
|
+
});
|
|
200
|
+
_this.defaultShowColumns.splice(rowCheckedIndex + 1, 0, extraColumnsSchema);
|
|
201
|
+
}
|
|
202
|
+
(_this$defaultShowColu = _this.defaultShowColumns).push.apply(_this$defaultShowColu, (0, _toConsumableArray2["default"])(_this.actionIconCol));
|
|
76
203
|
} else {
|
|
77
204
|
_this.columns = _this.columns.filter(function (item) {
|
|
78
205
|
if (item.type === "action_icon") {
|
|
@@ -84,22 +211,22 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
84
211
|
}
|
|
85
212
|
return true;
|
|
86
213
|
});
|
|
87
|
-
var
|
|
88
|
-
_this.defaultShowColumns = (0, _toConsumableArray2["default"])(
|
|
89
|
-
_this.extraColumns = (0, _toConsumableArray2["default"])(
|
|
90
|
-
var
|
|
91
|
-
var
|
|
92
|
-
if (
|
|
93
|
-
_this.defaultShowColumns.splice(
|
|
214
|
+
var allRegularColumns = (0, _toConsumableArray2["default"])(_this.columns);
|
|
215
|
+
_this.defaultShowColumns = (0, _toConsumableArray2["default"])(allRegularColumns);
|
|
216
|
+
_this.extraColumns = (0, _toConsumableArray2["default"])(allRegularColumns);
|
|
217
|
+
var maxRegularColumns = _this.props.showActions ? _this.props.maxShowNoOfColumns - 1 : _this.props.maxShowNoOfColumns;
|
|
218
|
+
var needsTruncation = _this.columns.length > maxRegularColumns;
|
|
219
|
+
if (needsTruncation) {
|
|
220
|
+
_this.defaultShowColumns.splice(maxRegularColumns);
|
|
94
221
|
if (_this.props.showActions && _this.actionIconCol.length > 0) {
|
|
95
|
-
var _this$
|
|
96
|
-
(_this$
|
|
222
|
+
var _this$defaultShowColu2;
|
|
223
|
+
(_this$defaultShowColu2 = _this.defaultShowColumns).push.apply(_this$defaultShowColu2, (0, _toConsumableArray2["default"])(_this.actionIconCol));
|
|
97
224
|
}
|
|
98
225
|
_this.defaultShowColumns.push(extraColumnsSchema);
|
|
99
|
-
_this.extraColumns.splice(0,
|
|
226
|
+
_this.extraColumns.splice(0, maxRegularColumns);
|
|
100
227
|
} else if (_this.props.showActions && _this.actionIconCol.length > 0) {
|
|
101
|
-
var _this$
|
|
102
|
-
(_this$
|
|
228
|
+
var _this$defaultShowColu3;
|
|
229
|
+
(_this$defaultShowColu3 = _this.defaultShowColumns).push.apply(_this$defaultShowColu3, (0, _toConsumableArray2["default"])(_this.actionIconCol));
|
|
103
230
|
}
|
|
104
231
|
}
|
|
105
232
|
return {
|
|
@@ -132,6 +259,19 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
132
259
|
return item.field;
|
|
133
260
|
});
|
|
134
261
|
});
|
|
262
|
+
/**
|
|
263
|
+
* Whether a row carries a nested table worth expanding
|
|
264
|
+
* @param {object} item a row of the table
|
|
265
|
+
* @returns {boolean} true when the row has nested rows to show
|
|
266
|
+
*/
|
|
267
|
+
(0, _defineProperty2["default"])(_this, "hasNestedRows", function (item) {
|
|
268
|
+
var nestedTable = _this.state.nestedTable;
|
|
269
|
+
if (!item || !nestedTable || !nestedTable.length || !nestedTable[0].field) {
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
var nested = item[nestedTable[0].field];
|
|
273
|
+
return !!(nested && nested.rows && nested.rows.length > 0);
|
|
274
|
+
});
|
|
135
275
|
// actions onClick event
|
|
136
276
|
(0, _defineProperty2["default"])(_this, "actionClickEvents", function (e, action, idx) {
|
|
137
277
|
// action eg. play, ingest_delete etc
|
|
@@ -261,23 +401,23 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
261
401
|
height: "16px",
|
|
262
402
|
width: "100%"
|
|
263
403
|
});
|
|
264
|
-
} else {
|
|
265
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
266
|
-
onClick: function onClick(e) {
|
|
267
|
-
_this.toggleExtraDetails(e, idx);
|
|
268
|
-
}
|
|
269
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
270
|
-
className: _this.state.showExtraRow === idx ? "show-row" : "hide-row"
|
|
271
|
-
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
272
|
-
className: "open-close-extra"
|
|
273
|
-
}, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
|
|
274
|
-
theme: _this.props.theme,
|
|
275
|
-
name: "chevron-down",
|
|
276
|
-
width: 12,
|
|
277
|
-
height: 10,
|
|
278
|
-
color: _tokens.colors[_this.props.theme].table.tdColor
|
|
279
|
-
}))));
|
|
280
404
|
}
|
|
405
|
+
if (!_this.hasNestedRows(item)) {
|
|
406
|
+
return null;
|
|
407
|
+
}
|
|
408
|
+
return /*#__PURE__*/_react["default"].createElement(ExpandToggle, {
|
|
409
|
+
className: "expand-toggle".concat(_this.state.showExtraRow === idx ? " is-expanded" : ""),
|
|
410
|
+
onClick: function onClick(e) {
|
|
411
|
+
_this.toggleExtraDetails(e, idx);
|
|
412
|
+
}
|
|
413
|
+
}, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
|
|
414
|
+
theme: _this.props.theme,
|
|
415
|
+
name: "right-arrow-chevron",
|
|
416
|
+
width: 12,
|
|
417
|
+
height: 12,
|
|
418
|
+
color: "none",
|
|
419
|
+
stroke: _tokens.colors[_this.props.theme].table.tdColor
|
|
420
|
+
}));
|
|
281
421
|
}
|
|
282
422
|
/**
|
|
283
423
|
* In link text we expect actions array in our items array to perform click functionality and data
|
|
@@ -624,6 +764,282 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
624
764
|
break;
|
|
625
765
|
}
|
|
626
766
|
});
|
|
767
|
+
/**
|
|
768
|
+
* Resolves the width a column should render at.
|
|
769
|
+
* @param {object} column column definition
|
|
770
|
+
* @returns {string|undefined} a CSS length, or undefined to leave it to layout
|
|
771
|
+
*/
|
|
772
|
+
(0, _defineProperty2["default"])(_this, "getColumnWidth", function (column) {
|
|
773
|
+
if (!column) {
|
|
774
|
+
return undefined;
|
|
775
|
+
}
|
|
776
|
+
if (FIXED_COLUMN_WIDTHS[column.field]) {
|
|
777
|
+
return FIXED_COLUMN_WIDTHS[column.field];
|
|
778
|
+
}
|
|
779
|
+
var override = _this.state.columnWidths[column.field];
|
|
780
|
+
if (override !== undefined) {
|
|
781
|
+
return "".concat(override, "px");
|
|
782
|
+
}
|
|
783
|
+
return toCssWidth(column.width) || (_this.props.resizableColumns ? DEFAULT_COLUMN_WIDTH : undefined);
|
|
784
|
+
});
|
|
785
|
+
/**
|
|
786
|
+
* The columns actually on screen, in render order.
|
|
787
|
+
* @returns {array} visible column definitions
|
|
788
|
+
*/
|
|
789
|
+
(0, _defineProperty2["default"])(_this, "getVisibleColumns", function () {
|
|
790
|
+
return (_this.defaultShowColumns || []).filter(function (column) {
|
|
791
|
+
return _this.state.showColumnArr.indexOf(column.field) > -1;
|
|
792
|
+
});
|
|
793
|
+
});
|
|
794
|
+
/**
|
|
795
|
+
* Resolves where each pinned column parks, keyed by field.
|
|
796
|
+
* Left-pinned columns stack against the left edge in the order they appear,
|
|
797
|
+
* right-pinned ones against the right edge; everything between them scrolls
|
|
798
|
+
* @returns {object} map of field -> { side, offset, isEdge }
|
|
799
|
+
*/
|
|
800
|
+
(0, _defineProperty2["default"])(_this, "getPinnedOffsets", function () {
|
|
801
|
+
var visibleColumns = _this.getVisibleColumns();
|
|
802
|
+
var offsets = {};
|
|
803
|
+
var left = 0;
|
|
804
|
+
var lastLeftField = null;
|
|
805
|
+
for (var i = 0; i < visibleColumns.length; i += 1) {
|
|
806
|
+
var column = visibleColumns[i];
|
|
807
|
+
var structural = STRUCTURAL_LEFT_FIELDS.includes(column.field);
|
|
808
|
+
if (structural || isPinned(column.pinned_left)) {
|
|
809
|
+
var width = toPxNumber(_this.getColumnWidth(column));
|
|
810
|
+
if (width === undefined) {
|
|
811
|
+
break;
|
|
812
|
+
}
|
|
813
|
+
offsets[column.field] = {
|
|
814
|
+
side: "left",
|
|
815
|
+
offset: left,
|
|
816
|
+
structural: structural
|
|
817
|
+
};
|
|
818
|
+
lastLeftField = column.field;
|
|
819
|
+
left += width;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
var right = 0;
|
|
823
|
+
var lastRightField = null;
|
|
824
|
+
for (var _i = visibleColumns.length - 1; _i >= 0; _i -= 1) {
|
|
825
|
+
var _column = visibleColumns[_i];
|
|
826
|
+
if (isPinned(_column.pinned_right) && !offsets[_column.field]) {
|
|
827
|
+
var _width = toPxNumber(_this.getColumnWidth(_column));
|
|
828
|
+
if (_width === undefined) {
|
|
829
|
+
break;
|
|
830
|
+
}
|
|
831
|
+
offsets[_column.field] = {
|
|
832
|
+
side: "right",
|
|
833
|
+
offset: right
|
|
834
|
+
};
|
|
835
|
+
lastRightField = _column.field;
|
|
836
|
+
right += _width;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
_this.frozenWidths = {
|
|
840
|
+
left: left,
|
|
841
|
+
right: right
|
|
842
|
+
};
|
|
843
|
+
if (lastLeftField) {
|
|
844
|
+
offsets[lastLeftField].isEdge = true;
|
|
845
|
+
}
|
|
846
|
+
if (lastRightField) {
|
|
847
|
+
offsets[lastRightField].isEdge = true;
|
|
848
|
+
}
|
|
849
|
+
return offsets;
|
|
850
|
+
});
|
|
851
|
+
/**
|
|
852
|
+
* Where a column is pinned this render, if at all.
|
|
853
|
+
* @param {object} column column definition
|
|
854
|
+
* @returns {object|undefined} { side, offset, isEdge }
|
|
855
|
+
*/
|
|
856
|
+
(0, _defineProperty2["default"])(_this, "getPinnedPlacement", function (column) {
|
|
857
|
+
if (!column || !_this.pinnedOffsets) {
|
|
858
|
+
return undefined;
|
|
859
|
+
}
|
|
860
|
+
return _this.pinnedOffsets[column.field];
|
|
861
|
+
});
|
|
862
|
+
/**
|
|
863
|
+
* Width and freeze styles for a header/body cell
|
|
864
|
+
* @param {object} column column definition
|
|
865
|
+
* @returns {object|undefined} style object, or undefined when unsized
|
|
866
|
+
*/
|
|
867
|
+
(0, _defineProperty2["default"])(_this, "getColumnStyle", function (column) {
|
|
868
|
+
var width = _this.getColumnWidth(column);
|
|
869
|
+
var pinned = _this.getPinnedPlacement(column);
|
|
870
|
+
if (!width && !pinned) {
|
|
871
|
+
return undefined;
|
|
872
|
+
}
|
|
873
|
+
var style = width ? {
|
|
874
|
+
width: width,
|
|
875
|
+
minWidth: width,
|
|
876
|
+
maxWidth: width
|
|
877
|
+
} : {};
|
|
878
|
+
if (pinned) {
|
|
879
|
+
style.position = "sticky";
|
|
880
|
+
style[pinned.side] = "".concat(pinned.offset, "px");
|
|
881
|
+
}
|
|
882
|
+
return style;
|
|
883
|
+
});
|
|
884
|
+
/**
|
|
885
|
+
* Class names for a header/body cell.
|
|
886
|
+
* @param {object} column column definition
|
|
887
|
+
* @param {string} base class name the cell carries regardless
|
|
888
|
+
* @returns {string|undefined} the full class name
|
|
889
|
+
*/
|
|
890
|
+
(0, _defineProperty2["default"])(_this, "getColumnClassName", function (column, base) {
|
|
891
|
+
var pinned = _this.getPinnedPlacement(column);
|
|
892
|
+
if (!pinned) {
|
|
893
|
+
return base;
|
|
894
|
+
}
|
|
895
|
+
var classes = [base, "pinned-column", "pinned-".concat(pinned.side)];
|
|
896
|
+
if (pinned.isEdge) {
|
|
897
|
+
classes.push("pinned-".concat(pinned.side, "-edge"));
|
|
898
|
+
}
|
|
899
|
+
return classes.filter(Boolean).join(" ");
|
|
900
|
+
});
|
|
901
|
+
/**
|
|
902
|
+
* Live feedback during a drag. Held locally so the store is not written on
|
|
903
|
+
* every animation frame.
|
|
904
|
+
* @param {string} field field of the column being resized
|
|
905
|
+
* @param {number} width new width in px
|
|
906
|
+
*/
|
|
907
|
+
(0, _defineProperty2["default"])(_this, "handleColumnResize", function (field, width) {
|
|
908
|
+
_this.setState(function (prevState) {
|
|
909
|
+
return {
|
|
910
|
+
columnWidths: _objectSpread(_objectSpread({}, prevState.columnWidths), {}, (0, _defineProperty2["default"])({}, field, width))
|
|
911
|
+
};
|
|
912
|
+
});
|
|
913
|
+
});
|
|
914
|
+
/**
|
|
915
|
+
* Drag finished - hand the final width up so the container can persist it.
|
|
916
|
+
* The local override is kept until props echo the same value back.
|
|
917
|
+
* @param {string} field field of the column being resized
|
|
918
|
+
* @param {number} width final width in px
|
|
919
|
+
*/
|
|
920
|
+
(0, _defineProperty2["default"])(_this, "handleColumnResizeEnd", function (field, width) {
|
|
921
|
+
_this.setState(function (prevState) {
|
|
922
|
+
return {
|
|
923
|
+
columnWidths: _objectSpread(_objectSpread({}, prevState.columnWidths), {}, (0, _defineProperty2["default"])({}, field, width))
|
|
924
|
+
};
|
|
925
|
+
}, function () {
|
|
926
|
+
if (_this.props.onColumnResize) {
|
|
927
|
+
_this.props.onColumnResize(field, width);
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
});
|
|
931
|
+
/**
|
|
932
|
+
* Drops local overrides that props have caught up with, so the incoming
|
|
933
|
+
* column definitions stay the source of truth after a resize round-trip.
|
|
934
|
+
* @param {array} columns freshly derived column definitions
|
|
935
|
+
* @returns {object} the next columnWidths map
|
|
936
|
+
*/
|
|
937
|
+
(0, _defineProperty2["default"])(_this, "reconcileColumnWidths", function (columns) {
|
|
938
|
+
var columnWidths = _this.state.columnWidths;
|
|
939
|
+
if (Object.keys(columnWidths).length === 0) {
|
|
940
|
+
return columnWidths;
|
|
941
|
+
}
|
|
942
|
+
var next = _objectSpread({}, columnWidths);
|
|
943
|
+
var changed = false;
|
|
944
|
+
columns.forEach(function (column) {
|
|
945
|
+
if (next[column.field] !== undefined && toPxNumber(column.width) === next[column.field]) {
|
|
946
|
+
delete next[column.field];
|
|
947
|
+
changed = true;
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
return changed ? next : columnWidths;
|
|
951
|
+
});
|
|
952
|
+
/**
|
|
953
|
+
* Pins the table to the exact sum of its column widths while resizing is on.
|
|
954
|
+
* @returns {object|undefined} style object, or undefined to keep the default
|
|
955
|
+
*/
|
|
956
|
+
(0, _defineProperty2["default"])(_this, "getTableStyle", function () {
|
|
957
|
+
var total = _this.getVisibleColumnsWidth();
|
|
958
|
+
if (total === undefined) {
|
|
959
|
+
return undefined;
|
|
960
|
+
}
|
|
961
|
+
if (_this.hasTableSlack()) {
|
|
962
|
+
return {
|
|
963
|
+
width: "100%"
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
return {
|
|
967
|
+
width: "".concat(total, "px")
|
|
968
|
+
};
|
|
969
|
+
});
|
|
970
|
+
/**
|
|
971
|
+
* Total px width of the visible columns.
|
|
972
|
+
* @returns {number|undefined} the sum, or undefined when it cannot be known
|
|
973
|
+
*/
|
|
974
|
+
(0, _defineProperty2["default"])(_this, "getVisibleColumnsWidth", function () {
|
|
975
|
+
if (!_this.props.resizableColumns) {
|
|
976
|
+
return undefined;
|
|
977
|
+
}
|
|
978
|
+
var visibleColumns = _this.getVisibleColumns();
|
|
979
|
+
if (visibleColumns.length === 0) {
|
|
980
|
+
return undefined;
|
|
981
|
+
}
|
|
982
|
+
var total = 0;
|
|
983
|
+
for (var i = 0; i < visibleColumns.length; i += 1) {
|
|
984
|
+
var width = toPxNumber(_this.getColumnWidth(visibleColumns[i]));
|
|
985
|
+
if (width === undefined) {
|
|
986
|
+
return undefined;
|
|
987
|
+
}
|
|
988
|
+
total += width;
|
|
989
|
+
}
|
|
990
|
+
return total;
|
|
991
|
+
});
|
|
992
|
+
/**
|
|
993
|
+
* Whether the columns leave empty space to the right of the table.
|
|
994
|
+
* @returns {boolean} true when a filler column is needed
|
|
995
|
+
*/
|
|
996
|
+
/**
|
|
997
|
+
* Position of the filler column
|
|
998
|
+
* @returns {number} index into defaultShowColumns, or -1 when unneeded
|
|
999
|
+
*/
|
|
1000
|
+
(0, _defineProperty2["default"])(_this, "renderFillerCell", function (key) {
|
|
1001
|
+
return /*#__PURE__*/_react["default"].createElement(Table.Cell, {
|
|
1002
|
+
className: "table-cell filler-cell",
|
|
1003
|
+
theme: _this.props.theme,
|
|
1004
|
+
key: key,
|
|
1005
|
+
maxWidth: "none",
|
|
1006
|
+
column: {}
|
|
1007
|
+
});
|
|
1008
|
+
});
|
|
1009
|
+
(0, _defineProperty2["default"])(_this, "getFillerIndex", function () {
|
|
1010
|
+
if (!_this.hasTableSlack()) {
|
|
1011
|
+
return -1;
|
|
1012
|
+
}
|
|
1013
|
+
var columns = _this.defaultShowColumns || [];
|
|
1014
|
+
for (var i = 0; i < columns.length; i += 1) {
|
|
1015
|
+
var placement = _this.getPinnedPlacement(columns[i]);
|
|
1016
|
+
if (placement && placement.side === "right") {
|
|
1017
|
+
return i;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
return columns.length;
|
|
1021
|
+
});
|
|
1022
|
+
(0, _defineProperty2["default"])(_this, "hasTableSlack", function () {
|
|
1023
|
+
var viewportWidth = _this.state.viewportWidth;
|
|
1024
|
+
if (!viewportWidth) {
|
|
1025
|
+
return false;
|
|
1026
|
+
}
|
|
1027
|
+
var total = _this.getVisibleColumnsWidth();
|
|
1028
|
+
return total !== undefined && total < viewportWidth;
|
|
1029
|
+
});
|
|
1030
|
+
(0, _defineProperty2["default"])(_this, "getColumnResizeProps", function () {
|
|
1031
|
+
return {
|
|
1032
|
+
resizableColumns: _this.props.resizableColumns,
|
|
1033
|
+
getColumnWidth: _this.getColumnWidth,
|
|
1034
|
+
getColumnStyle: _this.getColumnStyle,
|
|
1035
|
+
getColumnClassName: _this.getColumnClassName,
|
|
1036
|
+
getPinnedPlacement: _this.getPinnedPlacement,
|
|
1037
|
+
onColumnResize: _this.handleColumnResize,
|
|
1038
|
+
onColumnResizeEnd: _this.handleColumnResizeEnd
|
|
1039
|
+
};
|
|
1040
|
+
});
|
|
1041
|
+
_this.tableElementRef = /*#__PURE__*/_react["default"].createRef();
|
|
1042
|
+
_this.scrollProxyRef = /*#__PURE__*/_react["default"].createRef();
|
|
627
1043
|
_this.columns = _this.getColumns(props);
|
|
628
1044
|
var spiltColumns = _this.spiltColumns();
|
|
629
1045
|
_this.state = {
|
|
@@ -638,12 +1054,21 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
638
1054
|
isAllRowsSelected: false,
|
|
639
1055
|
searchedText: props.searchValue || "",
|
|
640
1056
|
commonActionsSelected: [],
|
|
641
|
-
ingestedDbIdArray: []
|
|
1057
|
+
ingestedDbIdArray: [],
|
|
1058
|
+
columnWidths: {},
|
|
1059
|
+
viewportWidth: null,
|
|
1060
|
+
scrollContentWidth: null
|
|
642
1061
|
};
|
|
643
1062
|
return _this;
|
|
644
1063
|
}
|
|
645
1064
|
(0, _inherits2["default"])(Table, _Component);
|
|
646
1065
|
return (0, _createClass2["default"])(Table, [{
|
|
1066
|
+
key: "componentDidMount",
|
|
1067
|
+
value: function componentDidMount() {
|
|
1068
|
+
this.syncScrollContainer();
|
|
1069
|
+
window.addEventListener("resize", this.measureScrollContainer);
|
|
1070
|
+
}
|
|
1071
|
+
}, {
|
|
647
1072
|
key: "componentDidUpdate",
|
|
648
1073
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
649
1074
|
if (prevState.items !== this.state.items) {
|
|
@@ -675,18 +1100,42 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
675
1100
|
showColumnArr: spiltColumns.showColumnArr ? spiltColumns.showColumnArr : []
|
|
676
1101
|
});
|
|
677
1102
|
}
|
|
1103
|
+
this.syncScrollContainer();
|
|
1104
|
+
}
|
|
1105
|
+
}, {
|
|
1106
|
+
key: "componentWillUnmount",
|
|
1107
|
+
value: function componentWillUnmount() {
|
|
1108
|
+
clearTimeout(this.nestedCloseTimer);
|
|
1109
|
+
window.removeEventListener("resize", this.measureScrollContainer);
|
|
1110
|
+
if (this.scrollContainer) {
|
|
1111
|
+
this.scrollContainer.removeEventListener("scroll", this.handleCardScroll);
|
|
1112
|
+
this.scrollContainer = null;
|
|
1113
|
+
}
|
|
1114
|
+
if (this.scrollObserver) {
|
|
1115
|
+
this.scrollObserver.disconnect();
|
|
1116
|
+
this.scrollObserver = null;
|
|
1117
|
+
}
|
|
678
1118
|
}
|
|
679
1119
|
}, {
|
|
680
1120
|
key: "toggleExtraDetails",
|
|
681
1121
|
value: function toggleExtraDetails(e, idx) {
|
|
1122
|
+
var _this2 = this;
|
|
1123
|
+
clearTimeout(this.nestedCloseTimer);
|
|
682
1124
|
if (this.state.showExtraRow !== idx) {
|
|
683
1125
|
this.setState({
|
|
684
|
-
showExtraRow: idx
|
|
1126
|
+
showExtraRow: idx,
|
|
1127
|
+
closingExtraRow: null
|
|
685
1128
|
});
|
|
686
1129
|
} else {
|
|
687
1130
|
this.setState({
|
|
688
|
-
showExtraRow: null
|
|
1131
|
+
showExtraRow: null,
|
|
1132
|
+
closingExtraRow: idx
|
|
689
1133
|
});
|
|
1134
|
+
this.nestedCloseTimer = setTimeout(function () {
|
|
1135
|
+
_this2.setState({
|
|
1136
|
+
closingExtraRow: null
|
|
1137
|
+
});
|
|
1138
|
+
}, NESTED_REVEAL_MS);
|
|
690
1139
|
}
|
|
691
1140
|
this.props.onToggleExtraDetails(e, idx);
|
|
692
1141
|
}
|
|
@@ -698,13 +1147,17 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
698
1147
|
}, {
|
|
699
1148
|
key: "componentWillReceiveProps",
|
|
700
1149
|
value: function componentWillReceiveProps(newProps) {
|
|
1150
|
+
clearTimeout(this.nestedCloseTimer);
|
|
701
1151
|
this.setState({
|
|
702
|
-
showExtraRow: null
|
|
1152
|
+
showExtraRow: null,
|
|
1153
|
+
closingExtraRow: null
|
|
703
1154
|
});
|
|
704
1155
|
this.columns = this.getColumns(newProps);
|
|
1156
|
+
var columnWidths = this.reconcileColumnWidths(this.columns);
|
|
705
1157
|
var spiltColumns = this.spiltColumns();
|
|
706
1158
|
var updatedData = this.applyRowChecked(this.state.items, newProps.items);
|
|
707
1159
|
this.setState({
|
|
1160
|
+
columnWidths: columnWidths,
|
|
708
1161
|
defaultShowColumns: spiltColumns.defaultShowColumns,
|
|
709
1162
|
extraColumns: spiltColumns.extraColumns,
|
|
710
1163
|
nestedTable: spiltColumns.nestedTable,
|
|
@@ -787,7 +1240,7 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
787
1240
|
}, {
|
|
788
1241
|
key: "execute",
|
|
789
1242
|
value: function execute(allChecked) {
|
|
790
|
-
var
|
|
1243
|
+
var _this3 = this;
|
|
791
1244
|
if (allChecked) {
|
|
792
1245
|
this.state.items.map(function (itemSelectedRows, i) {
|
|
793
1246
|
itemSelectedRows.rowChecked = true;
|
|
@@ -798,7 +1251,7 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
798
1251
|
});
|
|
799
1252
|
var commonActions = this.findCommon(this.state.items);
|
|
800
1253
|
var commonDisplayActions = commonActions.filter(function (value) {
|
|
801
|
-
return
|
|
1254
|
+
return _this3.props.dashboard_common_actions.includes(value);
|
|
802
1255
|
});
|
|
803
1256
|
var n = this.state.items.length;
|
|
804
1257
|
var numberArray = [];
|
|
@@ -931,7 +1384,7 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
931
1384
|
}, {
|
|
932
1385
|
key: "allRowCheckChange",
|
|
933
1386
|
value: function allRowCheckChange(e, value) {
|
|
934
|
-
var
|
|
1387
|
+
var _this4 = this;
|
|
935
1388
|
/*
|
|
936
1389
|
* var table = e.target.parentNode.parentNode.parentNode.parentNode.parentNode
|
|
937
1390
|
* console.log(table );
|
|
@@ -955,13 +1408,13 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
955
1408
|
});
|
|
956
1409
|
this.setState(function (prevState) {
|
|
957
1410
|
return {
|
|
958
|
-
selectedRows:
|
|
1411
|
+
selectedRows: _this4.props.items.map(function (item, idx) {
|
|
959
1412
|
return idx;
|
|
960
1413
|
}),
|
|
961
1414
|
isAllRowsSelected: true
|
|
962
1415
|
};
|
|
963
1416
|
}, function () {
|
|
964
|
-
|
|
1417
|
+
_this4.props.rowSelectionChange(_this4.state.selectedRows);
|
|
965
1418
|
});
|
|
966
1419
|
} else {
|
|
967
1420
|
/*
|
|
@@ -983,7 +1436,7 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
983
1436
|
isAllRowsSelected: false
|
|
984
1437
|
};
|
|
985
1438
|
}, function () {
|
|
986
|
-
|
|
1439
|
+
_this4.props.rowSelectionChange(_this4.state.selectedRows);
|
|
987
1440
|
});
|
|
988
1441
|
}
|
|
989
1442
|
}
|
|
@@ -1049,19 +1502,25 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
1049
1502
|
} else {
|
|
1050
1503
|
if (this.state.items.length == 0) {
|
|
1051
1504
|
if (this.props.tableLoading === false) {
|
|
1052
|
-
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(Table.Element,
|
|
1505
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(Table.Element, (0, _extends2["default"])({}, this.props, {
|
|
1506
|
+
style: this.getTableStyle()
|
|
1507
|
+
}), /*#__PURE__*/_react["default"].createElement(Table.Header, (0, _extends2["default"])({
|
|
1053
1508
|
theme: this.props.theme,
|
|
1054
1509
|
columns: this.defaultShowColumns,
|
|
1055
1510
|
selectedColumns: this.state.showColumnArr,
|
|
1056
|
-
onSort: this.props.onSort
|
|
1057
|
-
|
|
1511
|
+
onSort: this.props.onSort,
|
|
1512
|
+
fillerColumnIndex: this.getFillerIndex()
|
|
1513
|
+
}, this.getColumnResizeProps()))), /*#__PURE__*/_react["default"].createElement(_TableErrorScreen["default"], null));
|
|
1058
1514
|
} else {
|
|
1059
|
-
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(Table.Element,
|
|
1515
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(Table.Element, (0, _extends2["default"])({}, this.props, {
|
|
1516
|
+
style: this.getTableStyle()
|
|
1517
|
+
}), /*#__PURE__*/_react["default"].createElement(Table.Header, (0, _extends2["default"])({
|
|
1060
1518
|
theme: this.props.theme,
|
|
1061
1519
|
columns: this.defaultShowColumns,
|
|
1062
1520
|
selectedColumns: this.state.showColumnArr,
|
|
1063
|
-
onSort: this.props.onSort
|
|
1064
|
-
|
|
1521
|
+
onSort: this.props.onSort,
|
|
1522
|
+
fillerColumnIndex: this.getFillerIndex()
|
|
1523
|
+
}, this.getColumnResizeProps()))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
1065
1524
|
style: {
|
|
1066
1525
|
padding: "10px"
|
|
1067
1526
|
}
|
|
@@ -1073,7 +1532,7 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
1073
1532
|
}, {
|
|
1074
1533
|
key: "render",
|
|
1075
1534
|
value: function render() {
|
|
1076
|
-
var
|
|
1535
|
+
var _this5 = this;
|
|
1077
1536
|
var _this$props3 = this.props,
|
|
1078
1537
|
theme = _this$props3.theme,
|
|
1079
1538
|
refreshDashboard = _this$props3.refreshDashboard,
|
|
@@ -1094,82 +1553,84 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
1094
1553
|
nestedTable = _this$state2.nestedTable,
|
|
1095
1554
|
searchedText = _this$state2.searchedText,
|
|
1096
1555
|
items = _this$state2.items;
|
|
1556
|
+
this.pinnedOffsets = this.getPinnedOffsets();
|
|
1557
|
+
var fillerIndex = this.getFillerIndex();
|
|
1558
|
+
var hasSlack = fillerIndex > -1;
|
|
1559
|
+
var _this$state3 = this.state,
|
|
1560
|
+
viewportWidth = _this$state3.viewportWidth,
|
|
1561
|
+
scrollContentWidth = _this$state3.scrollContentWidth;
|
|
1562
|
+
var frozenLeft = this.frozenWidths ? this.frozenWidths.left : 0;
|
|
1563
|
+
var frozenRight = this.frozenWidths ? this.frozenWidths.right : 0;
|
|
1564
|
+
var showScrollProxy = !!(viewportWidth && scrollContentWidth && scrollContentWidth > viewportWidth);
|
|
1565
|
+
var proxyWidth = Math.max(viewportWidth - frozenLeft - frozenRight, 0);
|
|
1566
|
+
var proxyContentWidth = Math.max(scrollContentWidth - frozenLeft - frozenRight, 0);
|
|
1097
1567
|
var rows = this.state.items.map(function (item, index) {
|
|
1098
1568
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
|
|
1099
1569
|
key: index
|
|
1100
1570
|
}, /*#__PURE__*/_react["default"].createElement(Table.Row, {
|
|
1101
|
-
theme:
|
|
1571
|
+
theme: _this5.props.theme,
|
|
1102
1572
|
key: index,
|
|
1103
1573
|
className: item.rowChecked ? "selected-row " + (item._divider_ ? "divider-row" : "") : item._divider_ ? "divider-row" : ""
|
|
1104
|
-
},
|
|
1105
|
-
var cellRenderer = column.children ||
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1574
|
+
}, _this5.defaultShowColumns.map(function (column, columnIndex) {
|
|
1575
|
+
var cellRenderer = column.children || _this5.defaultCellRenderer;
|
|
1576
|
+
var filler = columnIndex === fillerIndex ? _this5.renderFillerCell("".concat(index, "-filler")) : null;
|
|
1577
|
+
if (_this5.state.showColumnArr.indexOf(column.field) > -1) {
|
|
1578
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
|
|
1579
|
+
key: index + "-" + column.title
|
|
1580
|
+
}, filler, /*#__PURE__*/_react["default"].createElement(Table.Cell, {
|
|
1581
|
+
className: _this5.getColumnClassName(column, "table-cell"),
|
|
1582
|
+
theme: _this5.props.theme,
|
|
1111
1583
|
maxWidth: column.maxWidth,
|
|
1112
1584
|
column: {
|
|
1113
1585
|
column: column,
|
|
1114
|
-
width: column
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1586
|
+
width: _this5.getColumnWidth(column)
|
|
1587
|
+
},
|
|
1588
|
+
style: _this5.getColumnStyle(column)
|
|
1589
|
+
}, cellRenderer(item, column, index)));
|
|
1117
1590
|
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1591
|
+
return filler;
|
|
1592
|
+
}), fillerIndex >= _this5.defaultShowColumns.length && _this5.renderFillerCell("".concat(index, "-filler-end"))), (_this5.state.showExtraRow === index || _this5.state.closingExtraRow === index) && _this5.hasNestedRows(item) ? /*#__PURE__*/_react["default"].createElement(Table.Row, {
|
|
1593
|
+
theme: _this5.props.theme,
|
|
1120
1594
|
key: "row-" + index + "extra"
|
|
1121
1595
|
}, /*#__PURE__*/_react["default"].createElement(Table.Cell, {
|
|
1122
1596
|
className: "table-inner-cell",
|
|
1123
|
-
theme:
|
|
1597
|
+
theme: _this5.props.theme,
|
|
1124
1598
|
column: {},
|
|
1125
|
-
|
|
1599
|
+
maxWidth: "none",
|
|
1600
|
+
colSpan: _this5.defaultShowColumns.length + (hasSlack ? 1 : 0)
|
|
1126
1601
|
// className="tableHolder"
|
|
1127
|
-
},
|
|
1128
|
-
|
|
1602
|
+
}, /*#__PURE__*/_react["default"].createElement(NestedRowReveal, {
|
|
1603
|
+
open: _this5.state.showExtraRow === index
|
|
1604
|
+
}, _this5.hasNestedRows(item) ? /*#__PURE__*/_react["default"].createElement(NestedTableHolder, {
|
|
1605
|
+
className: "nested-table-holder",
|
|
1606
|
+
style: _this5.state.viewportWidth ? {
|
|
1607
|
+
width: "".concat(_this5.state.viewportWidth, "px")
|
|
1608
|
+
} : undefined
|
|
1609
|
+
}, /*#__PURE__*/_react["default"].createElement(Table.Card, {
|
|
1610
|
+
theme: _this5.props.theme,
|
|
1129
1611
|
width: "100%"
|
|
1130
1612
|
}, /*#__PURE__*/_react["default"].createElement(TableInner.Element, {
|
|
1131
|
-
theme:
|
|
1613
|
+
theme: _this5.props.theme,
|
|
1132
1614
|
className: "nested-table"
|
|
1133
1615
|
}, /*#__PURE__*/_react["default"].createElement(Table.Header, {
|
|
1134
|
-
theme:
|
|
1616
|
+
theme: _this5.props.theme,
|
|
1135
1617
|
columns: item[nestedTable[0].field].column_elements,
|
|
1136
1618
|
selectedColumns: item[nestedTable[0].field].column_elements.map(function (column) {
|
|
1137
1619
|
return column.field;
|
|
1138
1620
|
})
|
|
1139
1621
|
}), item[nestedTable[0].field].rows.map(function (element, i) {
|
|
1140
1622
|
return /*#__PURE__*/_react["default"].createElement(Table.Body, {
|
|
1141
|
-
theme:
|
|
1623
|
+
theme: _this5.props.theme,
|
|
1142
1624
|
key: "nested-table-".concat(i)
|
|
1143
1625
|
}, /*#__PURE__*/_react["default"].createElement("tr", null, item[nestedTable[0].field].column_elements.map(function (inner) {
|
|
1144
|
-
var cellRenderer = inner.children ||
|
|
1626
|
+
var cellRenderer = inner.children || _this5.defaultCellRenderer;
|
|
1145
1627
|
return /*#__PURE__*/_react["default"].createElement(TableInner.Cell, {
|
|
1146
|
-
theme:
|
|
1628
|
+
theme: _this5.props.theme,
|
|
1147
1629
|
key: inner.title + "n",
|
|
1148
1630
|
column: inner
|
|
1149
1631
|
}, cellRenderer(element, inner, i));
|
|
1150
1632
|
})));
|
|
1151
|
-
}))) : null
|
|
1152
|
-
width: "100%"
|
|
1153
|
-
}), /*#__PURE__*/_react["default"].createElement(TableInner.Element, _this4.props, /*#__PURE__*/_react["default"].createElement(Table.Header, {
|
|
1154
|
-
theme: _this4.props.theme,
|
|
1155
|
-
columns: _this4.extraColumns,
|
|
1156
|
-
selectedColumns: _this4.extraColumns.map(function (column) {
|
|
1157
|
-
return column.field;
|
|
1158
|
-
})
|
|
1159
|
-
// displayAs="extraDetails"
|
|
1160
|
-
,
|
|
1161
|
-
onSort: _this4.props.onSort
|
|
1162
|
-
}), /*#__PURE__*/_react["default"].createElement(Table.Body, null, /*#__PURE__*/_react["default"].createElement(Table.Row, {
|
|
1163
|
-
theme: _this4.props.theme,
|
|
1164
|
-
key: "row-" + index + "child"
|
|
1165
|
-
}, _this4.extraColumns.map(function (column) {
|
|
1166
|
-
var cellRenderer = column.children || _this4.defaultCellRenderer;
|
|
1167
|
-
return /*#__PURE__*/_react["default"].createElement(TableInner.Cell, {
|
|
1168
|
-
theme: _this4.props.theme,
|
|
1169
|
-
key: column.title + "c",
|
|
1170
|
-
column: column
|
|
1171
|
-
}, cellRenderer(item, column, index));
|
|
1172
|
-
}))))))) : null);
|
|
1633
|
+
})))) : null))) : null);
|
|
1173
1634
|
});
|
|
1174
1635
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, showTableHeader && /*#__PURE__*/_react["default"].createElement(Table.Title, {
|
|
1175
1636
|
style: {
|
|
@@ -1201,13 +1662,13 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
1201
1662
|
label: "Search",
|
|
1202
1663
|
value: searchedText,
|
|
1203
1664
|
onChange: function onChange(e) {
|
|
1204
|
-
|
|
1205
|
-
|
|
1665
|
+
_this5.props.tableLoadingActionFunc(true);
|
|
1666
|
+
_this5.handleInputChange(e.target.value);
|
|
1206
1667
|
}
|
|
1207
1668
|
}), searchedText && searchedText.length && /*#__PURE__*/_react["default"].createElement("span", {
|
|
1208
1669
|
className: "close-icon-wrapper",
|
|
1209
1670
|
onClick: function onClick() {
|
|
1210
|
-
return
|
|
1671
|
+
return _this5.tableOperation("clearInput");
|
|
1211
1672
|
}
|
|
1212
1673
|
}, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
|
|
1213
1674
|
theme: this.props.theme,
|
|
@@ -1252,7 +1713,7 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
1252
1713
|
}), (!tableLoading || tableLoadingAction) && /*#__PURE__*/_react["default"].createElement("div", {
|
|
1253
1714
|
className: "".concat(isRefreshActivated ? "refresh-btn active" : "refresh-btn"),
|
|
1254
1715
|
onClick: function onClick() {
|
|
1255
|
-
return
|
|
1716
|
+
return _this5.tableOperation("refresh");
|
|
1256
1717
|
}
|
|
1257
1718
|
}, /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
1258
1719
|
theme: this.props.theme,
|
|
@@ -1326,20 +1787,20 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
1326
1787
|
name: "example2",
|
|
1327
1788
|
type: "label",
|
|
1328
1789
|
onChange: function onChange(e) {
|
|
1329
|
-
|
|
1790
|
+
_this5.showCloumnCheckChange(e.target.value, e.target.checked);
|
|
1330
1791
|
},
|
|
1331
1792
|
align: "horizontal",
|
|
1332
1793
|
selected: this.state.showColumnArr ? this.state.showColumnArr : []
|
|
1333
1794
|
}, this.columns ? this.columns.map(function (item) {
|
|
1334
1795
|
return /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
|
|
1335
|
-
theme:
|
|
1796
|
+
theme: _this5.props.theme,
|
|
1336
1797
|
value: item.field
|
|
1337
1798
|
}, item.title);
|
|
1338
1799
|
}) : null)))))))), rows.length && this.state.showColumnArr[0] === "rowChecked" && this.props.selectAllRows && !tableLoading ? /*#__PURE__*/_react["default"].createElement(SelectAllButton, {
|
|
1339
1800
|
theme: this.props.theme,
|
|
1340
1801
|
isActive: !this.state.isAllRowsSelected,
|
|
1341
1802
|
onClick: function onClick(e) {
|
|
1342
|
-
|
|
1803
|
+
_this5.execute(!_this5.state.isAllRowsSelected);
|
|
1343
1804
|
}
|
|
1344
1805
|
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
1345
1806
|
className: "input-select-all-button",
|
|
@@ -1349,43 +1810,45 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
1349
1810
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
1350
1811
|
className: "span-select-all-button"
|
|
1351
1812
|
}))) : null, /*#__PURE__*/_react["default"].createElement(Table.Card, (0, _extends2["default"])({
|
|
1352
|
-
theme: this.props.theme
|
|
1353
|
-
className: "table-card"
|
|
1813
|
+
theme: this.props.theme
|
|
1354
1814
|
}, this.props, {
|
|
1815
|
+
className: "table-card ".concat(this.props.className || ""),
|
|
1355
1816
|
width: "100%",
|
|
1356
1817
|
radius: 2
|
|
1357
|
-
}), this.state.commonActionsSelected.length > 0 ? /*#__PURE__*/_react["default"].createElement(
|
|
1818
|
+
}), this.state.commonActionsSelected.length > 0 ? /*#__PURE__*/_react["default"].createElement(SelectedActionRail, {
|
|
1819
|
+
className: "selected-action-rail"
|
|
1820
|
+
}, /*#__PURE__*/_react["default"].createElement(Table.SelectedAction, {
|
|
1358
1821
|
theme: this.props.theme,
|
|
1359
1822
|
className: this.state.selectedRows.length > 0 && this.state.commonActionsSelected.length > 0 ? "selectedAction show" : "selectedAction"
|
|
1360
1823
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1361
1824
|
className: "action-icons-common"
|
|
1362
1825
|
}, this.state.commonActionsSelected.map(function (item, idx) {
|
|
1363
1826
|
return item !== "play" ? /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
1364
|
-
theme:
|
|
1827
|
+
theme: _this5.props.theme,
|
|
1365
1828
|
className: "action-button " + (item === "play" ? "play" : "default"),
|
|
1366
1829
|
key: idx,
|
|
1367
1830
|
onClick: function onClick(e) {
|
|
1368
|
-
if (
|
|
1831
|
+
if (_this5.props.commonActionClickHandler) {
|
|
1369
1832
|
if (item !== 'restore') {
|
|
1370
1833
|
items.map(function (ele) {
|
|
1371
1834
|
return ele.rowChecked = false;
|
|
1372
1835
|
});
|
|
1373
1836
|
}
|
|
1374
|
-
|
|
1375
|
-
ingestedDbIdArray:
|
|
1376
|
-
var
|
|
1377
|
-
return (
|
|
1837
|
+
_this5.setState(_objectSpread(_objectSpread({}, _this5.state), {}, {
|
|
1838
|
+
ingestedDbIdArray: _this5.props.bulkRestoreAllowed ? _this5.state.selectedRows.map(function (index) {
|
|
1839
|
+
var _this5$state$items$in;
|
|
1840
|
+
return (_this5$state$items$in = _this5.state.items[index]) === null || _this5$state$items$in === void 0 ? void 0 : _this5$state$items$in.ingest_db_id;
|
|
1378
1841
|
}) : [],
|
|
1379
1842
|
isAllRowsSelected: false,
|
|
1380
|
-
commonActionsSelected:
|
|
1381
|
-
selectedRows:
|
|
1843
|
+
commonActionsSelected: _this5.props.bulkRestoreAllowed ? _this5.state.commonActionsSelected : [],
|
|
1844
|
+
selectedRows: _this5.props.bulkRestoreAllowed ? _this5.state.selectedRows : []
|
|
1382
1845
|
}));
|
|
1383
1846
|
switch (item) {
|
|
1384
1847
|
case 'restore':
|
|
1385
|
-
|
|
1848
|
+
_this5.props.actionClickHandler('restoreCommon', _this5.state.ingestedDbIdArray);
|
|
1386
1849
|
break;
|
|
1387
1850
|
default:
|
|
1388
|
-
|
|
1851
|
+
_this5.props.commonActionClickHandler(item, e, _this5.state.ingestedDbIdArray, "common-action");
|
|
1389
1852
|
break;
|
|
1390
1853
|
}
|
|
1391
1854
|
} else {
|
|
@@ -1397,16 +1860,33 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
1397
1860
|
icon: _permissionIconMap["default"][item],
|
|
1398
1861
|
iconWidth: 10,
|
|
1399
1862
|
iconHeight: 10,
|
|
1400
|
-
label:
|
|
1863
|
+
label: _this5.props.actionLable && _this5.props.actionLable[item] ? _this5.props.actionLable[item] : item,
|
|
1401
1864
|
width: 24,
|
|
1402
1865
|
height: 24
|
|
1403
1866
|
}) : null;
|
|
1404
|
-
})))) : null, rows.length ? /*#__PURE__*/_react["default"].createElement(Table.Element,
|
|
1867
|
+
})))) : null, rows.length ? /*#__PURE__*/_react["default"].createElement(Table.Element, (0, _extends2["default"])({}, this.props, {
|
|
1868
|
+
ref: this.tableElementRef,
|
|
1869
|
+
style: this.getTableStyle()
|
|
1870
|
+
}), /*#__PURE__*/_react["default"].createElement(Table.Header, (0, _extends2["default"])({
|
|
1405
1871
|
theme: this.props.theme,
|
|
1406
|
-
columns: this.defaultShowColumns
|
|
1872
|
+
columns: this.defaultShowColumns
|
|
1873
|
+
}, this.getColumnResizeProps(), {
|
|
1874
|
+
fillerColumnIndex: fillerIndex,
|
|
1407
1875
|
selectedColumns: !tableLoading || tableLoading && tableLoadingAction ? this.state.showColumnArr : [],
|
|
1408
1876
|
onSort: this.props.onSort
|
|
1409
|
-
}), /*#__PURE__*/_react["default"].createElement(Table.Body, null, rows)) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, this.returnTableStatus())
|
|
1877
|
+
})), /*#__PURE__*/_react["default"].createElement(Table.Body, null, rows)) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, this.returnTableStatus()), showScrollProxy && /*#__PURE__*/_react["default"].createElement(ScrollProxy, {
|
|
1878
|
+
className: "table-scroll-proxy",
|
|
1879
|
+
ref: this.scrollProxyRef,
|
|
1880
|
+
onScroll: this.handleProxyScroll,
|
|
1881
|
+
style: {
|
|
1882
|
+
left: "".concat(frozenLeft, "px"),
|
|
1883
|
+
width: "".concat(proxyWidth, "px")
|
|
1884
|
+
}
|
|
1885
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1886
|
+
style: {
|
|
1887
|
+
width: "".concat(proxyContentWidth, "px")
|
|
1888
|
+
}
|
|
1889
|
+
}))));
|
|
1410
1890
|
}
|
|
1411
1891
|
}]);
|
|
1412
1892
|
}(_react.Component);
|
|
@@ -1416,17 +1896,18 @@ var SearchContainer = _styledComponents["default"].div(_templateObject || (_temp
|
|
|
1416
1896
|
var AvatarBox = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n & .avatar-details {\n display: none;\n }\n\n .initial-placeholder {\n background: #78909c;\n width: 24px;\n height: 24px;\n text-align: center;\n border-radius: 100%;\n font-size: 12px;\n color: #fff;\n }\n"])));
|
|
1417
1897
|
var EditableColumn = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n background-color: #121d28;\n border: 1px solid #121d28;\n padding: 7px;\n border-radius: 50%;\n cursor: pointer;\n transition: all 0.2s ease;\n\n &:hover {\n svg path {\n fill: white;\n }\n .tooltip {\n display: flex;\n }\n }\n"])));
|
|
1418
1898
|
var Tooltip = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n top: -35px; /* Adjust if needed */\n left: 50%;\n transform: translateX(-50%);\n display: none;\n width: max-content;\n height: 25px;\n padding: 5px 10px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 10px;\n flex-shrink: 0;\n background-color: #ffffff;\n color: #0c141d;\n font-family: \"SFUIText-Regular\";\n font-size: 12px;\n border-radius: 4px;\n z-index: 999;\n\n &:after {\n content: \"\";\n position: absolute;\n bottom: -6px;\n left: 50%;\n transform: translateX(-50%);\n border-top: 6px dashed #ffffff;\n border-right: 6px solid transparent;\n border-left: 6px solid transparent;\n }\n"])));
|
|
1419
|
-
|
|
1899
|
+
var SelectedActionRail = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n position: sticky;\n left: 0;\n z-index: 2;\n width: 0;\n height: 0;\n"])));
|
|
1900
|
+
Table.SelectedAction = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n\n position: absolute;\n top: 0;\n left: 55px;\n width: 0px;\n overflow: hidden;\n transition: all 0.4s ease;\n height: 38px;\n background: ", ";\n display: flex;\n align-items: center;\n &.show{\n width: 146px;\n overflow: visible;\n }\n\n div.action-icons-common{\n display: flex;\n align-items: center;\n position: relative;\n top: -2px;\n white-space: nowrap;\n &>button{\n margin-right: 15px;\n display: inline-flex;\n }\n &>button:last-child{\n margin-right: 0px;\n }\n\n .tooltip-container{\n display: inline-block;\n margin: 0px 5px;\n }\n\n .action-button{\n // padding: 0px;\n // border-radius: 50%;\n // -webkit-appearance: none;\n // cursor:pointer;\n // align-items: center;\n // justify-content: center;\n // height: 25px;\n // width: 25px;\n\n &.default{\n //background: #666666;\n //border:1px solid #666666;\n &:hover{\n //background: #8e8e8e;\n //border:1px solid #8e8e8e;\n }\n }\n &.play{\n background: ", ";\n border:1px solid ", ";\n &:hover{\n background: #39cac2;\n border:1px solid #39cac2;\n }\n }\n }\n\n"])), function (props) {
|
|
1420
1901
|
return _tokens.colors[props.theme].table.background;
|
|
1421
1902
|
}, function (props) {
|
|
1422
1903
|
return _tokens.colors[props.theme].table.otherThemeShade;
|
|
1423
1904
|
}, function (props) {
|
|
1424
1905
|
return _tokens.colors[props.theme].table.otherThemeShade;
|
|
1425
1906
|
});
|
|
1426
|
-
Table.Card = (0, _styledComponents["default"])(_card["default"])(
|
|
1907
|
+
Table.Card = (0, _styledComponents["default"])(_card["default"])(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n height: 100%;\n overflow-x: auto;\n scrollbar-width: thin;\n scrollbar-color: rgba(255, 255, 255, 0.22) transparent;\n &.table-card {\n scrollbar-width: none;\n -ms-overflow-style: none;\n }\n\n &.table-card::-webkit-scrollbar {\n display: none;\n }\n // overflow-y: hidden;\n margin: 10px 0;\n /* box-shadow: 0 0 10px 0 rgba(18, 29, 41); */\n box-shadow: 0 12px 24px 0 rgba(0, 0, 0, 0.1);\n position:relative\n\n ", "\n\ninput[type='checkbox']{ height: 0; width: 0; display:none;}\n\ninput[type='checkbox'] + label{\n position: relative;\n display: flex;\n margin:0;\n align-items: center;\n color: #9e9e9e;\n transition: color 250ms cubic-bezier(.4,.0,.23,1);\n}\ninput[type='checkbox'] + label > span{\n display: flex;\n justify-content: center;\n align-items: center;\n width: 20px;\n height: 20px;\n background: transparent;\n border: 1px solid #9E9E9E;\n border-radius: 50%;\n cursor: pointer; \n transition: all 250ms cubic-bezier(.4,.0,.23,1);\n}\n\n\ninput[type='checkbox'] + label:hover > span,\ninput[type='checkbox']:focus + label > span{\n background: rgba(255,255,255,.1);\n}\n\ninput[type='checkbox']:checked + label > span{\n border: 10px solid #49dad0\n animation: shrink-bounce 200ms cubic-bezier(.4,.0,.23,1);\n}\ninput[type='checkbox']:checked + label > span:before{\n content: \"\";\n position: absolute;\n top: 6px;\n left: 4px;\n border-right: 2px solid transparent;\n border-bottom: 2px solid transparent;\n transform: rotate(45deg);\n transform-origin: 0% 100%;\n animation: checkbox-check 125ms 250ms cubic-bezier(.4,.0,.23,1) forwards;\n}\n\n@keyframes shrink-bounce{\n 0%{\n transform: scale(1);\n }\n 33%{ \n transform: scale(.85);\n }\n 100%{\n transform: scale(1); \n }\n}\n@keyframes checkbox-check{\n 0%{\n width: 0;\n height: 0;\n border-color: #FFF;\n transform: translate3d(0,0,0) rotate(45deg);\n }\n 33%{\n width: 4px;\n height: 0;\n transform: translate3d(0,0,0) rotate(45deg);\n }\n 100%{ \n width: 4px;\n height: 9px; \n border-color: #FFF;\n transform: translate3d(0,-.5em,0) rotate(45deg);\n }\n}\n \n"])), function (props) {
|
|
1427
1908
|
// console.log(props.theme);
|
|
1428
1909
|
});
|
|
1429
|
-
Table.Title = _styledComponents["default"].div(
|
|
1910
|
+
Table.Title = _styledComponents["default"].div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 20px;\n .table-title {\n font-family: 'SFUIText-Medium';\n font-size: 18px;\n letter-spacing: 0.3px;\n color: ", ";\n }\n .title-right-area {\n display: flex;\n align-items: center;\n & > div {\n margin-left: 10px;\n }\n\n .refresh-section {\n position: relative;\n\n @keyframes glowing {\n 0% {\n box-shadow: 0 2px 8px 4px rgb(0 206 198 / 0%);\n }\n 15% {\n box-shadow: 0 2px 8px 4px rgb(0 206 198 / 54%);\n }\n 30% {\n box-shadow: 0 2px 8px 4px rgb(0 206 198 / 0%);\n }\n 45% {\n box-shadow: 0 2px 8px 4px rgb(0 206 198 / 54%);\n }\n 60% {\n box-shadow: 0 2px 8px 4px rgb(0 206 198 / 0%);\n }\n 75% {\n box-shadow: 0 2px 8px 4px rgb(0 206 198 / 54%);\n }\n 90% {\n box-shadow: 0 2px 8px 4px rgb(0 206 198 / 54%);\n }\n 100% {\n box-shadow: 0 8px 8px 0 rgba(18, 29, 41, 0.2);\n }\n }\n\n .red-dot {\n position: absolute;\n top: 0;\n right 0;\n width: 16px\n height: 16px;\n border-radius: 100%;\n background-color: rgba(255, 108, 86, 0.1);\n &:after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 6px;\n height: 6px;\n background-color: #FF6C56;\n border-radius: 100%;\n transform: translate(-50%, -50%);\n }\n \n }\n\n .tooltip {\n font-family: 'SFUIText-Regular';\n font-size: 12px;\n top: -38px;\n right: -66px;\n position: absolute;\n display: flex;\n justify-content: center;\n width: 170px;\n background-color: ", ";\n color: #0c141d;\n border-radius: 20px;\n padding: 10px 5px;\n &:after {\n content: '';\n border-top: 6px dashed ", ";\n border-right: 6px solid transparent;\n border-left: 6px solid transparent;\n position: absolute;\n bottom: -6px;\n right: 76px;\n }\n }\n\n .refresh-btn {\n background-color: #121d28;\n border: 1px solid #121d28;\n padding: 7px;\n border-radius: 50%;\n cursor: pointer;\n\n &:hover {\n path {\n fill: ", ";\n }\n cursor: ", ";\n }\n \n &.active {\n background-color: ", ";\n border-color: ", ";\n transition: all 0.2s ease-in-out;\n path {\n transition: all 0.2s ease-in-out;\n fill: #fff;\n }\n }\n\n &.active {\n animation: glowing 5000ms infinite;\n }\n\n > button {\n border: none;\n background-color: transparent;\n position: relative;\n path {\n fill: #afb2ba;\n }\n cursor: ", ";\n }\n }\n }\n }\n .column-show-holder {\n position: relative;\n text-align: left;\n\n .column-show-icon {\n width: 30px;\n height: 30px;\n background: #121d28;\n border-radius: 50%;\n padding: 7px 7px;\n\n &:hover {\n path {\n fill: #fff;\n transition: all 0.4s ease-out;\n }\n }\n }\n\n .column-show-list-box {\n position: absolute;\n display: none;\n //display:block;\n width: 345px;\n right: 0;\n z-index: 101;\n padding-top: 7px;\n top: 29px;\n\n & > div {\n box-shadow: 0 12px 24px 0 rgba(0, 0, 0, 1);\n }\n\n &:before {\n content: '';\n position: absolute;\n /* left: 42%; */\n /* top: 100%; */\n width: 0;\n height: 0;\n\n border-left: 4px solid transparent;\n border-right: 4px solid transparent;\n border-bottom: 6px solid ", ";\n transform: translate(327px, -6px);\n }\n\n .column-show-info {\n background: #182738;\n color: #afb2ba;\n font-family: 'SFUIText-Regular';\n padding: 15px;\n font-size: 12px;\n border-bottom: solid 1px #303f51;\n line-height: 15px;\n border-top-left-radius: 2px;\n border-top-right-radius: 2px;\n .column-show-info-header {\n font-family: SFUIText-Medium;\n font-size: 14px;\n padding-bottom: 5px;\n }\n }\n\n .column-show-list {\n background: #182738;\n color: #fff;\n padding: 5px;\n border-bottom-left-radius: 2px;\n border-bottom-right-radius: 2px;\n & .label {\n margin-right: 0px;\n\n & > input {\n & ~ span {\n color: #fff;\n background: #303f51;\n &:hover {\n background: #303f51;\n color: ", ";\n }\n }\n\n &:checked ~ span {\n background: ", ";\n &:hover {\n background: ", ";\n color: #fff;\n }\n }\n }\n }\n }\n }\n\n &:hover {\n .column-show-list-box {\n display: block;\n }\n }\n }\n"])), function (props) {
|
|
1430
1911
|
return _tokens.colors[props.theme].table.titleColor;
|
|
1431
1912
|
}, function (props) {
|
|
1432
1913
|
return _tokens.colors[props.theme].table.titleBackgroundColor;
|
|
@@ -1462,10 +1943,12 @@ Table.compare = {
|
|
|
1462
1943
|
return String(row1[column.field]) - String(row2[column.field]);
|
|
1463
1944
|
}
|
|
1464
1945
|
};
|
|
1465
|
-
Table.Element = _styledComponents["default"].table(
|
|
1946
|
+
Table.Element = _styledComponents["default"].table(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n border-spacing: 0;\n border-collapse: separate;\n ", "\n"])), function (props) {
|
|
1947
|
+
return props.resizableColumns ? "table-layout: fixed;" : "";
|
|
1948
|
+
});
|
|
1466
1949
|
var TableInner = {};
|
|
1467
|
-
TableInner.Element = _styledComponents["default"].table(
|
|
1468
|
-
TableInner.Cell = _styledComponents["default"].td(
|
|
1950
|
+
TableInner.Element = _styledComponents["default"].table(_templateObject0 || (_templateObject0 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n border-spacing: 0;\n border-collapse: collapse;\n"])));
|
|
1951
|
+
TableInner.Cell = _styledComponents["default"].td(_templateObject1 || (_templateObject1 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: \"SFUIText-Regular\";\n font-size: 12px;\n letter-spacing: 0.4px;\n color: ", ";\n padding: 7px 14px;\n border-top: 1px solid ", ";\n text-align: left;\n vertical-align: middle;\n line-height: 2;\n width: auto;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n width: ", ";\n max-width: ", ";\n\n & > div.text-box {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n &.text-linkexpired {\n color: #ff6c56;\n }\n }\n"])), function (props) {
|
|
1469
1952
|
return _tokens.colors[props.theme].table.InnerTdColor;
|
|
1470
1953
|
}, function (props) {
|
|
1471
1954
|
return _tokens.colors[props.theme].table.border;
|
|
@@ -1474,8 +1957,89 @@ TableInner.Cell = _styledComponents["default"].td(_templateObject0 || (_template
|
|
|
1474
1957
|
}, function (props) {
|
|
1475
1958
|
return props.maxWidth || "175px";
|
|
1476
1959
|
});
|
|
1477
|
-
|
|
1478
|
-
|
|
1960
|
+
var ExpandToggle = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n\n svg {\n transform: rotate(0deg);\n transform-origin: 50% 50%;\n transition: transform 0.25s ease-in-out;\n }\n\n &.is-expanded svg {\n transform: rotate(90deg);\n }\n\n\n @media (prefers-reduced-motion: reduce) {\n svg {\n transition: none;\n }\n }\n\n path {\n stroke-linecap: round;\n stroke-linejoin: round;\n transition: stroke 0.3s ease-out;\n }\n\n &:hover path {\n stroke: #60bef8;\n }\n"])));
|
|
1961
|
+
var NestedReveal = _styledComponents["default"].div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n transition: height ", "ms ease,\n opacity ", "ms ease;\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n"])), NESTED_REVEAL_MS, NESTED_REVEAL_MS);
|
|
1962
|
+
var NestedRowReveal = /*#__PURE__*/function (_Component2) {
|
|
1963
|
+
function NestedRowReveal(props) {
|
|
1964
|
+
var _this6;
|
|
1965
|
+
(0, _classCallCheck2["default"])(this, NestedRowReveal);
|
|
1966
|
+
_this6 = _callSuper(this, NestedRowReveal, [props]);
|
|
1967
|
+
(0, _defineProperty2["default"])(_this6, "currentHeight", function () {
|
|
1968
|
+
var el = _this6.revealRef.current;
|
|
1969
|
+
return el ? el.getBoundingClientRect().height : 0;
|
|
1970
|
+
});
|
|
1971
|
+
(0, _defineProperty2["default"])(_this6, "grow", function (from) {
|
|
1972
|
+
var el = _this6.revealRef.current;
|
|
1973
|
+
if (!el) {
|
|
1974
|
+
return;
|
|
1975
|
+
}
|
|
1976
|
+
clearTimeout(_this6.releaseTimer);
|
|
1977
|
+
el.style.overflow = "hidden";
|
|
1978
|
+
el.style.height = "".concat(from, "px");
|
|
1979
|
+
el.style.opacity = from > 0 ? "1" : "0";
|
|
1980
|
+
el.getBoundingClientRect();
|
|
1981
|
+
el.style.height = "".concat(el.scrollHeight, "px");
|
|
1982
|
+
el.style.opacity = "1";
|
|
1983
|
+
_this6.releaseTimer = setTimeout(function () {
|
|
1984
|
+
var node = _this6.revealRef.current;
|
|
1985
|
+
if (node) {
|
|
1986
|
+
node.style.height = "auto";
|
|
1987
|
+
node.style.overflow = "visible";
|
|
1988
|
+
}
|
|
1989
|
+
}, NESTED_REVEAL_MS);
|
|
1990
|
+
});
|
|
1991
|
+
(0, _defineProperty2["default"])(_this6, "shrink", function () {
|
|
1992
|
+
var el = _this6.revealRef.current;
|
|
1993
|
+
if (!el) {
|
|
1994
|
+
return;
|
|
1995
|
+
}
|
|
1996
|
+
clearTimeout(_this6.releaseTimer);
|
|
1997
|
+
el.style.overflow = "hidden";
|
|
1998
|
+
el.style.height = "".concat(_this6.currentHeight(), "px");
|
|
1999
|
+
el.getBoundingClientRect();
|
|
2000
|
+
el.style.height = "0px";
|
|
2001
|
+
el.style.opacity = "0";
|
|
2002
|
+
});
|
|
2003
|
+
_this6.revealRef = /*#__PURE__*/_react["default"].createRef();
|
|
2004
|
+
return _this6;
|
|
2005
|
+
}
|
|
2006
|
+
(0, _inherits2["default"])(NestedRowReveal, _Component2);
|
|
2007
|
+
return (0, _createClass2["default"])(NestedRowReveal, [{
|
|
2008
|
+
key: "componentDidMount",
|
|
2009
|
+
value: function componentDidMount() {
|
|
2010
|
+
this.grow(0);
|
|
2011
|
+
}
|
|
2012
|
+
}, {
|
|
2013
|
+
key: "componentDidUpdate",
|
|
2014
|
+
value: function componentDidUpdate(prevProps) {
|
|
2015
|
+
if (prevProps.open === this.props.open) {
|
|
2016
|
+
return;
|
|
2017
|
+
}
|
|
2018
|
+
if (this.props.open) {
|
|
2019
|
+
this.grow(this.currentHeight());
|
|
2020
|
+
} else {
|
|
2021
|
+
this.shrink();
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
}, {
|
|
2025
|
+
key: "componentWillUnmount",
|
|
2026
|
+
value: function componentWillUnmount() {
|
|
2027
|
+
clearTimeout(this.releaseTimer);
|
|
2028
|
+
}
|
|
2029
|
+
}, {
|
|
2030
|
+
key: "render",
|
|
2031
|
+
value: function render() {
|
|
2032
|
+
return /*#__PURE__*/_react["default"].createElement(NestedReveal, {
|
|
2033
|
+
ref: this.revealRef,
|
|
2034
|
+
className: "nested-reveal"
|
|
2035
|
+
}, this.props.children);
|
|
2036
|
+
}
|
|
2037
|
+
}]);
|
|
2038
|
+
}(_react.Component);
|
|
2039
|
+
var NestedTableHolder = _styledComponents["default"].div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n position: sticky;\n left: 0;\n box-sizing: border-box;\n max-width: 100%;\n padding: 7px 14px;\n"])));
|
|
2040
|
+
var ScrollProxy = _styledComponents["default"].div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n position: sticky;\n bottom: 0;\n z-index: 2;\n overflow-x: auto;\n overflow-y: hidden;\n height: 10px;\n scrollbar-width: thin;\n scrollbar-color: rgba(255, 255, 255, 0.22) transparent;\n\n &::-webkit-scrollbar {\n height: 8px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n background: rgba(255, 255, 255, 0.22);\n border-radius: 4px;\n }\n\n & > div {\n height: 1px;\n }\n"])));
|
|
2041
|
+
Table.Body = _styledComponents["default"].tbody(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
2042
|
+
Table.Row = _styledComponents["default"].tr(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["\n .show-row {\n transform: rotate(-180deg);\n -webkit-transform: rotate(-180deg);\n -moz-transform: rotate(-180deg);\n -ms-transform: rotate(-180deg);\n -o-transform: rotate(-180deg);\n }\n .hide-row {\n transform: rotate(0deg);\n -webkit-transform: rotate(0deg);\n -moz-transform: rotate(0deg);\n -ms-transform: rotate(0deg);\n -o-transform: rotate(0deg);\n }\n .show-row,\n .hide-row {\n transition: transform 0.5s ease-in-out;\n -webkit-transition: transform 0.5s ease-in-out;\n -moz-transition: transform 0.5s ease-in-out;\n -ms-transition: transform 0.5s ease-in-out;\n -o-transition: transform 0.5s ease-in-out;\n text-align: right;\n cursor: pointer;\n }\n\n &.selected-row > td,\n &.selected-row:nth-child(even) > td {\n background: ", ";\n }\n\n &:nth-child(even) > td {\n background: ", ";\n }\n\n &:hover {\n .asset-play {\n color: ", ";\n }\n }\n\n ", " {\n margin: 0px;\n box-shadow: 0px 0px 0px transparent;\n ", ";\n }\n"])), function (props) {
|
|
1479
2043
|
return _tokens.colors[props.theme].table.rowSelectedBackground;
|
|
1480
2044
|
}, function (props) {
|
|
1481
2045
|
return _tokens.colors[props.theme].table.evenRowBackground;
|
|
@@ -1484,7 +2048,7 @@ Table.Row = _styledComponents["default"].tr(_templateObject10 || (_templateObjec
|
|
|
1484
2048
|
}, Table.Card, function (props) {
|
|
1485
2049
|
if (typeof props.theme === "string") return "background:" + _tokens.colors[props.theme].table.innerTableBackground;
|
|
1486
2050
|
});
|
|
1487
|
-
Table.Cell = _styledComponents["default"].td(
|
|
2051
|
+
Table.Cell = _styledComponents["default"].td(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: 'SFUIText-Regular';\n font-size: 12px;\n letter-spacing: 0.4px;\n color: ", "; \n padding: 7px 14px;\n // border-top: 1px solid ", "; \n text-align: left;\n vertical-align: middle;\n line-height: 2;\n width: ", ";\n max-width: ", ";\n\n &.tableHolder{\n padding:0px;\n }\n &.table-inner-cell {\n padding: 0;\n }\n &.pinned-column {\n background: ", ";\n z-index: 1;\n }\n\n &.pinned-column:hover {\n z-index: 3;\n }\n\n &.pinned-left-edge {\n box-shadow: 6px 0 8px -6px rgba(0, 0, 0, 0.55);\n }\n\n &.pinned-right-edge {\n box-shadow: -6px 0 8px -6px rgba(0, 0, 0, 0.55);\n }\n\n .asset-play {\n cursor: pointer;\n background-color: transparent;\n border: none;\n color: #dddddd;\n &:hover, &:focus {\n outline: none;\n color: ", ";\n text-decoration: underline;\n }\n }\n\n .icon-circle {\n border-radius: 50%;\n width: 24px;\n height: 24px;\n display: flex;\n text-align: center;\n justify-content: center;\n align-items: center;\n i {\n line-height: 0;\n }\n }\n\n // max-width: 0;\n // overflow: hidden;\n // text-overflow: ellipsis;\n // white-space: nowrap;\n\n & > div.text-box {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n &.text-linkexpired {\n color: #FF6C56;\n }\n }\n & > div.action-icons-cell{\n white-space: nowrap;\n\n .tooltip-block {\n top: -50px;\n }\n \n .action-item-btn {\n padding: 0 15px;\n cursor: pointer;\n background-color: transparent;\n\n &.nested {\n border-bottom: 1px solid #303f51;\n display: flex;\n padding: 10px;\n align-items: center;\n &>div:first-child{\n margin-right:10px;\n }\n &:last-child{\n border-bottom: 0px none;\n }\n }\n\n &:hover {\n transition: color 0.4s ease-out;\n color: ", ";\n path{\n fill: ", ";\n transition: fill 0.4s ease-out;\n }\n }\n }\n\n\n &>button{\n margin-right: 15px;\n display: inline-flex;\n }\n &>button:last-child{\n margin-right: 0px;\n }\n\n .more-action-holder {\n position: relative;\n\n &:hover {\n .more-action-list-box{\n display:block;\n }\n .more-action-icon{\n transition: all 0.4s ease-out;\n background: ", ";\n }\n }\n\n .more-action-icon{\n height: 24px;\n width: 24px;\n background: #303f51;\n border-radius: 50%;\n padding: 0px 10px;\n transform: translate(0px, -1px);\n }\n .more-action-list-box{\n position: absolute;\n z-index:100;\n display:none;\n //display:block;\n padding-top: 11px;\n transform: translate(-136px,-2px);\n \n .more-action-list {\n box-shadow: 0 12px 24px 0 rgba(0, 0, 0, 0.2);\n background: ", ";\n min-width: 200px;\n }\n\n &:before{\n content: '';\n position: absolute;\n /* left: 42%; */\n /* top: 100%; */\n width: 0;\n height: 0;\n \n border-left: 4px solid transparent;\n border-right: 4px solid transparent;\n border-bottom: 6px solid ", ";\n transform: translate(144px,-6px);\n }\n\n }\n\n }\n }\n\n .nested-table {\n background: #182738;\n border-left: 2px solid ", ";\n }\n\n\n"])), function (props) {
|
|
1488
2052
|
return _tokens.colors[props.theme].table.tdColor;
|
|
1489
2053
|
}, function (props) {
|
|
1490
2054
|
return _tokens.colors[props.theme].table.border;
|
|
@@ -1492,6 +2056,8 @@ Table.Cell = _styledComponents["default"].td(_templateObject11 || (_templateObje
|
|
|
1492
2056
|
return props.column.width;
|
|
1493
2057
|
}, function (props) {
|
|
1494
2058
|
return props.maxWidth || "175px";
|
|
2059
|
+
}, function (props) {
|
|
2060
|
+
return _tokens.colors[props.theme].card.background;
|
|
1495
2061
|
}, function (props) {
|
|
1496
2062
|
return _tokens.colors[props.theme].table.CellHoverFocusColor;
|
|
1497
2063
|
}, function (props) {
|
|
@@ -1507,11 +2073,11 @@ Table.Cell = _styledComponents["default"].td(_templateObject11 || (_templateObje
|
|
|
1507
2073
|
}, function (props) {
|
|
1508
2074
|
return _tokens.colors[props.theme].table.CellNestedTableBorderLeft;
|
|
1509
2075
|
});
|
|
1510
|
-
var TableTitleLoadingInitial = _styledComponents["default"].div(
|
|
1511
|
-
var DubbingStatusStyles = _styledComponents["default"].div(
|
|
2076
|
+
var TableTitleLoadingInitial = _styledComponents["default"].div(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["\n height: 30px;\n position: absolute;\n left: -1px;\n z-index: 2;\n display: flex;\n width: 100%;\n top: -1px;\n"])));
|
|
2077
|
+
var DubbingStatusStyles = _styledComponents["default"].div(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n .detail-block {\n display: flex;\n justify-content: center;\n align-items: center;\n\n &:not(:last-child) {\n margin-right: 7px;\n }\n\n .status-color {\n width: 7px;\n height: 7px;\n margin-right: 6px;\n border-radius: 100%;\n background: rgba(255, 255, 255, 0.3);\n &.approved {\n background: ", ";\n }\n &.rejected {\n background: #ef5350;\n }\n }\n .language-name {\n text-transform: capitalize;\n font-size: 12px;\n font-family: SFUIText-Regular;\n color: #fff;\n }\n }\n"])), function (props) {
|
|
1512
2078
|
return _tokens.colors[props.theme].table.ApprovedBackground;
|
|
1513
2079
|
});
|
|
1514
|
-
var SelectAllButton = _styledComponents["default"].div(
|
|
2080
|
+
var SelectAllButton = _styledComponents["default"].div(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2["default"])(["\n width: 20px;\n height: 20px;\n background: transparent;\n border: ", ";\n border-radius: 50%;\n cursor: pointer;\n position: absolute;\n left: 14px;\n z-index: 2;\n top: 73px;\n .input-select-all-button {\n height: 0px;\n width: 0px;\n display: none;\n }\n .label-select-all-button {\n position: relative;\n cursor: pointer;\n display: flex;\n margin: 0px;\n height: 20px;\n align-items: center;\n border-radius: 50%;\n background: ", ";\n .span-select-all-button {\n display: ", ";\n position: absolute;\n top: 10px;\n left: 5px;\n border-right: 2px solid transparent;\n border-bottom: 2px solid transparent;\n transform: rotate(45deg);\n transform-origin: 0 100%;\n animation: ", ";\n }\n }\n"])), function (props) {
|
|
1515
2081
|
return props.isActive ? "1px solid #9E9E9E" : "";
|
|
1516
2082
|
}, function (props) {
|
|
1517
2083
|
return !props.isActive ? "#49dad0" : "";
|
|
@@ -1532,7 +2098,9 @@ Table.propTypes = {
|
|
|
1532
2098
|
showSearchBox: _propTypes["default"].bool,
|
|
1533
2099
|
handleUserIdFilterChange: _propTypes["default"].func,
|
|
1534
2100
|
userIdsList: _propTypes["default"].instanceOf(Object),
|
|
1535
|
-
pageDropdown: _propTypes["default"].instanceOf(Object)
|
|
2101
|
+
pageDropdown: _propTypes["default"].instanceOf(Object),
|
|
2102
|
+
resizableColumns: _propTypes["default"].bool,
|
|
2103
|
+
onColumnResize: _propTypes["default"].func
|
|
1536
2104
|
};
|
|
1537
2105
|
Table.defaultProps = {
|
|
1538
2106
|
theme: "dark",
|
|
@@ -1544,6 +2112,7 @@ Table.defaultProps = {
|
|
|
1544
2112
|
maxShowNoOfColumns: 8,
|
|
1545
2113
|
searchable: false,
|
|
1546
2114
|
selectable: false,
|
|
1547
|
-
showTableHeader: true
|
|
2115
|
+
showTableHeader: true,
|
|
2116
|
+
resizableColumns: false
|
|
1548
2117
|
};
|
|
1549
2118
|
var _default = exports["default"] = Table;
|