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
4 changed files with 71 additions and 18 deletions

View File

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

View File

@@ -75,6 +75,12 @@
height: @at-height-textarea; 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-Input-button--active {
.at-mixin-ButtonColor(at-color-info, at-color-default); .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 { .at-InputTagContainer {
display: flex; display: flex;
width: 100%; width: 100%;
flex-wrap: wrap; 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) { function AtInputTextareaController (baseInputController) {
const vm = this || {}; const vm = this || {};
let scope;
vm.init = (scope, element, form) => { vm.init = (_scope_, element, form) => {
baseInputController.call(vm, 'input', scope, element, form); baseInputController.call(vm, 'input', _scope_, element, form);
scope = _scope_;
vm.check(); 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']; AtInputTextareaController.$inject = ['BaseInputController'];

View File

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