From 5e1e435c54b05347759fb3addd48338ca11bbcef Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Mon, 3 Jan 2022 16:58:37 +0200 Subject: [PATCH] feat(List/Matrix View): :sparkles: Option to hide implied relations (fix #226) --- main.js | 35 +++++++++++++++++++++++------------ src/BreadcrumbsSettingTab.ts | 13 +++++++++++++ src/Components/Lists.svelte | 4 ++-- src/Components/Matrix.svelte | 4 ++-- src/constants.ts | 1 + src/interfaces.ts | 1 + 6 files changed, 42 insertions(+), 16 deletions(-) diff --git a/main.js b/main.js index 9e0fd67c..924ad72b 100644 --- a/main.js +++ b/main.js @@ -21117,6 +21117,7 @@ const DEFAULT_SETTINGS = { showBCs: true, showBCsInEditLPMode: false, showRefreshNotice: true, + showImpliedRelations: true, showTrail: true, showGrid: true, showPrevNext: true, @@ -23490,7 +23491,7 @@ function get_each_context_3$2(ctx, list, i) { return child_ctx; } -// (25:8) {#if square.realItems.length > 0 || square.impliedItems.length > 0} +// (25:8) {#if square.realItems.length || (settings.showImpliedRelations && square.impliedItems.length)} function create_if_block$5(ctx) { let details; let summary; @@ -23499,7 +23500,7 @@ function create_if_block$5(ctx) { let t1; let t2; let if_block0 = /*square*/ ctx[12].realItems.length && create_if_block_3$2(ctx); - let if_block1 = /*square*/ ctx[12].impliedItems.length && create_if_block_1$4(ctx); + let if_block1 = /*settings*/ ctx[1].showImpliedRelations && /*square*/ ctx[12].impliedItems.length && create_if_block_1$4(ctx); return { c() { @@ -23539,7 +23540,7 @@ function create_if_block$5(ctx) { if_block0 = null; } - if (/*square*/ ctx[12].impliedItems.length) { + if (/*settings*/ ctx[1].showImpliedRelations && /*square*/ ctx[12].impliedItems.length) { if (if_block1) { if_block1.p(ctx, dirty); } else { @@ -23712,7 +23713,7 @@ function create_each_block_3$2(ctx) { }; } -// (49:12) {#if square.impliedItems.length} +// (49:12) {#if settings.showImpliedRelations && square.impliedItems.length} function create_if_block_1$4(ctx) { let t; let ol; @@ -23884,7 +23885,7 @@ function create_each_block_2$3(ctx) { // (24:6) {#each squares as square} function create_each_block_1$6(ctx) { let if_block_anchor; - let if_block = (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) && create_if_block$5(ctx); + let if_block = (/*square*/ ctx[12].realItems.length || /*settings*/ ctx[1].showImpliedRelations && /*square*/ ctx[12].impliedItems.length) && create_if_block$5(ctx); return { c() { @@ -23896,7 +23897,7 @@ function create_each_block_1$6(ctx) { insert(target, if_block_anchor, anchor); }, p(ctx, dirty) { - if (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) { + if (/*square*/ ctx[12].realItems.length || /*settings*/ ctx[1].showImpliedRelations && /*square*/ ctx[12].impliedItems.length) { if (if_block) { if_block.p(ctx, dirty); } else { @@ -24144,7 +24145,7 @@ function get_each_context_3$1(ctx, list, i) { return child_ctx; } -// (21:8) {#if square.realItems.length > 0 || square.impliedItems.length > 0} +// (21:8) {#if square.realItems.length || (settings.showImpliedRelations && square.impliedItems.length)} function create_if_block$4(ctx) { let div1; let div0; @@ -24156,7 +24157,7 @@ function create_if_block$4(ctx) { let t3; let if_block0 = /*settings*/ ctx[1].showRelationType && create_if_block_5(ctx); let if_block1 = /*square*/ ctx[12].realItems.length && create_if_block_4(ctx); - let if_block2 = /*square*/ ctx[12].impliedItems.length && create_if_block_1$3(ctx); + let if_block2 = /*settings*/ ctx[1].showImpliedRelations && /*square*/ ctx[12].impliedItems.length && create_if_block_1$3(ctx); return { c() { @@ -24215,7 +24216,7 @@ function create_if_block$4(ctx) { if_block1 = null; } - if (/*square*/ ctx[12].impliedItems.length) { + if (/*settings*/ ctx[1].showImpliedRelations && /*square*/ ctx[12].impliedItems.length) { if (if_block2) { if_block2.p(ctx, dirty); } else { @@ -24378,7 +24379,7 @@ function create_each_block_3$1(ctx) { }; } -// (49:12) {#if square.impliedItems.length} +// (49:12) {#if settings.showImpliedRelations && square.impliedItems.length} function create_if_block_1$3(ctx) { let div; let h4; @@ -24604,7 +24605,7 @@ function create_each_block_2$2(ctx) { // (20:6) {#each squares as square} function create_each_block_1$5(ctx) { let if_block_anchor; - let if_block = (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) && create_if_block$4(ctx); + let if_block = (/*square*/ ctx[12].realItems.length || /*settings*/ ctx[1].showImpliedRelations && /*square*/ ctx[12].impliedItems.length) && create_if_block$4(ctx); return { c() { @@ -24616,7 +24617,7 @@ function create_each_block_1$5(ctx) { insert(target, if_block_anchor, anchor); }, p(ctx, dirty) { - if (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) { + if (/*square*/ ctx[12].realItems.length || /*settings*/ ctx[1].showImpliedRelations && /*square*/ ctx[12].impliedItems.length) { if (if_block) { if_block.p(ctx, dirty); } else { @@ -25282,6 +25283,16 @@ class BCSettingTab extends require$$0.PluginSettingTab { await plugin.saveSettings(); await plugin.getActiveTYPEView(MATRIX_VIEW).draw(); })); + new require$$0.Setting(MLViewDetails) + .setName("Show Implied Relations") + .setDesc("Whether or not to show implied relations at all.") + .addToggle((toggle) => toggle + .setValue(settings.showImpliedRelations) + .onChange(async (value) => { + settings.showImpliedRelations = value; + await plugin.saveSettings(); + await plugin.getActiveTYPEView(MATRIX_VIEW).draw(); + })); new require$$0.Setting(MLViewDetails) .setName("Filter Implied Siblings") .setDesc(fragWithHTML(`Implied siblings are: diff --git a/src/BreadcrumbsSettingTab.ts b/src/BreadcrumbsSettingTab.ts index 5178d329..8776920c 100644 --- a/src/BreadcrumbsSettingTab.ts +++ b/src/BreadcrumbsSettingTab.ts @@ -343,6 +343,19 @@ export class BCSettingTab extends PluginSettingTab { }) ); + new Setting(MLViewDetails) + .setName("Show Implied Relations") + .setDesc("Whether or not to show implied relations at all.") + .addToggle((toggle) => + toggle + .setValue(settings.showImpliedRelations) + .onChange(async (value) => { + settings.showImpliedRelations = value; + await plugin.saveSettings(); + await plugin.getActiveTYPEView(MATRIX_VIEW).draw(); + }) + ); + new Setting(MLViewDetails) .setName("Filter Implied Siblings") .setDesc( diff --git a/src/Components/Lists.svelte b/src/Components/Lists.svelte index 55af63d3..32482893 100644 --- a/src/Components/Lists.svelte +++ b/src/Components/Lists.svelte @@ -24,7 +24,7 @@ > {#each squares as square} - {#if square.realItems.length > 0 || square.impliedItems.length > 0} + {#if square.realItems.length || (settings.showImpliedRelations && square.impliedItems.length)}
{square.field} {#if square.realItems.length} @@ -48,7 +48,7 @@ {/if} - {#if square.impliedItems.length} + {#if settings.showImpliedRelations && square.impliedItems.length} {#if settings.showRelationType}
Implied
{/if} diff --git a/src/Components/Matrix.svelte b/src/Components/Matrix.svelte index 0afd7f96..9ceeaf74 100644 --- a/src/Components/Matrix.svelte +++ b/src/Components/Matrix.svelte @@ -20,7 +20,7 @@ {#each filteredSquaresArr as squares}
{#each squares as square} - {#if square.realItems.length > 0 || square.impliedItems.length > 0} + {#if square.realItems.length || (settings.showImpliedRelations && square.impliedItems.length)}

{square.field}

@@ -48,7 +48,7 @@ {/if} - {#if square.impliedItems.length} + {#if settings.showImpliedRelations && square.impliedItems.length}

{#if square.impliedItems.length} diff --git a/src/constants.ts b/src/constants.ts index 1b17fa19..5e4be9b2 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -183,6 +183,7 @@ export const DEFAULT_SETTINGS: BCSettings = { showBCs: true, showBCsInEditLPMode: false, showRefreshNotice: true, + showImpliedRelations: true, showTrail: true, showGrid: true, showPrevNext: true, diff --git a/src/interfaces.ts b/src/interfaces.ts index 9c63d4ee..bddde415 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -54,6 +54,7 @@ export interface BCSettings { showBCsInEditLPMode: boolean; showAll: boolean; showGrid: boolean; + showImpliedRelations: boolean; showPrevNext: boolean; showRefreshNotice: boolean; showTrail: boolean;