@clake/react-bootstrap4-window 1.2.5 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/CTable.js CHANGED
@@ -1,6 +1,6 @@
1
- /* @clake/react-bootstrap4-window v1.2.5 | by Clake
1
+ /* @clake/react-bootstrap4-window v1.2.7 | by Clake
2
2
  * Copyright (c) 2025 Clake,
3
- * 2025-10-30T16:38:43+0800
3
+ * 2025-11-14T13:58:13+0800
4
4
  */
5
5
  "use strict";
6
6
 
@@ -519,6 +519,14 @@ function (_React$Component) {
519
519
  return true;
520
520
  }
521
521
 
522
+ if (this.props.edit !== nextProps.edit) {
523
+ return true;
524
+ }
525
+
526
+ if (this.props.select !== nextProps.select) {
527
+ return true;
528
+ }
529
+
522
530
  return nextState.data !== this.state.data;
523
531
  }
524
532
  }, {
@@ -1308,7 +1316,7 @@ function (_React$Component) {
1308
1316
  style: this.getTableStyles(null)
1309
1317
  }, _react["default"].createElement("thead", {
1310
1318
  className: this.getHeaderClasses()
1311
- }, _react["default"].createElement("tr", null, this.state.select || this.props.edit ? _react["default"].createElement("th", {
1319
+ }, _react["default"].createElement("tr", null, this.props.select || this.props.edit ? _react["default"].createElement("th", {
1312
1320
  style: {
1313
1321
  width: '20px',
1314
1322
  textAlign: 'center'
@@ -1322,12 +1330,7 @@ function (_React$Component) {
1322
1330
  onChange: this.selectAll,
1323
1331
  checked: this.state.selectAll,
1324
1332
  half: this.state.selectHalf
1325
- })) : null, this.props.edit && !this.props.nodel ? _react["default"].createElement("th", {
1326
- style: {
1327
- width: '20px',
1328
- textAlign: 'center'
1329
- }
1330
- }) : null, _react["default"].Children.map(this.props.children, function (item, key) {
1333
+ })) : null, _react["default"].Children.map(this.props.children, function (item, key) {
1331
1334
  var _ref, _item$props;
1332
1335
 
1333
1336
  _this13.cacheRow[item.props.field] = (_ref = (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.def) !== null && _ref !== void 0 ? _ref : '';
@@ -1371,7 +1374,12 @@ function (_React$Component) {
1371
1374
  "data-key": _this13.domId + '-' + key,
1372
1375
  className: "ck-column-split"
1373
1376
  }) : null);
1374
- })))));
1377
+ }), this.props.edit && !this.props.nodel ? _react["default"].createElement("th", {
1378
+ style: {
1379
+ width: '20px',
1380
+ textAlign: 'center'
1381
+ }
1382
+ }) : null))));
1375
1383
  }
