relay-forms-nodeps 1.1.1 → 2.2.0
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/README.md +4 -4
- package/lib/RelayFormsTypes.d.ts +5 -1
- package/lib/es/RelayFormsTypes.d.ts +5 -1
- package/lib/es/index.d.ts +2 -2
- package/lib/es/index.js +2 -2
- package/lib/es/relay/queryErrorsFieldQuery.graphql.d.ts +28 -0
- package/lib/es/relay/queryErrorsFieldQuery.graphql.js +103 -0
- package/lib/es/relay/queryFieldFragment.graphql.d.ts +18 -0
- package/lib/es/relay/queryFieldFragment.graphql.js +28 -0
- package/lib/es/relay/queryFieldQuery.graphql.d.ts +25 -0
- package/lib/es/relay/queryFieldQuery.graphql.js +85 -0
- package/lib/es/relay/queryValueFieldFragment.graphql.d.ts +20 -0
- package/lib/es/relay/queryValueFieldFragment.graphql.js +40 -0
- package/lib/es/useForm.d.ts +2 -0
- package/lib/es/{useFormSubmit.js → useForm.js} +2 -2
- package/lib/es/{useFormSetValue.d.ts → useFormField.d.ts} +1 -1
- package/lib/es/{useFormSetValue.js → useFormField.js} +49 -11
- package/lib/es/useFormState.js +3 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +4 -4
- package/lib/relay/queryErrorsFieldQuery.graphql.d.ts +28 -0
- package/lib/relay/queryErrorsFieldQuery.graphql.js +108 -0
- package/lib/relay/queryFieldFragment.graphql.d.ts +18 -0
- package/lib/relay/queryFieldFragment.graphql.js +33 -0
- package/lib/relay/queryFieldQuery.graphql.d.ts +25 -0
- package/lib/relay/queryFieldQuery.graphql.js +90 -0
- package/lib/relay/queryValueFieldFragment.graphql.d.ts +20 -0
- package/lib/relay/queryValueFieldFragment.graphql.js +45 -0
- package/lib/umd/relay-forms-nodeps.js +133 -69
- package/lib/umd/relay-forms-nodeps.js.map +1 -1
- package/lib/umd/relay-forms-nodeps.min.js +1 -1
- package/lib/umd/relay-forms-nodeps.min.js.map +1 -1
- package/lib/useForm.d.ts +2 -0
- package/lib/{useFormSubmit.js → useForm.js} +6 -6
- package/lib/{useFormSetValue.d.ts → useFormField.d.ts} +1 -1
- package/lib/{useFormSetValue.js → useFormField.js} +50 -12
- package/lib/useFormState.js +3 -1
- package/package.json +4 -4
- package/lib/es/useFormSubmit.d.ts +0 -2
- package/lib/useFormSubmit.d.ts +0 -2
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @generated SignedSource<<cdb0ac3f0c6e25530bc6aa8ece819e03>>
|
|
5
|
+
* @relayHash 1e729a4dd469bbcedf1c07919286ff70
|
|
6
|
+
* @lightSyntaxTransform
|
|
7
|
+
* @nogrep
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
var node = function () {
|
|
13
|
+
var v0 = [{
|
|
14
|
+
"alias": null,
|
|
15
|
+
"args": null,
|
|
16
|
+
"concreteType": "EntryForm",
|
|
17
|
+
"kind": "LinkedField",
|
|
18
|
+
"name": "form",
|
|
19
|
+
"plural": false,
|
|
20
|
+
"selections": [{
|
|
21
|
+
"alias": null,
|
|
22
|
+
"args": null,
|
|
23
|
+
"kind": "ScalarField",
|
|
24
|
+
"name": "isSubmitting",
|
|
25
|
+
"storageKey": null
|
|
26
|
+
}, {
|
|
27
|
+
"alias": null,
|
|
28
|
+
"args": null,
|
|
29
|
+
"kind": "ScalarField",
|
|
30
|
+
"name": "isValidating",
|
|
31
|
+
"storageKey": null
|
|
32
|
+
}, {
|
|
33
|
+
"alias": null,
|
|
34
|
+
"args": null,
|
|
35
|
+
"kind": "ScalarField",
|
|
36
|
+
"name": "isValid",
|
|
37
|
+
"storageKey": null
|
|
38
|
+
}, {
|
|
39
|
+
"alias": null,
|
|
40
|
+
"args": null,
|
|
41
|
+
"concreteType": "Entry",
|
|
42
|
+
"kind": "LinkedField",
|
|
43
|
+
"name": "errors",
|
|
44
|
+
"plural": true,
|
|
45
|
+
"selections": [{
|
|
46
|
+
"alias": null,
|
|
47
|
+
"args": null,
|
|
48
|
+
"kind": "ScalarField",
|
|
49
|
+
"name": "id",
|
|
50
|
+
"storageKey": null
|
|
51
|
+
}, {
|
|
52
|
+
"alias": null,
|
|
53
|
+
"args": null,
|
|
54
|
+
"kind": "ScalarField",
|
|
55
|
+
"name": "key",
|
|
56
|
+
"storageKey": null
|
|
57
|
+
}, {
|
|
58
|
+
"alias": null,
|
|
59
|
+
"args": null,
|
|
60
|
+
"kind": "ScalarField",
|
|
61
|
+
"name": "error",
|
|
62
|
+
"storageKey": null
|
|
63
|
+
}, {
|
|
64
|
+
"alias": null,
|
|
65
|
+
"args": null,
|
|
66
|
+
"kind": "ScalarField",
|
|
67
|
+
"name": "check",
|
|
68
|
+
"storageKey": null
|
|
69
|
+
}, {
|
|
70
|
+
"alias": null,
|
|
71
|
+
"args": null,
|
|
72
|
+
"kind": "ScalarField",
|
|
73
|
+
"name": "label",
|
|
74
|
+
"storageKey": null
|
|
75
|
+
}],
|
|
76
|
+
"storageKey": null
|
|
77
|
+
}],
|
|
78
|
+
"storageKey": null
|
|
79
|
+
}];
|
|
80
|
+
return {
|
|
81
|
+
"fragment": {
|
|
82
|
+
"argumentDefinitions": [],
|
|
83
|
+
"kind": "Fragment",
|
|
84
|
+
"metadata": null,
|
|
85
|
+
"name": "queryErrorsFieldQuery",
|
|
86
|
+
"selections": v0 /*: any*/,
|
|
87
|
+
"type": "Query",
|
|
88
|
+
"abstractKey": null
|
|
89
|
+
},
|
|
90
|
+
"kind": "Request",
|
|
91
|
+
"operation": {
|
|
92
|
+
"argumentDefinitions": [],
|
|
93
|
+
"kind": "Operation",
|
|
94
|
+
"name": "queryErrorsFieldQuery",
|
|
95
|
+
"selections": v0 /*: any*/
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
"params": {
|
|
99
|
+
"id": "1e729a4dd469bbcedf1c07919286ff70\r",
|
|
100
|
+
"metadata": {},
|
|
101
|
+
"name": "queryErrorsFieldQuery",
|
|
102
|
+
"operationKind": "query",
|
|
103
|
+
"text": null
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}();
|
|
107
|
+
node.hash = "10e337eb009f23b0bbee954d56b68b89";
|
|
108
|
+
exports.default = node;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<d21170d0feb748c6558c5e5dbb4425c4>>
|
|
3
|
+
* @lightSyntaxTransform
|
|
4
|
+
* @nogrep
|
|
5
|
+
*/
|
|
6
|
+
import { ReaderFragment } from 'relay-runtime';
|
|
7
|
+
import { FragmentRefs } from "relay-runtime";
|
|
8
|
+
export declare type queryFieldFragment$data = {
|
|
9
|
+
readonly check: number | null | undefined;
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly " $fragmentType": "queryFieldFragment";
|
|
12
|
+
};
|
|
13
|
+
export declare type queryFieldFragment$key = {
|
|
14
|
+
readonly " $data"?: queryFieldFragment$data;
|
|
15
|
+
readonly " $fragmentSpreads": FragmentRefs<"queryFieldFragment">;
|
|
16
|
+
};
|
|
17
|
+
declare const node: ReaderFragment;
|
|
18
|
+
export default node;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @generated SignedSource<<d21170d0feb748c6558c5e5dbb4425c4>>
|
|
5
|
+
* @lightSyntaxTransform
|
|
6
|
+
* @nogrep
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
var node = {
|
|
12
|
+
"argumentDefinitions": [],
|
|
13
|
+
"kind": "Fragment",
|
|
14
|
+
"metadata": null,
|
|
15
|
+
"name": "queryFieldFragment",
|
|
16
|
+
"selections": [{
|
|
17
|
+
"alias": null,
|
|
18
|
+
"args": null,
|
|
19
|
+
"kind": "ScalarField",
|
|
20
|
+
"name": "id",
|
|
21
|
+
"storageKey": null
|
|
22
|
+
}, {
|
|
23
|
+
"alias": null,
|
|
24
|
+
"args": null,
|
|
25
|
+
"kind": "ScalarField",
|
|
26
|
+
"name": "check",
|
|
27
|
+
"storageKey": null
|
|
28
|
+
}],
|
|
29
|
+
"type": "Entry",
|
|
30
|
+
"abstractKey": null
|
|
31
|
+
};
|
|
32
|
+
node.hash = "d5b0953bdeb412925ee13444a6be6082";
|
|
33
|
+
exports.default = node;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<6f460eca2a43fd75eab202937349c693>>
|
|
3
|
+
* @relayHash 0b493a6f66e132f2693f91a5da941414
|
|
4
|
+
* @lightSyntaxTransform
|
|
5
|
+
* @nogrep
|
|
6
|
+
*/
|
|
7
|
+
import { ConcreteRequest } from 'relay-runtime';
|
|
8
|
+
export declare type queryFieldQuery$variables = Record<PropertyKey, never>;
|
|
9
|
+
export declare type queryFieldQuery$data = {
|
|
10
|
+
readonly form: {
|
|
11
|
+
readonly entries: ReadonlyArray<{
|
|
12
|
+
readonly check: number | null | undefined;
|
|
13
|
+
readonly error: string | null | undefined;
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly key: string;
|
|
16
|
+
readonly value: string | null | undefined;
|
|
17
|
+
} | null | undefined> | null | undefined;
|
|
18
|
+
} | null | undefined;
|
|
19
|
+
};
|
|
20
|
+
export declare type queryFieldQuery = {
|
|
21
|
+
response: queryFieldQuery$data;
|
|
22
|
+
variables: queryFieldQuery$variables;
|
|
23
|
+
};
|
|
24
|
+
declare const node: ConcreteRequest;
|
|
25
|
+
export default node;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @generated SignedSource<<6f460eca2a43fd75eab202937349c693>>
|
|
5
|
+
* @relayHash 0b493a6f66e132f2693f91a5da941414
|
|
6
|
+
* @lightSyntaxTransform
|
|
7
|
+
* @nogrep
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
var node = function () {
|
|
13
|
+
var v0 = [{
|
|
14
|
+
"alias": null,
|
|
15
|
+
"args": null,
|
|
16
|
+
"concreteType": "EntryForm",
|
|
17
|
+
"kind": "LinkedField",
|
|
18
|
+
"name": "form",
|
|
19
|
+
"plural": false,
|
|
20
|
+
"selections": [{
|
|
21
|
+
"alias": null,
|
|
22
|
+
"args": null,
|
|
23
|
+
"concreteType": "Entry",
|
|
24
|
+
"kind": "LinkedField",
|
|
25
|
+
"name": "entries",
|
|
26
|
+
"plural": true,
|
|
27
|
+
"selections": [{
|
|
28
|
+
"alias": null,
|
|
29
|
+
"args": null,
|
|
30
|
+
"kind": "ScalarField",
|
|
31
|
+
"name": "id",
|
|
32
|
+
"storageKey": null
|
|
33
|
+
}, {
|
|
34
|
+
"alias": null,
|
|
35
|
+
"args": null,
|
|
36
|
+
"kind": "ScalarField",
|
|
37
|
+
"name": "key",
|
|
38
|
+
"storageKey": null
|
|
39
|
+
}, {
|
|
40
|
+
"alias": null,
|
|
41
|
+
"args": null,
|
|
42
|
+
"kind": "ScalarField",
|
|
43
|
+
"name": "value",
|
|
44
|
+
"storageKey": null
|
|
45
|
+
}, {
|
|
46
|
+
"alias": null,
|
|
47
|
+
"args": null,
|
|
48
|
+
"kind": "ScalarField",
|
|
49
|
+
"name": "check",
|
|
50
|
+
"storageKey": null
|
|
51
|
+
}, {
|
|
52
|
+
"alias": null,
|
|
53
|
+
"args": null,
|
|
54
|
+
"kind": "ScalarField",
|
|
55
|
+
"name": "error",
|
|
56
|
+
"storageKey": null
|
|
57
|
+
}],
|
|
58
|
+
"storageKey": null
|
|
59
|
+
}],
|
|
60
|
+
"storageKey": null
|
|
61
|
+
}];
|
|
62
|
+
return {
|
|
63
|
+
"fragment": {
|
|
64
|
+
"argumentDefinitions": [],
|
|
65
|
+
"kind": "Fragment",
|
|
66
|
+
"metadata": null,
|
|
67
|
+
"name": "queryFieldQuery",
|
|
68
|
+
"selections": v0 /*: any*/,
|
|
69
|
+
"type": "Query",
|
|
70
|
+
"abstractKey": null
|
|
71
|
+
},
|
|
72
|
+
"kind": "Request",
|
|
73
|
+
"operation": {
|
|
74
|
+
"argumentDefinitions": [],
|
|
75
|
+
"kind": "Operation",
|
|
76
|
+
"name": "queryFieldQuery",
|
|
77
|
+
"selections": v0 /*: any*/
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
"params": {
|
|
81
|
+
"id": "0b493a6f66e132f2693f91a5da941414\r",
|
|
82
|
+
"metadata": {},
|
|
83
|
+
"name": "queryFieldQuery",
|
|
84
|
+
"operationKind": "query",
|
|
85
|
+
"text": null
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}();
|
|
89
|
+
node.hash = "f9fd20a80a839dfb51206c305cbb1657";
|
|
90
|
+
exports.default = node;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<432c971608826457e61804e44aeb7a64>>
|
|
3
|
+
* @lightSyntaxTransform
|
|
4
|
+
* @nogrep
|
|
5
|
+
*/
|
|
6
|
+
import { ReaderFragment } from 'relay-runtime';
|
|
7
|
+
import { FragmentRefs } from "relay-runtime";
|
|
8
|
+
export declare type queryValueFieldFragment$data = {
|
|
9
|
+
readonly error: string | null | undefined;
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly label: string | null | undefined;
|
|
12
|
+
readonly value: string | null | undefined;
|
|
13
|
+
readonly " $fragmentType": "queryValueFieldFragment";
|
|
14
|
+
};
|
|
15
|
+
export declare type queryValueFieldFragment$key = {
|
|
16
|
+
readonly " $data"?: queryValueFieldFragment$data;
|
|
17
|
+
readonly " $fragmentSpreads": FragmentRefs<"queryValueFieldFragment">;
|
|
18
|
+
};
|
|
19
|
+
declare const node: ReaderFragment;
|
|
20
|
+
export default node;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @generated SignedSource<<432c971608826457e61804e44aeb7a64>>
|
|
5
|
+
* @lightSyntaxTransform
|
|
6
|
+
* @nogrep
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
var node = {
|
|
12
|
+
"argumentDefinitions": [],
|
|
13
|
+
"kind": "Fragment",
|
|
14
|
+
"metadata": null,
|
|
15
|
+
"name": "queryValueFieldFragment",
|
|
16
|
+
"selections": [{
|
|
17
|
+
"alias": null,
|
|
18
|
+
"args": null,
|
|
19
|
+
"kind": "ScalarField",
|
|
20
|
+
"name": "id",
|
|
21
|
+
"storageKey": null
|
|
22
|
+
}, {
|
|
23
|
+
"alias": null,
|
|
24
|
+
"args": null,
|
|
25
|
+
"kind": "ScalarField",
|
|
26
|
+
"name": "value",
|
|
27
|
+
"storageKey": null
|
|
28
|
+
}, {
|
|
29
|
+
"alias": null,
|
|
30
|
+
"args": null,
|
|
31
|
+
"kind": "ScalarField",
|
|
32
|
+
"name": "label",
|
|
33
|
+
"storageKey": null
|
|
34
|
+
}, {
|
|
35
|
+
"alias": null,
|
|
36
|
+
"args": null,
|
|
37
|
+
"kind": "ScalarField",
|
|
38
|
+
"name": "error",
|
|
39
|
+
"storageKey": null
|
|
40
|
+
}],
|
|
41
|
+
"type": "Entry",
|
|
42
|
+
"abstractKey": null
|
|
43
|
+
};
|
|
44
|
+
node.hash = "364beea31c4e318a5241f2bd7d96fbd8";
|
|
45
|
+
exports.default = node;
|
|
@@ -348,7 +348,9 @@ var operationQueryErrorsForm = createOperationDescriptor(QueryErrors);
|
|
|
348
348
|
var useFormState = function () {
|
|
349
349
|
var environment = useStore();
|
|
350
350
|
var snapshot = React__default["default"].useMemo(function () {
|
|
351
|
-
|
|
351
|
+
var s = environment.lookup(operationQueryErrorsForm.fragment);
|
|
352
|
+
s.seenRecords.add('local:form');
|
|
353
|
+
return s;
|
|
352
354
|
}, [environment]);
|
|
353
355
|
var _a = React__default["default"].useState(snapshot.data.form),
|
|
354
356
|
data = _a[0],
|
|
@@ -362,6 +364,100 @@ var useFormState = function () {
|
|
|
362
364
|
return data;
|
|
363
365
|
};
|
|
364
366
|
|
|
367
|
+
/*! *****************************************************************************
|
|
368
|
+
Copyright (c) Microsoft Corporation.
|
|
369
|
+
|
|
370
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
371
|
+
purpose with or without fee is hereby granted.
|
|
372
|
+
|
|
373
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
374
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
375
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
376
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
377
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
378
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
379
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
380
|
+
***************************************************************************** */
|
|
381
|
+
|
|
382
|
+
var __assign = function() {
|
|
383
|
+
__assign = Object.assign || function __assign(t) {
|
|
384
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
385
|
+
s = arguments[i];
|
|
386
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
387
|
+
}
|
|
388
|
+
return t;
|
|
389
|
+
};
|
|
390
|
+
return __assign.apply(this, arguments);
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
function __generator(thisArg, body) {
|
|
394
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
395
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
396
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
397
|
+
function step(op) {
|
|
398
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
399
|
+
while (_) try {
|
|
400
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
401
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
402
|
+
switch (op[0]) {
|
|
403
|
+
case 0: case 1: t = op; break;
|
|
404
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
405
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
406
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
407
|
+
default:
|
|
408
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
409
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
410
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
411
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
412
|
+
if (t[2]) _.ops.pop();
|
|
413
|
+
_.trys.pop(); continue;
|
|
414
|
+
}
|
|
415
|
+
op = body.call(thisArg, _);
|
|
416
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
417
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* @generated SignedSource<<432c971608826457e61804e44aeb7a64>>
|
|
423
|
+
* @lightSyntaxTransform
|
|
424
|
+
* @nogrep
|
|
425
|
+
*/
|
|
426
|
+
var node = {
|
|
427
|
+
"argumentDefinitions": [],
|
|
428
|
+
"kind": "Fragment",
|
|
429
|
+
"metadata": null,
|
|
430
|
+
"name": "queryValueFieldFragment",
|
|
431
|
+
"selections": [{
|
|
432
|
+
"alias": null,
|
|
433
|
+
"args": null,
|
|
434
|
+
"kind": "ScalarField",
|
|
435
|
+
"name": "id",
|
|
436
|
+
"storageKey": null
|
|
437
|
+
}, {
|
|
438
|
+
"alias": null,
|
|
439
|
+
"args": null,
|
|
440
|
+
"kind": "ScalarField",
|
|
441
|
+
"name": "value",
|
|
442
|
+
"storageKey": null
|
|
443
|
+
}, {
|
|
444
|
+
"alias": null,
|
|
445
|
+
"args": null,
|
|
446
|
+
"kind": "ScalarField",
|
|
447
|
+
"name": "label",
|
|
448
|
+
"storageKey": null
|
|
449
|
+
}, {
|
|
450
|
+
"alias": null,
|
|
451
|
+
"args": null,
|
|
452
|
+
"kind": "ScalarField",
|
|
453
|
+
"name": "error",
|
|
454
|
+
"storageKey": null
|
|
455
|
+
}],
|
|
456
|
+
"type": "Entry",
|
|
457
|
+
"abstractKey": null
|
|
458
|
+
};
|
|
459
|
+
node.hash = "364beea31c4e318a5241f2bd7d96fbd8";
|
|
460
|
+
|
|
365
461
|
function useForceUpdate() {
|
|
366
462
|
var _a = React.useReducer(function (x) {
|
|
367
463
|
return x + 1;
|
|
@@ -388,10 +484,15 @@ function logicSetValue(params) {
|
|
|
388
484
|
initialValue = params.initialValue,
|
|
389
485
|
forceUpdate = params.forceUpdate,
|
|
390
486
|
validateOnChange = params.validateOnChange,
|
|
391
|
-
label = params.label
|
|
487
|
+
label = params.label,
|
|
488
|
+
dependsOn = params.dependsOn;
|
|
392
489
|
var validate = undefined;
|
|
393
490
|
var firstSet = true;
|
|
491
|
+
var deps = {};
|
|
394
492
|
var localId = getFieldId(key);
|
|
493
|
+
function getDeps() {
|
|
494
|
+
return deps;
|
|
495
|
+
}
|
|
395
496
|
function getValidate() {
|
|
396
497
|
return validate;
|
|
397
498
|
}
|
|
@@ -466,13 +567,14 @@ function logicSetValue(params) {
|
|
|
466
567
|
}
|
|
467
568
|
commitField(false);
|
|
468
569
|
}
|
|
469
|
-
function internalValidate(value, validateFunction) {
|
|
570
|
+
function internalValidate(value, validateFunction, depsValidation) {
|
|
470
571
|
ref.isChecking = true;
|
|
471
|
-
var result = validateFunction(value);
|
|
572
|
+
var result = validateFunction(value, deps);
|
|
472
573
|
function internalFinalize(error) {
|
|
473
574
|
var validate = getValidate();
|
|
474
|
-
|
|
475
|
-
|
|
575
|
+
var deps = getDeps();
|
|
576
|
+
if (value !== dataResult.value || validate !== validateFunction || deps !== depsValidation) {
|
|
577
|
+
internalValidate(dataResult.value, validate, deps);
|
|
476
578
|
return;
|
|
477
579
|
}
|
|
478
580
|
finalizeCheck(error);
|
|
@@ -496,9 +598,23 @@ function logicSetValue(params) {
|
|
|
496
598
|
ref.check = getInitCheck(validate);
|
|
497
599
|
setValueInternal(initialValue);
|
|
498
600
|
} else if (isValidating && !ref.isChecking) {
|
|
499
|
-
internalValidate(dataResult.value, validate);
|
|
601
|
+
internalValidate(dataResult.value, validate, deps);
|
|
500
602
|
}
|
|
501
603
|
}).dispose;
|
|
604
|
+
if (dependsOn != null) {
|
|
605
|
+
dependsOn.forEach(function (depKey) {
|
|
606
|
+
var snapshot = getSnapshot(environment, node, depKey);
|
|
607
|
+
environment.subscribe(snapshot, function (s) {
|
|
608
|
+
var _a;
|
|
609
|
+
var data = s.data;
|
|
610
|
+
deps = __assign(__assign({}, deps), (_a = {}, _a[depKey] = data, _a));
|
|
611
|
+
if (ref.check == DONEVALIDATED && !ref.isChecking) {
|
|
612
|
+
ref.check = VALIDATING;
|
|
613
|
+
commitField(false);
|
|
614
|
+
}
|
|
615
|
+
}).dispose;
|
|
616
|
+
});
|
|
617
|
+
}
|
|
502
618
|
var dispose = function () {
|
|
503
619
|
disposeSubscrition();
|
|
504
620
|
commit(environment, function (store, form) {
|
|
@@ -511,7 +627,7 @@ function logicSetValue(params) {
|
|
|
511
627
|
});
|
|
512
628
|
};
|
|
513
629
|
if (validateOnChange) {
|
|
514
|
-
internalValidate(initialValue, getValidate());
|
|
630
|
+
internalValidate(initialValue, getValidate(), deps);
|
|
515
631
|
}
|
|
516
632
|
return dispose;
|
|
517
633
|
}
|
|
@@ -522,12 +638,13 @@ function logicSetValue(params) {
|
|
|
522
638
|
setValidate: setValidate
|
|
523
639
|
};
|
|
524
640
|
}
|
|
525
|
-
function
|
|
641
|
+
function useFormField(_a) {
|
|
526
642
|
var key = _a.key,
|
|
527
643
|
initialValue = _a.initialValue,
|
|
528
644
|
validate = _a.validate,
|
|
529
645
|
validateOnChange = _a.validateOnChange,
|
|
530
|
-
label = _a.label
|
|
646
|
+
label = _a.label,
|
|
647
|
+
dependsOn = _a.dependsOn;
|
|
531
648
|
var forceUpdate = useForceUpdate();
|
|
532
649
|
var environment = useStore();
|
|
533
650
|
var resolver = React__default["default"].useMemo(function () {
|
|
@@ -537,9 +654,10 @@ function useFormSetValue(_a) {
|
|
|
537
654
|
label: label,
|
|
538
655
|
initialValue: initialValue,
|
|
539
656
|
forceUpdate: forceUpdate,
|
|
540
|
-
validateOnChange: validateOnChange
|
|
657
|
+
validateOnChange: validateOnChange,
|
|
658
|
+
dependsOn: dependsOn
|
|
541
659
|
});
|
|
542
|
-
}, [environment, key, initialValue, forceUpdate, validateOnChange, label]);
|
|
660
|
+
}, [environment, key, initialValue, forceUpdate, validateOnChange, label, dependsOn]);
|
|
543
661
|
resolver.setValidate(validate);
|
|
544
662
|
React__default["default"].useEffect(function () {
|
|
545
663
|
return resolver.subscribe();
|
|
@@ -651,7 +769,7 @@ function logicSubmit(environment, onSubmit) {
|
|
|
651
769
|
getData: getData
|
|
652
770
|
};
|
|
653
771
|
}
|
|
654
|
-
var
|
|
772
|
+
var useForm = function (_a) {
|
|
655
773
|
var onSubmit = _a.onSubmit;
|
|
656
774
|
var environment = useStore();
|
|
657
775
|
var resolver = React__default["default"].useMemo(function () {
|
|
@@ -679,60 +797,6 @@ function useFormValue(key) {
|
|
|
679
797
|
return data;
|
|
680
798
|
}
|
|
681
799
|
|
|
682
|
-
/*! *****************************************************************************
|
|
683
|
-
Copyright (c) Microsoft Corporation.
|
|
684
|
-
|
|
685
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
686
|
-
purpose with or without fee is hereby granted.
|
|
687
|
-
|
|
688
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
689
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
690
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
691
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
692
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
693
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
694
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
695
|
-
***************************************************************************** */
|
|
696
|
-
|
|
697
|
-
var __assign = function() {
|
|
698
|
-
__assign = Object.assign || function __assign(t) {
|
|
699
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
700
|
-
s = arguments[i];
|
|
701
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
702
|
-
}
|
|
703
|
-
return t;
|
|
704
|
-
};
|
|
705
|
-
return __assign.apply(this, arguments);
|
|
706
|
-
};
|
|
707
|
-
|
|
708
|
-
function __generator(thisArg, body) {
|
|
709
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
710
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
711
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
712
|
-
function step(op) {
|
|
713
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
714
|
-
while (_) try {
|
|
715
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
716
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
717
|
-
switch (op[0]) {
|
|
718
|
-
case 0: case 1: t = op; break;
|
|
719
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
720
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
721
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
722
|
-
default:
|
|
723
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
724
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
725
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
726
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
727
|
-
if (t[2]) _.ops.pop();
|
|
728
|
-
_.trys.pop(); continue;
|
|
729
|
-
}
|
|
730
|
-
op = body.call(thisArg, _);
|
|
731
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
732
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
|
|
736
800
|
var ID_KEY = RelayStoreUtils.ID_KEY,
|
|
737
801
|
REF_KEY = RelayStoreUtils.REF_KEY,
|
|
738
802
|
REFS_KEY = RelayStoreUtils.REFS_KEY;
|
|
@@ -1513,9 +1577,9 @@ exports.RecordSource = RelayRecordSource;
|
|
|
1513
1577
|
exports.Store = RelayModernStore;
|
|
1514
1578
|
exports.StoreProvider = StoreProvider;
|
|
1515
1579
|
exports.createStore = createStore;
|
|
1516
|
-
exports.
|
|
1580
|
+
exports.useForm = useForm;
|
|
1581
|
+
exports.useFormField = useFormField;
|
|
1517
1582
|
exports.useFormState = useFormState;
|
|
1518
|
-
exports.useFormSubmit = useFormSubmit;
|
|
1519
1583
|
exports.useFormValue = useFormValue;
|
|
1520
1584
|
|
|
1521
1585
|
Object.defineProperty(exports, '__esModule', { value: true });
|