@guillotinaweb/react-gmi 0.22.4 → 0.23.1

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.
@@ -1122,143 +1122,6 @@ Select.propTypes = {
1122
1122
  className: PropTypes.string
1123
1123
  };
1124
1124
 
1125
- class RestClient {
1126
- constructor(url, container, auth) {
1127
- this.auth = auth;
1128
- this.url = url;
1129
- this.container = container;
1130
- }
1131
-
1132
- async request(path, data, headers) {
1133
- if (path.indexOf(this.url) !== -1) {
1134
- path = path.replace(this.url, '');
1135
- }
1136
-
1137
- if (this.container !== '/' && path.indexOf(this.container) === -1) {
1138
- path = `${this.container}${path}`;
1139
- }
1140
-
1141
- if (!path.startsWith('/')) {
1142
- path = `/${path}`;
1143
- }
1144
-
1145
- data = data || {};
1146
- data.headers = headers || this.getHeaders();
1147
- return await fetch(`${this.url}${path}`, data);
1148
- }
1149
-
1150
- getHeaders() {
1151
- const authToken = this.auth.getToken();
1152
- if (!authToken) return {};
1153
- return {
1154
- Accept: 'application/json',
1155
- 'Content-Type': 'application/json',
1156
- Authorization: 'Bearer ' + authToken
1157
- };
1158
- }
1159
-
1160
- async post(path, data) {
1161
- return await this.request(path, {
1162
- method: 'post',
1163
- body: JSON.stringify(data)
1164
- });
1165
- }
1166
-
1167
- async get(path) {
1168
- return await this.request(path, {});
1169
- }
1170
-
1171
- async put(path, data) {
1172
- return await this.request(path, {
1173
- method: 'put',
1174
- body: JSON.stringify(data)
1175
- });
1176
- }
1177
-
1178
- async patch(path, data) {
1179
- return await this.request(path, {
1180
- method: 'PATCH',
1181
- body: JSON.stringify(data)
1182
- });
1183
- }
1184
-
1185
- async upload(path, data) {
1186
- const headers = this.getHeaders();
1187
- delete headers['Content-Type'];
1188
- headers['Content-Type'] = data['content-type'];
1189
- headers['X-UPLOAD-FILENAME'] = data.filename;
1190
- headers['Content-Encoding'] = 'base64';
1191
- return await this.request(path, {
1192
- method: 'PATCH',
1193
- body: data.data
1194
- }, headers);
1195
- }
1196
-
1197
- async delete(path, data = undefined) {
1198
- return await this.request(path, {
1199
- method: 'delete',
1200
- body: JSON.stringify(data)
1201
- });
1202
- }
1203
-
1204
- }
1205
-
1206
- const Loading = (_ref) => {
1207
- let rest = _extends({}, _ref);
1208
-
1209
- return /*#__PURE__*/React.createElement("div", _extends({
1210
- className: "progress-line"
1211
- }, rest));
1212
- };
1213
-
1214
- const Tag = ({
1215
- name,
1216
- onRemove,
1217
- size: _size = 'is-medium',
1218
- color: _color = 'is-warning'
1219
- }) => /*#__PURE__*/React.createElement("span", {
1220
- className: classnames(['tag', _color, _size])
1221
- }, name, onRemove !== undefined && /*#__PURE__*/React.createElement("button", {
1222
- className: "delete is-small",
1223
- onClick: () => onRemove()
1224
- }));
1225
-
1226
- function Delete({
1227
- onClick,
1228
- className,
1229
- children
1230
- }) {
1231
- return /*#__PURE__*/React.createElement("button", {
1232
- type: "button",
1233
- onClick: onClick,
1234
- className: `delete ${className}`,
1235
- "data-test": "btnDeleteTest"
1236
- }, children);
1237
- }
1238
-
1239
- function Table({
1240
- headers,
1241
- children,
1242
- className
1243
- }) {
1244
- className = className ? className.split(' ') : ' is-full is-fullwidth is-narrow'.split(' ');
1245
- return /*#__PURE__*/React.createElement("table", {
1246
- className: classnames(['table', ...className])
1247
- }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, headers && headers.map((item, idx) => /*#__PURE__*/React.createElement("th", {
1248
- key: item + idx
1249
- }, item)))), /*#__PURE__*/React.createElement("tbody", null, children));
1250
- }
1251
-
1252
- function Notification({
1253
- isColor = '',
1254
- children
1255
- }) {
1256
- return /*#__PURE__*/React.createElement("div", {
1257
- className: 'notification is-' + isColor,
1258
- "data-test": "notificationTest"
1259
- }, children);
1260
- }
1261
-
1262
1125
  // https://github.com/molefrog/wouter
