Skip to content

Commit

Permalink
Support textarea widget for multifield (array) properties
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Sep 24, 2024
1 parent 739c053 commit 17008e6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
27 changes: 23 additions & 4 deletions bundle/src/main/resources/angularjs-partials/multifield.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@
ng-model="effectiveValue.value" />
<span class="coral-Checkbox-checkmark"></span>
</label>
<textarea is="coral-textarea"
bo-if="type==='textarea'"
disabled
readonly
ng-attr-rows="{{textareaRows}}"
ng-model="effectiveValue.value"></textarea>
<input is="coral-textfield" type="type"
bo-if="type!=='checkbox'"
bo-if="type!=='checkbox' && type!=='textarea'"
disabled
readonly
ng-model="effectiveValue.value" />
Expand All @@ -57,8 +63,14 @@
ng-model="value.value" />
<span class="coral-Checkbox-checkmark"></span>
</label>
<textarea is="coral-textarea"
bo-if="type==='textarea'"
disabled
readonly
ng-attr-rows="{{textareaRows}}"
ng-model="value.value"></textarea>
<input is="coral-textfield" type="type"
bo-if="type!=='checkbox'"
bo-if="type!=='checkbox' && type!=='textarea'"
disabled
readonly
ng-model="value.value" />
Expand All @@ -81,8 +93,15 @@
<span class="coral-Checkbox-checkmark"></span>
</label>
<div class="caconfig-textfield-wrapper">
<input is="coral-textfield" type="type"
bo-if="type!=='checkbox'"
<textarea is="coral-textarea"
bo-if="type==='textarea'"
ng-model="value.value" ng-trim="false"
ng-required="{{property.metadata.properties.required && !property.overridden && !property.inherited && !property.readOnly}}"
caconfig-validation="{{validation}}"
ng-attr-rows="{{textareaRows}}"
name="inputField"></textarea>
<input is="coral-textfield" type="type"
bo-if="type!=='checkbox' && type!=='textarea'"
ng-model="value.value"
ng-trim="false"
ng-pattern="pattern"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
</div>
<textarea is="coral-textarea" class="caconfig-if-property-not-overridden-and-not-inherited-and-not-readonly caconfig-if-config-inherited"
ng-model="property.value"
ng-attr-rows="{{textareaRows}}"
disabled readonly></textarea>
<textarea is="coral-textarea" class="caconfig-if-property-overridden-or-inherited-or-readonly"
ng-model="property.effectiveValue"
ng-attr-rows="{{textareaRows}}"
disabled readonly></textarea>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
scope.validation = props.validation;
scope.validationMessage = props.validationMessage ? Granite.I18n.get(props.validationMessage) : undefined;

// special handling for textarea
if (props.widgetType === "textarea") {
scope.type = "textarea";
scope.textareaRows = props.textareaRows;
}

setValueArray(scope.property.effectiveValue, scope.effectiveValues);
setValueArray(scope.property.value, scope.values);

Expand Down

0 comments on commit 17008e6

Please sign in to comment.