I am using angular 1.5.x to develop a control panel which includes, among other things, a grid editor (such as bootstrap).
I am using jQuery UI for differents interactions that the user can make to edit the grid (as dragabble, sortable, etc ...)
I understand that I must create components for different parts of the editor as the Workspace and the different toolbars.
I do not understand is where I should place DOM manipulation.
The components do not replace directives according to documentation. Should I include directives within templates components?
The only place you should be manipulating the DOM is in $compile.
Take a look at AngularUI as a replacement for JQueryUI
Related
Why can't I customize the styling of web component libraries i.e UI5, beyond themes? I have tried everything from inline styling to wrapping the web components in Styled-components. I tried using :host(), ::slott. I've tried to inject style tags into the template itself. I'm really at a loss, I wasn't able to change one pixel of styling. I'm leaning towards the issue being multiple shadow dom or encapsulated CSS.
<TabContainer backgroundDesign={"red"} ref={ToggleRef} className={`webCompToggleTabBar`} id="UI5TabContainer" tabs-overflow-mode="StartAndEnd" collapsed fixed>
{Object.keys(Tabs).map((subTemplate, i) => {
return (<Tab className="webCompToggleTab" key={Math.random()} additional-text={subTemplate} name={subTemplate} />);
</TabContainer>
Now the outer Tabcontainer is easilystyled with any type of styling, but when I attempt to style any of the tabContainer's inner Tabs...crickets
Just for clarity, I am building a lit-html wrapper around pre-built web-component libraries to work with React and Angular. But I need to be able to restyle the imported web-components
so the issue with styling web components from freely available libraries are:
Web components are usually created using the shadowDOM, this is great for
encapsulation. But when you want to go back in and try to override that
encapsulation and completely overwrite the web components CSS. You will
get stuck in the top layer of the web component, just outside it's shadowDOM(if there using it). With some libraries,
this is done on purpose, others allow you to do this but you may have
to fork over some hefty cash to use those libraries.
Fortunately, there are some things you can do to spice up the web-
components. CSS variables, A lot of libraries build CSS variables into
their components for theming. So one thing you can do is find their list of CSS variables either on their Documents page or in the elements tab in your browser and just cut and paste them
in.
If this is not enough for you there is another option.
You can create your own web components in a way very similar to
creating them in ReactJS. There is a tool called Stencil which
gives you a way to create web component using typescript and CSS.
Stencil solved all my issues, it has all the polyfills built in.
It sets up all your testing and deploying. https://stenciljs.com/
I am under a scenario where I have to build a portal container in HTML5 and Javascript. This container will be provided with 'n' number of widget URLs and container is responsible to load them through Ajax in DIVs (not in iFrame).
Now the question is how to make the definitions of JavaScript functions of each widget, separate? For example, I have two DIVs on the container page, Widget1_DIV and Widget2_DIV. HTML, JS and CSS of Widget1 will be placed in Widget1_DIV and similarly for Widget2.
Now suppose both the widgets have a JS function with same name, 'foo', which will conflict once they are embedded in same DOM. I want to know that will RequireJS helps in avoiding the conflict or the right solution to make both widget's DIVs modular?
Thanks
Did you consider using any JS Framework? I recommend you AngularJS because of its functionality, MVC approach and flexibility. I know, that this requires a lot of work on the beginning of project life-cycle, but later certainly you observe advantages and robust page structure.
In addition, Angular JS allows you to preserve separated project structure:
- WidgetName
| - javascriptfile.js
| - widgetpage.html
| - javascriptfile_test.js
See more: https://angularjs.org/
Of course you don't need to use this specific framework, there are a lot of other fantastic tools: Knockout, Backbone, ... .
How about using a dashboard framework for that. This should make things easier.
For ex.:
http://dashing.io/
I am developing a web app and using AngularJS. But, until now, I have no UI animations. I'm wondering to use jQuery or AngularJS to make the animations.
I know that AngularJS has ngAnimate directive, as I can build my own directive, but there are a lot of good animations in jQuery and a lot of good examples. Why should I make UI Animations using AngularJS? Only to keep the AngularJS standard in my code? Or there are more than that?
Is common to always use AngularJS for all animations when we are talking about an AngularJS web app?
If you're using angular's MVVM methodology when binding your data to your UI, angular-animate would be much much simpler and more intuitive.
Depends on the animations you want to have.. Using angular-animate you could easily do things like: stagger animation for ng-repeat items on entry, leave and move (different for each). easy with angular-animate, but could be hard without, again - depends on your animations, how you access and modify data ,etc..
Angular-animate allows you to easily:
Use existing CSS classes that built-in angular directives use whenever they manipulate the DOM: .enter, .leave, .enter-active, .leave-active etc. You can easily add CSS 3 transitions to animate when items are added or removed from an ng-repeat, for example.
Use scripting libraries to do the animations (jquery, tweenmax, etc). This is also CSS class driven.
we have a big ExtJS (still ExtJs 2) application, which provides windows explorer like functionality on a Java EE server.
We now evaluate implementing a new functionality; we could base this functionality on a jQuery plug in.
Is it recommended to use jQuery and ExtJs in one application?
Or will I have to deal with side effects occurring?
You will not have to deal with any side effect. The only problems I ever ran into when I did this is if I tried to operate on elements that Extjs relied on being left alone. Just make sure that when you start operating using jQuery that you're working inside a div that extjs doesn't plan to mess with. The best way to do this is to inherit from Ext.Component and then operate inside the div it provides. Ext doesn't do anything inside this div so you should be ok. You can also tap into the resize functionality if you need to, though this is not really necessary.
My company does so with no problems on a fairly large Apache/Catalyst site. We do use jQuery() rather than $() due to some old Prototype stuff on our site.
More: Blueprint CSS Extjs and JQuery in the same page, best way to make them coexist without conflict
keep jQuery within the jQuery namespace http://api.jquery.com/jQuery.noConflict/
Use it like so: $.noConflict();
jQuery only adds a single object (jQuery) to the window's context so you won't have any conflicts.
PROBLEM: Some third party libraries for jquery may rely on static webpage organization. As ExtJS components can be added to webpage dynamically - they will have no functions from third party libraries.
SOLUTION: You will have to run this library's script after component is added (use afterrender event, for example). Then you can call these functions on this ext component.
I am looking for a JavaScript framework that provides encapsulation of UI widgets, and allows the developer to define composite widgets. In particular, I need to be able to take a widget, clone it, and place it somewhere in the document, and the widget should take care of managing any subwidgets and of keeping matching DOM objects and JavaScript object in sync. I want to be able to take a multi-item form, where each item contains multiple widgets, and tell it to add or remove an item, without having to write specific code for each form, handle the subwidgets explicitly, reinstalling event handlers, etc..
Is there any JavaScript framework that offers such a feature. If not, which one comes closest? So far I know that jQuery doesn't (its focus is on providing an interface for DOM manipulation, not to encapsulate complex entities).
jQuery's UI Widget Factory provides you methods to create widget classes.
jQuery UI Widgets enforces follow it's coding style. It' provides all that you seek. You can also make your widgets theme-able by making use of ThemeRoller
Refer jQuery UI Developer Guide, Tips for Developing jQuery UI 1.8 Widgets
, Understanding jQuery UI widgets: A tutorial