Update project structure

This commit is contained in:
gconsidine
2017-05-10 17:42:52 -04:00
parent 5553a6bcda
commit 725fd15519
82 changed files with 134 additions and 1078 deletions

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,90 @@
function use (type, componentScope, componentElement) {
let vm = this;
let component;
switch (type) {
case 'input':
component = vm.trackInput(componentElement);
break;
case 'action':
component = vm.trackAction(componentElement);
break;
default:
throw new Error('An at-form cannot use component type:', type);
}
componentScope.meta = component;
}
function trackInput (componentElement) {
let vm = this;
let input = {
el: componentElement,
tabindex: vm.inputs.length + 1
};
if (vm.inputs.length === 0) {
input.autofocus = true;
componentElement.find('input').focus();
}
vm.inputs.push(input)
return input;
}
function trackAction (componentElement) {
let vm = this;
let action = {
el: componentElement
};
vm.actions.push(action);
return action;
}
function update () {
let vm = this;
vm.inputs.forEach(input => console.log(input));
}
function remove (id) {
let vm = this;
delete inputs[id];
}
function AtFormController () {
let vm = this;
vm.inputs = [];
vm.actions = [];
vm.use = use;
vm.trackInput = trackInput;
vm.trackAction = trackAction;
vm.update = update;
vm.remove = remove;
}
function atForm (pathService) {
return {
restrict: 'E',
transclude: true,
templateUrl: pathService.getPartialPath('components/form/form'),
controller: AtFormController,
controllerAs: 'vm',
scope: {
config: '='
}
};
}
atForm.$inject = ['PathService'];
export default atForm;

View File

@@ -0,0 +1,5 @@
<form>
<div class="row">
<ng-transclude></ng-transclude>
</div>
</form>