@plasmicpkgs/plasmic-cms 0.0.70 → 0.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +0 -1
- package/dist/plasmic-cms.cjs.development.js +50 -82
- package/dist/plasmic-cms.cjs.development.js.map +1 -1
- package/dist/plasmic-cms.cjs.production.min.js +1 -1
- package/dist/plasmic-cms.cjs.production.min.js.map +1 -1
- package/dist/plasmic-cms.esm.js +11 -44
- package/dist/plasmic-cms.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/plasmic-cms.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import registerComponent from '@plasmicapp/host/registerComponent';
|
|
2
2
|
import registerGlobalContext from '@plasmicapp/host/registerGlobalContext';
|
|
3
|
-
import { useSelector, DataProvider, useDataEnv, repeatedElement } from '@plasmicapp/host';
|
|
3
|
+
import { useSelector, DataProvider, useDataEnv, PlasmicCanvasContext, repeatedElement } from '@plasmicapp/host';
|
|
4
4
|
import { usePlasmicQueryData } from '@plasmicapp/query';
|
|
5
5
|
import dayjs from 'dayjs';
|
|
6
|
-
import React from 'react';
|
|
6
|
+
import React, { useContext } from 'react';
|
|
7
7
|
|
|
8
8
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
9
9
|
try {
|
|
@@ -1091,45 +1091,6 @@ var API = /*#__PURE__*/function () {
|
|
|
1091
1091
|
return query;
|
|
1092
1092
|
}();
|
|
1093
1093
|
|
|
1094
|
-
_proto.fetchRow = /*#__PURE__*/function () {
|
|
1095
|
-
var _fetchRow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(table, row, useDraft) {
|
|
1096
|
-
var response;
|
|
1097
|
-
return runtime_1.wrap(function _callee4$(_context4) {
|
|
1098
|
-
while (1) {
|
|
1099
|
-
switch (_context4.prev = _context4.next) {
|
|
1100
|
-
case 0:
|
|
1101
|
-
_context4.prev = 0;
|
|
1102
|
-
_context4.next = 3;
|
|
1103
|
-
return this.get("/tables/" + table + "/rows/" + row, {
|
|
1104
|
-
draft: Number(useDraft),
|
|
1105
|
-
locale: this.config.locale
|
|
1106
|
-
});
|
|
1107
|
-
|
|
1108
|
-
case 3:
|
|
1109
|
-
response = _context4.sent;
|
|
1110
|
-
return _context4.abrupt("return", response);
|
|
1111
|
-
|
|
1112
|
-
case 7:
|
|
1113
|
-
_context4.prev = 7;
|
|
1114
|
-
_context4.t0 = _context4["catch"](0);
|
|
1115
|
-
console.error(_context4.t0);
|
|
1116
|
-
throw _context4.t0;
|
|
1117
|
-
|
|
1118
|
-
case 11:
|
|
1119
|
-
case "end":
|
|
1120
|
-
return _context4.stop();
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
}, _callee4, this, [[0, 7]]);
|
|
1124
|
-
}));
|
|
1125
|
-
|
|
1126
|
-
function fetchRow(_x5, _x6, _x7) {
|
|
1127
|
-
return _fetchRow.apply(this, arguments);
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
return fetchRow;
|
|
1131
|
-
}();
|
|
1132
|
-
|
|
1133
1094
|
return API;
|
|
1134
1095
|
}();
|
|
1135
1096
|
|
|
@@ -1290,10 +1251,14 @@ var _excluded = ["children"],
|
|
|
1290
1251
|
var modulePath = "@plasmicpkgs/plasmic-cms";
|
|
1291
1252
|
var componentPrefix = "hostless-plasmic-cms";
|
|
1292
1253
|
|
|
1293
|
-
function renderMaybeData(maybeData, renderFn, loaderProps, loadingMessage, forceLoadingState) {
|
|
1254
|
+
function renderMaybeData(maybeData, renderFn, loaderProps, inEditor, loadingMessage, forceLoadingState) {
|
|
1294
1255
|
if ("error" in maybeData) {
|
|
1295
1256
|
var error = maybeData.error;
|
|
1296
1257
|
|
|
1258
|
+
if (!inEditor) {
|
|
1259
|
+
return React.createElement(React.Fragment, null, loadingMessage != null ? loadingMessage : React.createElement("div", null, "Loading..."));
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1297
1262
|
if (error && error instanceof HttpError && error.status === 404) {
|
|
1298
1263
|
if (loaderProps.hideIfNotFound) {
|
|
1299
1264
|
return null;
|
|
@@ -1387,13 +1352,14 @@ function TablesFetcher(_ref2) {
|
|
|
1387
1352
|
}
|
|
1388
1353
|
}, _callee);
|
|
1389
1354
|
})));
|
|
1355
|
+
var inEditor = !!useContext(PlasmicCanvasContext);
|
|
1390
1356
|
return renderMaybeData(maybeData, function (tables) {
|
|
1391
1357
|
return React.createElement(TablesProvider, {
|
|
1392
1358
|
tables: tables
|
|
1393
1359
|
}, children);
|
|
1394
1360
|
}, {
|
|
1395
1361
|
hideIfNotFound: false
|
|
1396
|
-
}, children);
|
|
1362
|
+
}, inEditor, children);
|
|
1397
1363
|
}
|
|
1398
1364
|
|
|
1399
1365
|
function isDatabaseConfigured(config) {
|
|
@@ -1614,6 +1580,7 @@ function CmsQueryRepeater(_ref5) {
|
|
|
1614
1580
|
}
|
|
1615
1581
|
}, _callee2);
|
|
1616
1582
|
})));
|
|
1583
|
+
var inEditor = !!useContext(PlasmicCanvasContext);
|
|
1617
1584
|
var node = renderMaybeData(maybeData, function (rows) {
|
|
1618
1585
|
if (rows.length === 0 || forceEmptyState) {
|
|
1619
1586
|
return React.createElement(QueryResultProvider, {
|
|
@@ -1633,7 +1600,7 @@ function CmsQueryRepeater(_ref5) {
|
|
|
1633
1600
|
}));
|
|
1634
1601
|
}, {
|
|
1635
1602
|
hideIfNotFound: false
|
|
1636
|
-
}, loadingMessage, forceLoadingState);
|
|
1603
|
+
}, inEditor, loadingMessage, forceLoadingState);
|
|
1637
1604
|
return noLayout ? React.createElement(React.Fragment, null, " ", node, " ") : React.createElement("div", {
|
|
1638
1605
|
className: className
|
|
1639
1606
|
}, " ", node, " ");
|