first commit
SAP-ERP Portal CI/CD / build (push) Failing after 5m20s

This commit is contained in:
John
2026-09-23 17:31:02 +05:30
commit 69b4e68baf
51657 changed files with 3864077 additions and 0 deletions
+81
View File
@@ -0,0 +1,81 @@
const BaseXform = require('../base-xform');
const FilterColumnXform = require('./filter-column-xform');
class AutoFilterXform extends BaseXform {
constructor() {
super();
this.map = {
filterColumn: new FilterColumnXform(),
};
}
get tag() {
return 'autoFilter';
}
prepare(model) {
model.columns.forEach((column, index) => {
this.map.filterColumn.prepare(column, {index});
});
}
render(xmlStream, model) {
xmlStream.openNode(this.tag, {ref: model.autoFilterRef});
model.columns.forEach(column => {
this.map.filterColumn.render(xmlStream, column);
});
xmlStream.closeNode();
return true;
}
parseOpen(node) {
if (this.parser) {
this.parser.parseOpen(node);
return true;
}
switch (node.name) {
case this.tag:
this.model = {
autoFilterRef: node.attributes.ref,
columns: [],
};
return true;
default:
this.parser = this.map[node.name];
if (this.parser) {
this.parseOpen(node);
return true;
}
throw new Error(`Unexpected xml node in parseOpen: ${JSON.stringify(node)}`);
}
}
parseText(text) {
if (this.parser) {
this.parser.parseText(text);
}
}
parseClose(name) {
if (this.parser) {
if (!this.parser.parseClose(name)) {
this.model.columns.push(this.parser.model);
this.parser = undefined;
}
return true;
}
switch (name) {
case this.tag:
return false;
default:
throw new Error(`Unexpected xml node in parseClose: ${name}`);
}
}
}
module.exports = AutoFilterXform;
+33
View File
@@ -0,0 +1,33 @@
const BaseXform = require('../base-xform');
class CustomFilterXform extends BaseXform {
get tag() {
return 'customFilter';
}
render(xmlStream, model) {
xmlStream.leafNode(this.tag, {
val: model.val,
operator: model.operator,
});
}
parseOpen(node) {
if (node.name === this.tag) {
this.model = {
val: node.attributes.val,
operator: node.attributes.operator,
};
return true;
}
return false;
}
parseText() {}
parseClose() {
return false;
}
}
module.exports = CustomFilterXform;
+96
View File
@@ -0,0 +1,96 @@
const BaseXform = require('../base-xform');
const ListXform = require('../list-xform');
const CustomFilterXform = require('./custom-filter-xform');
const FilterXform = require('./filter-xform');
class FilterColumnXform extends BaseXform {
constructor() {
super();
this.map = {
customFilters: new ListXform({
tag: 'customFilters',
count: false,
empty: true,
childXform: new CustomFilterXform(),
}),
filters: new ListXform({
tag: 'filters',
count: false,
empty: true,
childXform: new FilterXform(),
}),
};
}
get tag() {
return 'filterColumn';
}
prepare(model, options) {
model.colId = options.index.toString();
}
render(xmlStream, model) {
if (model.customFilters) {
xmlStream.openNode(this.tag, {
colId: model.colId,
hiddenButton: model.filterButton ? '0' : '1',
});
this.map.customFilters.render(xmlStream, model.customFilters);
xmlStream.closeNode();
return true;
}
xmlStream.leafNode(this.tag, {
colId: model.colId,
hiddenButton: model.filterButton ? '0' : '1',
});
return true;
}
parseOpen(node) {
if (this.parser) {
this.parser.parseOpen(node);
return true;
}
const {attributes} = node;
switch (node.name) {
case this.tag:
this.model = {
filterButton: attributes.hiddenButton === '0',
};
return true;
default:
this.parser = this.map[node.name];
if (this.parser) {
this.parseOpen(node);
return true;
}
throw new Error(`Unexpected xml node in parseOpen: ${JSON.stringify(node)}`);
}
}
parseText() {}
parseClose(name) {
if (this.parser) {
if (!this.parser.parseClose(name)) {
this.parser = undefined;
}
return true;
}
switch (name) {
case this.tag:
this.model.customFilters = this.map.customFilters.model;
return false;
default:
// could be some unrecognised tags
return true;
}
}
}
module.exports = FilterColumnXform;
+31
View File
@@ -0,0 +1,31 @@
const BaseXform = require('../base-xform');
class FilterXform extends BaseXform {
get tag() {
return 'filter';
}
render(xmlStream, model) {
xmlStream.leafNode(this.tag, {
val: model.val,
});
}
parseOpen(node) {
if (node.name === this.tag) {
this.model = {
val: node.attributes.val,
};
return true;
}
return false;
}
parseText() {}
parseClose() {
return false;
}
}
module.exports = FilterXform;
+44
View File
@@ -0,0 +1,44 @@
const BaseXform = require('../base-xform');
class TableColumnXform extends BaseXform {
get tag() {
return 'tableColumn';
}
prepare(model, options) {
model.id = options.index + 1;
}
render(xmlStream, model) {
xmlStream.leafNode(this.tag, {
id: model.id.toString(),
name: model.name,
totalsRowLabel: model.totalsRowLabel,
totalsRowFunction: model.totalsRowFunction,
dxfId: model.dxfId,
});
return true;
}
parseOpen(node) {
if (node.name === this.tag) {
const {attributes} = node;
this.model = {
name: attributes.name,
totalsRowLabel: attributes.totalsRowLabel,
totalsRowFunction: attributes.totalsRowFunction,
dxfId: attributes.dxfId,
};
return true;
}
return false;
}
parseText() {}
parseClose() {
return false;
}
}
module.exports = TableColumnXform;
+41
View File
@@ -0,0 +1,41 @@
const BaseXform = require('../base-xform');
class TableStyleInfoXform extends BaseXform {
get tag() {
return 'tableStyleInfo';
}
render(xmlStream, model) {
xmlStream.leafNode(this.tag, {
name: model.theme ? model.theme : undefined,
showFirstColumn: model.showFirstColumn ? '1' : '0',
showLastColumn: model.showLastColumn ? '1' : '0',
showRowStripes: model.showRowStripes ? '1' : '0',
showColumnStripes: model.showColumnStripes ? '1' : '0',
});
return true;
}
parseOpen(node) {
if (node.name === this.tag) {
const {attributes} = node;
this.model = {
theme: attributes.name ? attributes.name : null,
showFirstColumn: attributes.showFirstColumn === '1',
showLastColumn: attributes.showLastColumn === '1',
showRowStripes: attributes.showRowStripes === '1',
showColumnStripes: attributes.showColumnStripes === '1',
};
return true;
}
return false;
}
parseText() {}
parseClose() {
return false;
}
}
module.exports = TableStyleInfoXform;
+131
View File
@@ -0,0 +1,131 @@
const XmlStream = require('../../../utils/xml-stream');
const BaseXform = require('../base-xform');
const ListXform = require('../list-xform');
const AutoFilterXform = require('./auto-filter-xform');
const TableColumnXform = require('./table-column-xform');
const TableStyleInfoXform = require('./table-style-info-xform');
class TableXform extends BaseXform {
constructor() {
super();
this.map = {
autoFilter: new AutoFilterXform(),
tableColumns: new ListXform({
tag: 'tableColumns',
count: true,
empty: true,
childXform: new TableColumnXform(),
}),
tableStyleInfo: new TableStyleInfoXform(),
};
}
prepare(model, options) {
this.map.autoFilter.prepare(model);
this.map.tableColumns.prepare(model.columns, options);
}
get tag() {
return 'table';
}
render(xmlStream, model) {
xmlStream.openXml(XmlStream.StdDocAttributes);
xmlStream.openNode(this.tag, {
...TableXform.TABLE_ATTRIBUTES,
id: model.id,
name: model.name,
displayName: model.displayName || model.name,
ref: model.tableRef,
totalsRowCount: model.totalsRow ? '1' : undefined,
totalsRowShown: model.totalsRow ? undefined : '1',
headerRowCount: model.headerRow ? '1' : '0',
});
this.map.autoFilter.render(xmlStream, model);
this.map.tableColumns.render(xmlStream, model.columns);
this.map.tableStyleInfo.render(xmlStream, model.style);
xmlStream.closeNode();
}
parseOpen(node) {
if (this.parser) {
this.parser.parseOpen(node);
return true;
}
const {name, attributes} = node;
switch (name) {
case this.tag:
this.reset();
this.model = {
name: attributes.name,
displayName: attributes.displayName || attributes.name,
tableRef: attributes.ref,
totalsRow: attributes.totalsRowCount === '1',
headerRow: attributes.headerRowCount === '1',
};
break;
default:
this.parser = this.map[node.name];
if (this.parser) {
this.parser.parseOpen(node);
}
break;
}
return true;
}
parseText(text) {
if (this.parser) {
this.parser.parseText(text);
}
}
parseClose(name) {
if (this.parser) {
if (!this.parser.parseClose(name)) {
this.parser = undefined;
}
return true;
}
switch (name) {
case this.tag:
this.model.columns = this.map.tableColumns.model;
if (this.map.autoFilter.model) {
this.model.autoFilterRef = this.map.autoFilter.model.autoFilterRef;
this.map.autoFilter.model.columns.forEach((column, index) => {
this.model.columns[index].filterButton = column.filterButton;
});
}
this.model.style = this.map.tableStyleInfo.model;
return false;
default:
// could be some unrecognised tags
return true;
}
}
reconcile(model, options) {
// fetch the dfxs from styles
model.columns.forEach(column => {
if (column.dxfId !== undefined) {
column.style = options.styles.getDxfStyle(column.dxfId);
}
});
}
}
TableXform.TABLE_ATTRIBUTES = {
xmlns: 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',
'xmlns:mc': 'http://schemas.openxmlformats.org/markup-compatibility/2006',
'mc:Ignorable': 'xr xr3',
'xmlns:xr': 'http://schemas.microsoft.com/office/spreadsheetml/2014/revision',
'xmlns:xr3': 'http://schemas.microsoft.com/office/spreadsheetml/2016/revision3',
// 'xr:uid': '{00000000-000C-0000-FFFF-FFFF00000000}',
};
module.exports = TableXform;