1376
1384
  }, {
1377
1385
  key: "renderRows",
@@ -1411,7 +1419,7 @@ function (_React$Component) {
1411
1419
  return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("tr", {
1412
1420
  className: rowClass,
1413
1421
  onClick: this.clickHandler(row, i)
1414
- }, this.state.select ? _react["default"].createElement("th", {
1422
+ }, this.props.select ? _react["default"].createElement("th", {
1415
1423
  style: {
1416
1424
  width: '20px',
1417
1425
  textAlign: 'center'
@@ -1513,20 +1521,7 @@ function (_React$Component) {
1513
1521
  id: "".concat(this.domId, "-edit-row-icon-").concat(i),
1514
1522
  icon: "edit",
1515
1523
  className: this.props.disabled ? 'text-secondary' : 'text-success'
1516
- })), !this.props.nodel ? _react["default"].createElement("th", {
1517
- style: {
1518
- width: '20px',
1519
- textAlign: 'center',
1520
- cursor: 'pointer'
1521
- }
1522
- }, _react["default"].createElement(_reactBootstrap.Icon, {
1523
- icon: "trash",
1524
- className: this.props.disabled ? 'text-secondary' : 'text-danger',
1525
- text: "delete",
1526
- onClick: function onClick() {
1527
- _this16.deleteRowHandler(i);
1528
- }
1529
- })) : null, _react["default"].Children.map(this.props.children, function (item, key) {
1524
+ })), _react["default"].Children.map(this.props.children, function (item, key) {
1530
1525
  if (!item || item.props.hide) {
1531
1526
  return null;
1532
1527
  } //set style
@@ -1559,7 +1554,20 @@ function (_React$Component) {
1559
1554
  },
1560
1555
  "data-row": "".concat(i)
1561
1556
  }, item.props.disabled ? item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field] : _this16.renderEditComponent(item.props, row, i));
1562
- })));
1557
+ }), !this.props.nodel ? _react["default"].createElement("th", {
1558
+ style: {
1559
+ width: '20px',
1560
+ textAlign: 'center',
1561
+ cursor: 'pointer'
1562
+ }
1563
+ }, _react["default"].createElement(_reactBootstrap.Icon, {
1564
+ icon: "trash",
1565
+ className: this.props.disabled ? 'text-secondary' : 'text-danger',
1566
+ text: "delete",
1567
+ onClick: function onClick() {
1568
+ _this16.deleteRowHandler(i);
1569
+ }
1570
+ })) : null));
1563
1571
  }
1564
1572
  }, {
1565
1573
  key: "renderEditAddRow",
@@ -1724,6 +1732,7 @@ function (_React$Component) {
1724
1732
  }
1725
1733
 
1726
1734
  var total = this.state.total;
1735
+ var fields = this.props.totalFields;
1727
1736
  return _react["default"].createElement("div", {
1728
1737
  ref: function ref(c) {
1729
1738
  return _this20.tableTotal = c;
@@ -1736,16 +1745,11 @@ function (_React$Component) {
1736
1745
  id: "table-total-".concat(this.domId),
1737
1746
  className: this.getClasses(),
1738
1747
  style: this.getTableStyles()
1739
- }, _react["default"].createElement("tbody", null, _react["default"].createElement("tr", null, this.state.select || this.props.edit ? _react["default"].createElement("td", {
1748
+ }, _react["default"].createElement("tbody", null, _react["default"].createElement("tr", null, this.props.select || this.props.edit ? _react["default"].createElement("td", {
1740
1749
  width: "20px"
1741
1750
  }, _react["default"].createElement(_reactBootstrap.Icon, {
1742
1751
  icon: "chart-line"
1743
- })) : null, !this.props.nodel && this.props.edit ? _react["default"].createElement("td", {
1744
- style: {
1745
- width: '20px',
1746
- textAlign: 'center'
1747
- }
1748
- }) : null, _react["default"].Children.map(this.props.children, function (item, key) {
1752
+ })) : null, _react["default"].Children.map(this.props.children, function (item, key) {
1749
1753
  if (!item || item.props.hide) {
1750
1754
  return null;
1751
1755
  }
@@ -1759,12 +1763,25 @@ function (_React$Component) {
1759
1763
  style.width = item.props.width;
1760
1764
  }
1761
1765
 
1766
+ if (fields && !fields.includes(item.props.field) || !total[item.props.field]) {
1767
+ return _react["default"].createElement("td", {
1768
+ id: _this20.domId + '-' + key,
1769
+ "data-field": item.props.field,
1770
+ style: style
1771
+ });
1772
+ }
1773
+
1762
1774
  return _react["default"].createElement("td", {
1763
1775
  id: _this20.domId + '-' + key,
1764
1776
  "data-field": item.props.field,
1765
1777
  style: style
1766
1778
  }, item.props.onFormat ? item.props.onFormat(total[item.props.field], total, item.props.field) : total[item.props.field]);
1767
- })))));
1779
+ }), !this.props.nodel && this.props.edit ? _react["default"].createElement("td", {
1780
+ style: {
1781
+ width: '20px',
1782
+ textAlign: 'center'
1783
+ }
1784
+ }) : null))));
1768
1785
  }
1769
1786
  }, {
1770
1787
  key: "renderMenu",