@open-xamu-co/ui-common-types 3.0.0-next.9 → 3.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/package.json +26 -26
- package/src/fetch.ts +11 -13
- package/src/form/class.ts +106 -0
- package/src/form/index.ts +2 -0
- package/src/{form.ts → form/types.ts} +18 -16
- package/src/index.ts +1 -1
- package/src/locale.ts +8 -16
- package/src/plugin.ts +9 -3
- package/src/swal.ts +12 -5
- package/src/values.ts +36 -6
package/package.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@open-xamu-co/ui-common-types",
|
|
3
|
-
"version": "3.0.0-next.9",
|
|
4
|
-
"description": "Xamu shared types",
|
|
5
2
|
"author": "@xamu-co",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
"browserslist": [
|
|
4
|
+
"defaults"
|
|
5
|
+
],
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/xamu-co/ui/issues"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@fortawesome/fontawesome-common-types": "^6.4.0",
|
|
11
|
+
"@open-xamu-co/ui-common-enums": "^3.0.0",
|
|
12
|
+
"sweetalert2": "^11.11.1"
|
|
13
|
+
},
|
|
14
|
+
"description": "Xamu shared types",
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=18",
|
|
17
|
+
"yarn": ">=1.22.4"
|
|
18
|
+
},
|
|
9
19
|
"files": [
|
|
10
20
|
"src/*"
|
|
11
21
|
],
|
|
12
|
-
"
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/xamu-co/ui.git"
|
|
15
|
-
},
|
|
22
|
+
"homepage": "https://github.com/xamu-co/ui#readme",
|
|
16
23
|
"keywords": [
|
|
17
24
|
"ts",
|
|
18
25
|
"js",
|
|
19
26
|
"types"
|
|
20
27
|
],
|
|
21
28
|
"license": "MIT",
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
"homepage": "https://github.com/xamu-co/ui#readme",
|
|
29
|
+
"main": "src/index.ts",
|
|
30
|
+
"name": "@open-xamu-co/ui-common-types",
|
|
26
31
|
"publishConfig": {
|
|
27
32
|
"access": "public"
|
|
28
33
|
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/xamu-co/ui.git"
|
|
37
|
+
},
|
|
29
38
|
"scripts": {
|
|
30
39
|
"build": "node -e \"console.log('Build step not required')\"",
|
|
31
40
|
"build:legacy": "rimraf dist && tsc --outDir dist --declaration --emitDeclarationOnly"
|
|
32
41
|
},
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"sweetalert2": "^11.7.5"
|
|
37
|
-
},
|
|
38
|
-
"engines": {
|
|
39
|
-
"node": ">=18",
|
|
40
|
-
"yarn": ">=1.22.4"
|
|
41
|
-
},
|
|
42
|
-
"browserslist": [
|
|
43
|
-
"defaults"
|
|
44
|
-
]
|
|
42
|
+
"type": "module",
|
|
43
|
+
"types": "src/index.ts",
|
|
44
|
+
"version": "3.0.1"
|
|
45
45
|
}
|
package/src/fetch.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type tOrder = "desc" | "asc";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Order using column or property
|
|
5
|
+
*
|
|
6
|
+
* @example [["id", "asc" ]], order ascendente de id
|
|
7
|
+
* @example [["id", "desc" ]] or [["id"]], order descendente de id
|
|
8
|
+
*/
|
|
9
|
+
export type tOrderBy = [string, tOrder?];
|
|
2
10
|
|
|
3
11
|
export interface iPageEdge<T, C extends string | number = string> {
|
|
4
12
|
cursor: C;
|
|
@@ -19,7 +27,7 @@ export interface iPage<T, C extends string | number = string> {
|
|
|
19
27
|
totalCount: number;
|
|
20
28
|
}
|
|
21
29
|
|
|
22
|
-
export interface iPagination
|
|
30
|
+
export interface iPagination {
|
|
23
31
|
/**
|
|
24
32
|
* Identificador del elemento donde empieza la paginacion
|
|
25
33
|
*
|
|
@@ -30,19 +38,9 @@ export interface iPagination<O = tOrderBy> {
|
|
|
30
38
|
* Cantidad de elementos (limite)
|
|
31
39
|
*/
|
|
32
40
|
first?: number;
|
|
33
|
-
|
|
34
|
-
* Ordenar segun columna o propiedad
|
|
35
|
-
* ej: ["id", "asc" ], order ascendente de id
|
|
36
|
-
* ej: ["id", "desc" ], order descendente de id
|
|
37
|
-
*/
|
|
38
|
-
orderBy?: O;
|
|
41
|
+
orderBy?: tOrderBy[];
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
/**
|
|
42
|
-
* Hydrate fetch ref (no refresh)
|
|
43
|
-
*/
|
|
44
|
-
export type tHydrate<T> = (c: T, e?: unknown) => void;
|
|
45
|
-
|
|
46
44
|
export type iGetPage<T, C extends string | number = string> = (
|
|
47
45
|
params?: iPagination
|
|
48
46
|
) => Promise<iPage<T, C> | undefined>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
eFormTypeBase,
|
|
3
|
+
eFormTypeSimple,
|
|
4
|
+
eFormTypeComplex,
|
|
5
|
+
} from "@open-xamu-co/ui-common-enums";
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
iFormInput,
|
|
9
|
+
iFormInputDefault,
|
|
10
|
+
iFormValue,
|
|
11
|
+
tFormAutocomplete,
|
|
12
|
+
tFormIcon,
|
|
13
|
+
} from "./types";
|
|
14
|
+
import type { iSelectOption } from "../values.js";
|
|
15
|
+
|
|
16
|
+
export declare abstract class tFormInputDefault<
|
|
17
|
+
T extends eFormTypeBase | eFormTypeSimple | eFormTypeComplex = eFormTypeSimple,
|
|
18
|
+
> implements iFormInputDefault<T>
|
|
19
|
+
{
|
|
20
|
+
// public
|
|
21
|
+
public type: T;
|
|
22
|
+
// public readonly
|
|
23
|
+
public readonly required: boolean;
|
|
24
|
+
public readonly placeholder: string;
|
|
25
|
+
public readonly icon?: tFormIcon;
|
|
26
|
+
public readonly autocomplete?: tFormAutocomplete;
|
|
27
|
+
|
|
28
|
+
/** Rerender component */
|
|
29
|
+
public rerender(): void;
|
|
30
|
+
|
|
31
|
+
/** Set rerender function */
|
|
32
|
+
public setRerender(rerender: (fi?: Partial<iFormInputDefault<T>>) => void): this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export declare class tFormInput<
|
|
36
|
+
V extends iFormValue | iFormValue[] = iFormValue | iFormValue[],
|
|
37
|
+
T extends eFormTypeBase | eFormTypeSimple | eFormTypeComplex =
|
|
38
|
+
| eFormTypeBase
|
|
39
|
+
| eFormTypeSimple
|
|
40
|
+
| eFormTypeComplex,
|
|
41
|
+
>
|
|
42
|
+
extends tFormInputDefault<T>
|
|
43
|
+
implements iFormInput<V, T>
|
|
44
|
+
{
|
|
45
|
+
// public readonly
|
|
46
|
+
public readonly name: string;
|
|
47
|
+
public readonly title?: string;
|
|
48
|
+
public readonly multiple: boolean;
|
|
49
|
+
public readonly min: number;
|
|
50
|
+
public readonly max: number;
|
|
51
|
+
// public
|
|
52
|
+
public options: iSelectOption[];
|
|
53
|
+
public values: V[];
|
|
54
|
+
public defaults?: [
|
|
55
|
+
iFormInputDefault<eFormTypeBase | eFormTypeSimple | eFormTypeComplex>,
|
|
56
|
+
iFormInputDefault<eFormTypeBase | eFormTypeSimple | eFormTypeComplex>,
|
|
57
|
+
...iFormInputDefault<eFormTypeBase | eFormTypeSimple | eFormTypeComplex>[],
|
|
58
|
+
];
|
|
59
|
+
/**
|
|
60
|
+
* set rerender function
|
|
61
|
+
*
|
|
62
|
+
* @override
|
|
63
|
+
*/
|
|
64
|
+
public setRerender(rerender: (fi?: Partial<iFormInput<V, T>>) => void): this;
|
|
65
|
+
/**
|
|
66
|
+
* add new model to the models
|
|
67
|
+
*/
|
|
68
|
+
public addValue(newValue?: V): this;
|
|
69
|
+
/**
|
|
70
|
+
* remove the given value from the values
|
|
71
|
+
*/
|
|
72
|
+
public removeValue(index: number): this;
|
|
73
|
+
/**
|
|
74
|
+
* Clone this object
|
|
75
|
+
*/
|
|
76
|
+
public clone(
|
|
77
|
+
overrides?: Omit<iFormInput<V, T>, "name"> & { name?: string },
|
|
78
|
+
onUpdatedValues?: (updatedValues: V[]) => V[] | undefined | void
|
|
79
|
+
): tFormInput<V, T>;
|
|
80
|
+
/**
|
|
81
|
+
* Check if this object is equal to another
|
|
82
|
+
*/
|
|
83
|
+
public isEqual(other: tFormInput): boolean;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Get simple object
|
|
87
|
+
*/
|
|
88
|
+
static getObject<
|
|
89
|
+
Vi extends iFormValue | iFormValue[],
|
|
90
|
+
Ti extends eFormTypeBase | eFormTypeSimple | eFormTypeComplex = eFormTypeSimple,
|
|
91
|
+
>(input: iFormInput<Vi, Ti>): iFormInput<Vi, Ti>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface iForm {
|
|
95
|
+
/**
|
|
96
|
+
* Optional form key
|
|
97
|
+
*/
|
|
98
|
+
key?: string;
|
|
99
|
+
title?: string;
|
|
100
|
+
inputs: tFormInput[];
|
|
101
|
+
listen?: boolean;
|
|
102
|
+
/** Make all inputs read only by disabling them */
|
|
103
|
+
readonly?: boolean;
|
|
104
|
+
/** Message when no valid inputs are rendered */
|
|
105
|
+
emptyMessage?: string;
|
|
106
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { IconName } from "@fortawesome/fontawesome-common-types";
|
|
2
2
|
|
|
3
|
-
import { eFormTypeComplex, eFormTypeSimple } from "@open-xamu-co/ui-common-enums";
|
|
3
|
+
import { eFormTypeBase, eFormTypeComplex, eFormTypeSimple } from "@open-xamu-co/ui-common-enums";
|
|
4
4
|
|
|
5
|
-
import type { iSelectOption } from "
|
|
5
|
+
import type { iSelectOption } from "../values.js";
|
|
6
6
|
|
|
7
7
|
export interface iFormOption extends iSelectOption {
|
|
8
8
|
/**
|
|
@@ -95,14 +95,16 @@ export type iFormIconProps = { brand?: boolean; regular?: boolean };
|
|
|
95
95
|
|
|
96
96
|
export type tFormIcon = [IconName | undefined, iFormIconProps];
|
|
97
97
|
|
|
98
|
-
export type iFormValue = string | number | boolean | File;
|
|
98
|
+
export type iFormValue = string | number | boolean | File | Date;
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
101
|
* Simple input
|
|
102
102
|
*/
|
|
103
|
-
export interface iFormInputDefault<
|
|
104
|
-
|
|
103
|
+
export interface iFormInputDefault<
|
|
104
|
+
T extends eFormTypeBase | eFormTypeSimple | eFormTypeComplex = eFormTypeSimple,
|
|
105
|
+
> {
|
|
105
106
|
type?: T;
|
|
107
|
+
required?: boolean;
|
|
106
108
|
/**
|
|
107
109
|
* String without the dots
|
|
108
110
|
*/
|
|
@@ -114,8 +116,10 @@ export interface iFormInputDefault<T extends eFormTypeSimple | eFormTypeComplex
|
|
|
114
116
|
/**
|
|
115
117
|
* Complex input, sub input support
|
|
116
118
|
*/
|
|
117
|
-
export interface iFormInput<
|
|
118
|
-
extends
|
|
119
|
+
export interface iFormInput<
|
|
120
|
+
V extends iFormValue | iFormValue[],
|
|
121
|
+
T extends eFormTypeBase | eFormTypeSimple | eFormTypeComplex,
|
|
122
|
+
> extends iFormInputDefault<T> {
|
|
119
123
|
name: string;
|
|
120
124
|
options?: (string | number | iFormOption)[];
|
|
121
125
|
/**
|
|
@@ -123,8 +127,12 @@ export interface iFormInput<V extends iFormValue = iFormValue>
|
|
|
123
127
|
*
|
|
124
128
|
* @old value
|
|
125
129
|
*/
|
|
126
|
-
values?:
|
|
127
|
-
defaults?: [
|
|
130
|
+
values?: V[];
|
|
131
|
+
defaults?: [
|
|
132
|
+
iFormInputDefault<eFormTypeBase | eFormTypeSimple | eFormTypeComplex>,
|
|
133
|
+
iFormInputDefault<eFormTypeBase | eFormTypeSimple | eFormTypeComplex>,
|
|
134
|
+
...iFormInputDefault<eFormTypeBase | eFormTypeSimple | eFormTypeComplex>[],
|
|
135
|
+
];
|
|
128
136
|
/**
|
|
129
137
|
* Visible over the field, should describe it
|
|
130
138
|
*/
|
|
@@ -149,7 +157,7 @@ export interface iFormInput<V extends iFormValue = iFormValue>
|
|
|
149
157
|
/**
|
|
150
158
|
* Sended form values
|
|
151
159
|
*/
|
|
152
|
-
export interface iFormResponse<R = any
|
|
160
|
+
export interface iFormResponse<R = any> {
|
|
153
161
|
response?: R;
|
|
154
162
|
invalidInputs: iInvalidInput[];
|
|
155
163
|
/**
|
|
@@ -169,12 +177,6 @@ export interface iFormResponse<R = any, T = any> {
|
|
|
169
177
|
* 401 will be reported but not failed
|
|
170
178
|
*/
|
|
171
179
|
errors?: any;
|
|
172
|
-
/**
|
|
173
|
-
* Swal target
|
|
174
|
-
*
|
|
175
|
-
* If the swal was triggered from a modal, then use it as render target
|
|
176
|
-
*/
|
|
177
|
-
modalTarget?: T;
|
|
178
180
|
}
|
|
179
181
|
|
|
180
182
|
export interface iFetchResponse<R = any> {
|
package/src/index.ts
CHANGED
package/src/locale.ts
CHANGED
|
@@ -192,6 +192,10 @@ export type tLocaleForm = {
|
|
|
192
192
|
form_unmatching_passwords: string;
|
|
193
193
|
/** @example "Invalid data" */
|
|
194
194
|
form_invalid_data: string;
|
|
195
|
+
/** @example "No values" */
|
|
196
|
+
form_no_values: string;
|
|
197
|
+
/** @example "New value" */
|
|
198
|
+
form_new_value: string;
|
|
195
199
|
// swal: {};
|
|
196
200
|
};
|
|
197
201
|
|
|
@@ -205,8 +209,12 @@ export type tLocaleTable = {
|
|
|
205
209
|
table_see_values: string;
|
|
206
210
|
/** @example "See: \"{name}\"" */
|
|
207
211
|
table_see_name: string;
|
|
212
|
+
/** @example "Hide: \"{name}\"" */
|
|
213
|
+
table_hide_name: string;
|
|
208
214
|
/** @example "Create new" */
|
|
209
215
|
table_create_new: string;
|
|
216
|
+
/** @example "Crear nuevo" */
|
|
217
|
+
table_create_new_name: string;
|
|
210
218
|
/** @example "Quantity: {count} */
|
|
211
219
|
table_quantity: string;
|
|
212
220
|
/** @example "Modify" */
|
|
@@ -275,22 +283,6 @@ export type tLocalePagination = {
|
|
|
275
283
|
pagination_items: string;
|
|
276
284
|
/** @example "No pages | Single page | {count} pages" */
|
|
277
285
|
pagination_pages: string;
|
|
278
|
-
/** @example "Order: relevance" */
|
|
279
|
-
pagination_order_relevance: string;
|
|
280
|
-
/** @example "Order: more recent" */
|
|
281
|
-
pagination_order_recent: string;
|
|
282
|
-
/** @example "Order: more older" */
|
|
283
|
-
pagination_order_older: string;
|
|
284
|
-
/** @example "Order: lower price" */
|
|
285
|
-
pagination_order_expensive: string;
|
|
286
|
-
/** @example "Order: high price" */
|
|
287
|
-
pagination_order_cheaper: string;
|
|
288
|
-
/** @example "Order: alphabetically (Asc.)" */
|
|
289
|
-
pagination_order_az: string;
|
|
290
|
-
/** @example "Order: alphabetically (Desc.)" */
|
|
291
|
-
pagination_order_za: string;
|
|
292
|
-
/** @example "Filter by:" */
|
|
293
|
-
pagination_filter_by: string;
|
|
294
286
|
// swal: {};
|
|
295
287
|
};
|
|
296
288
|
|
package/src/plugin.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { tPluginLocale } from "./locale.js";
|
|
|
4
4
|
import type { SweetAlertOptions } from "sweetalert2";
|
|
5
5
|
|
|
6
6
|
export type tComponent = (typeof componentNames)[number];
|
|
7
|
+
export type tLogger = (at: string, ...logs: unknown[]) => any;
|
|
7
8
|
|
|
8
9
|
export type tSupportedLangs =
|
|
9
10
|
| "kr"
|
|
@@ -98,6 +99,7 @@ export interface iPluginOptions<ComponentType = unknown> {
|
|
|
98
99
|
overrides?: SweetAlertOptions;
|
|
99
100
|
preventOverrides?: SweetAlertOptions;
|
|
100
101
|
loaderOverrides?: SweetAlertOptions;
|
|
102
|
+
toastOverrides?: SweetAlertOptions;
|
|
101
103
|
};
|
|
102
104
|
/**
|
|
103
105
|
* Iso2 code for the default country
|
|
@@ -106,13 +108,11 @@ export interface iPluginOptions<ComponentType = unknown> {
|
|
|
106
108
|
*/
|
|
107
109
|
country?: string;
|
|
108
110
|
/**
|
|
109
|
-
* Countries API base endpoint
|
|
111
|
+
* Countries API base endpoint (full URL)
|
|
110
112
|
*
|
|
111
113
|
* If using nuxt, get better performance with the module
|
|
112
114
|
* @see https://www.npmjs.com/package/nuxt-countries-api
|
|
113
115
|
*
|
|
114
|
-
* Using an absolute path will enable the module
|
|
115
|
-
*
|
|
116
116
|
* @default "https://countries.xamu.com.co/api/v1"
|
|
117
117
|
*/
|
|
118
118
|
countriesUrl?: string;
|
|
@@ -134,4 +134,10 @@ export interface iPluginOptions<ComponentType = unknown> {
|
|
|
134
134
|
* @default 10
|
|
135
135
|
*/
|
|
136
136
|
first?: number;
|
|
137
|
+
/**
|
|
138
|
+
* Logger function for debugging purposes
|
|
139
|
+
*
|
|
140
|
+
* @default console.log
|
|
141
|
+
*/
|
|
142
|
+
logger?: tLogger;
|
|
137
143
|
}
|
package/src/swal.ts
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import DefaultSwal, { type SweetAlertOptions, type SweetAlertResult } from "sweetalert2";
|
|
2
2
|
|
|
3
|
+
export type tSwalOptions = Omit<SweetAlertOptions, "target"> & {
|
|
4
|
+
target?: SweetAlertOptions["target"] | Event;
|
|
5
|
+
};
|
|
6
|
+
|
|
3
7
|
/**
|
|
4
8
|
* Extended SweetAlert2 class
|
|
5
9
|
*
|
|
10
|
+
* Defaults should use Event as target
|
|
11
|
+
*
|
|
6
12
|
* Do not deestructure this
|
|
7
13
|
*/
|
|
8
|
-
export type tSwal = typeof DefaultSwal & {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
) => Promise<SweetAlertResult<Awaited<T>>>;
|
|
14
|
+
export type tSwal = Omit<typeof DefaultSwal, "fire"> & {
|
|
15
|
+
fire: <T = any>(options?: tSwalOptions) => Promise<SweetAlertResult<Awaited<T>>>;
|
|
16
|
+
firePrevent: <T = any>(options?: tSwalOptions) => Promise<SweetAlertResult<Awaited<T>>>;
|
|
17
|
+
fireLoader: <T = any>(options?: tSwalOptions) => Promise<SweetAlertResult<Awaited<T>>>;
|
|
18
|
+
fireToast: <T = any>(options?: tSwalOptions) => Promise<SweetAlertResult<Awaited<T>>>;
|
|
12
19
|
firePreventDefaults: SweetAlertOptions;
|
|
13
|
-
fireLoader: <T = unknown>(options?: SweetAlertOptions) => Promise<SweetAlertResult<Awaited<T>>>;
|
|
14
20
|
fireLoaderDefaults: SweetAlertOptions;
|
|
21
|
+
fireToastDefaults: SweetAlertOptions;
|
|
15
22
|
};
|
package/src/values.ts
CHANGED
|
@@ -2,24 +2,54 @@ export interface iSelectOption {
|
|
|
2
2
|
value: string | number;
|
|
3
3
|
alias?: string;
|
|
4
4
|
selected?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
hidden?: boolean;
|
|
5
7
|
}
|
|
6
8
|
|
|
9
|
+
export type iNodeFnResponse = [boolean?, Event?, (() => void)?];
|
|
10
|
+
|
|
7
11
|
/**
|
|
8
12
|
* Funtions that uses a node and perform some action
|
|
9
13
|
*
|
|
10
14
|
* Useful for table actions like creating, updating and deleting nodes
|
|
11
15
|
*/
|
|
12
|
-
export type iNodeFn<T extends Record<string, any
|
|
13
|
-
|
|
14
|
-
) => boolean | undefined | Promise<boolean | undefined>;
|
|
16
|
+
export type iNodeFn<T extends Record<string, any>, Ta extends [T?, ...any[]] = [T]> = (
|
|
17
|
+
...args: Ta
|
|
18
|
+
) => boolean | undefined | iNodeFnResponse | Promise<boolean | undefined | iNodeFnResponse>;
|
|
15
19
|
|
|
16
20
|
/**
|
|
17
21
|
* used on FactoryTable and related components
|
|
18
22
|
*/
|
|
19
|
-
export interface iProperty<
|
|
20
|
-
extends
|
|
23
|
+
export interface iProperty<
|
|
24
|
+
T extends Record<string, any> = Record<string, any>,
|
|
25
|
+
P extends Record<string, any> = Record<string, any>,
|
|
26
|
+
ComponentType = unknown,
|
|
27
|
+
> extends iSelectOption {
|
|
21
28
|
/**
|
|
22
29
|
* Function to create a node within the relation
|
|
30
|
+
* The parent is given since the node doesn't exist yet
|
|
31
|
+
*/
|
|
32
|
+
createNode?: iNodeFn<P, [P?]>;
|
|
33
|
+
/**
|
|
34
|
+
* Conditionally disable creating children for this particular property
|
|
35
|
+
*/
|
|
36
|
+
disableCreateNode?: (p: P) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Function to clone a node within the relation
|
|
39
|
+
*/
|
|
40
|
+
cloneNode?: iNodeFn<T, [T?]>;
|
|
41
|
+
/**
|
|
42
|
+
* Function to update a node within the relation
|
|
43
|
+
*/
|
|
44
|
+
updateNode?: iNodeFn<T, [T?, P?]>;
|
|
45
|
+
/**
|
|
46
|
+
* Function to delete a node within the relation
|
|
23
47
|
*/
|
|
24
|
-
|
|
48
|
+
deleteNode?: iNodeFn<T, [T?]>;
|
|
49
|
+
/**
|
|
50
|
+
* Render using this component instead
|
|
51
|
+
*/
|
|
52
|
+
component?: ComponentType;
|
|
25
53
|
}
|
|
54
|
+
|
|
55
|
+
export type tPropertyOrderFn = (a: [string, any], b: [string, any]) => -1 | 0 | 1;
|