table-column-xform.js 901 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. const BaseXform = require('../base-xform');
  2. class TableColumnXform extends BaseXform {
  3. get tag() {
  4. return 'tableColumn';
  5. }
  6. prepare(model, options) {
  7. model.id = options.index + 1;
  8. }
  9. render(xmlStream, model) {
  10. xmlStream.leafNode(this.tag, {
  11. id: model.id.toString(),
  12. name: model.name,
  13. totalsRowLabel: model.totalsRowLabel,
  14. totalsRowFunction: model.totalsRowFunction,
  15. dxfId: model.dxfId,
  16. });
  17. return true;
  18. }
  19. parseOpen(node) {
  20. if (node.name === this.tag) {
  21. const {attributes} = node;
  22. this.model = {
  23. name: attributes.name,
  24. totalsRowLabel: attributes.totalsRowLabel,
  25. totalsRowFunction: attributes.totalsRowFunction,
  26. dxfId: attributes.dxfId,
  27. };
  28. return true;
  29. }
  30. return false;
  31. }
  32. parseText() {}
  33. parseClose() {
  34. return false;
  35. }
  36. }
  37. module.exports = TableColumnXform;