@plasmicpkgs/plasmic-rich-components 1.0.49 → 1.0.51

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/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  import { Registerable } from "./utils";
2
+ export { RichLayout } from "./rich-layout";
3
+ export { RichTable } from "./rich-table";
2
4
  export declare function registerAll(loader?: Registerable): void;
@@ -138,8 +138,18 @@ function RichLayout(_ref) {
138
138
  showAvatarMenu = _ref.showAvatarMenu,
139
139
  className = _ref.className,
140
140
  layoutProps = _objectWithoutPropertiesLoose(_ref, _excluded);
141
- var _location = location,
142
- pathname = _location.pathname;
141
+ var isClient = useIsClient();
142
+ var _useState = React.useState(undefined),
143
+ pathname = _useState[0],
144
+ setPathname = _useState[1];
145
+ React.useEffect(function () {
146
+ if (typeof location !== "undefined") {
147
+ setPathname(location.pathname);
148
+ }
149
+ }, []);
150
+ if (!isClient) {
151
+ return null;
152
+ }
143
153
  return React__default.createElement("div", {
144
154
  className: className
145
155
  }, React__default.createElement("style", null, ".ant-pro-layout-bg-list {\n display: none;\n }"), React__default.createElement(proComponents.ProLayout, Object.assign({}, layoutProps, {
@@ -222,10 +232,13 @@ function generateNavMenuType(remainingDepth, displayName, defaultValue) {
222
232
  }
223
233
  var richLayoutMeta = {
224
234
  name: "hostless-rich-layout",
225
- displayName: "Rich Layout",
235
+ displayName: "Rich Page Layout",
226
236
  props: {
227
237
  children: "slot",
228
- actionsChildren: "slot",
238
+ actionsChildren: {
239
+ type: "slot",
240
+ hidePlaceholder: true
241
+ },
229
242
  title: {
230
243
  displayName: "Title",
231
244
  type: "string",
@@ -382,7 +395,7 @@ var richLayoutMeta = {
382
395
  height: "stretch"
383
396
  },
384
397
  importName: "RichLayout",
385
- importPath: "@plasmicpkgs/plasmic-rich-components/dist/rich-layout/RichLayout"
398
+ importPath: "@plasmicpkgs/plasmic-rich-components"
386
399
  };
387
400
  function registerRichLayout(loader) {
388
401
  registerComponentHelper(loader, RichLayout, richLayoutMeta);
@@ -1203,6 +1216,12 @@ function normalizeData(rawData) {
1203
1216
  schema: schema
1204
1217
  });
1205
1218
  }
1219
+ /**
1220
+ * Render booleans, objects, arrays, etc. as JSON repr.
1221
+ */
1222
+ function safeRender(x) {
1223
+ return x === undefined || x === null ? "" : typeof x === "string" ? x : typeof x === "number" ? x.toString() : JSON.stringify(x);
1224
+ }
1206
1225
  function RichTable(props) {
1207
1226
  var _data$data;
1208
1227
  var className = props.className,
@@ -1225,10 +1244,12 @@ function RichTable(props) {
1225
1244
  addHref = props.addHref,
1226
1245
  actions = props.actions,
1227
1246
  customActionChildren = props.customActionChildren,
1228
- _props$showSearch = props.showSearch,
1229
- showSearch = _props$showSearch === void 0 ? true : _props$showSearch,
1230
1247
  _props$pageSize = props.pageSize,
1231
- pageSize = _props$pageSize === void 0 ? 20 : _props$pageSize;
1248
+ pageSize = _props$pageSize === void 0 ? 20 : _props$pageSize,
1249
+ hideSearch = props.hideSearch,
1250
+ hideDensity = props.hideDensity,
1251
+ hideColumnPicker = props.hideColumnPicker,
1252
+ hideExports = props.hideExports;
1232
1253
  var data = normalizeData(rawData);
1233
1254
  var _useState = React.useState(""),
1234
1255
  search = _useState[0],
@@ -1285,7 +1306,7 @@ function RichTable(props) {
1285
1306
  }, React__default.createElement(host.DataProvider, {
1286
1307
  name: "currentColumn",
1287
1308
  data: value
1288
- }, cconfig.expr ? cconfig.expr(record) : record)));
1309
+ }, safeRender(cconfig.expr ? cconfig.expr(record) : value))));
1289
1310
  }
1290
1311
  };
