@pareto-engineering/design-system 2.0.0-alpha.43 → 2.0.0-alpha.46
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/.env.scripts.example +4 -0
- package/.eslintrc.js +25 -1
- package/babel.config.js +1 -0
- package/dist/cjs/f/FormInput/FormInput.js +13 -3
- package/dist/cjs/f/FormInput/styles.scss +11 -0
- package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +214 -0
- package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +194 -0
- package/dist/cjs/f/fields/QueryCombobox/common/Combobox/index.js +15 -0
- package/dist/cjs/f/fields/QueryCombobox/common/Menu/Menu.js +103 -0
- package/dist/cjs/f/fields/QueryCombobox/common/Menu/index.js +15 -0
- package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +281 -0
- package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/index.js +15 -0
- package/dist/cjs/f/fields/QueryCombobox/common/index.js +21 -0
- package/dist/cjs/f/fields/QueryCombobox/index.js +15 -0
- package/dist/cjs/f/fields/QueryCombobox/styles.scss +84 -0
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +0 -1
- package/dist/cjs/f/fields/SelectInput/styles.scss +8 -6
- package/dist/cjs/f/fields/index.js +9 -1
- package/dist/cjs/index.js +13 -0
- package/dist/cjs/test/QueryLoader/QueryLoader.js +41 -0
- package/dist/cjs/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +71 -0
- package/dist/cjs/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.js +49 -0
- package/dist/cjs/test/QueryLoader/common/PreloadedTestData/index.js +15 -0
- package/dist/cjs/test/QueryLoader/common/index.js +13 -0
- package/dist/cjs/test/QueryLoader/index.js +15 -0
- package/dist/cjs/test/QueryLoader/styles.scss +9 -0
- package/dist/cjs/test/index.js +13 -0
- package/dist/es/f/FormInput/FormInput.js +13 -3
- package/dist/es/f/FormInput/styles.scss +11 -0
- package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +191 -0
- package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +174 -0
- package/dist/es/f/fields/QueryCombobox/common/Combobox/index.js +2 -0
- package/dist/es/f/fields/QueryCombobox/common/Menu/Menu.js +77 -0
- package/dist/es/f/fields/QueryCombobox/common/Menu/index.js +2 -0
- package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +253 -0
- package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/index.js +2 -0
- package/dist/es/f/fields/QueryCombobox/common/index.js +2 -0
- package/dist/es/f/fields/QueryCombobox/index.js +2 -0
- package/dist/es/f/fields/QueryCombobox/styles.scss +84 -0
- package/dist/es/f/fields/SelectInput/SelectInput.js +0 -1
- package/dist/es/f/fields/SelectInput/styles.scss +8 -6
- package/dist/es/f/fields/index.js +2 -1
- package/dist/es/index.js +2 -1
- package/dist/es/test/QueryLoader/QueryLoader.js +29 -0
- package/dist/es/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +71 -0
- package/dist/es/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.js +31 -0
- package/dist/es/test/QueryLoader/common/PreloadedTestData/index.js +2 -0
- package/dist/es/test/QueryLoader/common/index.js +1 -0
- package/dist/es/test/QueryLoader/index.js +2 -0
- package/dist/es/test/QueryLoader/styles.scss +9 -0
- package/dist/es/test/index.js +1 -0
- package/package.json +16 -3
- package/relay.config.js +12 -0
- package/schema.graphql +4075 -0
- package/scripts/fetchSchema.js +74 -0
- package/src/__snapshots__/Storyshots.test.js.snap +323 -8
- package/src/stories/f/FormInput.stories.jsx +115 -0
- package/src/stories/f/QueryCombobox.stories.jsx +220 -0
- package/src/stories/f/__generated__/FormInputAllTeamsQuery.graphql.js +139 -0
- package/src/stories/f/__generated__/QueryComboboxAllTeamsQuery.graphql.js +139 -0
- package/src/stories/test/QueryLoader.stories.jsx +36 -0
- package/src/stories/utils/generateNodeId.js +12 -0
- package/src/stories/utils/relay/EnvironmentProvider.jsx +14 -0
- package/src/stories/utils/relay/environment.js +5 -0
- package/src/stories/utils/relay/index.js +4 -0
- package/src/stories/utils/relay/mockRelayOperation.js +14 -0
- package/src/stories/utils/relay/mockResolvers.js +299 -0
- package/src/stories/utils/testData.js +63 -0
- package/src/ui/f/FormInput/FormInput.jsx +16 -1
- package/src/ui/f/FormInput/styles.scss +11 -0
- package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +207 -0
- package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +214 -0
- package/src/ui/f/fields/QueryCombobox/common/Combobox/index.js +2 -0
- package/src/ui/f/fields/QueryCombobox/common/Menu/Menu.jsx +103 -0
- package/src/ui/f/fields/QueryCombobox/common/Menu/index.js +2 -0
- package/src/ui/f/fields/QueryCombobox/common/index.js +2 -0
- package/src/ui/f/fields/QueryCombobox/index.js +2 -0
- package/src/ui/f/fields/QueryCombobox/styles.scss +84 -0
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +1 -1
- package/src/ui/f/fields/SelectInput/styles.scss +8 -6
- package/src/ui/f/fields/index.js +1 -0
- package/src/ui/index.js +1 -0
- package/src/ui/test/QueryLoader/QueryLoader.jsx +41 -0
- package/src/ui/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +68 -0
- package/src/ui/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.jsx +51 -0
- package/src/ui/test/QueryLoader/common/PreloadedTestData/index.js +2 -0
- package/src/ui/test/QueryLoader/common/index.js +1 -0
- package/src/ui/test/QueryLoader/index.js +2 -0
- package/src/ui/test/index.js +1 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { Formik, Form, useField } from 'formik'
|
|
5
|
+
|
|
6
|
+
import { Button, FormDebugger, QueryCombobox } from 'ui'
|
|
7
|
+
|
|
8
|
+
import { fruits } from '../utils/testData'
|
|
9
|
+
|
|
10
|
+
import generateNodeId from '../utils/generateNodeId'
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
RelayEnvironmentProvider,
|
|
14
|
+
mockRelayOperation,
|
|
15
|
+
// environment,
|
|
16
|
+
} from '../utils/relay'
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
title :'f/fields/QueryCombobox',
|
|
20
|
+
component :QueryCombobox,
|
|
21
|
+
subcomponents:{
|
|
22
|
+
// Item:QueryCombobox.Item
|
|
23
|
+
},
|
|
24
|
+
decorators:[
|
|
25
|
+
(storyfn) => (
|
|
26
|
+
<RelayEnvironmentProvider>
|
|
27
|
+
{ storyfn() }
|
|
28
|
+
</RelayEnvironmentProvider>
|
|
29
|
+
),
|
|
30
|
+
],
|
|
31
|
+
argTypes:{
|
|
32
|
+
backgroundColor:{ control: 'color' },
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const allTeamsMockData = {
|
|
37
|
+
PageInfo() {
|
|
38
|
+
return {
|
|
39
|
+
hasNextPage :true,
|
|
40
|
+
hasPreviousPage:true,
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
TeamNodeConnection:(args) => {
|
|
44
|
+
const edges = fruits.map((fruit) => ({
|
|
45
|
+
node:{
|
|
46
|
+
id :generateNodeId('TeamNode'),
|
|
47
|
+
name:fruit,
|
|
48
|
+
},
|
|
49
|
+
}))
|
|
50
|
+
|
|
51
|
+
// eslint-disable-next-line camelcase
|
|
52
|
+
const { name_Icontains } = args?.args || {}
|
|
53
|
+
|
|
54
|
+
return ({
|
|
55
|
+
pageInfo:{
|
|
56
|
+
hasNextPage :true,
|
|
57
|
+
hasPreviousPage:true,
|
|
58
|
+
},
|
|
59
|
+
// eslint-disable-next-line camelcase
|
|
60
|
+
edges:name_Icontains?.trim()
|
|
61
|
+
? edges.filter(({ node }) => node.name
|
|
62
|
+
.toLowerCase()
|
|
63
|
+
.includes(name_Icontains.toLowerCase()))
|
|
64
|
+
: [],
|
|
65
|
+
})
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const FETCH_TEAMS_QUERY = graphql`
|
|
70
|
+
query QueryComboboxAllTeamsQuery($name_Icontains: String) {
|
|
71
|
+
allTeams(name_Icontains: $name_Icontains) {
|
|
72
|
+
edges {
|
|
73
|
+
node {
|
|
74
|
+
id
|
|
75
|
+
name
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
`
|
|
81
|
+
|
|
82
|
+
// eslint-disable-next-line react/prop-types
|
|
83
|
+
const ResolvedTemplate = ({ multiple, defaultFormikState = {} }) => {
|
|
84
|
+
mockRelayOperation(allTeamsMockData)
|
|
85
|
+
mockRelayOperation(allTeamsMockData)
|
|
86
|
+
mockRelayOperation(allTeamsMockData)
|
|
87
|
+
|
|
88
|
+
const Content = () => {
|
|
89
|
+
const name = multiple ? 'teams' : 'team'
|
|
90
|
+
|
|
91
|
+
const [, , helpers] = useField(name)
|
|
92
|
+
|
|
93
|
+
const { setValue } = helpers
|
|
94
|
+
|
|
95
|
+
const updateFormikState = () => {
|
|
96
|
+
setValue({
|
|
97
|
+
value:'VGVhbU5vZGU6MDAxZTIyOGEtYzA5My00MGI0LWE1MTUtYTNkMTM1NTE1MDNk',
|
|
98
|
+
label:'Kafagoho',
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<>
|
|
104
|
+
<QueryCombobox
|
|
105
|
+
query={FETCH_TEAMS_QUERY}
|
|
106
|
+
label="Search for a team"
|
|
107
|
+
optionsKeyMap={{
|
|
108
|
+
value:'id',
|
|
109
|
+
label:'name',
|
|
110
|
+
}}
|
|
111
|
+
name={name}
|
|
112
|
+
multiple={multiple}
|
|
113
|
+
graphQlNode="allTeams"
|
|
114
|
+
searchVariable="name_Icontains"
|
|
115
|
+
/>
|
|
116
|
+
<div
|
|
117
|
+
style={{
|
|
118
|
+
display :'flex',
|
|
119
|
+
alignItems :'flex-end',
|
|
120
|
+
flexDirection:'column',
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
<FormDebugger />
|
|
124
|
+
<Button
|
|
125
|
+
onClick={updateFormikState}
|
|
126
|
+
>
|
|
127
|
+
{multiple ? 'Add more initial values' : 'Replace initial value'}
|
|
128
|
+
</Button>
|
|
129
|
+
</div>
|
|
130
|
+
</>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<Formik
|
|
136
|
+
initialValues={defaultFormikState}
|
|
137
|
+
>
|
|
138
|
+
<Form>
|
|
139
|
+
<Content />
|
|
140
|
+
</Form>
|
|
141
|
+
</Formik>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export const SingleSelect = ResolvedTemplate.bind({})
|
|
146
|
+
SingleSelect.args = {
|
|
147
|
+
multiple:false,
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export const SingleSelectWithDefaultFormikState = ResolvedTemplate.bind({})
|
|
151
|
+
SingleSelectWithDefaultFormikState.args = {
|
|
152
|
+
multiple :false,
|
|
153
|
+
defaultFormikState:{
|
|
154
|
+
team:{
|
|
155
|
+
value:'VGVhbU5vZGU6MDAxZTIyOGEtYzA5My00MGI0LWE1MTUtYTNkMTM1NTE1MDNl',
|
|
156
|
+
label:'Apple',
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// eslint-disable-next-line react/prop-types
|
|
162
|
+
// const RejectedTemplate = ({ multiple }) => {
|
|
163
|
+
// const Content = () => {
|
|
164
|
+
// environment.mock.queuePendingOperation(
|
|
165
|
+
// FETCH_TEAMS_QUERY,
|
|
166
|
+
// { name_Icontains: 'a' },
|
|
167
|
+
// )
|
|
168
|
+
|
|
169
|
+
// environment.mock.rejectMostRecentOperation('An error has occured while fetching the teams')
|
|
170
|
+
|
|
171
|
+
// const name = multiple ? 'teams' : 'team'
|
|
172
|
+
|
|
173
|
+
// const [, meta, helpers] = useField(name)
|
|
174
|
+
|
|
175
|
+
// const { setValue, setError } = helpers
|
|
176
|
+
|
|
177
|
+
// const { error } = meta
|
|
178
|
+
|
|
179
|
+
// return (
|
|
180
|
+
// <>
|
|
181
|
+
// <QueryCombobox
|
|
182
|
+
// query={FETCH_TEAMS_QUERY}
|
|
183
|
+
// label="Search for a team"
|
|
184
|
+
// optionsKeyMap={{
|
|
185
|
+
// value:'id',
|
|
186
|
+
// label:'name',
|
|
187
|
+
// }}
|
|
188
|
+
// error={error}
|
|
189
|
+
// setValue={setValue}
|
|
190
|
+
// setError={setError}
|
|
191
|
+
// name={name}
|
|
192
|
+
// multiple={multiple}
|
|
193
|
+
// graphQlNode="allTeams"
|
|
194
|
+
// searchVariable="name_Icontains"
|
|
195
|
+
// />
|
|
196
|
+
// <FormDebugger />
|
|
197
|
+
// </>
|
|
198
|
+
// )
|
|
199
|
+
// }
|
|
200
|
+
|
|
201
|
+
// return (
|
|
202
|
+
// <Formik
|
|
203
|
+
// initialValues={{ team: '' }}
|
|
204
|
+
// >
|
|
205
|
+
// <Form>
|
|
206
|
+
// <Content />
|
|
207
|
+
// </Form>
|
|
208
|
+
// </Formik>
|
|
209
|
+
// )
|
|
210
|
+
// }
|
|
211
|
+
|
|
212
|
+
// export const SingleSelectWithError = RejectedTemplate.bind({})
|
|
213
|
+
// SingleSelectWithError.args = {
|
|
214
|
+
// multiple:false,
|
|
215
|
+
// }
|
|
216
|
+
|
|
217
|
+
// export const MultipleSelectWithError = RejectedTemplate.bind({})
|
|
218
|
+
// MultipleSelectWithError.args = {
|
|
219
|
+
// multiple:true,
|
|
220
|
+
// }
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flow
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
/*::
|
|
10
|
+
import type { ConcreteRequest } from 'relay-runtime';
|
|
11
|
+
export type FormInputAllTeamsQueryVariables = {|
|
|
12
|
+
name_Icontains?: ?string
|
|
13
|
+
|};
|
|
14
|
+
export type FormInputAllTeamsQueryResponse = {|
|
|
15
|
+
+allTeams: ?{|
|
|
16
|
+
+edges: $ReadOnlyArray<?{|
|
|
17
|
+
+node: ?{|
|
|
18
|
+
+id: string,
|
|
19
|
+
+name: string,
|
|
20
|
+
|}
|
|
21
|
+
|}>
|
|
22
|
+
|}
|
|
23
|
+
|};
|
|
24
|
+
export type FormInputAllTeamsQuery = {|
|
|
25
|
+
variables: FormInputAllTeamsQueryVariables,
|
|
26
|
+
response: FormInputAllTeamsQueryResponse,
|
|
27
|
+
|};
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
query FormInputAllTeamsQuery(
|
|
33
|
+
$name_Icontains: String
|
|
34
|
+
) {
|
|
35
|
+
allTeams(name_Icontains: $name_Icontains) {
|
|
36
|
+
edges {
|
|
37
|
+
node {
|
|
38
|
+
id
|
|
39
|
+
name
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
const node/*: ConcreteRequest*/ = (function(){
|
|
47
|
+
var v0 = [
|
|
48
|
+
{
|
|
49
|
+
"defaultValue": null,
|
|
50
|
+
"kind": "LocalArgument",
|
|
51
|
+
"name": "name_Icontains"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
v1 = [
|
|
55
|
+
{
|
|
56
|
+
"alias": null,
|
|
57
|
+
"args": [
|
|
58
|
+
{
|
|
59
|
+
"kind": "Variable",
|
|
60
|
+
"name": "name_Icontains",
|
|
61
|
+
"variableName": "name_Icontains"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"concreteType": "TeamNodeConnection",
|
|
65
|
+
"kind": "LinkedField",
|
|
66
|
+
"name": "allTeams",
|
|
67
|
+
"plural": false,
|
|
68
|
+
"selections": [
|
|
69
|
+
{
|
|
70
|
+
"alias": null,
|
|
71
|
+
"args": null,
|
|
72
|
+
"concreteType": "TeamNodeEdge",
|
|
73
|
+
"kind": "LinkedField",
|
|
74
|
+
"name": "edges",
|
|
75
|
+
"plural": true,
|
|
76
|
+
"selections": [
|
|
77
|
+
{
|
|
78
|
+
"alias": null,
|
|
79
|
+
"args": null,
|
|
80
|
+
"concreteType": "TeamNode",
|
|
81
|
+
"kind": "LinkedField",
|
|
82
|
+
"name": "node",
|
|
83
|
+
"plural": false,
|
|
84
|
+
"selections": [
|
|
85
|
+
{
|
|
86
|
+
"alias": null,
|
|
87
|
+
"args": null,
|
|
88
|
+
"kind": "ScalarField",
|
|
89
|
+
"name": "id",
|
|
90
|
+
"storageKey": null
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"alias": null,
|
|
94
|
+
"args": null,
|
|
95
|
+
"kind": "ScalarField",
|
|
96
|
+
"name": "name",
|
|
97
|
+
"storageKey": null
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"storageKey": null
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"storageKey": null
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"storageKey": null
|
|
107
|
+
}
|
|
108
|
+
];
|
|
109
|
+
return {
|
|
110
|
+
"fragment": {
|
|
111
|
+
"argumentDefinitions": (v0/*: any*/),
|
|
112
|
+
"kind": "Fragment",
|
|
113
|
+
"metadata": null,
|
|
114
|
+
"name": "FormInputAllTeamsQuery",
|
|
115
|
+
"selections": (v1/*: any*/),
|
|
116
|
+
"type": "Query",
|
|
117
|
+
"abstractKey": null
|
|
118
|
+
},
|
|
119
|
+
"kind": "Request",
|
|
120
|
+
"operation": {
|
|
121
|
+
"argumentDefinitions": (v0/*: any*/),
|
|
122
|
+
"kind": "Operation",
|
|
123
|
+
"name": "FormInputAllTeamsQuery",
|
|
124
|
+
"selections": (v1/*: any*/)
|
|
125
|
+
},
|
|
126
|
+
"params": {
|
|
127
|
+
"cacheID": "dc9287c6d087d0f0e1be2e8ef405cb1f",
|
|
128
|
+
"id": null,
|
|
129
|
+
"metadata": {},
|
|
130
|
+
"name": "FormInputAllTeamsQuery",
|
|
131
|
+
"operationKind": "query",
|
|
132
|
+
"text": "query FormInputAllTeamsQuery(\n $name_Icontains: String\n) {\n allTeams(name_Icontains: $name_Icontains) {\n edges {\n node {\n id\n name\n }\n }\n }\n}\n"
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
})();
|
|
136
|
+
// prettier-ignore
|
|
137
|
+
(node/*: any*/).hash = 'c76b6f84436895e8a6d0725bdd41cfe0';
|
|
138
|
+
|
|
139
|
+
module.exports = node;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flow
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
/*::
|
|
10
|
+
import type { ConcreteRequest } from 'relay-runtime';
|
|
11
|
+
export type QueryComboboxAllTeamsQueryVariables = {|
|
|
12
|
+
name_Icontains?: ?string
|
|
13
|
+
|};
|
|
14
|
+
export type QueryComboboxAllTeamsQueryResponse = {|
|
|
15
|
+
+allTeams: ?{|
|
|
16
|
+
+edges: $ReadOnlyArray<?{|
|
|
17
|
+
+node: ?{|
|
|
18
|
+
+id: string,
|
|
19
|
+
+name: string,
|
|
20
|
+
|}
|
|
21
|
+
|}>
|
|
22
|
+
|}
|
|
23
|
+
|};
|
|
24
|
+
export type QueryComboboxAllTeamsQuery = {|
|
|
25
|
+
variables: QueryComboboxAllTeamsQueryVariables,
|
|
26
|
+
response: QueryComboboxAllTeamsQueryResponse,
|
|
27
|
+
|};
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
query QueryComboboxAllTeamsQuery(
|
|
33
|
+
$name_Icontains: String
|
|
34
|
+
) {
|
|
35
|
+
allTeams(name_Icontains: $name_Icontains) {
|
|
36
|
+
edges {
|
|
37
|
+
node {
|
|
38
|
+
id
|
|
39
|
+
name
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
const node/*: ConcreteRequest*/ = (function(){
|
|
47
|
+
var v0 = [
|
|
48
|
+
{
|
|
49
|
+
"defaultValue": null,
|
|
50
|
+
"kind": "LocalArgument",
|
|
51
|
+
"name": "name_Icontains"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
v1 = [
|
|
55
|
+
{
|
|
56
|
+
"alias": null,
|
|
57
|
+
"args": [
|
|
58
|
+
{
|
|
59
|
+
"kind": "Variable",
|
|
60
|
+
"name": "name_Icontains",
|
|
61
|
+
"variableName": "name_Icontains"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"concreteType": "TeamNodeConnection",
|
|
65
|
+
"kind": "LinkedField",
|
|
66
|
+
"name": "allTeams",
|
|
67
|
+
"plural": false,
|
|
68
|
+
"selections": [
|
|
69
|
+
{
|
|
70
|
+
"alias": null,
|
|
71
|
+
"args": null,
|
|
72
|
+
"concreteType": "TeamNodeEdge",
|
|
73
|
+
"kind": "LinkedField",
|
|
74
|
+
"name": "edges",
|
|
75
|
+
"plural": true,
|
|
76
|
+
"selections": [
|
|
77
|
+
{
|
|
78
|
+
"alias": null,
|
|
79
|
+
"args": null,
|
|
80
|
+
"concreteType": "TeamNode",
|
|
81
|
+
"kind": "LinkedField",
|
|
82
|
+
"name": "node",
|
|
83
|
+
"plural": false,
|
|
84
|
+
"selections": [
|
|
85
|
+
{
|
|
86
|
+
"alias": null,
|
|
87
|
+
"args": null,
|
|
88
|
+
"kind": "ScalarField",
|
|
89
|
+
"name": "id",
|
|
90
|
+
"storageKey": null
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"alias": null,
|
|
94
|
+
"args": null,
|
|
95
|
+
"kind": "ScalarField",
|
|
96
|
+
"name": "name",
|
|
97
|
+
"storageKey": null
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"storageKey": null
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"storageKey": null
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"storageKey": null
|
|
107
|
+
}
|
|
108
|
+
];
|
|
109
|
+
return {
|
|
110
|
+
"fragment": {
|
|
111
|
+
"argumentDefinitions": (v0/*: any*/),
|
|
112
|
+
"kind": "Fragment",
|
|
113
|
+
"metadata": null,
|
|
114
|
+
"name": "QueryComboboxAllTeamsQuery",
|
|
115
|
+
"selections": (v1/*: any*/),
|
|
116
|
+
"type": "Query",
|
|
117
|
+
"abstractKey": null
|
|
118
|
+
},
|
|
119
|
+
"kind": "Request",
|
|
120
|
+
"operation": {
|
|
121
|
+
"argumentDefinitions": (v0/*: any*/),
|
|
122
|
+
"kind": "Operation",
|
|
123
|
+
"name": "QueryComboboxAllTeamsQuery",
|
|
124
|
+
"selections": (v1/*: any*/)
|
|
125
|
+
},
|
|
126
|
+
"params": {
|
|
127
|
+
"cacheID": "a507170c1616920d93ea7ceb061097d1",
|
|
128
|
+
"id": null,
|
|
129
|
+
"metadata": {},
|
|
130
|
+
"name": "QueryComboboxAllTeamsQuery",
|
|
131
|
+
"operationKind": "query",
|
|
132
|
+
"text": "query QueryComboboxAllTeamsQuery(\n $name_Icontains: String\n) {\n allTeams(name_Icontains: $name_Icontains) {\n edges {\n node {\n id\n name\n }\n }\n }\n}\n"
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
})();
|
|
136
|
+
// prettier-ignore
|
|
137
|
+
(node/*: any*/).hash = '243f007a2e8d0c359ad2976f1c68a472';
|
|
138
|
+
|
|
139
|
+
module.exports = node;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { QueryLoader } from 'ui'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
RelayEnvironmentProvider,
|
|
8
|
+
mockRelayOperation,
|
|
9
|
+
} from '../utils/relay'
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title :'test/QueryLoader',
|
|
13
|
+
component :QueryLoader,
|
|
14
|
+
subcomponents:{
|
|
15
|
+
// Item:QueryLoader.Item
|
|
16
|
+
},
|
|
17
|
+
decorators:[
|
|
18
|
+
// storyfn => <div className="">{ storyfn() }</div>,
|
|
19
|
+
(storyfn) => (
|
|
20
|
+
<RelayEnvironmentProvider>
|
|
21
|
+
{ storyfn() }
|
|
22
|
+
</RelayEnvironmentProvider>
|
|
23
|
+
),
|
|
24
|
+
],
|
|
25
|
+
argTypes:{
|
|
26
|
+
backgroundColor:{ control: 'color' },
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const Base = () => {
|
|
31
|
+
mockRelayOperation()
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<QueryLoader />
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* eslint-disable no-bitwise */
|
|
2
|
+
/* eslint-disable no-mixed-operators */
|
|
3
|
+
const uuidv4 = () => ([1e7] + -1e3 + -4e3 + -8e3 + -1e11)
|
|
4
|
+
.replace(
|
|
5
|
+
/[018]/g,
|
|
6
|
+
(c) => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4)
|
|
7
|
+
.toString(16),
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
const generateNodeId = (objectNode) => btoa(`${objectNode}:${uuidv4()}`)
|
|
11
|
+
|
|
12
|
+
export default generateNodeId
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { RelayEnvironmentProvider } from 'react-relay/hooks'
|
|
3
|
+
|
|
4
|
+
import environment from './environment'
|
|
5
|
+
|
|
6
|
+
const RelayEnvProvider = (props) => (
|
|
7
|
+
<RelayEnvironmentProvider
|
|
8
|
+
environment={environment}
|
|
9
|
+
// history={history}
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
export default RelayEnvProvider
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MockPayloadGenerator } from 'relay-test-utils'
|
|
2
|
+
import relayEnvironment from './environment'
|
|
3
|
+
import mockResolvers from './mockResolvers'
|
|
4
|
+
|
|
5
|
+
function mockRelayOperation(overrideMockResolvers = null) {
|
|
6
|
+
relayEnvironment.mock.queueOperationResolver(
|
|
7
|
+
(operation) => MockPayloadGenerator.generate(
|
|
8
|
+
operation,
|
|
9
|
+
overrideMockResolvers || mockResolvers,
|
|
10
|
+
),
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default mockRelayOperation
|