@open-xamu-co/ui-common-types 3.0.0 → 3.0.2-next.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 +1 -1
- package/src/form/class.ts +30 -17
- package/src/form/types.ts +11 -5
- package/src/plugin.ts +3 -1
package/package.json
CHANGED
package/src/form/class.ts
CHANGED
|
@@ -14,7 +14,7 @@ import type {
|
|
|
14
14
|
import type { iSelectOption } from "../values.js";
|
|
15
15
|
|
|
16
16
|
export declare abstract class tFormInputDefault<
|
|
17
|
-
T extends eFormTypeBase | eFormTypeSimple | eFormTypeComplex = eFormTypeSimple
|
|
17
|
+
T extends eFormTypeBase | eFormTypeSimple | eFormTypeComplex = eFormTypeSimple,
|
|
18
18
|
> implements iFormInputDefault<T>
|
|
19
19
|
{
|
|
20
20
|
// public
|
|
@@ -32,9 +32,15 @@ export declare abstract class tFormInputDefault<
|
|
|
32
32
|
public setRerender(rerender: (fi?: Partial<iFormInputDefault<T>>) => void): this;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export declare class tFormInput<
|
|
36
|
-
|
|
37
|
-
|
|
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>
|
|
38
44
|
{
|
|
39
45
|
// public readonly
|
|
40
46
|
public readonly name: string;
|
|
@@ -44,38 +50,45 @@ export declare class tFormInput<V extends iFormValue = iFormValue, Vk extends V
|
|
|
44
50
|
public readonly max: number;
|
|
45
51
|
// public
|
|
46
52
|
public options: iSelectOption[];
|
|
47
|
-
public values:
|
|
48
|
-
public defaults?: [
|
|
53
|
+
public values: V[];
|
|
54
|
+
public defaults?: [
|
|
55
|
+
iFormInputDefault<eFormTypeBase | eFormTypeSimple | eFormTypeComplex>,
|
|
56
|
+
iFormInputDefault<eFormTypeBase | eFormTypeSimple | eFormTypeComplex>,
|
|
57
|
+
...iFormInputDefault<eFormTypeBase | eFormTypeSimple | eFormTypeComplex>[],
|
|
58
|
+
];
|
|
49
59
|
/**
|
|
50
60
|
* set rerender function
|
|
51
61
|
*
|
|
52
62
|
* @override
|
|
53
63
|
*/
|
|
54
|
-
public setRerender(rerender: (fi?: Partial<iFormInput<V>>) => void): this;
|
|
64
|
+
public setRerender(rerender: (fi?: Partial<iFormInput<V, T>>) => void): this;
|
|
55
65
|
/**
|
|
56
66
|
* add new model to the models
|
|
57
67
|
*/
|
|
58
|
-
public addValue(newValue?:
|
|
68
|
+
public addValue(newValue?: V): this;
|
|
59
69
|
/**
|
|
60
70
|
* remove the given value from the values
|
|
61
71
|
*/
|
|
62
72
|
public removeValue(index: number): this;
|
|
63
|
-
|
|
64
73
|
/**
|
|
65
74
|
* Clone this object
|
|
66
75
|
*/
|
|
67
76
|
public clone(
|
|
68
|
-
overrides?: Omit<iFormInput<V,
|
|
69
|
-
onUpdatedValues?: (updatedValues:
|
|
70
|
-
): tFormInput<V,
|
|
77
|
+
overrides?: Omit<iFormInput<V, T>, "name"> & { name?: string },
|
|
78
|
+
onUpdatedValues?: (updatedValues: V[]) => V[] | undefined | void
|
|
79
|
+
): tFormInput<V, T>;
|
|
71
80
|
/**
|
|
72
|
-
*
|
|
81
|
+
* Check if this object is equal to another
|
|
73
82
|
*/
|
|
74
|
-
public getObject<Vi extends iFormValue = iFormValue, Vik extends Vi | Vi[] = Vi>(
|
|
75
|
-
input: iFormInput<Vi, Vik>
|
|
76
|
-
): iFormInput<Vi, Vik>;
|
|
77
|
-
|
|
78
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>;
|
|
79
92
|
}
|
|
80
93
|
|
|
81
94
|
export interface iForm {
|
package/src/form/types.ts
CHANGED
|
@@ -101,7 +101,7 @@ export type iFormValue = string | number | boolean | File | Date;
|
|
|
101
101
|
* Simple input
|
|
102
102
|
*/
|
|
103
103
|
export interface iFormInputDefault<
|
|
104
|
-
T extends eFormTypeBase | eFormTypeSimple | eFormTypeComplex = eFormTypeSimple
|
|
104
|
+
T extends eFormTypeBase | eFormTypeSimple | eFormTypeComplex = eFormTypeSimple,
|
|
105
105
|
> {
|
|
106
106
|
type?: T;
|
|
107
107
|
required?: boolean;
|
|
@@ -116,8 +116,10 @@ export interface iFormInputDefault<
|
|
|
116
116
|
/**
|
|
117
117
|
* Complex input, sub input support
|
|
118
118
|
*/
|
|
119
|
-
export interface iFormInput<
|
|
120
|
-
extends
|
|
119
|
+
export interface iFormInput<
|
|
120
|
+
V extends iFormValue | iFormValue[],
|
|
121
|
+
T extends eFormTypeBase | eFormTypeSimple | eFormTypeComplex,
|
|
122
|
+
> extends iFormInputDefault<T> {
|
|
121
123
|
name: string;
|
|
122
124
|
options?: (string | number | iFormOption)[];
|
|
123
125
|
/**
|
|
@@ -125,8 +127,12 @@ export interface iFormInput<V extends iFormValue = iFormValue, Vk extends V | V[
|
|
|
125
127
|
*
|
|
126
128
|
* @old value
|
|
127
129
|
*/
|
|
128
|
-
values?:
|
|
129
|
-
defaults?: [
|
|
130
|
+
values?: V[];
|
|
131
|
+
defaults?: [
|
|
132
|
+
iFormInputDefault<eFormTypeBase | eFormTypeSimple | eFormTypeComplex>,
|
|
133
|
+
iFormInputDefault<eFormTypeBase | eFormTypeSimple | eFormTypeComplex>,
|
|
134
|
+
...iFormInputDefault<eFormTypeBase | eFormTypeSimple | eFormTypeComplex>[],
|
|
135
|
+
];
|
|
130
136
|
/**
|
|
131
137
|
* Visible over the field, should describe it
|
|
132
138
|
*/
|
package/src/plugin.ts
CHANGED
|
@@ -108,7 +108,9 @@ export interface iPluginOptions<ComponentType = unknown> {
|
|
|
108
108
|
*/
|
|
109
109
|
country?: string;
|
|
110
110
|
/**
|
|
111
|
-
* Countries API base endpoint
|
|
111
|
+
* Countries API base endpoint
|
|
112
|
+
*
|
|
113
|
+
* Pathname or full URL (With pathname)
|
|
112
114
|
*
|
|
113
115
|
* If using nuxt, get better performance with the module
|
|
114
116
|
* @see https://www.npmjs.com/package/nuxt-countries-api
|