@esportsplus/ui 0.35.7 → 0.35.8
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: (
|
|
4
|
+
action: (data: {
|
|
5
|
+
input: Record<string, any>;
|
|
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,7 +2,10 @@ declare const _default: {
|
|
|
2
2
|
action: {
|
|
3
3
|
(): ReturnType<(this: {
|
|
4
4
|
attributes?: ({
|
|
5
|
-
action: (
|
|
5
|
+
action: (data: {
|
|
6
|
+
input: Record<string, any>;
|
|
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"];
|
|
@@ -126,7 +129,10 @@ declare const _default: {
|
|
|
126
129
|
} & Record<PropertyKey, unknown>) | undefined;
|
|
127
130
|
content?: import("@esportsplus/template").Renderable<any>;
|
|
128
131
|
}, attributes: Readonly<{
|
|
129
|
-
action: (
|
|
132
|
+
action: (data: {
|
|
133
|
+
input: Record<string, any>;
|
|
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"];
|
|
@@ -249,7 +255,10 @@ 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: (
|
|
258
|
+
action: (data: {
|
|
259
|
+
input: Record<string, any>;
|
|
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"];
|
|
@@ -372,7 +381,10 @@ 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: (
|
|
384
|
+
action: (data: {
|
|
385
|
+
input: Record<string, any>;
|
|
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"];
|
|
@@ -496,7 +508,10 @@ declare const _default: {
|
|
|
496
508
|
} & Record<PropertyKey, unknown>) | undefined;
|
|
497
509
|
content?: import("@esportsplus/template").Renderable<any>;
|
|
498
510
|
}, attributes: Readonly<{
|
|
499
|
-
action: (
|
|
511
|
+
action: (data: {
|
|
512
|
+
input: Record<string, any>;
|
|
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"];
|
|
@@ -620,7 +635,10 @@ 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: (
|
|
638
|
+
action: (data: {
|
|
639
|
+
input: Record<string, any>;
|
|
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"];
|
|
@@ -744,7 +762,10 @@ declare const _default: {
|
|
|
744
762
|
} & Record<PropertyKey, unknown>) | undefined;
|
|
745
763
|
content?: import("@esportsplus/template").Renderable<any>;
|
|
746
764
|
}, attributes: Readonly<{
|
|
747
|
-
action: (
|
|
765
|
+
action: (data: {
|
|
766
|
+
input: Record<string, any>;
|
|
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"];
|
|
@@ -867,7 +888,10 @@ 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: (
|
|
891
|
+
action: (data: {
|
|
892
|
+
input: Record<string, any>;
|
|
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"];
|
|
@@ -990,7 +1014,10 @@ 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: (
|
|
1017
|
+
action: (data: {
|
|
1018
|
+
input: Record<string, any>;
|
|
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"];
|
|
@@ -1114,7 +1141,10 @@ declare const _default: {
|
|
|
1114
1141
|
} & Record<PropertyKey, unknown>) | undefined;
|
|
1115
1142
|
content?: import("@esportsplus/template").Renderable<any>;
|
|
1116
1143
|
}, attributes: Readonly<{
|
|
1117
|
-
action: (
|
|
1144
|
+
action: (data: {
|
|
1145
|
+
input: Record<string, any>;
|
|
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"];
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import input from './input';
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
type A = {
|
|
9
|
-
action: (input: Record<string, any>,
|
|
9
|
+
action: (data: { input: Record<string, any>, response: typeof response }) => (Promise<Errors> | Errors),
|
|
10
10
|
state?: { processing: boolean }
|
|
11
11
|
} & Attributes;
|
|
12
12
|
|
|
@@ -75,10 +75,10 @@ export default template.factory<A>(
|
|
|
75
75
|
state.processing = true;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
let { errors } = await action(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
let { errors } = await action({
|
|
79
|
+
input: parse( new FormData( this as any as HTMLFormElement ).entries() ),
|
|
80
|
+
response
|
|
81
|
+
});
|
|
82
82
|
|
|
83
83
|
for (let i = 0, n = errors.length; i < n; i++) {
|
|
84
84
|
let { message, path } = errors[i],
|