GithubHelp home page GithubHelp logo

aurelia-contrib / aurelia-portal-attribute Goto Github PK

View Code? Open in Web Editor NEW
26.0 26.0 1.0 2.05 MB

Same view, same view model, but different DOM position. Portal custom attribute to render your component anywhere.

Home Page: https://aurelia-portal-attribute.now.sh/

License: MIT License

JavaScript 15.45% TypeScript 84.55%

aurelia-portal-attribute's People

Contributors

3cp avatar bigopon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

kremnari

aurelia-portal-attribute's Issues

Target element not being re-evaluated while the DOM is still being built

I'm submitting a bug report

  • Framework Version:
    1 - Aurelia CLI 3.0.1

  • Operating System:
    OSX 14.4.1

  • Node Version:
    18.17.1

  • NPM Version:
    9.6.7

  • Browser:
    all | Chrome XX

  • Language:
    ESNext

Current behavior:
Using the portal attribute, like portal="target.bind: isMobile ? '.bncHeader' : '.bncOptionsWrapper'" puts the element with this attribute at the end of the body if the intended target element isn't rendered yet. Otherwise it works fine.
I can work around this problem by binding the to-be-portalled element later, when the target element is available in the DOM but this is not ideal.

Expected/desired behavior:
The target portal element should be re-evaluated while the DOM is still being rendered.

What is the motivation / use case for changing the behavior?
For a hybrid application for desktop / mobile some elements need to be portalled to somewhere else on mobile.

request feature: insert before child

<div class="this is my target">
  <!-- I would like the portal injected here -->
  <div class="collapse-button"></div>
</div>

Use case: to control collpase-button dynamically based on injection:

.collapse-button {
  display: none;
}

.injected-class + .collapse-button {
  display: inline-block;
}

Too bad css is not flexible to say "if collapse-button is before injected-class".

Update: I could not use ref="" because the target dom is not in same view model.

Using slots

Not sure if this works or I've got a standard setup

I'm submitting a bug report

  • Framework Version:
    1.2.1

Please tell us about your environment:

  • Operating System:
    OSX 10.13.1

  • Node Version:
    9.5.0

  • NPM Version:
    5.6.0

  • Browser:
    all

  • Language:
    TypeScript 2.6.2

Current behavior:
Portal render slots empty

Expected/desired behavior:
Render slot within element with portal

Fix Documentation

If you use the Aurelia CLI, install the plugin with the following command

au import aurelia-portal-attribute
change to
au install aurelia-portal-attribute

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.