@clake/react-bootstrap4-window 1.0.5 → 1.0.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.0.5 | by Clake
1
+ /* @clake/react-bootstrap4-window v1.0.7 | by Clake
2
2
  * Copyright (c) 2024 Clake,
3
- * 2024-06-06T17:05:39+0800
3
+ * 2024-08-05T11:11:30+0800
4
4
  */
5
5
  "use strict";
6
6
 
@@ -59,6 +59,15 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
59
59
 
60
60
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
61
61
 
62
+ var numberCondition = {
63
+ '=': 'eq',
64
+ '!=': 'ne',
65
+ '>': 'gt',
66
+ '>=': 'gte',
67
+ '<=': 'lte',
68
+ '<': 'lt'
69
+ };
70
+
62
71
  var CTable = exports.CTable =
63
72
  /*#__PURE__*/
64
73
  function (_React$Component) {
@@ -121,6 +130,8 @@ function (_React$Component) {
121
130
 
122
131
  _defineProperty(_assertThisInitialized(_this), "table_total", void 0);
123
132
 
133
+ _defineProperty(_assertThisInitialized(_this), "fullButton", void 0);
134
+
124
135
  _defineProperty(_assertThisInitialized(_this), "split", void 0);
125
136
 
126
137
  _defineProperty(_assertThisInitialized(_this), "mainDom", void 0);
@@ -137,6 +148,8 @@ function (_React$Component) {
137
148
 
138
149
  _defineProperty(_assertThisInitialized(_this), "allchk", void 0);
139
150
 
151
+ _defineProperty(_assertThisInitialized(_this), "isFull", void 0);
152
+
140
153
  _defineProperty(_assertThisInitialized(_this), "equals", function (a, b) {
141
154
  if (a === b) return true;
142
155
  if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();
@@ -285,6 +298,27 @@ function (_React$Component) {
285
298
  }
286
299
  });
287
300
 
301
+ //全屏查看
302
+ _defineProperty(_assertThisInitialized(_this), "fullHandler", function () {
303
+ if (_this.isFull) {
304
+ var _this$fullButton$quer, _this$fullButton$quer2;
305
+
306
+ _this.mainDom.classList.remove('ck-ctable-full');
307
+
308
+ (_this$fullButton$quer = _this.fullButton.querySelector('i')) === null || _this$fullButton$quer === void 0 ? void 0 : _this$fullButton$quer.classList.remove("fa-compress");
309
+ (_this$fullButton$quer2 = _this.fullButton.querySelector('i')) === null || _this$fullButton$quer2 === void 0 ? void 0 : _this$fullButton$quer2.classList.add("fa-expand");
310
+ } else {
311
+ var _this$fullButton$quer3, _this$fullButton$quer4;
312
+
313
+ _this.mainDom.classList.add('ck-ctable-full');
314
+
315
+ (_this$fullButton$quer3 = _this.fullButton.querySelector('i')) === null || _this$fullButton$quer3 === void 0 ? void 0 : _this$fullButton$quer3.classList.add("fa-compress");
316
+ (_this$fullButton$quer4 = _this.fullButton.querySelector('i')) === null || _this$fullButton$quer4 === void 0 ? void 0 : _this$fullButton$quer4.classList.remove("fa-expand");
317
+ }
318
+
319
+ _this.isFull = !_this.isFull;
320
+ });
321
+
288
322
  _this.state = {
289
323
  data: _this.props.data || [],
290
324
  dataCount: (_this$props$dataCount = _this.props.dataCount) !== null && _this$props$dataCount !== void 0 ? _this$props$dataCount : 0,
@@ -325,6 +359,7 @@ function (_React$Component) {
325
359
  _this.lockColumns = []; //lock column flag
326
360
 
327
361
  _this.isLock = false;
362
+ _this.isFull = false;
328
363
 
329
364
  _this.initTableWidth();
330
365
 
@@ -893,14 +928,14 @@ function (_React$Component) {
893
928
  data: data,
894
929
  dataCount: data.length
895
930
  });
896
- } //****************************
931
+ }
932
+ }, {
933
+ key: "getSelectRows",
934
+ //****************************
897
935
 
898
936
  /**
899
937
  * 得到所有选中的行
900
938
  */
901
-
902
- }, {
903
- key: "getSelectRows",
904
939
  value: function getSelectRows() {
905
940
  var _this9 = this;
906
941
 
@@ -1489,25 +1524,40 @@ function (_React$Component) {
1489
1524
  }, {
1490
1525
  key: "renderFoot",
1491
1526
  value: function renderFoot() {
1492
- var _this$props$showNumbe, _this$props$showPages, _this$props$edit;
1527
+ var _this$props$showNumbe,
1528
+ _this$props$showPages,
1529
+ _this$props$edit,
1530
+ _this19 = this;
1493
1531
 
1494
1532
  if (!this.props.foot) {
1495
1533
  return null;
1496
1534
  }
1497
1535
 
1498
- return _react["default"].createElement("div", null, _react["default"].createElement(_PageBar["default"], {
1536
+ return _react["default"].createElement("div", {
1537
+ className: "ck-ctable-foot d-flex align-items-center"
1538
+ }, _react["default"].createElement(_PageBar["default"], {
1499
1539
  page: this.state.page,
1500
1540
  dataCount: this.state.dataCount,
1501
1541
  onSelect: this.selectPageHandler,
1502
1542
  showNumbers: (_this$props$showNumbe = this.props.showNumbers) !== null && _this$props$showNumbe !== void 0 ? _this$props$showNumbe : 0,
1503
1543
  showPages: (_this$props$showPages = this.props.showPages) !== null && _this$props$showPages !== void 0 ? _this$props$showPages : 0,
1504
1544
  noPage: (_this$props$edit = this.props.edit) !== null && _this$props$edit !== void 0 ? _this$props$edit : false
1505
- }));
1545
+ }), _react["default"].createElement("div", {
1546
+ ref: function ref(c) {
1547
+ _this19.fullButton = c;
1548
+ },
1549
+ className: "full-btn align-self-center ms-auto pe-2 text-primary",
1550
+ onClick: function onClick() {
1551
+ _this19.fullHandler();
1552
+ }
1553
+ }, _react["default"].createElement(_reactBootstrap.Icon, {
1554
+ icon: "expand"
1555
+ })));
1506
1556
  }
1507
1557
  }, {
1508
1558
  key: "renderTotal",
1509
1559
  value: function renderTotal() {
1510
- var _this19 = this;
1560
+ var _this20 = this;
1511
1561
 
1512
1562
  if (!this.state.total) {
1513
1563
  return null;
@@ -1516,12 +1566,12 @@ function (_React$Component) {
1516
1566
  var total = this.state.total;
1517
1567
  return _react["default"].createElement("div", {
1518
1568
  ref: function ref(c) {
1519
- return _this19.tableTotal = c;
1569
+ return _this20.tableTotal = c;
1520
1570
  },
1521
1571
  className: "ck-ctable-total"
1522
1572
  }, _react["default"].createElement("table", {
1523
1573
  ref: function ref(c) {
1524
- return _this19.table_total = c;
1574
+ return _this20.table_total = c;
1525
1575
  },
1526
1576
  id: "table-total-".concat(this.domId),
1527
1577
  className: this.getClasses(),
@@ -1535,7 +1585,7 @@ function (_React$Component) {
1535
1585
  return null;
1536
1586
  }
1537
1587
 
1538
- var align = item.props.align || _this19.props.align;
1588
+ var align = item.props.align || _this20.props.align;
1539
1589
  var style = {
1540
1590
  'textAlign': align
1541
1591
  };
@@ -1545,7 +1595,7 @@ function (_React$Component) {
1545
1595
  }
1546
1596
 
1547
1597
  return _react["default"].createElement("td", {
1548
- id: _this19.domId + '-' + key,
1598
+ id: _this20.domId + '-' + key,
1549
1599
  "data-field": item.props.field,
1550
1600
  style: style
1551
1601
  }, item.props.onFormat ? item.props.onFormat(total[item.props.field], total, item.props.field) : total[item.props.field]);
@@ -1554,7 +1604,7 @@ function (_React$Component) {
1554
1604
  }, {
1555
1605
  key: "renderMenu",
1556
1606
  value: function renderMenu() {
1557
- var _this20 = this;
1607
+ var _this21 = this;
1558
1608
 
1559
1609
  var lang;
1560
1610
 
@@ -1573,7 +1623,7 @@ function (_React$Component) {
1573
1623
 
1574
1624
  return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
1575
1625
  ref: function ref(c) {
1576
- return _this20.mainMenu = c;
1626
+ return _this21.mainMenu = c;
1577
1627
  },
1578
1628
  onClick: this.menuClickHandler
1579
1629
  }, _react["default"].createElement(_reactBootstrap.Menu.Item, {
@@ -1593,7 +1643,7 @@ function (_React$Component) {
1593
1643
  var select = document.getSelection();
1594
1644
  if (!select) return;
1595
1645
 
1596
- _this20.filterHandler(select.toString(), data.field, 'contain');
1646
+ _this21.filterHandler(select.toString(), data.field, 'contain');
1597
1647
  }
1598
1648
  }, _react["default"].createElement(_reactBootstrap.Icon, {
1599
1649
  className: "me-1",
@@ -1604,7 +1654,7 @@ function (_React$Component) {
1604
1654
  var select = document.getSelection();
1605
1655
  if (!select) return;
1606
1656
 
1607
- _this20.filterHandler(select.toString(), data.field, 'exclude');
1657
+ _this21.filterHandler(select.toString(), data.field, 'exclude');
1608
1658
  }
1609
1659
  }, _react["default"].createElement(_reactBootstrap.Icon, {
1610
1660
  className: "me-1",
@@ -1612,7 +1662,7 @@ function (_React$Component) {
1612
1662
  }), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1613
1663
  field: "clear_filter",
1614
1664
  onClick: function onClick() {
1615
- _this20.clearFilter();
1665
+ _this21.clearFilter();
1616
1666
  }
1617
1667
  }, _react["default"].createElement("span", {
1618
1668
  className: "text-danger"
@@ -1629,7 +1679,7 @@ function (_React$Component) {
1629
1679
  style: inputStyle
1630
1680
  }, lang['Equal With']), _react["default"].createElement(_reactBootstrap.Input, {
1631
1681
  ref: function ref(c) {
1632
- return _this20.filter.equal = c;
1682
+ return _this21.filter.equal = c;
1633
1683
  },
1634
1684
  className: "me-1",
1635
1685
  size: "xs",
@@ -1638,13 +1688,13 @@ function (_React$Component) {
1638
1688
  onChange: this.filterChangeHandler('equal'),
1639
1689
  onMouseDown: stopEvent,
1640
1690
  onEnter: function onEnter() {
1641
- _this20.filterHandler(_this20.state.filter.equal, _this20.mainMenu.data.field, 'equal');
1691
+ _this21.filterHandler(_this21.state.filter.equal, _this21.mainMenu.data.field, 'equal');
1642
1692
  }
1643
1693
  }), _react["default"].createElement(_reactBootstrap.Button, {
1644
1694
  size: "xs",
1645
1695
  onMouseDown: stopEvent,
1646
1696
  onClick: function onClick(e) {
1647
- _this20.filterHandler(_this20.state.filter.equal, _this20.mainMenu.data.field, 'equal');
1697
+ _this21.filterHandler(_this21.state.filter.equal, _this21.mainMenu.data.field, 'equal');
1648
1698
  },
1649
1699
  icon: "search"
1650
1700
  })) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
@@ -1654,7 +1704,7 @@ function (_React$Component) {
1654
1704
  style: inputStyle
1655
1705
  }, lang['Start With']), _react["default"].createElement(_reactBootstrap.Input, {
1656
1706
  ref: function ref(c) {
1657
- return _this20.filter.start = c;
1707
+ return _this21.filter.start = c;
1658
1708
  },
1659
1709
  className: "me-1",
1660
1710
  size: "xs",
@@ -1663,13 +1713,13 @@ function (_React$Component) {
1663
1713
  onChange: this.filterChangeHandler('start'),
1664
1714
  onMouseDown: stopEvent,
1665
1715
  onEnter: function onEnter() {
1666
- _this20.filterHandler(_this20.state.filter.start, _this20.mainMenu.data.field, 'start');
1716
+ _this21.filterHandler(_this21.state.filter.start, _this21.mainMenu.data.field, 'start');
1667
1717
  }
1668
1718
  }), _react["default"].createElement(_reactBootstrap.Button, {
1669
1719
  size: "xs",
1670
1720
  onMouseDown: stopEvent,
1671
1721
  onClick: function onClick(e) {
1672
- _this20.filterHandler(_this20.state.filter.start, _this20.mainMenu.data.field, 'start');
1722
+ _this21.filterHandler(_this21.state.filter.start, _this21.mainMenu.data.field, 'start');
1673
1723
  },
1674
1724
  icon: "search"
1675
1725
  })) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
@@ -1679,7 +1729,7 @@ function (_React$Component) {
1679
1729
  style: inputStyle
1680
1730
  }, lang['End With']), _react["default"].createElement(_reactBootstrap.Input, {
1681
1731
  ref: function ref(c) {
1682
- return _this20.filter.end = c;
1732
+ return _this21.filter.end = c;
1683
1733
  },
1684
1734
  className: "me-1",
1685
1735
  size: "xs",
@@ -1688,13 +1738,13 @@ function (_React$Component) {
1688
1738
  onChange: this.filterChangeHandler('end'),
1689
1739
  onMouseDown: stopEvent,
1690
1740
  onEnter: function onEnter() {
1691
- _this20.filterHandler(_this20.state.filter.end, _this20.mainMenu.data.field, 'end');
1741
+ _this21.filterHandler(_this21.state.filter.end, _this21.mainMenu.data.field, 'end');
1692
1742
  }
1693
1743
  }), _react["default"].createElement(_reactBootstrap.Button, {
1694
1744
  size: "xs",
1695
1745
  onMouseDown: stopEvent,
1696
1746
  onClick: function onClick(e) {
1697
- _this20.filterHandler(_this20.state.filter.end, _this20.mainMenu.data.field, 'end');
1747
+ _this21.filterHandler(_this21.state.filter.end, _this21.mainMenu.data.field, 'end');
1698
1748
  },
1699
1749
  icon: "search"
1700
1750
  })) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
@@ -1704,7 +1754,7 @@ function (_React$Component) {
1704
1754
  style: inputStyle
1705
1755
  }, lang['Contain with']), _react["default"].createElement(_reactBootstrap.Input, {
1706
1756
  ref: function ref(c) {
1707
- return _this20.filter.contain = c;
1757
+ return _this21.filter.contain = c;
1708
1758
  },
1709
1759
  className: "me-1",
1710
1760
  size: "xs",
@@ -1713,13 +1763,13 @@ function (_React$Component) {
1713
1763
  onChange: this.filterChangeHandler('contain'),
1714
1764
  onMouseDown: stopEvent,
1715
1765
  onEnter: function onEnter() {
1716
- _this20.filterHandler(_this20.state.filter.contain, _this20.mainMenu.data.field, 'contain');
1766
+ _this21.filterHandler(_this21.state.filter.contain, _this21.mainMenu.data.field, 'contain');
1717
1767
  }
1718
1768
  }), _react["default"].createElement(_reactBootstrap.Button, {
1719
1769
  size: "xs",
1720
1770
  onMouseDown: stopEvent,
1721
1771
  onClick: function onClick(e) {
1722
- _this20.filterHandler(_this20.state.filter.contain, _this20.mainMenu.data.field, 'contain');
1772
+ _this21.filterHandler(_this21.state.filter.contain, _this21.mainMenu.data.field, 'contain');
1723
1773
  },
1724
1774
  icon: "search"
1725
1775
  })) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
@@ -1737,7 +1787,7 @@ function (_React$Component) {
1737
1787
  onChange: this.filterChangeHandler('condition'),
1738
1788
  onMouseDown: stopEvent,
1739
1789
  onEnter: function onEnter() {
1740
- _this20.filterHandler(_this20.state.filter.condition, _this20.mainMenu.data.field, 'condition');
1790
+ _this21.filterHandler(_this21.state.filter.condition, _this21.mainMenu.data.field, 'condition');
1741
1791
  }
1742
1792
  })) : null, this.props.edit ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1743
1793
  field: "",
@@ -1750,13 +1800,13 @@ function (_React$Component) {
1750
1800
  field: "",
1751
1801
  step: true
1752
1802
  }) : null, this.props.customMenu ? this.props.customMenu.map(function (menu) {
1753
- return _this20.explainCustomMenu(menu);
1803
+ return _this21.explainCustomMenu(menu);
1754
1804
  }) : null));
1755
1805
  }
1756
1806
  }, {
1757
1807
  key: "renderNumberMenu",
1758
1808
  value: function renderNumberMenu() {
1759
- var _this21 = this;
1809
+ var _this22 = this;
1760
1810
 
1761
1811
  var lang;
1762
1812
 
@@ -1775,7 +1825,7 @@ function (_React$Component) {
1775
1825
 
1776
1826
  return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
1777
1827
  ref: function ref(c) {
1778
- return _this21.numMenu = c;
1828
+ return _this22.numMenu = c;
1779
1829
  },
1780
1830
  onClick: this.menuClickHandler
1781
1831
  }, _react["default"].createElement(_reactBootstrap.Menu.Item, {
@@ -1795,7 +1845,7 @@ function (_React$Component) {
1795
1845
  var select = document.getSelection();
1796
1846
  if (!select) return;
1797
1847
 
1798
- _this21.filterHandler(select.toString(), data.field, 'contain');
1848
+ _this22.filterHandler(select.toString(), data.field, 'contain');
1799
1849
  }
1800
1850
  }, _react["default"].createElement(_reactBootstrap.Icon, {
1801
1851
  className: "me-1",
@@ -1806,7 +1856,7 @@ function (_React$Component) {
1806
1856
  var select = document.getSelection();
1807
1857
  if (!select) return;
1808
1858
 
1809
- _this21.filterHandler(select.toString(), data.field, 'exclude');
1859
+ _this22.filterHandler(select.toString(), data.field, 'exclude');
1810
1860
  }
1811
1861
  }, _react["default"].createElement(_reactBootstrap.Icon, {
1812
1862
  className: "me-1",
@@ -1814,7 +1864,7 @@ function (_React$Component) {
1814
1864
  }), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1815
1865
  field: "clear_filter",
1816
1866
  onClick: function onClick() {
1817
- _this21.clearFilter();
1867
+ _this22.clearFilter();
1818
1868
  }
1819
1869
  }, _react["default"].createElement("span", {
1820
1870
  className: "text-danger"
@@ -1836,14 +1886,21 @@ function (_React$Component) {
1836
1886
  onChange: this.filterChangeHandler('condition'),
1837
1887
  onMouseDown: stopEvent,
1838
1888
  onEnter: function onEnter() {
1839
- _this21.filterHandler(_this21.state.filter.condition, _this21.numMenu.data.field, 'condition');
1889
+ var reg = /(>=|<=|<|>|=|!=)+\s*(\d+)/i;
1890
+ var m = String(_this22.state.filter.condition).match(reg);
1891
+
1892
+ if (m) {
1893
+ _this22.filterHandler(m[2], _this22.numMenu.data.field, numberCondition[m[1]]);
1894
+ } else {
1895
+ _this22.filterHandler(_this22.state.filter.condition, _this22.numMenu.data.field, 'condition');
1896
+ }
1840
1897
  }
1841
1898
  }), _react["default"].createElement("div", null, "and,or,between,>,>=,<,<=,=")) : null));
1842
1899
  }
1843
1900
  }, {
1844
1901
  key: "explainCustomMenu",
1845
1902
  value: function explainCustomMenu(menu) {
1846
- var _this22 = this;
1903
+ var _this23 = this;
1847
1904
 
1848
1905
  if (menu.children && menu.children instanceof Array) {
1849
1906
  return _react["default"].createElement(_reactBootstrap.Menu.Item, {
@@ -1851,7 +1908,7 @@ function (_React$Component) {
1851
1908
  text: menu.text,
1852
1909
  child: true
1853
1910
  }, menu.children.map(function (item) {
1854
- return _this22.explainCustomMenu(item);
1911
+ return _this23.explainCustomMenu(item);
1855
1912
  }));
1856
1913
  } else {
1857
1914
  return _react["default"].createElement(_reactBootstrap.Menu.Item, {