@webiny/app-aco 5.34.8 → 5.35.0-beta.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.
Files changed (107) hide show
  1. package/README.md +107 -47
  2. package/components/Dialogs/DialogCreate.d.ts +1 -1
  3. package/components/Dialogs/DialogCreate.js +82 -83
  4. package/components/Dialogs/DialogCreate.js.map +1 -1
  5. package/components/Dialogs/DialogDelete.js +46 -77
  6. package/components/Dialogs/DialogDelete.js.map +1 -1
  7. package/components/Dialogs/DialogMove.d.ts +11 -0
  8. package/components/Dialogs/DialogMove.js +115 -0
  9. package/components/Dialogs/DialogMove.js.map +1 -0
  10. package/components/Dialogs/DialogUpdate.js +60 -111
  11. package/components/Dialogs/DialogUpdate.js.map +1 -1
  12. package/components/Dialogs/index.js +0 -6
  13. package/components/Dialogs/index.js.map +1 -1
  14. package/components/Dialogs/styled.d.ts +15 -5
  15. package/components/Dialogs/styled.js +8 -7
  16. package/components/Dialogs/styled.js.map +1 -1
  17. package/components/Tree/ButtonCreate/index.js +0 -10
  18. package/components/Tree/ButtonCreate/index.js.map +1 -1
  19. package/components/Tree/ButtonCreate/styled.d.ts +12 -12
  20. package/components/Tree/ButtonCreate/styled.js +1 -5
  21. package/components/Tree/ButtonCreate/styled.js.map +1 -1
  22. package/components/Tree/Empty/index.js +0 -10
  23. package/components/Tree/Empty/index.js.map +1 -1
  24. package/components/Tree/Empty/styled.d.ts +5 -2
  25. package/components/Tree/Empty/styled.js +0 -3
  26. package/components/Tree/Empty/styled.js.map +1 -1
  27. package/components/Tree/List/constants.js.map +1 -1
  28. package/components/Tree/List/index.d.ts +3 -1
  29. package/components/Tree/List/index.js +60 -99
  30. package/components/Tree/List/index.js.map +1 -1
  31. package/components/Tree/List/utils.d.ts +2 -1
  32. package/components/Tree/List/utils.js +15 -20
  33. package/components/Tree/List/utils.js.map +1 -1
  34. package/components/Tree/Loader/index.js +2 -7
  35. package/components/Tree/Loader/index.js.map +1 -1
  36. package/components/Tree/Loader/styled.d.ts +9 -3
  37. package/components/Tree/Loader/styled.js +0 -3
  38. package/components/Tree/Loader/styled.js.map +1 -1
  39. package/components/Tree/MenuActions/index.js +12 -18
  40. package/components/Tree/MenuActions/index.js.map +1 -1
  41. package/components/Tree/MenuActions/styled.d.ts +8 -2
  42. package/components/Tree/MenuActions/styled.js +8 -5
  43. package/components/Tree/MenuActions/styled.js.map +1 -1
  44. package/components/Tree/Node/index.d.ts +4 -2
  45. package/components/Tree/Node/index.js +18 -29
  46. package/components/Tree/Node/index.js.map +1 -1
  47. package/components/Tree/Node/styled.d.ts +29 -24
  48. package/components/Tree/Node/styled.js +4 -8
  49. package/components/Tree/Node/styled.js.map +1 -1
  50. package/components/Tree/NodePreview/index.js +0 -6
  51. package/components/Tree/NodePreview/index.js.map +1 -1
  52. package/components/Tree/NodePreview/styled.d.ts +5 -2
  53. package/components/Tree/NodePreview/styled.js +0 -3
  54. package/components/Tree/NodePreview/styled.js.map +1 -1
  55. package/components/Tree/Placeholder/index.js +0 -5
  56. package/components/Tree/Placeholder/index.js.map +1 -1
  57. package/components/Tree/Placeholder/styled.d.ts +5 -2
  58. package/components/Tree/Placeholder/styled.js +0 -3
  59. package/components/Tree/Placeholder/styled.js.map +1 -1
  60. package/components/Tree/Title/index.js +2 -9
  61. package/components/Tree/Title/index.js.map +1 -1
  62. package/components/Tree/Title/styled.d.ts +9 -3
  63. package/components/Tree/Title/styled.js +1 -4
  64. package/components/Tree/Title/styled.js.map +1 -1
  65. package/components/Tree/index.d.ts +3 -0
  66. package/components/Tree/index.js +21 -36
  67. package/components/Tree/index.js.map +1 -1
  68. package/components/Tree/styled.d.ts +5 -2
  69. package/components/Tree/styled.js +1 -4
  70. package/components/Tree/styled.js.map +1 -1
  71. package/components/index.js +0 -4
  72. package/components/index.js.map +1 -1
  73. package/contexts/folders.js +193 -267
  74. package/contexts/folders.js.map +1 -1
  75. package/contexts/index.js +2 -8
  76. package/contexts/index.js.map +1 -1
  77. package/contexts/records.d.ts +24 -0
  78. package/contexts/records.js +363 -0
  79. package/contexts/records.js.map +1 -0
  80. package/graphql/folders.gql.js +7 -16
  81. package/graphql/folders.gql.js.map +1 -1
  82. package/graphql/records.gql.d.ts +5 -0
  83. package/graphql/records.gql.js +23 -0
  84. package/graphql/records.gql.js.map +1 -0
  85. package/handlers.js +13 -27
  86. package/handlers.js.map +1 -1
  87. package/hooks/index.d.ts +2 -1
  88. package/hooks/index.js +15 -8
  89. package/hooks/index.js.map +1 -1
  90. package/hooks/useAcoList.d.ts +18 -0
  91. package/hooks/useAcoList.js +137 -0
  92. package/hooks/useAcoList.js.map +1 -0
  93. package/hooks/useFolders.js +6 -12
  94. package/hooks/useFolders.js.map +1 -1
  95. package/hooks/useRecords.d.ts +24 -0
  96. package/hooks/useRecords.js +69 -0
  97. package/hooks/useRecords.js.map +1 -0
  98. package/index.d.ts +1 -1
  99. package/index.js +8 -5
  100. package/index.js.map +1 -1
  101. package/package.json +14 -12
  102. package/sorting.d.ts +3 -0
  103. package/sorting.js +32 -0
  104. package/sorting.js.map +1 -0
  105. package/types.d.ts +63 -38
  106. package/types.js +14 -1
  107. package/types.js.map +1 -1
