[MIG] web_responsive: Migration to 17.0

This commit is contained in:
Taras Shabaranskyi
2023-11-17 03:43:53 +02:00
parent 08b8d7bfab
commit 7d4e65dac6
89 changed files with 4140 additions and 2311 deletions

View File

@@ -0,0 +1,21 @@
/** @odoo-module **/
import {useState} from "@odoo/owl";
import {useService} from "@web/core/utils/hooks";
import {CommandPalette} from "@web/core/commands/command_palette";
import {patch} from "@web/core/utils/patch";
export const unpatchCommandPalette = patch(CommandPalette.prototype, {
setup() {
super.setup();
this.ui = useState(useService("ui"));
},
get small() {
return this.ui.size < 2;
},
get contentClass() {
return `o_command_palette ${this.small ? "" : "mt-5"}`;
},
});

View File

@@ -0,0 +1,28 @@
.o_command_palette {
.o_command_palette_exit {
display: none;
}
@include media-breakpoint-down(sm) {
.o_command_palette_root {
display: flex;
max-height: 100vh;
max-height: 100dvh;
flex-direction: column;
height: 100%;
justify-content: space-between;
}
.o_command_palette_exit {
display: block;
}
.o_command_palette_search {
flex-shrink: 0;
}
.o_command_palette_listbox {
max-height: unset;
}
.o_command_palette_footer {
flex-shrink: 0;
}
}
}

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<templates>
<t
t-name="web_responsive.CommandPalette"
t-inherit="web.CommandPalette"
t-inherit-mode="extension"
>
<xpath expr="//Dialog" position="attributes">
<attribute name="contentClass">contentClass</attribute>
</xpath>
<xpath expr="//div[@t-ref='root']" position="attributes">
<attribute name="class">o_command_palette_root</attribute>
</xpath>
<xpath expr="//div[hasclass('o_command_palette_search')]" position="before">
<div class="o_command_palette_exit">
<button
type="button"
class="btn btn-secondary w-100"
t-on-click="props.close"
>Exit</button>
</div>
</xpath>
</t>
</templates>