Skip to content

Commit

Permalink
fix(pagination): get pagination working in SF as well (#24)
Browse files Browse the repository at this point in the history
* fix(pagination): get pagination working in SF as well
  • Loading branch information
ghiscoding authored Jul 22, 2020
1 parent 1482e41 commit 1132f2e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/common/src/services/extension.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export class ExtensionService {
// }
// }
if (options.enableDraggableGrouping) {
if (!this.getCreatedExtensionByName(ExtensionName.rowDetailView)) {
if (!this.getCreatedExtensionByName(ExtensionName.draggableGrouping)) {
const draggableInstance = this.draggableGroupingExtension.create(options);
options.enableColumnReorder = draggableInstance?.getSetupColumnReorder !== undefined;
if (draggableInstance) {
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/styles/slick-pagination.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@

.pagination {
margin: 0;
display: inline-flex;

.page-link {
font-size: ($font-size-base - 1px);
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions packages/vanilla-bundle/src/components/slick-pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ export class SlickPaginationComponent {
this._paginationElement = temp.firstChild as HTMLDivElement;
this._paginationElement.classList.add(this.gridUid, 'pager');

if (gridParentContainerElm?.append && this._paginationElement) {
gridParentContainerElm.append(this._paginationElement);
if (gridParentContainerElm?.appendChild && this._paginationElement) {
gridParentContainerElm.appendChild(this._paginationElement);
this.renderPageSizes();
this.addBindings();
this.addEventListeners();
Expand Down
14 changes: 9 additions & 5 deletions packages/vanilla-bundle/src/services/binding.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export class BindingService {
this._property = binding.property || '';
this.elementBindings = [];
if (binding.property && binding.variable && (binding.variable.hasOwnProperty(binding.property) || binding.property in binding.variable)) {
this._value = typeof binding.variable[binding.property] === 'string' ? DOMPurify.sanitize(binding.variable[binding.property], {}) : binding.variable[binding.property];
this._value = typeof binding.variable[binding.property] === 'string' ? this.sanitizeText(binding.variable[binding.property]) : binding.variable[binding.property];
} else {
this._value = typeof binding.variable === 'string' ? DOMPurify.sanitize(binding.variable, {}) : binding.variable;
this._value = typeof binding.variable === 'string' ? this.sanitizeText(binding.variable) : binding.variable;
}

if (typeof binding.variable === 'object') {
Expand All @@ -54,11 +54,11 @@ export class BindingService {
}

valueSetter(val: any) {
this._value = typeof val === 'string' ? DOMPurify.sanitize(val, {}) : val;
this._value = typeof val === 'string' ? this.sanitizeText(val) : val;
if (Array.isArray(this.elementBindings)) {
for (const binding of this.elementBindings) {
if (binding?.element && binding?.attribute) {
binding.element[binding.attribute] = typeof val === 'string' ? DOMPurify.sanitize(val, {}) : val;
binding.element[binding.attribute] = typeof val === 'string' ? this.sanitizeText(val) : val;
}
}
}
Expand Down Expand Up @@ -92,7 +92,7 @@ export class BindingService {
element.addEventListener(eventName, listener);
}
this.elementBindings.push(binding);
element[attribute] = typeof this._value === 'string' ? DOMPurify.sanitize(this._value, {}) : this._value;
element[attribute] = typeof this._value === 'string' ? this.sanitizeText(this._value) : this._value;
}
return this;
}
Expand All @@ -103,4 +103,8 @@ export class BindingService {
element.removeEventListener(eventName, listener, options);
}
}

private sanitizeText(dirtyText: string): string {
return (DOMPurify?.sanitize) ? DOMPurify.sanitize(dirtyText, {}) : dirtyText;
}
}

0 comments on commit 1132f2e

Please sign in to comment.