@plasmicpkgs/plasmic-cms 0.0.214 → 0.0.216

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.
@@ -1,9 +1,9 @@
1
1
  import registerComponent from '@plasmicapp/host/registerComponent';
2
2
  import registerGlobalContext from '@plasmicapp/host/registerGlobalContext';
3
- import { useSelector, DataProvider, useDataEnv, PlasmicCanvasContext, repeatedElement } from '@plasmicapp/host';
3
+ import { useSelector, DataProvider, useDataEnv, usePlasmicCanvasContext, repeatedElement } from '@plasmicapp/host';
4
4
  import { usePlasmicQueryData } from '@plasmicapp/query';
5
5
  import dayjs from 'dayjs';
6
- import React, { useContext } from 'react';
6
+ import React from 'react';
7
7
 
8
8
  function _regeneratorRuntime() {
9
9
  _regeneratorRuntime = function () {
@@ -440,6 +440,7 @@ function queryParamsToApi(params) {
440
440
  return {
441
441
  where: params.where,
442
442
  limit: params.limit,
443
+ offset: params.offset,
443
444
  order: params.orderBy ? [{
444
445
  field: params.orderBy,
445
446
  dir: params.desc ? "desc" : "asc"
@@ -456,7 +457,7 @@ var HttpError = /*#__PURE__*/function (_Error) {
456
457
  }
457
458
  return HttpError;
458
459
  }( /*#__PURE__*/_wrapNativeSuper(Error));
459
- var API = /*#__PURE__*/function (_get, _fetchTables, _query) {
460
+ var API = /*#__PURE__*/function (_get, _fetchTables, _query, _count) {
460
461
  function API(config) {
461
462
  this.config = config;
462
463
  }
@@ -496,7 +497,9 @@ var API = /*#__PURE__*/function (_get, _fetchTables, _query) {
496
497
  if ((_json$error = json.error) != null && _json$error.message) {
497
498
  message = json.error.message;
498
499
  }
499
- } catch (_unused) {}
500
+ } catch (_unused) {
501
+ // ignored
502
+ }
500
503
  throw new HttpError(response.status, message);
501
504
  case 12:
502
505
  _context.next = 14;
@@ -565,6 +568,36 @@ var API = /*#__PURE__*/function (_get, _fetchTables, _query) {
565
568
  }, _callee3, this, [[1, 8]]);
566
569
  }))).apply(this, arguments);
567
570
  };
571
+ _proto.count = function count(_x5, _x6) {
572
+ return (_count = _count || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(table, params) {
573
+ var response;
574
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
575
+ while (1) switch (_context4.prev = _context4.next) {
576
+ case 0:
577
+ if (params === void 0) {
578
+ params = {};
579
+ }
580
+ _context4.prev = 1;
581
+ _context4.next = 4;
582
+ return this.get("/tables/" + table + "/count", {
583
+ q: JSON.stringify(queryParamsToApi(params)),
584
+ draft: Number(params.useDraft)
585
+ });
586
+ case 4:
587
+ response = _context4.sent;
588
+ return _context4.abrupt("return", response.count);
589
+ case 8:
590
+ _context4.prev = 8;
591
+ _context4.t0 = _context4["catch"](1);
592
+ console.error(_context4.t0);
593
+ throw _context4.t0;
594
+ case 12:
595
+ case "end":
596
+ return _context4.stop();
597
+ }
598
+ }, _callee4, this, [[1, 8]]);
599
+ }))).apply(this, arguments);
600
+ };
568
601
  return API;
569
602
  }();
570
603
  function mkApi(config) {
@@ -582,9 +615,17 @@ var mkQueryContextKey = function mkQueryContextKey(table) {
582
615
  return "" + contextPrefix + capitalizeFirst(table) + collectionResultSuffix;
583
616
  };
584
617
  var itemContextSuffix = "Item";
618
+ var countContextSuffix = "Count";
619
+ var modeContextSuffix = "Mode";
585
620
  var mkRowContextKey = function mkRowContextKey(table) {
586
621
  return "" + contextPrefix + capitalizeFirst(table) + itemContextSuffix;
587
622
  };
623
+ var mkCountContextKey = function mkCountContextKey(table) {
624
+ return "" + contextPrefix + capitalizeFirst(table) + countContextSuffix;
625
+ };
626
+ var mkModeContextKey = function mkModeContextKey(table) {
627
+ return "" + contextPrefix + capitalizeFirst(table) + modeContextSuffix;
628
+ };
588
629
  function capitalizeFirst(str) {
589
630
  var _str$;
590
631
  return ((_str$ = str[0]) == null ? void 0 : _str$.toUpperCase()) + str.slice(1);
@@ -613,9 +654,9 @@ function TablesProvider(_ref2) {
613
654
  hidden: true
614
655
  }, children);
615
656
  }
