@plasmicpkgs/plasmic-cms 0.0.45 → 0.0.48
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/components.d.ts +18 -13
- package/dist/context.d.ts +2 -1
- package/dist/plasmic-cms.cjs.development.js +204 -137
- 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 +204 -137
- package/dist/plasmic-cms.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/plasmic-cms.esm.js
CHANGED
|
@@ -1281,7 +1281,7 @@ function QueryResultProvider(_ref3) {
|
|
|
1281
1281
|
data: rows
|
|
1282
1282
|
}, children);
|
|
1283
1283
|
}
|
|
1284
|
-
function
|
|
1284
|
+
function useTablesWithDataLoaded() {
|
|
1285
1285
|
var env = useDataEnv();
|
|
1286
1286
|
var tables = useTables();
|
|
1287
1287
|
|
|
@@ -1289,39 +1289,33 @@ function useRow(table) {
|
|
|
1289
1289
|
return undefined;
|
|
1290
1290
|
}
|
|
1291
1291
|
|
|
1292
|
-
if (table) {
|
|
1293
|
-
return {
|
|
1294
|
-
table: table,
|
|
1295
|
-
row: env[mkRowContextKey(table)]
|
|
1296
|
-
};
|
|
1297
|
-
}
|
|
1298
|
-
|
|
1299
1292
|
if (!tables) {
|
|
1300
1293
|
return undefined;
|
|
1301
1294
|
}
|
|
1302
1295
|
|
|
1303
1296
|
var matchingKeys = getClosestMatchingKeys(env, rowContextPrefix);
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
var inferredTable = tables.find(function (t) {
|
|
1308
|
-
return mkRowContextKey(t.identifier) === key;
|
|
1297
|
+
return tables.filter(function (table) {
|
|
1298
|
+
return matchingKeys.some(function (key) {
|
|
1299
|
+
return mkRowContextKey(table.identifier) === key;
|
|
1309
1300
|
});
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
function useRow(tables, table) {
|
|
1304
|
+
var env = useDataEnv();
|
|
1310
1305
|
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
table: inferredTable.identifier,
|
|
1315
|
-
row: env[key]
|
|
1316
|
-
}
|
|
1317
|
-
};
|
|
1318
|
-
}
|
|
1319
|
-
};
|
|
1306
|
+
if (!env) {
|
|
1307
|
+
return undefined;
|
|
1308
|
+
}
|
|
1320
1309
|
|
|
1321
|
-
|
|
1322
|
-
|
|
1310
|
+
if (!table && tables && tables.length > 0) {
|
|
1311
|
+
table = tables[0].identifier;
|
|
1312
|
+
}
|
|
1323
1313
|
|
|
1324
|
-
|
|
1314
|
+
if (table) {
|
|
1315
|
+
return {
|
|
1316
|
+
table: table,
|
|
1317
|
+
row: env[mkRowContextKey(table)]
|
|
1318
|
+
};
|
|
1325
1319
|
}
|
|
1326
1320
|
|
|
1327
1321
|
return undefined;
|
|
@@ -1390,7 +1384,7 @@ var fetcherComponentPropMetas = {
|
|
|
1390
1384
|
}
|
|
1391
1385
|
};
|
|
1392
1386
|
|
|
1393
|
-
function renderMaybeData(maybeData, renderFn, loaderProps) {
|
|
1387
|
+
function renderMaybeData(maybeData, renderFn, loaderProps, loadingMessage, forceLoadingState) {
|
|
1394
1388
|
if ("error" in maybeData) {
|
|
1395
1389
|
var error = maybeData.error;
|
|
1396
1390
|
|
|
@@ -1405,8 +1399,8 @@ function renderMaybeData(maybeData, renderFn, loaderProps) {
|
|
|
1405
1399
|
}
|
|
1406
1400
|
}
|
|
1407
1401
|
|
|
1408
|
-
if (!("data" in maybeData)) {
|
|
1409
|
-
return React.createElement("div", null, "Loading...");
|
|
1402
|
+
if (!("data" in maybeData) || forceLoadingState) {
|
|
1403
|
+
return React.createElement(React.Fragment, null, loadingMessage != null ? loadingMessage : React.createElement("div", null, "Loading..."));
|
|
1410
1404
|
}
|
|
1411
1405
|
|
|
1412
1406
|
return renderFn(maybeData.data);
|
|
@@ -1693,6 +1687,7 @@ var cmsQueryRepeaterMeta = {
|
|
|
1693
1687
|
props: {
|
|
1694
1688
|
children: {
|
|
1695
1689
|
type: "slot",
|
|
1690
|
+
isRepeated: true,
|
|
1696
1691
|
defaultValue: {
|
|
1697
1692
|
type: "vbox",
|
|
1698
1693
|
children: [{
|
|
@@ -1707,6 +1702,9 @@ var cmsQueryRepeaterMeta = {
|
|
|
1707
1702
|
description: "CMS model (table) to query.",
|
|
1708
1703
|
options: function options(_, ctx) {
|
|
1709
1704
|
return mkTableOptions(ctx == null ? void 0 : ctx.tables);
|
|
1705
|
+
},
|
|
1706
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
1707
|
+
return ctx == null ? void 0 : ctx.table;
|
|
1710
1708
|
}
|
|
1711
1709
|
},
|
|
1712
1710
|
useDraft: {
|
|
@@ -1727,9 +1725,8 @@ var cmsQueryRepeaterMeta = {
|
|
|
1727
1725
|
type: "choice",
|
|
1728
1726
|
displayName: "Order by",
|
|
1729
1727
|
description: "Field to order by.",
|
|
1730
|
-
options: function options(
|
|
1731
|
-
|
|
1732
|
-
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, table);
|
|
1728
|
+
options: function options(_, ctx) {
|
|
1729
|
+
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, ctx == null ? void 0 : ctx.table);
|
|
1733
1730
|
}
|
|
1734
1731
|
},
|
|
1735
1732
|
desc: {
|
|
@@ -1743,28 +1740,50 @@ var cmsQueryRepeaterMeta = {
|
|
|
1743
1740
|
displayName: "Limit",
|
|
1744
1741
|
description: "Maximum number of entries to fetch (0 for unlimited).",
|
|
1745
1742
|
defaultValue: 0
|
|
1743
|
+
},
|
|
1744
|
+
emptyMessage: {
|
|
1745
|
+
type: "slot",
|
|
1746
|
+
defaultValue: {
|
|
1747
|
+
type: "text",
|
|
1748
|
+
value: "No matching entries found."
|
|
1749
|
+
}
|
|
1750
|
+
},
|
|
1751
|
+
forceEmptyState: {
|
|
1752
|
+
type: "boolean",
|
|
1753
|
+
displayName: "Force empty state",
|
|
1754
|
+
description: "If set, will render as if no matching entries were found.",
|
|
1755
|
+
defaultValue: false
|
|
1756
|
+
},
|
|
1757
|
+
loadingMessage: {
|
|
1758
|
+
type: "slot",
|
|
1759
|
+
defaultValue: {
|
|
1760
|
+
type: "text",
|
|
1761
|
+
value: "Loading..."
|
|
1762
|
+
}
|
|
1763
|
+
},
|
|
1764
|
+
forceLoadingState: {
|
|
1765
|
+
type: "boolean",
|
|
1766
|
+
displayName: "Force loading state",
|
|
1767
|
+
description: "If set, will render as if it is waiting for the query to run.",
|
|
1768
|
+
defaultValue: false
|
|
1746
1769
|
}
|
|
1747
1770
|
}
|
|
1748
1771
|
};
|
|
1749
|
-
function CmsQueryRepeater(
|
|
1750
|
-
var table =
|
|
1751
|
-
children =
|
|
1752
|
-
setControlContextData =
|
|
1753
|
-
where =
|
|
1754
|
-
useDraft =
|
|
1755
|
-
orderBy =
|
|
1756
|
-
desc =
|
|
1757
|
-
limit =
|
|
1772
|
+
function CmsQueryRepeater(_ref8) {
|
|
1773
|
+
var table = _ref8.table,
|
|
1774
|
+
children = _ref8.children,
|
|
1775
|
+
setControlContextData = _ref8.setControlContextData,
|
|
1776
|
+
where = _ref8.where,
|
|
1777
|
+
useDraft = _ref8.useDraft,
|
|
1778
|
+
orderBy = _ref8.orderBy,
|
|
1779
|
+
desc = _ref8.desc,
|
|
1780
|
+
limit = _ref8.limit,
|
|
1781
|
+
emptyMessage = _ref8.emptyMessage,
|
|
1782
|
+
forceEmptyState = _ref8.forceEmptyState,
|
|
1783
|
+
loadingMessage = _ref8.loadingMessage,
|
|
1784
|
+
forceLoadingState = _ref8.forceLoadingState;
|
|
1758
1785
|
var databaseConfig = useDatabase();
|
|
1759
1786
|
var tables = useTables();
|
|
1760
|
-
|
|
1761
|
-
if (tables) {
|
|
1762
|
-
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
1763
|
-
setControlContextData == null ? void 0 : setControlContextData({
|
|
1764
|
-
tables: tables
|
|
1765
|
-
});
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
1787
|
var params = {
|
|
1769
1788
|
where: where,
|
|
1770
1789
|
useDraft: useDraft,
|
|
@@ -1783,6 +1802,14 @@ function CmsQueryRepeater(_ref9) {
|
|
|
1783
1802
|
table = tables[0].identifier;
|
|
1784
1803
|
}
|
|
1785
1804
|
|
|
1805
|
+
if (tables) {
|
|
1806
|
+
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
1807
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
1808
|
+
tables: tables,
|
|
1809
|
+
table: table
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1786
1813
|
var maybeData = usePlasmicQueryData(cacheKey, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
1787
1814
|
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1788
1815
|
while (1) {
|
|
@@ -1824,8 +1851,8 @@ function CmsQueryRepeater(_ref9) {
|
|
|
1824
1851
|
}, _callee3);
|
|
1825
1852
|
})));
|
|
1826
1853
|
return renderMaybeData(maybeData, function (rows) {
|
|
1827
|
-
if (rows.length === 0) {
|
|
1828
|
-
return React.createElement(
|
|
1854
|
+
if (rows.length === 0 || forceEmptyState) {
|
|
1855
|
+
return React.createElement(React.Fragment, null, " ", emptyMessage, " ");
|
|
1829
1856
|
}
|
|
1830
1857
|
|
|
1831
1858
|
return React.createElement(QueryResultProvider, {
|
|
@@ -1839,7 +1866,7 @@ function CmsQueryRepeater(_ref9) {
|
|
|
1839
1866
|
}));
|
|
1840
1867
|
}, {
|
|
1841
1868
|
hideIfNotFound: false
|
|
1842
|
-
});
|
|
1869
|
+
}, loadingMessage, forceLoadingState);
|
|
1843
1870
|
}
|
|
1844
1871
|
var cmsRowFieldMeta = {
|
|
1845
1872
|
name: componentPrefix + "-row-field",
|
|
@@ -1853,24 +1880,32 @@ var cmsRowFieldMeta = {
|
|
|
1853
1880
|
description: "CMS model (table) to use.",
|
|
1854
1881
|
options: function options(_, ctx) {
|
|
1855
1882
|
return mkTableOptions(ctx == null ? void 0 : ctx.tables);
|
|
1883
|
+
},
|
|
1884
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
1885
|
+
return ctx == null ? void 0 : ctx.table;
|
|
1856
1886
|
}
|
|
1857
1887
|
},
|
|
1858
1888
|
field: {
|
|
1859
1889
|
type: "choice",
|
|
1860
1890
|
displayName: "Field",
|
|
1861
1891
|
description: "Field (from model schema) to use.",
|
|
1862
|
-
options: function options(
|
|
1892
|
+
options: function options(_ref10, ctx) {
|
|
1863
1893
|
var _ctx$table;
|
|
1864
1894
|
|
|
1865
|
-
var table =
|
|
1895
|
+
var table = _ref10.table;
|
|
1866
1896
|
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"]);
|
|
1897
|
+
},
|
|
1898
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
1899
|
+
var _ctx$fieldMeta, _ctx$fieldMeta2;
|
|
1900
|
+
|
|
1901
|
+
return (ctx == null ? void 0 : (_ctx$fieldMeta = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta.name) || (ctx == null ? void 0 : (_ctx$fieldMeta2 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta2.identifier);
|
|
1867
1902
|
}
|
|
1868
1903
|
},
|
|
1869
1904
|
dateFormat: {
|
|
1870
1905
|
type: "choice",
|
|
1871
1906
|
displayName: "Date Format",
|
|
1872
|
-
hidden: function hidden(
|
|
1873
|
-
var field =
|
|
1907
|
+
hidden: function hidden(_ref11, ctx) {
|
|
1908
|
+
var field = _ref11.field;
|
|
1874
1909
|
|
|
1875
1910
|
if (!ctx) {
|
|
1876
1911
|
return true;
|
|
@@ -1939,18 +1974,18 @@ var cmsRowFieldMeta = {
|
|
|
1939
1974
|
}
|
|
1940
1975
|
}
|
|
1941
1976
|
};
|
|
1942
|
-
function CmsRowField(
|
|
1977
|
+
function CmsRowField(_ref12) {
|
|
1943
1978
|
var _res$row$data;
|
|
1944
1979
|
|
|
1945
|
-
var className =
|
|
1946
|
-
table =
|
|
1947
|
-
field =
|
|
1948
|
-
dateFormat =
|
|
1949
|
-
setControlContextData =
|
|
1950
|
-
rest = _objectWithoutPropertiesLoose(
|
|
1980
|
+
var className = _ref12.className,
|
|
1981
|
+
table = _ref12.table,
|
|
1982
|
+
field = _ref12.field,
|
|
1983
|
+
dateFormat = _ref12.dateFormat,
|
|
1984
|
+
setControlContextData = _ref12.setControlContextData,
|
|
1985
|
+
rest = _objectWithoutPropertiesLoose(_ref12, _excluded2);
|
|
1951
1986
|
|
|
1952
|
-
var tables =
|
|
1953
|
-
var res = useRow(table);
|
|
1987
|
+
var tables = useTablesWithDataLoaded();
|
|
1988
|
+
var res = useRow(tables, table);
|
|
1954
1989
|
|
|
1955
1990
|
if (!res) {
|
|
1956
1991
|
return React.createElement("div", {
|
|
@@ -1964,22 +1999,23 @@ function CmsRowField(_ref13) {
|
|
|
1964
1999
|
}, "Error: No CMS Entry found");
|
|
1965
2000
|
}
|
|
1966
2001
|
|
|
2002
|
+
var fieldMeta = deriveInferredTableField({
|
|
2003
|
+
table: res.table,
|
|
2004
|
+
tables: tables,
|
|
2005
|
+
field: field,
|
|
2006
|
+
typeFilters: ["text", "long-text", "rich-text"]
|
|
2007
|
+
});
|
|
2008
|
+
|
|
1967
2009
|
if (tables) {
|
|
1968
2010
|
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
1969
2011
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
1970
2012
|
tables: tables,
|
|
1971
2013
|
table: res.table,
|
|
1972
|
-
row: res.row
|
|
2014
|
+
row: res.row,
|
|
2015
|
+
fieldMeta: fieldMeta
|
|
1973
2016
|
});
|
|
1974
2017
|
}
|
|
1975
2018
|
|
|
1976
|
-
var fieldMeta = deriveInferredTableField({
|
|
1977
|
-
table: res.table,
|
|
1978
|
-
tables: tables,
|
|
1979
|
-
field: field,
|
|
1980
|
-
typeFilters: ["text", "long-text", "rich-text"]
|
|
1981
|
-
});
|
|
1982
|
-
|
|
1983
2019
|
if (!fieldMeta) {
|
|
1984
2020
|
throw new Error("Please select an entry field to display.");
|
|
1985
2021
|
}
|
|
@@ -2007,6 +2043,7 @@ function deriveInferredTableField(opts) {
|
|
|
2007
2043
|
tables = opts.tables,
|
|
2008
2044
|
field = opts.field,
|
|
2009
2045
|
typeFilters = opts.typeFilters;
|
|
2046
|
+
if (!table) return undefined;
|
|
2010
2047
|
var schema = tables == null ? void 0 : (_tables$find = tables.find(function (t) {
|
|
2011
2048
|
return t.identifier === table;
|
|
2012
2049
|
})) == null ? void 0 : _tables$find.schema;
|
|
@@ -2074,17 +2111,25 @@ var cmsRowLinkMeta = {
|
|
|
2074
2111
|
description: "CMS model (table) to use.",
|
|
2075
2112
|
options: function options(_, ctx) {
|
|
2076
2113
|
return mkTableOptions(ctx == null ? void 0 : ctx.tables);
|
|
2114
|
+
},
|
|
2115
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
2116
|
+
return ctx == null ? void 0 : ctx.table;
|
|
2077
2117
|
}
|
|
2078
2118
|
},
|
|
2079
2119
|
field: {
|
|
2080
2120
|
type: "choice",
|
|
2081
2121
|
displayName: "Field",
|
|
2082
2122
|
description: "Field (from model schema) to use.",
|
|
2083
|
-
options: function options(
|
|
2123
|
+
options: function options(_ref13, ctx) {
|
|
2084
2124
|
var _ctx$table2;
|
|
2085
2125
|
|
|
2086
|
-
var table =
|
|
2126
|
+
var table = _ref13.table;
|
|
2087
2127
|
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table2 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table2 : table);
|
|
2128
|
+
},
|
|
2129
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
2130
|
+
var _ctx$fieldMeta3, _ctx$fieldMeta4;
|
|
2131
|
+
|
|
2132
|
+
return (ctx == null ? void 0 : (_ctx$fieldMeta3 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta3.name) || (ctx == null ? void 0 : (_ctx$fieldMeta4 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta4.identifier);
|
|
2088
2133
|
}
|
|
2089
2134
|
},
|
|
2090
2135
|
hrefProp: {
|
|
@@ -2105,31 +2150,23 @@ var cmsRowLinkMeta = {
|
|
|
2105
2150
|
}
|
|
2106
2151
|
}
|
|
2107
2152
|
};
|
|
2108
|
-
function CmsRowLink(
|
|
2153
|
+
function CmsRowLink(_ref14) {
|
|
2109
2154
|
var _res$row$data2;
|
|
2110
2155
|
|
|
2111
|
-
var table =
|
|
2112
|
-
field =
|
|
2113
|
-
hrefProp =
|
|
2114
|
-
children =
|
|
2115
|
-
setControlContextData =
|
|
2116
|
-
prefix =
|
|
2117
|
-
suffix =
|
|
2118
|
-
var tables =
|
|
2119
|
-
var res = useRow(table);
|
|
2156
|
+
var table = _ref14.table,
|
|
2157
|
+
field = _ref14.field,
|
|
2158
|
+
hrefProp = _ref14.hrefProp,
|
|
2159
|
+
children = _ref14.children,
|
|
2160
|
+
setControlContextData = _ref14.setControlContextData,
|
|
2161
|
+
prefix = _ref14.prefix,
|
|
2162
|
+
suffix = _ref14.suffix;
|
|
2163
|
+
var tables = useTablesWithDataLoaded();
|
|
2164
|
+
var res = useRow(tables, table);
|
|
2120
2165
|
|
|
2121
2166
|
if (!res || !res.row) {
|
|
2122
2167
|
return React.createElement(React.Fragment, null, children);
|
|
2123
2168
|
}
|
|
2124
2169
|
|
|
2125
|
-
if (tables) {
|
|
2126
|
-
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
2127
|
-
setControlContextData == null ? void 0 : setControlContextData({
|
|
2128
|
-
tables: tables,
|
|
2129
|
-
table: res.table
|
|
2130
|
-
});
|
|
2131
|
-
}
|
|
2132
|
-
|
|
2133
2170
|
var fieldMeta = deriveInferredTableField({
|
|
2134
2171
|
table: res.table,
|
|
2135
2172
|
tables: tables,
|
|
@@ -2137,6 +2174,16 @@ function CmsRowLink(_ref15) {
|
|
|
2137
2174
|
typeFilters: ["text"]
|
|
2138
2175
|
});
|
|
2139
2176
|
|
|
2177
|
+
if (tables) {
|
|
2178
|
+
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
2179
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
2180
|
+
tables: tables,
|
|
2181
|
+
table: res.table,
|
|
2182
|
+
row: res.row,
|
|
2183
|
+
fieldMeta: fieldMeta
|
|
2184
|
+
});
|
|
2185
|
+
}
|
|
2186
|
+
|
|
2140
2187
|
if (!fieldMeta) {
|
|
2141
2188
|
return React.createElement(React.Fragment, null, children);
|
|
2142
2189
|
}
|
|
@@ -2176,17 +2223,25 @@ var cmsRowImageMeta = {
|
|
|
2176
2223
|
description: "CMS model (table) to use.",
|
|
2177
2224
|
options: function options(_, ctx) {
|
|
2178
2225
|
return mkTableOptions(ctx == null ? void 0 : ctx.tables);
|
|
2226
|
+
},
|
|
2227
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
2228
|
+
return ctx == null ? void 0 : ctx.table;
|
|
2179
2229
|
}
|
|
2180
2230
|
},
|
|
2181
2231
|
field: {
|
|
2182
2232
|
type: "choice",
|
|
2183
2233
|
displayName: "Field",
|
|
2184
2234
|
description: "Field (from model schema) to use.",
|
|
2185
|
-
options: function options(
|
|
2235
|
+
options: function options(_ref15, ctx) {
|
|
2186
2236
|
var _ctx$table3;
|
|
2187
2237
|
|
|
2188
|
-
var table =
|
|
2189
|
-
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table3 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table3 : table);
|
|
2238
|
+
var table = _ref15.table;
|
|
2239
|
+
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table3 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table3 : table, ["image"]);
|
|
2240
|
+
},
|
|
2241
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
2242
|
+
var _ctx$fieldMeta5, _ctx$fieldMeta6;
|
|
2243
|
+
|
|
2244
|
+
return (ctx == null ? void 0 : (_ctx$fieldMeta5 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta5.name) || (ctx == null ? void 0 : (_ctx$fieldMeta6 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta6.identifier);
|
|
2190
2245
|
}
|
|
2191
2246
|
},
|
|
2192
2247
|
srcProp: {
|
|
@@ -2197,29 +2252,21 @@ var cmsRowImageMeta = {
|
|
|
2197
2252
|
}
|
|
2198
2253
|
}
|
|
2199
2254
|
};
|
|
2200
|
-
function CmsRowImage(
|
|
2255
|
+
function CmsRowImage(_ref16) {
|
|
2201
2256
|
var _res$row$data3;
|
|
2202
2257
|
|
|
2203
|
-
var table =
|
|
2204
|
-
field =
|
|
2205
|
-
srcProp =
|
|
2206
|
-
children =
|
|
2207
|
-
setControlContextData =
|
|
2208
|
-
var tables =
|
|
2209
|
-
var res = useRow(table);
|
|
2258
|
+
var table = _ref16.table,
|
|
2259
|
+
field = _ref16.field,
|
|
2260
|
+
srcProp = _ref16.srcProp,
|
|
2261
|
+
children = _ref16.children,
|
|
2262
|
+
setControlContextData = _ref16.setControlContextData;
|
|
2263
|
+
var tables = useTablesWithDataLoaded();
|
|
2264
|
+
var res = useRow(tables, table);
|
|
2210
2265
|
|
|
2211
2266
|
if (!res || !res.row) {
|
|
2212
2267
|
return React.createElement(React.Fragment, null, children);
|
|
2213
2268
|
}
|
|
2214
2269
|
|
|
2215
|
-
if (tables) {
|
|
2216
|
-
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
2217
|
-
setControlContextData == null ? void 0 : setControlContextData({
|
|
2218
|
-
tables: tables,
|
|
2219
|
-
table: res.table
|
|
2220
|
-
});
|
|
2221
|
-
}
|
|
2222
|
-
|
|
2223
2270
|
var fieldMeta = deriveInferredTableField({
|
|
2224
2271
|
table: res.table,
|
|
2225
2272
|
tables: tables,
|
|
@@ -2227,6 +2274,16 @@ function CmsRowImage(_ref17) {
|
|
|
2227
2274
|
typeFilters: ["image"]
|
|
2228
2275
|
});
|
|
2229
2276
|
|
|
2277
|
+
if (tables) {
|
|
2278
|
+
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
2279
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
2280
|
+
tables: tables,
|
|
2281
|
+
table: res.table,
|
|
2282
|
+
row: res.row,
|
|
2283
|
+
fieldMeta: fieldMeta
|
|
2284
|
+
});
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2230
2287
|
if (!fieldMeta) {
|
|
2231
2288
|
return React.createElement(React.Fragment, null, children);
|
|
2232
2289
|
}
|
|
@@ -2268,17 +2325,25 @@ var cmsRowFieldValueMeta = {
|
|
|
2268
2325
|
description: "CMS model (table) to use.",
|
|
2269
2326
|
options: function options(_, ctx) {
|
|
2270
2327
|
return mkTableOptions(ctx == null ? void 0 : ctx.tables);
|
|
2328
|
+
},
|
|
2329
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
2330
|
+
return ctx == null ? void 0 : ctx.table;
|
|
2271
2331
|
}
|
|
2272
2332
|
},
|
|
2273
2333
|
field: {
|
|
2274
2334
|
type: "choice",
|
|
2275
2335
|
displayName: "Field",
|
|
2276
2336
|
description: "Field (from model schema) to use.",
|
|
2277
|
-
options: function options(
|
|
2337
|
+
options: function options(_ref17, ctx) {
|
|
2278
2338
|
var _ctx$table4;
|
|
2279
2339
|
|
|
2280
|
-
var table =
|
|
2340
|
+
var table = _ref17.table;
|
|
2281
2341
|
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table4 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table4 : table);
|
|
2342
|
+
},
|
|
2343
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
2344
|
+
var _ctx$fieldMeta7, _ctx$fieldMeta8;
|
|
2345
|
+
|
|
2346
|
+
return (ctx == null ? void 0 : (_ctx$fieldMeta7 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta7.name) || (ctx == null ? void 0 : (_ctx$fieldMeta8 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta8.identifier);
|
|
2282
2347
|
}
|
|
2283
2348
|
},
|
|
2284
2349
|
valueProp: {
|
|
@@ -2289,31 +2354,23 @@ var cmsRowFieldValueMeta = {
|
|
|
2289
2354
|
}
|
|
2290
2355
|
}
|
|
2291
2356
|
};
|
|
2292
|
-
function CmsRowFieldValue(
|
|
2357
|
+
function CmsRowFieldValue(_ref18) {
|
|
2293
2358
|
var _res$row$data4;
|
|
2294
2359
|
|
|
2295
|
-
var table =
|
|
2296
|
-
field =
|
|
2297
|
-
valueProp =
|
|
2298
|
-
children =
|
|
2299
|
-
setControlContextData =
|
|
2300
|
-
rest = _objectWithoutPropertiesLoose(
|
|
2360
|
+
var table = _ref18.table,
|
|
2361
|
+
field = _ref18.field,
|
|
2362
|
+
valueProp = _ref18.valueProp,
|
|
2363
|
+
children = _ref18.children,
|
|
2364
|
+
setControlContextData = _ref18.setControlContextData,
|
|
2365
|
+
rest = _objectWithoutPropertiesLoose(_ref18, _excluded3);
|
|
2301
2366
|
|
|
2302
|
-
var tables =
|
|
2303
|
-
var res = useRow(table);
|
|
2367
|
+
var tables = useTablesWithDataLoaded();
|
|
2368
|
+
var res = useRow(tables, table);
|
|
2304
2369
|
|
|
2305
2370
|
if (!res || !res.row) {
|
|
2306
2371
|
return React.createElement(React.Fragment, null, children);
|
|
2307
2372
|
}
|
|
2308
2373
|
|
|
2309
|
-
if (tables) {
|
|
2310
|
-
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
2311
|
-
setControlContextData == null ? void 0 : setControlContextData({
|
|
2312
|
-
tables: tables,
|
|
2313
|
-
table: res.table
|
|
2314
|
-
});
|
|
2315
|
-
}
|
|
2316
|
-
|
|
2317
2374
|
var fieldMeta = deriveInferredTableField({
|
|
2318
2375
|
table: res.table,
|
|
2319
2376
|
tables: tables,
|
|
@@ -2321,6 +2378,16 @@ function CmsRowFieldValue(_ref19) {
|
|
|
2321
2378
|
typeFilters: ["text"]
|
|
2322
2379
|
});
|
|
2323
2380
|
|
|
2381
|
+
if (tables) {
|
|
2382
|
+
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
2383
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
2384
|
+
tables: tables,
|
|
2385
|
+
table: res.table,
|
|
2386
|
+
row: res.row,
|
|
2387
|
+
fieldMeta: fieldMeta
|
|
2388
|
+
});
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2324
2391
|
if (!fieldMeta) {
|
|
2325
2392
|
return React.createElement(React.Fragment, null, children);
|
|
2326
2393
|
}
|
|
@@ -2371,13 +2438,13 @@ var cmsRowLoaderMeta = {
|
|
|
2371
2438
|
}
|
|
2372
2439
|
}, fetcherComponentPropMetas)
|
|
2373
2440
|
};
|
|
2374
|
-
function CmsRowLoader(
|
|
2375
|
-
var table =
|
|
2376
|
-
row =
|
|
2377
|
-
children =
|
|
2378
|
-
useDraft =
|
|
2379
|
-
hideIfNotFound =
|
|
2380
|
-
setControlContextData =
|
|
2441
|
+
function CmsRowLoader(_ref19) {
|
|
2442
|
+
var table = _ref19.table,
|
|
2443
|
+
row = _ref19.row,
|
|
2444
|
+
children = _ref19.children,
|
|
2445
|
+
useDraft = _ref19.useDraft,
|
|
2446
|
+
hideIfNotFound = _ref19.hideIfNotFound,
|
|
2447
|
+
setControlContextData = _ref19.setControlContextData;
|
|
2381
2448
|
var databaseConfig = useDatabase();
|
|
2382
2449
|
var tables = useTables();
|
|
2383
2450
|
|