@plasmicpkgs/plasmic-cms 0.0.50 → 0.0.57
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/LICENSE.md +21 -0
- package/dist/components.d.ts +4 -1
- package/dist/plasmic-cms.cjs.development.js +98 -65
- 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 +98 -65
- package/dist/plasmic-cms.esm.js.map +1 -1
- package/package.json +5 -4
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Plasmic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/dist/components.d.ts
CHANGED
|
@@ -25,10 +25,13 @@ interface CmsQueryRepeaterProps extends QueryParams, CanvasComponentProps<TableC
|
|
|
25
25
|
forceEmptyState?: boolean;
|
|
26
26
|
loadingMessage?: React.ReactNode;
|
|
27
27
|
forceLoadingState?: boolean;
|
|
28
|
+
noLayout?: boolean;
|
|
28
29
|
className?: string;
|
|
30
|
+
filterField?: string;
|
|
31
|
+
filterValue?: string;
|
|
29
32
|
}
|
|
30
33
|
export declare const cmsQueryRepeaterMeta: ComponentMeta<CmsQueryRepeaterProps>;
|
|
31
|
-
export declare function CmsQueryRepeater({ table, children, setControlContextData, where, useDraft, orderBy, desc, limit, emptyMessage, forceEmptyState, loadingMessage, forceLoadingState, className, }: CmsQueryRepeaterProps): JSX.Element;
|
|
34
|
+
export declare function CmsQueryRepeater({ table, children, setControlContextData, where, useDraft, orderBy, desc, limit, emptyMessage, forceEmptyState, loadingMessage, forceLoadingState, noLayout, className, filterField, filterValue, }: CmsQueryRepeaterProps): JSX.Element;
|
|
32
35
|
interface CmsRowFieldProps extends CanvasComponentProps<RowContextData> {
|
|
33
36
|
table?: string;
|
|
34
37
|
field?: string;
|
|
@@ -1399,7 +1399,7 @@ function TablesFetcher(_ref2) {
|
|
|
1399
1399
|
}, children);
|
|
1400
1400
|
}, {
|
|
1401
1401
|
hideIfNotFound: false
|
|
1402
|
-
});
|
|
1402
|
+
}, children);
|
|
1403
1403
|
}
|
|
1404
1404
|
|
|
1405
1405
|
function isDatabaseConfigured(config) {
|
|
@@ -1458,6 +1458,22 @@ var cmsQueryRepeaterMeta = {
|
|
|
1458
1458
|
return true;
|
|
1459
1459
|
}
|
|
1460
1460
|
},
|
|
1461
|
+
filterField: {
|
|
1462
|
+
type: "choice",
|
|
1463
|
+
displayName: "Filter field",
|
|
1464
|
+
description: "Field (from model schema) to filter by",
|
|
1465
|
+
options: function options(_ref4, ctx) {
|
|
1466
|
+
var _ctx$table;
|
|
1467
|
+
|
|
1468
|
+
var table = _ref4.table;
|
|
1469
|
+
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", "rich-text"]);
|
|
1470
|
+
}
|
|
1471
|
+
},
|
|
1472
|
+
filterValue: {
|
|
1473
|
+
type: "string",
|
|
1474
|
+
displayName: "Filter value",
|
|
1475
|
+
description: "Value to filter by, should be of filter field type"
|
|
1476
|
+
},
|
|
1461
1477
|
orderBy: {
|
|
1462
1478
|
type: "choice",
|
|
1463
1479
|
displayName: "Order by",
|
|
@@ -1503,25 +1519,41 @@ var cmsQueryRepeaterMeta = {
|
|
|
1503
1519
|
displayName: "Force loading state",
|
|
1504
1520
|
description: "If set, will render as if it is waiting for the query to run.",
|
|
1505
1521
|
defaultValue: false
|
|
1522
|
+
},
|
|
1523
|
+
noLayout: {
|
|
1524
|
+
type: "boolean",
|
|
1525
|
+
displayName: "No layout",
|
|
1526
|
+
description: "When set, CMS Data Loader will not layout its children; instead, the layout set on its parent element will be used. Useful if you want to set flex gap or control container tag type.",
|
|
1527
|
+
defaultValue: false
|
|
1506
1528
|
}
|
|
1507
1529
|
}
|
|
1508
1530
|
};
|
|
1509
|
-
function CmsQueryRepeater(
|
|
1510
|
-
var table =
|
|
1511
|
-
children =
|
|
1512
|
-
setControlContextData =
|
|
1513
|
-
where =
|
|
1514
|
-
useDraft =
|
|
1515
|
-
orderBy =
|
|
1516
|
-
desc =
|
|
1517
|
-
limit =
|
|
1518
|
-
emptyMessage =
|
|
1519
|
-
forceEmptyState =
|
|
1520
|
-
loadingMessage =
|
|
1521
|
-
forceLoadingState =
|
|
1522
|
-
|
|
1531
|
+
function CmsQueryRepeater(_ref5) {
|
|
1532
|
+
var table = _ref5.table,
|
|
1533
|
+
children = _ref5.children,
|
|
1534
|
+
setControlContextData = _ref5.setControlContextData,
|
|
1535
|
+
where = _ref5.where,
|
|
1536
|
+
useDraft = _ref5.useDraft,
|
|
1537
|
+
orderBy = _ref5.orderBy,
|
|
1538
|
+
desc = _ref5.desc,
|
|
1539
|
+
limit = _ref5.limit,
|
|
1540
|
+
emptyMessage = _ref5.emptyMessage,
|
|
1541
|
+
forceEmptyState = _ref5.forceEmptyState,
|
|
1542
|
+
loadingMessage = _ref5.loadingMessage,
|
|
1543
|
+
forceLoadingState = _ref5.forceLoadingState,
|
|
1544
|
+
noLayout = _ref5.noLayout,
|
|
1545
|
+
className = _ref5.className,
|
|
1546
|
+
filterField = _ref5.filterField,
|
|
1547
|
+
filterValue = _ref5.filterValue;
|
|
1523
1548
|
var databaseConfig = useDatabase();
|
|
1524
1549
|
var tables = useTables();
|
|
1550
|
+
|
|
1551
|
+
if (filterField && filterValue) {
|
|
1552
|
+
var _where;
|
|
1553
|
+
|
|
1554
|
+
where = (_where = {}, _where[filterField] = filterValue, _where);
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1525
1557
|
var params = {
|
|
1526
1558
|
where: where,
|
|
1527
1559
|
useDraft: useDraft,
|
|
@@ -1588,9 +1620,7 @@ function CmsQueryRepeater(_ref4) {
|
|
|
1588
1620
|
}
|
|
1589
1621
|
}, _callee2);
|
|
1590
1622
|
})));
|
|
1591
|
-
|
|
1592
|
-
className: className
|
|
1593
|
-
}, renderMaybeData(maybeData, function (rows) {
|
|
1623
|
+
var node = renderMaybeData(maybeData, function (rows) {
|
|
1594
1624
|
if (rows.length === 0 || forceEmptyState) {
|
|
1595
1625
|
return React.createElement(QueryResultProvider, {
|
|
1596
1626
|
table: table,
|
|
@@ -1609,7 +1639,10 @@ function CmsQueryRepeater(_ref4) {
|
|
|
1609
1639
|
}));
|
|
1610
1640
|
}, {
|
|
1611
1641
|
hideIfNotFound: false
|
|
1612
|
-
}, loadingMessage, forceLoadingState)
|
|
1642
|
+
}, loadingMessage, forceLoadingState);
|
|
1643
|
+
return noLayout ? React.createElement(React.Fragment, null, " ", node, " ") : React.createElement("div", {
|
|
1644
|
+
className: className
|
|
1645
|
+
}, " ", node, " ");
|
|
1613
1646
|
}
|
|
1614
1647
|
var cmsRowFieldMeta = {
|
|
1615
1648
|
name: componentPrefix + "-row-field",
|
|
@@ -1632,11 +1665,11 @@ var cmsRowFieldMeta = {
|
|
|
1632
1665
|
type: "choice",
|
|
1633
1666
|
displayName: "Field",
|
|
1634
1667
|
description: "Field (from model schema) to use.",
|
|
1635
|
-
options: function options(
|
|
1636
|
-
var _ctx$
|
|
1668
|
+
options: function options(_ref7, ctx) {
|
|
1669
|
+
var _ctx$table2;
|
|
1637
1670
|
|
|
1638
|
-
var table =
|
|
1639
|
-
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$
|
|
1671
|
+
var table = _ref7.table;
|
|
1672
|
+
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table2 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table2 : table, ["number", "boolean", "text", "long-text", "date-time", "rich-text", "image"]);
|
|
1640
1673
|
},
|
|
1641
1674
|
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
1642
1675
|
var _ctx$fieldMeta, _ctx$fieldMeta2;
|
|
@@ -1647,8 +1680,8 @@ var cmsRowFieldMeta = {
|
|
|
1647
1680
|
dateFormat: {
|
|
1648
1681
|
type: "choice",
|
|
1649
1682
|
displayName: "Date Format",
|
|
1650
|
-
hidden: function hidden(
|
|
1651
|
-
var field =
|
|
1683
|
+
hidden: function hidden(_ref8, ctx) {
|
|
1684
|
+
var field = _ref8.field;
|
|
1652
1685
|
|
|
1653
1686
|
if (!ctx) {
|
|
1654
1687
|
return true;
|
|
@@ -1717,15 +1750,15 @@ var cmsRowFieldMeta = {
|
|
|
1717
1750
|
}
|
|
1718
1751
|
}
|
|
1719
1752
|
};
|
|
1720
|
-
function CmsRowField(
|
|
1753
|
+
function CmsRowField(_ref9) {
|
|
1721
1754
|
var _res$row$data;
|
|
1722
1755
|
|
|
1723
|
-
var className =
|
|
1724
|
-
table =
|
|
1725
|
-
field =
|
|
1726
|
-
dateFormat =
|
|
1727
|
-
setControlContextData =
|
|
1728
|
-
rest = _objectWithoutPropertiesLoose(
|
|
1756
|
+
var className = _ref9.className,
|
|
1757
|
+
table = _ref9.table,
|
|
1758
|
+
field = _ref9.field,
|
|
1759
|
+
dateFormat = _ref9.dateFormat,
|
|
1760
|
+
setControlContextData = _ref9.setControlContextData,
|
|
1761
|
+
rest = _objectWithoutPropertiesLoose(_ref9, _excluded2);
|
|
1729
1762
|
|
|
1730
1763
|
var tables = useTablesWithDataLoaded();
|
|
1731
1764
|
var res = useRow(tables, table);
|
|
@@ -1866,11 +1899,11 @@ var cmsRowLinkMeta = {
|
|
|
1866
1899
|
type: "choice",
|
|
1867
1900
|
displayName: "Field",
|
|
1868
1901
|
description: "Field (from model schema) to use.",
|
|
1869
|
-
options: function options(
|
|
1870
|
-
var _ctx$
|
|
1902
|
+
options: function options(_ref10, ctx) {
|
|
1903
|
+
var _ctx$table3;
|
|
1871
1904
|
|
|
1872
|
-
var table =
|
|
1873
|
-
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$
|
|
1905
|
+
var table = _ref10.table;
|
|
1906
|
+
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table3 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table3 : table);
|
|
1874
1907
|
},
|
|
1875
1908
|
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
1876
1909
|
var _ctx$fieldMeta3, _ctx$fieldMeta4;
|
|
@@ -1896,16 +1929,16 @@ var cmsRowLinkMeta = {
|
|
|
1896
1929
|
}
|
|
1897
1930
|
}
|
|
1898
1931
|
};
|
|
1899
|
-
function CmsRowLink(
|
|
1932
|
+
function CmsRowLink(_ref11) {
|
|
1900
1933
|
var _res$row$data2;
|
|
1901
1934
|
|
|
1902
|
-
var table =
|
|
1903
|
-
field =
|
|
1904
|
-
hrefProp =
|
|
1905
|
-
children =
|
|
1906
|
-
setControlContextData =
|
|
1907
|
-
prefix =
|
|
1908
|
-
suffix =
|
|
1935
|
+
var table = _ref11.table,
|
|
1936
|
+
field = _ref11.field,
|
|
1937
|
+
hrefProp = _ref11.hrefProp,
|
|
1938
|
+
children = _ref11.children,
|
|
1939
|
+
setControlContextData = _ref11.setControlContextData,
|
|
1940
|
+
prefix = _ref11.prefix,
|
|
1941
|
+
suffix = _ref11.suffix;
|
|
1909
1942
|
var tables = useTablesWithDataLoaded();
|
|
1910
1943
|
var res = useRow(tables, table);
|
|
1911
1944
|
|
|
@@ -1978,11 +2011,11 @@ var cmsRowImageMeta = {
|
|
|
1978
2011
|
type: "choice",
|
|
1979
2012
|
displayName: "Field",
|
|
1980
2013
|
description: "Field (from model schema) to use.",
|
|
1981
|
-
options: function options(
|
|
1982
|
-
var _ctx$
|
|
2014
|
+
options: function options(_ref12, ctx) {
|
|
2015
|
+
var _ctx$table4;
|
|
1983
2016
|
|
|
1984
|
-
var table =
|
|
1985
|
-
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$
|
|
2017
|
+
var table = _ref12.table;
|
|
2018
|
+
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table4 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table4 : table, ["image"]);
|
|
1986
2019
|
},
|
|
1987
2020
|
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
1988
2021
|
var _ctx$fieldMeta5, _ctx$fieldMeta6;
|
|
@@ -1998,14 +2031,14 @@ var cmsRowImageMeta = {
|
|
|
1998
2031
|
}
|
|
1999
2032
|
}
|
|
2000
2033
|
};
|
|
2001
|
-
function CmsRowImage(
|
|
2034
|
+
function CmsRowImage(_ref13) {
|
|
2002
2035
|
var _res$row$data3;
|
|
2003
2036
|
|
|
2004
|
-
var table =
|
|
2005
|
-
field =
|
|
2006
|
-
srcProp =
|
|
2007
|
-
children =
|
|
2008
|
-
setControlContextData =
|
|
2037
|
+
var table = _ref13.table,
|
|
2038
|
+
field = _ref13.field,
|
|
2039
|
+
srcProp = _ref13.srcProp,
|
|
2040
|
+
children = _ref13.children,
|
|
2041
|
+
setControlContextData = _ref13.setControlContextData;
|
|
2009
2042
|
var tables = useTablesWithDataLoaded();
|
|
2010
2043
|
var res = useRow(tables, table);
|
|
2011
2044
|
|
|
@@ -2080,11 +2113,11 @@ var cmsRowFieldValueMeta = {
|
|
|
2080
2113
|
type: "choice",
|
|
2081
2114
|
displayName: "Field",
|
|
2082
2115
|
description: "Field (from model schema) to use.",
|
|
2083
|
-
options: function options(
|
|
2084
|
-
var _ctx$
|
|
2116
|
+
options: function options(_ref14, ctx) {
|
|
2117
|
+
var _ctx$table5;
|
|
2085
2118
|
|
|
2086
|
-
var table =
|
|
2087
|
-
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$
|
|
2119
|
+
var table = _ref14.table;
|
|
2120
|
+
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table5 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table5 : table);
|
|
2088
2121
|
},
|
|
2089
2122
|
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
2090
2123
|
var _ctx$fieldMeta7, _ctx$fieldMeta8;
|
|
@@ -2100,15 +2133,15 @@ var cmsRowFieldValueMeta = {
|
|
|
2100
2133
|
}
|
|
2101
2134
|
}
|
|
2102
2135
|
};
|
|
2103
|
-
function CmsRowFieldValue(
|
|
2136
|
+
function CmsRowFieldValue(_ref15) {
|
|
2104
2137
|
var _res$row$data4;
|
|
2105
2138
|
|
|
2106
|
-
var table =
|
|
2107
|
-
field =
|
|
2108
|
-
valueProp =
|
|
2109
|
-
children =
|
|
2110
|
-
setControlContextData =
|
|
2111
|
-
rest = _objectWithoutPropertiesLoose(
|
|
2139
|
+
var table = _ref15.table,
|
|
2140
|
+
field = _ref15.field,
|
|
2141
|
+
valueProp = _ref15.valueProp,
|
|
2142
|
+
children = _ref15.children,
|
|
2143
|
+
setControlContextData = _ref15.setControlContextData,
|
|
2144
|
+
rest = _objectWithoutPropertiesLoose(_ref15, _excluded3);
|
|
2112
2145
|
|
|
2113
2146
|
var tables = useTablesWithDataLoaded();
|
|
2114
2147
|
var res = useRow(tables, table);
|