@open-xamu-co/ui-common-types 3.0.0-next.14 → 3.0.0-next.16
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/form.ts +8 -6
- package/src/values.ts +5 -0
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.16",
|
|
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.6",
|
|
36
36
|
"sweetalert2": "^11.11.1"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
package/src/form.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
5
|
import type { iSelectOption } from "./values.js";
|
|
6
6
|
|
|
@@ -95,12 +95,14 @@ 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<
|
|
103
|
+
export interface iFormInputDefault<
|
|
104
|
+
T extends eFormTypeBase | eFormTypeSimple | eFormTypeComplex = eFormTypeSimple,
|
|
105
|
+
> {
|
|
104
106
|
required?: boolean;
|
|
105
107
|
type?: T;
|
|
106
108
|
/**
|
|
@@ -114,8 +116,8 @@ export interface iFormInputDefault<T extends eFormTypeSimple | eFormTypeComplex
|
|
|
114
116
|
/**
|
|
115
117
|
* Complex input, sub input support
|
|
116
118
|
*/
|
|
117
|
-
export interface iFormInput<V extends iFormValue = iFormValue>
|
|
118
|
-
extends iFormInputDefault<eFormTypeSimple | eFormTypeComplex> {
|
|
119
|
+
export interface iFormInput<V extends iFormValue = iFormValue, Vk extends V | V[] = V | V[]>
|
|
120
|
+
extends iFormInputDefault<eFormTypeBase | eFormTypeSimple | eFormTypeComplex> {
|
|
119
121
|
name: string;
|
|
120
122
|
options?: (string | number | iFormOption)[];
|
|
121
123
|
/**
|
|
@@ -123,7 +125,7 @@ export interface iFormInput<V extends iFormValue = iFormValue>
|
|
|
123
125
|
*
|
|
124
126
|
* @old value
|
|
125
127
|
*/
|
|
126
|
-
values?:
|
|
128
|
+
values?: Vk[];
|
|
127
129
|
defaults?: [iFormInputDefault, iFormInputDefault, ...iFormInputDefault[]];
|
|
128
130
|
/**
|
|
129
131
|
* Visible over the field, should describe it
|
package/src/values.ts
CHANGED
|
@@ -2,6 +2,7 @@ export interface iSelectOption {
|
|
|
2
2
|
value: string | number;
|
|
3
3
|
alias?: string;
|
|
4
4
|
selected?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -25,6 +26,10 @@ export interface iProperty<
|
|
|
25
26
|
* The parent is given since the node doesn't exist yet
|
|
26
27
|
*/
|
|
27
28
|
createNode?: iNodeFn<P, [P?]>;
|
|
29
|
+
/**
|
|
30
|
+
* Conditionally disable creating children for this particular property
|
|
31
|
+
*/
|
|
32
|
+
disableCreateNode?: (p: P) => boolean;
|
|
28
33
|
/**
|
|
29
34
|
* Function to clone a node within the relation
|
|
30
35
|
*/
|