Skip to content

Commit

Permalink
fix regex
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Feb 11, 2019
1 parent bb1f3c0 commit 8c98cdf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/renderer/AAggregatedGroupRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export abstract class AAggregatedGroupRenderer<T extends Column> implements ICel
createGroup(col: T, context: IRenderContext, imposer?: IImposer): IGroupCellRenderer {
const single = this.create(col, context, imposer);
return {
template: `<div>${single.template}</div>`,
template: single.template,
update: (node: HTMLElement, group: IOrderedGroup) => {
return context.tasks.groupRows(col, group, 'aagreated', (rows) => this.aggregatedIndex(rows, col)).then((data) => {
if (typeof data !== 'symbol') {
single.update(<HTMLElement>node.firstElementChild!, data.row, data.index, group);
single.update(node, data.row, data.index, group);
}
});
}
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/MultiLevelCellRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export function createData(parent: {children: Column[]} & Column, context: IRend
// inject data attributes
template = template.replace(/^<([^ >]+)([ >])/, `<$1 data-column-id="${column.id}" data-renderer="${rendererId}"$2`);
// inject classes
if (/^<([^ >]+)class="([ >])/.test(template)) {
if (/^<([^>]+) class="([ >]*)/.test(template)) {
// has class attribute
template = template.replace(/^<([^ >]+)class="([ >])/, `<$1 class="${cssClass(`renderer-${rendererId}`)} $2`);
template = template.replace(/^<([^>]+) class="([ >]*)/, `<$1 class="${cssClass(`renderer-${rendererId}`)} $2`);
} else {
// inject as the others
template = template.replace(/^<([^ >]+)([ >])/, `<$1 class="${cssClass(`renderer-${rendererId}`)}"$2`);
Expand Down Expand Up @@ -93,7 +93,7 @@ export default class MultiLevelCellRenderer extends AAggregatedGroupRenderer<IMu
cols.forEach((col, ci) => {
const weight = col.column.getWidth() / total;
const cnode = children[ci];
cnode.classList.add(cssClass('stack-sub'), cssClass('detail'));
cnode.classList.add(cssClass(this.stacked ? 'stack-sub' : 'nested-sub'), cssClass('detail'));
cnode.dataset.group = 'd';
cnode.style.transform = stacked ? `translate(-${round((missingWeight / weight) * 100, 4)}%,0)` : null;
cnode.style.gridColumnStart = (ci + 1).toString();
Expand Down Expand Up @@ -174,7 +174,7 @@ export default class MultiLevelCellRenderer extends AAggregatedGroupRenderer<IMu
const children = <HTMLElement[]>Array.from(n.children);
cols.forEach((col, ci) => {
const cnode = children[ci];
cnode.classList.add(cssClass('stack-sub'), cssClass('group'));
cnode.classList.add(cssClass(this.stacked ? 'stack-sub' : 'nested-sub'), cssClass('group'));
cnode.dataset.group = 'g';
cnode.style.gridColumnStart = (ci + 1).toString();
const r = col.groupRenderer!.update(cnode, group);
Expand Down

0 comments on commit 8c98cdf

Please sign in to comment.