import {AbstractControl} from '../abstract-control';
import {schemaTypeIs, Testers, optionIs} from '../../testers';
const stringTemplate = `
`;
class StringDirective implements ng.IDirective {
restrict = 'E';
templateUrl = 'string.html';
controller = StringController;
controllerAs = 'vm';
}
const textAreaTemplate = `
`;
class StringAreaDirective implements ng.IDirective {
restrict = 'E';
templateUrl = 'text-area.html';
controller = StringController;
controllerAs = 'vm';
}
interface StringControllerScope extends ng.IScope { }
class StringController extends AbstractControl {
static $inject = ['$scope', 'PathResolver'];
constructor(scope: StringControllerScope) {
super(scope);
}
}
export default angular
.module('jsonforms.renderers.controls.string', ['jsonforms.renderers.controls'])
.directive('stringControl', () => new StringDirective())
.directive('textAreaControl', () => new StringAreaDirective())
.run(['RendererService', RendererService => {
RendererService.register('string-control', schemaTypeIs('string'), 1);
RendererService.register('text-area-control',
Testers.and(
schemaTypeIs('string'),
optionIs('multi', true)
), 2);
}
])
.run(['$templateCache', $templateCache => {
$templateCache.put('string.html', stringTemplate);
$templateCache.put('text-area.html', textAreaTemplate);
}])
.name;