616
- function getClosestMatchingKeys(env, suffix) {
617
- return [].concat(Object.keys(env).reverse()).filter(function (k) {
618
- return k.endsWith(suffix);
657
+ function getClosestMatchingKeysBy(env, pred) {
658
+ return [].concat(Object.keys(env).reverse()).filter(function (key) {
659
+ return pred(key);
619
660
  });
620
661
  }
621
662
  function QueryResultProvider(_ref3) {
@@ -624,12 +665,16 @@ function QueryResultProvider(_ref3) {
624
665
  rows = _ref3.rows,
625
666
  hidden = _ref3.hidden;
626
667
  return React.createElement(DataProvider, {
668
+ name: table ? mkModeContextKey(table) : undefined,
669
+ data: "rows",
670
+ hidden: true
671
+ }, React.createElement(DataProvider, {
627
672
  name: table ? mkQueryContextKey(table) : undefined,
628
673
  data: rows,
629
674
  hidden: hidden
630
- }, children);
675
+ }, children));
631
676
  }
632
- function useTablesWithDataLoaded() {
677
+ function useTablesWithDataLoaded(mode) {
633
678
  var env = useDataEnv();
634
679
  var tables = useTables();
635
680
  if (!env) {
@@ -638,21 +683,39 @@ function useTablesWithDataLoaded() {
638
683
  if (!tables) {
639
684
  return undefined;
640
685
  }
641
- var matchingKeys = getClosestMatchingKeys(env, itemContextSuffix);
686
+ var matchingKeys = getClosestMatchingKeysBy(env, function (key) {
687
+ if (mode === "rows") {
688
+ return key.endsWith(itemContextSuffix);
689
+ } else if (mode === "count") {
690
+ return key.endsWith(countContextSuffix);
691
+ } else {
692
+ return key.endsWith(itemContextSuffix) || key.endsWith(countContextSuffix);
693
+ }
694
+ });
642
695
  return tables.filter(function (table) {
643
696
  return matchingKeys.some(function (key) {
644
- return mkRowContextKey(table.identifier) === key;
697
+ if (mode === "rows") {
698
+ return mkRowContextKey(table.identifier) === key;
699
+ } else if (mode === "count") {
700
+ return mkCountContextKey(table.identifier) === key;
701
+ } else {
702
+ return mkRowContextKey(table.identifier) === key || mkCountContextKey(table.identifier) === key;
703
+ }
645
704
  });
646
705
  });
647
706
  }
707
+ function deriveTableId(tables, table) {
708
+ if (!table && tables && tables.length > 0) {
709
+ table = tables[0].identifier;
710
+ }
711
+ return table;
712
+ }
648
713
  function useRow(tables, table) {
649
714
  var env = useDataEnv();
650
715
  if (!env) {
651
716
  return undefined;
652
717
  }
653
- if (!table && tables && tables.length > 0) {
654
- table = tables[0].identifier;
655
- }
718
+ table = deriveTableId(tables, table);
656
719
  if (table) {
657
720
  return {
658
721
  table: table,
@@ -661,6 +724,20 @@ function useRow(tables, table) {
661
724
  }
662
725
  return undefined;
663
726
  }
727
+ function useCount(tables, table) {
728
+ var env = useDataEnv();
729
+ if (!env) {
730
+ return undefined;
731
+ }
732
+ table = deriveTableId(tables, table);
733
+ if (table) {
734
+ return {
735
+ table: table,
736
+ count: env[mkCountContextKey(table)]
737
+ };
738
+ }
739
+ return undefined;
740
+ }
664
741
  function RowProvider(_ref4) {
665
742
  var children = _ref4.children,
666
743
  table = _ref4.table,
@@ -670,6 +747,19 @@ function RowProvider(_ref4) {
670
747
  data: row
671
748
  }, children);
672
749
  }
750
+ function CountProvider(_ref5) {
751
+ var children = _ref5.children,
752
+ table = _ref5.table,
753
+ count = _ref5.count;
754
+ return React.createElement(DataProvider, {
755
+ name: table ? mkModeContextKey(table) : undefined,
756
+ data: "count",
757
+ hidden: true
758
+ }, React.createElement(DataProvider, {
759
+ name: table ? mkCountContextKey(table) : undefined,
760
+ data: count
761
+ }, children));
762
+ }
673
763
 
674
764
  function mkTableOptions(tables) {
675
765
  if (!tables) {
@@ -716,7 +806,8 @@ function mkFieldOptions(tables, tableIdentifier, types) {
716
806
  }
717
807
 
718
808
  var _excluded = ["className", "table", "field", "dateFormat", "setControlContextData"],
719
- _excluded2 = ["table", "field", "valueProp", "children", "setControlContextData"];
809
+ _excluded2 = ["className", "table", "setControlContextData"],
810
+ _excluded3 = ["table", "field", "valueProp", "children", "setControlContextData"];
720
811
  var modulePath = "@plasmicpkgs/plasmic-cms";
721
812
  var componentPrefix = "hostless-plasmic-cms";
722
813
  function renderMaybeData(maybeData, renderFn, loaderProps, inEditor, loadingMessage, forceLoadingState) {
@@ -817,7 +908,7 @@ function TablesFetcher(_ref2) {
817
908
  }
818
909
  }, _callee);
819
910
  })));
820
- var inEditor = !!useContext(PlasmicCanvasContext);
911
+ var inEditor = !!usePlasmicCanvasContext();
821
912
  return React.createElement(TablesProvider, {
822
913
  tables: maybeData.data
823
914
  }, inEditor && maybeData.error ? React.createElement("div", null, "CMS Error: ", maybeData.error.message) : children);
@@ -870,6 +961,17 @@ var cmsQueryRepeaterMeta = {
870
961
  return true;
871
962
  }
872
963
  },
964
+ mode: {
965
+ type: "choice",
966
+ options: [{
967
+ label: "Rows",
968
+ value: "rows"
969
+ }, {
970
+ label: "Count",
971
+ value: "count"
972
+ }],
973
+ defaultValueHint: "rows"
974
+ },
873
975
  where: {
874
976
  type: "object",
875
977
  displayName: "Filter",
@@ -899,19 +1001,36 @@ var cmsQueryRepeaterMeta = {
899
1001
  description: "Field to order by.",
900
1002
  options: function options(_, ctx) {
901
1003
  return mkFieldOptions(ctx == null ? void 0 : ctx.tables, ctx == null ? void 0 : ctx.table, ["number", "boolean", "date-time", "long-text", "text"]);
1004
+ },
1005
+ hidden: function hidden(ps) {
1006
+ return ps.mode === "count";
902
1007
  }
903
1008
  },
904
1009
  desc: {
905
1010
  type: "boolean",
906
1011
  displayName: "Sort descending?",
907
1012
  description: 'Sort descending by "Order by" field.',
908
- defaultValue: false
1013
+ defaultValue: false,
1014
+ hidden: function hidden(ps) {
1015
+ return ps.mode === "count";
1016
+ }
909
1017
  },
910
1018
  limit: {
911
1019
  type: "number",
912
1020
  displayName: "Limit",
913
1021
  description: "Maximum number of entries to fetch (0 for unlimited).",
914
- defaultValue: 0
1022
+ defaultValue: 0,
1023
+ hidden: function hidden(ps) {
1024
+ return ps.mode === "count";
1025
+ }
1026
+ },
1027
+ offset: {
1028
+ type: "number",
1029
+ displayName: "Offset",
1030
+ description: "Skips this number of rows in the result set; used in combination with limit to build pagination",
1031
+ hidden: function hidden(ps) {
1032
+ return ps.mode === "count";
1033
+ }
915
1034
  },
916
1035
  emptyMessage: {
917
1036
  type: "slot",
@@ -949,7 +1068,10 @@ var cmsQueryRepeaterMeta = {
949
1068
  type: "boolean",
950
1069
  displayName: "No auto-repeat",
951
1070
  description: "Do not automatically repeat children for every entry.",
952
- defaultValue: false
1071
+ defaultValue: false,
1072
+ hidden: function hidden(ps) {
1073
+ return ps.mode === "count";
1074
+ }
953
1075
  }
954
1076
  }
955
1077
  };
@@ -957,11 +1079,13 @@ function CmsQueryRepeater(_ref5) {
957
1079
  var table = _ref5.table,
958
1080
  children = _ref5.children,
959
1081
  setControlContextData = _ref5.setControlContextData,
1082
+ mode = _ref5.mode,
960
1083
  where = _ref5.where,
961
1084
  useDraft = _ref5.useDraft,
962
1085
  orderBy = _ref5.orderBy,
963
1086
  desc = _ref5.desc,
964
1087
  limit = _ref5.limit,
1088
+ offset = _ref5.offset,
965
1089
  emptyMessage = _ref5.emptyMessage,
966
1090
  forceEmptyState = _ref5.forceEmptyState,
967
1091
  loadingMessage = _ref5.loadingMessage,
@@ -982,13 +1106,15 @@ function CmsQueryRepeater(_ref5) {
982
1106
  useDraft: useDraft,
983
1107
  orderBy: orderBy,
984
1108
  desc: desc,
985
- limit: limit
1109
+ limit: limit,
1110
+ offset: offset
986
1111
  };
987
1112
  if (!table && tables && tables.length > 0) {
988
1113
  table = tables[0].identifier;
989
1114
  }
990
1115
  var cacheKey = JSON.stringify({
991
1116
  component: "CmsQueryLoader",
1117
+ mode: mode,
992
1118
  table: table,
993
1119
  databaseConfig: databaseConfig,
994
1120
  params: params
@@ -1024,34 +1150,52 @@ function CmsQueryRepeater(_ref5) {
1024
1150
  }
1025
1151
  throw new Error("There is no model called \"" + table + "\"");
1026
1152
  case 10:
1153
+ if (!(mode === "count")) {
1154
+ _context2.next = 14;
1155
+ break;
1156
+ }
1157
+ return _context2.abrupt("return", mkApi(databaseConfig).count(table, params));
1158
+ case 14:
1027
1159
  return _context2.abrupt("return", mkApi(databaseConfig).query(table, params));
1028
- case 11:
1160
+ case 15:
1029
1161
  case "end":
1030
1162
  return _context2.stop();
1031
1163
  }
1032
1164
  }, _callee2);
1033
1165
  })));
