Core refactor, first step

This commit is contained in:
Juan Ferrer Toribio 2018-02-10 16:18:01 +01:00
parent 8852bfd4bb
commit 88d50e3d00
182 changed files with 580 additions and 898 deletions

View File

@ -1,3 +1,2 @@
import './ngModule'; import './module';
import './config';
import './login/login'; import './login/login';

View File

@ -1,4 +1,4 @@
import ngModule from '../ngModule'; import ngModule from '../module';
import './style.scss'; import './style.scss';
export default class Controller { export default class Controller {

View File

@ -1,4 +1,8 @@
import ngModule from './ngModule'; import {ng} from 'vendor';
import 'core';
let ngModule = ng.module('vnAuth', ['vnCore']);
export default ngModule;
config.$inject = ['$translatePartialLoaderProvider', '$httpProvider']; config.$inject = ['$translatePartialLoaderProvider', '$httpProvider'];
export function config($translatePartialLoaderProvider, $httpProvider) { export function config($translatePartialLoaderProvider, $httpProvider) {

View File

@ -1,5 +0,0 @@
import {ng} from 'vendor';
import 'core';
let ngModule = ng.module('vnAuth', ['vnCore']);
export default ngModule;

View File

@ -1,5 +1,5 @@
import ngModule from '../module'; import ngModule from '../module';
import FilterClientList from '../filterClientList'; import FilterClientList from '../filter-client-list';
ngModule.component('vnClientCreditList', { ngModule.component('vnClientCreditList', {
template: require('./credit-list.html'), template: require('./credit-list.html'),

View File

@ -1,4 +1,5 @@
import FilterList from '../../core/src/lib/filterList'; import FilterList from 'core/src/lib/filter-list';
export default class FilterClientList extends FilterList { export default class FilterClientList extends FilterList {
constructor($scope, $timeout, $state) { constructor($scope, $timeout, $state) {
super($scope, $timeout, $state); super($scope, $timeout, $state);

View File

@ -1,5 +1,5 @@
import ngModule from '../module'; import ngModule from '../module';
import FilterClientList from '../filterClientList'; import FilterClientList from '../filter-client-list';
ngModule.component('vnClientGreugeList', { ngModule.component('vnClientGreugeList', {
template: require('./greuge-list.html'), template: require('./greuge-list.html'),

View File

@ -1,5 +1,5 @@
import ngModule from '../module'; import ngModule from '../module';
import FilterClientList from '../filterClientList'; import FilterClientList from '../filter-client-list';
ngModule.component('vnClientMandate', { ngModule.component('vnClientMandate', {
template: require('./mandate.html'), template: require('./mandate.html'),

View File

@ -1,18 +0,0 @@
import {module as _module} from '../module';
import * as resolveFactory from '../lib/resolveDefaultComponents';
import * as util from '../lib/util';
const _NAME = 'button';
export const NAME = util.getName(_NAME);
directive.$inject = [resolveFactory.NAME];
export function directive(resolve) {
return {
restrict: 'E',
template: function(_, attr) {
return resolve.getTemplate(_NAME, attr);
}
};
}
_module.directive(NAME, directive);

View File

@ -1,21 +0,0 @@
import {module as _module} from '../module';
import * as util from '../lib/util';
import * as constant from '../lib/constants';
import template from './button.mdl.html';
const _NAME = 'button';
export const NAME = util.getFactoryName(_NAME + constant.MATERIAL_DESIGN_FRAMEWORK);
export function factory() {
return {
template: template,
default: {
label: 'Submit',
className: 'mdl-button mdl-js-button mdl-button--raised mdl-button--colored',
enabled: 'true',
typeName: 'button'
}
};
}
_module.factory(NAME, factory);

View File

@ -1,21 +0,0 @@
import {module as _module} from '../module';
import * as resolveFactory from '../lib/resolveDefaultComponents';
import * as util from '../lib/util';
require('./style.css');
const _NAME = 'card';
export const NAME = util.getName(_NAME);
directive.$inject = [resolveFactory.NAME];
export function directive(resolve) {
return {
restrict: 'E',
transclude: true,
template: function(_, attr) {
return resolve.getTemplate(_NAME, attr);
}
};
}
_module.directive(NAME, directive);

View File

@ -1,16 +0,0 @@
import {module as _module} from '../module';
import * as util from '../lib/util';
import * as constant from '../lib/constants';
import template from './card.mdl.html';
const _NAME = 'card';
export const NAME = util.getFactoryName(_NAME + constant.MATERIAL_DESIGN_FRAMEWORK);
export function factory() {
return {
template: template
};
}
_module.factory(NAME, factory);

View File

@ -1,29 +0,0 @@
import {module as _module} from '../module';
import * as resolveFactory from '../lib/resolveDefaultComponents';
import * as normalizerFactory from '../lib/inputAttrsNormalizer';
import * as util from '../lib/util';
import './style.css';
const _NAME = 'check';
export const NAME = util.getName(_NAME);
directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME];
export function directive(resolve, normalizer) {
return {
restrict: 'E',
template: function(_, attrs) {
normalizer.normalize(attrs);
return resolve.getTemplate(_NAME, attrs);
},
link: function(scope, element, attrs) {
scope.$watch(attrs.model, () => {
let mdlField = element[0].firstChild.MaterialCheckbox;
if (mdlField)
mdlField.updateClasses_();
});
componentHandler.upgradeElement(element[0].firstChild);
}
};
}
_module.directive(NAME, directive);

View File

@ -1,21 +0,0 @@
import {module as _module} from '../module';
import * as util from '../lib/util';
import * as constant from '../lib/constants';
import template from './check.mdl.html';
const _NAME = 'check';
const DEFAULT_CLASS = 'mdl-checkbox__input';
export const NAME = util.getFactoryName(_NAME + constant.MATERIAL_DESIGN_FRAMEWORK);
export function factory() {
return {
template: template,
default: {
enabled: 'true',
className: DEFAULT_CLASS
}
};
}
_module.factory(NAME, factory);

View File

@ -1,28 +0,0 @@
import {module as _module} from '../module';
import * as resolveFactory from '../lib/resolveDefaultComponents';
import * as normalizerFactory from '../lib/inputAttrsNormalizer';
import * as util from '../lib/util';
const _NAME = 'combo';
export const NAME = util.getName(_NAME);
directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME];
export function directive(resolve, normalizer) {
return {
restrict: 'E',
transclude: true,
template: function(_, attrs) {
normalizer.normalize(attrs);
return resolve.getTemplate(_NAME, attrs);
},
link: function(scope, element, attrs) {
scope.$watch(attrs.model, () => {
let mdlField = element[0].firstChild.MaterialTextfield;
if (mdlField)
mdlField.updateClasses_();
});
componentHandler.upgradeElement(element[0].firstChild);
}
};
}
_module.directive(NAME, directive);

View File

@ -1,14 +0,0 @@
import {module} from '../module';
import template from './combo.mdl.html';
export const NAME = 'vnComboMdlFactory';
export function factory() {
return {
template: template,
default: {
label: 'Label',
enabled: 'enabled'
}
};
}
module.factory(NAME, factory);

View File

@ -1,46 +0,0 @@
import './mdl-override.css';
import './styles/fonts/mdi-override.css';
import './textfield/textfield';
import './watcher/watcher';
import './paging/paging';
import './icon/icon';
import './autocomplete/autocomplete';
import './popover/popover';
import './dialog/dialog';
import './confirm/confirm';
import './title/title';
import './subtitle/subtitle';
import './spinner/spinner';
import './snackbar/snackbar';
import './tooltip/tooltip';
import './icon-menu/icon-menu';
import './drop-down/drop-down';
import './column-header/column-header';
import './grid-header/grid-header';
import './multi-check/multi-check';
import './datePicker/datePicker';
export {NAME as BUTTON, directive as ButtonDirective} from './button/button';
export {NAME as BUTTON_MDL, factory as buttonMdl} from './button/button.mdl';
export {NAME as CHECK, directive as CheckDirective} from './check/check';
export {NAME as CHECK_MDL, factory as checknMdl} from './check/check.mdl';
export {NAME as RADIO, directive as RadioDirective} from './radio/radio';
export {NAME as RADIO_MDL, factory as radionMdl} from './radio/radio.mdl';
export {NAME as TEXTAREA, directive as TextareaDirective} from './textarea/textarea';
export {NAME as TEXTAREA_MDL, factory as textareaMdl} from './textarea/textarea.mdl';
export {NAME as LABEL, directive as LabelDirective} from './label/label';
export {NAME as LABEL_MDL, factory as labelMdl} from './label/label.mdl';
export {NAME as ICON_BUTTON, directive as IconButtonDirective} from './icon-button/icon-button';
export {NAME as SUBMIT, directive as SubmitDirective} from './submit/submit';
export {NAME as SUBMIT_MDL, factory as submitMdl} from './submit/submit.mdl';
export {NAME as COMBO, directive as ComboDirective} from './combo/combo';
export {NAME as COMBO_MDL, factory as comboMdl} from './combo/combo.mdl';
export {NAME as CARD, directive as CardDirective} from './card/card';
export {NAME as CARD_MDL, factory as cardMdl} from './card/card.mdl';
export {NAME as SWITCH, directive as SwitchDirective} from './switch/switch';
export {NAME as SWITCH_MDL, factory as switchdMdl} from './switch/switch.mdl';
export {NAME as FLOATBUTTON, directive as FloatButtonDirective} from './floatbutton/floatbutton';
export {NAME as FLOATBUTTON_MDL, factory as floatButtondMdl} from './floatbutton/floatbutton.mdl';

View File

@ -1,6 +1,6 @@
import {module} from '../module'; import ngModule from '../../module';
import Component from '../lib/component'; import Component from '../../lib/component';
import copyObject from '../lib/copy'; import copyObject from '../../lib/copy';
import './style.scss'; import './style.scss';
class Autocomplete extends Component { class Autocomplete extends Component {
@ -357,7 +357,7 @@ class Autocomplete extends Component {
} }
Autocomplete.$inject = ['$element', '$scope', '$http', '$timeout', '$filter']; Autocomplete.$inject = ['$element', '$scope', '$http', '$timeout', '$filter'];
module.component('vnAutocomplete', { ngModule.component('vnAutocomplete', {
template: require('./autocomplete.html'), template: require('./autocomplete.html'),
controller: Autocomplete, controller: Autocomplete,
bindings: { bindings: {

View File

@ -0,0 +1,17 @@
import ngModule from '../../module';
import template from './button.html';
directive.$inject = ['vnTemplate'];
export default function directive(vnTemplate) {
return {
restrict: 'E',
template: (_, $attrs) =>
vnTemplate.get(template, $attrs, {
label: 'Submit',
className: 'mdl-button mdl-js-button mdl-button--raised mdl-button--colored',
enabled: 'true',
typeName: 'button'
})
};
}
ngModule.directive('vnButton', directive);

View File

@ -0,0 +1,14 @@
import ngModule from '../../module';
import template from './card.html';
require('./style.css');
directive.$inject = ['vnTemplate'];
export default function directive(vnTemplate) {
return {
restrict: 'E',
transclude: true,
template: (_, $attrs) =>
vnTemplate.get(template, $attrs)
};
}
ngModule.directive('vnCard', directive);

View File

@ -0,0 +1,24 @@
import ngModule from '../../module';
import template from './check.html';
import './style.css';
directive.$inject = ['vnTemplate'];
export default function directive(vnTemplate) {
return {
restrict: 'E',
template: (_, $attrs) =>
vnTemplate.getNormalized(template, $attrs, {
enabled: 'true',
className: 'mdl-checkbox__input'
}),
link: function(scope, element, attrs) {
scope.$watch(attrs.model, () => {
let mdlField = element[0].firstChild.MaterialCheckbox;
if (mdlField)
mdlField.updateClasses_();
});
componentHandler.upgradeElement(element[0].firstChild);
}
};
}
ngModule.directive('vnCheck', directive);

View File

@ -1,4 +1,4 @@
import {module} from '../module'; import ngModule from '../../module';
export default class ColumnHeader { export default class ColumnHeader {
constructor($attrs) { constructor($attrs) {
@ -40,7 +40,7 @@ export default class ColumnHeader {
} }
ColumnHeader.$inject = ['$attrs']; ColumnHeader.$inject = ['$attrs'];
module.component('vnColumnHeader', { ngModule.component('vnColumnHeader', {
template: require('./column-header.html'), template: require('./column-header.html'),
bindings: { bindings: {
field: '@?', field: '@?',

View File

@ -1,5 +1,11 @@
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<select class="mdl-textfield__input" class="*[className]*" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* ng-transclude> <select
class="*[className]*"
name="*[name]*"
ng-model="*[model]*"
rule="*[rule]*"
*[enabled]*
ng-transclude>
</select> </select>
<label class="mdl-textfield__label" translate>*[label]*</label> <label class="mdl-textfield__label" translate>*[label]*</label>
</div> </div>

View File

@ -0,0 +1,25 @@
import ngModule from '../../module';
import template from './combo.html';
directive.$inject = ['vnTemplate'];
export function directive(vnTemplate) {
return {
restrict: 'E',
transclude: true,
template: (_, $attrs) =>
vnTemplate.getNormalized(template, $attrs, {
label: 'Label',
enabled: 'enabled',
class: 'mdl-textfield__input'
}),
link: function(scope, element, attrs) {
scope.$watch(attrs.model, () => {
let mdlField = element[0].firstChild.MaterialTextfield;
if (mdlField)
mdlField.updateClasses_();
});
componentHandler.upgradeElement(element[0].firstChild);
}
};
}
ngModule.directive('vnCombo', directive);

View File

@ -1,11 +1,11 @@
import {module} from '../module'; import ngModule from '../../module';
import Dialog from '../dialog/dialog'; import Dialog from '../dialog/dialog';
import './style.css'; import './style.css';
export default class Confirm extends Dialog {} export default class Confirm extends Dialog {}
Dialog.$inject = ['$element']; Dialog.$inject = ['$element'];
module.component('vnConfirm', { ngModule.component('vnConfirm', {
template: require('./confirm.html'), template: require('./confirm.html'),
bindings: { bindings: {
onResponse: '&', onResponse: '&',

View File

@ -5,8 +5,7 @@
ng-blur="$ctrl.hasFocus = false" ng-blur="$ctrl.hasFocus = false"
ng-mouseenter="$ctrl.hasMouseIn = true" ng-mouseenter="$ctrl.hasMouseIn = true"
ng-mouseleave="$ctrl.hasMouseIn = false" ng-mouseleave="$ctrl.hasMouseIn = false"
ng-click="$ctrl.onClick()" ng-click="$ctrl.onClick()">
>
<input type="text" <input type="text"
class="mdl-textfield__input" class="mdl-textfield__input"
name="{{::$ctrl.name}}" name="{{::$ctrl.name}}"
@ -15,8 +14,18 @@
rule="{{::$ctrl.rule}}"/> rule="{{::$ctrl.rule}}"/>
<div class="mdl-chip__action"> <div class="mdl-chip__action">
<i class="material-icons" ng-if="$ctrl.isTimePicker" ng-click="$ctrl.vp.open()">query_builder</i> <i
<i class="material-icons pointer" ng-show="$ctrl.modelView&&($ctrl.hasFocus||$ctrl.hasMouseIn)" ng-click="$ctrl.onClear()">clear</i> class="material-icons"
ng-if="$ctrl.isTimePicker"
ng-click="$ctrl.vp.open()">
query_builder
</i>
<i
class="material-icons pointer"
ng-show="$ctrl.modelView&&($ctrl.hasFocus||$ctrl.hasMouseIn)"
ng-click="$ctrl.onClear()">
clear
</i>
</div> </div>
<label class="mdl-textfield__label" translate>{{$ctrl.label}}</label> <label class="mdl-textfield__label" translate>{{$ctrl.label}}</label>
</div> </div>

View File

@ -1,5 +1,5 @@
import {module} from '../module'; import ngModule from '../../module';
import Component from '../lib/component'; import Component from '../../lib/component';
import Flatpickr from 'vendor/src/flatpickr'; import Flatpickr from 'vendor/src/flatpickr';
import './style.scss'; import './style.scss';
@ -238,8 +238,8 @@ class DatePicker extends Component {
} }
DatePicker.$inject = ['$element', '$translate', '$filter', '$timeout', '$attrs']; DatePicker.$inject = ['$element', '$translate', '$filter', '$timeout', '$attrs'];
module.component('vnDatePicker', { ngModule.component('vnDatePicker', {
template: require('./datePicker.html'), template: require('./date-picker.html'),
bindings: { bindings: {
model: '=', model: '=',
label: '@?', label: '@?',

View File

@ -1,4 +1,4 @@
import './datePicker.js'; import './date-picker.js';
describe('Component vnDatePicker', () => { describe('Component vnDatePicker', () => {
let $componentController; let $componentController;

View File

@ -1,5 +1,5 @@
import {module} from '../module'; import ngModule from '../../module';
import Component from '../lib/component'; import Component from '../../lib/component';
import './style.scss'; import './style.scss';
/** /**
@ -8,6 +8,8 @@ import './style.scss';
export default class Dialog extends Component { export default class Dialog extends Component {
/** /**
* Contructor. * Contructor.
*
* @param {HTMLElement} $element The HTML element object
*/ */
constructor($element) { constructor($element) {
super($element); super($element);
@ -100,7 +102,7 @@ export default class Dialog extends Component {
} }
Dialog.$inject = ['$element']; Dialog.$inject = ['$element'];
module.component('vnDialog', { ngModule.component('vnDialog', {
template: require('./dialog.html'), template: require('./dialog.html'),
transclude: { transclude: {
tplBody: 'tplBody', tplBody: 'tplBody',

View File

@ -1,6 +1,6 @@
import {module} from '../module'; import ngModule from '../../module';
import validKey from '../../lib/key-codes';
import './style.scss'; import './style.scss';
import validKey from '../lib/keyCodes';
export default class DropDown { export default class DropDown {
constructor($element, $filter, $timeout) { constructor($element, $filter, $timeout) {
@ -264,7 +264,7 @@ export default class DropDown {
DropDown.$inject = ['$element', '$filter', '$timeout']; DropDown.$inject = ['$element', '$filter', '$timeout'];
module.component('vnDropDown', { ngModule.component('vnDropDown', {
template: require('./drop-down.html'), template: require('./drop-down.html'),
controller: DropDown, controller: DropDown,
bindings: { bindings: {

View File

@ -0,0 +1,14 @@
import ngModule from '../../module';
import template from './float-button.html';
directive.$inject = ['vnTemplate'];
export function directive(vnTemplate) {
return {
restrict: 'E',
template: (_, $attrs) =>
vnTemplate.get(template, $attrs, {
className: 'mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored'
})
};
}
ngModule.directive('vnFloatButton', directive);

View File

@ -1,4 +1,4 @@
import {module} from '../module'; import ngModule from '../../module';
import './style.scss'; import './style.scss';
export default class GridHeader { export default class GridHeader {
@ -17,7 +17,7 @@ export default class GridHeader {
} }
module.component('vnGridHeader', { ngModule.component('vnGridHeader', {
template: require('./grid-header.html'), template: require('./grid-header.html'),
transclude: true, transclude: true,
bindings: { bindings: {

View File

@ -0,0 +1,5 @@
<button
class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored icon-square {{::$ctrl.className}}"
{{$ctrl.enabled}}>
<vn-icon icon="{{::$ctrl.icon}}"></vn-icon>{{::$ctrl.label}}
</button>

View File

@ -1,6 +1,6 @@
import {module as _module} from '../module'; import ngModule from '../../module';
_module.component('vnIconButton', { ngModule.component('vnIconButton', {
template: require('./icon-button.html'), template: require('./icon-button.html'),
bindings: { bindings: {
icon: '@', icon: '@',

View File

@ -1,4 +1,4 @@
import {module} from '../module'; import ngModule from '../../module';
import './style.scss'; import './style.scss';
export default class IconMenu { export default class IconMenu {
@ -116,10 +116,9 @@ export default class IconMenu {
this.$element.unbind('focusout'); this.$element.unbind('focusout');
} }
} }
IconMenu.$inject = ['$element', '$http', '$timeout']; IconMenu.$inject = ['$element', '$http', '$timeout'];
module.component('vnIconMenu', { ngModule.component('vnIconMenu', {
template: require('./icon-menu.html'), template: require('./icon-menu.html'),
bindings: { bindings: {
url: '@?', url: '@?',

View File

@ -1,7 +1,7 @@
import {module} from '../module'; import ngModule from '../../module';
import './style.css'; import './style.css';
module.component('vnIcon', { ngModule.component('vnIcon', {
template: '<i class="material-icons">{{::$ctrl.icon}}</i>', template: '<i class="material-icons">{{::$ctrl.icon}}</i>',
bindings: { bindings: {
icon: '@' icon: '@'

View File

@ -0,0 +1,30 @@
import './textfield/textfield';
import './watcher/watcher';
import './paging/paging';
import './icon/icon';
import './autocomplete/autocomplete';
import './popover/popover';
import './dialog/dialog';
import './confirm/confirm';
import './title/title';
import './subtitle/subtitle';
import './spinner/spinner';
import './snackbar/snackbar';
import './tooltip/tooltip';
import './icon-menu/icon-menu';
import './drop-down/drop-down';
import './column-header/column-header';
import './grid-header/grid-header';
import './multi-check/multi-check';
import './date-picker/date-picker';
import './button/button';
import './check/check';
import './radio/radio';
import './textarea/textarea';
import './label/label';
import './icon-button/icon-button';
import './submit/submit';
import './combo/combo';
import './card/card';
import './switch/switch';
import './float-button/float-button';

View File

@ -0,0 +1,12 @@
import ngModule from '../../module';
import template from './label.html';
directive.$inject = ['vnTemplate'];
export default function directive(vnTemplate) {
return {
restrict: 'E',
template: (_, $attrs) =>
vnTemplate.get(template, $attrs)
};
}
ngModule.directive('vnLabel', directive);

View File

@ -1,5 +1,6 @@
import {module} from '../module'; import ngModule from '../../module';
import './multi-check.scss'; import './multi-check.scss';
/** /**
* Draw checkbox with a drop-down and multi options * Draw checkbox with a drop-down and multi options
* @param {SmallInt} checkAll Primary input-check state: 0 -> uncheck, 1 -> checked, 2 -> indeterminate checked * @param {SmallInt} checkAll Primary input-check state: 0 -> uncheck, 1 -> checked, 2 -> indeterminate checked
@ -90,10 +91,9 @@ export default class MultiCheck {
}, 200); }, 200);
} }
} }
MultiCheck.$inject = ['$timeout']; MultiCheck.$inject = ['$timeout'];
module.component('vnMultiCheck', { ngModule.component('vnMultiCheck', {
template: require('./multi-check.html'), template: require('./multi-check.html'),
controller: MultiCheck, controller: MultiCheck,
bindings: { bindings: {

View File

@ -1,4 +1,4 @@
import {module} from '../module'; import ngModule from '../../module';
import './style.scss'; import './style.scss';
export default class Paging { export default class Paging {
@ -45,11 +45,9 @@ export default class Paging {
} }
} }
} }
Paging.$inject = ['$http', '$scope']; Paging.$inject = ['$http', '$scope'];
export const NAME = 'vnPaging'; ngModule.component('vnPaging', {
export const COMPONENT = {
template: require('./paging.html'), template: require('./paging.html'),
bindings: { bindings: {
index: '<', index: '<',
@ -57,6 +55,4 @@ export const COMPONENT = {
total: '<' total: '<'
}, },
controller: Paging controller: Paging
}; });
module.component(NAME, COMPONENT);

View File

@ -1,4 +1,4 @@
import {module} from '../module'; import ngModule from '../../module';
import './style.css'; import './style.css';
directive.$inject = ['vnPopover']; directive.$inject = ['vnPopover'];
@ -13,8 +13,7 @@ export function directive(vnPopover) {
} }
}; };
} }
ngModule.directive('vnPopover', directive);
module.directive('vnPopover', directive);
export class Popover { export class Popover {
constructor($document, $compile, $transitions) { constructor($document, $compile, $transitions) {
@ -201,7 +200,6 @@ export class Popover {
this.lastTarget = event.target; this.lastTarget = event.target;
} }
} }
Popover.$inject = ['$document', '$compile', '$transitions']; Popover.$inject = ['$document', '$compile', '$transitions'];
module.service('vnPopover', Popover); ngModule.service('vnPopover', Popover);

View File

@ -0,0 +1,7 @@
<input
type="radio"
class="*[className]*"
name="*[name]*"
ng-model="*[model]*.*[name]*"
*[enabled]*>
<span class="mdl-radio__label" translate>*[text]*</span>

View File

@ -0,0 +1,15 @@
import ngModule from '../../module';
import template from './radio.html';
directive.$inject = ['vnTemplate'];
export default function directive(vnTemplate) {
return {
restrict: 'E',
template: (_, $attrs) =>
vnTemplate.get(template, $attrs, {
enabled: 'true',
className: 'mdl-radio mdl-js-radio mdl-js-ripple-effect'
})
};
}
ngModule.directive('vnRadio', directive);

View File

@ -1,4 +1,4 @@
import {module} from '../module'; import ngModule from '../../module';
/** /**
* A simple component to show non-obstructive notifications to the user. * A simple component to show non-obstructive notifications to the user.
@ -19,7 +19,7 @@ export default class Controller {
} }
Controller.$inject = ['$element']; Controller.$inject = ['$element'];
module.component('vnSnackbar', { ngModule.component('vnSnackbar', {
template: require('./snackbar.html'), template: require('./snackbar.html'),
controller: Controller controller: Controller
}); });

View File

@ -1,5 +1,5 @@
import {module} from '../module'; import ngModule from '../../module';
import Component from '../lib/component'; import Component from '../../lib/component';
import './style.css'; import './style.css';
/** /**
@ -55,4 +55,4 @@ export const component = {
}, },
controller: Spinner controller: Spinner
}; };
module.component('vnSpinner', component); ngModule.component('vnSpinner', component);

View File

@ -0,0 +1,7 @@
<input
type="submit"
class="*[className]*"
translate-attr="{value: '*[label]*'}"
value="*[label]*"
*[enabled]*>
</input>

View File

@ -0,0 +1,16 @@
import ngModule from '../../module';
import template from './submit.html';
directive.$inject = ['vnTemplate'];
export default function directive(vnTemplate) {
return {
restrict: 'E',
template: (_, $attrs) =>
vnTemplate.get(template, $attrs, {
label: 'Submit',
className: 'mdl-button mdl-js-button mdl-button--raised mdl-button--colored',
enabled: 'true'
})
};
}
ngModule.directive('vnSubmit', directive);

View File

@ -0,0 +1,6 @@
import ngModule from '../../module';
ngModule.component('vnSubtitle', {
template: require('./subtitle.html'),
transclude: true
});

View File

@ -0,0 +1,26 @@
import ngModule from '../../module';
directive.$inject = ['vnTemplate'];
export default function directive(vnTemplate) {
return {
restrict: 'E',
template: (_, $attrs) =>
vnTemplate.getNormalized(template, $attrs, {
className: 'mdl-switch__input',
label: ''
}),
link: function(scope, element, attrs) {
scope.$watch(attrs.model, () => {
let mdlField = element[0].firstChild.MaterialSwitch;
if (mdlField)
mdlField.updateClasses_();
});
componentHandler.upgradeElement(element[0].firstChild);
}
};
}
ngModule.directive('vnSwitch', directive);
export function factory() {
}
ngModule.factory('vnSwitchMdlFactory', factory);

View File

@ -0,0 +1,10 @@
<div class="mdl-textfield mdl-js-textfield">
<textarea
class="mdl-textfield__input"
type="text" rows= "*[rows]*"
ng-model="*[model]*"
rule="*[rule]*"
*[enabled]*>
</textarea>
<label class="mdl-textfield__label" translate>*[label]*</label>
</div>

View File

@ -0,0 +1,23 @@
import ngModule from '../../module';
import template from './textarea.html';
directive.$inject = ['vnTemplate'];
export function directive(vnTemplate) {
return {
restrict: 'E',
template: (_, $attrs) =>
vnTemplate.getNormalized(template, $attrs, {
label: '',
rows: 3
}),
link: function(scope, element, attrs) {
scope.$watch(attrs.model, () => {
let mdlField = element[0].firstChild.MaterialTextfield;
if (mdlField)
mdlField.updateClasses_();
});
componentHandler.upgradeElement(element[0].firstChild);
}
};
}
ngModule.directive('vnTextarea', directive);

View File

@ -1,12 +1,12 @@
import {module} from '../module'; import ngModule from '../../module';
import Input from '../lib/input'; import Input from '../../lib/input';
import './style.scss'; import './style.scss';
export default class Textfield extends Input { export default class Textfield extends Input {
constructor($element, $scope, $attrs, $timeout, normalizer) { constructor($element, $scope, $attrs, $timeout, vnTemplate) {
super($element); super($element);
normalizer.normalize($attrs); vnTemplate.normalizeInputAttrs($attrs);
this.$scope = $scope; this.$scope = $scope;
this.$attrs = $attrs; this.$attrs = $attrs;
@ -45,9 +45,9 @@ export default class Textfield extends Input {
this.input.focus(); this.input.focus();
} }
} }
Textfield.$inject = ['$element', '$scope', '$attrs', '$timeout', 'vnInputAttrsNormalizer']; Textfield.$inject = ['$element', '$scope', '$attrs', '$timeout', 'vnTemplate'];
module.component('vnTextfield', { ngModule.component('vnTextfield', {
template: require('./textfield.html'), template: require('./textfield.html'),
controller: Textfield, controller: Textfield,
bindings: { bindings: {

View File

@ -0,0 +1,6 @@
import ngModule from '../../module';
ngModule.component('vnTitle', {
template: require('./title.html'),
transclude: true
});

View File

@ -1,4 +1,4 @@
import {module} from '../module'; import ngModule from '../../module';
import './style.css'; import './style.css';
tooltip.$inject = ['$document', '$compile', '$interpolate', '$sce', '$templateCache', '$http', '$q']; tooltip.$inject = ['$document', '$compile', '$interpolate', '$sce', '$templateCache', '$http', '$q'];
@ -122,4 +122,4 @@ function tooltip($document, $compile, $interpolate, $sce, $templateCache, $http,
}; };
} }
module.directive('vnTooltip', tooltip); ngModule.directive('vnTooltip', tooltip);

Some files were not shown because too many files have changed in this diff Show More