@plasmicpkgs/plasmic-cms 0.0.46 → 0.0.47
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 +2 -2
package/dist/components.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { CanvasComponentProps, ComponentMeta } from "@plasmicapp/host/registerCo
|
|
|
2
2
|
import { GlobalContextMeta } from "@plasmicapp/host/registerGlobalContext";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { DatabaseConfig, QueryParams } from "./api";
|
|
5
|
-
import { ApiCmsRow, ApiCmsTable } from "./schema";
|
|
5
|
+
import { ApiCmsRow, ApiCmsTable, CmsFieldMeta } from "./schema";
|
|
6
6
|
interface FetcherComponentProps {
|
|
7
7
|
hideIfNotFound?: boolean;
|
|
8
8
|
}
|
|
@@ -14,6 +14,13 @@ export declare function CmsCredentialsProvider({ children, ...config }: CmsCrede
|
|
|
14
14
|
declare type TablesContextData = {
|
|
15
15
|
tables?: ApiCmsTable[];
|
|
16
16
|
};
|
|
17
|
+
interface TableContextData extends TablesContextData {
|
|
18
|
+
table?: string;
|
|
19
|
+
}
|
|
20
|
+
interface RowContextData extends TableContextData {
|
|
21
|
+
row: ApiCmsRow;
|
|
22
|
+
fieldMeta?: CmsFieldMeta;
|
|
23
|
+
}
|
|
17
24
|
interface CmsQueryLoaderProps extends QueryParams, CanvasComponentProps<TablesContextData> {
|
|
18
25
|
children?: React.ReactNode;
|
|
19
26
|
table?: string;
|
|
@@ -26,16 +33,17 @@ interface CmsRowRepeaterProps extends CanvasComponentProps<TablesContextData> {
|
|
|
26
33
|
}
|
|
27
34
|
export declare const cmsRowRepeaterMeta: ComponentMeta<CmsRowRepeaterProps>;
|
|
28
35
|
export declare function CmsRowRepeater({ table, children, setControlContextData, }: CmsRowRepeaterProps): JSX.Element;
|
|
29
|
-
interface CmsQueryRepeaterProps extends QueryParams, CanvasComponentProps<
|
|
36
|
+
interface CmsQueryRepeaterProps extends QueryParams, CanvasComponentProps<TableContextData> {
|
|
30
37
|
children?: React.ReactNode;
|
|
31
38
|
table?: string;
|
|
39
|
+
emptyMessage?: React.ReactNode;
|
|
40
|
+
forceEmptyState?: boolean;
|
|
41
|
+
loadingMessage?: React.ReactNode;
|
|
42
|
+
forceLoadingState?: boolean;
|
|
32
43
|
}
|
|
33
44
|
export declare const cmsQueryRepeaterMeta: ComponentMeta<CmsQueryRepeaterProps>;
|
|
34
|
-
export declare function CmsQueryRepeater({ table, children, setControlContextData, where, useDraft, orderBy, desc, limit, }:
|
|
35
|
-
interface CmsRowFieldProps extends CanvasComponentProps<
|
|
36
|
-
table: string;
|
|
37
|
-
row: ApiCmsRow;
|
|
38
|
-
}> {
|
|
45
|
+
export declare function CmsQueryRepeater({ table, children, setControlContextData, where, useDraft, orderBy, desc, limit, emptyMessage, forceEmptyState, loadingMessage, forceLoadingState, }: CmsQueryRepeaterProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | null;
|
|
46
|
+
interface CmsRowFieldProps extends CanvasComponentProps<RowContextData> {
|
|
39
47
|
table?: string;
|
|
40
48
|
field?: string;
|
|
41
49
|
className?: string;
|
|
@@ -43,10 +51,7 @@ interface CmsRowFieldProps extends CanvasComponentProps<TablesContextData & {
|
|
|
43
51
|
}
|
|
44
52
|
export declare const cmsRowFieldMeta: ComponentMeta<CmsRowFieldProps>;
|
|
45
53
|
export declare function CmsRowField({ className, table, field, dateFormat, setControlContextData, ...rest }: CmsRowFieldProps): JSX.Element | null;
|
|
46
|
-
interface
|
|
47
|
-
table?: string;
|
|
48
|
-
}
|
|
49
|
-
interface CmsRowLinkProps extends CanvasComponentProps<TableContextData> {
|
|
54
|
+
interface CmsRowLinkProps extends CanvasComponentProps<RowContextData> {
|
|
50
55
|
table: string;
|
|
51
56
|
field: string;
|
|
52
57
|
hrefProp: string;
|
|
@@ -56,7 +61,7 @@ interface CmsRowLinkProps extends CanvasComponentProps<TableContextData> {
|
|
|
56
61
|
}
|
|
57
62
|
export declare const cmsRowLinkMeta: ComponentMeta<CmsRowLinkProps>;
|
|
58
63
|
export declare function CmsRowLink({ table, field, hrefProp, children, setControlContextData, prefix, suffix, }: CmsRowLinkProps): React.ReactElement | null;
|
|
59
|
-
interface CmsRowImageProps extends CanvasComponentProps<
|
|
64
|
+
interface CmsRowImageProps extends CanvasComponentProps<RowContextData> {
|
|
60
65
|
table: string;
|
|
61
66
|
field: string;
|
|
62
67
|
srcProp: string;
|
|
@@ -64,7 +69,7 @@ interface CmsRowImageProps extends CanvasComponentProps<TableContextData> {
|
|
|
64
69
|
}
|
|
65
70
|
export declare const cmsRowImageMeta: ComponentMeta<CmsRowImageProps>;
|
|
66
71
|
export declare function CmsRowImage({ table, field, srcProp, children, setControlContextData, }: CmsRowImageProps): React.ReactElement | null;
|
|
67
|
-
interface CmsRowFieldValueProps extends CanvasComponentProps<
|
|
72
|
+
interface CmsRowFieldValueProps extends CanvasComponentProps<RowContextData> {
|
|
68
73
|
table: string;
|
|
69
74
|
field: string;
|
|
70
75
|
valueProp: string;
|
package/dist/context.d.ts
CHANGED
|
@@ -20,7 +20,8 @@ export declare function QueryResultProvider({ children, table, rows, }: {
|
|
|
20
20
|
table: string;
|
|
21
21
|
rows: ApiCmsRow[];
|
|
22
22
|
}): JSX.Element;
|
|
23
|
-
export declare function
|
|
23
|
+
export declare function useTablesWithDataLoaded(): ApiCmsTable[] | undefined;
|
|
24
|
+
export declare function useRow(tables?: ApiCmsTable[], table?: string): {
|
|
24
25
|
table: string;
|
|
25
26
|
row: ApiCmsRow | undefined;
|
|
26
27
|
} | undefined;
|
|
@@ -1287,7 +1287,7 @@ function QueryResultProvider(_ref3) {
|
|
|
1287
1287
|
data: rows
|
|
1288
1288
|
}, children);
|
|
1289
1289
|
}
|
|
1290
|
-
function
|
|
1290
|
+
function useTablesWithDataLoaded() {
|
|
1291
1291
|
var env = host.useDataEnv();
|
|
1292
1292
|
var tables = useTables();
|
|
1293
1293
|
|
|
@@ -1295,39 +1295,33 @@ function useRow(table) {
|
|
|
1295
1295
|
return undefined;
|
|
1296
1296
|
}
|
|
1297
1297
|
|
|
1298
|
-
if (table) {
|
|
1299
|
-
return {
|
|
1300
|
-
table: table,
|
|
1301
|
-
row: env[mkRowContextKey(table)]
|
|
1302
|
-
};
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
1298
|
if (!tables) {
|
|
1306
1299
|
return undefined;
|
|
1307
1300
|
}
|
|
1308
1301
|
|
|
1309
1302
|
var matchingKeys = getClosestMatchingKeys(env, rowContextPrefix);
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
var inferredTable = tables.find(function (t) {
|
|
1314
|
-
return mkRowContextKey(t.identifier) === key;
|
|
1303
|
+
return tables.filter(function (table) {
|
|
1304
|
+
return matchingKeys.some(function (key) {
|
|
1305
|
+
return mkRowContextKey(table.identifier) === key;
|
|
1315
1306
|
});
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
function useRow(tables, table) {
|
|
1310
|
+
var env = host.useDataEnv();
|
|
1316
1311
|
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
table: inferredTable.identifier,
|
|
1321
|
-
row: env[key]
|
|
1322
|
-
}
|
|
1323
|
-
};
|
|
1324
|
-
}
|
|
1325
|
-
};
|
|
1312
|
+
if (!env) {
|
|
1313
|
+
return undefined;
|
|
1314
|
+
}
|
|
1326
1315
|
|
|
1327
|
-
|
|
1328
|
-
|
|
1316
|
+
if (!table && tables && tables.length > 0) {
|
|
1317
|
+
table = tables[0].identifier;
|
|
1318
|
+
}
|
|
1329
1319
|
|
|
1330
|
-
|
|
1320
|
+
if (table) {
|
|
1321
|
+
return {
|
|
1322
|
+
table: table,
|
|
1323
|
+
row: env[mkRowContextKey(table)]
|
|
1324
|
+
};
|
|
1331
1325
|
}
|
|
1332
1326
|
|
|
1333
1327
|
return undefined;
|
|
@@ -1396,7 +1390,7 @@ var fetcherComponentPropMetas = {
|
|
|
1396
1390
|
}
|
|
1397
1391
|
};
|
|
1398
1392
|
|
|
1399
|
-
function renderMaybeData(maybeData, renderFn, loaderProps) {
|
|
1393
|
+
function renderMaybeData(maybeData, renderFn, loaderProps, loadingMessage, forceLoadingState) {
|
|
1400
1394
|
if ("error" in maybeData) {
|
|
1401
1395
|
var error = maybeData.error;
|
|
1402
1396
|
|
|
@@ -1411,8 +1405,8 @@ function renderMaybeData(maybeData, renderFn, loaderProps) {
|
|
|
1411
1405
|
}
|
|
1412
1406
|
}
|
|
1413
1407
|
|
|
1414
|
-
if (!("data" in maybeData)) {
|
|
1415
|
-
return React.createElement("div", null, "Loading...");
|
|
1408
|
+
if (!("data" in maybeData) || forceLoadingState) {
|
|
1409
|
+
return React.createElement(React.Fragment, null, loadingMessage != null ? loadingMessage : React.createElement("div", null, "Loading..."));
|
|
1416
1410
|
}
|
|
1417
1411
|
|
|
1418
1412
|
return renderFn(maybeData.data);
|
|
@@ -1699,6 +1693,7 @@ var cmsQueryRepeaterMeta = {
|
|
|
1699
1693
|
props: {
|
|
1700
1694
|
children: {
|
|
1701
1695
|
type: "slot",
|
|
1696
|
+
isRepeated: true,
|
|
1702
1697
|
defaultValue: {
|
|
1703
1698
|
type: "vbox",
|
|
1704
1699
|
children: [{
|
|
@@ -1713,6 +1708,9 @@ var cmsQueryRepeaterMeta = {
|
|
|
1713
1708
|
description: "CMS model (table) to query.",
|
|
1714
1709
|
options: function options(_, ctx) {
|
|
1715
1710
|
return mkTableOptions(ctx == null ? void 0 : ctx.tables);
|
|
1711
|
+
},
|
|
1712
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
1713
|
+
return ctx == null ? void 0 : ctx.table;
|
|
1716
1714
|
}
|
|
1717
1715
|
},
|
|
1718
1716
|
useDraft: {
|
|
@@ -1733,9 +1731,8 @@ var cmsQueryRepeaterMeta = {
|
|
|
1733
1731
|
type: "choice",
|
|
1734
1732
|
displayName: "Order by",
|
|
1735
1733
|
description: "Field to order by.",
|
|
1736
|
-
options: function options(
|
|
1737
|
-
|
|
1738
|
-
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, table);
|
|
1734
|
+
options: function options(_, ctx) {
|
|
1735
|
+
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, ctx == null ? void 0 : ctx.table);
|
|
1739
1736
|
}
|
|
1740
1737
|
},
|
|
1741
1738
|
desc: {
|
|
@@ -1749,28 +1746,50 @@ var cmsQueryRepeaterMeta = {
|
|
|
1749
1746
|
displayName: "Limit",
|
|
1750
1747
|
description: "Maximum number of entries to fetch (0 for unlimited).",
|
|
1751
1748
|
defaultValue: 0
|
|
1749
|
+
},
|
|
1750
|
+
emptyMessage: {
|
|
1751
|
+
type: "slot",
|
|
1752
|
+
defaultValue: {
|
|
1753
|
+
type: "text",
|
|
1754
|
+
value: "No matching entries found."
|
|
1755
|
+
}
|
|
1756
|
+
},
|
|
1757
|
+
forceEmptyState: {
|
|
1758
|
+
type: "boolean",
|
|
1759
|
+
displayName: "Force empty state",
|
|
1760
|
+
description: "If set, will render as if no matching entries were found.",
|
|
1761
|
+
defaultValue: false
|
|
1762
|
+
},
|
|
1763
|
+
loadingMessage: {
|
|
1764
|
+
type: "slot",
|
|
1765
|
+
defaultValue: {
|
|
1766
|
+
type: "text",
|
|
1767
|
+
value: "Loading..."
|
|
1768
|
+
}
|
|
1769
|
+
},
|
|
1770
|
+
forceLoadingState: {
|
|
1771
|
+
type: "boolean",
|
|
1772
|
+
displayName: "Force loading state",
|
|
1773
|
+
description: "If set, will render as if it is waiting for the query to run.",
|
|
1774
|
+
defaultValue: false
|
|
1752
1775
|
}
|
|
1753
1776
|
}
|
|
1754
1777
|
};
|
|
1755
|
-
function CmsQueryRepeater(
|
|
1756
|
-
var table =
|
|
1757
|
-
children =
|
|
1758
|
-
setControlContextData =
|
|
1759
|
-
where =
|
|
1760
|
-
useDraft =
|
|
1761
|
-
orderBy =
|
|
1762
|
-
desc =
|
|
1763
|
-
limit =
|
|
1778
|
+
function CmsQueryRepeater(_ref8) {
|
|
1779
|
+
var table = _ref8.table,
|
|
1780
|
+
children = _ref8.children,
|
|
1781
|
+
setControlContextData = _ref8.setControlContextData,
|
|
1782
|
+
where = _ref8.where,
|
|
1783
|
+
useDraft = _ref8.useDraft,
|
|
1784
|
+
orderBy = _ref8.orderBy,
|
|
1785
|
+
desc = _ref8.desc,
|
|
1786
|
+
limit = _ref8.limit,
|
|
1787
|
+
emptyMessage = _ref8.emptyMessage,
|
|
1788
|
+
forceEmptyState = _ref8.forceEmptyState,
|
|
1789
|
+
loadingMessage = _ref8.loadingMessage,
|
|
1790
|
+
forceLoadingState = _ref8.forceLoadingState;
|
|
1764
1791
|
var databaseConfig = useDatabase();
|
|
1765
1792
|
var tables = useTables();
|
|
1766
|
-
|
|
1767
|
-
if (tables) {
|
|
1768
|
-
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
1769
|
-
setControlContextData == null ? void 0 : setControlContextData({
|
|
1770
|
-
tables: tables
|
|
1771
|
-
});
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
1793
|
var params = {
|
|
1775
1794
|
where: where,
|
|
1776
1795
|
useDraft: useDraft,
|
|
@@ -1789,6 +1808,14 @@ function CmsQueryRepeater(_ref9) {
|
|
|
1789
1808
|
table = tables[0].identifier;
|
|
1790
1809
|
}
|
|
1791
1810
|
|
|
1811
|
+
if (tables) {
|
|
1812
|
+
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
1813
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
1814
|
+
tables: tables,
|
|
1815
|
+
table: table
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1792
1819
|
var maybeData = query.usePlasmicQueryData(cacheKey, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
1793
1820
|
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1794
1821
|
while (1) {
|
|
@@ -1830,8 +1857,8 @@ function CmsQueryRepeater(_ref9) {
|
|
|
1830
1857
|
}, _callee3);
|
|
1831
1858
|
})));
|
|
1832
1859
|
return renderMaybeData(maybeData, function (rows) {
|
|
1833
|
-
if (rows.length === 0) {
|
|
1834
|
-
return React.createElement(
|
|
1860
|
+
if (rows.length === 0 || forceEmptyState) {
|
|
1861
|
+
return React.createElement(React.Fragment, null, " ", emptyMessage, " ");
|
|
1835
1862
|
}
|
|
1836
1863
|
|
|
1837
1864
|
return React.createElement(QueryResultProvider, {
|
|
@@ -1845,7 +1872,7 @@ function CmsQueryRepeater(_ref9) {
|
|
|
1845
1872
|
}));
|
|
1846
1873
|
}, {
|
|
1847
1874
|
hideIfNotFound: false
|
|
1848
|
-
});
|
|
1875
|
+
}, loadingMessage, forceLoadingState);
|
|
1849
1876
|
}
|
|
1850
1877
|
var cmsRowFieldMeta = {
|
|
1851
1878
|
name: componentPrefix + "-row-field",
|
|
@@ -1859,24 +1886,32 @@ var cmsRowFieldMeta = {
|
|
|
1859
1886
|
description: "CMS model (table) to use.",
|
|
1860
1887
|
options: function options(_, ctx) {
|
|
1861
1888
|
return mkTableOptions(ctx == null ? void 0 : ctx.tables);
|
|
1889
|
+
},
|
|
1890
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
1891
|
+
return ctx == null ? void 0 : ctx.table;
|
|
1862
1892
|
}
|
|
1863
1893
|
},
|
|
1864
1894
|
field: {
|
|
1865
1895
|
type: "choice",
|
|
1866
1896
|
displayName: "Field",
|
|
1867
1897
|
description: "Field (from model schema) to use.",
|
|
1868
|
-
options: function options(
|
|
1898
|
+
options: function options(_ref10, ctx) {
|
|
1869
1899
|
var _ctx$table;
|
|
1870
1900
|
|
|
1871
|
-
var table =
|
|
1901
|
+
var table = _ref10.table;
|
|
1872
1902
|
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"]);
|
|
1903
|
+
},
|
|
1904
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
1905
|
+
var _ctx$fieldMeta, _ctx$fieldMeta2;
|
|
1906
|
+
|
|
1907
|
+
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);
|
|
1873
1908
|
}
|
|
1874
1909
|
},
|
|
1875
1910
|
dateFormat: {
|
|
1876
1911
|
type: "choice",
|
|
1877
1912
|
displayName: "Date Format",
|
|
1878
|
-
hidden: function hidden(
|
|
1879
|
-
var field =
|
|
1913
|
+
hidden: function hidden(_ref11, ctx) {
|
|
1914
|
+
var field = _ref11.field;
|
|
1880
1915
|
|
|
1881
1916
|
if (!ctx) {
|
|
1882
1917
|
return true;
|
|
@@ -1945,18 +1980,18 @@ var cmsRowFieldMeta = {
|
|
|
1945
1980
|
}
|
|
1946
1981
|
}
|
|
1947
1982
|
};
|
|
1948
|
-
function CmsRowField(
|
|
1983
|
+
function CmsRowField(_ref12) {
|
|
1949
1984
|
var _res$row$data;
|
|
1950
1985
|
|
|
1951
|
-
var className =
|
|
1952
|
-
table =
|
|
1953
|
-
field =
|
|
1954
|
-
dateFormat =
|
|
1955
|
-
setControlContextData =
|
|
1956
|
-
rest = _objectWithoutPropertiesLoose(
|
|
1986
|
+
var className = _ref12.className,
|
|
1987
|
+
table = _ref12.table,
|
|
1988
|
+
field = _ref12.field,
|
|
1989
|
+
dateFormat = _ref12.dateFormat,
|
|
1990
|
+
setControlContextData = _ref12.setControlContextData,
|
|
1991
|
+
rest = _objectWithoutPropertiesLoose(_ref12, _excluded2);
|
|
1957
1992
|
|
|
1958
|
-
var tables =
|
|
1959
|
-
var res = useRow(table);
|
|
1993
|
+
var tables = useTablesWithDataLoaded();
|
|
1994
|
+
var res = useRow(tables, table);
|
|
1960
1995
|
|
|
1961
1996
|
if (!res) {
|
|
1962
1997
|
return React.createElement("div", {
|
|
@@ -1970,22 +2005,23 @@ function CmsRowField(_ref13) {
|
|
|
1970
2005
|
}, "Error: No CMS Entry found");
|
|
1971
2006
|
}
|
|
1972
2007
|
|
|
2008
|
+
var fieldMeta = deriveInferredTableField({
|
|
2009
|
+
table: res.table,
|
|
2010
|
+
tables: tables,
|
|
2011
|
+
field: field,
|
|
2012
|
+
typeFilters: ["text", "long-text", "rich-text"]
|
|
2013
|
+
});
|
|
2014
|
+
|
|
1973
2015
|
if (tables) {
|
|
1974
2016
|
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
1975
2017
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
1976
2018
|
tables: tables,
|
|
1977
2019
|
table: res.table,
|
|
1978
|
-
row: res.row
|
|
2020
|
+
row: res.row,
|
|
2021
|
+
fieldMeta: fieldMeta
|
|
1979
2022
|
});
|
|
1980
2023
|
}
|
|
1981
2024
|
|
|
1982
|
-
var fieldMeta = deriveInferredTableField({
|
|
1983
|
-
table: res.table,
|
|
1984
|
-
tables: tables,
|
|
1985
|
-
field: field,
|
|
1986
|
-
typeFilters: ["text", "long-text", "rich-text"]
|
|
1987
|
-
});
|
|
1988
|
-
|
|
1989
2025
|
if (!fieldMeta) {
|
|
1990
2026
|
throw new Error("Please select an entry field to display.");
|
|
1991
2027
|
}
|
|
@@ -2013,6 +2049,7 @@ function deriveInferredTableField(opts) {
|
|
|
2013
2049
|
tables = opts.tables,
|
|
2014
2050
|
field = opts.field,
|
|
2015
2051
|
typeFilters = opts.typeFilters;
|
|
2052
|
+
if (!table) return undefined;
|
|
2016
2053
|
var schema = tables == null ? void 0 : (_tables$find = tables.find(function (t) {
|
|
2017
2054
|
return t.identifier === table;
|
|
2018
2055
|
})) == null ? void 0 : _tables$find.schema;
|
|
@@ -2080,17 +2117,25 @@ var cmsRowLinkMeta = {
|
|
|
2080
2117
|
description: "CMS model (table) to use.",
|
|
2081
2118
|
options: function options(_, ctx) {
|
|
2082
2119
|
return mkTableOptions(ctx == null ? void 0 : ctx.tables);
|
|
2120
|
+
},
|
|
2121
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
2122
|
+
return ctx == null ? void 0 : ctx.table;
|
|
2083
2123
|
}
|
|
2084
2124
|
},
|
|
2085
2125
|
field: {
|
|
2086
2126
|
type: "choice",
|
|
2087
2127
|
displayName: "Field",
|
|
2088
2128
|
description: "Field (from model schema) to use.",
|
|
2089
|
-
options: function options(
|
|
2129
|
+
options: function options(_ref13, ctx) {
|
|
2090
2130
|
var _ctx$table2;
|
|
2091
2131
|
|
|
2092
|
-
var table =
|
|
2132
|
+
var table = _ref13.table;
|
|
2093
2133
|
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table2 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table2 : table);
|
|
2134
|
+
},
|
|
2135
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
2136
|
+
var _ctx$fieldMeta3, _ctx$fieldMeta4;
|
|
2137
|
+
|
|
2138
|
+
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);
|
|
2094
2139
|
}
|
|
2095
2140
|
},
|
|
2096
2141
|
hrefProp: {
|
|
@@ -2111,31 +2156,23 @@ var cmsRowLinkMeta = {
|
|
|
2111
2156
|
}
|
|
2112
2157
|
}
|
|
2113
2158
|
};
|
|
2114
|
-
function CmsRowLink(
|
|
2159
|
+
function CmsRowLink(_ref14) {
|
|
2115
2160
|
var _res$row$data2;
|
|
2116
2161
|
|
|
2117
|
-
var table =
|
|
2118
|
-
field =
|
|
2119
|
-
hrefProp =
|
|
2120
|
-
children =
|
|
2121
|
-
setControlContextData =
|
|
2122
|
-
prefix =
|
|
2123
|
-
suffix =
|
|
2124
|
-
var tables =
|
|
2125
|
-
var res = useRow(table);
|
|
2162
|
+
var table = _ref14.table,
|
|
2163
|
+
field = _ref14.field,
|
|
2164
|
+
hrefProp = _ref14.hrefProp,
|
|
2165
|
+
children = _ref14.children,
|
|
2166
|
+
setControlContextData = _ref14.setControlContextData,
|
|
2167
|
+
prefix = _ref14.prefix,
|
|
2168
|
+
suffix = _ref14.suffix;
|
|
2169
|
+
var tables = useTablesWithDataLoaded();
|
|
2170
|
+
var res = useRow(tables, table);
|
|
2126
2171
|
|
|
2127
2172
|
if (!res || !res.row) {
|
|
2128
2173
|
return React.createElement(React.Fragment, null, children);
|
|
2129
2174
|
}
|
|
2130
2175
|
|
|
2131
|
-
if (tables) {
|
|
2132
|
-
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
2133
|
-
setControlContextData == null ? void 0 : setControlContextData({
|
|
2134
|
-
tables: tables,
|
|
2135
|
-
table: res.table
|
|
2136
|
-
});
|
|
2137
|
-
}
|
|
2138
|
-
|
|
2139
2176
|
var fieldMeta = deriveInferredTableField({
|
|
2140
2177
|
table: res.table,
|
|
2141
2178
|
tables: tables,
|
|
@@ -2143,6 +2180,16 @@ function CmsRowLink(_ref15) {
|
|
|
2143
2180
|
typeFilters: ["text"]
|
|
2144
2181
|
});
|
|
2145
2182
|
|
|
2183
|
+
if (tables) {
|
|
2184
|
+
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
2185
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
2186
|
+
tables: tables,
|
|
2187
|
+
table: res.table,
|
|
2188
|
+
row: res.row,
|
|
2189
|
+
fieldMeta: fieldMeta
|
|
2190
|
+
});
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2146
2193
|
if (!fieldMeta) {
|
|
2147
2194
|
return React.createElement(React.Fragment, null, children);
|
|
2148
2195
|
}
|
|
@@ -2182,17 +2229,25 @@ var cmsRowImageMeta = {
|
|
|
2182
2229
|
description: "CMS model (table) to use.",
|
|
2183
2230
|
options: function options(_, ctx) {
|
|
2184
2231
|
return mkTableOptions(ctx == null ? void 0 : ctx.tables);
|
|
2232
|
+
},
|
|
2233
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
2234
|
+
return ctx == null ? void 0 : ctx.table;
|
|
2185
2235
|
}
|
|
2186
2236
|
},
|
|
2187
2237
|
field: {
|
|
2188
2238
|
type: "choice",
|
|
2189
2239
|
displayName: "Field",
|
|
2190
2240
|
description: "Field (from model schema) to use.",
|
|
2191
|
-
options: function options(
|
|
2241
|
+
options: function options(_ref15, ctx) {
|
|
2192
2242
|
var _ctx$table3;
|
|
2193
2243
|
|
|
2194
|
-
var table =
|
|
2195
|
-
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table3 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table3 : table);
|
|
2244
|
+
var table = _ref15.table;
|
|
2245
|
+
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table3 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table3 : table, ["image"]);
|
|
2246
|
+
},
|
|
2247
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
2248
|
+
var _ctx$fieldMeta5, _ctx$fieldMeta6;
|
|
2249
|
+
|
|
2250
|
+
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);
|
|
2196
2251
|
}
|
|
2197
2252
|
},
|
|
2198
2253
|
srcProp: {
|
|
@@ -2203,29 +2258,21 @@ var cmsRowImageMeta = {
|
|
|
2203
2258
|
}
|
|
2204
2259
|
}
|
|
2205
2260
|
};
|
|
2206
|
-
function CmsRowImage(
|
|
2261
|
+
function CmsRowImage(_ref16) {
|
|
2207
2262
|
var _res$row$data3;
|
|
2208
2263
|
|
|
2209
|
-
var table =
|
|
2210
|
-
field =
|
|
2211
|
-
srcProp =
|
|
2212
|
-
children =
|
|
2213
|
-
setControlContextData =
|
|
2214
|
-
var tables =
|
|
2215
|
-
var res = useRow(table);
|
|
2264
|
+
var table = _ref16.table,
|
|
2265
|
+
field = _ref16.field,
|
|
2266
|
+
srcProp = _ref16.srcProp,
|
|
2267
|
+
children = _ref16.children,
|
|
2268
|
+
setControlContextData = _ref16.setControlContextData;
|
|
2269
|
+
var tables = useTablesWithDataLoaded();
|
|
2270
|
+
var res = useRow(tables, table);
|
|
2216
2271
|
|
|
2217
2272
|
if (!res || !res.row) {
|
|
2218
2273
|
return React.createElement(React.Fragment, null, children);
|
|
2219
2274
|
}
|
|
2220
2275
|
|
|
2221
|
-
if (tables) {
|
|
2222
|
-
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
2223
|
-
setControlContextData == null ? void 0 : setControlContextData({
|
|
2224
|
-
tables: tables,
|
|
2225
|
-
table: res.table
|
|
2226
|
-
});
|
|
2227
|
-
}
|
|
2228
|
-
|
|
2229
2276
|
var fieldMeta = deriveInferredTableField({
|
|
2230
2277
|
table: res.table,
|
|
2231
2278
|
tables: tables,
|
|
@@ -2233,6 +2280,16 @@ function CmsRowImage(_ref17) {
|
|
|
2233
2280
|
typeFilters: ["image"]
|
|
2234
2281
|
});
|
|
2235
2282
|
|
|
2283
|
+
if (tables) {
|
|
2284
|
+
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
2285
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
2286
|
+
tables: tables,
|
|
2287
|
+
table: res.table,
|
|
2288
|
+
row: res.row,
|
|
2289
|
+
fieldMeta: fieldMeta
|
|
2290
|
+
});
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2236
2293
|
if (!fieldMeta) {
|
|
2237
2294
|
return React.createElement(React.Fragment, null, children);
|
|
2238
2295
|
}
|
|
@@ -2274,17 +2331,25 @@ var cmsRowFieldValueMeta = {
|
|
|
2274
2331
|
description: "CMS model (table) to use.",
|
|
2275
2332
|
options: function options(_, ctx) {
|
|
2276
2333
|
return mkTableOptions(ctx == null ? void 0 : ctx.tables);
|
|
2334
|
+
},
|
|
2335
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
2336
|
+
return ctx == null ? void 0 : ctx.table;
|
|
2277
2337
|
}
|
|
2278
2338
|
},
|
|
2279
2339
|
field: {
|
|
2280
2340
|
type: "choice",
|
|
2281
2341
|
displayName: "Field",
|
|
2282
2342
|
description: "Field (from model schema) to use.",
|
|
2283
|
-
options: function options(
|
|
2343
|
+
options: function options(_ref17, ctx) {
|
|
2284
2344
|
var _ctx$table4;
|
|
2285
2345
|
|
|
2286
|
-
var table =
|
|
2346
|
+
var table = _ref17.table;
|
|
2287
2347
|
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table4 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table4 : table);
|
|
2348
|
+
},
|
|
2349
|
+
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
2350
|
+
var _ctx$fieldMeta7, _ctx$fieldMeta8;
|
|
2351
|
+
|
|
2352
|
+
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);
|
|
2288
2353
|
}
|
|
2289
2354
|
},
|
|
2290
2355
|
valueProp: {
|
|
@@ -2295,31 +2360,23 @@ var cmsRowFieldValueMeta = {
|
|
|
2295
2360
|
}
|
|
2296
2361
|
}
|
|
2297
2362
|
};
|
|
2298
|
-
function CmsRowFieldValue(
|
|
2363
|
+
function CmsRowFieldValue(_ref18) {
|
|
2299
2364
|
var _res$row$data4;
|
|
2300
2365
|
|
|
2301
|
-
var table =
|
|
2302
|
-
field =
|
|
2303
|
-
valueProp =
|
|
2304
|
-
children =
|
|
2305
|
-
setControlContextData =
|
|
2306
|
-
rest = _objectWithoutPropertiesLoose(
|
|
2366
|
+
var table = _ref18.table,
|
|
2367
|
+
field = _ref18.field,
|
|
2368
|
+
valueProp = _ref18.valueProp,
|
|
2369
|
+
children = _ref18.children,
|
|
2370
|
+
setControlContextData = _ref18.setControlContextData,
|
|
2371
|
+
rest = _objectWithoutPropertiesLoose(_ref18, _excluded3);
|
|
2307
2372
|
|
|
2308
|
-
var tables =
|
|
2309
|
-
var res = useRow(table);
|
|
2373
|
+
var tables = useTablesWithDataLoaded();
|
|
2374
|
+
var res = useRow(tables, table);
|
|
2310
2375
|
|
|
2311
2376
|
if (!res || !res.row) {
|
|
2312
2377
|
return React.createElement(React.Fragment, null, children);
|
|
2313
2378
|
}
|
|
2314
2379
|
|
|
2315
|
-
if (tables) {
|
|
2316
|
-
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
2317
|
-
setControlContextData == null ? void 0 : setControlContextData({
|
|
2318
|
-
tables: tables,
|
|
2319
|
-
table: res.table
|
|
2320
|
-
});
|
|
2321
|
-
}
|
|
2322
|
-
|
|
2323
2380
|
var fieldMeta = deriveInferredTableField({
|
|
2324
2381
|
table: res.table,
|
|
2325
2382
|
tables: tables,
|
|
@@ -2327,6 +2384,16 @@ function CmsRowFieldValue(_ref19) {
|
|
|
2327
2384
|
typeFilters: ["text"]
|
|
2328
2385
|
});
|
|
2329
2386
|
|
|
2387
|
+
if (tables) {
|
|
2388
|
+
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
2389
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
2390
|
+
tables: tables,
|
|
2391
|
+
table: res.table,
|
|
2392
|
+
row: res.row,
|
|
2393
|
+
fieldMeta: fieldMeta
|
|
2394
|
+
});
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2330
2397
|
if (!fieldMeta) {
|
|
2331
2398
|
return React.createElement(React.Fragment, null, children);
|
|
2332
2399
|
}
|
|
@@ -2377,13 +2444,13 @@ var cmsRowLoaderMeta = {
|
|
|
2377
2444
|
}
|
|
2378
2445
|
}, fetcherComponentPropMetas)
|
|
2379
2446
|
};
|
|
2380
|
-
function CmsRowLoader(
|
|
2381
|
-
var table =
|
|
2382
|
-
row =
|
|
2383
|
-
children =
|
|
2384
|
-
useDraft =
|
|
2385
|
-
hideIfNotFound =
|
|
2386
|
-
setControlContextData =
|
|
2447
|
+
function CmsRowLoader(_ref19) {
|
|
2448
|
+
var table = _ref19.table,
|
|
2449
|
+
row = _ref19.row,
|
|
2450
|
+
children = _ref19.children,
|
|
2451
|
+
useDraft = _ref19.useDraft,
|
|
2452
|
+
hideIfNotFound = _ref19.hideIfNotFound,
|
|
2453
|
+
setControlContextData = _ref19.setControlContextData;
|
|
2387
2454
|
var databaseConfig = useDatabase();
|
|
2388
2455
|
var tables = useTables();
|
|
2389
2456
|
|