package/README.md CHANGED
@@ -12,14 +12,15 @@ A set of frontend aco-related utilities.
12
12
  - [Overview](#overview)
13
13
  - [Reference](#reference)
14
14
  - [Components](#components)
15
- - [`FoldersProvider`](#FoldersProvider)
15
+ - [`ACOProvider`](#ACOProvider)
16
16
  - [`FolderTree`](#FolderTree)
17
+ - [`EntryDialogMove`](#EntryDialogMove)
17
18
  - [`FolderDialogCreate`](#FolderDialogCreate)
18
- - [`FolderDialogUpdate`](#FolderDialogUpdate)
19
19
  - [`FolderDialogDelete`](#FolderDialogDelete)
20
+ - [`FolderDialogUpdate`](#FolderDialogUpdate)
20
21
  - [Hooks](#hooks)
21
22
  - [`useFolder`](#useFolders)
22
- - [`useLinks`](#useLinks)
23
+ - [`useRecords`](#useRecords)
23
24
 
24
25
  ## Installation
25
26
  ```
@@ -32,40 +33,40 @@ yarn add @webiny/app-aco
32
33
  ```
33
34
 
34
35
  ## Overview
35
- The `@webiny/app-aco` package contains essential aco-related utilities (Advanced Content Organisation), that can be used within a React app. These include the `FoldersProvider` provider component, the `useFolders` and `useLinks` hooks, which can be used to retrieve the current folder and link information and interact with them.
36
+ The `@webiny/app-aco` package contains essential aco-related utilities (Advanced Content Organisation), that can be used within a React app. These include the `FoldersProvider` provider component, the `useFolders` and `useRecords` hooks, which can be used to retrieve the current folder and search record information and interact with them.
36
37
 
37
38
  > ℹ️ **INFO**
38
39
  >
39
- > Internally, the [`FoldersProvider`](#FoldersProvider) provider retrieves information from the Webiny's default GraphQL API. Because of this, note that this project relies on [`@webiny/api-aco`](./../api-aco) when it comes to retrieving folders and links information (via GraphQL).
40
+ > Internally, the [`FoldersProvider`](#FoldersProvider) provider retrieves information from the Webiny's default GraphQL API. Because of this, note that this project relies on [`@webiny/api-aco`](./../api-aco) when it comes to retrieving folders and records information (via GraphQL).
40
41
 
41
42
  ## Reference
42
43
 
43
44
  ### Components
44
45
 
45
- #### `FoldersProvider`
46
+ #### `ACOProvider`
46
47
 
47
48
  <details>
48
49
  <summary>Type Declaration</summary>
49
50
  <p>
50
51
 
51
52
  ```tsx
52
- export declare const FoldersProvider: React.FC;
53
+ export declare const ACOProvider: React.FC;
53
54
  ```
54
55
 
55
56
  </p>
56
57
  </details>
57
58
 
58
- The [`FoldersProvider`](#FoldersProvider) is a provider component, which retrieves the folders and links information. The component also makes it possible to use the [`useFolders`](#useFolders) and [`useLinks`](#useLinks) hook, which can be used to list, create, update or delete folders and links within the React app.
59
+ The [`ACOProvider`](#ACOProvider) is a provider component, which retrieves the folders and records information. The component also makes it possible to use the [`useFolders`](#useFolders) and [`useRecords`](#useRecords) hook, which can be used to list, create, update or delete folders and records within the React app.
59
60
 
60
61
  ```tsx
61
62
  import React from "react";
62
- import { FoldersProvider } from "@webiny/app-aco";
63
+ import { ACOProvider } from "@webiny/app-aco";
63
64
 
64
65
  export const App = () => {
65
66
  return (
66
- <FoldersProvider>
67
+ <ACOProvider>
67
68
  <MyApp />
68
- </FoldersProvider>
69
+ </ACOProvider>
69
70
  );
70
71
  };
71
72
  ```
@@ -82,9 +83,12 @@ import { DndItemData } from "~/types";
82
83
  interface Props {
83
84
  type: string;
84
85
  title: string;
86
+ enableCreate?: boolean;
87
+ enableActions?: boolean;
88
+ focusedFolderId?: string;
89
+ hiddenFolderId?: string;
85
90
  onFolderClick: (data: NodeModel<DndItemData>["data"]) => void;
86
91
  onTitleClick?: (event: React.MouseEvent<HTMLElement>) => void;
87
- focusedFolderId?: string;
88
92
  }
89
93
 
90
94
  declare function FolderTree(props: Props): React.FC;
@@ -103,9 +107,12 @@ export const MyComponent = () => {
103
107
  <FolderTree
104
108
  type={"page"}
105
109
  title={"All pages"}
110
+ enableCreate={true}
111
+ enableActions={true}
112
+ focusedFolderId={"anyExistingId"}
113
+ hiddenFolderId={"folderIdToHide"}
106
114
  onFolderClick={item => console.log(item)}
107
115
  onTitleClick={() => console.log("Do whatever you like on title click")}
108
- focusedFolderId={"anyExistingId"}
109
116
  />
110
117
  );
111
118
  };
@@ -114,6 +121,54 @@ export const MyComponent = () => {
114
121
  >
115
122
  > Internally, the `FolderTree` uses [react-dnd-treeview](https://www.npmjs.com/package/@minoru/react-dnd-treeview) to render and manage the folder list: DO NOT rely on any of this package features, we might change it in the future.
116
123
 
124
+ #### `EntryDialogMove`
125
+ <details>
126
+ <summary>Type Declaration</summary>
127
+ <p>
128
+
129
+ ```tsx
130
+ import { DialogOnClose } from "@webiny/ui/Dialog";
131
+ import { SearchRecordItem } from "@webiny/app-aco";
132
+
133
+ interface Props {
134
+ type: string;
135
+ searchRecord: SearchRecordItem;
136
+ open: boolean;
137
+ onClose: DialogOnClose;
138
+ }
139
+
140
+ declare function EntryDialogMove(props: Props): React.FC;
141
+ ```
142
+ </p>
143
+ </details>
144
+
145
+ `EntryDialogMove` component shows a dialog to allow users to move a search record into a folder.
146
+
147
+ ```tsx
148
+ import React, { useState } from "react";
149
+ import { EntryDialogMove } from "@webiny/app-aco";
150
+
151
+ type Props = {
152
+ searchRecord: SearchRecordItem;
153
+ }
154
+
155
+ export const MyComponent = ({ searchRecord }: Props) => {
156
+ const [dialogOpen, setDialogOpen] = useState(false);
157
+
158
+ return (
159
+ <>
160
+ <button onClick={() => setDialogOpen(true)}>Edit folder</button>
161
+ <EntryDialogMove
162
+ type={"anyType"}
163
+ searchRecord={searchRecord}
164
+ open={dialogOpen}
165
+ onClose={() => setDialogOpen(false)}
166
+ />
167
+ </>
168
+ );
169
+ };
170
+ ```
171
+
117
172
  #### `FolderDialogCreate`
118
173
  <details>
119
174
  <summary>Type Declaration</summary>
@@ -126,7 +181,7 @@ interface Props {
126
181
  type: string;
127
182
  open: boolean;
128
183
  onClose: DialogOnClose;
129
- parentId?: string | null;
184
+ currentParentId?: string | null;
130
185
  }
131
186
 
132
187
  declare function FolderDialogCreate(props: Props): React.FC;
@@ -150,14 +205,13 @@ export const MyComponent = () => {
150
205
  type={"page"}
151
206
  open={dialogOpen}
152
207
  onClose={() => setDialogOpen(false)}
153
- parentId={"anyParentId"}
208
+ currentParentId={"anyParentId"}
154
209
  />
155
210
  </>
156
211
  );
157
212
  };
158
213
  ```
159
-
160
- #### `FolderDialogUpdate`
214
+ #### `FolderDialogDelete`
161
215
  <details>
162
216
  <summary>Type Declaration</summary>
163
217
  <p>
@@ -171,16 +225,16 @@ interface Props {
171
225
  onClose: DialogOnClose;
172
226
  }
173
227
 
174
- declare function FolderDialogUpdate(props: Props): React.FC;
228
+ declare function FolderDialogDelete(props: Props): React.FC;
175
229
  ```
176
230
  </p>
177
231
  </details>
178
232
 
179
- `FolderDialogUpdate` component shows a dialog to allow users to update an existing folder.
233
+ `FolderDialogDelete` component shows a dialog to allow users to delete an existing folder.
180
234
 
181
235
  ```tsx
182
236
  import React, { useState } from "react";
183
- import { FolderDialogUpdate } from "@webiny/app-aco";
237
+ import { FolderDialogDelete } from "@webiny/app-aco";
184
238
 
185
239
  type Props = {
186
240
  folder: FolderItem;
@@ -191,8 +245,8 @@ export const MyComponent = ({ folder }: Props) => {
191
245
 
192
246
  return (
193
247
  <>
194
- <button onClick={() => setDialogOpen(true)}>Edit folder</button>
195
- <FolderDialogUpdate
248
+ <button onClick={() => setDialogOpen(true)}>Delete folder</button>
249
+ <FolderDialogDelete
196
250
  folder={folder}
197
251
  open={dialogOpen}
198
252
  onClose={() => setDialogOpen(false)}
@@ -202,7 +256,7 @@ export const MyComponent = ({ folder }: Props) => {
202
256
  };
203
257
  ```
204
258
 
205
- #### `FolderDialogDelete`
259
+ #### `FolderDialogUpdate`
206
260
  <details>
207
261
  <summary>Type Declaration</summary>
208
262
  <p>
@@ -216,16 +270,16 @@ interface Props {
216
270
  onClose: DialogOnClose;
217
271
  }
218
272
 
219
- declare function FolderDialogDelete(props: Props): React.FC;
273
+ declare function FolderDialogUpdate(props: Props): React.FC;
220
274
  ```
221
275
  </p>
222
276
  </details>
223
277
 
224
- `FolderDialogDelete` component shows a dialog to allow users to delete an existing folder.
278
+ `FolderDialogUpdate` component shows a dialog to allow users to update an existing folder.
225
279
 
226
280
  ```tsx
227
281
  import React, { useState } from "react";
228
- import { FolderDialogDelete } from "@webiny/app-aco";
282
+ import { FolderDialogUpdate } from "@webiny/app-aco";
229
283
 
230
284
  type Props = {
231
285
  folder: FolderItem;
@@ -236,8 +290,8 @@ export const MyComponent = ({ folder }: Props) => {
236
290
 
237
291
  return (
238
292
  <>
239
- <button onClick={() => setDialogOpen(true)}>Delete folder</button>
240
- <FolderDialogDelete
293
+ <button onClick={() => setDialogOpen(true)}>Edit folder</button>
294
+ <FolderDialogUpdate
241
295
  folder={folder}
242
296
  open={dialogOpen}
243
297
  onClose={() => setDialogOpen(false)}
@@ -294,49 +348,57 @@ As you might notice, there is not `listFolders` method available from `useFolder
294
348
 
295
349
  You don't need to store the result of it to any local state; that is managed by the context provider.
296
350
 
297
- #### `useLinks`
351
+ #### `useRecords`
298
352
  <details>
299
353
  <summary>Type Declaration</summary>
300
354
  <p>
301
355
 
302
356
  ```tsx
303
- import { LinkItem, LinksActions } from "./types";
304
-
305
- interface UseLinksHook {
306
- links: LinkItem[];
307
- loading: Record<LinksActions, boolean>;
308
- getLink: (id: string, folderId: string) => Promise<LinkItem>;
309
- createLink: (link: Omit<LinkItem, "linkId">) => Promise<LinkItem>;
310
- updateLink: (link: LinkItem, contextFolderId: string) => Promise<LinkItem>;
311
- deleteLink(link: LinkItem): Promise<true>;
357
+ import { SearchRecordItem, Loading, LoadingActions, ListMeta } from "./types";
358
+
359
+ interface UseRecordsHook {
360
+ records: SearchRecordItem[];
361
+ loading: Loading<LoadingActions>;
362
+ meta: Meta<ListMeta>;
363
+ listRecords: (params: {
364
+ type?: string;
365
+ folderId?: string;
366
+ limit?: number;
367
+ after?: string;
368
+ sort?: ListSort;
369
+ }) => Promise<SearchRecordItem[]>;
370
+ getRecord: (id: string) => Promise<SearchRecordItem>;
371
+ createRecord: (record: Omit<SearchRecordItem, "id">) => Promise<SearchRecordItem>;
372
+ updateRecord: (record: SearchRecordItem, contextFolderId?: string) => Promise<SearchRecordItem>;
373
+ deleteRecord(record: SearchRecordItem): Promise<true>;
312
374
  }
313
375
 
314
- export declare function useLinks(folderId: string): UseLinksHook;
376
+ export declare function useRecords(type: string, folderId: string): UseRecordsHook;
315
377
  ```
316
378
  </p>
317
379
  </details>
318
380
 
319
381
 
320
- `useLinks()` hook allows you to interact with folders links state and related APIs while building your custom component.
382
+ `useRecords()` hook allows you to interact with search records state and related APIs while building your custom component.
321
383
 
322
384
  ```tsx
323
385
  import React, { useEffect, useState } from "react";
324
- import { useLinks } from "@webiny/app-aco";
386
+ import { useRecords } from "@webiny/app-aco";
325
387
 
326
388
  import { getEntryDetails } from "./any-custom-hook"
327
389
 
328
390
  export const MyComponent = () => {
329
- const { links } = useLinks("anyFolderId");
391
+ const { records } = useRecords("anyType", "anyFolderId");
330
392
  const [entries, setEntries] = useState([]);
331
393
 
332
394
  useEffect(() => {
333
- const details = getEntryDetails(links);
395
+ const details = getEntryDetails(records);
334
396
  setEntries(details)
335
- }, [links])
397
+ }, [records])
336
398
 
337
399
  if (entries) {
338
400
  return entries.map(entry => {
339
- return <span key={entry.id}>{entry.name}</span>;
401
+ return <span key={entry.id}>{entry.title}</span>;
340
402
  });
341
403
  }
342
404
 
@@ -344,6 +406,4 @@ export const MyComponent = () => {
344
406
  };
345
407
  ```
346
408
 
347
- As you might notice, there is not `listLinks` method available from `useLinks()` hook: this is because on first mount, `listLinks` is called internally, which will either issue a network request, or load links from cache.
348
-
349
409
  You don't need to store the result of it to any local state; that is managed by the context provider.
@@ -4,7 +4,7 @@ declare type Props = {
4
4
  type: string;
5
5
  open: boolean;
6
6
  onClose: DialogOnClose;
7
- parentId?: string | null;
7
+ currentParentId?: string | null;
8
8
  };
9
9
  export declare const FolderDialogCreate: React.FC<Props>;
10
10
  export {};
@@ -1,111 +1,102 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.FolderDialogCreate = void 0;
11
-
12
9
  var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
13
-
14
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
-
16
11
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
17
-
18
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
19
-
20
13
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
21
-
22
14
  var _react = _interopRequireWildcard(require("react"));
23
-
24
- var _AutoComplete = require("@webiny/ui/AutoComplete");
25
-
15
+ var _i18n = require("@webiny/app/i18n");
16
+ var _appAdmin = require("@webiny/app-admin");
17
+ var _form = require("@webiny/form");
26
18
  var _Button = require("@webiny/ui/Button");
27
-
28
19
  var _Dialog = require("@webiny/ui/Dialog");
29
-
30
20
  var _Grid = require("@webiny/ui/Grid");
31
-
32
21
  var _Input = require("@webiny/ui/Input");
33
-
34
22
  var _Progress = require("@webiny/ui/Progress");
35
-
36
- var _form = require("@webiny/form");
37
-
23
+ var _Typography = require("@webiny/ui/Typography");
38
24
  var _validation = require("@webiny/validation");
39
-
40
- var _i18n = require("@webiny/app/i18n");
41
-
42
- var _appAdmin = require("@webiny/app-admin");
43
-
25
+ var _slugify = _interopRequireDefault(require("slugify"));
26
+ var _ = require("./..");
44
27
  var _useFolders2 = require("../../hooks/useFolders");
45
-
46
28
  var _styled = require("./styled");
47
-
48
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
49
-
29
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
50
30
  var t = _i18n.i18n.ns("app-aco/components/tree/dialog-create");
51
-
52
31
  var FolderDialogCreate = function FolderDialogCreate(_ref) {
53
32
  var type = _ref.type,
54
- onClose = _ref.onClose,
55
- open = _ref.open,
56
- parentId = _ref.parentId;
57
-
33
+ onClose = _ref.onClose,
34
+ open = _ref.open,
35
+ currentParentId = _ref.currentParentId;
58
36
  var _useFolders = (0, _useFolders2.useFolders)(type),
59
- folders = _useFolders.folders,
60
- loading = _useFolders.loading,
61
- createFolder = _useFolders.createFolder;
62
-
37
+ loading = _useFolders.loading,
38
+ createFolder = _useFolders.createFolder;
63
39
  var _useState = (0, _react.useState)(false),
64
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
65
- dialogOpen = _useState2[0],
66
- setDialogOpen = _useState2[1];
67
-
40
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
41
+ dialogOpen = _useState2[0],
42
+ setDialogOpen = _useState2[1];
43
+ var _useState3 = (0, _react.useState)(),
44
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
45
+ parentId = _useState4[0],
46
+ setParentId = _useState4[1];
68
47
  var _useSnackbar = (0, _appAdmin.useSnackbar)(),
69
- showSnackbar = _useSnackbar.showSnackbar;
70
-
48
+ showSnackbar = _useSnackbar.showSnackbar;
71
49
  var onSubmit = /*#__PURE__*/function () {
72
50
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(data) {
73
51
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
74
- while (1) {
75
- switch (_context.prev = _context.next) {
76
- case 0:
77
- _context.prev = 0;
78
- _context.next = 3;
79
- return createFolder((0, _objectSpread2.default)((0, _objectSpread2.default)({}, data), {}, {
80
- type: type
81
- }, typeof parentId !== "undefined" && {
82
- parentId: parentId
83
- }));
84
-
85
- case 3:
86
- setDialogOpen(false);
87
- showSnackbar(t(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["Folder created successfully!"]))));
88
- _context.next = 10;
89
- break;
90
-
91
- case 7:
92
- _context.prev = 7;
93
- _context.t0 = _context["catch"](0);
94
- showSnackbar(_context.t0.message);
95
-
96
- case 10:
97
- case "end":
98
- return _context.stop();
99
- }
52
+ while (1) switch (_context.prev = _context.next) {
53
+ case 0:
54
+ _context.prev = 0;
55
+ _context.next = 3;
56
+ return createFolder((0, _objectSpread2.default)((0, _objectSpread2.default)({}, data), {}, {
57
+ type: type,
58
+ parentId: parentId || null
59
+ }));
60
+ case 3:
61
+ setDialogOpen(false);
62
+ showSnackbar(t(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["Folder created successfully!"]))));
63
+ _context.next = 10;
64
+ break;
65
+ case 7:
66
+ _context.prev = 7;
67
+ _context.t0 = _context["catch"](0);
68
+ showSnackbar(_context.t0.message);
69
+ case 10:
70
+ case "end":
71
+ return _context.stop();
100
72
  }
101
73
  }, _callee, null, [[0, 7]]);
102
74
  }));
103
-
104
75
  return function onSubmit(_x) {
105
76
  return _ref2.apply(this, arguments);
106
77
  };
107
78
  }();
79
+ var generateSlug = function generateSlug(form) {
80
+ return function () {
81
+ if (form.data.slug) {
82
+ return;
83
+ }
84
+ if (!form.data.title) {
85
+ return;
86
+ }
108
87
 
88
+ // We want to update slug only when the folder is first being created.
89
+ form.setValue("slug", (0, _slugify.default)(form.data.title, {
90
+ replacement: "-",
91
+ lower: true,
92
+ remove: /[*#\?<>_\{\}\[\]+~.()'"!:;@]/g,
93
+ trim: false
94
+ }));
95
+ };
96
+ };
97
+ (0, _react.useEffect)(function () {
98
+ setParentId(currentParentId);
99
+ }, [currentParentId]);
109
100
  (0, _react.useEffect)(function () {
110
101
  setDialogOpen(open);
111
102
  }, [open]);
@@ -115,17 +106,19 @@ var FolderDialogCreate = function FolderDialogCreate(_ref) {
115
106
  }, dialogOpen && /*#__PURE__*/_react.default.createElement(_form.Form, {
116
107
  onSubmit: onSubmit
117
108
  }, function (_ref3) {
118
- var Bind = _ref3.Bind,
119
- submit = _ref3.submit;
109
+ var form = _ref3.form,
110
+ Bind = _ref3.Bind,
111
+ submit = _ref3.submit;
120
112
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, loading.CREATE && /*#__PURE__*/_react.default.createElement(_Progress.CircularProgress, {
121
113
  label: t(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["Creating folder..."])))
122
114
  }), /*#__PURE__*/_react.default.createElement(_Dialog.DialogTitle, null, t(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["Create a new folder"])))), /*#__PURE__*/_react.default.createElement(_Dialog.DialogContent, null, /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
123
115
  span: 12
124
116
  }, /*#__PURE__*/_react.default.createElement(Bind, {
125
- name: "name",
117
+ name: "title",
126
118
  validators: [_validation.validation.create("required,minLength:3")]
127
119
  }, /*#__PURE__*/_react.default.createElement(_Input.Input, {
128
- label: t(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["Name"])))
120
+ label: t(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["Title"]))),
121
+ onBlur: generateSlug(form)
129
122
  }))), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
130
123
  span: 12
131
124
  }, /*#__PURE__*/_react.default.createElement(Bind, {
@@ -133,21 +126,27 @@ var FolderDialogCreate = function FolderDialogCreate(_ref) {
133
126
  validators: [_validation.validation.create("required,minLength:3,slug")]
134
127
  }, /*#__PURE__*/_react.default.createElement(_Input.Input, {
135
128
  label: t(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["Slug"])))
136
- }))), typeof parentId === "undefined" && /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
129
+ }))), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
137
130
  span: 12
138
- }, /*#__PURE__*/_react.default.createElement(Bind, {
139
- name: "parentId"
140
- }, /*#__PURE__*/_react.default.createElement(_AutoComplete.AutoComplete, {
141
- options: folders,
142
- label: t(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["Parent"])))
143
- }))))), /*#__PURE__*/_react.default.createElement(_styled.DialogActions, null, /*#__PURE__*/_react.default.createElement(_Button.ButtonDefault, {
131
+ }, /*#__PURE__*/_react.default.createElement(_Typography.Typography, {
132
+ use: "body1"
133
+ }, t(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["Parent folder"])))), /*#__PURE__*/_react.default.createElement(_styled.DialogFoldersContainer, null, /*#__PURE__*/_react.default.createElement(_.FolderTree, {
134
+ title: t(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["Root folder"]))),
135
+ type: type,
136
+ focusedFolderId: parentId || undefined,
137
+ onFolderClick: function onFolderClick(data) {
138
+ return setParentId((data === null || data === void 0 ? void 0 : data.id) || null);
139
+ },
140
+ onTitleClick: function onTitleClick() {
141
+ return setParentId(null);
142
+ }
143
+ }))))), /*#__PURE__*/_react.default.createElement(_Dialog.DialogActions, null, /*#__PURE__*/_react.default.createElement(_Button.ButtonDefault, {
144
144
  onClick: function onClick() {
145
145
  setDialogOpen(false);
146
146
  }
147
- }, t(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["Cancel"])))), /*#__PURE__*/_react.default.createElement(_Button.ButtonPrimary, {
147
+ }, t(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["Cancel"])))), /*#__PURE__*/_react.default.createElement(_Button.ButtonPrimary, {
148
148
  onClick: submit
149
- }, t(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["Create Folder"]))))));
149
+ }, t(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["Create Folder"]))))));
150
150
  }));
151
151
  };
152
-
153
152
  exports.FolderDialogCreate = FolderDialogCreate;
@@ -1 +1 @@
1
- {"version":3,"names":["t","i18n","ns","FolderDialogCreate","type","onClose","open","parentId","useFolders","folders","loading","createFolder","useState","dialogOpen","setDialogOpen","useSnackbar","showSnackbar","onSubmit","data","message","useEffect","Bind","submit","CREATE","validation","create"],"sources":["DialogCreate.tsx"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\n\nimport { AutoComplete } from \"@webiny/ui/AutoComplete\";\nimport { ButtonPrimary, ButtonDefault } from \"@webiny/ui/Button\";\nimport { DialogTitle, DialogContent, DialogOnClose } from \"@webiny/ui/Dialog\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { Form, FormOnSubmit } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { useSnackbar } from \"@webiny/app-admin\";\n\nimport { useFolders } from \"~/hooks/useFolders\";\n\nimport { DialogContainer, DialogActions } from \"./styled\";\n\nimport { FolderItem } from \"~/types\";\n\ntype Props = {\n type: string;\n open: boolean;\n onClose: DialogOnClose;\n parentId?: string | null;\n};\n\nconst t = i18n.ns(\"app-aco/components/tree/dialog-create\");\n\ntype SubmitData = Omit<FolderItem, \"id\">;\n\nexport const FolderDialogCreate: React.FC<Props> = ({ type, onClose, open, parentId }) => {\n const { folders, loading, createFolder } = useFolders(type);\n const [dialogOpen, setDialogOpen] = useState(false);\n const { showSnackbar } = useSnackbar();\n\n const onSubmit: FormOnSubmit<SubmitData> = async data => {\n try {\n await createFolder({\n ...data,\n type,\n ...(typeof parentId !== \"undefined\" && { parentId })\n });\n setDialogOpen(false);\n showSnackbar(t`Folder created successfully!`);\n } catch (error) {\n showSnackbar(error.message);\n }\n };\n\n useEffect(() => {\n setDialogOpen(open);\n }, [open]);\n\n return (\n <DialogContainer open={dialogOpen} onClose={onClose}>\n {dialogOpen && (\n <Form onSubmit={onSubmit}>\n {({ Bind, submit }) => (\n <>\n {loading.CREATE && <CircularProgress label={t`Creating folder...`} />}\n <DialogTitle>{t`Create a new folder`}</DialogTitle>\n <DialogContent>\n <Grid>\n <Cell span={12}>\n <Bind\n name={\"name\"}\n validators={[validation.create(\"required,minLength:3\")]}\n >\n <Input label={t`Name`} />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name={\"slug\"}\n validators={[\n validation.create(\"required,minLength:3,slug\")\n ]}\n >\n <Input label={t`Slug`} />\n </Bind>\n </Cell>\n {typeof parentId === \"undefined\" && (\n <Cell span={12}>\n <Bind name=\"parentId\">\n <AutoComplete options={folders} label={t`Parent`} />\n </Bind>\n </Cell>\n )}\n </Grid>\n </DialogContent>\n <DialogActions>\n <ButtonDefault\n onClick={() => {\n setDialogOpen(false);\n }}\n >\n {t`Cancel`}\n </ButtonDefault>\n <ButtonPrimary onClick={submit}>{t`Create Folder`}</ButtonPrimary>\n </DialogActions>\n </>\n )}\n </Form>\n )}\n </DialogContainer>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MACH;IAHL,GAKKd,CALL,4FADJ,eAQI,6BAAC,qBAAD;MAAe,OAAO,EAAEsB;IAAxB,GAAiCtB,CAAjC,mGARJ,CAhCJ,CADH;EAAA,CADL,CAFR,CADJ;AAqDH,CA5EM"}
1
+ {"version":3,"names":["t","i18n","ns","FolderDialogCreate","type","onClose","open","currentParentId","useFolders","loading","createFolder","useState","dialogOpen","setDialogOpen","parentId","setParentId","useSnackbar","showSnackbar","onSubmit","data","message","generateSlug","form","slug","title","setValue","slugify","replacement","lower","remove","trim","useEffect","Bind","submit","CREATE","validation","create","undefined","id"],"sources":["DialogCreate.tsx"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\n\nimport { i18n } from \"@webiny/app/i18n\";\nimport { useSnackbar } from \"@webiny/app-admin\";\nimport { Form, FormAPI, FormOnSubmit } from \"@webiny/form\";\nimport { ButtonDefault, ButtonPrimary } from \"@webiny/ui/Button\";\nimport { DialogTitle, DialogActions, DialogContent, DialogOnClose } from \"@webiny/ui/Dialog\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { validation } from \"@webiny/validation\";\nimport slugify from \"slugify\";\n\nimport { FolderTree } from \"~/components\";\nimport { useFolders } from \"~/hooks/useFolders\";\n\nimport { DialogContainer, DialogFoldersContainer } from \"./styled\";\n\nimport { FolderItem } from \"~/types\";\n\ntype Props = {\n type: string;\n open: boolean;\n onClose: DialogOnClose;\n currentParentId?: string | null;\n};\n\nconst t = i18n.ns(\"app-aco/components/tree/dialog-create\");\n\ntype SubmitData = Omit<FolderItem, \"id\">;\n\nexport const FolderDialogCreate: React.FC<Props> = ({ type, onClose, open, currentParentId }) => {\n const { loading, createFolder } = useFolders(type);\n const [dialogOpen, setDialogOpen] = useState(false);\n const [parentId, setParentId] = useState<string | null>();\n const { showSnackbar } = useSnackbar();\n\n const onSubmit: FormOnSubmit<SubmitData> = async data => {\n try {\n await createFolder({\n ...data,\n type,\n parentId: parentId || null\n });\n setDialogOpen(false);\n showSnackbar(t`Folder created successfully!`);\n } catch (error) {\n showSnackbar(error.message);\n }\n };\n\n const generateSlug = (form: FormAPI) => () => {\n if (form.data.slug) {\n return;\n }\n\n if (!form.data.title) {\n return;\n }\n\n // We want to update slug only when the folder is first being created.\n form.setValue(\n \"slug\",\n slugify(form.data.title, {\n replacement: \"-\",\n lower: true,\n remove: /[*#\\?<>_\\{\\}\\[\\]+~.()'\"!:;@]/g,\n trim: false\n })\n );\n };\n\n useEffect(() => {\n setParentId(currentParentId);\n }, [currentParentId]);\n\n useEffect(() => {\n setDialogOpen(open);\n }, [open]);\n\n return (\n <DialogContainer open={dialogOpen} onClose={onClose}>\n {dialogOpen && (\n <Form<SubmitData> onSubmit={onSubmit}>\n {({ form, Bind, submit }) => (\n <>\n {loading.CREATE && <CircularProgress label={t`Creating folder...`} />}\n <DialogTitle>{t`Create a new folder`}</DialogTitle>\n <DialogContent>\n <Grid>\n <Cell span={12}>\n <Bind\n name={\"title\"}\n validators={[validation.create(\"required,minLength:3\")]}\n >\n <Input label={t`Title`} onBlur={generateSlug(form)} />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name={\"slug\"}\n validators={[\n validation.create(\"required,minLength:3,slug\")\n ]}\n >\n <Input label={t`Slug`} />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Typography use=\"body1\">{t`Parent folder`}</Typography>\n <DialogFoldersContainer>\n <FolderTree\n title={t`Root folder`}\n type={type}\n focusedFolderId={parentId || undefined}\n onFolderClick={data =>\n setParentId(data?.id || null)\n }\n onTitleClick={() => setParentId(null)}\n />\n </DialogFoldersContainer>\n </Cell>\n </Grid>\n </DialogContent>\n <DialogActions>\n <ButtonDefault\n onClick={() => {\n setDialogOpen(false);\n }}\n >\n {t`Cancel`}\n </ButtonDefault>\n <ButtonPrimary onClick={submit}>{t`Create Folder`}</ButtonPrimary>\n </Dialog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