1291
1312
  return columnDefinition;
@@ -1365,9 +1386,11 @@ function RichTable(props) {
1365
1386
  },
1366
1387
  search: false,
1367
1388
  options: {
1368
- setting: {
1389
+ setting: hideColumnPicker ? false : {
1369
1390
  listsHeight: 400
1370
- }
1391
+ },
1392
+ reload: false,
1393
+ density: !hideDensity
1371
1394
  },
1372
1395
  pagination: {
1373
1396
  pageSize: pageSize,
@@ -1378,7 +1401,7 @@ function RichTable(props) {
1378
1401
  dateFormatter: "string",
1379
1402
  headerTitle: title,
1380
1403
  toolbar: {
1381
- search: showSearch ? {
1404
+ search: !hideSearch ? {
1382
1405
  value: search,
1383
1406
  onChange: function onChange(e) {
1384
1407
  return setSearch(e.target.value);
@@ -1393,7 +1416,7 @@ function RichTable(props) {
1393
1416
  icon: React__default.createElement(icons.PlusOutlined, null),
1394
1417
  type: "primary",
1395
1418
  href: addHref
1396
- }, "Add"), React__default.createElement(antd.Dropdown, {
1419
+ }, "Add"), !hideExports && React__default.createElement(antd.Dropdown, {
1397
1420
  key: "menu",
1398
1421
  menu: {
1399
1422
  items: [{
@@ -1494,7 +1517,7 @@ function getDefaultValueHint(field) {
1494
1517
  }
1495
1518
  var dataTableMeta = {
1496
1519
  name: "hostless-rich-table",
1497
- displayName: "Rich Table",
1520
+ displayName: "Table",
1498
1521
  defaultStyles: {
1499
1522
  width: "stretch"
1500
1523
  },
@@ -1519,6 +1542,9 @@ var dataTableMeta = {
1519
1542
  },
1520
1543
  fields: {
1521
1544
  type: "array",
1545
+ hidden: function hidden(ps) {
1546
+ return !ps.data;
1547
+ },
1522
1548
  unstable__keyFunc: function unstable__keyFunc(x) {
1523
1549
  return x.key;
1524
1550
  },
@@ -1588,10 +1614,26 @@ var dataTableMeta = {
1588
1614
  }
1589
1615
  }
1590
1616
  }
1617
+ },
1618
+ hideSearch: {
1619
+ type: "boolean",
1620
+ advanced: true
1621
+ },
1622
+ hideExports: {
1623
+ type: "boolean",
1624
+ advanced: true
1625
+ },
1626
+ hideDensity: {
1627
+ type: "boolean",
1628
+ advanced: true
1629
+ },
1630
+ hideColumnPicker: {
1631
+ type: "boolean",
1632
+ advanced: true
1591
1633
  }
1592
1634
  },
1593
1635
  importName: "RichTable",
1594
- importPath: "@plasmicpkgs/plasmic-rich-components/dist/rich-table/RichTable"
1636
+ importPath: "@plasmicpkgs/plasmic-rich-components"
1595
1637
  };
1596
1638
  function registerRichTable(loader) {
1597
1639
  registerComponentHelper(loader, RichTable, dataTableMeta);
@@ -1602,5 +1644,7 @@ function registerAll(loader) {
1602
1644
  registerRichTable(loader);
1603
1645
  }
1604
1646
 
1647
+ exports.RichLayout = RichLayout;
1648
+ exports.RichTable = RichTable;
1605
1649
  exports.registerAll = registerAll;
1606
1650
  //# sourceMappingURL=plasmic-rich-components.cjs.development.js.map