@homebound/form-state 2.32.0 → 3.0.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/dist/index.d.ts +437 -9
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1109 -14
- package/dist/index.js.map +1 -0
- package/package.json +40 -43
- package/dist/FormStateApp.d.ts +0 -5
- package/dist/FormStateApp.js +0 -54
- package/dist/FormStateApp.test.d.ts +0 -1
- package/dist/FormStateApp.test.js +0 -26
- package/dist/config.d.ts +0 -78
- package/dist/config.js +0 -2
- package/dist/configBuilders.d.ts +0 -67
- package/dist/configBuilders.js +0 -115
- package/dist/configBuilders.test.d.ts +0 -1
- package/dist/configBuilders.test.js +0 -65
- package/dist/fields/deepEquals.d.ts +0 -7
- package/dist/fields/deepEquals.js +0 -53
- package/dist/fields/fragmentField.d.ts +0 -4
- package/dist/fields/fragmentField.js +0 -58
- package/dist/fields/listField.d.ts +0 -11
- package/dist/fields/listField.js +0 -355
- package/dist/fields/objectField.d.ts +0 -63
- package/dist/fields/objectField.js +0 -277
- package/dist/fields/valueField.d.ts +0 -81
- package/dist/fields/valueField.js +0 -244
- package/dist/formState.stories.d.ts +0 -4
- package/dist/formState.stories.js +0 -12
- package/dist/formState.test.d.ts +0 -11
- package/dist/formState.test.js +0 -2109
- package/dist/formStateDomain.d.ts +0 -47
- package/dist/formStateDomain.js +0 -28
- package/dist/mobx-behavior.test.d.ts +0 -1
- package/dist/mobx-behavior.test.js +0 -51
- package/dist/proxies.d.ts +0 -5
- package/dist/proxies.js +0 -20
- package/dist/rules.d.ts +0 -10
- package/dist/rules.js +0 -11
- package/dist/setupTests.d.ts +0 -1
- package/dist/setupTests.js +0 -13
- package/dist/stackoverlfow.d.ts +0 -17
- package/dist/stackoverlfow.js +0 -17
- package/dist/temporal.d.ts +0 -6
- package/dist/temporal.js +0 -34
- package/dist/temporal.test.d.ts +0 -1
- package/dist/temporal.test.js +0 -97
- package/dist/useFormState.d.ts +0 -82
- package/dist/useFormState.js +0 -158
- package/dist/useFormState.test.d.ts +0 -1
- package/dist/useFormState.test.js +0 -787
- package/dist/useFormStates.d.ts +0 -68
- package/dist/useFormStates.js +0 -101
- package/dist/useFormStates.test.d.ts +0 -1
- package/dist/useFormStates.test.js +0 -223
- package/dist/utils.d.ts +0 -52
- package/dist/utils.js +0 -198
- package/dist/utils.test.d.ts +0 -1
- package/dist/utils.test.js +0 -102
package/dist/utils.test.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const mobx_1 = require("mobx");
|
|
4
|
-
const rules_1 = require("./rules");
|
|
5
|
-
const utils_1 = require("./utils");
|
|
6
|
-
describe("utils", () => {
|
|
7
|
-
describe("pickFields", () => {
|
|
8
|
-
it("can pick a value field", () => {
|
|
9
|
-
const a = (0, utils_1.pickFields)(
|
|
10
|
-
//
|
|
11
|
-
{ firstName: { type: "value" } }, { firstName: "a", b: "ignored" });
|
|
12
|
-
expect(a).toMatchInlineSnapshot(`
|
|
13
|
-
{
|
|
14
|
-
"firstName": "a",
|
|
15
|
-
}
|
|
16
|
-
`);
|
|
17
|
-
});
|
|
18
|
-
it("can pick an unset object fields", () => {
|
|
19
|
-
const a = (0, utils_1.pickFields)(authorWithAddressConfig, { firstName: "a", b: "ignored" });
|
|
20
|
-
expect(a).toMatchInlineSnapshot(`
|
|
21
|
-
{
|
|
22
|
-
"address": undefined,
|
|
23
|
-
"firstName": "a",
|
|
24
|
-
"id": undefined,
|
|
25
|
-
"lastName": undefined,
|
|
26
|
-
}
|
|
27
|
-
`);
|
|
28
|
-
});
|
|
29
|
-
it("can pick a set object field", () => {
|
|
30
|
-
const a = (0, utils_1.pickFields)(authorWithAddressConfig, { firstName: "a", b: "ignored", address: {} });
|
|
31
|
-
expect(a).toMatchInlineSnapshot(`
|
|
32
|
-
{
|
|
33
|
-
"address": {
|
|
34
|
-
"city": undefined,
|
|
35
|
-
"street": undefined,
|
|
36
|
-
},
|
|
37
|
-
"firstName": "a",
|
|
38
|
-
"id": undefined,
|
|
39
|
-
"lastName": undefined,
|
|
40
|
-
}
|
|
41
|
-
`);
|
|
42
|
-
});
|
|
43
|
-
it("can pick an unset list field", () => {
|
|
44
|
-
const a = (0, utils_1.pickFields)(authorWithBooksConfig, { firstName: "a", b: "ignored" });
|
|
45
|
-
expect(a).toMatchInlineSnapshot(`
|
|
46
|
-
{
|
|
47
|
-
"books": undefined,
|
|
48
|
-
"firstName": "a",
|
|
49
|
-
"id": undefined,
|
|
50
|
-
"lastName": undefined,
|
|
51
|
-
}
|
|
52
|
-
`);
|
|
53
|
-
});
|
|
54
|
-
it("can pick a set list field", () => {
|
|
55
|
-
const a = (0, utils_1.pickFields)(authorWithBooksConfig, { firstName: "a", b: "ignored", books: [{}] });
|
|
56
|
-
expect(a).toMatchInlineSnapshot(`
|
|
57
|
-
{
|
|
58
|
-
"books": [
|
|
59
|
-
{
|
|
60
|
-
"classification": undefined,
|
|
61
|
-
"id": undefined,
|
|
62
|
-
"title": undefined,
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
"firstName": "a",
|
|
66
|
-
"id": undefined,
|
|
67
|
-
"lastName": undefined,
|
|
68
|
-
}
|
|
69
|
-
`);
|
|
70
|
-
});
|
|
71
|
-
it("can pick a set observable list field", () => {
|
|
72
|
-
const books = (0, mobx_1.observable)([]);
|
|
73
|
-
const a = (0, utils_1.pickFields)(authorWithBooksConfig, { firstName: "a", b: "ignored", books });
|
|
74
|
-
expect((0, mobx_1.isObservable)(a.books)).toEqual(true);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
const authorWithAddressConfig = {
|
|
79
|
-
id: { type: "value" },
|
|
80
|
-
firstName: { type: "value" },
|
|
81
|
-
lastName: { type: "value" },
|
|
82
|
-
address: {
|
|
83
|
-
type: "object",
|
|
84
|
-
config: {
|
|
85
|
-
street: { type: "value", rules: [rules_1.required] },
|
|
86
|
-
city: { type: "value" },
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
const authorWithBooksConfig = {
|
|
91
|
-
id: { type: "value" },
|
|
92
|
-
firstName: { type: "value" },
|
|
93
|
-
lastName: { type: "value" },
|
|
94
|
-
books: {
|
|
95
|
-
type: "list",
|
|
96
|
-
config: {
|
|
97
|
-
id: { type: "value" },
|
|
98
|
-
title: { type: "value", rules: [rules_1.required] },
|
|
99
|
-
classification: { type: "value" },
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
};
|