1034
- var inEditor = !!useContext(PlasmicCanvasContext);
1035
- var node = renderMaybeData(maybeData, function (rows) {
1036
- if (rows.length === 0 || forceEmptyState) {
1037
- return emptyMessage;
1038
- }
1039
- return noAutoRepeat ? children : rows.map(function (row, index) {
1040
- return React.createElement(RowProvider, {
1041
- key: index,
1042
- table: table,
1043
- row: row
1044
- }, repeatedElement(index, children));
1045
- });
1046
- }, {
1047
- hideIfNotFound: false
1048
- }, inEditor, loadingMessage, forceLoadingState);
1049
- return React.createElement(QueryResultProvider, {
1050
- rows: maybeData == null ? void 0 : maybeData.data,
1051
- table: table
1052
- }, noLayout ? React.createElement(React.Fragment, null, " ", node, " ") : React.createElement("div", {
1053
- className: className
1054
- }, " ", node, " "));
1166
+ var inEditor = !!usePlasmicCanvasContext();
1167
+ if (mode === "count") {
1168
+ var node = renderMaybeData(maybeData, function () {
1169
+ return children;
1170
+ }, {
1171
+ hideIfNotFound: false
1172
+ }, inEditor, loadingMessage, forceLoadingState);
1173
+ return React.createElement(CountProvider, {
1174
+ table: table,
1175
+ count: typeof (maybeData == null ? void 0 : maybeData.data) === "number" ? maybeData.data : undefined
1176
+ }, node);
1177
+ } else {
1178
+ var _node = renderMaybeData(maybeData, function (rows) {
1179
+ if (rows.length === 0 || forceEmptyState) {
1180
+ return emptyMessage;
1181
+ }
1182
+ return noAutoRepeat ? children : rows.map(function (row, index) {
1183
+ return React.createElement(RowProvider, {
1184
+ key: index,
1185
+ table: table,
1186
+ row: row
1187
+ }, repeatedElement(index, children));
1188
+ });
1189
+ }, {
1190
+ hideIfNotFound: false
1191
+ }, inEditor, loadingMessage, forceLoadingState);
1192
+ return React.createElement(QueryResultProvider, {
1193
+ rows: Array.isArray(maybeData == null ? void 0 : maybeData.data) ? maybeData.data : undefined,
1194
+ table: table
1195
+ }, noLayout ? React.createElement(React.Fragment, null, " ", _node, " ") : React.createElement("div", {
1196
+ className: className
1197
+ }, " ", _node, " "));
1198
+ }
1055
1199
  }