1263
1126
 
1264
1127
  const setURLParams = p => window.history['pushState'](0, 0, (window.history.pathname || '') + '?' + p.toString().replace(/%2F/g, '/'));
@@ -1395,6 +1258,143 @@ function TdLink(_ref) {
1395
1258
  }, children));
1396
1259
  }
1397
1260
 
1261
+ const Loading = (_ref) => {
1262
+ let rest = _extends({}, _ref);
1263
+
1264
+ return /*#__PURE__*/React.createElement("div", _extends({
1265
+ className: "progress-line"
1266
+ }, rest));
1267
+ };
1268
+
1269
+ const Tag = ({
1270
+ name,
1271
+ onRemove,
1272
+ size: _size = 'is-medium',
1273
+ color: _color = 'is-warning'
1274
+ }) => /*#__PURE__*/React.createElement("span", {
1275
+ className: classnames(['tag', _color, _size])
1276
+ }, name, onRemove !== undefined && /*#__PURE__*/React.createElement("button", {
1277
+ className: "delete is-small",
1278
+ onClick: () => onRemove()
1279
+ }));
1280
+
1281
+ function Delete({
1282
+ onClick,
1283
+ className,
1284
+ children
1285
+ }) {
1286
+ return /*#__PURE__*/React.createElement("button", {
1287
+ type: "button",
1288
+ onClick: onClick,
1289
+ className: `delete ${className}`,
1290
+ "data-test": "btnDeleteTest"
1291
+ }, children);
1292
+ }
1293
+
1294
+ function Table({
1295
+ headers,
1296
+ children,
1297
+ className
1298
+ }) {
1299
+ className = className ? className.split(' ') : ' is-full is-fullwidth is-narrow'.split(' ');
1300
+ return /*#__PURE__*/React.createElement("table", {
1301
+ className: classnames(['table', ...className])
1302
+ }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, headers && headers.map((item, idx) => /*#__PURE__*/React.createElement("th", {
1303
+ key: item + idx
1304
+ }, item)))), /*#__PURE__*/React.createElement("tbody", null, children));
1305
+ }
1306
+
1307
+ function Notification({
1308
+ isColor = '',
1309
+ children
1310
+ }) {
1311
+ return /*#__PURE__*/React.createElement("div", {
1312
+ className: 'notification is-' + isColor,
1313
+ "data-test": "notificationTest"
1314
+ }, children);
1315
+ }
1316
+
1317
+ class RestClient {
1318
+ constructor(url, container, auth) {
1319
+ this.auth = auth;
1320
+ this.url = url;
1321
+ this.container = container;
1322
+ }
1323
+
1324
+ async request(path, data, headers) {
1325
+ if (path.indexOf(this.url) !== -1) {
1326
+ path = path.replace(this.url, '');
1327
+ }
1328
+
1329
+ if (this.container !== '/' && path.indexOf(this.container) === -1) {
1330
+ path = `${this.container}${path}`;
1331
+ }
1332
+
1333
+ if (!path.startsWith('/')) {
1334
+ path = `/${path}`;
1335
+ }
1336
+
1337
+ data = data || {};
1338
+ data.headers = headers || this.getHeaders();
1339
+ return await fetch(`${this.url}${path}`, data);
1340
+ }
1341
+
1342
+ getHeaders() {
1343
+ const authToken = this.auth.getToken();
1344
+ if (!authToken) return {};
1345
+ return {
1346
+ Accept: 'application/json',
1347
+ 'Content-Type': 'application/json',
1348
+ Authorization: 'Bearer ' + authToken
1349
+ };
1350
+ }
1351
+
1352
+ async post(path, data) {
1353
+ return await this.request(path, {
1354
+ method: 'post',
1355
+ body: JSON.stringify(data)
1356
+ });
1357
+ }
1358
+
1359
+ async get(path) {
1360
+ return await this.request(path, {});
1361
+ }
1362
+
1363
+ async put(path, data) {
1364
+ return await this.request(path, {
1365
+ method: 'put',
1366
+ body: JSON.stringify(data)
1367
+ });
1368
+ }
1369
+
1370
+ async patch(path, data) {
1371
+ return await this.request(path, {
1372
+ method: 'PATCH',
1373
+ body: JSON.stringify(data)
1374
+ });
1375
+ }
1376
+
1377
+ async upload(path, data) {
1378
+ const headers = this.getHeaders();
1379
+ delete headers['Content-Type'];
1380
+ headers['Content-Type'] = data['content-type'];
1381
+ headers['X-UPLOAD-FILENAME'] = data.filename;
1382
+ headers['Content-Encoding'] = 'base64';
1383
+ return await this.request(path, {
1384
+ method: 'PATCH',
1385
+ body: data.data
1386
+ }, headers);
1387
+ }
1388
+
1389
+ async delete(path, data = undefined) {
1390
+ return await this.request(path, {
1391
+ method: 'delete',
1392
+ body: JSON.stringify(data)
1393
+ });
1394
+ }
1395
+
1396
+ }
1397
+
1398
1398
  const SEP = '=';
