2
0
mirror of https://github.com/frappe/books.git synced 2024-11-08 23:00:56 +00:00

fix(ui): transition for hints

- remove fix scrollbar jump on edit toggle
- remove toggle edit toast
- (unrelated) add formula for root type
This commit is contained in:
18alantom 2023-03-11 10:31:40 +05:30
parent f7f3444352
commit f061108565
2 changed files with 47 additions and 20 deletions

View File

@ -7,7 +7,9 @@ import {
RequiredMap, RequiredMap,
TreeViewSettings, TreeViewSettings,
ReadOnlyMap, ReadOnlyMap,
FormulaMap,
} from 'fyo/model/types'; } from 'fyo/model/types';
import { ModelNameEnum } from 'models/types';
import { QueryFilter } from 'utils/db/types'; import { QueryFilter } from 'utils/db/types';
import { AccountRootType, AccountRootTypeEnum, AccountType } from './types'; import { AccountRootType, AccountRootTypeEnum, AccountType } from './types';
@ -76,6 +78,22 @@ export class Account extends Doc {
}; };
} }
formulas: FormulaMap = {
rootType: {
formula: async () => {
if (!this.parentAccount) {
return;
}
return await this.fyo.getValue(
ModelNameEnum.Account,
this.parentAccount,
'rootType'
);
},
},
};
static filters: FiltersMap = { static filters: FiltersMap = {
parentAccount: (doc: Doc) => { parentAccount: (doc: Doc) => {
const filter: QueryFilter = { const filter: QueryFilter = {

View File

@ -34,12 +34,12 @@
<!-- Template Builder Body --> <!-- Template Builder Body -->
<div <div
v-if="doc" v-if="doc"
class="w-full bg-gray-25 grid" class="w-full bg-gray-50 grid"
:style="templateBuilderBodyStyles" :style="templateBuilderBodyStyles"
> >
<!-- Template Display Area --> <!-- Template Display Area -->
<div <div
class="overflow-auto custom-scroll flex flex-col" class="overflow-auto no-scrollbar flex flex-col"
style="height: calc(100vh - var(--h-row-largest) - 1px)" style="height: calc(100vh - var(--h-row-largest) - 1px)"
> >
<!-- Display Hints --> <!-- Display Hints -->
@ -173,13 +173,15 @@
</div> </div>
<!-- Value Key Hints --> <!-- Value Key Hints -->
<div <Transition name="hints">
v-if="showHints" <div
class="overflow-auto custom-scroll p-2 border-t" v-if="showHints"
style="max-height: 30vh" class="overflow-auto custom-scroll p-2 border-t"
> style="max-height: 30vh"
<TemplateBuilderHint :hints="hints" /> >
</div> <TemplateBuilderHint :hints="hints" />
</div>
</Transition>
</div> </div>
</div> </div>
</div> </div>
@ -354,22 +356,11 @@ export default defineComponent({
showSidebar.value = false; showSidebar.value = false;
this.scale = this.getEditModeScale(); this.scale = this.getEditModeScale();
this.view?.focus(); this.view?.focus();
showToast({
type: 'info',
message: this.t`Edit Mode enabled`,
duration: 1000,
});
}, },
disableEditMode() { disableEditMode() {
showSidebar.value = this.preEditMode.showSidebar; showSidebar.value = this.preEditMode.showSidebar;
this.panelWidth = this.preEditMode.panelWidth; this.panelWidth = this.preEditMode.panelWidth;
this.scale = this.preEditMode.scale; this.scale = this.preEditMode.scale;
showToast({
type: 'info',
message: this.t`Edit Mode disabled`,
duration: 1000,
});
}, },
getEditModeScale(): number { getEditModeScale(): number {
// @ts-ignore // @ts-ignore
@ -550,3 +541,21 @@ export default defineComponent({
}, },
}); });
</script> </script>
<style scoped>
.hints-enter-from,
.hints-leave-to {
opacity: 0;
height: 0px;
}
.hints-enter-to,
.hints-leave-from {
opacity: 1;
height: 30vh;
}
.hints-enter-active,
.hints-leave-active {
transition: all 150ms ease-out;
}
</style>