1056
1200
  var cmsRowFieldMeta = {
1057
1201
  name: componentPrefix + "-row-field",
@@ -1167,7 +1311,7 @@ function CmsRowField(_ref9) {
1167
1311
  dateFormat = _ref9.dateFormat,
1168
1312
  setControlContextData = _ref9.setControlContextData,
1169
1313
  rest = _objectWithoutPropertiesLoose(_ref9, _excluded);
1170
- var tables = useTablesWithDataLoaded();
1314
+ var tables = useTablesWithDataLoaded("rows");
1171
1315
  var res = useRow(tables, table);
1172
1316
  var unknown = React.createElement("div", Object.assign({
1173
1317
  className: className
@@ -1210,6 +1354,50 @@ function CmsRowField(_ref9) {
1210
1354
  className: className
1211
1355
  }, rest)) : null;
1212
1356
  }
1357
+ var cmsCountFieldMeta = {
1358
+ name: componentPrefix + "-count",
1359
+ displayName: "CMS Entries Count",
1360
+ importName: "CmsCount",
1361
+ importPath: modulePath,
1362
+ props: {
1363
+ table: {
1364
+ type: "choice",
1365
+ displayName: "Model",
1366
+ hidden: function hidden(props, ctx) {
1367
+ var _ctx$tables$length2, _ctx$tables2;
1368
+ return ((_ctx$tables$length2 = ctx == null || (_ctx$tables2 = ctx.tables) == null ? void 0 : _ctx$tables2.length) != null ? _ctx$tables$length2 : 0) <= 1 && !props.table;
1369
+ },
1370
+ helpText: "Pick model from a CMS Data Fetcher",
1371
+ description: "Usually not used! Only with multiple CMS Data Loaders, use this to choose which to show. Otherwise, go select the CMS Data Loader if you want to load different data.",
1372
+ options: function options(_, ctx) {
1373
+ return mkTableOptions(ctx == null ? void 0 : ctx.tables);
1374
+ },
1375
+ defaultValueHint: function defaultValueHint(_, ctx) {
1376
+ return ctx == null ? void 0 : ctx.table;
1377
+ }
1378
+ }
1379
+ }
1380
+ };
1381
+ function CmsCount(_ref10) {
1382
+ var className = _ref10.className,
1383
+ table = _ref10.table,
1384
+ rest = _objectWithoutPropertiesLoose(_ref10, _excluded2);
1385
+ var tables = useTablesWithDataLoaded("count");
1386
+ var res = useCount(tables, table);
1387
+ var unknown = React.createElement("div", Object.assign({
1388
+ className: className
1389
+ }, rest), "Count: ", table != null ? table : "Unknown Model");
1390
+ if (!res) {
1391
+ return unknown;
1392
+ }
1393
+ if (res.count == null) {
1394
+ return null;
1395
+ } else {
1396
+ return React.createElement("div", Object.assign({
1397
+ className: className
1398
+ }, rest), new Intl.NumberFormat().format(res.count));
1399
+ }
1400
+ }
1213
1401
  var DEFAULT_TYPE_FILTERS = ["text"];
1214
1402
  function deriveInferredTableField(opts) {
1215
1403
  var _tables$find;
@@ -1288,8 +1476,8 @@ var cmsRowLinkMeta = {
1288
1476
  type: "choice",
1289
1477
  displayName: "Model",
1290
1478
  hidden: function hidden(props, ctx) {
1291
- var _ctx$tables$length2, _ctx$tables2;
1292
- return ((_ctx$tables$length2 = ctx == null || (_ctx$tables2 = ctx.tables) == null ? void 0 : _ctx$tables2.length) != null ? _ctx$tables$length2 : 0) <= 1 && !props.table;
1479
+ var _ctx$tables$length3, _ctx$tables3;
1480
+ return ((_ctx$tables$length3 = ctx == null || (_ctx$tables3 = ctx.tables) == null ? void 0 : _ctx$tables3.length) != null ? _ctx$tables$length3 : 0) <= 1 && !props.table;
1293
1481
  },
1294
1482
  helpText: "Pick model from a CMS Data Fetcher",
1295
1483
  description: "Usually not used! Only with multiple CMS Data Loaders, use this to choose which to show. Otherwise, go select the CMS Data Loader if you want to load different data.",
@@ -1304,9 +1492,9 @@ var cmsRowLinkMeta = {
1304
1492
  type: "choice",
1305
1493
  displayName: "Field",
1306
1494
  description: "Field (from model schema) to use.",
1307
- options: function options(_ref10, ctx) {
1495
+ options: function options(_ref11, ctx) {
1308
1496
  var _ctx$table3;
1309
- var table = _ref10.table;
1497
+ var table = _ref11.table;
1310
1498
  return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table3 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table3 : table);
1311
1499
  },
1312
1500
  defaultValueHint: function defaultValueHint(_, ctx) {
@@ -1340,16 +1528,16 @@ var cmsRowLinkMeta = {
1340
1528
  }
1341
1529
  }
1342
1530
  };
1343
- function CmsRowLink(_ref11) {
1531
+ function CmsRowLink(_ref12) {
1344
1532
  var _res$row$data2;
1345
- var table = _ref11.table,
1346
- field = _ref11.field,
1347
- hrefProp = _ref11.hrefProp,
1348
- children = _ref11.children,
1349
- setControlContextData = _ref11.setControlContextData,
1350
- prefix = _ref11.prefix,
1351
- suffix = _ref11.suffix;
1352
- var tables = useTablesWithDataLoaded();
1533
+ var table = _ref12.table,
1534
+ field = _ref12.field,
1535
+ hrefProp = _ref12.hrefProp,
1536
+ children = _ref12.children,
1537
+ setControlContextData = _ref12.setControlContextData,
1538
+ prefix = _ref12.prefix,
1539
+ suffix = _ref12.suffix;
1540
+ var tables = useTablesWithDataLoaded("rows");
1353
1541
  var res = useRow(tables, table);
1354
1542
  if (!res || !res.row) {
1355
1543
  return React.createElement(React.Fragment, null, children);
@@ -1402,8 +1590,8 @@ var cmsRowImageMeta = {
1402
1590
  type: "choice",
1403
1591
  displayName: "Model",
1404
1592
  hidden: function hidden(props, ctx) {
1405
- var _ctx$tables$length3, _ctx$tables3;
1406
- return ((_ctx$tables$length3 = ctx == null || (_ctx$tables3 = ctx.tables) == null ? void 0 : _ctx$tables3.length) != null ? _ctx$tables$length3 : 0) <= 1 && !props.table;
1593
+ var _ctx$tables$length4, _ctx$tables4;
1594
+ return ((_ctx$tables$length4 = ctx == null || (_ctx$tables4 = ctx.tables) == null ? void 0 : _ctx$tables4.length) != null ? _ctx$tables$length4 : 0) <= 1 && !props.table;
1407
1595
  },
1408
1596
  helpText: "Pick model from a CMS Data Fetcher",
1409
1597
  description: "Usually not used! Only with multiple CMS Data Loaders, use this to choose which to show. Otherwise, go select the CMS Data Loader if you want to load different data.",
@@ -1418,9 +1606,9 @@ var cmsRowImageMeta = {
1418
1606
  type: "choice",
1419
1607
  displayName: "Field",
1420
1608
  description: "Field (from model schema) to use.",
1421
- options: function options(_ref12, ctx) {
1609
+ options: function options(_ref13, ctx) {
1422
1610
  var _ctx$table4;
1423
- var table = _ref12.table;
1611
+ var table = _ref13.table;
1424
1612
  return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table4 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table4 : table, ["image"]);
1425
1613
  },
1426
1614
  defaultValueHint: function defaultValueHint(_, ctx) {
@@ -1436,14 +1624,14 @@ var cmsRowImageMeta = {
1436
1624
  }
1437
1625
  }
1438
1626
  };
1439
- function CmsRowImage(_ref13) {
1627
+ function CmsRowImage(_ref14) {
1440
1628
  var _res$row$data3;
1441
- var table = _ref13.table,
1442
- field = _ref13.field,
1443
- srcProp = _ref13.srcProp,
1444
- children = _ref13.children,
1445
- setControlContextData = _ref13.setControlContextData;
1446
- var tables = useTablesWithDataLoaded();
1629
+ var table = _ref14.table,
1630
+ field = _ref14.field,
1631
+ srcProp = _ref14.srcProp,
1632
+ children = _ref14.children,
1633
+ setControlContextData = _ref14.setControlContextData;
1634
+ var tables = useTablesWithDataLoaded("rows");
1447
1635
  var res = useRow(tables, table);
1448
1636
  if (!res || !res.row) {
1449
1637
  return React.createElement(React.Fragment, null, children);
@@ -1497,8 +1685,8 @@ var cmsRowFieldValueMeta = {
1497
1685
  type: "choice",
1498
1686
  displayName: "Model",
1499
1687
  hidden: function hidden(props, ctx) {
1500
- var _ctx$tables$length4, _ctx$tables4;
1501
- return ((_ctx$tables$length4 = ctx == null || (_ctx$tables4 = ctx.tables) == null ? void 0 : _ctx$tables4.length) != null ? _ctx$tables$length4 : 0) <= 1 && !props.table;
1688
+ var _ctx$tables$length5, _ctx$tables5;
1689
+ return ((_ctx$tables$length5 = ctx == null || (_ctx$tables5 = ctx.tables) == null ? void 0 : _ctx$tables5.length) != null ? _ctx$tables$length5 : 0) <= 1 && !props.table;
1502
1690
  },
1503
1691
  helpText: "Pick model from a CMS Data Fetcher",
1504
1692
  description: "Usually not used! Only with multiple CMS Data Loaders, use this to choose which to show. Otherwise, go select the CMS Data Loader if you want to load different data.",
@@ -1513,9 +1701,9 @@ var cmsRowFieldValueMeta = {
1513
1701
  type: "choice",
1514
1702
  displayName: "Field",
1515
1703
  description: "Field (from model schema) to use.",
1516
- options: function options(_ref14, ctx) {
1704
+ options: function options(_ref15, ctx) {
1517
1705
  var _ctx$table5;
1518
- var table = _ref14.table;
1706
+ var table = _ref15.table;
1519
1707
  return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table5 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table5 : table);
1520
1708
  },
1521
1709
  defaultValueHint: function defaultValueHint(_, ctx) {
@@ -1531,15 +1719,15 @@ var cmsRowFieldValueMeta = {
1531
1719
  }
1532
1720
  }
1533
1721
  };
1534
- function CmsRowFieldValue(_ref15) {
1722
+ function CmsRowFieldValue(_ref16) {
1535
1723
  var _res$row$data4;
1536
- var table = _ref15.table,
1537
- field = _ref15.field,
1538
- valueProp = _ref15.valueProp,
1539
- children = _ref15.children,
1540
- setControlContextData = _ref15.setControlContextData,
1541
- rest = _objectWithoutPropertiesLoose(_ref15, _excluded2);
1542
- var tables = useTablesWithDataLoaded();
1724
+ var table = _ref16.table,
1725
+ field = _ref16.field,
1726
+ valueProp = _ref16.valueProp,
1727
+ children = _ref16.children,
1728
+ setControlContextData = _ref16.setControlContextData,
1729
+ rest = _objectWithoutPropertiesLoose(_ref16, _excluded3);
1730
+ var tables = useTablesWithDataLoaded("rows");
1543
1731
  var res = useRow(tables, table);
1544
1732
  if (!res || !res.row) {
1545
1733
  return React.createElement(React.Fragment, null, children);
@@ -1596,7 +1784,8 @@ function registerAll(loader) {
1596
1784
  _registerComponent(CmsRowLink, cmsRowLinkMeta);
1597
1785
  _registerComponent(CmsRowImage, cmsRowImageMeta);
1598
1786
  _registerComponent(CmsRowFieldValue, cmsRowFieldValueMeta);
1787
+ _registerComponent(CmsCount, cmsCountFieldMeta);
1599
1788
  }
1600
1789
 
1601
- export { API, CmsCredentialsProvider, CmsQueryRepeater, CmsRowField, CmsRowFieldValue, CmsRowImage, CmsRowLink, HttpError, cmsCredentialsProviderMeta, cmsQueryRepeaterMeta, cmsRowFieldMeta, cmsRowFieldValueMeta, cmsRowImageMeta, cmsRowLinkMeta, mkApi, registerAll };
1790
+ export { API, CmsCount, CmsCredentialsProvider, CmsQueryRepeater, CmsRowField, CmsRowFieldValue, CmsRowImage, CmsRowLink, HttpError, cmsCountFieldMeta, cmsCredentialsProviderMeta, cmsQueryRepeaterMeta, cmsRowFieldMeta, cmsRowFieldValueMeta, cmsRowImageMeta, cmsRowLinkMeta, mkApi, registerAll };
1602
1791
  //# sourceMappingURL=plasmic-cms.esm.js.map