@configuratorware/configurator-admingui 1.41.0 → 1.41.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -205,13 +205,7 @@ var TemplateDefaultList = /*#__PURE__*/function (_Component) {
205
205
  });
206
206
 
207
207
  _defineProperty(_assertThisInitialized(_this), "getAvailableItems", function () {
208
- var _this$props = _this.props,
209
- list = _this$props.list,
210
- sourceItemId = _this$props.sourceItemId;
211
- var excludedIds = [sourceItemId];
212
- return _lodash["default"].get(list, 'data', []).filter(function (item) {
213
- return excludedIds.indexOf(item.id) === -1;
214
- });
208
+ return _lodash["default"].get(_this.props.list, 'data', []);
215
209
  });
216
210
 
217
211
  _defineProperty(_assertThisInitialized(_this), "onMoveItems", function () {
@@ -257,8 +251,13 @@ var TemplateDefaultList = /*#__PURE__*/function (_Component) {
257
251
  });
258
252
  });
259
253
 
254
+ _defineProperty(_assertThisInitialized(_this), "isItemAtIndexSource", function (index) {
255
+ var clickedItem = _this.props.list.data[index];
256
+ return clickedItem.id === _this.props.sourceItemId;
257
+ });
258
+
260
259
  _defineProperty(_assertThisInitialized(_this), "isRowSelectable", function (index) {
261
- return !_this.isItemAtIndexMoved(index);
260
+ return !_this.isItemAtIndexMoved(index) && !_this.isItemAtIndexSource(index);
262
261
  });
263
262
 
