@carbonorm/carbonreact 2.0.0 → 2.0.1
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.
- package/dist/CarbonReact.d.ts +6 -13
- package/dist/hoc/deleteRestfulObjectArrays.d.ts +3 -2
- package/dist/hoc/getStyles.d.ts +3 -3
- package/dist/hoc/updateRestfulObjectArrays.d.ts +3 -2
- package/dist/index.cjs.js +1519 -2650
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.esm.js +1517 -2636
- package/dist/index.esm.js.map +1 -1
- package/dist/variables/C6.d.ts +33 -564
- package/package.json +1 -1
- package/src/CarbonReact.tsx +4 -5
- package/src/hoc/deleteRestfulObjectArrays.tsx +7 -5
- package/src/hoc/updateRestfulObjectArrays.tsx +6 -6
- package/src/index.ts +0 -2
- package/src/variables/C6.tsx +3 -1
- package/dist/components/Errors/Localhost.d.ts +0 -1
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import CarbonReact, {iCarbonORMState
|
|
1
|
+
import CarbonReact, {iCarbonORMState} from "CarbonReact";
|
|
2
|
+
import {iRestfulObjectArrayTypes, tRestfulObjectValues} from "variables/C6";
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
//ObjectType, UniqueIdType extends keyof ObjectType
|
|
5
|
-
export default function deleteRestfulObjectArrays<ObjectType
|
|
6
|
+
export default function deleteRestfulObjectArrays<ObjectType = tRestfulObjectValues, ObjectArrayTypes = iRestfulObjectArrayTypes>
|
|
6
7
|
(dataOrCallback: ((prev: Readonly<iCarbonORMState>) => ObjectType[]) | ObjectType[],
|
|
7
|
-
stateKey: keyof
|
|
8
|
+
stateKey: keyof ObjectArrayTypes,
|
|
8
9
|
uniqueObjectId: keyof ObjectType,
|
|
9
10
|
callback?: () => void): void {
|
|
10
11
|
|
|
11
|
-
return CarbonReact.instance.setState((previousBootstrapState): {} => {
|
|
12
|
+
return CarbonReact.instance.setState((previousBootstrapState ): {} => {
|
|
12
13
|
|
|
13
14
|
let newOrReplacementData: ObjectType[] = dataOrCallback instanceof Function ? dataOrCallback(previousBootstrapState) : dataOrCallback;
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
const previousStateProperty = previousBootstrapState[stateKey];
|
|
16
18
|
|
|
17
19
|
return {
|
|
18
20
|
[stateKey]: null === previousBootstrapState ? null : [
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import CarbonReact, {
|
|
2
|
-
iCarbonORMState
|
|
3
|
-
iRestfulObjectArrayTypes,
|
|
4
|
-
tRestfulObjectValues
|
|
2
|
+
iCarbonORMState
|
|
5
3
|
} from "CarbonReact";
|
|
4
|
+
import {iRestfulObjectArrayTypes, tRestfulObjectValues} from "variables/C6";
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
export enum eUpdateInsertMethod {
|
|
@@ -21,9 +20,9 @@ export enum eUpdateInsertMethod {
|
|
|
21
20
|
* @param callback - if you want to do something with the updated state, you can pass a callback here. Run as the second
|
|
22
21
|
* parameter of setState.
|
|
23
22
|
*/
|
|
24
|
-
export default function updateRestfulObjectArray<ObjectType
|
|
23
|
+
export default function updateRestfulObjectArray<ObjectType = tRestfulObjectValues, ObjectArrayTypes = iRestfulObjectArrayTypes>
|
|
25
24
|
(dataOrCallback: ((prev: Readonly<iCarbonORMState>) => ObjectType[]) | ObjectType[],
|
|
26
|
-
stateKey: keyof
|
|
25
|
+
stateKey: keyof ObjectArrayTypes,
|
|
27
26
|
uniqueObjectId: keyof ObjectType,
|
|
28
27
|
insertUpdateOrder: eUpdateInsertMethod = eUpdateInsertMethod.LAST,
|
|
29
28
|
callback?: () => void): void {
|
|
@@ -34,7 +33,8 @@ export default function updateRestfulObjectArray<ObjectType extends tRestfulObje
|
|
|
34
33
|
|
|
35
34
|
let newOrReplacementData: ObjectType[] = dataOrCallback instanceof Function ? dataOrCallback(previousBootstrapState) : dataOrCallback;
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
const previousStateProperty = previousBootstrapState[stateKey];
|
|
38
38
|
|
|
39
39
|
let updatedData = newOrReplacementData.map(value => {
|
|
40
40
|
return {
|
package/src/index.ts
CHANGED
|
@@ -12,8 +12,6 @@ export { default as BackendThrowable } from "./components/Errors/BackendThrowabl
|
|
|
12
12
|
export * from "./components/Errors/BackendThrowable";
|
|
13
13
|
export { default as ErrorHttpCode } from "./components/Errors/ErrorHttpCode";
|
|
14
14
|
export * from "./components/Errors/ErrorHttpCode";
|
|
15
|
-
export { default as Localhost } from "./components/Errors/Localhost";
|
|
16
|
-
export * from "./components/Errors/Localhost";
|
|
17
15
|
export { default as PageNotFound } from "./components/Errors/PageNotFound";
|
|
18
16
|
export * from "./components/Errors/PageNotFound";
|
|
19
17
|
export { default as Loading } from "./components/Loading/Loading";
|
package/src/variables/C6.tsx
CHANGED
|
@@ -1802,7 +1802,7 @@ export interface iRestfulObjectArrayTypes {
|
|
|
1802
1802
|
users: tStatefulApiData<iUsers>,
|
|
1803
1803
|
}
|
|
1804
1804
|
|
|
1805
|
-
export const
|
|
1805
|
+
export const initialRestfulObjectsState: iRestfulObjectArrayTypes = {
|
|
1806
1806
|
|
|
1807
1807
|
carbons: undefined,
|
|
1808
1808
|
comments: undefined,
|
|
@@ -1832,3 +1832,5 @@ export type tRestfulObjectArrayValues = iRestfulObjectArrayTypes[tRestfulObjectA
|
|
|
1832
1832
|
export type tRestfulObjectValues = tRestfulObjectArrayValues[number];
|
|
1833
1833
|
|
|
1834
1834
|
|
|
1835
|
+
|
|
1836
|
+
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function Localhost(): import("react/jsx-runtime").JSX.Element;
|