@esportsplus/ui 0.35.0 → 0.35.2
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,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Response } from '@esportsplus/action';
|
|
2
2
|
import { Attributes } from '@esportsplus/template';
|
|
3
3
|
type A = Attributes & {
|
|
4
4
|
action: Action;
|
|
@@ -6,14 +6,10 @@ type A = Attributes & {
|
|
|
6
6
|
processing: boolean;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
type Action = <T extends Record<string, any>>(
|
|
9
|
+
type Action = <T extends Record<string, any>>(response: Response<T>) => Promise<Errors> | Errors;
|
|
10
10
|
type Errors = {
|
|
11
11
|
errors: Response<unknown>['errors'];
|
|
12
12
|
};
|
|
13
|
-
type Payload<T extends Record<string, any>> = {
|
|
14
|
-
input: T;
|
|
15
|
-
response: typeof response;
|
|
16
|
-
};
|
|
17
13
|
declare const _default: {
|
|
18
14
|
(): ReturnType<(this: {
|
|
19
15
|
attributes?: A | undefined;
|
|
@@ -45,10 +45,7 @@ export default template.factory((attributes, content) => {
|
|
|
45
45
|
if (state) {
|
|
46
46
|
state.processing = true;
|
|
47
47
|
}
|
|
48
|
-
let { errors } = await action(
|
|
49
|
-
input: parse(new FormData(this).entries()),
|
|
50
|
-
response
|
|
51
|
-
});
|
|
48
|
+
let { errors } = await action(response(parse(new FormData(this).entries())));
|
|
52
49
|
for (let i = 0, n = errors.length; i < n; i++) {
|
|
53
50
|
let { message, path } = errors[i], reactive = input.get(this[path]);
|
|
54
51
|
if (!reactive) {
|
|
@@ -115,10 +115,7 @@ declare const _default: {
|
|
|
115
115
|
onwebkittransitionend?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
116
116
|
onwheel?: ((this: import("@esportsplus/template").Element, event: WheelEvent) => void) | undefined;
|
|
117
117
|
} & Record<PropertyKey, unknown> & {
|
|
118
|
-
action: <T extends Record<string, any>>(
|
|
119
|
-
input: T;
|
|
120
|
-
response: typeof import("@esportsplus/action").default;
|
|
121
|
-
}) => Promise<{
|
|
118
|
+
action: <T extends Record<string, any>>(response: import("@esportsplus/action").Response<T>) => Promise<{
|
|
122
119
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
123
120
|
}> | {
|
|
124
121
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
@@ -242,10 +239,7 @@ declare const _default: {
|
|
|
242
239
|
onwebkittransitionend?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
243
240
|
onwheel?: ((this: import("@esportsplus/template").Element, event: WheelEvent) => void) | undefined;
|
|
244
241
|
} & Record<PropertyKey, unknown> & {
|
|
245
|
-
action: <T extends Record<string, any>>(
|
|
246
|
-
input: T;
|
|
247
|
-
response: typeof import("@esportsplus/action").default;
|
|
248
|
-
}) => Promise<{
|
|
242
|
+
action: <T extends Record<string, any>>(response: import("@esportsplus/action").Response<T>) => Promise<{
|
|
249
243
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
250
244
|
}> | {
|
|
251
245
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
@@ -368,10 +362,7 @@ declare const _default: {
|
|
|
368
362
|
onwebkittransitionend?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
369
363
|
onwheel?: ((this: import("@esportsplus/template").Element, event: WheelEvent) => void) | undefined;
|
|
370
364
|
} & Record<PropertyKey, unknown> & {
|
|
371
|
-
action: <T_1 extends Record<string, any>>(
|
|
372
|
-
input: T_1;
|
|
373
|
-
response: typeof import("@esportsplus/action").default;
|
|
374
|
-
}) => Promise<{
|
|
365
|
+
action: <T_1 extends Record<string, any>>(response: import("@esportsplus/action").Response<T_1>) => Promise<{
|
|
375
366
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
376
367
|
}> | {
|
|
377
368
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
@@ -494,10 +485,7 @@ declare const _default: {
|
|
|
494
485
|
onwebkittransitionend?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
495
486
|
onwheel?: ((this: import("@esportsplus/template").Element, event: WheelEvent) => void) | undefined;
|
|
496
487
|
} & Record<PropertyKey, unknown> & {
|
|
497
|
-
action: <T_1 extends Record<string, any>>(
|
|
498
|
-
input: T_1;
|
|
499
|
-
response: typeof import("@esportsplus/action").default;
|
|
500
|
-
}) => Promise<{
|
|
488
|
+
action: <T_1 extends Record<string, any>>(response: import("@esportsplus/action").Response<T_1>) => Promise<{
|
|
501
489
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
502
490
|
}> | {
|
|
503
491
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
@@ -621,10 +609,7 @@ declare const _default: {
|
|
|
621
609
|
onwebkittransitionend?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
622
610
|
onwheel?: ((this: import("@esportsplus/template").Element, event: WheelEvent) => void) | undefined;
|
|
623
611
|
} & Record<PropertyKey, unknown> & {
|
|
624
|
-
action: <T_1 extends Record<string, any>>(
|
|
625
|
-
input: T_1;
|
|
626
|
-
response: typeof import("@esportsplus/action").default;
|
|
627
|
-
}) => Promise<{
|
|
612
|
+
action: <T_1 extends Record<string, any>>(response: import("@esportsplus/action").Response<T_1>) => Promise<{
|
|
628
613
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
629
614
|
}> | {
|
|
630
615
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
@@ -748,10 +733,7 @@ declare const _default: {
|
|
|
748
733
|
onwebkittransitionend?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
749
734
|
onwheel?: ((this: import("@esportsplus/template").Element, event: WheelEvent) => void) | undefined;
|
|
750
735
|
} & Record<PropertyKey, unknown> & {
|
|
751
|
-
action: <T_1 extends Record<string, any>>(
|
|
752
|
-
input: T_1;
|
|
753
|
-
response: typeof import("@esportsplus/action").default;
|
|
754
|
-
}) => Promise<{
|
|
736
|
+
action: <T_1 extends Record<string, any>>(response: import("@esportsplus/action").Response<T_1>) => Promise<{
|
|
755
737
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
756
738
|
}> | {
|
|
757
739
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
@@ -875,10 +857,7 @@ declare const _default: {
|
|
|
875
857
|
onwebkittransitionend?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
876
858
|
onwheel?: ((this: import("@esportsplus/template").Element, event: WheelEvent) => void) | undefined;
|
|
877
859
|
} & Record<PropertyKey, unknown> & {
|
|
878
|
-
action: <T_1 extends Record<string, any>>(
|
|
879
|
-
input: T_1;
|
|
880
|
-
response: typeof import("@esportsplus/action").default;
|
|
881
|
-
}) => Promise<{
|
|
860
|
+
action: <T_1 extends Record<string, any>>(response: import("@esportsplus/action").Response<T_1>) => Promise<{
|
|
882
861
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
883
862
|
}> | {
|
|
884
863
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
@@ -1001,10 +980,7 @@ declare const _default: {
|
|
|
1001
980
|
onwebkittransitionend?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
1002
981
|
onwheel?: ((this: import("@esportsplus/template").Element, event: WheelEvent) => void) | undefined;
|
|
1003
982
|
} & Record<PropertyKey, unknown> & {
|
|
1004
|
-
action: <T extends Record<string, any>>(
|
|
1005
|
-
input: T;
|
|
1006
|
-
response: typeof import("@esportsplus/action").default;
|
|
1007
|
-
}) => Promise<{
|
|
983
|
+
action: <T extends Record<string, any>>(response: import("@esportsplus/action").Response<T>) => Promise<{
|
|
1008
984
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
1009
985
|
}> | {
|
|
1010
986
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
@@ -1127,10 +1103,7 @@ declare const _default: {
|
|
|
1127
1103
|
onwebkittransitionend?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
1128
1104
|
onwheel?: ((this: import("@esportsplus/template").Element, event: WheelEvent) => void) | undefined;
|
|
1129
1105
|
} & Record<PropertyKey, unknown> & {
|
|
1130
|
-
action: <T extends Record<string, any>>(
|
|
1131
|
-
input: T;
|
|
1132
|
-
response: typeof import("@esportsplus/action").default;
|
|
1133
|
-
}) => Promise<{
|
|
1106
|
+
action: <T extends Record<string, any>>(response: import("@esportsplus/action").Response<T>) => Promise<{
|
|
1134
1107
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
1135
1108
|
}> | {
|
|
1136
1109
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
@@ -1254,10 +1227,7 @@ declare const _default: {
|
|
|
1254
1227
|
onwebkittransitionend?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
1255
1228
|
onwheel?: ((this: import("@esportsplus/template").Element, event: WheelEvent) => void) | undefined;
|
|
1256
1229
|
} & Record<PropertyKey, unknown> & {
|
|
1257
|
-
action: <T extends Record<string, any>>(
|
|
1258
|
-
input: T;
|
|
1259
|
-
response: typeof import("@esportsplus/action").default;
|
|
1260
|
-
}) => Promise<{
|
|
1230
|
+
action: <T extends Record<string, any>>(response: import("@esportsplus/action").Response<T>) => Promise<{
|
|
1261
1231
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
|
1262
1232
|
}> | {
|
|
1263
1233
|
errors: import("@esportsplus/action").Response<unknown>["errors"];
|
package/package.json
CHANGED
|
@@ -7,15 +7,10 @@ import input from './input';
|
|
|
7
7
|
|
|
8
8
|
type A = Attributes & { action: Action, state?: { processing: boolean } };
|
|
9
9
|
|
|
10
|
-
type Action = <T extends Record<string, any>>(
|
|
10
|
+
type Action = <T extends Record<string, any>>(response: Response<T>) => Promise<Errors> | Errors;
|
|
11
11
|
|
|
12
12
|
type Errors = { errors: Response<unknown>['errors'] };
|
|
13
13
|
|
|
14
|
-
type Payload<T extends Record<string, any>> = {
|
|
15
|
-
input: T;
|
|
16
|
-
response: typeof response;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
14
|
|
|
20
15
|
const OMIT = ['action', 'state'];
|
|
21
16
|
|
|
@@ -79,10 +74,9 @@ export default template.factory<A>(
|
|
|
79
74
|
state.processing = true;
|
|
80
75
|
}
|
|
81
76
|
|
|
82
|
-
let { errors } = await action(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
});
|
|
77
|
+
let { errors } = await action(
|
|
78
|
+
response(parse( new FormData( this as any as HTMLFormElement ).entries() ))
|
|
79
|
+
);
|
|
86
80
|
|
|
87
81
|
for (let i = 0, n = errors.length; i < n; i++) {
|
|
88
82
|
let { message, path } = errors[i],
|