enable input source linking for textarea fields

This commit is contained in:
Jake McDermott 2019-03-12 20:26:42 -04:00
parent e14f17687c
commit 957804e22a
No known key found for this signature in database
GPG Key ID: 9A6F084352C3A0B7
4 changed files with 71 additions and 18 deletions

View File

@ -18,11 +18,13 @@
{{::vm.strings.get('inputSources.SELECTED')}}
</div>
<span>
<at-tag
ng-show="vm.selectedName"
tag="vm.selectedName"
icon="external"
/>
<div class="at-InputTagContainer">
<at-tag
ng-show="vm.selectedName"
tag="vm.selectedName"
icon="external"
/>
</div>
<div
class="InputSourceLookup-selectedItemText"
ng-show="!vm.selectedName"

View File

@ -75,6 +75,12 @@
height: @at-height-textarea;
}
.at-Input-button--long-sm {
.at-mixin-InputButton();
max-width: @at-width-input-button-md;
min-height: @at-height-textarea;
}
.at-Input-button--active {
.at-mixin-ButtonColor(at-color-info, at-color-default);
}
@ -329,8 +335,21 @@
}
}
.at-InputTaggedTextarea {
.at-mixin-FontFixedWidth();
min-height: @at-height-textarea;
padding: 6px @at-padding-input 0 @at-padding-input;
border-radius: @at-border-radius;
}
.at-InputTagContainer {
display: flex;
width: 100%;
flex-wrap: wrap;
}
.at-InputTagContainer .TagComponent-name {
align-self: auto;
word-break: break-all;
font-family: 'Open Sans', sans-serif;
}

View File

@ -13,12 +13,21 @@ function atInputTextareaLink (scope, element, attrs, controllers) {
function AtInputTextareaController (baseInputController) {
const vm = this || {};
let scope;
vm.init = (scope, element, form) => {
baseInputController.call(vm, 'input', scope, element, form);
vm.init = (_scope_, element, form) => {
baseInputController.call(vm, 'input', _scope_, element, form);
scope = _scope_;
vm.check();
};
vm.onLookupClick = () => {
if (scope.state._onInputLookup) {
const { id, label, required, type } = scope.state;
scope.state._onInputLookup({ id, label, required, type });
}
};
}
AtInputTextareaController.$inject = ['BaseInputController'];

View File

@ -1,17 +1,40 @@
<div class="col-sm-{{::col}} at-InputContainer">
<div class="form-group at-u-flat">
<at-input-label></at-input-label>
<textarea class="form-control at-Input at-InputTextarea"
ng-model="state._value"
ng-class="{ 'at-Input--rejected': state._rejected }"
ng-attr-rows="{{::state._rows || 6 }}"
ng-attr-maxlength="{{ state.max_length || undefined }}"
ng-attr-tabindex="{{ tab || undefined }}"
ng-attr-placeholder="{{::state._placeholder || undefined }}"
ng-change="vm.check()"
ng-disabled="state._disabled || form.disabled" /></textarea>
<div ng-class="{ 'input-group': state.tagMode }">
<div class="input-group-btn at-InputGroup-button input-group-prepend" ng-show="state.tagMode">
<button class="btn at-ButtonHollow--white at-Input-button--long-sm"
ng-disabled="state._disabled || form.disabled"
ng-click="vm.onLookupClick()">
<i class="fa fa-search"></i>
</button>
</div>
<div
ng-show="state.asTag"
class="form-control at-Input at-InputTaggedTextarea"
ng-class="{
'at-Input--rejected': state._rejected,
}"
>
<div class="at-InputTagContainer">
<at-tag
icon="external"
tag="state._tagValue"
remove-tag="state._onRemoveTag(state)"
/>
</div>
</div>
<textarea class="form-control at-Input at-InputTextarea"
ng-show="!state.asTag"
ng-model="state._value"
ng-class="{ 'at-Input--rejected': state._rejected }"
ng-attr-rows="{{::state._rows || 6 }}"
ng-attr-maxlength="{{ state.max_length || undefined }}"
ng-attr-tabindex="{{ tab || undefined }}"
ng-attr-placeholder="{{::state._placeholder || undefined }}"
ng-change="vm.check()"
ng-disabled="state._disabled || form.disabled" />
</div>
<at-input-message></at-input-message>
</div>
</div>