@saltcorn/builder 0.9.3-beta.0 → 0.9.3-beta.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/builder",
3
- "version": "0.9.3-beta.0",
3
+ "version": "0.9.3-beta.1",
4
4
  "description": "Drag and drop view builder for Saltcorn, open-source no-code platform",
5
5
  "main": "index.js",
6
6
  "homepage": "https://saltcorn.com",
@@ -251,15 +251,19 @@ const LinkElem = ({ connectors }) => (
251
251
  * @subcategory components / Toolbox
252
252
  * @namespace
253
253
  */
254
- const ViewElem = ({ connectors, views }) => (
254
+ const ViewElem = ({ connectors, views, isPageEdit }) => (
255
255
  <WrapElem
256
256
  connectors={connectors}
257
257
  icon="fas fa-eye"
258
258
  title="Embed a view"
259
259
  label="View"
260
- disable={views.length < 2}
260
+ disable={!views || views.length < (!isPageEdit ? 2 : 1)}
261
261
  >
262
- <View name={"not_assigned"} state={"shared"} view={views[0].name} />
262
+ <View
263
+ name={"not_assigned"}
264
+ state={"shared"}
265
+ view={views?.length > 0 ? views[0].name : ""}
266
+ />
263
267
  </WrapElem>
264
268
  );
265
269
  /**
@@ -425,10 +429,10 @@ const ViewLinkElem = ({ connectors, options }) => (
425
429
  icons={["fas fa-eye", "fas fa-link"]}
426
430
  title="Link to a view"
427
431
  label="ViewLink"
428
- disable={options.views.length < 2}
432
+ disable={!options.views || options.views.length < 2}
429
433
  >
430
434
  <ViewLink
431
- name={options.views.length > 0 ? options.views[0].name : ""}
435
+ name={options.views?.length > 0 ? options.views[0].name : ""}
432
436
  block={false}
433
437
  minRole={100}
434
438
  label={""}
@@ -703,7 +707,7 @@ const ToolboxPage = () => {
703
707
  </div>
704
708
  <div className="toolbar-row">
705
709
  <LinkElem connectors={connectors} />
706
- <ViewElem connectors={connectors} views={views} />
710
+ <ViewElem connectors={connectors} views={views} isPageEdit={true} />
707
711
  </div>
708
712
  <div className="toolbar-row">
709
713
  <SearchElem connectors={connectors} />