Skip to content

Commit

Permalink
feat(List/Matrix View): ✨ Option to hide implied relations (fix #226)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Jan 3, 2022
1 parent b4cf427 commit 5e1e435
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 16 deletions.
35 changes: 23 additions & 12 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21117,6 +21117,7 @@ const DEFAULT_SETTINGS = {
showBCs: true,
showBCsInEditLPMode: false,
showRefreshNotice: true,
showImpliedRelations: true,
showTrail: true,
showGrid: true,
showPrevNext: true,
Expand Down Expand Up @@ -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;
Expand All @@ -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() {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand All @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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() {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand All @@ -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 {
Expand Down Expand Up @@ -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:
Expand Down
13 changes: 13 additions & 0 deletions src/BreadcrumbsSettingTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Lists.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
<details open class="BC-details">
<summary>{square.field}</summary>
{#if square.realItems.length}
Expand All @@ -48,7 +48,7 @@
</ol>
{/if}

{#if square.impliedItems.length}
{#if settings.showImpliedRelations && square.impliedItems.length}
{#if settings.showRelationType}
<h5 class="BC-header">Implied</h5>
{/if}
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Matrix.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{#each filteredSquaresArr as squares}
<div>
{#each squares as square}
{#if square.realItems.length > 0 || square.impliedItems.length > 0}
{#if square.realItems.length || (settings.showImpliedRelations && square.impliedItems.length)}
<div class="BC-Matrix-square">
<div class="BC-Matrix-headers">
<h4 class="BC-Matrix-header">{square.field}</h4>
Expand Down Expand Up @@ -48,7 +48,7 @@
</ol>
{/if}

{#if square.impliedItems.length}
{#if settings.showImpliedRelations && square.impliedItems.length}
<div class="BC-Matrix-headers">
<h4 class="BC-Matrix-header" />
{#if square.impliedItems.length}
Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export const DEFAULT_SETTINGS: BCSettings = {
showBCs: true,
showBCsInEditLPMode: false,
showRefreshNotice: true,
showImpliedRelations: true,
showTrail: true,
showGrid: true,
showPrevNext: true,
Expand Down
1 change: 1 addition & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export interface BCSettings {
showBCsInEditLPMode: boolean;
showAll: boolean;
showGrid: boolean;
showImpliedRelations: boolean;
showPrevNext: boolean;
showRefreshNotice: boolean;
showTrail: boolean;
Expand Down

0 comments on commit 5e1e435

Please sign in to comment.