form view cell width fix

This commit is contained in:
Jan Prochazka
2021-11-18 18:30:13 +01:00
parent 780c1321e6
commit fb01b4b3f7
2 changed files with 47 additions and 47 deletions

View File

@@ -58,7 +58,7 @@
export let isAutofillSelected = false; export let isAutofillSelected = false;
export let isFocusedColumn = false; export let isFocusedColumn = false;
export let domCell = undefined; export let domCell = undefined;
export let hideContent = false; export let showSlot = false;
export let onSetFormView; export let onSetFormView;
export let isDynamicStructure = false; export let isDynamicStructure = false;
export let isAutoFillMarker = false; export let isAutoFillMarker = false;
@@ -96,61 +96,61 @@
class:isFocusedColumn class:isFocusedColumn
{style} {style}
> >
{#if hideContent} {#if value === null}
<slot /> <span class="null">(NULL)</span>
{:else} {:else if value === undefined}
{#if value === null} <span class="null">(No field)</span>
<span class="null">(NULL)</span> {:else if _.isDate(value)}
{:else if value === undefined} {value.toString()}
<span class="null">(No field)</span> {:else if value === true}
{:else if _.isDate(value)} <span class="value">true</span>
{value.toString()} {:else if value === false}
{:else if value === true} <span class="value">false</span>
<span class="value">true</span> {:else if _.isNumber(value)}
{:else if value === false} <span class="value">{formatNumber(value)}</span>
<span class="value">false</span> {:else if _.isString(value)}
{:else if _.isNumber(value)} {#if dateTimeRegex.test(value)}
<span class="value">{formatNumber(value)}</span> <span class="value">
{:else if _.isString(value)} {formatDateTime(value)}
{#if dateTimeRegex.test(value)} </span>
<span class="value">
{formatDateTime(value)}
</span>
{:else}
{highlightSpecialCharacters(value)}
{/if}
{:else if value?.type == 'Buffer' && _.isArray(value.data)}
{#if value.data.length <= 16}
<span class="value">{arrayToHexString(value.data)}</span>
{:else}
<span class="null">({value.data.length} bytes)</span>
{/if}
{:else if _.isPlainObject(value)}
<span class="null" title={JSON.stringify(value, undefined, 2)}>(JSON)</span>
{:else if _.isArray(value)}
<span class="null">[{value.length} items]</span>
{:else} {:else}
{value.toString()} {highlightSpecialCharacters(value)}
{/if} {/if}
{:else if value?.type == 'Buffer' && _.isArray(value.data)}
{#if value.data.length <= 16}
<span class="value">{arrayToHexString(value.data)}</span>
{:else}
<span class="null">({value.data.length} bytes)</span>
{/if}
{:else if _.isPlainObject(value)}
<span class="null" title={JSON.stringify(value, undefined, 2)}>(JSON)</span>
{:else if _.isArray(value)}
<span class="null">[{value.length} items]</span>
{:else}
{value.toString()}
{/if}
{#if allowHintField && rowData && _.some(col.hintColumnNames, hintColumnName => rowData[hintColumnName])} {#if allowHintField && rowData && _.some(col.hintColumnNames, hintColumnName => rowData[hintColumnName])}
<span class="hint" <span class="hint"
>{col.hintColumnNames.map(hintColumnName => rowData[hintColumnName]).join(col.hintColumnDelimiter || ' ')}</span >{col.hintColumnNames.map(hintColumnName => rowData[hintColumnName]).join(col.hintColumnDelimiter || ' ')}</span
> >
{/if} {/if}
{#if col.foreignKey && rowData && rowData[col.uniqueName] && !isCurrentCell} {#if col.foreignKey && rowData && rowData[col.uniqueName] && !isCurrentCell}
<ShowFormButton on:click={() => onSetFormView(rowData, col)} /> <ShowFormButton on:click={() => onSetFormView(rowData, col)} />
{/if} {/if}
{#if col.foreignKey && isCurrentCell && onDictionaryLookup} {#if col.foreignKey && isCurrentCell && onDictionaryLookup}
<ShowFormButton icon="icon dots-horizontal" on:click={onDictionaryLookup} /> <ShowFormButton icon="icon dots-horizontal" on:click={onDictionaryLookup} />
{/if}
{/if} {/if}
{#if isAutoFillMarker} {#if isAutoFillMarker}
<div class="autoFillMarker autofillHandleMarker" /> <div class="autoFillMarker autofillHandleMarker" />
{/if} {/if}
{#if showSlot}
<slot />
{/if}
</td> </td>
<!-- {#if _.isArray(value.data)} <!-- {#if _.isArray(value.data)}

View File

@@ -537,7 +537,7 @@
allowHintField={!(rowStatus.modifiedFields && rowStatus.modifiedFields.has(col.uniqueName))} allowHintField={!(rowStatus.modifiedFields && rowStatus.modifiedFields.has(col.uniqueName))}
bind:domCell={domCells[`${rowIndex},${chunkIndex * 2 + 1}`]} bind:domCell={domCells[`${rowIndex},${chunkIndex * 2 + 1}`]}
onSetFormView={handleSetFormView} onSetFormView={handleSetFormView}
hideContent={!rowData || showSlot={!rowData ||
($inplaceEditorState.cell && ($inplaceEditorState.cell &&
rowIndex == $inplaceEditorState.cell[0] && rowIndex == $inplaceEditorState.cell[0] &&
chunkIndex * 2 + 1 == $inplaceEditorState.cell[1])} chunkIndex * 2 + 1 == $inplaceEditorState.cell[1])}