cozy-ui-plus 10.0.0 → 12.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/CHANGELOG.md +20 -0
- package/dist/ContactsList/Contacts/ContactIdentity.js +4 -5
- package/dist/stylesheet.css +0 -23
- package/package.json +4 -2
- package/src/ContactsList/ContactRow.spec.js +7 -1
- package/src/ContactsList/Contacts/ContactIdentity.jsx +7 -5
- package/dist/FilePicker/FilePickerBody.js +0 -108
- package/dist/FilePicker/FilePickerBodyItem.js +0 -128
- package/dist/FilePicker/FilePickerBreadcrumb.js +0 -72
- package/dist/FilePicker/FilePickerFooter.js +0 -91
- package/dist/FilePicker/FilePickerHeader.js +0 -108
- package/dist/FilePicker/docs/DemoProvider.js +0 -280
- package/dist/FilePicker/helpers.js +0 -57
- package/dist/FilePicker/index.js +0 -125
- package/dist/FilePicker/queries.js +0 -61
- package/dist/src/FilePicker/FilePickerBody.d.ts +0 -19
- package/dist/src/FilePicker/FilePickerBodyItem.d.ts +0 -22
- package/dist/src/FilePicker/FilePickerBodyItem.spec.d.ts +0 -1
- package/dist/src/FilePicker/FilePickerBreadcrumb.d.ts +0 -13
- package/dist/src/FilePicker/FilePickerFooter.d.ts +0 -15
- package/dist/src/FilePicker/FilePickerFooter.spec.d.ts +0 -1
- package/dist/src/FilePicker/FilePickerHeader.d.ts +0 -14
- package/dist/src/FilePicker/docs/DemoProvider.d.ts +0 -23
- package/dist/src/FilePicker/helpers.d.ts +0 -3
- package/dist/src/FilePicker/helpers.spec.d.ts +0 -1
- package/dist/src/FilePicker/index.d.ts +0 -22
- package/dist/src/FilePicker/queries.d.ts +0 -14
- package/src/FilePicker/FilePickerBody.jsx +0 -111
- package/src/FilePicker/FilePickerBodyItem.jsx +0 -124
- package/src/FilePicker/FilePickerBodyItem.spec.jsx +0 -164
- package/src/FilePicker/FilePickerBreadcrumb.jsx +0 -54
- package/src/FilePicker/FilePickerFooter.jsx +0 -42
- package/src/FilePicker/FilePickerFooter.spec.jsx +0 -41
- package/src/FilePicker/FilePickerHeader.jsx +0 -88
- package/src/FilePicker/Readme.md +0 -50
- package/src/FilePicker/docs/DemoProvider.jsx +0 -273
- package/src/FilePicker/helpers.js +0 -46
- package/src/FilePicker/helpers.spec.js +0 -84
- package/src/FilePicker/index.jsx +0 -94
- package/src/FilePicker/locales/en.json +0 -8
- package/src/FilePicker/locales/fr.json +0 -8
- package/src/FilePicker/locales/ru.json +0 -8
- package/src/FilePicker/locales/vi.json +0 -8
- package/src/FilePicker/queries.js +0 -37
- package/src/FilePicker/styles.styl +0 -18
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
|
|
12
|
-
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
|
-
var _cozyClient = _interopRequireWildcard(require("cozy-client"));
|
|
15
|
-
|
|
16
|
-
var _store = require("cozy-client/dist/store");
|
|
17
|
-
|
|
18
|
-
var _cozyStackClient = require("cozy-stack-client");
|
|
19
|
-
|
|
20
|
-
var _Breakpoints = require("cozy-ui/transpiled/react/providers/Breakpoints");
|
|
21
|
-
|
|
22
|
-
var _twakeI18n = require("twake-i18n");
|
|
23
|
-
|
|
24
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
-
|
|
26
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @typedef {object} CreateMockClientForDocParam
|
|
30
|
-
* @property {object} [queries] - Prefill queries inside the store
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @typedef {object} FillQueryInsideClientQueryOptions
|
|
35
|
-
* @property {IOCozyFile[]} data - Array of IOCozyFile
|
|
36
|
-
* @property {{ doctype: string, selector: object }} definition - Prefill queries inside the store
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @param {CozyClient} client - Instance of CozyClient
|
|
41
|
-
* @param {string} queryName - Name of the query
|
|
42
|
-
* @param {FillQueryInsideClientQueryOptions} queryOptions - Options of the query
|
|
43
|
-
*/
|
|
44
|
-
var fillQueryInsideClient = function fillQueryInsideClient(client, queryName, queryOptions) {
|
|
45
|
-
var definition = queryOptions.definition,
|
|
46
|
-
data = queryOptions.data;
|
|
47
|
-
client.store.dispatch((0, _store.initQuery)(queryName, definition));
|
|
48
|
-
client.store.dispatch((0, _store.receiveQueryResult)(queryName, {
|
|
49
|
-
data: data ? data.map(function (doc) {
|
|
50
|
-
return (0, _cozyStackClient.normalizeDoc)(doc, definition.doctype);
|
|
51
|
-
}) : []
|
|
52
|
-
}));
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Creates a client suitable for use in Documentation
|
|
56
|
-
*
|
|
57
|
-
* @param {CreateMockClientForDocParam} param
|
|
58
|
-
* @returns {CozyClient} Instance of CozyClient
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var createMockClientForDoc = function createMockClientForDoc(_ref) {
|
|
63
|
-
var _ref$queries = _ref.queries,
|
|
64
|
-
queries = _ref$queries === void 0 ? {} : _ref$queries;
|
|
65
|
-
var client = new _cozyClient.default();
|
|
66
|
-
client.ensureStore();
|
|
67
|
-
|
|
68
|
-
for (var _i = 0, _Object$entries = Object.entries(queries); _i < _Object$entries.length; _i++) {
|
|
69
|
-
var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),
|
|
70
|
-
queryName = _Object$entries$_i[0],
|
|
71
|
-
queryOptions = _Object$entries$_i[1];
|
|
72
|
-
|
|
73
|
-
fillQueryInsideClient(client, queryName, queryOptions);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return client;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
var setupClient = function setupClient() {
|
|
80
|
-
var client = createMockClientForDoc({
|
|
81
|
-
queries: {
|
|
82
|
-
'onlyfolder-io.cozy.files.root-dir': {
|
|
83
|
-
data: [{
|
|
84
|
-
_id: 'io.cozy.files.root-dir',
|
|
85
|
-
id: 'io.cozy.files.root-dir',
|
|
86
|
-
_type: 'io.cozy.files',
|
|
87
|
-
type: 'directory',
|
|
88
|
-
dir_id: 'io.cozy.files.root-dir',
|
|
89
|
-
name: 'io.cozy.files.root-dir',
|
|
90
|
-
updated_at: '2021-01-01T12:00:00.000000+01:00'
|
|
91
|
-
}],
|
|
92
|
-
definition: {
|
|
93
|
-
doctype: 'io.cozy.files',
|
|
94
|
-
selector: {
|
|
95
|
-
dir_id: 'io.cozy.files.root-dir'
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
'buildContentFolderQuery-io.cozy.files.root-dir': {
|
|
100
|
-
data: [{
|
|
101
|
-
_id: 'folder.01.id',
|
|
102
|
-
id: 'folder.01.id',
|
|
103
|
-
_type: 'io.cozy.files',
|
|
104
|
-
type: 'directory',
|
|
105
|
-
dir_id: 'io.cozy.files.root-dir',
|
|
106
|
-
name: 'Folder one',
|
|
107
|
-
updated_at: '2021-01-01T12:00:00.000000+01:00'
|
|
108
|
-
}, {
|
|
109
|
-
_id: 'folder.02.id',
|
|
110
|
-
id: 'folder.02.id',
|
|
111
|
-
_type: 'io.cozy.files',
|
|
112
|
-
type: 'directory',
|
|
113
|
-
dir_id: 'io.cozy.files.root-dir',
|
|
114
|
-
name: 'Folder two',
|
|
115
|
-
updated_at: '2021-01-01T12:00:00.000000+01:00'
|
|
116
|
-
}, {
|
|
117
|
-
_id: 'file.a.id',
|
|
118
|
-
id: 'file.a.id',
|
|
119
|
-
_type: 'io.cozy.files',
|
|
120
|
-
type: 'file',
|
|
121
|
-
dir_id: 'io.cozy.files.root-dir',
|
|
122
|
-
name: 'File A.md',
|
|
123
|
-
updated_at: '2021-01-01T12:00:00.000000+01:00',
|
|
124
|
-
size: '111609'
|
|
125
|
-
}, {
|
|
126
|
-
_id: 'file.b.id',
|
|
127
|
-
id: 'file.b.id',
|
|
128
|
-
_type: 'io.cozy.files',
|
|
129
|
-
type: 'file',
|
|
130
|
-
dir_id: 'io.cozy.files.root-dir',
|
|
131
|
-
name: 'File B.png',
|
|
132
|
-
updated_at: '2021-01-01T12:00:00.000000+01:00',
|
|
133
|
-
size: '11160963'
|
|
134
|
-
}],
|
|
135
|
-
definition: {
|
|
136
|
-
doctype: 'io.cozy.files',
|
|
137
|
-
selector: {
|
|
138
|
-
dir_id: 'io.cozy.files.root-dir'
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
'onlyfolder-folder.01.id': {
|
|
143
|
-
data: [{
|
|
144
|
-
_id: 'folder.01.id',
|
|
145
|
-
id: 'folder.01.id',
|
|
146
|
-
_type: 'io.cozy.files',
|
|
147
|
-
type: 'directory',
|
|
148
|
-
dir_id: 'io.cozy.files.root-dir',
|
|
149
|
-
name: 'Folder One',
|
|
150
|
-
updated_at: '2021-01-01T12:00:00.000000+01:00'
|
|
151
|
-
}],
|
|
152
|
-
definition: {
|
|
153
|
-
doctype: 'io.cozy.files',
|
|
154
|
-
selector: {
|
|
155
|
-
dir_id: 'io.cozy.files.root-dir'
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
'buildContentFolderQuery-folder.01.id': {
|
|
160
|
-
data: [{
|
|
161
|
-
_id: 'folder.03.id',
|
|
162
|
-
id: 'folder.03.id',
|
|
163
|
-
_type: 'io.cozy.files',
|
|
164
|
-
type: 'directory',
|
|
165
|
-
dir_id: 'io.cozy.files.root-dir',
|
|
166
|
-
name: 'Folder One',
|
|
167
|
-
updated_at: '2021-01-01T12:00:00.000000+01:00'
|
|
168
|
-
}, {
|
|
169
|
-
_id: 'file.c.id',
|
|
170
|
-
id: 'file.c.id',
|
|
171
|
-
_type: 'io.cozy.files',
|
|
172
|
-
type: 'file',
|
|
173
|
-
dir_id: 'folder.01.id',
|
|
174
|
-
name: 'File C.txt',
|
|
175
|
-
updated_at: '2021-01-01T12:00:00.000000+01:00',
|
|
176
|
-
size: '111609'
|
|
177
|
-
}],
|
|
178
|
-
definition: {
|
|
179
|
-
doctype: 'io.cozy.files',
|
|
180
|
-
selector: {
|
|
181
|
-
dir_id: 'folder.01.id'
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
'onlyfolder-folder.02.id': {
|
|
186
|
-
data: [{
|
|
187
|
-
_id: 'folder.02.id',
|
|
188
|
-
id: 'folder.02.id',
|
|
189
|
-
_type: 'io.cozy.files',
|
|
190
|
-
type: 'directory',
|
|
191
|
-
dir_id: 'io.cozy.files.root-dir',
|
|
192
|
-
name: 'Folder Two',
|
|
193
|
-
updated_at: '2021-01-01T12:00:00.000000+01:00'
|
|
194
|
-
}],
|
|
195
|
-
definition: {
|
|
196
|
-
doctype: 'io.cozy.files',
|
|
197
|
-
selector: {
|
|
198
|
-
dir_id: 'io.cozy.files.root-dir'
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
'buildContentFolderQuery-folder.02.id': {
|
|
203
|
-
data: [{
|
|
204
|
-
_id: 'file.d.id',
|
|
205
|
-
id: 'file.d.id',
|
|
206
|
-
_type: 'io.cozy.files',
|
|
207
|
-
type: 'file',
|
|
208
|
-
dir_id: 'folder.02.id',
|
|
209
|
-
name: 'File D.jpg',
|
|
210
|
-
updated_at: '2021-01-01T12:00:00.000000+01:00',
|
|
211
|
-
size: '222111'
|
|
212
|
-
}],
|
|
213
|
-
definition: {
|
|
214
|
-
doctype: 'io.cozy.files',
|
|
215
|
-
selector: {
|
|
216
|
-
dir_id: 'folder.02.id'
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
'onlyfolder-folder.03.id': {
|
|
221
|
-
data: [{
|
|
222
|
-
_id: 'folder.03.id',
|
|
223
|
-
id: 'folder.03.id',
|
|
224
|
-
_type: 'io.cozy.files',
|
|
225
|
-
type: 'directory',
|
|
226
|
-
dir_id: 'folder.01.id',
|
|
227
|
-
name: 'Folder Three',
|
|
228
|
-
updated_at: '2021-01-01T12:00:00.000000+01:00'
|
|
229
|
-
}],
|
|
230
|
-
definition: {
|
|
231
|
-
doctype: 'io.cozy.files',
|
|
232
|
-
selector: {
|
|
233
|
-
dir_id: 'folder.01.id'
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
|
-
'buildContentFolderQuery-folder.03.id': {
|
|
238
|
-
data: [{
|
|
239
|
-
_id: 'file.e.id',
|
|
240
|
-
id: 'file.e.id',
|
|
241
|
-
_type: 'io.cozy.files',
|
|
242
|
-
type: 'file',
|
|
243
|
-
dir_id: 'folder.03.id',
|
|
244
|
-
name: 'File E.doc',
|
|
245
|
-
updated_at: '2021-01-01T12:00:00.000000+01:00',
|
|
246
|
-
size: '222111'
|
|
247
|
-
}],
|
|
248
|
-
definition: {
|
|
249
|
-
doctype: 'io.cozy.files',
|
|
250
|
-
selector: {
|
|
251
|
-
dir_id: 'folder.03.id'
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
return client;
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
var mockClient = setupClient();
|
|
261
|
-
|
|
262
|
-
var Wrapper = function Wrapper(_ref2) {
|
|
263
|
-
var children = _ref2.children;
|
|
264
|
-
return /*#__PURE__*/_react.default.createElement(_cozyClient.CozyProvider, {
|
|
265
|
-
client: mockClient
|
|
266
|
-
}, /*#__PURE__*/_react.default.createElement(_Breakpoints.BreakpointsProvider, null, /*#__PURE__*/_react.default.createElement(_twakeI18n.I18nContext.Provider, {
|
|
267
|
-
value: {
|
|
268
|
-
t: function t(x) {
|
|
269
|
-
return x;
|
|
270
|
-
},
|
|
271
|
-
f: function f() {
|
|
272
|
-
return '01 Jan. 2022';
|
|
273
|
-
},
|
|
274
|
-
lang: 'en'
|
|
275
|
-
}
|
|
276
|
-
}, children)));
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
var _default = Wrapper;
|
|
280
|
-
exports.default = _default;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.isValidFolder = exports.isValidFile = exports.getCompliantTypes = void 0;
|
|
9
|
-
|
|
10
|
-
var _mimeTypes = _interopRequireDefault(require("mime-types"));
|
|
11
|
-
|
|
12
|
-
var _file = require("cozy-client/dist/models/file");
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @param {string} types - Types we wish to accept ("folder" and/or "extensions/mime" of file), separated by commas
|
|
16
|
-
* @returns {string[]} All the valid types, if the parameter is undefined or if no type is valid, return an empty array
|
|
17
|
-
*/
|
|
18
|
-
var getCompliantTypes = function getCompliantTypes(types) {
|
|
19
|
-
if (types) {
|
|
20
|
-
return types.replaceAll(' ', '').split(',').filter(function (type) {
|
|
21
|
-
return type !== 'folder' ? !!_mimeTypes.default.contentType(type) : true;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return [];
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Check if Item is a file with accepted extension/mime
|
|
29
|
-
*
|
|
30
|
-
* @param {object} item - file or folder
|
|
31
|
-
* @param {string[]} validTypes - List of accepted types
|
|
32
|
-
* @returns {boolean}
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
exports.getCompliantTypes = getCompliantTypes;
|
|
37
|
-
|
|
38
|
-
var isValidFile = function isValidFile(item, validTypes) {
|
|
39
|
-
var fileTypesAccepted = validTypes.includes(".".concat(item.name.split('.').pop())) || validTypes.includes(item.mime);
|
|
40
|
-
return (0, _file.isFile)(item) && (fileTypesAccepted || validTypes.length === 0);
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Check if Item is a folder with accepted type
|
|
44
|
-
*
|
|
45
|
-
* @param {object} item - file or folder
|
|
46
|
-
* @param {string[]} validTypes - List of accepted types
|
|
47
|
-
* @returns {boolean}
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
exports.isValidFile = isValidFile;
|
|
52
|
-
|
|
53
|
-
var isValidFolder = function isValidFolder(item, validTypes) {
|
|
54
|
-
return (0, _file.isDirectory)(item) && validTypes.includes("folder");
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
exports.isValidFolder = isValidFolder;
|
package/dist/FilePicker/index.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = exports.ROOT_DIR_ID = void 0;
|
|
9
|
-
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
|
-
var _CozyDialogs = require("cozy-ui/transpiled/react/CozyDialogs");
|
|
17
|
-
|
|
18
|
-
var _Breakpoints = _interopRequireDefault(require("cozy-ui/transpiled/react/providers/Breakpoints"));
|
|
19
|
-
|
|
20
|
-
var _styles = require("cozy-ui/transpiled/react/styles");
|
|
21
|
-
|
|
22
|
-
var _FilePickerBody = _interopRequireDefault(require("./FilePickerBody"));
|
|
23
|
-
|
|
24
|
-
var _FilePickerFooter = _interopRequireDefault(require("./FilePickerFooter"));
|
|
25
|
-
|
|
26
|
-
var _FilePickerHeader = _interopRequireDefault(require("./FilePickerHeader"));
|
|
27
|
-
|
|
28
|
-
var _helpers = require("./helpers");
|
|
29
|
-
|
|
30
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
-
|
|
32
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
-
|
|
34
|
-
var useStyles = (0, _styles.makeStyles)(function () {
|
|
35
|
-
return {
|
|
36
|
-
paper: {
|
|
37
|
-
height: '100%'
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
var ROOT_DIR_ID = 'io.cozy.files.root-dir';
|
|
42
|
-
exports.ROOT_DIR_ID = ROOT_DIR_ID;
|
|
43
|
-
|
|
44
|
-
var FilePicker = function FilePicker(_ref) {
|
|
45
|
-
var onClose = _ref.onClose,
|
|
46
|
-
onChange = _ref.onChange,
|
|
47
|
-
accept = _ref.accept,
|
|
48
|
-
multiple = _ref.multiple;
|
|
49
|
-
|
|
50
|
-
var _useBreakpoints = (0, _Breakpoints.default)(),
|
|
51
|
-
isMobile = _useBreakpoints.isMobile;
|
|
52
|
-
|
|
53
|
-
var classes = useStyles();
|
|
54
|
-
|
|
55
|
-
var _useState = (0, _react.useState)(ROOT_DIR_ID),
|
|
56
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
57
|
-
folderId = _useState2[0],
|
|
58
|
-
setFolderId = _useState2[1];
|
|
59
|
-
|
|
60
|
-
var _useState3 = (0, _react.useState)([]),
|
|
61
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
62
|
-
itemsIdsSelected = _useState4[0],
|
|
63
|
-
setItemsIdsSelected = _useState4[1];
|
|
64
|
-
|
|
65
|
-
var onSelectItemId = function onSelectItemId(fileId) {
|
|
66
|
-
if (!multiple) {
|
|
67
|
-
handleConfirm(null, fileId);
|
|
68
|
-
} else {
|
|
69
|
-
setItemsIdsSelected(fileId);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
var navigateTo = function navigateTo(folder) {
|
|
74
|
-
return setFolderId(folder.id);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
var handleConfirm = function handleConfirm(_, fileId) {
|
|
78
|
-
onChange(fileId ? fileId : itemsIdsSelected);
|
|
79
|
-
onClose();
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
var itemTypesAccepted = (0, _helpers.getCompliantTypes)(accept);
|
|
83
|
-
return /*#__PURE__*/_react.default.createElement(_CozyDialogs.FixedDialog, {
|
|
84
|
-
open: true,
|
|
85
|
-
disableGutters: true,
|
|
86
|
-
onClose: isMobile ? undefined : onClose,
|
|
87
|
-
size: "large",
|
|
88
|
-
classes: {
|
|
89
|
-
paper: classes.paper
|
|
90
|
-
},
|
|
91
|
-
title: /*#__PURE__*/_react.default.createElement(_FilePickerHeader.default, {
|
|
92
|
-
navigateTo: navigateTo,
|
|
93
|
-
folderId: folderId,
|
|
94
|
-
onClose: onClose
|
|
95
|
-
}),
|
|
96
|
-
content: /*#__PURE__*/_react.default.createElement(_FilePickerBody.default, {
|
|
97
|
-
navigateTo: navigateTo,
|
|
98
|
-
onSelectItemId: onSelectItemId,
|
|
99
|
-
itemsIdsSelected: itemsIdsSelected,
|
|
100
|
-
folderId: folderId,
|
|
101
|
-
itemTypesAccepted: itemTypesAccepted,
|
|
102
|
-
multiple: multiple
|
|
103
|
-
}),
|
|
104
|
-
actions: multiple ? /*#__PURE__*/_react.default.createElement(_FilePickerFooter.default, {
|
|
105
|
-
onClose: onClose,
|
|
106
|
-
onConfirm: handleConfirm,
|
|
107
|
-
disabledConfirm: itemsIdsSelected.length === 0
|
|
108
|
-
}) : null
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
FilePicker.propTypes = {
|
|
113
|
-
onClose: _propTypes.default.func.isRequired,
|
|
114
|
-
onChange: _propTypes.default.func.isRequired,
|
|
115
|
-
accept: _propTypes.default.string,
|
|
116
|
-
multiple: _propTypes.default.bool
|
|
117
|
-
};
|
|
118
|
-
FilePicker.defaultProps = {
|
|
119
|
-
accept: '',
|
|
120
|
-
multiple: false
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
var _default = /*#__PURE__*/(0, _react.memo)(FilePicker);
|
|
124
|
-
|
|
125
|
-
exports.default = _default;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.buildCurrentFolderQuery = exports.buildContentFolderQuery = void 0;
|
|
7
|
-
|
|
8
|
-
var _cozyClient = require("cozy-client");
|
|
9
|
-
|
|
10
|
-
var FILES_DOCTYPE = 'io.cozy.files';
|
|
11
|
-
|
|
12
|
-
var defaultFetchPolicy = _cozyClient.fetchPolicies.olderThan(30 * 1000);
|
|
13
|
-
|
|
14
|
-
var TRASH_DIR_ID = "".concat(FILES_DOCTYPE, ".trash-dir");
|
|
15
|
-
var SHARED_DRIVES_DIR_ID = "".concat(FILES_DOCTYPE, ".shared-drives-dir");
|
|
16
|
-
|
|
17
|
-
var buildCurrentFolderQuery = function buildCurrentFolderQuery(folderId) {
|
|
18
|
-
return {
|
|
19
|
-
definition: function definition() {
|
|
20
|
-
return (0, _cozyClient.Q)(FILES_DOCTYPE).getById(folderId);
|
|
21
|
-
},
|
|
22
|
-
options: {
|
|
23
|
-
as: "onlyfolder-".concat(folderId),
|
|
24
|
-
fetchPolicy: defaultFetchPolicy
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
exports.buildCurrentFolderQuery = buildCurrentFolderQuery;
|
|
30
|
-
|
|
31
|
-
var buildContentFolderQuery = function buildContentFolderQuery(dirId) {
|
|
32
|
-
return {
|
|
33
|
-
definition: function definition() {
|
|
34
|
-
return (0, _cozyClient.Q)(FILES_DOCTYPE).where({
|
|
35
|
-
dir_id: dirId,
|
|
36
|
-
type: {
|
|
37
|
-
$gt: null
|
|
38
|
-
},
|
|
39
|
-
name: {
|
|
40
|
-
$gt: null
|
|
41
|
-
}
|
|
42
|
-
}).partialIndex({
|
|
43
|
-
_id: {
|
|
44
|
-
$nin: [SHARED_DRIVES_DIR_ID, TRASH_DIR_ID]
|
|
45
|
-
}
|
|
46
|
-
}).indexFields(['dir_id', 'type', 'name']).sortBy([{
|
|
47
|
-
dir_id: 'asc'
|
|
48
|
-
}, {
|
|
49
|
-
type: 'asc'
|
|
50
|
-
}, {
|
|
51
|
-
name: 'asc'
|
|
52
|
-
}]).limitBy(20);
|
|
53
|
-
},
|
|
54
|
-
options: {
|
|
55
|
-
as: "buildContentFolderQuery-".concat(dirId),
|
|
56
|
-
fetchPolicy: defaultFetchPolicy
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
exports.buildContentFolderQuery = buildContentFolderQuery;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export default FilePickerBody;
|
|
2
|
-
declare function FilePickerBody({ navigateTo, folderId, onSelectItemId, itemsIdsSelected, itemTypesAccepted, multiple }: {
|
|
3
|
-
navigateTo: any;
|
|
4
|
-
folderId: any;
|
|
5
|
-
onSelectItemId: any;
|
|
6
|
-
itemsIdsSelected: any;
|
|
7
|
-
itemTypesAccepted: any;
|
|
8
|
-
multiple: any;
|
|
9
|
-
}): JSX.Element;
|
|
10
|
-
declare namespace FilePickerBody {
|
|
11
|
-
namespace propTypes {
|
|
12
|
-
let onSelectItemId: PropTypes.Validator<(...args: any[]) => any>;
|
|
13
|
-
let itemsIdsSelected: PropTypes.Validator<string[]>;
|
|
14
|
-
let folderId: PropTypes.Validator<string>;
|
|
15
|
-
let navigateTo: PropTypes.Validator<(...args: any[]) => any>;
|
|
16
|
-
let itemTypesAccepted: PropTypes.Validator<string[]>;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
import PropTypes from 'prop-types';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export default FilePickerBodyItem;
|
|
2
|
-
declare function FilePickerBodyItem({ item, itemTypesAccepted, multiple, handleChoiceClick, handleListItemClick, itemsIdsSelected, hasDivider }: {
|
|
3
|
-
item: any;
|
|
4
|
-
itemTypesAccepted: any;
|
|
5
|
-
multiple: any;
|
|
6
|
-
handleChoiceClick: any;
|
|
7
|
-
handleListItemClick: any;
|
|
8
|
-
itemsIdsSelected: any;
|
|
9
|
-
hasDivider: any;
|
|
10
|
-
}): JSX.Element;
|
|
11
|
-
declare namespace FilePickerBodyItem {
|
|
12
|
-
namespace propTypes {
|
|
13
|
-
let item: PropTypes.Validator<object>;
|
|
14
|
-
let itemTypesAccepted: PropTypes.Validator<string[]>;
|
|
15
|
-
let multiple: PropTypes.Requireable<boolean>;
|
|
16
|
-
let handleChoiceClick: PropTypes.Validator<(...args: any[]) => any>;
|
|
17
|
-
let handleListItemClick: PropTypes.Validator<(...args: any[]) => any>;
|
|
18
|
-
let itemsIdsSelected: PropTypes.Validator<string[]>;
|
|
19
|
-
let hasDivider: PropTypes.Validator<boolean>;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
import PropTypes from 'prop-types';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare const _default: React.MemoExoticComponent<{
|
|
2
|
-
({ path, onBreadcrumbClick }: {
|
|
3
|
-
path: any;
|
|
4
|
-
onBreadcrumbClick: any;
|
|
5
|
-
}): JSX.Element;
|
|
6
|
-
propTypes: {
|
|
7
|
-
path: PropTypes.Requireable<any[]>;
|
|
8
|
-
onBreadcrumbClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
9
|
-
};
|
|
10
|
-
}>;
|
|
11
|
-
export default _default;
|
|
12
|
-
import PropTypes from 'prop-types';
|
|
13
|
-
import React from 'react';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
declare const _default: React.MemoExoticComponent<{
|
|
2
|
-
({ onConfirm, onClose, disabledConfirm }: {
|
|
3
|
-
onConfirm: any;
|
|
4
|
-
onClose: any;
|
|
5
|
-
disabledConfirm: any;
|
|
6
|
-
}): JSX.Element;
|
|
7
|
-
propTypes: {
|
|
8
|
-
onConfirm: PropTypes.Validator<(...args: any[]) => any>;
|
|
9
|
-
onClose: PropTypes.Validator<(...args: any[]) => any>;
|
|
10
|
-
disabledConfirm: PropTypes.Validator<boolean>;
|
|
11
|
-
};
|
|
12
|
-
}>;
|
|
13
|
-
export default _default;
|
|
14
|
-
import PropTypes from 'prop-types';
|
|
15
|
-
import React from 'react';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare const _default: React.MemoExoticComponent<{
|
|
2
|
-
({ navigateTo, folderId, onClose }: {
|
|
3
|
-
navigateTo: any;
|
|
4
|
-
folderId: any;
|
|
5
|
-
onClose: any;
|
|
6
|
-
}): JSX.Element;
|
|
7
|
-
propTypes: {
|
|
8
|
-
folderId: PropTypes.Validator<string>;
|
|
9
|
-
navigateTo: PropTypes.Validator<(...args: any[]) => any>;
|
|
10
|
-
};
|
|
11
|
-
}>;
|
|
12
|
-
export default _default;
|
|
13
|
-
import PropTypes from 'prop-types';
|
|
14
|
-
import React from 'react';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export default Wrapper;
|
|
2
|
-
export type CreateMockClientForDocParam = {
|
|
3
|
-
/**
|
|
4
|
-
* - Prefill queries inside the store
|
|
5
|
-
*/
|
|
6
|
-
queries?: object;
|
|
7
|
-
};
|
|
8
|
-
export type FillQueryInsideClientQueryOptions = {
|
|
9
|
-
/**
|
|
10
|
-
* - Array of IOCozyFile
|
|
11
|
-
*/
|
|
12
|
-
data: IOCozyFile[];
|
|
13
|
-
/**
|
|
14
|
-
* - Prefill queries inside the store
|
|
15
|
-
*/
|
|
16
|
-
definition: {
|
|
17
|
-
doctype: string;
|
|
18
|
-
selector: object;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
declare function Wrapper({ children }: {
|
|
22
|
-
children: any;
|
|
23
|
-
}): JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const ROOT_DIR_ID: "io.cozy.files.root-dir";
|
|
2
|
-
declare const _default: React.MemoExoticComponent<{
|
|
3
|
-
({ onClose, onChange, accept, multiple }: {
|
|
4
|
-
onClose: any;
|
|
5
|
-
onChange: any;
|
|
6
|
-
accept: any;
|
|
7
|
-
multiple: any;
|
|
8
|
-
}): JSX.Element;
|
|
9
|
-
propTypes: {
|
|
10
|
-
onClose: PropTypes.Validator<(...args: any[]) => any>;
|
|
11
|
-
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
12
|
-
accept: PropTypes.Requireable<string>;
|
|
13
|
-
multiple: PropTypes.Requireable<boolean>;
|
|
14
|
-
};
|
|
15
|
-
defaultProps: {
|
|
16
|
-
accept: string;
|
|
17
|
-
multiple: boolean;
|
|
18
|
-
};
|
|
19
|
-
}>;
|
|
20
|
-
export default _default;
|
|
21
|
-
import PropTypes from 'prop-types';
|
|
22
|
-
import React from 'react';
|