From 02c89bcdb12cf7394bdacff74292d98ae1510292 Mon Sep 17 00:00:00 2001 From: Dean Date: Tue, 23 Aug 2022 09:56:09 +0100 Subject: [PATCH] Minor refactoring and icon updates --- .../builder/src/builderStore/dataBinding.js | 9 +- .../common/bindings/BindingPanel.svelte | 97 ++++++++++++------- 2 files changed, 72 insertions(+), 34 deletions(-) diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index 3fbe450906..79ada2d7de 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -359,7 +359,8 @@ const getProviderContextBindings = (asset, dataProviders) => { providerId, // Table ID is used by JSON fields to know what table the field is in tableId: table?._id, - category: "Data", + category: "Dataprovider", + display: { name: readableBinding, type: fieldSchema.type }, }) }) }) @@ -387,6 +388,7 @@ const getUserBindings = () => { fieldSchema, providerId: "user", category: "Current User", + display: fieldSchema, }) }) return bindings @@ -404,12 +406,14 @@ const getDeviceBindings = () => { runtimeBinding: `${safeDevice}.${makePropSafe("mobile")}`, readableBinding: `Device.Mobile`, category: "Device", + display: { type: "string", name: "mobile" }, }) bindings.push({ type: "context", runtimeBinding: `${safeDevice}.${makePropSafe("tablet")}`, readableBinding: `Device.Tablet`, category: "Device", + display: { type: "string", name: "tablet" }, }) } return bindings @@ -433,6 +437,7 @@ const getSelectedRowsBindings = asset => { "selectedRows" )}`, readableBinding: `${table._instanceName}.Selected rows`, + category: "Dataprovider", })) ) @@ -465,6 +470,7 @@ const getStateBindings = () => { runtimeBinding: `${safeState}.${makePropSafe(key)}`, readableBinding: `State.${key}`, category: "State", + display: { name: key }, })) } return bindings @@ -505,6 +511,7 @@ const getRoleBindings = () => { runtimeBinding: `trim "${role._id}"`, readableBinding: `Role.${role.name}`, category: "Role", + display: { name: role.name }, } }) } diff --git a/packages/builder/src/components/common/bindings/BindingPanel.svelte b/packages/builder/src/components/common/bindings/BindingPanel.svelte index 40a4ed8061..18dcb893c2 100644 --- a/packages/builder/src/components/common/bindings/BindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/BindingPanel.svelte @@ -53,15 +53,15 @@ Device: "DevicePhone", "Current User": "User", Helpers: "MagicWand", - Data: "Data", + Dataprovider: "Data", State: "AutomatedSegment", URL: "RailTop", - Role: "UsersLock", + Role: "UserGroup", } let popover let popoverAnchor - let hoverHelper + let hoverTarget $: usingJS = mode === "JavaScript" $: searchRgx = new RegExp(search, "ig") @@ -179,21 +179,15 @@ bind:this={popover} anchor={popoverAnchor} maxWidth={300} - observe={false} > - {#if selectedCategory === "Helpers" || search} -
-
{hoverHelper.displayText}
-
- {@html hoverHelper.description} -
-
{getHelperExample(
-              hoverHelper,
-              usingJS
-            )}
+
+
{hoverTarget.title}
+
+ {@html hoverTarget.description}
- {/if} +
{hoverTarget.example}
+
@@ -244,21 +238,53 @@