37 lines
791 B
JavaScript
37 lines
791 B
JavaScript
//import { Ut } from ".";
|
|
|
|
export class AppendOptions {
|
|
|
|
constructor(target, data, opts) {
|
|
|
|
opts = opts || {};
|
|
|
|
if (opts.clear) {
|
|
this.dxHtml('');
|
|
}
|
|
|
|
if (typeof data === 'string') {
|
|
|
|
if (data == '{}') {
|
|
return this;
|
|
}
|
|
|
|
data.slice(1).slice(0, -1).split(',').forEach(function(token) {
|
|
|
|
let option = token.split(':').map(function(a) {
|
|
return a.slice(1).slice(0, -1);
|
|
});
|
|
|
|
target.append(new Option(option[1], option[0]));
|
|
});
|
|
}
|
|
else {
|
|
|
|
for (let id in data) {
|
|
target.append(new Option(data[id], id));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Ut.extendNodeUx(AppendOptions);
|