@esportsplus/ui 0.35.4 → 0.35.6
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.
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import response, { Response } from '@esportsplus/action';
|
|
2
2
|
import { Attributes } from '@esportsplus/template';
|
|
3
3
|
type A = {
|
|
4
|
-
action: (<T extends Record<string,
|
|
4
|
+
action: (<T extends Record<string, unknown>>(data: {
|
|
5
|
+
input: T;
|
|
6
|
+
response: typeof response;
|
|
7
|
+
}) => (Promise<Errors> | Errors));
|
|
5
8
|
state?: {
|
|
6
9
|
processing: boolean;
|
|
7
10
|
};
|
|
@@ -45,7 +45,10 @@ export default template.factory((attributes, content) => {
|
|
|
45
45
|
if (state) {
|
|
46
46
|
state.processing = true;
|
|
47
47
|
}
|
|
48
|
-
let { errors } = await action(
|
|
48
|
+
let { errors } = await action({
|
|
49
|
+
input: parse(new FormData(this).entries()),
|
|
50
|
+
response
|
|
51
|
+
});
|
|
49
52
|
for (let i = 0, n = errors.length; i < n; i++) {
|
|
50
53
|
let { message, path } = errors[i], reactive = input.get(this[path]);
|
|
51
54
|
if (!reactive) {
|
|
@@ -2,11 +2,14 @@ declare const _default: {
|
|
|
2
2
|
action: {
|
|
3
3
|
(): ReturnType<(this: {
|
|
4
4
|
attributes?: ({
|
|
5
|
-
action: (<T extends Record<string,
|
|
5
|
+
action: (<T extends Record<string, unknown>>(data: {
|
|
6
|
+
input: T;
|
|
7
|
+
response: typeof import("@esportsplus/action").default;
|
|
8
|
+
}) => (Promise<{
|
|
6
9
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
7
10
|
}> | {
|
|
8
11
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
9
|
-
});
|
|
12
|
+
}));
|
|
10
13
|
state?: {
|
|
11
14
|
processing: boolean;
|
|
12
15
|
};
|
|
@@ -126,11 +129,14 @@ declare const _default: {
|
|
|
126
129
|
} & Record<PropertyKey, unknown>) | undefined;
|
|
127
130
|
content?: import("@esportsplus/template").Renderable<any>;
|
|
128
131
|
}, attributes: Readonly<{
|
|
129
|
-
action: (<T extends Record<string,
|
|
132
|
+
action: (<T extends Record<string, unknown>>(data: {
|
|
133
|
+
input: T;
|
|
134
|
+
response: typeof import("@esportsplus/action").default;
|
|
135
|
+
}) => (Promise<{
|
|
130
136
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
131
137
|
}> | {
|
|
132
138
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
133
|
-
});
|
|
139
|
+
}));
|
|
134
140
|
state?: {
|
|
135
141
|
processing: boolean;
|
|
136
142
|
};
|
|
@@ -249,11 +255,14 @@ declare const _default: {
|
|
|
249
255
|
onwheel?: ((this: import("@esportsplus/template").Element, event: WheelEvent) => void) | undefined;
|
|
250
256
|
} & Record<PropertyKey, unknown>>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
|
|
251
257
|
<T extends {
|
|
252
|
-
action: (<T_1 extends Record<string,
|
|
258
|
+
action: (<T_1 extends Record<string, unknown>>(data: {
|
|
259
|
+
input: T_1;
|
|
260
|
+
response: typeof import("@esportsplus/action").default;
|
|
261
|
+
}) => (Promise<{
|
|
253
262
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
254
263
|
}> | {
|
|
255
264
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
256
|
-
});
|
|
265
|
+
}));
|
|
257
266
|
state?: {
|
|
258
267
|
processing: boolean;
|
|
259
268
|
};
|
|
@@ -372,11 +381,14 @@ declare const _default: {
|
|
|
372
381
|
onwheel?: ((this: import("@esportsplus/template").Element, event: WheelEvent) => void) | undefined;
|
|
373
382
|
} & Record<PropertyKey, unknown>>(attributes: T): ReturnType<(this: {
|
|
374
383
|
attributes?: ({
|
|
375
|
-
action: (<T_1 extends Record<string,
|
|
384
|
+
action: (<T_1 extends Record<string, unknown>>(data: {
|
|
385
|
+
input: T_1;
|
|
386
|
+
response: typeof import("@esportsplus/action").default;
|
|
387
|
+
}) => (Promise<{
|
|
376
388
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
377
389
|
}> | {
|
|
378
390
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
379
|
-
});
|
|
391
|
+
}));
|
|
380
392
|
state?: {
|
|
381
393
|
processing: boolean;
|
|
382
394
|
};
|
|
@@ -496,11 +508,14 @@ declare const _default: {
|
|
|
496
508
|
} & Record<PropertyKey, unknown>) | undefined;
|
|
497
509
|
content?: import("@esportsplus/template").Renderable<any>;
|
|
498
510
|
}, attributes: Readonly<{
|
|
499
|
-
action: (<T_1 extends Record<string,
|
|
511
|
+
action: (<T_1 extends Record<string, unknown>>(data: {
|
|
512
|
+
input: T_1;
|
|
513
|
+
response: typeof import("@esportsplus/action").default;
|
|
514
|
+
}) => (Promise<{
|
|
500
515
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
501
516
|
}> | {
|
|
502
517
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
503
|
-
});
|
|
518
|
+
}));
|
|
504
519
|
state?: {
|
|
505
520
|
processing: boolean;
|
|
506
521
|
};
|
|
@@ -620,11 +635,14 @@ declare const _default: {
|
|
|
620
635
|
} & Record<PropertyKey, unknown>>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
|
|
621
636
|
<T extends import("@esportsplus/template").Renderable<any>>(content: T): ReturnType<(this: {
|
|
622
637
|
attributes?: ({
|
|
623
|
-
action: (<T_1 extends Record<string,
|
|
638
|
+
action: (<T_1 extends Record<string, unknown>>(data: {
|
|
639
|
+
input: T_1;
|
|
640
|
+
response: typeof import("@esportsplus/action").default;
|
|
641
|
+
}) => (Promise<{
|
|
624
642
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
625
643
|
}> | {
|
|
626
644
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
627
|
-
});
|
|
645
|
+
}));
|
|
628
646
|
state?: {
|
|
629
647
|
processing: boolean;
|
|
630
648
|
};
|
|
@@ -744,11 +762,14 @@ declare const _default: {
|
|
|
744
762
|
} & Record<PropertyKey, unknown>) | undefined;
|
|
745
763
|
content?: import("@esportsplus/template").Renderable<any>;
|
|
746
764
|
}, attributes: Readonly<{
|
|
747
|
-
action: (<T_1 extends Record<string,
|
|
765
|
+
action: (<T_1 extends Record<string, unknown>>(data: {
|
|
766
|
+
input: T_1;
|
|
767
|
+
response: typeof import("@esportsplus/action").default;
|
|
768
|
+
}) => (Promise<{
|
|
748
769
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
749
770
|
}> | {
|
|
750
771
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
751
|
-
});
|
|
772
|
+
}));
|
|
752
773
|
state?: {
|
|
753
774
|
processing: boolean;
|
|
754
775
|
};
|
|
@@ -867,11 +888,14 @@ declare const _default: {
|
|
|
867
888
|
onwheel?: ((this: import("@esportsplus/template").Element, event: WheelEvent) => void) | undefined;
|
|
868
889
|
} & Record<PropertyKey, unknown>>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
|
|
869
890
|
(attributes: {
|
|
870
|
-
action: (<T extends Record<string,
|
|
891
|
+
action: (<T extends Record<string, unknown>>(data: {
|
|
892
|
+
input: T;
|
|
893
|
+
response: typeof import("@esportsplus/action").default;
|
|
894
|
+
}) => (Promise<{
|
|
871
895
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
872
896
|
}> | {
|
|
873
897
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
874
|
-
});
|
|
898
|
+
}));
|
|
875
899
|
state?: {
|
|
876
900
|
processing: boolean;
|
|
877
901
|
};
|
|
@@ -990,11 +1014,14 @@ declare const _default: {
|
|
|
990
1014
|
onwheel?: ((this: import("@esportsplus/template").Element, event: WheelEvent) => void) | undefined;
|
|
991
1015
|
} & Record<PropertyKey, unknown>, content: import("@esportsplus/template").Renderable<any>): ReturnType<(this: {
|
|
992
1016
|
attributes?: ({
|
|
993
|
-
action: (<T extends Record<string,
|
|
1017
|
+
action: (<T extends Record<string, unknown>>(data: {
|
|
1018
|
+
input: T;
|
|
1019
|
+
response: typeof import("@esportsplus/action").default;
|
|
1020
|
+
}) => (Promise<{
|
|
994
1021
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
995
1022
|
}> | {
|
|
996
1023
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
997
|
-
});
|
|
1024
|
+
}));
|
|
998
1025
|
state?: {
|
|
999
1026
|
processing: boolean;
|
|
1000
1027
|
};
|
|
@@ -1114,11 +1141,14 @@ declare const _default: {
|
|
|
1114
1141
|
} & Record<PropertyKey, unknown>) | undefined;
|
|
1115
1142
|
content?: import("@esportsplus/template").Renderable<any>;
|
|
1116
1143
|
}, attributes: Readonly<{
|
|
1117
|
-
action: (<T extends Record<string,
|
|
1144
|
+
action: (<T extends Record<string, unknown>>(data: {
|
|
1145
|
+
input: T;
|
|
1146
|
+
response: typeof import("@esportsplus/action").default;
|
|
1147
|
+
}) => (Promise<{
|
|
1118
1148
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
1119
1149
|
}> | {
|
|
1120
1150
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
1121
|
-
});
|
|
1151
|
+
}));
|
|
1122
1152
|
state?: {
|
|
1123
1153
|
processing: boolean;
|
|
1124
1154
|
};
|
package/package.json
CHANGED
|
@@ -6,7 +6,12 @@ import input from './input';
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
type A = {
|
|
9
|
-
action: (<
|
|
9
|
+
action: (<
|
|
10
|
+
T extends Record<string, unknown>>(data: {
|
|
11
|
+
input: T;
|
|
12
|
+
response: typeof response;
|
|
13
|
+
}) => (Promise<Errors> | Errors)
|
|
14
|
+
),
|
|
10
15
|
state?: { processing: boolean }
|
|
11
16
|
} & Attributes;
|
|
12
17
|
|
|
@@ -75,10 +80,10 @@ export default template.factory<A>(
|
|
|
75
80
|
state.processing = true;
|
|
76
81
|
}
|
|
77
82
|
|
|
78
|
-
let { errors } = await action(
|
|
79
|
-
parse( new FormData( this as any as HTMLFormElement ).entries() ),
|
|
83
|
+
let { errors } = await action({
|
|
84
|
+
input: parse( new FormData( this as any as HTMLFormElement ).entries() ),
|
|
80
85
|
response
|
|
81
|
-
);
|
|
86
|
+
});
|
|
82
87
|
|
|
83
88
|
for (let i = 0, n = errors.length; i < n; i++) {
|
|
84
89
|
let { message, path } = errors[i],
|