mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-11 17:58:41 +00:00
add tag remove function
This commit is contained in:
parent
b3673209d7
commit
39cbafb6d2
|
|
@ -17,7 +17,7 @@ export class AdvancedInput
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
constructor (e)
|
constructor (e, eventManager, observer)
|
||||||
{
|
{
|
||||||
this.id = e.id;
|
this.id = e.id;
|
||||||
this.inputComponent = e;
|
this.inputComponent = e;
|
||||||
|
|
@ -113,6 +113,25 @@ export class AdvancedInput
|
||||||
self.addToResultList(self, document.activeElement);
|
self.addToResultList(self, document.activeElement);
|
||||||
jsOMS.removeClass(self.dropdownElement, 'active');
|
jsOMS.removeClass(self.dropdownElement, 'active');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
observer.observe(this.tagElement, { childList: true, attributes: false, subtree: false });
|
||||||
|
eventManager.attach(this.id + '-tags-childList', function(data) {
|
||||||
|
const removes = data.target.querySelectorAll('.fa-times'),
|
||||||
|
removesLength = removes === null ? 0 : removes.length;
|
||||||
|
|
||||||
|
if (removesLength < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
removes[removesLength - 1].addEventListener('click', function(e) {
|
||||||
|
if (e.target.parentNode.parentNode === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e.target.parentNode.parentNode.removeChild(e.target.parentNode);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,14 @@ export class GeneralUI
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
*
|
*
|
||||||
|
* @param {Object} app Application object
|
||||||
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
constructor ()
|
constructor (app)
|
||||||
{
|
{
|
||||||
this.visObs = null;
|
this.visObs = null;
|
||||||
|
this.app = app;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -130,7 +133,7 @@ export class GeneralUI
|
||||||
const length = e.length;
|
const length = e.length;
|
||||||
|
|
||||||
for (let i = 0; i < length; ++i) {
|
for (let i = 0; i < length; ++i) {
|
||||||
new AdvancedInput(e[i]);
|
new AdvancedInput(e[i], this.app.eventManager, this.app.uiManager.getDOMObserver());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ export class UIManager
|
||||||
this.tableManager = new Table(this.app);
|
this.tableManager = new Table(this.app);
|
||||||
this.actionManager = new ActionManager(this.app);
|
this.actionManager = new ActionManager(this.app);
|
||||||
this.dragNDrop = new DragNDrop(this.app);
|
this.dragNDrop = new DragNDrop(this.app);
|
||||||
this.generalUI = new GeneralUI();
|
this.generalUI = new GeneralUI(this.app);
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
/** global: MutationObserver */
|
/** global: MutationObserver */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user