Skip to content
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

Add support for multiple attribute #37

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

bfiessinger
Copy link

@bfiessinger bfiessinger commented Aug 27, 2021

reopened #34 on new branch.
This PR adds the ability to select multiple values.

By adding the multiple attribute on the component the select input turns into a multi-select dropdown.

<livewire:car-model-select
    name="car_model_ids[]"
    placeholder="Choose a Car Model"
    :multiple="true"
/>

Example:
multiselect

To include the required assets I've also made some small changes on the blade directives.

  • Updated directive livewireSelectScripts
  • Added directive livewireSelectStyles

Both directives now support options where you can set which assets should be loaded.

...
    @livewireSelectStyles 
    <!-- 
         loads all styles defined in Asantibanez\LivewireSelect\LivewireSelect->css.
         omit this directive completely if Livewire::styles() and tailwindcss is already included on the page
     -->
</head>
<body>
    ...
 
    @livewireSelectScripts(alpine, livewire-select-multiple) 
    <!-- loads only alpinejs, livewire-select-multiple and the default required livewire-select-->
</body>
</html>

also closes #22 by 25f5147

- added support for HTML attribute multiple
- added new view for multiple select tag
- add new blade directive livewireSelectStyles for adding custom css
- update directive livewireSelectScripts single assets can now be included and excluded by options
…lectScripts and livewireSelectStyles

- each asset option now get's automatically trimmed
- livewireSelect default script only get's pushed if not in option array
…ad of livewireSelect and add �ssetType parameter to renderAssets method
@bfiessinger bfiessinger changed the title Add support for multiple attribute Add support for multiple attribute Aug 27, 2021
@bfiessinger
Copy link
Author

According to #39 where the initial value is nulled for dependant selects I already built something to make it work on this multiple input too. Please merge #39 and #37 first so I can push the next step.

@mydnic
Copy link

mydnic commented Sep 22, 2021

@asantibanez is this something you plan to merge ? Just to know if I wait for it or if I implement another solution in the app I'm currently working on :)

Thank a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for php 8.x
2 participants