Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
initCategoryDatas() {
let datas = [];
if (utils.isArray(this.param.datas)) {
datas = this.param.datas;
} else if (utils.isFunction(this.param.datas)) {
datas = this.param.datas.apply(this.param);
}
if (utils.isFunction(this.param.getTotalDatas) || utils.isFunction(this.param.getDatas)) {
datas = [];
this.globalloading = true;
let loadData = this.param.getTotalDatas || this.param.getDatas;
let param = [
result => {
this.categoryDatas = this.initDatas(utils.copy(result));
this.parse();
this.globalloading = false;
this.$emit('loadDataSuccess');
},
() => {parse() {
if (this.multiple) {
let values = this.value || [];
if (!utils.isArray(values)) {
console.warn(`[HeyUI WARNING] Select Component: value '${values}' can't be a value of a multiple select`);
values = [];
}
this.codes = values.map((item) => {
return this.type == 'key' ? this.getValue(item) : item[this.keyName];
}).filter(item => item !== null);
} else {
if (this.type == 'key') {
this.codes = this.getValue(this.value);
} else {
if (utils.isObject(this.value)) {
this.codes = this.value[this.keyName];
} else {
this.codes = null;
}
}computedList() {
if (this.isSingle) {
return [genObject(this.datas)];
} else if (utils.isArray(this.datas)) {
return this.datas.map(item => {
return genObject(item);
});
}
return [];
}
}parse() {
if (this.multiple) {
let os = [];
if (utils.isArray(this.value) && this.value.length > 0) {
for (let v of this.value) {
os.push(this.getValue(v));
}
}
this.objects = os;
this.object = null;
} else {
this.object = this.getValue(this.value);
this.objects = [];
}
},
getValue(item) {dispose() {
let value = null;
if (this.multiple) {
value = [];
if (utils.isArray(this.objects) && this.objects.length > 0) {
for (let o of this.objects) {
value.push(this.getV(o));
}
}
return value;
} else {
if (this.mustMatch) {
value = this.getV(this.object);
} else {
if (!utils.isBlank(this.object.key)) {
value = this.getV(this.object);
} else {
if (!utils.isBlank(this.tempValue)) {
let inputValue = null;
if (this.type == 'title') {
inputValue = this.tempValue;const that = this;
this.mouseOver = false;
this.closeTimeout = false;
let param = this.param = utils.extend({}, Default, orignalparam, true);
let html = '';
if (param.hasMask) {
html += `<div class="${notifyMaskCls}"></div>`;
}
if (param.type === TYPE.MODAL && param.hasMask) {
html += `<div class="${notifyBodyCls}">`;
}
html += `<div class="${notifyContainerCls}">`;
if (param.hasCloseIcon) html += `<span class="${notifyCloseCls} ${closeIcon}"></span>`;
if (param.title) html += `<header class="${param.type}-header">${param.title}</header>`;
html += `<div class="${notifyContentCls}"></div>`;
param.hasFooter = utils.isArray(param.buttons) && param.buttons.length > 0 && !param.component;
if (param.hasFooter) {
let footeHtml = '';
for (const b of param.buttons) {
let name = '';
let attr = '';
let color = '';
if (b == 'cancel') {
name = b.name || locale.t('h.common.cancel');
attr = b;
} else if (b == 'ok') {
name = b.name || locale.t('h.common.confirm');
attr = 'ok';
color = 'primary';
} else if (utils.isObject(b)) {
attr = b.type;
name = b.name;</div></div>parse() {
if (this.multiple) {
let os = [];
if (utils.isArray(this.value) && this.value.length > 0) {
for (let v of this.value) {
os.push(this.getValue(v));
}
}
this.objects = os;
} else {
this.object = this.getValue(this.value);
}
},
getValue(item) {setSelection(data) {
if (utils.isArray(data)) {
this.checks = [...data];
}
},
getSelection() {parse() {
if (this.multiple) {
let os = [];
if (utils.isArray(this.value) && this.value.length > 0) {
for (let v of this.value) {
os.push(this.getValue(v));
}
}
this.objects = os;
} else {
this.object = this.getValue(this.value);
}
},
getValue(item) {computedDatas() {
if (utils.isString(this.datas)) {
return [this.datas];
} else if (utils.isArray(this.datas)) {
return this.datas;
}
return [];
},
isShowIndex() {