imp: rename library into owl

This commit is contained in:
Géry Debongnie
2019-03-27 15:26:20 +01:00
parent e53287b52e
commit 80e2124cbf
11 changed files with 18 additions and 16 deletions
+5 -3
View File
@@ -5,12 +5,14 @@ We hope to use it in the Odoo web client soon.
--- ---
# Core Utility for Odoo Web Client # 🦉 Odoo Web Lab 🦉
## Overview ## Overview
This repository contains some useful building block for building web applications. Odoo Web Lab (OWL) is a project to collect some useful, reusable, well designed
We made some efforts to make sure the code is reusable and generic. However, since this is the basis for the Odoo web client, we will not hesitate to design building block for building web applications.
However, since this is the basis for the Odoo web client, we will not hesitate to design
the code here to better match the Odoo architecture/design principles. the code here to better match the Odoo architecture/design principles.
Currently, this repository contains: Currently, this repository contains:
+1 -1
View File
@@ -25,7 +25,7 @@ const template = `
</div> </div>
</div>`; </div>`;
export class App extends odoo.core.Component { export class App extends owl.core.Component {
constructor(parent, props) { constructor(parent, props) {
super(parent, props); super(parent, props);
this.inlineTemplate = template; this.inlineTemplate = template;
+1 -1
View File
@@ -1,4 +1,4 @@
export class Counter extends odoo.core.Component { export class Counter extends owl.core.Component {
inlineTemplate = ` inlineTemplate = `
<div> <div>
<button t-on-click="increment(-1)">-</button> <button t-on-click="increment(-1)">-</button>
+1 -1
View File
@@ -2,7 +2,7 @@ import { App } from "./app.js";
function createApp(el) { function createApp(el) {
const env = { const env = {
qweb: new odoo.core.QWeb() qweb: new owl.core.QWeb()
}; };
const app = new App(env, { initialState: 13 }); const app = new App(env, { initialState: 13 });
app.mount(el); app.mount(el);
+1 -1
View File
@@ -1,6 +1,6 @@
import { Counter } from "./counter.js"; import { Counter } from "./counter.js";
export class Message extends odoo.core.Component { export class Message extends owl.core.Component {
inlineTemplate = ` inlineTemplate = `
<div class="message"> <div class="message">
<span class="author"><t t-esc="props.author"/></span> <span class="author"><t t-esc="props.author"/></span>
+2 -2
View File
@@ -1,7 +1,7 @@
import { TodoItem } from "./TodoItem.js"; import { TodoItem } from "./TodoItem.js";
const { Component } = odoo.core; const { Component } = owl.core;
const { connect } = odoo.extras; const { connect } = owl.extras;
const ENTER_KEY = 13; const ENTER_KEY = 13;
+1 -1
View File
@@ -1,7 +1,7 @@
const ENTER_KEY = 13; const ENTER_KEY = 13;
const ESC_KEY = 27; const ESC_KEY = 27;
export class TodoItem extends odoo.core.Component { export class TodoItem extends owl.core.Component {
template = "todoitem"; template = "todoitem";
state = { isEditing: false }; state = { isEditing: false };
+1 -1
View File
@@ -8,7 +8,7 @@ async function makeEnv() {
} }
let templates = await result.text(); let templates = await result.text();
templates = templates.replace(/<!--[\s\S]*?-->/g, ""); templates = templates.replace(/<!--[\s\S]*?-->/g, "");
const qweb = new odoo.core.QWeb(); const qweb = new owl.core.QWeb();
qweb.loadTemplates(templates); qweb.loadTemplates(templates);
return { return {
qweb, qweb,
+1 -1
View File
@@ -66,7 +66,7 @@ export function makeStore() {
); );
const nextId = Math.max(0, ...todos.map(t => t.id || 0)) + 1; const nextId = Math.max(0, ...todos.map(t => t.id || 0)) + 1;
const state = { todos, nextId }; const state = { todos, nextId };
const store = new odoo.extras.Store({ state, actions, mutations }); const store = new owl.extras.Store({ state, actions, mutations });
store.on("update", null, () => { store.on("update", null, () => {
const state = JSON.stringify(store.state.todos); const state = JSON.stringify(store.state.todos);
window.localStorage.setItem(LOCALSTORAGE_KEY, state); window.localStorage.setItem(LOCALSTORAGE_KEY, state);
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "web-core", "name": "owl",
"version": "0.3.0", "version": "0.3.0",
"description": "Core Utils for Odoo Web Client", "description": "Odoo Web Lab",
"main": "src/index.ts", "main": "src/index.ts",
"scripts": { "scripts": {
"build:js": "tsc --lib es2017,dom --target esnext --outDir dist/core src/*", "build:js": "tsc --lib es2017,dom --target esnext --outDir dist/core src/*",
+2 -2
View File
@@ -7,8 +7,8 @@ export default {
output: { output: {
file: "dist/core.js", file: "dist/core.js",
format: "iife", format: "iife",
name: "odoo", name: "owl",
extend: true, extend: true,
outro: `exports.core._version = '${version}';\nexports.core._date = '${new Date().toISOString()}';\nexports.core._hash = '${git.short()}';` outro: `exports._version = '${version}';\nexports._date = '${new Date().toISOString()}';\nexports._hash = '${git.short()}';`
} }
}; };