Browse Source

Merge pull request #11273 from abpframework/auto-merge/rel-5-0/782

Merge branch rel-5.1 with rel-5.0
pull/11275/head
Mehmet Erim 4 years ago
committed by GitHub
parent
commit
c37dc044fc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      npm/ng-packs/packages/core/src/lib/utils/string-utils.ts
  2. 4
      npm/ng-packs/packages/identity/src/lib/defaults/default-roles-entity-props.ts
  3. 6
      npm/ng-packs/packages/identity/src/lib/defaults/default-users-entity-props.ts
  4. 5
      npm/ng-packs/packages/theme-shared/extensions/src/lib/models/entity-props.ts

7
npm/ng-packs/packages/core/src/lib/utils/string-utils.ts

@ -21,3 +21,10 @@ export function interpolate(text: string, params: string[]) {
.replace(/(['"]?\{\s*(\d+)\s*\}['"]?)/g, (_, match, digit) => params[digit] ?? match)
.replace(/\s+/g, ' ');
}
export function escapeHtmlChars(value: string) {
return (
value &&
value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;')
);
}

4
npm/ng-packs/packages/identity/src/lib/defaults/default-roles-entity-props.ts

@ -1,4 +1,4 @@
import { LocalizationService } from '@abp/ng.core';
import { escapeHtmlChars, LocalizationService } from '@abp/ng.core';
import { IdentityRoleDto } from '@abp/ng.identity/proxy';
import { EntityProp, ePropType } from '@abp/ng.theme.shared/extensions';
import { of } from 'rxjs';
@ -15,7 +15,7 @@ export const DEFAULT_ROLES_ENTITY_PROPS = EntityProp.createMany<IdentityRoleDto>
const { isDefault, isPublic, name } = data.record;
return of(
name +
escapeHtmlChars(name) +
(isDefault
? `<span class="badge rounded-pill bg-success ms-1">${t(
'AbpIdentity::DisplayName:IsDefault',

6
npm/ng-packs/packages/identity/src/lib/defaults/default-users-entity-props.ts

@ -1,4 +1,4 @@
import { LocalizationService } from '@abp/ng.core';
import { escapeHtmlChars, LocalizationService } from '@abp/ng.core';
import { IdentityUserDto } from '@abp/ng.identity/proxy';
import { EntityProp, ePropType } from '@abp/ng.theme.shared/extensions';
import { of } from 'rxjs';
@ -21,7 +21,9 @@ export const DEFAULT_USERS_ENTITY_PROPS = EntityProp.createMany<IdentityUserDto>
return of(
`
${!data.record.isActive ? inactiveIcon : ''}
<span class="${!data.record.isActive ? 'text-muted' : ''}">${data.record.userName}</span>`,
<span class="${!data.record.isActive ? 'text-muted' : ''}">${escapeHtmlChars(
data.record.userName,
)}</span>`,
);
},
},

5
npm/ng-packs/packages/theme-shared/extensions/src/lib/models/entity-props.ts

@ -1,7 +1,7 @@
import { ABP, escapeHtmlChars } from '@abp/ng.core';
import { Type } from '@angular/core';
import { Observable, of } from 'rxjs';
import { O } from 'ts-toolbelt';
import { ABP } from '@abp/ng.core';
import { ActionCallback } from './actions';
import {
Prop,
@ -43,7 +43,8 @@ export class EntityProp<R = any> extends Prop<R> {
this.columnWidth = options.columnWidth;
this.sortable = options.sortable || false;
this.valueResolver = options.valueResolver || (data => of(data.record[this.name]));
this.valueResolver =
options.valueResolver || (data => of(escapeHtmlChars(data.record[this.name])));
this.action = options.action;
this.component = options.component;
this.enumList = options.enumList;

Loading…
Cancel
Save