relay-forms-nodeps 2.2.0 → 2.3.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/.vscode/settings.json +10 -0
- package/eslint.config.js +84 -0
- package/lib/RelayFormsTypes.d.ts +13 -10
- package/lib/Utils.d.ts +1 -1
- package/lib/Utils.js +4 -3
- package/lib/es/RelayFormsTypes.d.ts +13 -10
- package/lib/es/RelayFormsTypes.js +1 -0
- package/lib/es/Utils.d.ts +1 -1
- package/lib/es/index.js +3 -1
- package/lib/es/relay/RelayModernStore.js +1 -2
- package/lib/es/relay/RelayReader.js +0 -1
- package/lib/es/relay/RelayStoreProvider.d.ts +1 -1
- package/lib/es/relay/RelayTypes.d.ts +7 -7
- package/lib/es/relay/RelayTypes.js +1 -0
- package/lib/es/relay/queries.js +0 -1
- package/lib/es/relay/queryErrorsFieldQuery.graphql.d.ts +4 -5
- package/lib/es/relay/queryErrorsFieldQuery.graphql.js +4 -6
- package/lib/es/relay/queryFieldFragment.graphql.d.ts +3 -4
- package/lib/es/relay/queryFieldFragment.graphql.js +1 -2
- package/lib/es/relay/queryFieldQuery.graphql.d.ts +4 -5
- package/lib/es/relay/queryFieldQuery.graphql.js +4 -6
- package/lib/es/relay/queryValueFieldFragment.graphql.d.ts +3 -4
- package/lib/es/relay/queryValueFieldFragment.graphql.js +1 -2
- package/lib/es/useForm.js +6 -2
- package/lib/es/useFormState.d.ts +2 -12
- package/lib/index.js +70 -8
- package/lib/relay/RelayModernRecord.js +2 -1
- package/lib/relay/RelayModernSelector.js +1 -0
- package/lib/relay/RelayModernStore.js +7 -7
- package/lib/relay/RelayReader.js +1 -1
- package/lib/relay/RelayRecordProxy.js +1 -0
- package/lib/relay/RelayRecordSource.js +1 -0
- package/lib/relay/RelayRecordSourceMutator.js +1 -0
- package/lib/relay/RelayRecordSourceProxy.js +1 -0
- package/lib/relay/RelayReferenceMarker.js +1 -0
- package/lib/relay/RelayStoreProvider.d.ts +1 -1
- package/lib/relay/RelayStoreProvider.js +3 -1
- package/lib/relay/RelayStoreUtils.js +1 -0
- package/lib/relay/RelayTypes.d.ts +7 -7
- package/lib/relay/queries.js +1 -1
- package/lib/relay/queryErrorsFieldQuery.graphql.d.ts +4 -5
- package/lib/relay/queryErrorsFieldQuery.graphql.js +4 -6
- package/lib/relay/queryFieldFragment.graphql.d.ts +3 -4
- package/lib/relay/queryFieldFragment.graphql.js +1 -2
- package/lib/relay/queryFieldQuery.graphql.d.ts +4 -5
- package/lib/relay/queryFieldQuery.graphql.js +4 -6
- package/lib/relay/queryValueFieldFragment.graphql.d.ts +3 -4
- package/lib/relay/queryValueFieldFragment.graphql.js +1 -2
- package/lib/umd/relay-forms-nodeps.js +17 -12
- 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/useForceUpdate.js +2 -1
- package/lib/useForm.js +17 -11
- package/lib/useFormField.js +9 -8
- package/lib/useFormState.d.ts +2 -12
- package/lib/useFormState.js +5 -3
- package/lib/useFormValue.js +3 -2
- package/package.json +106 -102
- package/rollup.config.js +92 -92
- package/yarn-error.log +127 -127
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"prettier.requireConfig": true,
|
|
3
|
+
"prettier.prettierPath": "./node_modules/prettier/index.cjs",
|
|
4
|
+
"[typescript]": {
|
|
5
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
6
|
+
},
|
|
7
|
+
"[typescriptreact]": {
|
|
8
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
9
|
+
}
|
|
10
|
+
}
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const js = require('@eslint/js');
|
|
2
|
+
const tsParser = require('@typescript-eslint/parser');
|
|
3
|
+
const tsPlugin = require('@typescript-eslint/eslint-plugin');
|
|
4
|
+
const importPlugin = require('eslint-plugin-import');
|
|
5
|
+
const prettierPlugin = require('eslint-plugin-prettier');
|
|
6
|
+
const reactPlugin = require('eslint-plugin-react');
|
|
7
|
+
const reactHooksPlugin = require('eslint-plugin-react-hooks');
|
|
8
|
+
const prettierConfig = require('eslint-config-prettier');
|
|
9
|
+
|
|
10
|
+
module.exports = [
|
|
11
|
+
js.configs.recommended,
|
|
12
|
+
prettierConfig,
|
|
13
|
+
{
|
|
14
|
+
files: ['src/**/*.{js,jsx,ts,tsx}'],
|
|
15
|
+
languageOptions: {
|
|
16
|
+
ecmaVersion: 2018,
|
|
17
|
+
sourceType: 'module',
|
|
18
|
+
parser: tsParser,
|
|
19
|
+
parserOptions: {
|
|
20
|
+
ecmaFeatures: {
|
|
21
|
+
jsx: true,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
plugins: {
|
|
26
|
+
'@typescript-eslint': tsPlugin,
|
|
27
|
+
import: importPlugin,
|
|
28
|
+
prettier: prettierPlugin,
|
|
29
|
+
react: reactPlugin,
|
|
30
|
+
'react-hooks': reactHooksPlugin,
|
|
31
|
+
},
|
|
32
|
+
settings: {
|
|
33
|
+
'import/parsers': {
|
|
34
|
+
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
35
|
+
},
|
|
36
|
+
'import/resolver': {
|
|
37
|
+
typescript: {},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
rules: {
|
|
41
|
+
...tsPlugin.configs.recommended.rules,
|
|
42
|
+
...reactHooksPlugin.configs.recommended.rules,
|
|
43
|
+
'react/jsx-filename-extension': [2, { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
|
|
44
|
+
'import/no-extraneous-dependencies': [
|
|
45
|
+
2,
|
|
46
|
+
{ devDependencies: ['**/test.tsx', '**/test.ts'] },
|
|
47
|
+
],
|
|
48
|
+
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
|
|
49
|
+
'max-len': [
|
|
50
|
+
2,
|
|
51
|
+
{
|
|
52
|
+
code: 100,
|
|
53
|
+
ignorePattern: '^import [^,]+ from |^export | implements',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
'no-duplicate-imports': ['error'],
|
|
57
|
+
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
|
|
58
|
+
'no-unused-vars': 'off',
|
|
59
|
+
'no-undef': 'off',
|
|
60
|
+
'object-curly-newline': ['error', { consistent: true }],
|
|
61
|
+
semi: [2, 'always'],
|
|
62
|
+
'space-before-function-paren': [
|
|
63
|
+
'error',
|
|
64
|
+
{ anonymous: 'never', named: 'never', asyncArrow: 'ignore' },
|
|
65
|
+
],
|
|
66
|
+
'@typescript-eslint/no-empty-function': ['error', { allow: ['arrowFunctions'] }],
|
|
67
|
+
'@typescript-eslint/no-explicit-any': [0],
|
|
68
|
+
'@typescript-eslint/no-unused-vars': [2, { argsIgnorePattern: '^_' }],
|
|
69
|
+
'@typescript-eslint/no-use-before-define': [0],
|
|
70
|
+
'import/no-default-export': ['error'],
|
|
71
|
+
'import/order': [
|
|
72
|
+
'error',
|
|
73
|
+
{
|
|
74
|
+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
75
|
+
alphabetize: {
|
|
76
|
+
order: 'asc',
|
|
77
|
+
caseInsensitive: true,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
'prettier/prettier': 'error',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
];
|
package/lib/RelayFormsTypes.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type FunctionOnSubmit<ValueType> = (values: ValueType) => Promise<void> | void;
|
|
3
|
+
export type FormSubmitOptions<ValueType> = {
|
|
4
4
|
onSubmit: FunctionOnSubmit<ValueType>;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type FormSubmitReturn = {
|
|
7
7
|
submit: (event?: React.BaseSyntheticEvent<any, any, any>) => void;
|
|
8
8
|
validate: () => void;
|
|
9
9
|
reset: () => void;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type ValidateFunction<ValueType> = (value: ValueType, deps?: {
|
|
12
12
|
[key: string]: FormValueStateReturn<any>;
|
|
13
13
|
}) => Promise<string | undefined> | string | undefined;
|
|
14
|
-
export
|
|
14
|
+
export type FormSetValueOptions<ValueType> = {
|
|
15
15
|
key: string;
|
|
16
16
|
initialValue?: ValueType;
|
|
17
17
|
validate?: ValidateFunction<ValueType>;
|
|
@@ -19,18 +19,21 @@ export declare type FormSetValueOptions<ValueType> = {
|
|
|
19
19
|
label?: string;
|
|
20
20
|
dependsOn?: ReadonlyArray<string> | null | undefined;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export type FormSetValueStateReturn<ValueType> = {
|
|
23
23
|
error: undefined | null | Error;
|
|
24
24
|
value?: ValueType;
|
|
25
25
|
};
|
|
26
|
-
export
|
|
26
|
+
export type FormValueStateReturn<ValueType> = {
|
|
27
27
|
readonly id: string;
|
|
28
28
|
readonly value: ValueType | null;
|
|
29
29
|
readonly error: string | null;
|
|
30
30
|
};
|
|
31
|
-
export
|
|
32
|
-
export
|
|
33
|
-
|
|
31
|
+
export type FormSetValueFunctionReturn<ValueType> = (newValue: ValueType) => void;
|
|
32
|
+
export type FormSetValueReturn<ValueType> = [
|
|
33
|
+
FormSetValueStateReturn<ValueType>,
|
|
34
|
+
FormSetValueFunctionReturn<ValueType>
|
|
35
|
+
];
|
|
36
|
+
export type FormStateReturn = {
|
|
34
37
|
errors: ReadonlyArray<{
|
|
35
38
|
readonly id: string;
|
|
36
39
|
readonly key: string;
|
package/lib/Utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RecordProxy, RecordSourceProxy, Snapshot, Store } from './relay/RelayTypes';
|
|
2
|
-
|
|
2
|
+
type FormStoreUpdater = (store: RecordSourceProxy, form: RecordProxy) => void;
|
|
3
3
|
export declare function getFieldId(key: any): string;
|
|
4
4
|
export declare function getSnapshot(environment: Store, fragment: any, key: string): Snapshot;
|
|
5
5
|
export declare function commit(environment: Store, updater: FormStoreUpdater): void;
|
package/lib/Utils.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.operationQueryErrorsForm = exports.operationQueryForm = exports.commit = exports.getSnapshot = exports.getFieldId = void 0;
|
|
6
7
|
var queries_1 = require("./relay/queries");
|
|
7
8
|
var RelayModernSelector_1 = require("./relay/RelayModernSelector");
|
|
8
9
|
var PREFIX_LOCAL_FORM = 'local:form';
|
|
@@ -14,7 +15,7 @@ function getSnapshot(environment, fragment, key) {
|
|
|
14
15
|
var item = {
|
|
15
16
|
__id: getFieldId(key)
|
|
16
17
|
};
|
|
17
|
-
return environment.lookup(RelayModernSelector_1.getSingularSelector(fragment, item));
|
|
18
|
+
return environment.lookup((0, RelayModernSelector_1.getSingularSelector)(fragment, item));
|
|
18
19
|
}
|
|
19
20
|
exports.getSnapshot = getSnapshot;
|
|
20
21
|
function commit(environment, updater) {
|
|
@@ -28,5 +29,5 @@ function commit(environment, updater) {
|
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
31
|
exports.commit = commit;
|
|
31
|
-
exports.operationQueryForm = RelayModernSelector_1.createOperationDescriptor(queries_1.QueryFields);
|
|
32
|
-
exports.operationQueryErrorsForm = RelayModernSelector_1.createOperationDescriptor(queries_1.QueryErrors);
|
|
32
|
+
exports.operationQueryForm = (0, RelayModernSelector_1.createOperationDescriptor)(queries_1.QueryFields);
|
|
33
|
+
exports.operationQueryErrorsForm = (0, RelayModernSelector_1.createOperationDescriptor)(queries_1.QueryErrors);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type FunctionOnSubmit<ValueType> = (values: ValueType) => Promise<void> | void;
|
|
3
|
+
export type FormSubmitOptions<ValueType> = {
|
|
4
4
|
onSubmit: FunctionOnSubmit<ValueType>;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type FormSubmitReturn = {
|
|
7
7
|
submit: (event?: React.BaseSyntheticEvent<any, any, any>) => void;
|
|
8
8
|
validate: () => void;
|
|
9
9
|
reset: () => void;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type ValidateFunction<ValueType> = (value: ValueType, deps?: {
|
|
12
12
|
[key: string]: FormValueStateReturn<any>;
|
|
13
13
|
}) => Promise<string | undefined> | string | undefined;
|
|
14
|
-
export
|
|
14
|
+
export type FormSetValueOptions<ValueType> = {
|
|
15
15
|
key: string;
|
|
16
16
|
initialValue?: ValueType;
|
|
17
17
|
validate?: ValidateFunction<ValueType>;
|
|
@@ -19,18 +19,21 @@ export declare type FormSetValueOptions<ValueType> = {
|
|
|
19
19
|
label?: string;
|
|
20
20
|
dependsOn?: ReadonlyArray<string> | null | undefined;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export type FormSetValueStateReturn<ValueType> = {
|
|
23
23
|
error: undefined | null | Error;
|
|
24
24
|
value?: ValueType;
|
|
25
25
|
};
|
|
26
|
-
export
|
|
26
|
+
export type FormValueStateReturn<ValueType> = {
|
|
27
27
|
readonly id: string;
|
|
28
28
|
readonly value: ValueType | null;
|
|
29
29
|
readonly error: string | null;
|
|
30
30
|
};
|
|
31
|
-
export
|
|
32
|
-
export
|
|
33
|
-
|
|
31
|
+
export type FormSetValueFunctionReturn<ValueType> = (newValue: ValueType) => void;
|
|
32
|
+
export type FormSetValueReturn<ValueType> = [
|
|
33
|
+
FormSetValueStateReturn<ValueType>,
|
|
34
|
+
FormSetValueFunctionReturn<ValueType>
|
|
35
|
+
];
|
|
36
|
+
export type FormStateReturn = {
|
|
34
37
|
errors: ReadonlyArray<{
|
|
35
38
|
readonly id: string;
|
|
36
39
|
readonly key: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/es/Utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RecordProxy, RecordSourceProxy, Snapshot, Store } from './relay/RelayTypes';
|
|
2
|
-
|
|
2
|
+
type FormStoreUpdater = (store: RecordSourceProxy, form: RecordProxy) => void;
|
|
3
3
|
export declare function getFieldId(key: any): string;
|
|
4
4
|
export declare function getSnapshot(environment: Store, fragment: any, key: string): Snapshot;
|
|
5
5
|
export declare function commit(environment: Store, updater: FormStoreUpdater): void;
|
package/lib/es/index.js
CHANGED
|
@@ -4,4 +4,6 @@ export { useFormField } from './useFormField';
|
|
|
4
4
|
export { useFormValue } from './useFormValue';
|
|
5
5
|
export { StoreProvider } from './relay/RelayStoreProvider';
|
|
6
6
|
export { RelayModernStore as Store, createStore } from './relay/RelayModernStore';
|
|
7
|
-
export { RelayRecordSource as RecordSource } from './relay/RelayRecordSource';
|
|
7
|
+
export { RelayRecordSource as RecordSource } from './relay/RelayRecordSource';
|
|
8
|
+
export * from './RelayFormsTypes';
|
|
9
|
+
export * from './relay/RelayTypes';
|
|
@@ -39,7 +39,7 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
39
39
|
}
|
|
40
40
|
function step(op) {
|
|
41
41
|
if (f) throw new TypeError("Generator is already executing.");
|
|
42
|
-
while (_) try {
|
|
42
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
43
43
|
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;
|
|
44
44
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
45
45
|
switch (op[0]) {
|
|
@@ -309,7 +309,6 @@ var RelayModernStore = /** @class */function () {
|
|
|
309
309
|
}
|
|
310
310
|
});
|
|
311
311
|
};
|
|
312
|
-
|
|
313
312
|
return RelayModernStore;
|
|
314
313
|
}();
|
|
315
314
|
export { RelayModernStore };
|
|
@@ -3,5 +3,5 @@ import { Store } from './RelayTypes';
|
|
|
3
3
|
export declare const StoreProvider: <TStore extends Store = Store>(props: {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
store: TStore;
|
|
6
|
-
}) => JSX.Element;
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
7
|
export declare function useStore<TStore extends Store = Store>(): TStore;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RelayRecordState } from './RelayStoreUtils';
|
|
2
|
-
export
|
|
2
|
+
export type Disposable = {
|
|
3
3
|
dispose(): void;
|
|
4
4
|
};
|
|
5
5
|
export interface RecordProxy {
|
|
@@ -16,14 +16,14 @@ export interface RecordSourceProxy {
|
|
|
16
16
|
get(string: string): RecordProxy | null | undefined;
|
|
17
17
|
getRoot(): RecordProxy;
|
|
18
18
|
}
|
|
19
|
-
export
|
|
20
|
-
export
|
|
19
|
+
export type StoreUpdater = (store: RecordSourceProxy) => void;
|
|
20
|
+
export type Record = {
|
|
21
21
|
[key: string]: any;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type SelectorData = {
|
|
24
24
|
[key: string]: any;
|
|
25
25
|
};
|
|
26
|
-
export
|
|
26
|
+
export type RecordState = keyof typeof RelayRecordState;
|
|
27
27
|
export interface RecordSource {
|
|
28
28
|
get(dataID: string): Record | null | undefined;
|
|
29
29
|
getRecordIDs(): Array<string>;
|
|
@@ -34,12 +34,12 @@ export interface RecordSource {
|
|
|
34
34
|
[key: string]: Record | null | undefined;
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
export
|
|
37
|
+
export type Snapshot = {
|
|
38
38
|
data: SelectorData | null | undefined;
|
|
39
39
|
seenRecords: Set<string>;
|
|
40
40
|
selector: any;
|
|
41
41
|
};
|
|
42
|
-
export
|
|
42
|
+
export type OperationDescriptor = {
|
|
43
43
|
fragment: any;
|
|
44
44
|
request: any;
|
|
45
45
|
root: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/es/relay/queries.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @generated SignedSource<<
|
|
2
|
+
* @generated SignedSource<<c006e1b0c17510c704075849dda72ba6>>
|
|
3
3
|
* @relayHash 1e729a4dd469bbcedf1c07919286ff70
|
|
4
4
|
* @lightSyntaxTransform
|
|
5
|
-
* @nogrep
|
|
6
5
|
*/
|
|
7
6
|
import { ConcreteRequest } from 'relay-runtime';
|
|
8
|
-
export
|
|
9
|
-
export
|
|
7
|
+
export type queryErrorsFieldQuery$variables = Record<PropertyKey, never>;
|
|
8
|
+
export type queryErrorsFieldQuery$data = {
|
|
10
9
|
readonly form: {
|
|
11
10
|
readonly errors: ReadonlyArray<{
|
|
12
11
|
readonly check: number | null | undefined;
|
|
@@ -20,7 +19,7 @@ export declare type queryErrorsFieldQuery$data = {
|
|
|
20
19
|
readonly isValidating: boolean | null | undefined;
|
|
21
20
|
} | null | undefined;
|
|
22
21
|
};
|
|
23
|
-
export
|
|
22
|
+
export type queryErrorsFieldQuery = {
|
|
24
23
|
response: queryErrorsFieldQuery$data;
|
|
25
24
|
variables: queryErrorsFieldQuery$variables;
|
|
26
25
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @generated SignedSource<<
|
|
2
|
+
* @generated SignedSource<<c006e1b0c17510c704075849dda72ba6>>
|
|
3
3
|
* @relayHash 1e729a4dd469bbcedf1c07919286ff70
|
|
4
4
|
* @lightSyntaxTransform
|
|
5
|
-
* @nogrep
|
|
6
5
|
*/
|
|
7
6
|
var node = function () {
|
|
8
7
|
var v0 = [{
|
|
@@ -78,7 +77,7 @@ var node = function () {
|
|
|
78
77
|
"kind": "Fragment",
|
|
79
78
|
"metadata": null,
|
|
80
79
|
"name": "queryErrorsFieldQuery",
|
|
81
|
-
"selections": v0
|
|
80
|
+
"selections": v0 /*:: as any*/,
|
|
82
81
|
"type": "Query",
|
|
83
82
|
"abstractKey": null
|
|
84
83
|
},
|
|
@@ -87,11 +86,10 @@ var node = function () {
|
|
|
87
86
|
"argumentDefinitions": [],
|
|
88
87
|
"kind": "Operation",
|
|
89
88
|
"name": "queryErrorsFieldQuery",
|
|
90
|
-
"selections": v0
|
|
89
|
+
"selections": v0 /*:: as any*/
|
|
91
90
|
},
|
|
92
|
-
|
|
93
91
|
"params": {
|
|
94
|
-
"id": "1e729a4dd469bbcedf1c07919286ff70
|
|
92
|
+
"id": "1e729a4dd469bbcedf1c07919286ff70",
|
|
95
93
|
"metadata": {},
|
|
96
94
|
"name": "queryErrorsFieldQuery",
|
|
97
95
|
"operationKind": "query",
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @generated SignedSource<<
|
|
2
|
+
* @generated SignedSource<<f339f7f54e87337ad69e9fc4490d6f4e>>
|
|
3
3
|
* @lightSyntaxTransform
|
|
4
|
-
* @nogrep
|
|
5
4
|
*/
|
|
6
5
|
import { ReaderFragment } from 'relay-runtime';
|
|
7
6
|
import { FragmentRefs } from "relay-runtime";
|
|
8
|
-
export
|
|
7
|
+
export type queryFieldFragment$data = {
|
|
9
8
|
readonly check: number | null | undefined;
|
|
10
9
|
readonly id: string;
|
|
11
10
|
readonly " $fragmentType": "queryFieldFragment";
|
|
12
11
|
};
|
|
13
|
-
export
|
|
12
|
+
export type queryFieldFragment$key = {
|
|
14
13
|
readonly " $data"?: queryFieldFragment$data;
|
|
15
14
|
readonly " $fragmentSpreads": FragmentRefs<"queryFieldFragment">;
|
|
16
15
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @generated SignedSource<<
|
|
2
|
+
* @generated SignedSource<<1263d9ecd9ad411904cb6c36855bf582>>
|
|
3
3
|
* @relayHash 0b493a6f66e132f2693f91a5da941414
|
|
4
4
|
* @lightSyntaxTransform
|
|
5
|
-
* @nogrep
|
|
6
5
|
*/
|
|
7
6
|
import { ConcreteRequest } from 'relay-runtime';
|
|
8
|
-
export
|
|
9
|
-
export
|
|
7
|
+
export type queryFieldQuery$variables = Record<PropertyKey, never>;
|
|
8
|
+
export type queryFieldQuery$data = {
|
|
10
9
|
readonly form: {
|
|
11
10
|
readonly entries: ReadonlyArray<{
|
|
12
11
|
readonly check: number | null | undefined;
|
|
@@ -17,7 +16,7 @@ export declare type queryFieldQuery$data = {
|
|
|
17
16
|
} | null | undefined> | null | undefined;
|
|
18
17
|
} | null | undefined;
|
|
19
18
|
};
|
|
20
|
-
export
|
|
19
|
+
export type queryFieldQuery = {
|
|
21
20
|
response: queryFieldQuery$data;
|
|
22
21
|
variables: queryFieldQuery$variables;
|
|
23
22
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @generated SignedSource<<
|
|
2
|
+
* @generated SignedSource<<1263d9ecd9ad411904cb6c36855bf582>>
|
|
3
3
|
* @relayHash 0b493a6f66e132f2693f91a5da941414
|
|
4
4
|
* @lightSyntaxTransform
|
|
5
|
-
* @nogrep
|
|
6
5
|
*/
|
|
7
6
|
var node = function () {
|
|
8
7
|
var v0 = [{
|
|
@@ -60,7 +59,7 @@ var node = function () {
|
|
|
60
59
|
"kind": "Fragment",
|
|
61
60
|
"metadata": null,
|
|
62
61
|
"name": "queryFieldQuery",
|
|
63
|
-
"selections": v0
|
|
62
|
+
"selections": v0 /*:: as any*/,
|
|
64
63
|
"type": "Query",
|
|
65
64
|
"abstractKey": null
|
|
66
65
|
},
|
|
@@ -69,11 +68,10 @@ var node = function () {
|
|
|
69
68
|
"argumentDefinitions": [],
|
|
70
69
|
"kind": "Operation",
|
|
71
70
|
"name": "queryFieldQuery",
|
|
72
|
-
"selections": v0
|
|
71
|
+
"selections": v0 /*:: as any*/
|
|
73
72
|
},
|
|
74
|
-
|
|
75
73
|
"params": {
|
|
76
|
-
"id": "0b493a6f66e132f2693f91a5da941414
|
|
74
|
+
"id": "0b493a6f66e132f2693f91a5da941414",
|
|
77
75
|
"metadata": {},
|
|
78
76
|
"name": "queryFieldQuery",
|
|
79
77
|
"operationKind": "query",
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @generated SignedSource<<
|
|
2
|
+
* @generated SignedSource<<69ff99d34e27e6719e62c7c4258f81e8>>
|
|
3
3
|
* @lightSyntaxTransform
|
|
4
|
-
* @nogrep
|
|
5
4
|
*/
|
|
6
5
|
import { ReaderFragment } from 'relay-runtime';
|
|
7
6
|
import { FragmentRefs } from "relay-runtime";
|
|
8
|
-
export
|
|
7
|
+
export type queryValueFieldFragment$data = {
|
|
9
8
|
readonly error: string | null | undefined;
|
|
10
9
|
readonly id: string;
|
|
11
10
|
readonly label: string | null | undefined;
|
|
12
11
|
readonly value: string | null | undefined;
|
|
13
12
|
readonly " $fragmentType": "queryValueFieldFragment";
|
|
14
13
|
};
|
|
15
|
-
export
|
|
14
|
+
export type queryValueFieldFragment$key = {
|
|
16
15
|
readonly " $data"?: queryValueFieldFragment$data;
|
|
17
16
|
readonly " $fragmentSpreads": FragmentRefs<"queryValueFieldFragment">;
|
|
18
17
|
};
|
package/lib/es/useForm.js
CHANGED
|
@@ -5,7 +5,9 @@ import { isDone, RESET, TOBEVALIDATE, VALIDATING } from './useFormField';
|
|
|
5
5
|
import { operationQueryForm, commit } from './Utils';
|
|
6
6
|
function logicSubmit(environment, onSubmit) {
|
|
7
7
|
function dispose() {
|
|
8
|
-
|
|
8
|
+
if (subscription) {
|
|
9
|
+
subscription.dispose();
|
|
10
|
+
}
|
|
9
11
|
subscription = undefined;
|
|
10
12
|
}
|
|
11
13
|
var isSubmitting = false;
|
|
@@ -81,7 +83,9 @@ function logicSubmit(environment, onSubmit) {
|
|
|
81
83
|
execute(snapshot);
|
|
82
84
|
}
|
|
83
85
|
function submit(event) {
|
|
84
|
-
|
|
86
|
+
if (event) {
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
}
|
|
85
89
|
if (!isSubmitting) {
|
|
86
90
|
isSubmitting = true;
|
|
87
91
|
validate();
|
package/lib/es/useFormState.d.ts
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
readonly check: number;
|
|
4
|
-
readonly error: string;
|
|
5
|
-
readonly id: string;
|
|
6
|
-
readonly key: string;
|
|
7
|
-
readonly label: string;
|
|
8
|
-
}[];
|
|
9
|
-
readonly isSubmitting: boolean;
|
|
10
|
-
readonly isValid: boolean;
|
|
11
|
-
readonly isValidating: boolean;
|
|
12
|
-
};
|
|
1
|
+
import { QueryErrorsData } from './relay/queries';
|
|
2
|
+
export declare const useFormState: () => QueryErrorsData['form'] | null;
|
package/lib/index.js
CHANGED
|
@@ -1,20 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
3
22
|
Object.defineProperty(exports, "__esModule", {
|
|
4
23
|
value: true
|
|
5
24
|
});
|
|
25
|
+
exports.RecordSource = exports.createStore = exports.Store = exports.StoreProvider = exports.useFormValue = exports.useFormField = exports.useForm = exports.useFormState = void 0;
|
|
6
26
|
var useFormState_1 = require("./useFormState");
|
|
7
|
-
exports
|
|
27
|
+
Object.defineProperty(exports, "useFormState", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () {
|
|
30
|
+
return useFormState_1.useFormState;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
8
33
|
var useForm_1 = require("./useForm");
|
|
9
|
-
exports
|
|
34
|
+
Object.defineProperty(exports, "useForm", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return useForm_1.useForm;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
10
40
|
var useFormField_1 = require("./useFormField");
|
|
11
|
-
exports
|
|
41
|
+
Object.defineProperty(exports, "useFormField", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return useFormField_1.useFormField;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
12
47
|
var useFormValue_1 = require("./useFormValue");
|
|
13
|
-
exports
|
|
48
|
+
Object.defineProperty(exports, "useFormValue", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return useFormValue_1.useFormValue;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
14
54
|
var RelayStoreProvider_1 = require("./relay/RelayStoreProvider");
|
|
15
|
-
exports
|
|
55
|
+
Object.defineProperty(exports, "StoreProvider", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return RelayStoreProvider_1.StoreProvider;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
16
61
|
var RelayModernStore_1 = require("./relay/RelayModernStore");
|
|
17
|
-
exports
|
|
18
|
-
|
|
62
|
+
Object.defineProperty(exports, "Store", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function () {
|
|
65
|
+
return RelayModernStore_1.RelayModernStore;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(exports, "createStore", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () {
|
|
71
|
+
return RelayModernStore_1.createStore;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
19
74
|
var RelayRecordSource_1 = require("./relay/RelayRecordSource");
|
|
20
|
-
exports
|
|
75
|
+
Object.defineProperty(exports, "RecordSource", {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function () {
|
|
78
|
+
return RelayRecordSource_1.RelayRecordSource;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
__exportStar(require("./RelayFormsTypes"), exports);
|
|
82
|
+
__exportStar(require("./relay/RelayTypes"), exports);
|