@luminati-io/uikit 3.4.10 → 3.4.12
Sign up to get free protection for your applications and to get access to all the features.
@@ -33111,7 +33111,18 @@ var DragDrop = function DragDrop(props) {
|
|
33111
33111
|
matrix = _removeItem.matrix,
|
33112
33112
|
item = _removeItem.item;
|
33113
33113
|
var newValue = addItem(matrix, dst_drop_id, +destination.index, item);
|
33114
|
-
|
33114
|
+
var info = {
|
33115
|
+
id: item,
|
33116
|
+
source: {
|
33117
|
+
section: src_drop_id,
|
33118
|
+
index: source.index
|
33119
|
+
},
|
33120
|
+
destination: {
|
33121
|
+
section: dst_drop_id,
|
33122
|
+
index: destination.index
|
33123
|
+
}
|
33124
|
+
};
|
33125
|
+
onChange(newValue, info);
|
33115
33126
|
}, [value, onChange]);
|
33116
33127
|
var itemsMap = (0,react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(function () {
|
33117
33128
|
return items.reduce(function (acc, item) {
|
@@ -33135,7 +33146,8 @@ var DragDrop = function DragDrop(props) {
|
|
33135
33146
|
isLast: i == value.length - 1,
|
33136
33147
|
containerDirection: direction,
|
33137
33148
|
Comp: props.CustomDrop,
|
33138
|
-
DragComp: props.CustomDrag
|
33149
|
+
DragComp: props.CustomDrag,
|
33150
|
+
EmptyComp: props.EmptyComp
|
33139
33151
|
});
|
33140
33152
|
})));
|
33141
33153
|
};
|
@@ -33284,6 +33296,7 @@ var DroppableArea = function DroppableArea(props) {
|
|
33284
33296
|
containerDirection = props.containerDirection;
|
33285
33297
|
var Comp = props.Comp || DropComp;
|
33286
33298
|
var DragComp = props.DragComp || _draggable__WEBPACK_IMPORTED_MODULE_6__.DraggableItem;
|
33299
|
+
var EmptyComp = props.EmptyComp || EmptyDrop;
|
33287
33300
|
var get_draggable = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (provided, snapshot, item) {
|
33288
33301
|
return /*#__PURE__*/React.createElement("div", _extends({}, provided.draggableProps, {
|
33289
33302
|
ref: provided.innerRef
|
@@ -33302,7 +33315,7 @@ var DroppableArea = function DroppableArea(props) {
|
|
33302
33315
|
}, function (drop_provided, drop_snapshot) {
|
33303
33316
|
return /*#__PURE__*/React.createElement("div", _extends({}, drop_provided.droppableProps, {
|
33304
33317
|
ref: drop_provided.innerRef
|
33305
|
-
}), items.map(function (item, i) {
|
33318
|
+
}), !(items !== null && items !== void 0 && items.length) && /*#__PURE__*/React.createElement(EmptyComp, null), items.map(function (item, i) {
|
33306
33319
|
return /*#__PURE__*/React.createElement(react_beautiful_dnd__WEBPACK_IMPORTED_MODULE_7__.Draggable, {
|
33307
33320
|
key: item.id,
|
33308
33321
|
draggableId: item.id,
|
@@ -33310,9 +33323,19 @@ var DroppableArea = function DroppableArea(props) {
|
|
33310
33323
|
}, function (provided, snapshot) {
|
33311
33324
|
return snapshot.isDragging && portal ? /*#__PURE__*/react_dom__WEBPACK_IMPORTED_MODULE_0___default().createPortal(get_draggable(provided, snapshot, item), portal.current) : get_draggable(provided, snapshot, item);
|
33312
33325
|
});
|
33313
|
-
}));
|
33326
|
+
}), drop_provided.placeholder);
|
33314
33327
|
}));
|
33315
33328
|
};
|
33329
|
+
var EmptyDrop = function EmptyDrop() {
|
33330
|
+
return /*#__PURE__*/React.createElement(_typography__WEBPACK_IMPORTED_MODULE_4__.Label, {
|
33331
|
+
color: "gray_8",
|
33332
|
+
variant: "xs",
|
33333
|
+
style: {
|
33334
|
+
fontStyle: 'italic',
|
33335
|
+
padding: '12px'
|
33336
|
+
}
|
33337
|
+
}, "Empty");
|
33338
|
+
};
|
33316
33339
|
var DropComp = function DropComp(props) {
|
33317
33340
|
return /*#__PURE__*/React.createElement(SectionFlex, {
|
33318
33341
|
flex_direction: "column",
|
@@ -37836,13 +37859,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
37836
37859
|
/* harmony import */ var _pinned_columns__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./pinned_columns */ "./src/table/pinned_columns.js");
|
37837
37860
|
/* harmony import */ var _expandable_rows__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./expandable_rows */ "./src/table/expandable_rows.js");
|
37838
37861
|
/* harmony import */ var _select_rows__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./select_rows */ "./src/table/select_rows.js");
|
37839
|
-
/* harmony import */ var
|
37862
|
+
/* harmony import */ var _row_menu__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./row_menu */ "./src/table/row_menu.js");
|
37863
|
+
/* harmony import */ var _order_logic__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./order_logic */ "./src/table/order_logic.js");
|
37840
37864
|
// LICENSE_CODE ZON
|
37841
37865
|
|
37842
37866
|
|
37843
37867
|
/*jslint react:true*/
|
37844
37868
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
37845
|
-
var _excluded = ["data", "columnsSort", "pageSize", "pageSizes", "children", "stateManager", "hooks", "NoDataComp", "LoadingComp", "ExpandHandleComp", "noDataText", "loadingText", "isLoading", "onPageChange", "manualPagination", "totalCount", "paginateExpandedRows", "getHeaderProps", "getColumnProps", "getRowProps", "getCellProps", "getFooterProps", "selectedRowIds", "canOrderColumns"];
|
37869
|
+
var _excluded = ["data", "columnsSort", "pageSize", "pageSizes", "children", "stateManager", "hooks", "NoDataComp", "LoadingComp", "ExpandHandleComp", "noDataText", "loadingText", "isLoading", "onPageChange", "manualPagination", "totalCount", "paginateExpandedRows", "getHeaderProps", "getColumnProps", "getRowProps", "getCellProps", "getFooterProps", "selectedRowIds", "canOrderColumns", "rowActions"];
|
37846
37870
|
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; }
|
37847
37871
|
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) { _defineProperty(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; }
|
37848
37872
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
@@ -37872,6 +37896,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
37872
37896
|
|
37873
37897
|
|
37874
37898
|
|
37899
|
+
|
37875
37900
|
var assign = Object.assign;
|
37876
37901
|
var defaultPropGetter = function defaultPropGetter() {
|
37877
37902
|
return {};
|
@@ -37932,6 +37957,7 @@ var Provider = function Provider(props) {
|
|
37932
37957
|
selectedRowIds = props.selectedRowIds,
|
37933
37958
|
_props$canOrderColumn = props.canOrderColumns,
|
37934
37959
|
canOrderColumns = _props$canOrderColumn === void 0 ? false : _props$canOrderColumn,
|
37960
|
+
rowActions = props.rowActions,
|
37935
37961
|
rest = _objectWithoutProperties(props, _excluded);
|
37936
37962
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(0),
|
37937
37963
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -37967,7 +37993,7 @@ var Provider = function Provider(props) {
|
|
37967
37993
|
getCellProps: getCellProps,
|
37968
37994
|
getFooterProps: getFooterProps,
|
37969
37995
|
ExpandHandleComp: ExpandHandleComp
|
37970
|
-
}, rest), useCanHideColumns, react_table__WEBPACK_IMPORTED_MODULE_2__.useExpanded, _expandable_rows__WEBPACK_IMPORTED_MODULE_9__.useExpandHandle, react_table__WEBPACK_IMPORTED_MODULE_2__.usePagination, props.fullWidth ? react_table__WEBPACK_IMPORTED_MODULE_2__.useFlexLayout : react_table__WEBPACK_IMPORTED_MODULE_2__.useBlockLayout, react_table__WEBPACK_IMPORTED_MODULE_2__.useResizeColumns, react_table__WEBPACK_IMPORTED_MODULE_2__.useColumnOrder, _pinned_columns__WEBPACK_IMPORTED_MODULE_8__.usePinnedColumns, _editable_columns__WEBPACK_IMPORTED_MODULE_7__.useEditableColumns, react_table__WEBPACK_IMPORTED_MODULE_2__.useRowSelect, _select_rows__WEBPACK_IMPORTED_MODULE_10__.useSelectRows].concat(_toConsumableArray(hooks)));
|
37996
|
+
}, rest), useCanHideColumns, react_table__WEBPACK_IMPORTED_MODULE_2__.useExpanded, _expandable_rows__WEBPACK_IMPORTED_MODULE_9__.useExpandHandle, react_table__WEBPACK_IMPORTED_MODULE_2__.usePagination, props.fullWidth ? react_table__WEBPACK_IMPORTED_MODULE_2__.useFlexLayout : react_table__WEBPACK_IMPORTED_MODULE_2__.useBlockLayout, react_table__WEBPACK_IMPORTED_MODULE_2__.useResizeColumns, react_table__WEBPACK_IMPORTED_MODULE_2__.useColumnOrder, _pinned_columns__WEBPACK_IMPORTED_MODULE_8__.usePinnedColumns, _editable_columns__WEBPACK_IMPORTED_MODULE_7__.useEditableColumns, react_table__WEBPACK_IMPORTED_MODULE_2__.useRowSelect, _select_rows__WEBPACK_IMPORTED_MODULE_10__.useSelectRows].concat(_toConsumableArray(rowActions !== null && rowActions !== void 0 && rowActions.length ? [_row_menu__WEBPACK_IMPORTED_MODULE_11__.useRowMenu] : []), _toConsumableArray(hooks)));
|
37971
37997
|
var _table$state = table.state,
|
37972
37998
|
pageIndex = _table$state.pageIndex,
|
37973
37999
|
_pageSize = _table$state.pageSize;
|
@@ -37984,14 +38010,15 @@ var Provider = function Provider(props) {
|
|
37984
38010
|
}, [manualPagination, totalCount, pageIndex, _pageSize]);
|
37985
38011
|
var _LoadingComp = useComp(loadingText, LoadingComp);
|
37986
38012
|
var _NoDataComp = useComp(noDataText, NoDataComp);
|
37987
|
-
var orderLogic = (0,
|
38013
|
+
var orderLogic = (0,_order_logic__WEBPACK_IMPORTED_MODULE_12__.useOrderLogic)(table);
|
37988
38014
|
var value = _objectSpread(_objectSpread({
|
37989
38015
|
columnsSort: columnsSort
|
37990
38016
|
}, table), {}, {
|
37991
38017
|
canOrderColumns: canOrderColumns,
|
37992
38018
|
orderLogic: orderLogic,
|
37993
38019
|
LoadingComp: _LoadingComp,
|
37994
|
-
NoDataComp: _NoDataComp
|
38020
|
+
NoDataComp: _NoDataComp,
|
38021
|
+
rowActions: rowActions
|
37995
38022
|
});
|
37996
38023
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(TableContext.Provider, {
|
37997
38024
|
value: value
|
@@ -38068,7 +38095,8 @@ Provider.propTypes = {
|
|
38068
38095
|
scrollTarget: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().any),
|
38069
38096
|
className: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
|
38070
38097
|
onSelectRows: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),
|
38071
|
-
canOrderColumns: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool)
|
38098
|
+
canOrderColumns: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool),
|
38099
|
+
rowActions: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().array)
|
38072
38100
|
};
|
38073
38101
|
var calcPageCount = function calcPageCount(totalCount, pageSize) {
|
38074
38102
|
return Math.ceil(totalCount / pageSize);
|
@@ -38141,12 +38169,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
38141
38169
|
|
38142
38170
|
/*jslint react:true*/
|
38143
38171
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
38172
|
+
var _excluded = ["Dragger", "isDragging"];
|
38173
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
38174
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
38175
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
38144
38176
|
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; }
|
38145
38177
|
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) { _defineProperty(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; }
|
38146
38178
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
38147
38179
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
38148
38180
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
38149
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
38150
38181
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
38151
38182
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
38152
38183
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
@@ -38167,7 +38198,9 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
38167
38198
|
|
38168
38199
|
var CustomizeButton = function CustomizeButton(props) {
|
38169
38200
|
var _useTableContext = (0,_context__WEBPACK_IMPORTED_MODULE_11__.useTableContext)(),
|
38170
|
-
allColumns = _useTableContext.allColumns
|
38201
|
+
allColumns = _useTableContext.allColumns,
|
38202
|
+
canOrderColumns = _useTableContext.canOrderColumns,
|
38203
|
+
orderLogic = _useTableContext.orderLogic;
|
38171
38204
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(''),
|
38172
38205
|
_useState2 = _slicedToArray(_useState, 2),
|
38173
38206
|
search = _useState2[0],
|
@@ -38180,16 +38213,13 @@ var CustomizeButton = function CustomizeButton(props) {
|
|
38180
38213
|
});
|
38181
38214
|
if (!columns.length) return null;
|
38182
38215
|
var filtered = columns.filter(searchColumn(search));
|
38183
|
-
var
|
38184
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(CustomizeButtonItem, _extends({
|
38185
|
-
key: c.id
|
38186
|
-
}, c));
|
38187
|
-
});
|
38216
|
+
var orderProps = canOrderColumns && orderLogic;
|
38188
38217
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(CustomizeButtonWithPopover, {
|
38189
38218
|
popoverProps: _objectSpread(_objectSpread({}, props), {}, {
|
38190
|
-
items:
|
38219
|
+
items: filtered,
|
38191
38220
|
search: search,
|
38192
|
-
setSearch: setSearch
|
38221
|
+
setSearch: setSearch,
|
38222
|
+
orderProps: orderProps
|
38193
38223
|
})
|
38194
38224
|
});
|
38195
38225
|
};
|
@@ -38247,13 +38277,20 @@ var CustomizeButtonPopover = function CustomizeButtonPopover(props) {
|
|
38247
38277
|
search = props.search,
|
38248
38278
|
setSearch = props.setSearch,
|
38249
38279
|
maxMenuHeight = props.maxMenuHeight,
|
38250
|
-
items = props.items
|
38280
|
+
items = props.items,
|
38281
|
+
orderProps = props.orderProps;
|
38282
|
+
var maxHeight = Number.parseInt(maxMenuHeight);
|
38283
|
+
var _maxMenuHeight = orderProps && (!maxHeight || maxHeight < 600) ? 600 : maxMenuHeight;
|
38251
38284
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(PopoverContainer, null, searchable && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(Search, {
|
38252
38285
|
search: search,
|
38253
38286
|
setSearch: setSearch
|
38254
38287
|
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(ItemsWrapper, {
|
38255
|
-
$maxMenuHeight:
|
38256
|
-
},
|
38288
|
+
$maxMenuHeight: _maxMenuHeight
|
38289
|
+
}, orderProps ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(CustomizeButtonDraggableItems, _extends({
|
38290
|
+
items: items
|
38291
|
+
}, orderProps)) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(CustomizeButtonStaticItems, {
|
38292
|
+
items: items
|
38293
|
+
})));
|
38257
38294
|
};
|
38258
38295
|
CustomizeButtonPopover.displayName = 'CustomizeButtonPopover';
|
38259
38296
|
var CustomizeButtonWithPopover = (0,_hoc__WEBPACK_IMPORTED_MODULE_3__.withPopover)(function (p) {
|
@@ -38265,6 +38302,82 @@ var CustomizeButtonWithPopover = (0,_hoc__WEBPACK_IMPORTED_MODULE_3__.withPopove
|
|
38265
38302
|
}, CustomizeButtonPopover, {
|
38266
38303
|
placement: 'bottom'
|
38267
38304
|
});
|
38305
|
+
var CustomizeButtonStaticItems = function CustomizeButtonStaticItems(_ref) {
|
38306
|
+
var items = _ref.items;
|
38307
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), null, items.map(function (c) {
|
38308
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(CustomizeButtonItem, _extends({
|
38309
|
+
key: c.id
|
38310
|
+
}, c));
|
38311
|
+
}));
|
38312
|
+
};
|
38313
|
+
var CustomizeButtonDraggableItems = function CustomizeButtonDraggableItems(props) {
|
38314
|
+
var items = props.items,
|
38315
|
+
orders = props.orders,
|
38316
|
+
moveColumn = props.moveColumn;
|
38317
|
+
var sections = (0,react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(function () {
|
38318
|
+
var _orders$pinned;
|
38319
|
+
return [((_orders$pinned = orders.pinned) === null || _orders$pinned === void 0 ? void 0 : _orders$pinned.length) && {
|
38320
|
+
name: 'Pinned',
|
38321
|
+
sectionId: 'pinned'
|
38322
|
+
}, {
|
38323
|
+
name: 'Visible',
|
38324
|
+
sectionId: 'visible'
|
38325
|
+
}, {
|
38326
|
+
name: 'Hidden',
|
38327
|
+
sectionId: 'hidden'
|
38328
|
+
}].filter(Boolean);
|
38329
|
+
}, [orders]);
|
38330
|
+
var sectionIds = (0,react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(function () {
|
38331
|
+
return sections.map(function (sec) {
|
38332
|
+
return sec.sectionId;
|
38333
|
+
});
|
38334
|
+
}, [sections]);
|
38335
|
+
var value = (0,react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(function () {
|
38336
|
+
var filtered = new Set(items.map(function (it) {
|
38337
|
+
return it.id;
|
38338
|
+
}));
|
38339
|
+
return sectionIds.map(function (sec) {
|
38340
|
+
return orders[sec].filter(function (id) {
|
38341
|
+
return filtered.has(id);
|
38342
|
+
});
|
38343
|
+
});
|
38344
|
+
}, [items, sectionIds, orders]);
|
38345
|
+
var onChange = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (newOrder, info) {
|
38346
|
+
var n,
|
38347
|
+
id = info.id,
|
38348
|
+
cat = sectionIds[info.destination.section];
|
38349
|
+
var dstIndex = info.destination.index;
|
38350
|
+
if (dstIndex == value[info.destination.section].length) n = orders[cat].length;else {
|
38351
|
+
var currentItem = value[info.destination.section][dstIndex];
|
38352
|
+
n = orders[cat].indexOf(currentItem);
|
38353
|
+
}
|
38354
|
+
moveColumn(id, cat, n);
|
38355
|
+
}, [sectionIds, value, orders, moveColumn]);
|
38356
|
+
var _items = (0,react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(function () {
|
38357
|
+
return items.map(function (it) {
|
38358
|
+
return _objectSpread({
|
38359
|
+
name: it.id
|
38360
|
+
}, it);
|
38361
|
+
});
|
38362
|
+
}, [items]);
|
38363
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_input__WEBPACK_IMPORTED_MODULE_6__.DragDrop, {
|
38364
|
+
value: value,
|
38365
|
+
onChange: onChange,
|
38366
|
+
items: _items,
|
38367
|
+
sections: sections,
|
38368
|
+
direction: "column",
|
38369
|
+
CustomDrag: CustomizeButtonDraggableItem
|
38370
|
+
});
|
38371
|
+
};
|
38372
|
+
var CustomizeButtonDraggableItem = function CustomizeButtonDraggableItem(props) {
|
38373
|
+
var Dragger = props.Dragger,
|
38374
|
+
isDragging = props.isDragging,
|
38375
|
+
itemProps = _objectWithoutProperties(props, _excluded);
|
38376
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_input__WEBPACK_IMPORTED_MODULE_6__.DragDrop.DraggableItem, {
|
38377
|
+
Dragger: Dragger,
|
38378
|
+
isDragging: isDragging
|
38379
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(CustomizeButtonItem, itemProps));
|
38380
|
+
};
|
38268
38381
|
var CustomizeButtonItem = function CustomizeButtonItem(props) {
|
38269
38382
|
var id = props.id,
|
38270
38383
|
name = props.name,
|
@@ -38815,6 +38928,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
38815
38928
|
/* harmony import */ var _typography__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../typography */ "./src/typography/index.js");
|
38816
38929
|
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../constants */ "./src/constants.js");
|
38817
38930
|
/* harmony import */ var _sort_icon__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./sort_icon */ "./src/table/sort_icon.js");
|
38931
|
+
/* harmony import */ var _order_logic__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./order_logic */ "./src/table/order_logic.js");
|
38818
38932
|
// LICENSE_CODE ZON
|
38819
38933
|
|
38820
38934
|
|
@@ -38829,11 +38943,13 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
38829
38943
|
|
38830
38944
|
|
38831
38945
|
|
38946
|
+
|
38832
38947
|
var HeaderFunctions = function HeaderFunctions(props) {
|
38833
38948
|
var header = props.header,
|
38834
38949
|
visible = props.visible,
|
38835
38950
|
onItemClick = props.onItemClick,
|
38836
38951
|
orderLogic = props.orderLogic;
|
38952
|
+
if ((0,_order_logic__WEBPACK_IMPORTED_MODULE_9__.isSysColumn)(header.id)) return null;
|
38837
38953
|
var id = header.id,
|
38838
38954
|
on_sort = header.on_sort,
|
38839
38955
|
canHide = header.canHide,
|
@@ -39086,6 +39202,7 @@ _table__WEBPACK_IMPORTED_MODULE_3__["default"].plugins = _plugin__WEBPACK_IMPORT
|
|
39086
39202
|
"use strict";
|
39087
39203
|
__webpack_require__.r(__webpack_exports__);
|
39088
39204
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
39205
|
+
/* harmony export */ isSysColumn: () => (/* binding */ isSysColumn),
|
39089
39206
|
/* harmony export */ useOrderLogic: () => (/* binding */ useOrderLogic)
|
39090
39207
|
/* harmony export */ });
|
39091
39208
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
@@ -39111,6 +39228,10 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
39111
39228
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
39112
39229
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
39113
39230
|
|
39231
|
+
var sysColumns = ['selection', 'row_menu'];
|
39232
|
+
var isSysColumn = function isSysColumn(id) {
|
39233
|
+
return sysColumns.includes(id);
|
39234
|
+
};
|
39114
39235
|
var useOrderLogic = function useOrderLogic(table) {
|
39115
39236
|
var _table$state = table.state,
|
39116
39237
|
columnOrder = _table$state.columnOrder,
|
@@ -39118,8 +39239,13 @@ var useOrderLogic = function useOrderLogic(table) {
|
|
39118
39239
|
pinnedColumns = _table$state.pinnedColumns,
|
39119
39240
|
setColumnOrder = table.setColumnOrder,
|
39120
39241
|
setHiddenColumns = table.setHiddenColumns,
|
39121
|
-
|
39122
|
-
|
39242
|
+
togglePinColumn = table.togglePinColumn,
|
39243
|
+
_allColumns = table.allColumns;
|
39244
|
+
var allColumns = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () {
|
39245
|
+
return _allColumns.filter(function (col) {
|
39246
|
+
return !isSysColumn(col.id);
|
39247
|
+
});
|
39248
|
+
}, [_allColumns]);
|
39123
39249
|
var getColumnCategory = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (id) {
|
39124
39250
|
if (hiddenColumns.includes(id)) return 'hidden';
|
39125
39251
|
if (pinnedColumns.includes(id)) return 'pinned';
|
@@ -39169,19 +39295,19 @@ var useOrderLogic = function useOrderLogic(table) {
|
|
39169
39295
|
return setColumnOrder([].concat(_toConsumableArray(pinned), _toConsumableArray(visible), _toConsumableArray(hidden)));
|
39170
39296
|
}, [setColumnOrder]);
|
39171
39297
|
var moveBackwards = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (id) {
|
39298
|
+
if (isSysColumn(id)) return;
|
39172
39299
|
var category = getColumnCategory(id);
|
39173
39300
|
var arr = orders[category];
|
39174
39301
|
var n = arr.indexOf(id);
|
39175
|
-
console.log('orders1', orders, category, n);
|
39176
39302
|
if (n <= 0) return;
|
39177
39303
|
var new_arr = arr.toSpliced(n, 1);
|
39178
39304
|
new_arr.splice(n - 1, 0, id);
|
39179
39305
|
var newOrder = _objectSpread({}, orders);
|
39180
39306
|
newOrder[category] = new_arr;
|
39181
|
-
console.log('orders', orders, newOrder);
|
39182
39307
|
setOrders(newOrder);
|
39183
39308
|
}, [getColumnCategory, orders, setOrders]);
|
39184
39309
|
var moveForward = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (id) {
|
39310
|
+
if (isSysColumn(id)) return;
|
39185
39311
|
var category = getColumnCategory(id);
|
39186
39312
|
var arr = orders[category];
|
39187
39313
|
var n = arr.indexOf(id);
|
@@ -39193,18 +39319,19 @@ var useOrderLogic = function useOrderLogic(table) {
|
|
39193
39319
|
setOrders(newOrder);
|
39194
39320
|
}, [getColumnCategory, orders, setOrders]);
|
39195
39321
|
var moveColumn = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (id, cat, n) {
|
39322
|
+
if (isSysColumn(id)) return;
|
39196
39323
|
var srcCat = getColumnCategory(id);
|
39197
39324
|
if (srcCat == cat && orders[srcCat][n] == id) return;
|
39198
39325
|
var newOrders = _objectSpread({}, orders);
|
39199
39326
|
newOrders[srcCat] = newOrders[srcCat].filter(function (_id) {
|
39200
39327
|
return _id != id;
|
39201
39328
|
});
|
39202
|
-
newOrders[cat] = newOrders.toSpliced(n, 0, id);
|
39329
|
+
newOrders[cat] = newOrders[cat].toSpliced(n, 0, id);
|
39203
39330
|
setOrders(newOrders);
|
39204
39331
|
if (srcCat == cat) return;
|
39205
39332
|
if (srcCat == 'hidden' || cat == 'hidden') setHiddenColumns(newOrders.hidden);
|
39206
|
-
if (srcCat == 'pinned' || cat == 'pinned')
|
39207
|
-
}, [getColumnCategory, orders, setOrders, setHiddenColumns
|
39333
|
+
if (srcCat == 'pinned' || cat == 'pinned') togglePinColumn(id, cat == 'pinned');
|
39334
|
+
}, [getColumnCategory, orders, setOrders, setHiddenColumns]);
|
39208
39335
|
var res = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () {
|
39209
39336
|
return {
|
39210
39337
|
orders: orders,
|
@@ -39721,6 +39848,7 @@ var plugins = {};
|
|
39721
39848
|
"use strict";
|
39722
39849
|
__webpack_require__.r(__webpack_exports__);
|
39723
39850
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
39851
|
+
/* harmony export */ preventOnClickClass: () => (/* binding */ preventOnClickClass),
|
39724
39852
|
/* harmony export */ renderRow: () => (/* binding */ renderRow)
|
39725
39853
|
/* harmony export */ });
|
39726
39854
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
@@ -39737,6 +39865,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
39737
39865
|
|
39738
39866
|
|
39739
39867
|
|
39868
|
+
var preventOnClickClass = 'tableCell--preventOnClick';
|
39740
39869
|
var renderRow = function renderRow(opt) {
|
39741
39870
|
var className = opt.className,
|
39742
39871
|
row = opt.row,
|
@@ -39747,7 +39876,7 @@ var renderRow = function renderRow(opt) {
|
|
39747
39876
|
renderRowSubComponent = opt.renderRowSubComponent;
|
39748
39877
|
var rowProps = row.getRowProps(getRowProps === null || getRowProps === void 0 ? void 0 : getRowProps(row));
|
39749
39878
|
var onClick = onRowClick ? function (evt) {
|
39750
|
-
|
39879
|
+
if (!evt.target.matches(".".concat(preventOnClickClass, " *"))) onRowClick(row.original, evt);
|
39751
39880
|
} : undefined;
|
39752
39881
|
var cursor = onRowClick ? 'pointer' : undefined;
|
39753
39882
|
var tableRow = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_table_row__WEBPACK_IMPORTED_MODULE_3__.TableRow, _extends({}, rowProps, {
|
@@ -39782,6 +39911,157 @@ var renderRow = function renderRow(opt) {
|
|
39782
39911
|
|
39783
39912
|
/***/ }),
|
39784
39913
|
|
39914
|
+
/***/ "./src/table/row_menu.js":
|
39915
|
+
/*!*******************************!*\
|
39916
|
+
!*** ./src/table/row_menu.js ***!
|
39917
|
+
\*******************************/
|
39918
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
39919
|
+
|
39920
|
+
"use strict";
|
39921
|
+
__webpack_require__.r(__webpack_exports__);
|
39922
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
39923
|
+
/* harmony export */ addRowMenuInternalAction: () => (/* binding */ addRowMenuInternalAction),
|
39924
|
+
/* harmony export */ useRowMenu: () => (/* binding */ useRowMenu)
|
39925
|
+
/* harmony export */ });
|
39926
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
39927
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
39928
|
+
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! styled-components */ "styled-components");
|
39929
|
+
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_1__);
|
39930
|
+
/* harmony import */ var _hoc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../hoc */ "./src/hoc/index.js");
|
39931
|
+
/* harmony import */ var _icon_button__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../icon_button */ "./src/icon_button.js");
|
39932
|
+
/* harmony import */ var _menu__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../menu */ "./src/menu/index.js");
|
39933
|
+
/* harmony import */ var _theme__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../theme */ "./src/theme.js");
|
39934
|
+
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./context */ "./src/table/context.js");
|
39935
|
+
/* harmony import */ var _render_row__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./render_row */ "./src/table/render_row.js");
|
39936
|
+
// LICENSE_CODE ZON
|
39937
|
+
|
39938
|
+
|
39939
|
+
/*jslint react:true*/
|
39940
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
39941
|
+
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; }
|
39942
|
+
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) { _defineProperty(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; }
|
39943
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
39944
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
39945
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
39946
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
39947
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
39948
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
39949
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
39950
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
39951
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
39952
|
+
|
39953
|
+
|
39954
|
+
|
39955
|
+
|
39956
|
+
|
39957
|
+
|
39958
|
+
|
39959
|
+
|
39960
|
+
var RowMenuCell = function RowMenuCell(_ref) {
|
39961
|
+
var row = _ref.row,
|
39962
|
+
column = _ref.column;
|
39963
|
+
var _useTableContext = (0,_context__WEBPACK_IMPORTED_MODULE_6__.useTableContext)(),
|
39964
|
+
rowActions = _useTableContext.rowActions;
|
39965
|
+
var allActions = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () {
|
39966
|
+
return [].concat(_toConsumableArray(rowActions || []), _toConsumableArray(Object.values(column.internalActions))).map(function (item) {
|
39967
|
+
return typeof item == 'function' ? item(row) : item;
|
39968
|
+
}).filter(function (item) {
|
39969
|
+
return item && !item.hidden && item.key;
|
39970
|
+
});
|
39971
|
+
}, [rowActions, column, row]);
|
39972
|
+
if (!allActions.length) return null;
|
39973
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(RowMenuCellPopover, {
|
39974
|
+
popoverProps: {
|
39975
|
+
allActions: allActions,
|
39976
|
+
row: row
|
39977
|
+
}
|
39978
|
+
});
|
39979
|
+
};
|
39980
|
+
RowMenuCell.displayName = 'RowMenuCell';
|
39981
|
+
var RowMenuCellPopover = (0,_hoc__WEBPACK_IMPORTED_MODULE_2__.withPopover)(function (p) {
|
39982
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icon_button__WEBPACK_IMPORTED_MODULE_3__.IconButton, {
|
39983
|
+
onClick: p.popover.toggle,
|
39984
|
+
icon: "DotsHorizontal",
|
39985
|
+
variant: "ghost",
|
39986
|
+
className: _render_row__WEBPACK_IMPORTED_MODULE_7__.preventOnClickClass
|
39987
|
+
});
|
39988
|
+
}, function (p) {
|
39989
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PopoverMenu, {
|
39990
|
+
allActions: p.allActions,
|
39991
|
+
row: p.row,
|
39992
|
+
togglePopover: p.popover.toggle
|
39993
|
+
});
|
39994
|
+
}, {
|
39995
|
+
placement: 'left'
|
39996
|
+
});
|
39997
|
+
var PopoverMenu = function PopoverMenu(props) {
|
39998
|
+
var allActions = props.allActions,
|
39999
|
+
row = props.row,
|
40000
|
+
togglePopover = props.togglePopover;
|
40001
|
+
var items = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () {
|
40002
|
+
return allActions.map(function (item) {
|
40003
|
+
var func = item.onClick;
|
40004
|
+
var newFunc = function newFunc() {
|
40005
|
+
if (!item.keepPopover) togglePopover();
|
40006
|
+
func(row);
|
40007
|
+
};
|
40008
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
40009
|
+
onClick: newFunc
|
40010
|
+
});
|
40011
|
+
});
|
40012
|
+
}, [allActions]);
|
40013
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_menu__WEBPACK_IMPORTED_MODULE_4__["default"], {
|
40014
|
+
items: items,
|
40015
|
+
size: "sm"
|
40016
|
+
});
|
40017
|
+
};
|
40018
|
+
var RowMenuButton = styled_components__WEBPACK_IMPORTED_MODULE_1___default().button.withConfig({
|
40019
|
+
displayName: "RowMenuButton",
|
40020
|
+
componentId: "sc-q7kjip-0"
|
40021
|
+
})(["box-sizing:border-box;min-width:180px;display:flex;align-items:center;padding:7px 12px;gap:10px;border:0 none;background-color:unset;white-space:nowrap;"]);
|
40022
|
+
RowMenuButton.displayName = 'RowMenuButton';
|
40023
|
+
var rowMenuStyle = {
|
40024
|
+
backgroundColor: _theme__WEBPACK_IMPORTED_MODULE_5__["default"].color.white,
|
40025
|
+
display: 'flex',
|
40026
|
+
alignItems: 'center',
|
40027
|
+
position: 'sticky',
|
40028
|
+
right: 0,
|
40029
|
+
overflow: 'visible'
|
40030
|
+
};
|
40031
|
+
var getRowMenuCellProps = function getRowMenuCellProps(props, _ref2) {
|
40032
|
+
var cell = _ref2.cell;
|
40033
|
+
if (cell.column.id == 'row_menu') return [props, {
|
40034
|
+
style: rowMenuStyle
|
40035
|
+
}];
|
40036
|
+
return props;
|
40037
|
+
};
|
40038
|
+
var rowMenuColumn = {
|
40039
|
+
id: 'row_menu',
|
40040
|
+
name: ' ',
|
40041
|
+
Cell: RowMenuCell,
|
40042
|
+
disableHiding: true,
|
40043
|
+
disableResizing: true,
|
40044
|
+
disablePinning: true,
|
40045
|
+
canEdit: false,
|
40046
|
+
width: 48,
|
40047
|
+
minWidth: 48,
|
40048
|
+
maxWidth: 48,
|
40049
|
+
internalActions: {}
|
40050
|
+
};
|
40051
|
+
var useRowMenu = function useRowMenu(hooks) {
|
40052
|
+
hooks.visibleColumns.push(function (columns) {
|
40053
|
+
if (columns[columns.length - 1] == rowMenuColumn) return columns;
|
40054
|
+
return [].concat(_toConsumableArray(columns), [rowMenuColumn]);
|
40055
|
+
});
|
40056
|
+
hooks.getCellProps.push(getRowMenuCellProps);
|
40057
|
+
};
|
40058
|
+
useRowMenu.pluginName = 'useRowMenu';
|
40059
|
+
var addRowMenuInternalAction = function addRowMenuInternalAction(id, action) {
|
40060
|
+
if (!rowMenuColumn.internalActions[id]) rowMenuColumn.internalActions[id] = action;
|
40061
|
+
};
|
40062
|
+
|
40063
|
+
/***/ }),
|
40064
|
+
|
39785
40065
|
/***/ "./src/table/select_rows.js":
|
39786
40066
|
/*!**********************************!*\
|
39787
40067
|
!*** ./src/table/select_rows.js ***!
|
@@ -40092,24 +40372,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
40092
40372
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
40093
40373
|
/* harmony import */ var react_table__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-table */ "react-table");
|
40094
40374
|
/* harmony import */ var react_table__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_table__WEBPACK_IMPORTED_MODULE_1__);
|
40095
|
-
/* harmony import */ var
|
40096
|
-
/* harmony import */ var
|
40097
|
-
/* harmony import */ var _hoc__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../hoc */ "./src/hoc/index.js");
|
40098
|
-
/* harmony import */ var _icon_button__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../icon_button */ "./src/icon_button.js");
|
40099
|
-
/* harmony import */ var _menu__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../menu */ "./src/menu/index.js");
|
40100
|
-
/* harmony import */ var _theme__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../theme */ "./src/theme.js");
|
40101
|
-
/* harmony import */ var _plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./plugin */ "./src/table/plugin.js");
|
40375
|
+
/* harmony import */ var _plugin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./plugin */ "./src/table/plugin.js");
|
40376
|
+
/* harmony import */ var _row_menu_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./row_menu.js */ "./src/table/row_menu.js");
|
40102
40377
|
// LICENSE_CODE ZON
|
40103
40378
|
|
40104
40379
|
|
40105
40380
|
/*jslint react:true*/
|
40106
40381
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
40107
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
40108
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
40109
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
40110
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
40111
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
40112
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
40113
40382
|
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; }
|
40114
40383
|
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) { _defineProperty(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; }
|
40115
40384
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
@@ -40119,35 +40388,25 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
40119
40388
|
|
40120
40389
|
|
40121
40390
|
|
40122
|
-
|
40123
|
-
|
40124
|
-
|
40125
|
-
|
40126
40391
|
var assign = Object.assign;
|
40127
40392
|
react_table__WEBPACK_IMPORTED_MODULE_1__.actions.resetPinnedRows = 'resetPinnedRows';
|
40128
40393
|
react_table__WEBPACK_IMPORTED_MODULE_1__.actions.toggleRowPinned = 'toggleRowPinned';
|
40129
40394
|
var useStickyRows = function useStickyRows(hooks) {
|
40130
|
-
hooks.getCellProps.push(getStickyCellProps);
|
40131
40395
|
hooks.stateReducers.push(stickyRowsReducer);
|
40132
40396
|
hooks.useInstance.push(useStickyRowInstance);
|
40133
40397
|
hooks.prepareRow.push(prepareStickyRow);
|
40398
|
+
(0,_row_menu_js__WEBPACK_IMPORTED_MODULE_3__.addRowMenuInternalAction)('stick_row', function (row) {
|
40399
|
+
return {
|
40400
|
+
key: 'stick_row',
|
40401
|
+
text: "".concat(row.isPinned ? 'Unpin' : 'Pin', " row"),
|
40402
|
+
icon: row.isPinned ? 'Unpin' : 'Pin',
|
40403
|
+
onClick: function onClick() {
|
40404
|
+
return row.toggleRowPinned(!row.isPinned);
|
40405
|
+
}
|
40406
|
+
};
|
40407
|
+
});
|
40134
40408
|
};
|
40135
40409
|
useStickyRows.pluginName = 'useStickyRows';
|
40136
|
-
var rowMenuStyle = {
|
40137
|
-
backgroundColor: _theme__WEBPACK_IMPORTED_MODULE_6__["default"].color.white,
|
40138
|
-
display: 'flex',
|
40139
|
-
alignItems: 'center',
|
40140
|
-
position: 'sticky',
|
40141
|
-
right: 0,
|
40142
|
-
overflow: 'visible'
|
40143
|
-
};
|
40144
|
-
var getStickyCellProps = function getStickyCellProps(props, _ref) {
|
40145
|
-
var cell = _ref.cell;
|
40146
|
-
if (cell.column.id == 'row_menu') return [props, {
|
40147
|
-
style: rowMenuStyle
|
40148
|
-
}];
|
40149
|
-
return props;
|
40150
|
-
};
|
40151
40410
|
var stickyRowsReducer = function stickyRowsReducer(state, action, previousState, instance) {
|
40152
40411
|
if (action.type == react_table__WEBPACK_IMPORTED_MODULE_1__.actions.init) return _objectSpread({
|
40153
40412
|
pinnedRowIds: {}
|
@@ -40206,70 +40465,16 @@ var useStickyRowInstance = function useStickyRowInstance(instance) {
|
|
40206
40465
|
toggleRowPinned: toggleRowPinned
|
40207
40466
|
});
|
40208
40467
|
};
|
40209
|
-
var prepareStickyRow = function prepareStickyRow(row,
|
40210
|
-
var instance =
|
40468
|
+
var prepareStickyRow = function prepareStickyRow(row, _ref) {
|
40469
|
+
var instance = _ref.instance;
|
40211
40470
|
row.toggleRowPinned = function (set) {
|
40212
40471
|
return instance.toggleRowPinned(row.id, set);
|
40213
40472
|
};
|
40214
40473
|
};
|
40215
|
-
|
40216
|
-
var _props$row = props.row,
|
40217
|
-
isPinned = _props$row.isPinned,
|
40218
|
-
toggleRowPinned = _props$row.toggleRowPinned;
|
40219
|
-
var items = [{
|
40220
|
-
key: 'stick_row',
|
40221
|
-
text: "".concat(isPinned ? 'Unpin' : 'Pin', " row"),
|
40222
|
-
icon: isPinned ? 'Unpin' : 'Pin',
|
40223
|
-
onClick: function onClick() {
|
40224
|
-
return toggleRowPinned(!isPinned);
|
40225
|
-
}
|
40226
|
-
}];
|
40227
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(RowMenuCellPopover, {
|
40228
|
-
popoverProps: {
|
40229
|
-
items: items
|
40230
|
-
}
|
40231
|
-
});
|
40232
|
-
};
|
40233
|
-
RowMenuCell.displayName = 'RowMenuCell';
|
40234
|
-
var RowMenuCellPopover = (0,_hoc__WEBPACK_IMPORTED_MODULE_3__.withPopover)(function (p) {
|
40235
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icon_button__WEBPACK_IMPORTED_MODULE_4__.IconButton, {
|
40236
|
-
onClick: p.popover.toggle,
|
40237
|
-
icon: "DotsHorizontal",
|
40238
|
-
variant: "ghost"
|
40239
|
-
});
|
40240
|
-
}, function (p) {
|
40241
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_menu__WEBPACK_IMPORTED_MODULE_5__["default"], {
|
40242
|
-
items: p.items,
|
40243
|
-
size: "sm"
|
40244
|
-
});
|
40245
|
-
}, {
|
40246
|
-
placement: 'left'
|
40247
|
-
});
|
40248
|
-
var RowMenuButton = styled_components__WEBPACK_IMPORTED_MODULE_2___default().button.withConfig({
|
40249
|
-
displayName: "RowMenuButton",
|
40250
|
-
componentId: "sc-u1g3r9-0"
|
40251
|
-
})(["box-sizing:border-box;min-width:180px;display:flex;align-items:center;padding:7px 12px;gap:10px;border:0 none;background-color:unset;white-space:nowrap;"]);
|
40252
|
-
RowMenuButton.displayName = 'RowMenuButton';
|
40253
|
-
var rowMenuColumn = {
|
40254
|
-
id: 'row_menu',
|
40255
|
-
name: ' ',
|
40256
|
-
Cell: RowMenuCell,
|
40257
|
-
disableHiding: true,
|
40258
|
-
disableResizing: true,
|
40259
|
-
disablePinning: true,
|
40260
|
-
canEdit: false,
|
40261
|
-
width: 48,
|
40262
|
-
minWidth: 48,
|
40263
|
-
maxWidth: 48
|
40264
|
-
};
|
40265
|
-
_plugin__WEBPACK_IMPORTED_MODULE_7__.plugins.stickyRows = function () {
|
40474
|
+
_plugin__WEBPACK_IMPORTED_MODULE_2__.plugins.stickyRows = function () {
|
40266
40475
|
return {
|
40267
40476
|
hooks: function hooks() {
|
40268
|
-
return [
|
40269
|
-
hooks.visibleColumns.push(function (columns) {
|
40270
|
-
return [].concat(_toConsumableArray(columns), [rowMenuColumn]);
|
40271
|
-
});
|
40272
|
-
}];
|
40477
|
+
return [_row_menu_js__WEBPACK_IMPORTED_MODULE_3__.useRowMenu, useStickyRows];
|
40273
40478
|
}
|
40274
40479
|
};
|
40275
40480
|
};
|