@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
|
@@ -1454,15 +1454,6 @@ function CmsCredentialsProvider(_ref) {
|
|
|
1454
1454
|
config = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1455
1455
|
|
|
1456
1456
|
config.host = config.host || defaultHost;
|
|
1457
|
-
|
|
1458
|
-
if (!config.databaseId) {
|
|
1459
|
-
throw new Error("You must specify the CMS database ID to use.");
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
|
-
if (!config.databaseToken) {
|
|
1463
|
-
throw new Error("You must specify the token of the CMS database you are using.");
|
|
1464
|
-
}
|
|
1465
|
-
|
|
1466
1457
|
return React.createElement(DatabaseProvider, {
|
|
1467
1458
|
config: config
|
|
1468
1459
|
}, React.createElement(TablesFetcher, null, children));
|
|
@@ -1480,9 +1471,21 @@ function TablesFetcher(_ref2) {
|
|
|
1480
1471
|
while (1) {
|
|
1481
1472
|
switch (_context.prev = _context.next) {
|
|
1482
1473
|
case 0:
|
|
1483
|
-
|
|
1474
|
+
if (isDatabaseConfigured(databaseConfig)) {
|
|
1475
|
+
_context.next = 2;
|
|
1476
|
+
break;
|
|
1477
|
+
}
|
|
1484
1478
|
|
|
1485
|
-
|
|
1479
|
+
return _context.abrupt("return", []);
|
|
1480
|
+
|
|
1481
|
+
case 2:
|
|
1482
|
+
_context.next = 4;
|
|
1483
|
+
return mkApi(databaseConfig).fetchTables();
|
|
1484
|
+
|
|
1485
|
+
case 4:
|
|
1486
|
+
return _context.abrupt("return", _context.sent);
|
|
1487
|
+
|
|
1488
|
+
case 5:
|
|
1486
1489
|
case "end":
|
|
1487
1490
|
return _context.stop();
|
|
1488
1491
|
}
|
|
@@ -1500,7 +1503,7 @@ function TablesFetcher(_ref2) {
|
|
|
1500
1503
|
|
|
1501
1504
|
var cmsQueryLoaderMeta = {
|
|
1502
1505
|
name: componentPrefix + "-query-loader",
|
|
1503
|
-
displayName: "CMS
|
|
1506
|
+
displayName: "CMS Data Loader",
|
|
1504
1507
|
importName: "CmsQueryLoader",
|
|
1505
1508
|
importPath: modulePath,
|
|
1506
1509
|
props: {
|
|
@@ -1553,6 +1556,11 @@ var cmsQueryLoaderMeta = {
|
|
|
1553
1556
|
}
|
|
1554
1557
|
}
|
|
1555
1558
|
};
|
|
1559
|
+
|
|
1560
|
+
function isDatabaseConfigured(config) {
|
|
1561
|
+
return (config == null ? void 0 : config.databaseId) && (config == null ? void 0 : config.databaseToken);
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1556
1564
|
function CmsQueryLoader(_ref5) {
|
|
1557
1565
|
var table = _ref5.table,
|
|
1558
1566
|
children = _ref5.children,
|
|
@@ -1590,27 +1598,35 @@ function CmsQueryLoader(_ref5) {
|
|
|
1590
1598
|
while (1) {
|
|
1591
1599
|
switch (_context2.prev = _context2.next) {
|
|
1592
1600
|
case 0:
|
|
1601
|
+
if (isDatabaseConfigured(databaseConfig)) {
|
|
1602
|
+
_context2.next = 2;
|
|
1603
|
+
break;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
throw new Error("You must specify the CMS ID and API key");
|
|
1607
|
+
|
|
1608
|
+
case 2:
|
|
1593
1609
|
if (table) {
|
|
1594
|
-
_context2.next =
|
|
1610
|
+
_context2.next = 6;
|
|
1595
1611
|
break;
|
|
1596
1612
|
}
|
|
1597
1613
|
|
|
1598
|
-
throw new Error("You must select a
|
|
1614
|
+
throw new Error("You must select a model to query");
|
|
1599
1615
|
|
|
1600
|
-
case
|
|
1616
|
+
case 6:
|
|
1601
1617
|
if (!(tables && !tables.find(function (t) {
|
|
1602
1618
|
return t.identifier === table;
|
|
1603
1619
|
}))) {
|
|
1604
|
-
_context2.next =
|
|
1620
|
+
_context2.next = 8;
|
|
1605
1621
|
break;
|
|
1606
1622
|
}
|
|
1607
1623
|
|
|
1608
|
-
throw new Error("There is no
|
|
1624
|
+
throw new Error("There is no model called \"" + table + "\"");
|
|
1609
1625
|
|
|
1610
|
-
case
|
|
1626
|
+
case 8:
|
|
1611
1627
|
return _context2.abrupt("return", mkApi(databaseConfig).query(table, params));
|
|
1612
1628
|
|
|
1613
|
-
case
|
|
1629
|
+
case 9:
|
|
1614
1630
|
case "end":
|
|
1615
1631
|
return _context2.stop();
|
|
1616
1632
|
}
|
|
@@ -1628,7 +1644,7 @@ function CmsQueryLoader(_ref5) {
|
|
|
1628
1644
|
}
|
|
1629
1645
|
var cmsRowRepeaterMeta = {
|
|
1630
1646
|
name: componentPrefix + "-row-repeater",
|
|
1631
|
-
displayName: "CMS
|
|
1647
|
+
displayName: "CMS Entry Repeater",
|
|
1632
1648
|
importName: "CmsRowRepeater",
|
|
1633
1649
|
importPath: modulePath,
|
|
1634
1650
|
props: {
|
|
@@ -1676,7 +1692,7 @@ function CmsRowRepeater(_ref7) {
|
|
|
1676
1692
|
}
|
|
1677
1693
|
var cmsQueryRepeaterMeta = {
|
|
1678
1694
|
name: componentPrefix + "-query-repeater",
|
|
1679
|
-
displayName: "CMS
|
|
1695
|
+
displayName: "CMS Data Loader",
|
|
1680
1696
|
description: "Fetches CMS data and repeats content of children once for every row fetched.",
|
|
1681
1697
|
importName: "CmsQueryRepeater",
|
|
1682
1698
|
importPath: modulePath,
|
|
@@ -1684,8 +1700,11 @@ var cmsQueryRepeaterMeta = {
|
|
|
1684
1700
|
children: {
|
|
1685
1701
|
type: "slot",
|
|
1686
1702
|
defaultValue: {
|
|
1687
|
-
type: "
|
|
1688
|
-
|
|
1703
|
+
type: "vbox",
|
|
1704
|
+
children: [{
|
|
1705
|
+
type: "component",
|
|
1706
|
+
name: componentPrefix + "-row-field"
|
|
1707
|
+
}]
|
|
1689
1708
|
}
|
|
1690
1709
|
},
|
|
1691
1710
|
table: {
|
|
@@ -1705,7 +1724,10 @@ var cmsQueryRepeaterMeta = {
|
|
|
1705
1724
|
where: {
|
|
1706
1725
|
type: "object",
|
|
1707
1726
|
displayName: "Filter",
|
|
1708
|
-
description: "Filter clause, in JSON format."
|
|
1727
|
+
description: "Filter clause, in JSON format.",
|
|
1728
|
+
hidden: function hidden() {
|
|
1729
|
+
return true;
|
|
1730
|
+
}
|
|
1709
1731
|
},
|
|
1710
1732
|
orderBy: {
|
|
1711
1733
|
type: "choice",
|
|
@@ -1767,27 +1789,43 @@ function CmsQueryRepeater(_ref9) {
|
|
|
1767
1789
|
while (1) {
|
|
1768
1790
|
switch (_context3.prev = _context3.next) {
|
|
1769
1791
|
case 0:
|
|
1792
|
+
if (isDatabaseConfigured(databaseConfig)) {
|
|
1793
|
+
_context3.next = 2;
|
|
1794
|
+
break;
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
throw new Error("You must specify a CMS ID and API key");
|
|
1798
|
+
|
|
1799
|
+
case 2:
|
|
1770
1800
|
if (table) {
|
|
1771
|
-
_context3.next =
|
|
1801
|
+
_context3.next = 6;
|
|
1772
1802
|
break;
|
|
1773
1803
|
}
|
|
1774
1804
|
|
|
1775
|
-
|
|
1805
|
+
if (!(!tables || tables.length === 0)) {
|
|
1806
|
+
_context3.next = 5;
|
|
1807
|
+
break;
|
|
1808
|
+
}
|
|
1776
1809
|
|
|
1777
|
-
|
|
1810
|
+
throw new Error("You must select a model to query");
|
|
1811
|
+
|
|
1812
|
+
case 5:
|
|
1813
|
+
table = tables[0].identifier;
|
|
1814
|
+
|
|
1815
|
+
case 6:
|
|
1778
1816
|
if (!(tables && !tables.find(function (t) {
|
|
1779
1817
|
return t.identifier === table;
|
|
1780
1818
|
}))) {
|
|
1781
|
-
_context3.next =
|
|
1819
|
+
_context3.next = 8;
|
|
1782
1820
|
break;
|
|
1783
1821
|
}
|
|
1784
1822
|
|
|
1785
|
-
throw new Error("There is no
|
|
1823
|
+
throw new Error("There is no model called \"" + table + "\"");
|
|
1786
1824
|
|
|
1787
|
-
case
|
|
1825
|
+
case 8:
|
|
1788
1826
|
return _context3.abrupt("return", mkApi(databaseConfig).query(table, params));
|
|
1789
1827
|
|
|
1790
|
-
case
|
|
1828
|
+
case 9:
|
|
1791
1829
|
case "end":
|
|
1792
1830
|
return _context3.stop();
|
|
1793
1831
|
}
|
|
@@ -1795,6 +1833,10 @@ function CmsQueryRepeater(_ref9) {
|
|
|
1795
1833
|
}, _callee3);
|
|
1796
1834
|
})));
|
|
1797
1835
|
return renderMaybeData(maybeData, function (rows) {
|
|
1836
|
+
if (rows.length === 0) {
|
|
1837
|
+
return React.createElement("div", null, "No matching entries found.");
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1798
1840
|
return React.createElement(QueryResultProvider, {
|
|
1799
1841
|
table: table,
|
|
1800
1842
|
rows: rows
|
|
@@ -1810,7 +1852,7 @@ function CmsQueryRepeater(_ref9) {
|
|
|
1810
1852
|
}
|
|
1811
1853
|
var cmsRowFieldMeta = {
|
|
1812
1854
|
name: componentPrefix + "-row-field",
|
|
1813
|
-
displayName: "CMS
|
|
1855
|
+
displayName: "CMS Entry Field",
|
|
1814
1856
|
importName: "CmsRowField",
|
|
1815
1857
|
importPath: modulePath,
|
|
1816
1858
|
props: {
|
|
@@ -1830,7 +1872,7 @@ var cmsRowFieldMeta = {
|
|
|
1830
1872
|
var _ctx$table;
|
|
1831
1873
|
|
|
1832
1874
|
var table = _ref11.table;
|
|
1833
|
-
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"]);
|
|
1875
|
+
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"]);
|
|
1834
1876
|
}
|
|
1835
1877
|
},
|
|
1836
1878
|
dateFormat: {
|
|
@@ -1919,8 +1961,16 @@ function CmsRowField(_ref13) {
|
|
|
1919
1961
|
var tables = useTables();
|
|
1920
1962
|
var res = useRow(table);
|
|
1921
1963
|
|
|
1922
|
-
if (!res
|
|
1923
|
-
return React.createElement("div",
|
|
1964
|
+
if (!res) {
|
|
1965
|
+
return React.createElement("div", {
|
|
1966
|
+
className: className
|
|
1967
|
+
}, "Field ", table != null ? table : "Unknown Model", ".", field != null ? field : "Unknown Field");
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
if (!res.row) {
|
|
1971
|
+
return React.createElement("div", {
|
|
1972
|
+
className: className
|
|
1973
|
+
}, "Error: No CMS Entry found");
|
|
1924
1974
|
}
|
|
1925
1975
|
|
|
1926
1976
|
if (tables) {
|
|
@@ -1936,11 +1986,11 @@ function CmsRowField(_ref13) {
|
|
|
1936
1986
|
table: res.table,
|
|
1937
1987
|
tables: tables,
|
|
1938
1988
|
field: field,
|
|
1939
|
-
typeFilters: ["text"]
|
|
1989
|
+
typeFilters: ["text", "long-text", "rich-text"]
|
|
1940
1990
|
});
|
|
1941
1991
|
|
|
1942
1992
|
if (!fieldMeta) {
|
|
1943
|
-
|
|
1993
|
+
throw new Error("Please select an entry field to display.");
|
|
1944
1994
|
}
|
|
1945
1995
|
|
|
1946
1996
|
var data = (_res$row$data = res.row.data) == null ? void 0 : _res$row$data[fieldMeta.identifier];
|
|
@@ -2015,7 +2065,7 @@ function renderValue(value, type, props) {
|
|
|
2015
2065
|
|
|
2016
2066
|
var cmsRowLinkMeta = {
|
|
2017
2067
|
name: componentPrefix + "-row-link",
|
|
2018
|
-
displayName: "CMS
|
|
2068
|
+
displayName: "CMS Entry Link",
|
|
2019
2069
|
importName: "CmsRowLink",
|
|
2020
2070
|
importPath: modulePath,
|
|
2021
2071
|
props: {
|
|
@@ -2106,7 +2156,7 @@ function CmsRowLink(_ref15) {
|
|
|
2106
2156
|
}
|
|
2107
2157
|
var cmsRowImageMeta = {
|
|
2108
2158
|
name: componentPrefix + "-row-image",
|
|
2109
|
-
displayName: "CMS
|
|
2159
|
+
displayName: "CMS Entry Image",
|
|
2110
2160
|
importName: "CmsRowImage",
|
|
2111
2161
|
importPath: modulePath,
|
|
2112
2162
|
props: {
|
|
@@ -2202,7 +2252,7 @@ function CmsRowImage(_ref17) {
|
|
|
2202
2252
|
}
|
|
2203
2253
|
var cmsRowFieldValueMeta = {
|
|
2204
2254
|
name: componentPrefix + "-row-value",
|
|
2205
|
-
displayName: "CMS
|
|
2255
|
+
displayName: "CMS Entry Value",
|
|
2206
2256
|
importName: "CmsRowValue",
|
|
2207
2257
|
importPath: modulePath,
|
|
2208
2258
|
props: {
|