@clake/react-bootstrap4-window 1.1.7 → 1.1.9
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/dist/react-bootstrap4-window.js +3 -3
- package/lib/CTable.js +91 -59
- package/lib/CTable.js.map +3 -3
- package/lib/CTableInput.js +2 -2
- package/lib/CTableInput.js.map +2 -2
- package/lib/CTableTextArea.js +2 -2
- package/lib/CTableTextArea.js.map +2 -2
- package/lib/Drag.js +2 -2
- package/lib/Drag.js.map +2 -2
- package/lib/IconButton.js +2 -2
- package/lib/IconButton.js.map +2 -2
- package/lib/PageBar.js +2 -2
- package/lib/PageBar.js.map +2 -2
- package/lib/TopMenu.js +2 -2
- package/lib/TopMenu.js.map +2 -2
- package/lib/WCalendar.js +2 -2
- package/lib/WCalendar.js.map +2 -2
- package/lib/WCombo.js +2 -2
- package/lib/WCombo.js.map +2 -2
- package/lib/WModal.js +2 -2
- package/lib/WModal.js.map +2 -2
- package/lib/Window.js +2 -2
- package/lib/Window.js.map +2 -2
- package/lib/WindowGroup.js +2 -2
- package/lib/WindowGroup.js.map +2 -2
- package/lib/css/CTableText.less +9 -0
- package/lib/i18n/CTable.js +2 -2
- package/lib/i18n/CTable.js.map +2 -2
- package/lib/index.js +2 -2
- package/lib/index.js.map +2 -2
- package/lib/types/expsrc/view/test/CTableTest.d.ts +1 -0
- package/lib/types/expsrc/view/test/CTableTest.d.ts.map +1 -1
- package/lib/types/src/CTable.d.ts +2 -1
- package/lib/types/src/CTable.d.ts.map +1 -1
- package/package.json +2 -2
package/lib/CTable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* @clake/react-bootstrap4-window v1.1.
|
|
1
|
+
/* @clake/react-bootstrap4-window v1.1.9 | by Clake
|
|
2
2
|
* Copyright (c) 2024 Clake,
|
|
3
|
-
* 2024-12-
|
|
3
|
+
* 2024-12-10T09:36:02+0800
|
|
4
4
|
*/
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
@@ -304,6 +304,31 @@ function (_React$Component) {
|
|
|
304
304
|
}
|
|
305
305
|
});
|
|
306
306
|
|
|
307
|
+
_defineProperty(_assertThisInitialized(_this), "deleteRow", function (row_index) {
|
|
308
|
+
if (row_index < 0 || row_index >= _this.state.data.length) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
var data = _this.state.data.slice(0);
|
|
313
|
+
|
|
314
|
+
data.splice(row_index, 1);
|
|
315
|
+
|
|
316
|
+
if (_this.editRows.indexOf(row_index) !== -1) {
|
|
317
|
+
_this.editRows.splice(_this.editRows.indexOf(row_index), 1);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
_this.editRows.forEach(function (item, index) {
|
|
321
|
+
if (item > row_index) {
|
|
322
|
+
_this.editRows[index] = item - 1;
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
_this.setState({
|
|
327
|
+
data: data,
|
|
328
|
+
dataCount: data.length
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
|
|
307
332
|
//全屏查看
|
|
308
333
|
_defineProperty(_assertThisInitialized(_this), "fullHandler", function () {
|
|
309
334
|
if (_this.isFull) {
|
|
@@ -387,6 +412,33 @@ function (_React$Component) {
|
|
|
387
412
|
value: function componentDidMount() {
|
|
388
413
|
this.bindSplit();
|
|
389
414
|
}
|
|
415
|
+
}, {
|
|
416
|
+
key: "componentDidUpdate",
|
|
417
|
+
value: function componentDidUpdate(prevProps, prevState, snapshot) {
|
|
418
|
+
var _this2 = this;
|
|
419
|
+
|
|
420
|
+
if (this.table_head) {
|
|
421
|
+
this.table_body.style.width = this.width;
|
|
422
|
+
var list = this.table_head.querySelectorAll('th');
|
|
423
|
+
list.forEach(function (item) {
|
|
424
|
+
if (!item.id) return;
|
|
425
|
+
|
|
426
|
+
var td = _this2.table_body.querySelector("#".concat(item.id));
|
|
427
|
+
|
|
428
|
+
if (td) {
|
|
429
|
+
td.style.width = item.style.width;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
if (_this2.table_total) {
|
|
433
|
+
var _td = _this2.table_total.querySelector("#".concat(item.id));
|
|
434
|
+
|
|
435
|
+
if (_td) {
|
|
436
|
+
_td.style.width = item.style.width;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
}
|
|
390
442
|
}, {
|
|
391
443
|
key: "UNSAFE_componentWillReceiveProps",
|
|
392
444
|
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
@@ -468,7 +520,7 @@ function (_React$Component) {
|
|
|
468
520
|
}, {
|
|
469
521
|
key: "initTableWidth",
|
|
470
522
|
value: function initTableWidth() {
|
|
471
|
-
var
|
|
523
|
+
var _this3 = this;
|
|
472
524
|
|
|
473
525
|
if (this.props.width) {
|
|
474
526
|
var width = 0;
|
|
@@ -481,10 +533,10 @@ function (_React$Component) {
|
|
|
481
533
|
var _matchs = item.props.width.match(reg);
|
|
482
534
|
|
|
483
535
|
width += parseInt(_matchs[1]);
|
|
484
|
-
|
|
536
|
+
_this3.headers[item.props.field] = item.props;
|
|
485
537
|
|
|
486
538
|
if (item.props.noClone) {
|
|
487
|
-
|
|
539
|
+
_this3.noClone[item.props.field] = "";
|
|
488
540
|
}
|
|
489
541
|
}
|
|
490
542
|
});
|
|
@@ -500,7 +552,7 @@ function (_React$Component) {
|
|
|
500
552
|
}, {
|
|
501
553
|
key: "sourceLoad",
|
|
502
554
|
value: function sourceLoad() {
|
|
503
|
-
var
|
|
555
|
+
var _this4 = this;
|
|
504
556
|
|
|
505
557
|
if (typeof this.props.sourceFunc !== 'function') return;
|
|
506
558
|
this.props.sourceFunc({
|
|
@@ -508,7 +560,7 @@ function (_React$Component) {
|
|
|
508
560
|
page: this.state.page,
|
|
509
561
|
number: this.props.showNumbers
|
|
510
562
|
}, function (res) {
|
|
511
|
-
|
|
563
|
+
_this4.setState({
|
|
512
564
|
data: res.data,
|
|
513
565
|
dataCount: res.count,
|
|
514
566
|
page: res.page
|
|
@@ -562,24 +614,24 @@ function (_React$Component) {
|
|
|
562
614
|
}, {
|
|
563
615
|
key: "changeHandler",
|
|
564
616
|
value: function changeHandler(row, i) {
|
|
565
|
-
var
|
|
617
|
+
var _this5 = this;
|
|
566
618
|
|
|
567
619
|
return function (checked, e) {
|
|
568
|
-
var selectRows =
|
|
620
|
+
var selectRows = _this5.setRowCheck(checked, i);
|
|
569
621
|
|
|
570
|
-
var
|
|
571
|
-
|
|
572
|
-
allChecked =
|
|
573
|
-
half =
|
|
622
|
+
var _this5$checkAllCheckH = _this5.checkAllCheckHalf(selectRows),
|
|
623
|
+
_this5$checkAllCheckH2 = _slicedToArray(_this5$checkAllCheckH, 2),
|
|
624
|
+
allChecked = _this5$checkAllCheckH2[0],
|
|
625
|
+
half = _this5$checkAllCheckH2[1];
|
|
574
626
|
|
|
575
|
-
|
|
627
|
+
_this5.setState({
|
|
576
628
|
selectRows: selectRows,
|
|
577
629
|
selectAll: allChecked,
|
|
578
630
|
selectHalf: half
|
|
579
631
|
});
|
|
580
632
|
|
|
581
|
-
if (typeof
|
|
582
|
-
|
|
633
|
+
if (typeof _this5.props.onCheck === "function") {
|
|
634
|
+
_this5.props.onCheck(checked, row, _this5.props.jsxId);
|
|
583
635
|
}
|
|
584
636
|
};
|
|
585
637
|
}
|
|
@@ -622,24 +674,24 @@ function (_React$Component) {
|
|
|
622
674
|
}, {
|
|
623
675
|
key: "clickHandler",
|
|
624
676
|
value: function clickHandler(row, i) {
|
|
625
|
-
var
|
|
677
|
+
var _this6 = this;
|
|
626
678
|
|
|
627
679
|
return function () {
|
|
628
|
-
if (typeof
|
|
629
|
-
|
|
680
|
+
if (typeof _this6.props.onClick === 'function') {
|
|
681
|
+
_this6.props.onClick(row, i, _this6.props.jsxId);
|
|
630
682
|
}
|
|
631
683
|
|
|
632
|
-
if (
|
|
633
|
-
var _row =
|
|
684
|
+
if (_this6.props.select && _this6.props.rowCheck) {
|
|
685
|
+
var _row = _this6.refs['row_' + i];
|
|
634
686
|
|
|
635
687
|
_row.changeHandler(null); // this.setRowCheck(!row.getChecked(),i);
|
|
636
688
|
// this.checkAllCheckHalf();
|
|
637
689
|
|
|
638
690
|
}
|
|
639
691
|
|
|
640
|
-
if (
|
|
641
|
-
|
|
642
|
-
focus: i ===
|
|
692
|
+
if (_this6.props.focus) {
|
|
693
|
+
_this6.setState({
|
|
694
|
+
focus: i === _this6.state.focus ? -1 : i
|
|
643
695
|
});
|
|
644
696
|
}
|
|
645
697
|
};
|
|
@@ -727,25 +779,25 @@ function (_React$Component) {
|
|
|
727
779
|
* @param dataType
|
|
728
780
|
*/
|
|
729
781
|
value: function menuContextHandler(dataType) {
|
|
730
|
-
var
|
|
782
|
+
var _this7 = this;
|
|
731
783
|
|
|
732
784
|
return function (e) {
|
|
733
785
|
e.preventDefault();
|
|
734
786
|
e.stopPropagation();
|
|
735
787
|
var data = {
|
|
736
788
|
field: e.currentTarget.dataset.field || '',
|
|
737
|
-
data:
|
|
789
|
+
data: _this7.state.data[e.currentTarget.dataset.row],
|
|
738
790
|
index: e.currentTarget.dataset.row
|
|
739
791
|
};
|
|
740
792
|
|
|
741
793
|
if (dataType === "text") {
|
|
742
|
-
|
|
794
|
+
_this7.mainMenu.show({
|
|
743
795
|
evt: e,
|
|
744
796
|
type: 'mouse',
|
|
745
797
|
data: data
|
|
746
798
|
});
|
|
747
799
|
} else {
|
|
748
|
-
|
|
800
|
+
_this7.numMenu.show({
|
|
749
801
|
evt: e,
|
|
750
802
|
type: 'mouse',
|
|
751
803
|
data: data
|
|
@@ -849,14 +901,14 @@ function (_React$Component) {
|
|
|
849
901
|
}, {
|
|
850
902
|
key: "filterChangeHandler",
|
|
851
903
|
value: function filterChangeHandler(field) {
|
|
852
|
-
var
|
|
904
|
+
var _this8 = this;
|
|
853
905
|
|
|
854
906
|
return function (val) {
|
|
855
|
-
var filter = _objectSpread({},
|
|
907
|
+
var filter = _objectSpread({}, _this8.state.filter);
|
|
856
908
|
|
|
857
909
|
filter[field] = val;
|
|
858
910
|
|
|
859
|
-
|
|
911
|
+
_this8.setState({
|
|
860
912
|
filter: filter
|
|
861
913
|
});
|
|
862
914
|
};
|
|
@@ -921,32 +973,6 @@ function (_React$Component) {
|
|
|
921
973
|
this.deleteRow(row_index);
|
|
922
974
|
}
|
|
923
975
|
}
|
|
924
|
-
}, {
|
|
925
|
-
key: "deleteRow",
|
|
926
|
-
value: function deleteRow(row_index) {
|
|
927
|
-
var _this8 = this;
|
|
928
|
-
|
|
929
|
-
if (row_index < 0 || row_index >= this.state.data.length) {
|
|
930
|
-
return;
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
var data = this.state.data.slice(0);
|
|
934
|
-
data.splice(row_index, 1);
|
|
935
|
-
|
|
936
|
-
if (this.editRows.indexOf(row_index) !== -1) {
|
|
937
|
-
this.editRows.splice(this.editRows.indexOf(row_index), 1);
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
this.editRows.forEach(function (item, index) {
|
|
941
|
-
if (item > row_index) {
|
|
942
|
-
_this8.editRows[index] = item - 1;
|
|
943
|
-
}
|
|
944
|
-
});
|
|
945
|
-
this.setState({
|
|
946
|
-
data: data,
|
|
947
|
-
dataCount: data.length
|
|
948
|
-
});
|
|
949
|
-
}
|
|
950
976
|
}, {
|
|
951
977
|
key: "cloneRow",
|
|
952
978
|
value: function cloneRow(row_index) {
|
|
@@ -1535,7 +1561,8 @@ function (_React$Component) {
|
|
|
1535
1561
|
width: item.props.width
|
|
1536
1562
|
};
|
|
1537
1563
|
return _react["default"].createElement("td", {
|
|
1538
|
-
style: style
|
|
1564
|
+
style: style,
|
|
1565
|
+
id: _this17.domId + '-' + key
|
|
1539
1566
|
}, _react["default"].createElement(_CTableInput["default"], {
|
|
1540
1567
|
onFocus: _this17.addNewHandler
|
|
1541
1568
|
}));
|
|
@@ -1681,7 +1708,12 @@ function (_React$Component) {
|
|
|
1681
1708
|
width: "20px"
|
|
1682
1709
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1683
1710
|
icon: "chart-line"
|
|
1684
|
-
})) : null,
|
|
1711
|
+
})) : null, !this.props.nodel && this.props.edit ? _react["default"].createElement("td", {
|
|
1712
|
+
style: {
|
|
1713
|
+
width: '20px',
|
|
1714
|
+
textAlign: 'center'
|
|
1715
|
+
}
|
|
1716
|
+
}) : null, _react["default"].Children.map(this.props.children, function (item, key) {
|
|
1685
1717
|
if (!item || item.props.hide) {
|
|
1686
1718
|
return null;
|
|
1687
1719
|
}
|