rt_grid.dart 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import 'package:fis_lib_report/report/cellPostion.dart';
  2. import 'package:fis_lib_report/report/element_type.dart';
  3. import 'package:fis_lib_report/report/interfaces/cell.dart';
  4. import 'package:fis_lib_report/report/interfaces/grid.dart';
  5. import 'package:fis_lib_report/report/interfaces/report_element.dart';
  6. import 'package:fis_lib_report/report/rt_table.dart';
  7. import 'package:fis_lib_report/report_info/block_element_info_interface.dart';
  8. import 'package:fis_lib_report/report_info/element_info.dart';
  9. import 'package:fis_lib_report/report_info/rt_cell_info.dart';
  10. class RTGridInfo extends ElementInfo {
  11. @override
  12. List<RTColumnDefinition>? columnDefinitions = [];
  13. @override
  14. List<RTRowDefinition>? rowDefinitions = [];
  15. bool? isDelete;
  16. bool? isInsertColumn;
  17. int? deleteRowIndex;
  18. int? deleteColumnIndex;
  19. bool? isMergeCell;
  20. int? mergeDeleteStartColumnIndex;
  21. int? mergeDeleteEndColumnIndex;
  22. Map<CellPostion, RTCellInfo>? cells = {};
  23. RTGridInfo.fromElement(RTTable table) : super.fromElement(table) {
  24. columnDefinitions = table.columnDefinitions;
  25. rowDefinitions = table.rowDefinitions;
  26. isDelete = table.isDelete;
  27. isInsertColumn = table.isInsertColumn;
  28. deleteRowIndex = table.deleteColumnIndex;
  29. deleteColumnIndex = table.deleteColumnIndex;
  30. isMergeCell = table.isMergeCell;
  31. mergeDeleteStartColumnIndex = table.mergeDeleteStartColumnIndex;
  32. mergeDeleteEndColumnIndex = table.mergeDeleteEndColumnIndex;
  33. table.cells!.forEach((key, value) {
  34. cells![key] = RTCellInfo.fromElement(value);
  35. });
  36. }
  37. @override
  38. Map<String, dynamic> toJson() {
  39. final map = <String, dynamic>{};
  40. map.addAll(super.toJson());
  41. final blockInfos = [];
  42. cells!.forEach((key, value) {
  43. blockInfos.add(key.toJson());
  44. blockInfos.add(value.toJson());
  45. });
  46. map['Cells'] = blockInfos;
  47. return map;
  48. }
  49. }