@open-xamu-co/ui-common-types 3.0.0-next.12 → 3.0.0-next.14
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/package.json +2 -2
- package/src/values.ts +10 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-xamu-co/ui-common-types",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.14",
|
|
4
4
|
"description": "Xamu shared types",
|
|
5
5
|
"author": "@xamu-co",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@fortawesome/fontawesome-common-types": "^6.4.0",
|
|
35
|
-
"@open-xamu-co/ui-common-enums": "^3.0.0-next.
|
|
35
|
+
"@open-xamu-co/ui-common-enums": "^3.0.0-next.5",
|
|
36
36
|
"sweetalert2": "^11.11.1"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
package/src/values.ts
CHANGED
|
@@ -9,19 +9,22 @@ export interface iSelectOption {
|
|
|
9
9
|
*
|
|
10
10
|
* Useful for table actions like creating, updating and deleting nodes
|
|
11
11
|
*/
|
|
12
|
-
export type iNodeFn<T extends Record<string, any>, Ta extends [T
|
|
12
|
+
export type iNodeFn<T extends Record<string, any>, Ta extends [T?, ...any[]] = [T]> = (
|
|
13
13
|
...args: Ta
|
|
14
14
|
) => boolean | undefined | Promise<boolean | undefined>;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* used on FactoryTable and related components
|
|
18
18
|
*/
|
|
19
|
-
export interface iProperty<
|
|
20
|
-
extends
|
|
19
|
+
export interface iProperty<
|
|
20
|
+
T extends Record<string, any> = Record<string, any>,
|
|
21
|
+
P extends Record<string, any> = Record<string, any>,
|
|
22
|
+
> extends iSelectOption {
|
|
21
23
|
/**
|
|
22
24
|
* Function to create a node within the relation
|
|
25
|
+
* The parent is given since the node doesn't exist yet
|
|
23
26
|
*/
|
|
24
|
-
createNode?: iNodeFn<
|
|
27
|
+
createNode?: iNodeFn<P, [P?]>;
|
|
25
28
|
/**
|
|
26
29
|
* Function to clone a node within the relation
|
|
27
30
|
*/
|
|
@@ -29,9 +32,11 @@ export interface iProperty<T extends Record<string, any> = Record<string, any>>
|
|
|
29
32
|
/**
|
|
30
33
|
* Function to update a node within the relation
|
|
31
34
|
*/
|
|
32
|
-
updateNode?: iNodeFn<T, [T?]>;
|
|
35
|
+
updateNode?: iNodeFn<T, [T?, P?]>;
|
|
33
36
|
/**
|
|
34
37
|
* Function to delete a node within the relation
|
|
35
38
|
*/
|
|
36
39
|
deleteNode?: iNodeFn<T, [T?]>;
|
|
37
40
|
}
|
|
41
|
+
|
|
42
|
+
export type tPropertyOrderFn = (a: [string, any], b: [string, any]) => -1 | 0 | 1;
|