( styleName: string, parse: (value: string) => T = value => value as T, )
| 2 | import type {Layout} from '../components'; |
| 3 | |
| 4 | export function defaultStyle<T>( |
| 5 | styleName: string, |
| 6 | parse: (value: string) => T = value => value as T, |
| 7 | ): PropertyDecorator { |
| 8 | return (target: any, key) => { |
| 9 | target[`getDefault${capitalize(<string>key)}`] = function (this: Layout) { |
| 10 | this.requestLayoutUpdate(); |
| 11 | const old = (<any>this.element.style)[styleName]; |
| 12 | (<any>this.element.style)[styleName] = ''; |
| 13 | const ret = parse.call(this, this.styles.getPropertyValue(styleName)); |
| 14 | (<any>this.element.style)[styleName] = old; |
| 15 | return ret; |
| 16 | }; |
| 17 | }; |
| 18 | } |
no test coverage detected