added disabled property
This commit is contained in:
parent
ba62f545f7
commit
54a835eefd
|
@ -11,7 +11,11 @@ export default class Controller extends Component {
|
|||
element.tabIndex = 0;
|
||||
|
||||
element.addEventListener('focus', () => {
|
||||
if (this.field) return;
|
||||
if (this.field || this.disabled) {
|
||||
console.log(element.style.cursor);
|
||||
// element.style.cursor = 'none!important';
|
||||
return;
|
||||
}
|
||||
$transclude((tClone, tScope) => {
|
||||
this.field = tClone;
|
||||
this.tScope = tScope;
|
||||
|
@ -26,7 +30,7 @@ export default class Controller extends Component {
|
|||
});
|
||||
|
||||
element.addEventListener('focusout', event => {
|
||||
this.destroyTimer();
|
||||
if (this.field || this.disabled) return;
|
||||
this.lastEvent = event;
|
||||
let target = event.relatedTarget;
|
||||
while (target && target != element)
|
||||
|
@ -57,6 +61,9 @@ Controller.$inject = ['$element', '$scope', '$transclude', '$timeout'];
|
|||
ngModule.component('vnTdEditable', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
disabled: '<?'
|
||||
},
|
||||
transclude: {
|
||||
text: 'text',
|
||||
field: '?field'
|
||||
|
|
|
@ -4,7 +4,9 @@ vn-td-editable {
|
|||
cursor: pointer;
|
||||
outline: none;
|
||||
position: relative;
|
||||
|
||||
&:not([disabled="true"]) {
|
||||
cursor: initial;
|
||||
}
|
||||
&.selected > .text {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue