angular-schema-form-bootstrap icon indicating copy to clipboard operation
angular-schema-form-bootstrap copied to clipboard

[Proposal] Hideable array elements

Open GerardSoleCa opened this issue 9 years ago • 3 comments

Hi, I'm using lots of arrays, and many of them have lots of elements, so I end up with long forms.

I've been searching ways to collapse elements, or at least hide them. Until now, I've reached a simple solution (which deserves some work around), but I think thats in some way functional.

src/array.html

...
<li class="list-group-item {{form.fieldHtmlClass}}"
        sf-field-model="ng-repeat"
        ng-repeat="item in $$value$$ track by $index">
      <button ng-hide="form.readonly || form.remove === null"
              ng-click="deleteFromArray($index)"
              ng-disabled="form.schema.minItems >= modelArray.length"
              style="position: relative; z-index: 20;"
              type="button" class="close pull-right">
              <span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
      </button>
      <button
              ng-click="($parent.show==$index)?$parent.show=-1:$parent.show=$index"
              style="position: relative; z-index: 20; margin-right:10px"
              type="button" class="close pull-right">
              <span aria-hidden="true">{{($parent.show==$index)?'-':'+'}}</span><span class="sr-only">Show</span>
      </button>
      <div schema-form-array-items ng-class="$parent.show=={{$index}}?'':'hidden' "></div>
      <span ng-class="$parent.show=={{$index}}?'hidden':''">{{$index}} - {{form.title}}</span>
    </li>
...

Result optimised

GerardSoleCa avatar Aug 25 '15 11:08 GerardSoleCa

In order to test, this is the right fork and branch :) https://github.com/GerardSoleCa/angular-schema-form-bootstrap/tree/feature-array-collapse-elements

GerardSoleCa avatar Aug 25 '15 12:08 GerardSoleCa

Awesome, I really need this !! Will this feature be available ?

Thank you

AlexAlbala avatar Sep 25 '15 09:09 AlexAlbala

+1 for this, we make heavy use of child forms for which we currently use fieldset, this seems like a really nice compact alternative.

slyadams avatar Jun 28 '16 09:06 slyadams