@plasmicpkgs/plasmic-cms 0.0.35 → 0.0.37
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/plasmic-cms.cjs.development.js +90 -40
- 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 +90 -40
- package/dist/plasmic-cms.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/plasmic-cms.esm.js
CHANGED
|
@@ -1448,15 +1448,6 @@ function CmsCredentialsProvider(_ref) {
|
|
|
1448
1448
|
config = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1449
1449
|
|
|
1450
1450
|
config.host = config.host || defaultHost;
|
|
1451
|
-
|
|
1452
|
-
if (!config.databaseId) {
|
|
1453
|
-
throw new Error("You must specify the CMS database ID to use.");
|
|
1454
|
-
}
|
|
1455
|
-
|
|
1456
|
-
if (!config.databaseToken) {
|
|
1457
|
-
throw new Error("You must specify the token of the CMS database you are using.");
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
1451
|
return React.createElement(DatabaseProvider, {
|
|
1461
1452
|
config: config
|
|
1462
1453
|
}, React.createElement(TablesFetcher, null, children));
|
|
@@ -1474,9 +1465,21 @@ function TablesFetcher(_ref2) {
|
|
|
1474
1465
|
while (1) {
|
|
1475
1466
|
switch (_context.prev = _context.next) {
|
|
1476
1467
|
case 0:
|
|
1477
|
-
|
|
1468
|
+
if (isDatabaseConfigured(databaseConfig)) {
|
|
1469
|
+
_context.next = 2;
|
|
1470
|
+
break;
|
|
1471
|
+
}
|
|
1478
1472
|
|
|
1479
|
-
|
|
1473
|
+
return _context.abrupt("return", []);
|
|
1474
|
+
|
|
1475
|
+
case 2:
|
|
1476
|
+
_context.next = 4;
|
|
1477
|
+
return mkApi(databaseConfig).fetchTables();
|
|
1478
|
+
|
|
1479
|
+
case 4:
|
|
1480
|
+
return _context.abrupt("return", _context.sent);
|
|
1481
|
+
|
|
1482
|
+
case 5:
|
|
1480
1483
|
case "end":
|
|
1481
1484
|
return _context.stop();
|
|
1482
1485
|
}
|
|
@@ -1494,7 +1497,7 @@ function TablesFetcher(_ref2) {
|
|
|
1494
1497
|
|
|
1495
1498
|
var cmsQueryLoaderMeta = {
|
|
1496
1499
|
name: componentPrefix + "-query-loader",
|
|
1497
|
-
displayName: "CMS
|
|
1500
|
+
displayName: "CMS Data Loader",
|
|
1498
1501
|
importName: "CmsQueryLoader",
|
|
1499
1502
|
importPath: modulePath,
|
|
1500
1503
|
props: {
|
|
@@ -1547,6 +1550,11 @@ var cmsQueryLoaderMeta = {
|
|
|
1547
1550
|
}
|
|
1548
1551
|
}
|
|
1549
1552
|
};
|
|
1553
|
+
|
|
1554
|
+
function isDatabaseConfigured(config) {
|
|
1555
|
+
return (config == null ? void 0 : config.databaseId) && (config == null ? void 0 : config.databaseToken);
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1550
1558
|
function CmsQueryLoader(_ref5) {
|
|
1551
1559
|
var table = _ref5.table,
|
|
1552
1560
|
children = _ref5.children,
|
|
@@ -1584,27 +1592,35 @@ function CmsQueryLoader(_ref5) {
|
|
|
1584
1592
|
while (1) {
|
|
1585
1593
|
switch (_context2.prev = _context2.next) {
|
|
1586
1594
|
case 0:
|
|
1595
|
+
if (isDatabaseConfigured(databaseConfig)) {
|
|
1596
|
+
_context2.next = 2;
|
|
1597
|
+
break;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
throw new Error("You must specify the CMS ID and API key");
|
|
1601
|
+
|
|
1602
|
+
case 2:
|
|
1587
1603
|
if (table) {
|
|
1588
|
-
_context2.next =
|
|
1604
|
+
_context2.next = 6;
|
|
1589
1605
|
break;
|
|
1590
1606
|
}
|
|
1591
1607
|
|
|
1592
|
-
throw new Error("You must select a
|
|
1608
|
+
throw new Error("You must select a model to query");
|
|
1593
1609
|
|
|
1594
|
-
case
|
|
1610
|
+
case 6:
|
|
1595
1611
|
if (!(tables && !tables.find(function (t) {
|
|
1596
1612
|
return t.identifier === table;
|
|
1597
1613
|
}))) {
|
|
1598
|
-
_context2.next =
|
|
1614
|
+
_context2.next = 8;
|
|
1599
1615
|
break;
|
|
1600
1616
|
}
|
|
1601
1617
|
|
|
1602
|
-
throw new Error("There is no
|
|
1618
|
+
throw new Error("There is no model called \"" + table + "\"");
|
|
1603
1619
|
|
|
1604
|
-
case
|
|
1620
|
+
case 8:
|
|
1605
1621
|
return _context2.abrupt("return", mkApi(databaseConfig).query(table, params));
|
|
1606
1622
|
|
|
1607
|
-
case
|
|
1623
|
+
case 9:
|
|
1608
1624
|
case "end":
|
|
1609
1625
|
return _context2.stop();
|
|
1610
1626
|
}
|
|
@@ -1622,7 +1638,7 @@ function CmsQueryLoader(_ref5) {
|
|
|
1622
1638
|
}
|
|
1623
1639
|
var cmsRowRepeaterMeta = {
|
|
1624
1640
|
name: componentPrefix + "-row-repeater",
|
|
1625
|
-
displayName: "CMS
|
|
1641
|
+
displayName: "CMS Entry Repeater",
|
|
1626
1642
|
importName: "CmsRowRepeater",
|
|
1627
1643
|
importPath: modulePath,
|
|
1628
1644
|
props: {
|
|
@@ -1670,7 +1686,7 @@ function CmsRowRepeater(_ref7) {
|
|
|
1670
1686
|
}
|
|
1671
1687
|
var cmsQueryRepeaterMeta = {
|
|
1672
1688
|
name: componentPrefix + "-query-repeater",
|
|
1673
|
-
displayName: "CMS
|
|
1689
|
+
displayName: "CMS Data Loader",
|
|
1674
1690
|
description: "Fetches CMS data and repeats content of children once for every row fetched.",
|
|
1675
1691
|
importName: "CmsQueryRepeater",
|
|
1676
1692
|
importPath: modulePath,
|
|
@@ -1678,8 +1694,11 @@ var cmsQueryRepeaterMeta = {
|
|
|
1678
1694
|
children: {
|
|
1679
1695
|
type: "slot",
|
|
1680
1696
|
defaultValue: {
|
|
1681
|
-
type: "
|
|
1682
|
-
|
|
1697
|
+
type: "vbox",
|
|
1698
|
+
children: [{
|
|
1699
|
+
type: "component",
|
|
1700
|
+
name: componentPrefix + "-row-field"
|
|
1701
|
+
}]
|
|
1683
1702
|
}
|
|
1684
1703
|
},
|
|
1685
1704
|
table: {
|
|
@@ -1699,7 +1718,10 @@ var cmsQueryRepeaterMeta = {
|
|
|
1699
1718
|
where: {
|
|
1700
1719
|
type: "object",
|
|
1701
1720
|
displayName: "Filter",
|
|
1702
|
-
description: "Filter clause, in JSON format."
|
|
1721
|
+
description: "Filter clause, in JSON format.",
|
|
1722
|
+
hidden: function hidden() {
|
|
1723
|
+
return true;
|
|
1724
|
+
}
|
|
1703
1725
|
},
|
|
1704
1726
|
orderBy: {
|
|
1705
1727
|
type: "choice",
|
|
@@ -1761,27 +1783,43 @@ function CmsQueryRepeater(_ref9) {
|
|
|
1761
1783
|
while (1) {
|
|
1762
1784
|
switch (_context3.prev = _context3.next) {
|
|
1763
1785
|
case 0:
|
|
1786
|
+
if (isDatabaseConfigured(databaseConfig)) {
|
|
1787
|
+
_context3.next = 2;
|
|
1788
|
+
break;
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
throw new Error("You must specify a CMS ID and API key");
|
|
1792
|
+
|
|
1793
|
+
case 2:
|
|
1764
1794
|
if (table) {
|
|
1765
|
-
_context3.next =
|
|
1795
|
+
_context3.next = 6;
|
|
1766
1796
|
break;
|
|
1767
1797
|
}
|
|
1768
1798
|
|
|
1769
|
-
|
|
1799
|
+
if (!(!tables || tables.length === 0)) {
|
|
1800
|
+
_context3.next = 5;
|
|
1801
|
+
break;
|
|
1802
|
+
}
|
|
1770
1803
|
|
|
1771
|
-
|
|
1804
|
+
throw new Error("You must select a model to query");
|
|
1805
|
+
|
|
1806
|
+
case 5:
|
|
1807
|
+
table = tables[0].identifier;
|
|
1808
|
+
|
|
1809
|
+
case 6:
|
|
1772
1810
|
if (!(tables && !tables.find(function (t) {
|
|
1773
1811
|
return t.identifier === table;
|
|
1774
1812
|
}))) {
|
|
1775
|
-
_context3.next =
|
|
1813
|
+
_context3.next = 8;
|
|
1776
1814
|
break;
|
|
1777
1815
|
}
|
|
1778
1816
|
|
|
1779
|
-
throw new Error("There is no
|
|
1817
|
+
throw new Error("There is no model called \"" + table + "\"");
|
|
1780
1818
|
|
|
1781
|
-
case
|
|
1819
|
+
case 8:
|
|
1782
1820
|
return _context3.abrupt("return", mkApi(databaseConfig).query(table, params));
|
|
1783
1821
|
|
|
1784
|
-
case
|
|
1822
|
+
case 9:
|
|
1785
1823
|
case "end":
|
|
1786
1824
|
return _context3.stop();
|
|
1787
1825
|
}
|
|
@@ -1789,6 +1827,10 @@ function CmsQueryRepeater(_ref9) {
|
|
|
1789
1827
|
}, _callee3);
|
|
1790
1828
|
})));
|
|
1791
1829
|
return renderMaybeData(maybeData, function (rows) {
|
|
1830
|
+
if (rows.length === 0) {
|
|
1831
|
+
return React.createElement("div", null, "No matching entries found.");
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1792
1834
|
return React.createElement(QueryResultProvider, {
|
|
1793
1835
|
table: table,
|
|
1794
1836
|
rows: rows
|
|
@@ -1804,7 +1846,7 @@ function CmsQueryRepeater(_ref9) {
|
|
|
1804
1846
|
}
|
|
1805
1847
|
var cmsRowFieldMeta = {
|
|
1806
1848
|
name: componentPrefix + "-row-field",
|
|
1807
|
-
displayName: "CMS
|
|
1849
|
+
displayName: "CMS Entry Field",
|
|
1808
1850
|
importName: "CmsRowField",
|
|
1809
1851
|
importPath: modulePath,
|
|
1810
1852
|
props: {
|
|
@@ -1824,7 +1866,7 @@ var cmsRowFieldMeta = {
|
|
|
1824
1866
|
var _ctx$table;
|
|
1825
1867
|
|
|
1826
1868
|
var table = _ref11.table;
|
|
1827
|
-
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table = ctx == null ? void 0 : ctx.table) != null ? _ctx$table : table, ["number", "boolean", "text", "long-text", "date-time", "rich-text"]);
|
|
1869
|
+
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table = ctx == null ? void 0 : ctx.table) != null ? _ctx$table : table, ["number", "boolean", "text", "long-text", "date-time", "rich-text", "image"]);
|
|
1828
1870
|
}
|
|
1829
1871
|
},
|
|
1830
1872
|
dateFormat: {
|
|
@@ -1913,8 +1955,16 @@ function CmsRowField(_ref13) {
|
|
|
1913
1955
|
var tables = useTables();
|
|
1914
1956
|
var res = useRow(table);
|
|
1915
1957
|
|
|
1916
|
-
if (!res
|
|
1917
|
-
return React.createElement("div",
|
|
1958
|
+
if (!res) {
|
|
1959
|
+
return React.createElement("div", {
|
|
1960
|
+
className: className
|
|
1961
|
+
}, "Field ", table != null ? table : "Unknown Model", ".", field != null ? field : "Unknown Field");
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
if (!res.row) {
|
|
1965
|
+
return React.createElement("div", {
|
|
1966
|
+
className: className
|
|
1967
|
+
}, "Error: No CMS Entry found");
|
|
1918
1968
|
}
|
|
1919
1969
|
|
|
1920
1970
|
if (tables) {
|
|
@@ -1930,11 +1980,11 @@ function CmsRowField(_ref13) {
|
|
|
1930
1980
|
table: res.table,
|
|
1931
1981
|
tables: tables,
|
|
1932
1982
|
field: field,
|
|
1933
|
-
typeFilters: ["text"]
|
|
1983
|
+
typeFilters: ["text", "long-text", "rich-text"]
|
|
1934
1984
|
});
|
|
1935
1985
|
|
|
1936
1986
|
if (!fieldMeta) {
|
|
1937
|
-
|
|
1987
|
+
throw new Error("Please select an entry field to display.");
|
|
1938
1988
|
}
|
|
1939
1989
|
|
|
1940
1990
|
var data = (_res$row$data = res.row.data) == null ? void 0 : _res$row$data[fieldMeta.identifier];
|
|
@@ -2009,7 +2059,7 @@ function renderValue(value, type, props) {
|
|
|
2009
2059
|
|
|
2010
2060
|
var cmsRowLinkMeta = {
|
|
2011
2061
|
name: componentPrefix + "-row-link",
|
|
2012
|
-
displayName: "CMS
|
|
2062
|
+
displayName: "CMS Entry Link",
|
|
2013
2063
|
importName: "CmsRowLink",
|
|
2014
2064
|
importPath: modulePath,
|
|
2015
2065
|
props: {
|
|
@@ -2100,7 +2150,7 @@ function CmsRowLink(_ref15) {
|
|
|
2100
2150
|
}
|
|
2101
2151
|
var cmsRowImageMeta = {
|
|
2102
2152
|
name: componentPrefix + "-row-image",
|
|
2103
|
-
displayName: "CMS
|
|
2153
|
+
displayName: "CMS Entry Image",
|
|
2104
2154
|
importName: "CmsRowImage",
|
|
2105
2155
|
importPath: modulePath,
|
|
2106
2156
|
props: {
|
|
@@ -2196,7 +2246,7 @@ function CmsRowImage(_ref17) {
|
|
|
2196
2246
|
}
|
|
2197
2247
|
var cmsRowFieldValueMeta = {
|
|
2198
2248
|
name: componentPrefix + "-row-value",
|
|
2199
|
-
displayName: "CMS
|
|
2249
|
+
displayName: "CMS Entry Value",
|
|
2200
2250
|
importName: "CmsRowValue",
|
|
2201
2251
|
importPath: modulePath,
|
|
2202
2252
|
props: {
|