easy3wui 1.5.55-beta4 → 1.5.55-beta6

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.
@@ -514,13 +514,57 @@ var Easy3wEditBigTable = function (_Component) {
514
514
  return toolbar;
515
515
  };
516
516
 
517
+ _this.onCheckCellIsEditable = function (obj) {
518
+ var column = obj.column;
519
+ // column:当前列的信息。
520
+ // idx:当前单元格的索引。
521
+ // row:当前行的数据。
522
+ // rowIdx:当前行的索引
523
+
524
+ var editable = column.editable,
525
+ editor = column.editor;
526
+
527
+ if (editable || editor) {
528
+ // 单元格可编辑
529
+ return true; // 返回 true 表示允许编辑
530
+ } else {
531
+ return false; // 返回 false 表示禁止编辑
532
+ }
533
+ };
534
+
535
+ _this.touchRowRenderer = function (obj) {
536
+ var onCheckCellIsEditable = _this.props.onCheckCellIsEditable;
537
+ var renderBaseRow = obj.renderBaseRow,
538
+ columns = obj.columns,
539
+ row = obj.row,
540
+ idx = obj.idx;
541
+
542
+ var onCheckCellIsEditableNew = onCheckCellIsEditable || _this.onCheckCellIsEditable;
543
+ var columnsNew = [].concat(columns);
544
+ columns.map(function (column, index) {
545
+ if (onCheckCellIsEditableNew({ column: column, idx: idx, row: row })) {
546
+ columnsNew[index] = (0, _extends3['default'])({}, column, { cellClass: (column.cellClass || '') + ' custom-edit-cell' });
547
+ }
548
+ return column;
549
+ });
550
+ return _react2['default'].createElement(
551
+ 'span',
552
+ null,
553
+ renderBaseRow((0, _extends3['default'])({}, obj, {
554
+ columns: [].concat(columnsNew)
555
+ }))
556
+ );
557
+ };
558
+
517
559
  _this.getReactDataGridProps = function () {
518
560
  var arrValues = _this.state.arrValues;
519
561
  var _this$props8 = _this.props,
520
562
  enableCellSelect = _this$props8.enableCellSelect,
521
563
  rowKey = _this$props8.rowKey,
522
564
  objToolbarProps = _this$props8.objToolbarProps,
523
- rowSelection = _this$props8.rowSelection;
565
+ rowSelection = _this$props8.rowSelection,
566
+ onCheckCellIsEditable = _this$props8.onCheckCellIsEditable,
567
+ touchRowRenderer = _this$props8.touchRowRenderer;
524
568
 
525
569
  var objReactDataGridProps = {}; // ReactDataGrid属性对象
526
570
  // toolbar属性
@@ -537,6 +581,10 @@ var Easy3wEditBigTable = function (_Component) {
537
581
  if (enableCellSelect && typeof enableCellSelect === 'boolean') {
538
582
  objReactDataGridProps.enableCellSelect = enableCellSelect;
539
583
  objReactDataGridProps.onGridRowsUpdated = _this.onGridRowsUpdated; // 表格编辑
584
+ if (onCheckCellIsEditable) {
585
+ objReactDataGridProps.onCheckCellIsEditable = onCheckCellIsEditable; // 单元格是否可编辑
586
+ }
587
+ objReactDataGridProps.rowRenderer = touchRowRenderer || _this.touchRowRenderer; // 表格行渲染
540
588
  }
541
589
  // 表格行选择
542
590
  if (rowSelection && typeof rowSelection === 'boolean') {
@@ -727,6 +775,9 @@ var Easy3wEditBigTable = function (_Component) {
727
775
 
728
776
  // #endregion toolbar处理
729
777
  // #region 设置ReactDataGrid属性
778
+ // 在单元格设置为活动状态之前调用,返回一个布尔值以确定单元格是否可编辑
779
+
780
+ // 表格行渲染
730
781
 
731
782
  // 创建columns
732
783
 
@@ -747,7 +798,9 @@ var Easy3wEditBigTable = function (_Component) {
747
798
  var _props = this.props,
748
799
  totalFlag = _props.totalFlag,
749
800
  objOtherProps = _props.objOtherProps,
750
- objToolbarProps = _props.objToolbarProps;
801
+ objToolbarProps = _props.objToolbarProps,
802
+ strReactDataGridStyle = _props.strReactDataGridStyle,
803
+ strAddReactDataGridStyle = _props.strAddReactDataGridStyle;
751
804
 
752
805
  var objReactDataGridProps = this.getReactDataGridProps();
753
806
  var columns = this.createColumns(); // 表头
@@ -755,6 +808,11 @@ var Easy3wEditBigTable = function (_Component) {
755
808
  return _react2['default'].createElement(
756
809
  'div',
757
810
  { style: { backgroundColor: '#fff' } },
811
+ _react2['default'].createElement(
812
+ 'style',
813
+ null,
814
+ strReactDataGridStyle || (strAddReactDataGridStyle || '') + '\n .custom-edit-cell { \n background-color: #f6ffed;\n }\n '
815
+ ),
758
816
  _react2['default'].createElement(_reactDataGrid2['default'], (0, _extends3['default'])({}, this.props, {
759
817
  ref: this.ReactDataGridRef,
760
818
  columns: columns // 表头
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy3wui",
3
- "version": "1.5.55-beta4",
3
+ "version": "1.5.55-beta6",
4
4
  "description": "easy3wui components for react",
5
5
  "keywords": [
6
6
  "react",