@matchlighter/common_library
Advanced tools
Comparing version 1.2.13 to 1.2.14
/** | ||
* @deprecated Use `@component_fragment` | ||
*/ | ||
export declare function observerMethod(target: any, key: any, descriptor: any): { | ||
configurable: boolean; | ||
get(): any; | ||
set(value: any): void; | ||
}; | ||
/** | ||
* Method decorator to make render methods MobX Observers. | ||
@@ -6,3 +14,3 @@ * Apply to a method that returns a React Element: | ||
* ```jsx | ||
* @observerMethod | ||
* @component_fragment | ||
* renderItem({ observable }) { | ||
@@ -13,6 +21,2 @@ * return <div>{observable.value}</div> | ||
*/ | ||
export declare function observerMethod(target: any, key: any, descriptor: any): { | ||
configurable: boolean; | ||
get(): any; | ||
set(value: any): void; | ||
}; | ||
export declare const component_fragment: typeof observerMethod; |
import React from 'react'; | ||
import { observer } from 'mobx-react'; | ||
/** | ||
* Method decorator to make render methods MobX Observers. | ||
* Apply to a method that returns a React Element: | ||
* | ||
* ```jsx | ||
* @observerMethod | ||
* renderItem({ observable }) { | ||
* return <div>{observable.value}</div> | ||
* } | ||
* ``` | ||
* @deprecated Use `@component_fragment` | ||
*/ | ||
@@ -54,2 +46,14 @@ export function observerMethod(target, key, descriptor) { | ||
} | ||
/** | ||
* Method decorator to make render methods MobX Observers. | ||
* Apply to a method that returns a React Element: | ||
* | ||
* ```jsx | ||
* @component_fragment | ||
* renderItem({ observable }) { | ||
* return <div>{observable.value}</div> | ||
* } | ||
* ``` | ||
*/ | ||
export const component_fragment = observerMethod; | ||
//# sourceMappingURL=method_component.js.map |
@@ -23,4 +23,5 @@ export declare const mapObject: <K extends string | number, V = any>(obj: { | ||
export declare function getInheritedHiddenProp<T>(target: any, propName: PropertyKey, type: 'prototypical'): Record<any, T>; | ||
export declare function getInheritedHiddenProp<T>(target: any, propName: PropertyKey, type: (target: any, inherit: T) => T): T; | ||
export declare function getInheritedHiddenProp<T>(target: any, propName: PropertyKey, defaultValue: Record<any, T> | 'object'): Record<any, T>; | ||
export declare function getInheritedHiddenProp<T>(target: any, propName: PropertyKey, defaultValue: T[] | 'array'): T[]; | ||
export declare function getInheritedHiddenProp<T>(target: any, propName: PropertyKey, defaultValue: 'set'): Set<T>; |
@@ -55,3 +55,6 @@ export const mapObject = (obj, valueTransform, keyTransform) => { | ||
let newValue; | ||
if (Array.isArray(defaultValue) || defaultValue == 'array') { | ||
if (typeof defaultValue == 'function') { | ||
newValue = defaultValue(target, inherited); | ||
} | ||
else if (Array.isArray(defaultValue) || defaultValue == 'array') { | ||
newValue = inherited ? [...inherited] : []; | ||
@@ -58,0 +61,0 @@ } |
{ | ||
"name": "@matchlighter/common_library", | ||
"version": "1.2.13", | ||
"version": "1.2.14", | ||
"description": "Shared Functions, Helpers, Patterns & Utilities for Apps and Libraries", | ||
@@ -5,0 +5,0 @@ "author": "Matchlighter", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
148104
125
2333