add vite external plugin
This commit is contained in:
@ -1,10 +1,9 @@
|
||||
import { createElement } from "../../functions";
|
||||
import Grid from "../../ui/grid";
|
||||
import { createPopup } from "../../ui/popup";
|
||||
import { nullOrEmpty, r } from "../../utility";
|
||||
import { Grid, createElement, createPopup } from "../../ui";
|
||||
import { nullOrEmpty, r, contains } from "../../utility";
|
||||
|
||||
class Follower {
|
||||
#option;
|
||||
#grid;
|
||||
|
||||
constructor(option = {}) {
|
||||
this.#option = option;
|
||||
@ -19,15 +18,29 @@ class Follower {
|
||||
createElement('input', search => {
|
||||
search.className = 'ui-input follower-search';
|
||||
search.addEventListener('input', () => {
|
||||
|
||||
const key = search.value;
|
||||
if (nullOrEmpty(key)) {
|
||||
this.#grid.source = this.#option.followers;
|
||||
} else {
|
||||
this.#grid.source = this.#option.followers.filter(f => contains(f.DisplayName, key, true));
|
||||
}
|
||||
});
|
||||
}),
|
||||
gridContainer
|
||||
),
|
||||
{ text: r('ok', 'OK'), key: 'ok' },
|
||||
{
|
||||
text: r('ok', 'OK'),
|
||||
key: 'ok',
|
||||
trigger: () => {
|
||||
if (typeof this.#option.onOk === 'function') {
|
||||
return this.#option.onOk.call(this, this.#grid.source.filter(f => f.Email || f.Text));
|
||||
}
|
||||
}
|
||||
},
|
||||
{ text: r('cancel', 'Cancel'), key: 'cancel' }
|
||||
);
|
||||
const result = await popup.show(parent);
|
||||
result.querySelector('.follower-search').focus();
|
||||
// grid
|
||||
const grid = new Grid(gridContainer);
|
||||
grid.columns = [
|
||||
@ -50,6 +63,7 @@ class Follower {
|
||||
];
|
||||
grid.init();
|
||||
grid.source = this.#option.followers;
|
||||
this.#grid = grid;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user