@carbonorm/carbonreact 4.0.6 → 4.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,9 +25,10 @@ declare abstract class CarbonReact<P = {}, S extends iCarbonReactState = iCarbon
25
25
  private static persistentStateMap;
26
26
  context: Context<S & iCarbonReactState>;
27
27
  protected target: typeof CarbonReact;
28
- protected static _instance: typeof this;
29
- static get instance(): typeof this;
30
- static set instance(instance: typeof this);
28
+ protected static _instance: CarbonReact<any, any>;
29
+ static getInstance<T extends CarbonReact<any, any>>(): T;
30
+ static get instance(): CarbonReact<any, any>;
31
+ static set instance(instance: CarbonReact<any, any>);
31
32
  protected updateRestfulObjectArrays: <ObjectType extends {
32
33
  [key: string]: any;
33
34
  } = {}>(rest: Omit<iUpdateRestfulObjectArrays<ObjectType, S, P>, "instance">) => void;
@@ -6,7 +6,7 @@ export interface iAlertButtonOptions {
6
6
  className?: string;
7
7
  color: "default" | "primary" | "secondary" | "inherit" | "danger" | "info" | "success" | "warning" | undefined;
8
8
  }
9
- export interface iAlert<P, S> {
9
+ export interface iAlert<P, S extends iCarbonReactState> {
10
10
  title: string;
11
11
  text: string;
12
12
  instance: CarbonReact<P, S>;
@@ -22,7 +22,7 @@ export interface iAlert<P, S> {
22
22
  [key: string]: any;
23
23
  };
24
24
  }
25
- export declare function addAlert<P, S extends Partial<iCarbonReactState>>(props: iAlert<P, S>): void;
26
- export default function Alert<P, S extends Partial<iCarbonReactState>>({ instance }: {
25
+ export declare function addAlert<P, S extends iCarbonReactState>(props: iAlert<P, S>): void;
26
+ export default function Alert<P, S extends iCarbonReactState>({ instance }: {
27
27
  instance: CarbonReact<P, S>;
28
28
  }): import("react/jsx-runtime").JSX.Element | null;
@@ -1,6 +1,6 @@
1
1
  import CarbonReact, { iCarbonReactState } from "CarbonReact";
2
2
  import { tC6Tables, tC6RestApi } from "@carbonorm/carbonnode";
3
- export interface iCarbonWebSocketProps<P, S> {
3
+ export interface iCarbonWebSocketProps<P, S extends iCarbonReactState> {
4
4
  url?: string;
5
5
  timeoutSeconds?: number;
6
6
  heartbeatSeconds?: number;
@@ -12,5 +12,5 @@ export interface iCarbonWebSocketProps<P, S> {
12
12
  * @function connect
13
13
  * This function establishes a connection with the websocket and also ensures constant reconnection if connection closes
14
14
  **/
15
- export declare function initiateWebsocket<P, S extends Partial<iCarbonReactState>>(props: iCarbonWebSocketProps<P, S>): void;
16
- export default function <P, S extends Partial<iCarbonReactState>>(props: iCarbonWebSocketProps<P, S>): null;
15
+ export declare function initiateWebsocket<P, S extends iCarbonReactState>(props: iCarbonWebSocketProps<P, S>): void;
16
+ export default function <P, S extends iCarbonReactState>(props: iCarbonWebSocketProps<P, S>): null;
package/dist/index.cjs.js CHANGED
@@ -4365,8 +4365,11 @@ class CarbonReact extends react.Component {
4365
4365
  context = react.createContext(this.state);
4366
4366
  target;
4367
4367
  static _instance;
4368
+ static getInstance() {
4369
+ return this._instance;
4370
+ }
4368
4371
  static get instance() {
4369
- return this;
4372
+ return this.getInstance();
4370
4373
  }
4371
4374
  static set instance(instance) {
4372
4375
  this._instance = instance;