@plasmicpkgs/plasmic-cms 0.0.37 → 0.0.40
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 +3 -1
- package/dist/plasmic-cms.cjs.development.js +22 -13
- 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 +22 -13
- package/dist/plasmic-cms.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/components.d.ts
CHANGED
|
@@ -51,9 +51,11 @@ interface CmsRowLinkProps extends CanvasComponentProps<TableContextData> {
|
|
|
51
51
|
field: string;
|
|
52
52
|
hrefProp: string;
|
|
53
53
|
children: React.ReactNode;
|
|
54
|
+
prefix?: string;
|
|
55
|
+
suffix?: string;
|
|
54
56
|
}
|
|
55
57
|
export declare const cmsRowLinkMeta: ComponentMeta<CmsRowLinkProps>;
|
|
56
|
-
export declare function CmsRowLink({ table, field, hrefProp, children, setControlContextData, }: CmsRowLinkProps): React.ReactElement | null;
|
|
58
|
+
export declare function CmsRowLink({ table, field, hrefProp, children, setControlContextData, prefix, suffix, }: CmsRowLinkProps): React.ReactElement | null;
|
|
57
59
|
interface CmsRowImageProps extends CanvasComponentProps<TableContextData> {
|
|
58
60
|
table: string;
|
|
59
61
|
field: string;
|
|
@@ -1784,6 +1784,11 @@ function CmsQueryRepeater(_ref9) {
|
|
|
1784
1784
|
databaseConfig: databaseConfig,
|
|
1785
1785
|
params: params
|
|
1786
1786
|
});
|
|
1787
|
+
|
|
1788
|
+
if (!table && tables && tables.length > 0) {
|
|
1789
|
+
table = tables[0].identifier;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1787
1792
|
var maybeData = query.usePlasmicQueryData(cacheKey, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
1788
1793
|
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1789
1794
|
while (1) {
|
|
@@ -1802,30 +1807,22 @@ function CmsQueryRepeater(_ref9) {
|
|
|
1802
1807
|
break;
|
|
1803
1808
|
}
|
|
1804
1809
|
|
|
1805
|
-
if (!(!tables || tables.length === 0)) {
|
|
1806
|
-
_context3.next = 5;
|
|
1807
|
-
break;
|
|
1808
|
-
}
|
|
1809
|
-
|
|
1810
1810
|
throw new Error("You must select a model to query");
|
|
1811
1811
|
|
|
1812
|
-
case 5:
|
|
1813
|
-
table = tables[0].identifier;
|
|
1814
|
-
|
|
1815
1812
|
case 6:
|
|
1816
1813
|
if (!(tables && !tables.find(function (t) {
|
|
1817
1814
|
return t.identifier === table;
|
|
1818
1815
|
}))) {
|
|
1819
|
-
_context3.next =
|
|
1816
|
+
_context3.next = 10;
|
|
1820
1817
|
break;
|
|
1821
1818
|
}
|
|
1822
1819
|
|
|
1823
1820
|
throw new Error("There is no model called \"" + table + "\"");
|
|
1824
1821
|
|
|
1825
|
-
case
|
|
1822
|
+
case 10:
|
|
1826
1823
|
return _context3.abrupt("return", mkApi(databaseConfig).query(table, params));
|
|
1827
1824
|
|
|
1828
|
-
case
|
|
1825
|
+
case 11:
|
|
1829
1826
|
case "end":
|
|
1830
1827
|
return _context3.stop();
|
|
1831
1828
|
}
|
|
@@ -2101,6 +2098,16 @@ var cmsRowLinkMeta = {
|
|
|
2101
2098
|
displayName: '"href" prop',
|
|
2102
2099
|
description: "Prop to inject into children",
|
|
2103
2100
|
defaultValue: "href"
|
|
2101
|
+
},
|
|
2102
|
+
prefix: {
|
|
2103
|
+
type: "string",
|
|
2104
|
+
displayName: "Optional prefix",
|
|
2105
|
+
description: "Prefix to prepend to prop value."
|
|
2106
|
+
},
|
|
2107
|
+
suffix: {
|
|
2108
|
+
type: "string",
|
|
2109
|
+
displayName: "Optional suffix",
|
|
2110
|
+
description: "Suffix to append to prop value."
|
|
2104
2111
|
}
|
|
2105
2112
|
}
|
|
2106
2113
|
};
|
|
@@ -2111,7 +2118,9 @@ function CmsRowLink(_ref15) {
|
|
|
2111
2118
|
field = _ref15.field,
|
|
2112
2119
|
hrefProp = _ref15.hrefProp,
|
|
2113
2120
|
children = _ref15.children,
|
|
2114
|
-
setControlContextData = _ref15.setControlContextData
|
|
2121
|
+
setControlContextData = _ref15.setControlContextData,
|
|
2122
|
+
prefix = _ref15.prefix,
|
|
2123
|
+
suffix = _ref15.suffix;
|
|
2115
2124
|
var tables = useTables();
|
|
2116
2125
|
var res = useRow(table);
|
|
2117
2126
|
|
|
@@ -2147,7 +2156,7 @@ function CmsRowLink(_ref15) {
|
|
|
2147
2156
|
if (React.isValidElement(child)) {
|
|
2148
2157
|
var _React$cloneElement;
|
|
2149
2158
|
|
|
2150
|
-
return React.cloneElement(child, (_React$cloneElement = {}, _React$cloneElement[hrefProp] = value, _React$cloneElement));
|
|
2159
|
+
return React.cloneElement(child, (_React$cloneElement = {}, _React$cloneElement[hrefProp] = prefix || suffix ? "" + (prefix || "") + value + (suffix || "") : value, _React$cloneElement));
|
|
2151
2160
|
}
|
|
2152
2161
|
|
|
2153
2162
|
return child;
|