264
263
  _defineProperty(_assertThisInitialized(_this), "getRowStyle", function (index) {
@@ -269,6 +268,13 @@ var TemplateDefaultList = /*#__PURE__*/function (_Component) {
269
268
  };
270
269
  }
271
270
 
271
+ if (_this.isItemAtIndexSource(index)) {
272
+ return {
273
+ cursor: 'not-allowed',
274
+ opacity: 0.5
275
+ };
276
+ }
277
+
272
278
  return {
273
279
  cursor: 'pointer'
274
280
  };
@@ -345,14 +351,14 @@ var TemplateDefaultList = /*#__PURE__*/function (_Component) {
345
351
  }, {
346
352
  key: "render",
347
353
  value: function render() {
348
- var _this$props2 = this.props,
349
- list = _this$props2.list,
350
- columns = _this$props2.columns,
351
- error = _this$props2.error,
352
- selected = _this$props2.selected,
353
- onAddItem = _this$props2.onAddItem,
354
- config = _this$props2.config,
355
- List = _this$props2.List;
354
+ var _this$props = this.props,
355
+ list = _this$props.list,
356
+ columns = _this$props.columns,
357
+ error = _this$props.error,
358
+ selected = _this$props.selected,
359
+ onAddItem = _this$props.onAddItem,
360
+ config = _this$props.config,
361
+ List = _this$props.List;
356
362
  var _this$state3 = this.state,
357
363
  movedItems = _this$state3.movedItems,
358
364
  selectedItems = _this$state3.selectedItems;
@@ -376,6 +382,7 @@ var TemplateDefaultList = /*#__PURE__*/function (_Component) {
376
382
  shownColumns: shownColumns,
377
383
  rowsTotal: total,
378
384
  rowsPerPage: this.state.listParams.limit,
385
+ listParams: this.state.listParams,
379
386
  onRowSelection: this.onRowSelection,
380
387
  selected: selected || this.state.selectedRows,
381
388
  onAddItem: onAddItem,
@@ -200,7 +200,8 @@ var TemplateList = /*#__PURE__*/function (_Component) {
200
200
 
201
201
  _this.props.onRowSelection(rows, event);
202
202
  },
203
- selected: _this.selectedRows
203
+ selected: _this.selectedRows,
204
+ isRowSelectable: _this.props.isRowSelectable
204
205
  }, /*#__PURE__*/_react["default"].createElement(_Table.TableHead, {
205
206
  showCheckbox: showCheckboxes
206
207
  }, /*#__PURE__*/_react["default"].createElement(_Table.TableRow, null, columns.map(function (column, i) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configuratorware/configurator-admingui",
3
- "version": "1.41.0",
3
+ "version": "1.41.1",
4
4
  "license": "UNLICENSED",
5
5
  "private": false,
6
6
  "dependencies": {
@@ -29,7 +29,7 @@
29
29
  "react-redux-i18n": "^1.9.3",
30
30
  "react-router": "^3.2.6",
31
31
  "react-sortable-hoc": "^1.11.0",
32
- "redhotmagma-visualization": "1.41.0",
32
+ "redhotmagma-visualization": "1.41.1",
33
33
  "redux": "^4.1.0",
34
34
  "redux-logger": "^3.0.6",
35
35
  "redux-persist": "^5.10.0",
@@ -174,11 +174,7 @@ export default class TemplateDefaultList extends Component {
174
174
  };
175
175
 
176
176
  getAvailableItems = () => {
177
- const { list, sourceItemId } = this.props;
178
-
179
- const excludedIds = [sourceItemId];
180
-
181
- return _.get(list, 'data', []).filter(item => excludedIds.indexOf(item.id) === -1);
177
+ return _.get(this.props.list, 'data', []);
182
178
  };
183
179
 
184
180
  onMoveItems = () => {
@@ -186,7 +182,7 @@ export default class TemplateDefaultList extends Component {
186
182
  const data = this.getAvailableItems();
187
183
 
188
184
  const newItems = _.filter(data, (item, index) => {
189
- return (selectedRows.indexOf(index) !== -1 || selectedRows === 'all');
185
+ return selectedRows.indexOf(index) !== -1 || selectedRows === 'all';
190
186
  });
191
187
 
192
188
  this.setState(
@@ -217,23 +213,32 @@ export default class TemplateDefaultList extends Component {
217
213
  }
218
214
  );
219
215
  };
220
-
221
- isItemAtIndexMoved= (index) => {
216
+
217
+ isItemAtIndexMoved = index => {
222
218
  const clickedItem = this.props.list.data[index];
223
219
 
224
220
  return _.find(this.state.movedItems, { id: clickedItem.id });
225
- }
226
-
227
- isRowSelectable = (index) => {
228
- return !this.isItemAtIndexMoved(index);
229
- }
221
+ };
222
+
223
+ isItemAtIndexSource = index => {
224
+ const clickedItem = this.props.list.data[index];
230
225
 
231
- getRowStyle = (index) => {
226
+ return clickedItem.id === this.props.sourceItemId;
227
+ };
228
+
229
+ isRowSelectable = index => {
230
+ return !this.isItemAtIndexMoved(index) && !this.isItemAtIndexSource(index);
231
+ };
232
+
233
+ getRowStyle = index => {
232
234
  if (this.isItemAtIndexMoved(index)) {
233
235
  return { cursor: 'not-allowed', backgroundColor: 'lightgreen' };
234
236
  }
237
+ if (this.isItemAtIndexSource(index)) {
238
+ return { cursor: 'not-allowed', opacity: 0.5 };
239
+ }
235
240
  return { cursor: 'pointer' };
236
- }
241
+ };
237
242
 
238
243
  onMovedItemsChange = () => {
239
244
  const movedItemIds = this.state.movedItems.map(item => item.id);
@@ -275,6 +280,7 @@ export default class TemplateDefaultList extends Component {
275
280
  shownColumns={shownColumns}
276
281
  rowsTotal={total}
277
282
  rowsPerPage={this.state.listParams.limit}
283
+ listParams={this.state.listParams}
278
284
  onRowSelection={this.onRowSelection}
279
285
  selected={selected || this.state.selectedRows}
280
286
  onAddItem={onAddItem}
@@ -170,6 +170,7 @@ export default class TemplateList extends Component {
170
170
  this.props.onRowSelection(rows, event);
171
171
  }}
172
172
  selected={this.selectedRows}
173
+ isRowSelectable={this.props.isRowSelectable}
173
174
  >
174
175
  <TableHead showCheckbox={showCheckboxes}>
175
176
  <TableRow>