@clake/react-bootstrap4-window 1.0.4 → 1.0.6

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.0.4 | by Clake
1
+ /* @clake/react-bootstrap4-window v1.0.6 | by Clake
2
2
  * Copyright (c) 2024 Clake,
3
- * 2024-04-02T10:57:59+0800
3
+ * 2024-06-19T16:20:17+0800
4
4
  */
5
5
  "use strict";
6
6
 
@@ -121,6 +121,8 @@ function (_React$Component) {
121
121
 
122
122
  _defineProperty(_assertThisInitialized(_this), "table_total", void 0);
123
123
 
124
+ _defineProperty(_assertThisInitialized(_this), "fullButton", void 0);
125
+
124
126
  _defineProperty(_assertThisInitialized(_this), "split", void 0);
125
127
 
126
128
  _defineProperty(_assertThisInitialized(_this), "mainDom", void 0);
@@ -137,6 +139,8 @@ function (_React$Component) {
137
139
 
138
140
  _defineProperty(_assertThisInitialized(_this), "allchk", void 0);
139
141
 
142
+ _defineProperty(_assertThisInitialized(_this), "isFull", void 0);
143
+
140
144
  _defineProperty(_assertThisInitialized(_this), "equals", function (a, b) {
141
145
  if (a === b) return true;
142
146
  if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();
@@ -285,6 +289,27 @@ function (_React$Component) {
285
289
  }
286
290
  });
287
291
 
292
+ //全屏查看
293
+ _defineProperty(_assertThisInitialized(_this), "fullHandler", function () {
294
+ if (_this.isFull) {
295
+ var _this$fullButton$quer, _this$fullButton$quer2;
296
+
297
+ _this.mainDom.classList.remove('ck-ctable-full');
298
+
299
+ (_this$fullButton$quer = _this.fullButton.querySelector('i')) === null || _this$fullButton$quer === void 0 ? void 0 : _this$fullButton$quer.classList.remove("fa-compress");
300
+ (_this$fullButton$quer2 = _this.fullButton.querySelector('i')) === null || _this$fullButton$quer2 === void 0 ? void 0 : _this$fullButton$quer2.classList.add("fa-expand");
301
+ } else {
302
+ var _this$fullButton$quer3, _this$fullButton$quer4;
303
+
304
+ _this.mainDom.classList.add('ck-ctable-full');
305
+
306
+ (_this$fullButton$quer3 = _this.fullButton.querySelector('i')) === null || _this$fullButton$quer3 === void 0 ? void 0 : _this$fullButton$quer3.classList.add("fa-compress");
307
+ (_this$fullButton$quer4 = _this.fullButton.querySelector('i')) === null || _this$fullButton$quer4 === void 0 ? void 0 : _this$fullButton$quer4.classList.remove("fa-expand");
308
+ }
309
+
310
+ _this.isFull = !_this.isFull;
311
+ });
312
+
288
313
  _this.state = {
289
314
  data: _this.props.data || [],
290
315
  dataCount: (_this$props$dataCount = _this.props.dataCount) !== null && _this$props$dataCount !== void 0 ? _this$props$dataCount : 0,
@@ -325,6 +350,7 @@ function (_React$Component) {
325
350
  _this.lockColumns = []; //lock column flag
326
351
 
327
352
  _this.isLock = false;
353
+ _this.isFull = false;
328
354
 
329
355
  _this.initTableWidth();
330
356
 
@@ -893,14 +919,14 @@ function (_React$Component) {
893
919
  data: data,
894
920
  dataCount: data.length
895
921
  });
896
- } //****************************
922
+ }
923
+ }, {
924
+ key: "getSelectRows",
925
+ //****************************
897
926
 
898
927
  /**
899
928
  * 得到所有选中的行
900
929
  */
901
-
902
- }, {
903
- key: "getSelectRows",
904
930
  value: function getSelectRows() {
905
931
  var _this9 = this;
906
932
 
@@ -1489,25 +1515,40 @@ function (_React$Component) {
1489
1515
  }, {
1490
1516
  key: "renderFoot",
1491
1517
  value: function renderFoot() {
1492
- var _this$props$showNumbe, _this$props$showPages, _this$props$edit;
1518
+ var _this$props$showNumbe,
1519
+ _this$props$showPages,
1520
+ _this$props$edit,
1521
+ _this19 = this;
1493
1522
 
1494
1523
  if (!this.props.foot) {
1495
1524
  return null;
1496
1525
  }
1497
1526
 
1498
- return _react["default"].createElement("div", null, _react["default"].createElement(_PageBar["default"], {
1527
+ return _react["default"].createElement("div", {
1528
+ className: "ck-ctable-foot d-flex align-items-center"
1529
+ }, _react["default"].createElement(_PageBar["default"], {
1499
1530
  page: this.state.page,
1500
1531
  dataCount: this.state.dataCount,
1501
1532
  onSelect: this.selectPageHandler,
1502
1533
  showNumbers: (_this$props$showNumbe = this.props.showNumbers) !== null && _this$props$showNumbe !== void 0 ? _this$props$showNumbe : 0,
1503
1534
  showPages: (_this$props$showPages = this.props.showPages) !== null && _this$props$showPages !== void 0 ? _this$props$showPages : 0,
1504
1535
  noPage: (_this$props$edit = this.props.edit) !== null && _this$props$edit !== void 0 ? _this$props$edit : false
1505
- }));
1536
+ }), _react["default"].createElement("div", {
1537
+ ref: function ref(c) {
1538
+ _this19.fullButton = c;
1539
+ },
1540
+ className: "full-btn align-self-center ms-auto pe-2 text-primary",
1541
+ onClick: function onClick() {
1542
+ _this19.fullHandler();
1543
+ }
1544
+ }, _react["default"].createElement(_reactBootstrap.Icon, {
1545
+ icon: "expand"
1546
+ })));
1506
1547
  }
1507
1548
  }, {
1508
1549
  key: "renderTotal",
1509
1550
  value: function renderTotal() {
1510
- var _this19 = this;
1551
+ var _this20 = this;
1511
1552
 
1512
1553
  if (!this.state.total) {
1513
1554
  return null;
@@ -1516,12 +1557,12 @@ function (_React$Component) {
1516
1557
  var total = this.state.total;
1517
1558
  return _react["default"].createElement("div", {
1518
1559
  ref: function ref(c) {
1519
- return _this19.tableTotal = c;
1560
+ return _this20.tableTotal = c;
1520
1561
  },
1521
1562
  className: "ck-ctable-total"
1522
1563
  }, _react["default"].createElement("table", {
1523
1564
  ref: function ref(c) {
1524
- return _this19.table_total = c;
1565
+ return _this20.table_total = c;
1525
1566
  },
1526
1567
  id: "table-total-".concat(this.domId),
1527
1568
  className: this.getClasses(),
@@ -1535,7 +1576,7 @@ function (_React$Component) {
1535
1576
  return null;
1536
1577
  }
1537
1578
 
1538
- var align = item.props.align || _this19.props.align;
1579
+ var align = item.props.align || _this20.props.align;
1539
1580
  var style = {
1540
1581
  'textAlign': align
1541
1582
  };
@@ -1545,7 +1586,7 @@ function (_React$Component) {
1545
1586
  }
1546
1587
 
1547
1588
  return _react["default"].createElement("td", {
1548
- id: _this19.domId + '-' + key,
1589
+ id: _this20.domId + '-' + key,
1549
1590
  "data-field": item.props.field,
1550
1591
  style: style
1551
1592
  }, item.props.onFormat ? item.props.onFormat(total[item.props.field], total, item.props.field) : total[item.props.field]);
@@ -1554,7 +1595,7 @@ function (_React$Component) {
1554
1595
  }, {
1555
1596
  key: "renderMenu",
1556
1597
  value: function renderMenu() {
1557
- var _this20 = this;
1598
+ var _this21 = this;
1558
1599
 
1559
1600
  var lang;
1560
1601
 
@@ -1573,7 +1614,7 @@ function (_React$Component) {
1573
1614
 
1574
1615
  return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
1575
1616
  ref: function ref(c) {
1576
- return _this20.mainMenu = c;
1617
+ return _this21.mainMenu = c;
1577
1618
  },
1578
1619
  onClick: this.menuClickHandler
1579
1620
  }, _react["default"].createElement(_reactBootstrap.Menu.Item, {
@@ -1593,7 +1634,7 @@ function (_React$Component) {
1593
1634
  var select = document.getSelection();
1594
1635
  if (!select) return;
1595
1636
 
1596
- _this20.filterHandler(select.toString(), data.field, 'contain');
1637
+ _this21.filterHandler(select.toString(), data.field, 'contain');
1597
1638
  }
1598
1639
  }, _react["default"].createElement(_reactBootstrap.Icon, {
1599
1640
  className: "me-1",
@@ -1604,7 +1645,7 @@ function (_React$Component) {
1604
1645
  var select = document.getSelection();
1605
1646
  if (!select) return;
1606
1647
 
1607
- _this20.filterHandler(select.toString(), data.field, 'exclude');
1648
+ _this21.filterHandler(select.toString(), data.field, 'exclude');
1608
1649
  }
1609
1650
  }, _react["default"].createElement(_reactBootstrap.Icon, {
1610
1651
  className: "me-1",
@@ -1612,7 +1653,7 @@ function (_React$Component) {
1612
1653
  }), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1613
1654
  field: "clear_filter",
1614
1655
  onClick: function onClick() {
1615
- _this20.clearFilter();
1656
+ _this21.clearFilter();
1616
1657
  }
1617
1658
  }, _react["default"].createElement("span", {
1618
1659
  className: "text-danger"
@@ -1629,7 +1670,7 @@ function (_React$Component) {
1629
1670
  style: inputStyle
1630
1671
  }, lang['Equal With']), _react["default"].createElement(_reactBootstrap.Input, {
1631
1672
  ref: function ref(c) {
1632
- return _this20.filter.equal = c;
1673
+ return _this21.filter.equal = c;
1633
1674
  },
1634
1675
  className: "me-1",
1635
1676
  size: "xs",
@@ -1638,13 +1679,13 @@ function (_React$Component) {
1638
1679
  onChange: this.filterChangeHandler('equal'),
1639
1680
  onMouseDown: stopEvent,
1640
1681
  onEnter: function onEnter() {
1641
- _this20.filterHandler(_this20.state.filter.equal, _this20.mainMenu.data.field, 'equal');
1682
+ _this21.filterHandler(_this21.state.filter.equal, _this21.mainMenu.data.field, 'equal');
1642
1683
  }
1643
1684
  }), _react["default"].createElement(_reactBootstrap.Button, {
1644
1685
  size: "xs",
1645
1686
  onMouseDown: stopEvent,
1646
1687
  onClick: function onClick(e) {
1647
- _this20.filterHandler(_this20.state.filter.equal, _this20.mainMenu.data.field, 'equal');
1688
+ _this21.filterHandler(_this21.state.filter.equal, _this21.mainMenu.data.field, 'equal');
1648
1689
  },
1649
1690
  icon: "search"
1650
1691
  })) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
@@ -1654,7 +1695,7 @@ function (_React$Component) {
1654
1695
  style: inputStyle
1655
1696
  }, lang['Start With']), _react["default"].createElement(_reactBootstrap.Input, {
1656
1697
  ref: function ref(c) {
1657
- return _this20.filter.start = c;
1698
+ return _this21.filter.start = c;
1658
1699
  },
1659
1700
  className: "me-1",
1660
1701
  size: "xs",
@@ -1663,13 +1704,13 @@ function (_React$Component) {
1663
1704
  onChange: this.filterChangeHandler('start'),
1664
1705
  onMouseDown: stopEvent,
1665
1706
  onEnter: function onEnter() {
1666
- _this20.filterHandler(_this20.state.filter.start, _this20.mainMenu.data.field, 'start');
1707
+ _this21.filterHandler(_this21.state.filter.start, _this21.mainMenu.data.field, 'start');
1667
1708
  }
1668
1709
  }), _react["default"].createElement(_reactBootstrap.Button, {
1669
1710
  size: "xs",
1670
1711
  onMouseDown: stopEvent,
1671
1712
  onClick: function onClick(e) {
1672
- _this20.filterHandler(_this20.state.filter.start, _this20.mainMenu.data.field, 'start');
1713
+ _this21.filterHandler(_this21.state.filter.start, _this21.mainMenu.data.field, 'start');
1673
1714
  },
1674
1715
  icon: "search"
1675
1716
  })) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
@@ -1679,7 +1720,7 @@ function (_React$Component) {
1679
1720
  style: inputStyle
1680
1721
  }, lang['End With']), _react["default"].createElement(_reactBootstrap.Input, {
1681
1722
  ref: function ref(c) {
1682
- return _this20.filter.end = c;
1723
+ return _this21.filter.end = c;
1683
1724
  },
1684
1725
  className: "me-1",
1685
1726
  size: "xs",
@@ -1688,13 +1729,13 @@ function (_React$Component) {
1688
1729
  onChange: this.filterChangeHandler('end'),
1689
1730
  onMouseDown: stopEvent,
1690
1731
  onEnter: function onEnter() {
1691
- _this20.filterHandler(_this20.state.filter.end, _this20.mainMenu.data.field, 'end');
1732
+ _this21.filterHandler(_this21.state.filter.end, _this21.mainMenu.data.field, 'end');
1692
1733
  }
1693
1734
  }), _react["default"].createElement(_reactBootstrap.Button, {
1694
1735
  size: "xs",
1695
1736
  onMouseDown: stopEvent,
1696
1737
  onClick: function onClick(e) {
1697
- _this20.filterHandler(_this20.state.filter.end, _this20.mainMenu.data.field, 'end');
1738
+ _this21.filterHandler(_this21.state.filter.end, _this21.mainMenu.data.field, 'end');
1698
1739
  },
1699
1740
  icon: "search"
1700
1741
  })) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
@@ -1704,7 +1745,7 @@ function (_React$Component) {
1704
1745
  style: inputStyle
1705
1746
  }, lang['Contain with']), _react["default"].createElement(_reactBootstrap.Input, {
1706
1747
  ref: function ref(c) {
1707
- return _this20.filter.contain = c;
1748
+ return _this21.filter.contain = c;
1708
1749
  },
1709
1750
  className: "me-1",
1710
1751
  size: "xs",
@@ -1713,13 +1754,13 @@ function (_React$Component) {
1713
1754
  onChange: this.filterChangeHandler('contain'),
1714
1755
  onMouseDown: stopEvent,
1715
1756
  onEnter: function onEnter() {
1716
- _this20.filterHandler(_this20.state.filter.contain, _this20.mainMenu.data.field, 'contain');
1757
+ _this21.filterHandler(_this21.state.filter.contain, _this21.mainMenu.data.field, 'contain');
1717
1758
  }
1718
1759
  }), _react["default"].createElement(_reactBootstrap.Button, {
1719
1760
  size: "xs",
1720
1761
  onMouseDown: stopEvent,
1721
1762
  onClick: function onClick(e) {
1722
- _this20.filterHandler(_this20.state.filter.contain, _this20.mainMenu.data.field, 'contain');
1763
+ _this21.filterHandler(_this21.state.filter.contain, _this21.mainMenu.data.field, 'contain');
1723
1764
  },
1724
1765
  icon: "search"
1725
1766
  })) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
@@ -1737,7 +1778,7 @@ function (_React$Component) {
1737
1778
  onChange: this.filterChangeHandler('condition'),
1738
1779
  onMouseDown: stopEvent,
1739
1780
  onEnter: function onEnter() {
1740
- _this20.filterHandler(_this20.state.filter.condition, _this20.mainMenu.data.field, 'condition');
1781
+ _this21.filterHandler(_this21.state.filter.condition, _this21.mainMenu.data.field, 'condition');
1741
1782
  }
1742
1783
  })) : null, this.props.edit ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1743
1784
  field: "",
@@ -1750,13 +1791,13 @@ function (_React$Component) {
1750
1791
  field: "",
1751
1792
  step: true
1752
1793
  }) : null, this.props.customMenu ? this.props.customMenu.map(function (menu) {
1753
- return _this20.explainCustomMenu(menu);
1794
+ return _this21.explainCustomMenu(menu);
1754
1795
  }) : null));
1755
1796
  }
1756
1797
  }, {
1757
1798
  key: "renderNumberMenu",
1758
1799
  value: function renderNumberMenu() {
1759
- var _this21 = this;
1800
+ var _this22 = this;
1760
1801
 
1761
1802
  var lang;
1762
1803
 
@@ -1775,7 +1816,7 @@ function (_React$Component) {
1775
1816
 
1776
1817
  return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
1777
1818
  ref: function ref(c) {
1778
- return _this21.numMenu = c;
1819
+ return _this22.numMenu = c;
1779
1820
  },
1780
1821
  onClick: this.menuClickHandler
1781
1822
  }, _react["default"].createElement(_reactBootstrap.Menu.Item, {
@@ -1795,7 +1836,7 @@ function (_React$Component) {
1795
1836
  var select = document.getSelection();
1796
1837
  if (!select) return;
1797
1838
 
1798
- _this21.filterHandler(select.toString(), data.field, 'contain');
1839
+ _this22.filterHandler(select.toString(), data.field, 'contain');
1799
1840
  }
1800
1841
  }, _react["default"].createElement(_reactBootstrap.Icon, {
1801
1842
  className: "me-1",
@@ -1806,7 +1847,7 @@ function (_React$Component) {
1806
1847
  var select = document.getSelection();
1807
1848
  if (!select) return;
1808
1849
 
1809
- _this21.filterHandler(select.toString(), data.field, 'exclude');
1850
+ _this22.filterHandler(select.toString(), data.field, 'exclude');
1810
1851
  }
1811
1852
  }, _react["default"].createElement(_reactBootstrap.Icon, {
1812
1853
  className: "me-1",
@@ -1814,7 +1855,7 @@ function (_React$Component) {
1814
1855
  }), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1815
1856
  field: "clear_filter",
1816
1857
  onClick: function onClick() {
1817
- _this21.clearFilter();
1858
+ _this22.clearFilter();
1818
1859
  }
1819
1860
  }, _react["default"].createElement("span", {
1820
1861
  className: "text-danger"
@@ -1836,14 +1877,14 @@ function (_React$Component) {
1836
1877
  onChange: this.filterChangeHandler('condition'),
1837
1878
  onMouseDown: stopEvent,
1838
1879
  onEnter: function onEnter() {
1839
- _this21.filterHandler(_this21.state.filter.condition, _this21.numMenu.data.field, 'condition');
1880
+ _this22.filterHandler(_this22.state.filter.condition, _this22.numMenu.data.field, 'condition');
1840
1881
  }
1841
1882
  }), _react["default"].createElement("div", null, "and,or,between,>,>=,<,<=,=")) : null));
1842
1883
  }
1843
1884
  }, {
1844
1885
  key: "explainCustomMenu",
1845
1886
  value: function explainCustomMenu(menu) {
1846
- var _this22 = this;
1887
+ var _this23 = this;
1847
1888
 
1848
1889
  if (menu.children && menu.children instanceof Array) {
1849
1890
  return _react["default"].createElement(_reactBootstrap.Menu.Item, {
@@ -1851,7 +1892,7 @@ function (_React$Component) {
1851
1892
  text: menu.text,
1852
1893
  child: true
1853
1894
  }, menu.children.map(function (item) {
1854
- return _this22.explainCustomMenu(item);
1895
+ return _this23.explainCustomMenu(item);
1855
1896
  }));
1856
1897
  } else {
1857
1898
  return _react["default"].createElement(_reactBootstrap.Menu.Item, {