1399
1399
  const DEFAULT_FIELD = 'title__in';
1400
1400
  const CLEANER = '||';
@@ -1512,7 +1512,7 @@ class GuillotinaClient {
1512
1512
  objectPath = objectPath.slice(0, -1);
1513
1513
  }
1514
1514
 
1515
- result = [...parser(start.toString(), '_from'), ...parser(pageSize.toString(), 'size')];
1515
+ result = [...parser(start.toString(), '_from'), ...parser(pageSize.toString(), 'size'), ...parser('*', '_metadata=*')];
1516
1516
 
1517
1517
  if (withDepth) {
1518
1518
  var _parser2;
@@ -4363,15 +4363,13 @@ const tabs = {
4363
4363
  Properties: PanelProperties,
4364
4364
  Behaviors: PanelBehaviors,
4365
4365
  Permissions: PanelPermissions,
4366
- Actions: PanelActions // Requester: PanelRequester,
4367
-
4366
+ Actions: PanelActions
4368
4367
  };
4369
4368
  const tabsPermissions = {
4370
4369
  Items: 'guillotina.ViewContent',
4371
4370
  Properties: 'guillotina.ViewContent',
4372
4371
  Behaviors: 'guillotina.ModifyContent',
4373
- Permissions: 'guillotina.SeePermissions' // Requester: "guillotina.swagger.View"
4374
-
4372
+ Permissions: 'guillotina.SeePermissions'
4375
4373
  };
4376
4374
  function FolderCtx(props) {
4377
4375
  const ctx = useTraversal();
@@ -4531,16 +4529,14 @@ const tabs$2 = {
4531
4529
  Registry: PanelNotImplemented,
4532
4530
  Behaviors: PanelBehaviors,
4533
4531
  Permissions: PanelPermissions,
4534
- Actions: PanelActions // Requester: PanelRequester
4535
-
4532
+ Actions: PanelActions
4536
4533
  };
4537
4534
  const tabsPermissions$2 = {
4538
4535
  Items: 'guillotina.ViewContent',
4539
4536
  Addons: 'guillotina.ManageAddons',
4540
4537
  Registry: 'guillotina.ReadConfiguration',
4541
4538
  Behaviors: 'guillotina.ModifyContent',
4542
- Permissions: 'guillotina.SeePermissions' // Requester: "guillotina.swagger.View"
4543
-
4539
+ Permissions: 'guillotina.SeePermissions'
4544
4540
  };
4545
4541
  function ContainerCtx(props) {
4546
4542
  const ctx = useTraversal();