UI: Coerce decorator method rename
This commit is contained in:
parent
7da4d9b4fe
commit
e1fbfd64de
@ -15,11 +15,11 @@
|
|||||||
///
|
///
|
||||||
|
|
||||||
import {
|
import {
|
||||||
coerceArray,
|
coerceArray as coerceArrayAngular,
|
||||||
coerceBooleanProperty,
|
coerceBooleanProperty,
|
||||||
coerceCssPixelValue,
|
coerceCssPixelValue as coerceCssPixelValueAngular,
|
||||||
coerceNumberProperty,
|
coerceNumberProperty,
|
||||||
coerceStringArray
|
coerceStringArray as coerceStringArrayAngular
|
||||||
} from '@angular/cdk/coercion';
|
} from '@angular/cdk/coercion';
|
||||||
|
|
||||||
export const coerceBoolean = () => (target: any, key: string): void => {
|
export const coerceBoolean = () => (target: any, key: string): void => {
|
||||||
@ -56,13 +56,13 @@ export const coerceNumber = () => (target: any, key: string): void => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const coerceCssPixelProperty = () => (target: any, key: string): void => {
|
export const coerceCssPixelValue = () => (target: any, key: string): void => {
|
||||||
const getter = function(): string {
|
const getter = function(): string {
|
||||||
return this['__' + key];
|
return this['__' + key];
|
||||||
};
|
};
|
||||||
|
|
||||||
const setter = function(next: any) {
|
const setter = function(next: any) {
|
||||||
this['__' + key] = coerceCssPixelValue(next);
|
this['__' + key] = coerceCssPixelValueAngular(next);
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.defineProperty(target, key, {
|
Object.defineProperty(target, key, {
|
||||||
@ -73,13 +73,13 @@ export const coerceCssPixelProperty = () => (target: any, key: string): void =>
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const coerceArrayProperty = () => (target: any, key: string): void => {
|
export const coerceArray = () => (target: any, key: string): void => {
|
||||||
const getter = function(): any[] {
|
const getter = function(): any[] {
|
||||||
return this['__' + key];
|
return this['__' + key];
|
||||||
};
|
};
|
||||||
|
|
||||||
const setter = function(next: any) {
|
const setter = function(next: any) {
|
||||||
this['__' + key] = coerceArray(next);
|
this['__' + key] = coerceArrayAngular(next);
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.defineProperty(target, key, {
|
Object.defineProperty(target, key, {
|
||||||
@ -90,13 +90,13 @@ export const coerceArrayProperty = () => (target: any, key: string): void => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const coerceStringArrayProperty = (separator?: string | RegExp) => (target: any, key: string): void => {
|
export const coerceStringArray = (separator?: string | RegExp) => (target: any, key: string): void => {
|
||||||
const getter = function(): string[] {
|
const getter = function(): string[] {
|
||||||
return this['__' + key];
|
return this['__' + key];
|
||||||
};
|
};
|
||||||
|
|
||||||
const setter = function(next: any) {
|
const setter = function(next: any) {
|
||||||
this['__' + key] = coerceStringArray(next, separator);
|
this['__' + key] = coerceStringArrayAngular(next, separator);
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.defineProperty(target, key, {
|
Object.defineProperty(target, key, {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user