Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
Signed-off-by: Vinzenz Rosenkranz <[email protected]>
  • Loading branch information
v1r0x committed Jul 31, 2024
1 parent 558f359 commit c835670
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
6 changes: 1 addition & 5 deletions resources/js/components/attribute/Attribute.vue
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,6 @@
data,
valueWrapper,
disabled,
reactTo,
hideLinks,
preview,
previewData,
} = toRefs(props);
// FETCH
Expand All @@ -356,7 +352,7 @@
disabled: computed(_ => data.value.isDisabled || disabled.value),
value: computed(_ => getValueOrDefault()),
// TODO check for selection need?
selection: computed(_ => getAttributeSelection(data.value.id) || {}),
selection: computed(_ => getAttributeSelection(data.value.id) || []),
});
Expand Down
5 changes: 3 additions & 2 deletions resources/js/components/attribute/Tabular.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<td
v-if="row.hidden_info"
class="text-muted text-center fs-5 p-2 bg-primary-subtle"
:colspan="Object.keys(state.columns).length + 2"
:colspan="state.placeholderWidth"
@click="state.showAll = true"
>
show {{ v.value.length - 20 }} hidden rows…
Expand All @@ -66,7 +66,7 @@
<td
class="text-center"
style="--bs-table-striped-bg:248,249,250;"
:colspan="Object.keys(state.columns).length + 2"
:colspan="state.placeholderWidth"
>
<button
type="button"
Expand Down Expand Up @@ -512,6 +512,7 @@
const state = reactive({
isPreview: computed(_ => preview.value && previewData.value && Object.keys(previewData.value).length > 0),
columns: computed(_ => state.isPreview ? previewData.value : getAttribute(attribute.value.id).columns),
placeholderWidth: computed(_ => Object.keys(state.columns).length + 2),
selections: computed(_ => {
const list = {};
if(!state.columns || state.isPreview) return list;
Expand Down
18 changes: 8 additions & 10 deletions resources/js/helpers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,6 @@ export function getEmptyAttributeValue(type) {
switch(type) {
case 'boolean':
return false;
case 'geography':
case 'iconclass':
case 'string-sc':
case 'date':
case 'url':
return '';
case 'dimension':
case 'entity':
case 'epoch':
Expand All @@ -431,15 +425,19 @@ export function getEmptyAttributeValue(type) {
case 'table':
case 'userlist':
return [];
case 'serial':
case 'sql':
return null;
case 'richtext':
case 'rism':
case 'string':
case 'stringf':
case 'system-separator':
return '';
case 'serial':
case 'sql':
return null;
case 'geography':
case 'iconclass':
case 'string-sc':
case 'date':
case 'url':
default:
return '';
}
Expand Down

0 comments on commit c835670

Please sign in to comment.