refactor: removed is_custom getter & refactored code accordingly
This commit is contained in:
parent
601062e7fd
commit
bb0e28937b
6 changed files with 9 additions and 15 deletions
|
|
@ -19,7 +19,7 @@ function add_column() {
|
|||
}
|
||||
|
||||
function remove_column() {
|
||||
if (store.is_customize_form && store.is_custom(props.column) == 0) {
|
||||
if (store.is_customize_form && props.column.df.is_custom_field == 0) {
|
||||
frappe.msgprint(__("Cannot delete standard field. You can hide it if you want"));
|
||||
throw "cannot delete standard field";
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ function remove_column() {
|
|||
<Field
|
||||
:column="column"
|
||||
:field="element"
|
||||
:data-is-custom="store.is_custom(element)"
|
||||
:data-is-custom="element.df.is_custom_field"
|
||||
/>
|
||||
</template>
|
||||
</draggable>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ let editing = ref(false);
|
|||
let hovered = ref(false);
|
||||
|
||||
function remove_field() {
|
||||
if (store.is_customize_form && store.is_custom(props.field) == 0) {
|
||||
if (store.is_customize_form && props.field.df.is_custom_field == 0) {
|
||||
frappe.msgprint(__("Cannot delete standard field. You can hide it if you want"));
|
||||
throw "cannot delete standard field";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ onMounted(() => store.fetch());
|
|||
}
|
||||
}
|
||||
|
||||
:deep([data-is-custom="1"]) {
|
||||
:deep([data-has-std-field="false"]), :deep([data-is-custom="1"]) {
|
||||
background-color: var(--yellow-highlight-color);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ function remove_section() {
|
|||
<Column
|
||||
:section="section"
|
||||
:column="element"
|
||||
:data-is-custom="store.is_custom(element)"
|
||||
:data-is-custom="element.df.is_custom_field"
|
||||
:data-has-std-field="store.has_standard_field(element)"
|
||||
/>
|
||||
</template>
|
||||
|
|
@ -115,13 +115,14 @@ function remove_section() {
|
|||
<style lang="scss" scoped>
|
||||
.form-section-container {
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
background-color: var(--fg-color);
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.form-section {
|
||||
background-color: var(--fg-color);
|
||||
background-color: inherit;
|
||||
border: 1px solid transparent;
|
||||
border-radius: var(--border-radius);
|
||||
padding: 1rem;
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ function remove_tab() {
|
|||
<div
|
||||
:class="['tab', store.active_tab == element.df.name ? 'active' : '']"
|
||||
:title="element.df.fieldname"
|
||||
:data-is-custom="store.is_custom(element)"
|
||||
:data-is-custom="element.df.is_custom_field"
|
||||
:data-has-std-field="store.has_standard_field(element)"
|
||||
@click.stop="activate_tab(element)"
|
||||
@dragstart="dragged = true"
|
||||
|
|
@ -175,7 +175,7 @@ function remove_tab() {
|
|||
<Section
|
||||
:tab="tab"
|
||||
:section="element"
|
||||
:data-is-custom="store.is_custom(element)"
|
||||
:data-is-custom="element.df.is_custom_field"
|
||||
:data-has-std-field="store.has_standard_field(element)"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -34,13 +34,6 @@ export const useStore = defineStore("store", {
|
|||
return df;
|
||||
};
|
||||
},
|
||||
is_custom: (state) => {
|
||||
return (field) => {
|
||||
if (!state.is_customize_form) return;
|
||||
if (field.is_first) return 0;
|
||||
return field.df.is_custom_field;
|
||||
};
|
||||
},
|
||||
has_standard_field: (state) => {
|
||||
return (field) => {
|
||||
if (!state.is_customize_form) return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue