diff --git a/lerna.json b/lerna.json index db0a1d59fa..9488ebe3a0 100644 --- a/lerna.json +++ b/lerna.json @@ -22,4 +22,4 @@ "loadEnvFiles": false } } -} \ No newline at end of file +} diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte index c6d4ed3353..88866196a7 100644 --- a/packages/bbui/src/Form/Core/Picker.svelte +++ b/packages/bbui/src/Form/Core/Picker.svelte @@ -157,7 +157,7 @@ useAnchorWidth={!autoWidth} maxWidth={autoWidth ? 400 : null} customHeight={customPopoverHeight} - maxHeight={240} + maxHeight={360} >
- import { flip } from "svelte/animate" - import { dndzone } from "svelte-dnd-action" - import Icon from "../Icon/Icon.svelte" - import Popover from "../Popover/Popover.svelte" - import { onMount } from "svelte" - - const flipDurationMs = 150 - - export let constraints - export let optionColors = {} - let options = [] - - let colorPopovers = [] - let anchors = [] - - let colorsArray = [ - "hsla(0, 90%, 75%, 0.3)", - "hsla(50, 80%, 75%, 0.3)", - "hsla(120, 90%, 75%, 0.3)", - "hsla(200, 90%, 75%, 0.3)", - "hsla(240, 90%, 75%, 0.3)", - "hsla(320, 90%, 75%, 0.3)", - ] - const removeInput = idx => { - delete optionColors[options[idx].name] - constraints.inclusion = constraints.inclusion.filter((e, i) => i !== idx) - options = options.filter((e, i) => i !== idx) - colorPopovers.pop(undefined) - anchors.pop(undefined) - } - - const addNewInput = () => { - options = [ - ...options, - { name: `Option ${constraints.inclusion.length + 1}`, id: Math.random() }, - ] - constraints.inclusion = [ - ...constraints.inclusion, - `Option ${constraints.inclusion.length + 1}`, - ] - - colorPopovers.push(undefined) - anchors.push(undefined) - } - - const handleDndConsider = e => { - options = e.detail.items - } - const handleDndFinalize = e => { - options = e.detail.items - constraints.inclusion = options.map(option => option.name) - } - - const handleColorChange = (optionName, color, idx) => { - optionColors[optionName] = color - colorPopovers[idx].hide() - } - - const handleNameChange = (optionName, idx, value) => { - constraints.inclusion[idx] = value - options[idx].name = value - optionColors[value] = optionColors[optionName] - delete optionColors[optionName] - } - - const openColorPickerPopover = (optionIdx, target) => { - colorPopovers[optionIdx].show() - anchors[optionIdx] = target - } - - onMount(() => { - // Initialize anchor arrays on mount, assuming 'options' is already populated - colorPopovers = constraints.inclusion.map(() => undefined) - anchors = constraints.inclusion.map(() => undefined) - - options = constraints.inclusion.map(value => ({ - name: value, - id: Math.random(), - })) - }) - - - - -
-
- {#each options as option, idx (option.id)} -
-
- -
-
-
openColorPickerPopover(idx, e.target)} - > - -
- {#each colorsArray as color} -
handleColorChange(option.name, color, idx)} - style="--color:{color};" - class="circle circle-hover" - /> - {/each} -
- -
-
-
- handleNameChange(option.name, idx, e.target.value)} - value={option.name} - placeholder="Option name" - /> -
-
- -
-
- {/each} -
-
- -
Add option
-
-
- - diff --git a/packages/bbui/src/index.js b/packages/bbui/src/index.js index e746e3a72b..7a4ff3f081 100644 --- a/packages/bbui/src/index.js +++ b/packages/bbui/src/index.js @@ -89,7 +89,6 @@ export { default as ListItem } from "./List/ListItem.svelte" export { default as IconSideNav } from "./IconSideNav/IconSideNav.svelte" export { default as IconSideNavItem } from "./IconSideNav/IconSideNavItem.svelte" export { default as Accordion } from "./Accordion/Accordion.svelte" -export { default as OptionSelectDnD } from "./OptionSelectDnD/OptionSelectDnD.svelte" export { default as AbsTooltip } from "./Tooltip/AbsTooltip.svelte" export { TooltipPosition, TooltipType } from "./Tooltip/AbsTooltip.svelte" diff --git a/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte b/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte index 087d0b94fc..0a27360347 100644 --- a/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte +++ b/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte @@ -99,7 +99,7 @@ on:change={e => onChange(e, field)} useLabel={false} /> -{:else if schema.type === "bb_reference"} +{:else if schema.type === "bb_reference" || schema.type === "bb_reference_single"} {:else if type === "attachment"} {:else if type === "attachment_single"} source._id === table?.sourceId @@ -559,9 +561,10 @@ bind:value={editableColumn.constraints.length.maximum} /> {:else if editableColumn.type === FieldType.OPTIONS} - {:else if editableColumn.type === FieldType.LONGFORM}
@@ -582,9 +585,10 @@ />
{:else if editableColumn.type === FieldType.ARRAY} - {:else if editableColumn.type === DATE_TYPE && !editableColumn.autocolumn}
diff --git a/packages/builder/src/components/backend/DataTable/modals/OptionsEditor.svelte b/packages/builder/src/components/backend/DataTable/modals/OptionsEditor.svelte new file mode 100644 index 0000000000..8e35e38ae9 --- /dev/null +++ b/packages/builder/src/components/backend/DataTable/modals/OptionsEditor.svelte @@ -0,0 +1,252 @@ + + + + +
+
options.set(e.detail.items)} + on:finalize={e => options.set(e.detail.items)} + > + {#each $enrichedOptions as option (option.id)} +
+
+ +
+
openColorPicker(option.id)} + > +
+ +
+ {#each OptionColours as colorOption} +
handleColorChange(option.id, colorOption)} + style="--color:{colorOption};" + class="circle" + class:selected={colorOption === option.color} + /> + {/each} +
+ +
+
+ handleNameChange(option.id, e.target.value)} + /> + removeInput(option.id)} + /> +
+ {/each} +
+
+ +
Add option
+
+
+ + diff --git a/packages/builder/src/components/common/LinkedRowSelector.svelte b/packages/builder/src/components/common/LinkedRowSelector.svelte index b042d3a9ae..8db4a7dc03 100644 --- a/packages/builder/src/components/common/LinkedRowSelector.svelte +++ b/packages/builder/src/components/common/LinkedRowSelector.svelte @@ -43,7 +43,7 @@ {linkedTable.name} table. -{:else if schema.relationshipType === "one-to-many"} +{:else if schema.relationshipType === "one-to-many" || schema.type === "bb_reference_single"}