diff --git a/src/components/UIShell/FormTest.svelte b/src/components/UIShell/FormTest.svelte
index e69de29b..af97bdcc 100644
--- a/src/components/UIShell/FormTest.svelte
+++ b/src/components/UIShell/FormTest.svelte
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/components/UIShell/UIShell.Story.svelte b/src/components/UIShell/UIShell.Story.svelte
index 2be69076..7191f2b0 100644
--- a/src/components/UIShell/UIShell.Story.svelte
+++ b/src/components/UIShell/UIShell.Story.svelte
@@ -4,7 +4,6 @@
import UIShell from './UIShell.svelte';
import FormTest from './FormTest.svelte';
import SettingsAdjust20 from 'carbon-icons-svelte/lib/SettingsAdjust20';
- // import Binoculars20 from 'carbon-icons-svelte/lib/Binoculars20'
import { leftPanelActions, leftPanelTypes } from './constants';
import searchStore from './searchStore';
@@ -101,7 +100,7 @@
type: leftPanelTypes.links,
content: [
{
- subjet: 'Notification subjet 1',
+ subject: 'Notification subject 1',
items: [
{
href: '#',
@@ -110,7 +109,7 @@
]
},
{
- subjet: 'Notification subjet 2',
+ subject: 'Notification subject 2',
items: [
{
href: '#',
@@ -138,7 +137,7 @@
type: leftPanelTypes.links,
content: [
{
- subjet: 'Switcher subjet 1',
+ subject: 'Switcher subject 1',
items: [
{
href: '#',
@@ -147,7 +146,7 @@
]
},
{
- subjet: 'Switcher subjet 2',
+ subject: 'Switcher subject 2',
items: [
{
href: '#',
@@ -168,7 +167,7 @@
]
},
{
- subjet: 'Switcher subjet 3',
+ subject: 'Switcher subject 3',
items: [
{
href: '#',
@@ -192,22 +191,6 @@
},
isVisible: true
}
- // {
- // action: 'customsearch',
- // type: leftPanelTypes.search,
- // icon: [
- // {
- // class: undefined,
- // skeleton: false,
- // render: Binoculars20,
- // title: 'binoculars',
- // tabIndex: 0,
- // focusable: false,
- // style: undefined
- // }
- // ],
- // isVisible: true
- // }
];
function searchInStore(event) {
diff --git a/src/components/UIShell/UIShellRightPanel/ActionComponent.svelte b/src/components/UIShell/UIShellRightPanel/ActionComponent.svelte
index 93854289..e42b0c85 100644
--- a/src/components/UIShell/UIShellRightPanel/ActionComponent.svelte
+++ b/src/components/UIShell/UIShellRightPanel/ActionComponent.svelte
@@ -1,14 +1,35 @@
-
+
+
+
+
+ {#if componentIsActive}
+
+ {/if}
+
diff --git a/src/components/UIShell/UIShellRightPanel/ActionGeneric.svelte b/src/components/UIShell/UIShellRightPanel/ActionGeneric.svelte
index 679c1be1..c3f2f4da 100644
--- a/src/components/UIShell/UIShellRightPanel/ActionGeneric.svelte
+++ b/src/components/UIShell/UIShellRightPanel/ActionGeneric.svelte
@@ -5,6 +5,7 @@
import ActionComponent from './ActionComponent.svelte';
import ActionSearch from './ActionSearch.svelte';
import { leftPanelTypes } from '../constants';
+ import { isChildOf } from '../helpers';
let typeComponent = undefined;
let componentIsActive = false;
@@ -16,12 +17,61 @@
let isSearchFocus = false;
window.addEventListener('mouseup', ({ target }) => {
- checkForClicks(target, typeComponent, leftPanelTypes.component);
- checkForClicksTypeSearch(target, typeSearch, leftPanelTypes.search);
- checkForClicks(target, typeLink, leftPanelTypes.link);
+ checkForClicksTypeComponent(target, typeComponent);
+ checkForClicksTypeSearch(target, typeSearch);
+ checkForClicksTypeLink(target, typeLink);
});
- function checkForClicks(target, component, actionString) {
+ function checkForClicksTypeComponent(target, component) {
+ if (component && target) {
+ try {
+ if (
+ !isChildOf(target, 'right-panel-action-component') ||
+ !isChildOf(target, 'right-panel-action-component-form')
+ ) {
+ if (component.contains(target) || target === component) {
+ componentIsActive = !componentIsActive;
+ } else {
+ if (componentIsActive) {
+ componentIsActive = false;
+ }
+ }
+ }
+ } catch (error) {
+ if (componentIsActive) {
+ componentIsActive = false;
+ }
+ }
+ }
+ }
+
+ function checkForClicksTypeSearch(target, component, actionString) {
+ if (component && target) {
+ try {
+ if (!isChildOf(target, 'right-panel-action-search')) {
+ if (component.contains(target) || target === component) {
+ searchIsActive = !searchIsActive;
+ } else {
+ if (searchIsActive) {
+ searchIsActive = false;
+ }
+ }
+ } else {
+ if (!searchIsActive && target.id !== 'right-panel-close-search') {
+ searchIsActive = true;
+ } else if (searchIsActive && isChildOf(target, 'right-panel-close-search')) {
+ searchIsActive = false;
+ }
+ }
+ } catch (error) {
+ if (searchIsActive) {
+ searchIsActive = false;
+ }
+ }
+ }
+ }
+
+ function checkForClicksTypeLink(target, component, actionString) {
try {
if (component && target) {
if (component.contains(target) || target === component) {
@@ -44,88 +94,6 @@
}
} catch (error) {}
}
-
- function checkForClicksTypeSearch(target, component, actionString) {
- if (component && target) {
- try {
- if (
- target.id !== 'right-panel-action-search' &&
- target.parentNode.id !== 'right-panel-action-search' &&
- target.parentNode.parentNode.id !== 'right-panel-action-search'
- ) {
- if (component.contains(target) || target === component) {
- if (actionString === leftPanelTypes.component) {
- componentIsActive = !componentIsActive;
- } else if (actionString === leftPanelTypes.search) {
- searchIsActive = !searchIsActive;
- } else if (actionString === leftPanelTypes.link) {
- linkIsActive = !linkIsActive;
- }
- } else {
- if (actionString === leftPanelTypes.component) {
- if (componentIsActive) {
- componentIsActive = false;
- }
- } else if (actionString === leftPanelTypes.search) {
- if (searchIsActive) {
- searchIsActive = false;
- }
- } else if (actionString === leftPanelTypes.link) {
- if (linkIsActive) {
- linkIsActive = false;
- }
- }
- }
- } else {
- if (actionString === leftPanelTypes.component) {
- if (!componentIsActive && target.id !== 'right-panel-close-search') {
- componentIsActive = true;
- } else if (
- componentIsActive &&
- (target.id === 'right-panel-close-search' ||
- target.parentNode.id === 'right-panel-close-search')
- ) {
- componentIsActive = false;
- }
- } else if (actionString === leftPanelTypes.search) {
- if (!searchIsActive && target.id !== 'right-panel-close-search') {
- searchIsActive = true;
- } else if (
- searchIsActive &&
- (target.id === 'right-panel-close-search' ||
- target.parentNode.id === 'right-panel-close-search')
- ) {
- searchIsActive = false;
- }
- } else if (actionString === leftPanelTypes.link) {
- if (!linkIsActive && target.id !== 'right-panel-close-search') {
- linkIsActive = true;
- } else if (
- linkIsActive &&
- (target.id === 'right-panel-close-search' ||
- target.parentNode.id === 'right-panel-close-search')
- ) {
- linkIsActive = false;
- }
- }
- }
- } catch (error) {
- if (actionString === leftPanelTypes.component) {
- if (componentIsActive) {
- componentIsActive = false;
- }
- } else if (actionString === leftPanelTypes.search) {
- if (searchIsActive) {
- searchIsActive = false;
- }
- } else if (actionString === leftPanelTypes.link) {
- if (linkIsActive) {
- linkIsActive = false;
- }
- }
- }
- }
- }
-{#if action.type === leftPanelTypes.component}
- {#if action.isVisible}
+{#if action.isVisible}
+ {#if action.type === leftPanelTypes.component}
- {/if}
-{:else if action.type === leftPanelTypes.search}
- {#if action.isVisible}
+ {:else if action.type === leftPanelTypes.search}
- {/if}
-{:else if action.type === leftPanelTypes.link || action.type === leftPanelTypes.links}
- {#if action.isVisible}
+ {:else if action.type === leftPanelTypes.link || action.type === leftPanelTypes.links}
diff --git a/src/components/UIShell/UIShellRightPanel/ActionLink.svelte b/src/components/UIShell/UIShellRightPanel/ActionLink.svelte
index 51cc04b7..f354c45f 100644
--- a/src/components/UIShell/UIShellRightPanel/ActionLink.svelte
+++ b/src/components/UIShell/UIShellRightPanel/ActionLink.svelte
@@ -2,14 +2,20 @@
export let action = undefined;
export let type = undefined;
export let icon = undefined;
- // export let content = undefined;
+ export let content = undefined;
export let linkIsActive = undefined;
import { cx } from '../../../lib';
import Icon from '../../Icon/Icon.svelte';
- import { leftPanelActions } from '../constants';
+ import { leftPanelActions, leftPanelTypes } from '../constants';
import { slide } from 'svelte/transition';
+ let href = undefined;
+
+ if (type === leftPanelTypes.link) {
+ href = content.href;
+ }
+
if (!icon) {
const actionsArray = Object.entries(leftPanelActions);
@@ -25,33 +31,63 @@
}
-
-{#if linkIsActive}
-
+
+
+{#if type === leftPanelTypes.link}
+
+{:else}
+
+ {#if linkIsActive && type === leftPanelTypes.links}
+
+ {/if}
{/if}
diff --git a/src/components/UIShell/UIShellRightPanel/ActionSearch.svelte b/src/components/UIShell/UIShellRightPanel/ActionSearch.svelte
index 7a7f34a1..c1095cd5 100644
--- a/src/components/UIShell/UIShellRightPanel/ActionSearch.svelte
+++ b/src/components/UIShell/UIShellRightPanel/ActionSearch.svelte
@@ -38,10 +38,6 @@
dispatch('inputSearch', params);
}
- function clearSearch() {
- searchStore.clear();
- }
-
$: if (!searchIsActive) {
try {
inputSearchField.value = '';
@@ -172,7 +168,7 @@
class:btn-clear-hidden={!searchIsActive}
type="button"
aria-label="Clear search"
- on:click={clearSearch}>
+ on:click={() => searchStore.clear()}>
diff --git a/src/components/UIShell/helpers.js b/src/components/UIShell/helpers.js
new file mode 100644
index 00000000..10e9f6e5
--- /dev/null
+++ b/src/components/UIShell/helpers.js
@@ -0,0 +1,21 @@
+export function isChildOf(target, parentId) {
+ if (target.id) {
+ if (target.id == parentId) {
+ return true;
+ }
+ }
+
+ if (target.parentNode) {
+ if (target.parentNode.id) {
+ if (target.parentNode.id == parentId) {
+ return true;
+ } else {
+ return isChildOf(target.parentNode, parentId);
+ }
+ } else {
+ return isChildOf(target.parentNode, parentId);
+ }
+ } else {
+ return false;
+ }
+}