-
-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrap Dijit widgets required to move the UI away from directly depending on Dojo #7214
Conversation
9ab7d5a
to
46d9e3e
Compare
46d9e3e
to
5eaba06
Compare
5eaba06
to
397aaed
Compare
397aaed
to
d30ee73
Compare
Testing showed that it's impossible to use the dojo parser in combination with dojo-based custom components: the browser renders the widgets, but the AMD parser does it again, leading to havoc. This means we can't partially move to the use of these widgets. We either need to go "all in" or forget about it. I'm all for moving: it means that each element maintains its own state and registration with the Dojo widget registry, eliminating the need to sync destruction of Dojo widgets with Vue state. It also opens the possibility to start moving to a heavier (and smarter) web-UI as described above. |
@ylavoie do you have any comments as to my reasoning? Note: my idea is that eventually, we use Vue to control the UI and we use web components for the layout. Thereby I mean: checkboxes, textboxes, date selectors, drop-downs etc will be custom components. The component adding/removing lines on the invoice will eventually be a Vue component. |
E.g. dijit/form/Select has content.
Using elements.html for just three occurrances is overkill.
d30ee73
to
10066d9
Compare
/** @format */ | ||
/* eslint-disable class-methods-use-this */ | ||
|
||
import { LsmbDijit } from "@/elements/lsmb-dijit"; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class
|
||
const Form = require("lsmb/Form"); | ||
const registry = require("dijit/registry"); | ||
const parser = require("dojo/parser"); |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class
fdaeeea
to
7dbdfa3
Compare
Additional findings while working on this PR showed that Dojo creates new nodes in the DOM tree, even if that would not be necessary (e.g. because the tag is only being "enhanced" with additional methods). This means it's impossible for custom tags to be a dojo widget at the same time: when passing the DOM node ( For some widgets, the fact that they are replaced isn't much of an issue (input boxes, etc); others can be rewritten because they don't really use much of Dojo's widget functionality (Invoice, Reconciliation and friends), but others are hard to work around ('dijit/layout/BorderContainer', ContentPane and TabContainer). |
Based on the discussion and findings so far, is clear were not there yet... Closing for now. |
The purpose of this PR is to move parsing of the DOM away from Dojo: the browser can do it a lot more efficiently using Custom Web Components. These web components can instantiate Dojo widgets (for now) to create a consistent UI experience (which we can later swap for another type of custom element for a different look).
We make Dojo widgets out of standard elements in some places, such as the
TABLE
element which is converted to alsmb/InvoiceLines
widget. Support for this usage exists in custom web components using theis
attribute.There's a problem with Custom Built-in Web Components: Safari does not support Custom Web Elements for built-in elements. There is a solution to that problem: using a polyfill.