- {#if $store && $store.logList.length > 0}
- {#each $store.logList as log (log._id)}
- {#if (
- // filterType
- filterType === 'all' || filterType === log.type)
- &&
- // filterText
- (filterText === '' || isMatchedFilterText(log, filterText)
- )}
-
+
+ Empty
+
+
+ {#if showCmd}
+
{/if}
- {/each}
- {:else}
-
- {/if}
-
- {#if showCmd}
-
- {/if}
-
+
+
diff --git a/src/log/log.ts b/src/log/log.ts
index a59714b5..73c49e46 100644
--- a/src/log/log.ts
+++ b/src/log/log.ts
@@ -61,6 +61,18 @@ export class VConsoleLogPlugin extends VConsoleSveltePlugin {
this.model.clearPluginLog(this.id);
this.vConsole.triggerEvent('clearLog');
}
+ }, {
+ name: 'Top',
+ global: false,
+ onClick: (e) => {
+ this.compInstance.scrollToTop()
+ }
+ }, {
+ name: 'Bottom',
+ global: false,
+ onClick: (e) => {
+ this.compInstance.scrollToBottom()
+ }
}];
callback(toolList);
}
diff --git a/src/log/logCommand.less b/src/log/logCommand.less
index 637dd795..7e5eff79 100644
--- a/src/log/logCommand.less
+++ b/src/log/logCommand.less
@@ -2,13 +2,10 @@
// container
.vc-cmd {
- position: absolute;
height: (40em / @font);
- left: 0;
- right: 0;
- bottom: (40em / @font);
border-top: 1px solid var(--VC-FG-3);
- display: block !important;
+ display: flex;
+ flex-direction: row;
&.vc-filter{
bottom: 0;
@@ -19,9 +16,10 @@
.vc-cmd-input-wrap {
display: flex;
align-items: center;
+ flex: 1;
position: relative;
height: (28em / @font);
- margin-right: (40em / @font);
+ // margin-right: (40em / @font);
padding: (6em / @font) (8em / @font);
}
.vc-cmd-input {
@@ -40,10 +38,10 @@
// button
.vc-cmd-btn {
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
+ // position: absolute;
+ // top: 0;
+ // right: 0;
+ // bottom: 0;
width: (40em / @font);
border: none;
background-color: var(--VC-BG-0);
diff --git a/src/log/logCommand.svelte b/src/log/logCommand.svelte
index 5fb81491..6e6f478f 100644
--- a/src/log/logCommand.svelte
+++ b/src/log/logCommand.svelte
@@ -43,7 +43,7 @@
onDestroy(() => {
Style.unuse();
});
-
+
/*************************************
* Methods
@@ -109,7 +109,7 @@
if (promptedList.length >= 100) {
break;
}
-
+
const key = String(cachedObjKeys[objName][i]);
const keyPattern = new RegExp('^' + keyName, 'i'); // polyfill String.startsWith
if (keyPattern.test(key)) {
@@ -222,8 +222,6 @@
{#each log.data as logData, i (i)}
{#if isTree(logData.origData)}
-
+
{:else}
{/if}
diff --git a/src/log/logTree.svelte b/src/log/logTree.svelte
index a31d5f57..dbc6a0e8 100644
--- a/src/log/logTree.svelte
+++ b/src/log/logTree.svelte
@@ -8,10 +8,11 @@
export let origData: any;
export let dataKey: string = undefined;
+ export let keyPath: string = ''
export let keyType: '' | 'private' | 'symbol' = '';
+ export let toggle: Record
= {}
const KEY_PAGE_SIZE = 50;
- let isInited: boolean = false;
let isToggle: boolean = false;
let isTree: boolean = false;
let isShowProto: boolean = false;
@@ -22,10 +23,9 @@
let childNonEnumKeyOffset = KEY_PAGE_SIZE;
$: {
- if (!isInited) {
- isTree = !(origData instanceof VConsoleUninvocatableObject) && (tool.isArray(origData) || tool.isObject(origData));
- isInited = true;
- }
+ isToggle = toggle[keyPath] || false
+
+ isTree = !(origData instanceof VConsoleUninvocatableObject) && (tool.isArray(origData) || tool.isObject(origData));
if (isTree && isToggle) {
// keys only need to be initialized once
@@ -57,6 +57,7 @@
};
const onTapTreeNode = () => {
isToggle = !isToggle;
+ toggle[keyPath] = isToggle
};
const getValueByKey = (key: any) => {
// invocate some object's property may cause error,
@@ -69,7 +70,7 @@
};
-
+
@@ -79,7 +80,7 @@
{#each childEnumKeys as key, i (key)}
{#if i < childEnumKeyOffset}
-
+
{/if}
{/each}
{#if childEnumKeyOffset < childEnumKeys.length}
@@ -87,12 +88,12 @@
{/if}
{#each childSymbolKeys as key (key)}
-
+
{/each}
{#each childNonEnumKeys as key, i (key)}
{#if i < childNonEnumKeyOffset}
-
+
{/if}
{/each}
{#if childNonEnumKeyOffset < childNonEnumKeys.length}
@@ -100,7 +101,7 @@
{/if}
{#if isShowProto}
-
+
{/if}
{/if}
diff --git a/src/log/logValue.svelte b/src/log/logValue.svelte
index 50f860d2..d747a813 100644
--- a/src/log/logValue.svelte
+++ b/src/log/logValue.svelte
@@ -12,25 +12,19 @@
let dataValue: string = '';
let valueType: string = '';
- let isInited: boolean = false;
let isInTree: boolean = false;
$: {
- if (!isInited) {
- // the value is NOT in a tree when key is undefined
- isInTree = dataKey !== undefined;
+ // the value is NOT in a tree when key is undefined
+ isInTree = dataKey !== undefined;
- const ret = getValueTextAndType(origData, isInTree);
- valueType = ret.valueType;
- dataValue = ret.text;
+ const ret = getValueTextAndType(origData, isInTree);
+ valueType = ret.valueType;
+ dataValue = ret.text;
- if (!isInTree && valueType === 'string') {
- // if it's a single string, then keep line breaks.
- dataValue = dataValue.replace(/\\n/g, '\n').replace(/\\t/g, ' ');
- }
-
- // (window as any)._vcOrigConsole.log('logValue update', origData);
- isInited = true;
+ if (!isInTree && valueType === 'string') {
+ // if it's a single string, then keep line breaks.
+ dataValue = dataValue.replace(/\\n/g, '\n').replace(/\\t/g, ' ');
}
}