From 52174bad8a6cc0c5a0d0fee058fc40ec92dbd870 Mon Sep 17 00:00:00 2001 From: Johan Lahti Date: Fri, 18 Aug 2023 10:01:28 +0200 Subject: [PATCH] refactor: move collapse mode to presentation --- .../property-panel/data/data-panel/index.ts | 40 +++---------------- .../data/data-panel/presentation/index.ts | 30 ++++++++++++++ types/global.d.ts | 1 + 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/packages/sn-filter-pane/src/ext/property-panel/data/data-panel/index.ts b/packages/sn-filter-pane/src/ext/property-panel/data/data-panel/index.ts index 8a22b72c..309fb63f 100644 --- a/packages/sn-filter-pane/src/ext/property-panel/data/data-panel/index.ts +++ b/packages/sn-filter-pane/src/ext/property-panel/data/data-panel/index.ts @@ -114,41 +114,11 @@ export default function getDataPanelItems(env: IEnv) { }, }, }, - autoConfirmGroup: { - type: 'items', - grouped: true, - show() { - return env?.flags?.isEnabled('IM_4072_FILTERPANE_SETTINGS'); - }, - items: { - autoConfirm: { - ref: 'autoConfirm', - component: 'checkbox', - translation: 'properties.filterpane.autoConfirm', - defaultValue: false, - }, - }, - }, - collapseMode: { - ref: 'collapseMode', - type: 'string', - component: 'buttongroup', // dropdown - translation: 'properties.filterpane.collapseMode', - defaultValue: 'auto', - options: [ - { - value: 'auto', - translation: 'Common.Auto', - }, - { - value: 'always', - translation: 'Common.Always', - }, - { - value: 'never', - translation: 'Common.Never', - }, - ], + autoConfirm: { + ref: 'autoConfirm', + component: 'checkbox', + translation: 'properties.filterpane.autoConfirm', + defaultValue: false, show() { return env?.flags?.isEnabled('IM_4072_FILTERPANE_SETTINGS'); }, diff --git a/packages/sn-filter-pane/src/ext/property-panel/data/data-panel/presentation/index.ts b/packages/sn-filter-pane/src/ext/property-panel/data/data-panel/presentation/index.ts index 51c3b51b..0eec5ff2 100644 --- a/packages/sn-filter-pane/src/ext/property-panel/data/data-panel/presentation/index.ts +++ b/packages/sn-filter-pane/src/ext/property-panel/data/data-panel/presentation/index.ts @@ -106,6 +106,36 @@ export default function getPresentation(env: IEnv) { }, }, }, + collapseModeGroup: { + type: 'items', + grouped: true, + show() { + return env?.flags?.isEnabled('IM_4072_FILTERPANE_SETTINGS'); + }, + items: { + collapseMode: { + ref: 'collapseMode', + type: 'string', + component: 'dropdown', + translation: 'properties.filterpane.collapseMode', + defaultValue: 'auto', + options: [ + { + value: 'auto', + translation: 'Common.Auto', + }, + { + value: 'always', + translation: 'Common.Always', + }, + { + value: 'never', + translation: 'Common.Never', + }, + ], + }, + }, + }, gridModeGroup: { grouped: true, type: 'items', diff --git a/types/global.d.ts b/types/global.d.ts index 2b701cd0..6c497e08 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -8,6 +8,7 @@ export interface IListLayout extends EngineAPI.IGenericListLayout { dense: boolean, dataLayout?: 'grid' | 'singleColumn', }, + collapseMode?: 'auto' | 'always' | 'never'; showTitle?: boolean, qHasSoftPatches?: boolean; qExtendsId?: string;