Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
jump(event) {
let value = parseInt(event.target.value, 10);
// log(value);
if (isNaN(value)) {
Message.error(this.t('h.pagination.incorrectFormat'));
return;
}
if (value > this.count || value < 1) {
Message.error(this.t('h.pagination.overSize'));
return;
}
let cur = parseInt(event.target.value, 10);
if (cur == (this.value.page || this.cur)) {
return;
}
this.setvalue({ cur: cur, size: this.sizeNow });
},
change(cur) {if (this.isSingle) {
if (!utils.isNull(this.value)) {
value = utils.toggleValue(this.checkList, this.value);
} else if (!utils.isNull(this.checkStatus)) {
value = this.isChecked ? this.falseValue : this.trueValue;
} else if (this.checked === true) {
value = this.checked;
} else {
value = this.isChecked ? this.falseValue : this.trueValue;
}
} else {
value = utils.copy(this.checkStatus);
let key = option[this.key];
value = utils.toggleValue(value, key);
if (this.limit && this.limit < value.length) {
Message.error(this.t('h.checkbox.limitSize', { limitSize: this.limit }));
return;
}
}
this.$emit('change', value);
this.$emit('input', value);
let event = document.createEvent('CustomEvent');
event.initCustomEvent('setvalue', true, true, value);
this.$el.dispatchEvent(event);
},
check(key) {setvalue(option, trigger) {
if (this.disabled) return;
if (option.disabled || option.isLabel) return;
let code = option[this.keyName];
if (this.multiple) {
if (!utils.isNull(this.limit) && !this.isIncludes(code) && this.codes.length >= this.limit) {
Message.error(this.t('h.select.limitSize', { limitSize: this.limit }));
return;
}
this.codes = utils.toggleValue(this.codes, code);
} else {
this.codes = code;
}
this.setObjects();
let value = this.type == 'key' ? this.codes : this.objects;
this.$emit('input', value);
this.$emit('change', this.objects);
let event = document.createEvent('CustomEvent');
event.initCustomEvent('setvalue', true, true, this.objects);
this.$el.dispatchEvent(event);
this.nowSelected = -1;
if (this.multiple) {
this.searchInput = '';add() {
if (this.wordlimit < this.tagvalue.length) {
Message.error(this.t('h.wordlimit.warn', [this.wordlimit]));
return false;
}
if (this.limit <= this.values.length) {
Message.error(this.t('h.taginput.limitWords'));
return false;
}
if (this.readonly) return false;
if (this.tagvalue === '') return false;
let value = utils.copy(this.values);
value.push(this.tagvalue);
this.setvalue(value);
},
setvalue(value) {change(data, event) {
if (event) {
event.stopPropagation();
event.preventDefault();
}
if (!this.multiple && data.status.selectable === false) {
return;
}
if (this.multiple && data.status.checkable === false) {
return;
}
if (this.multiple) {
if (this.objects.length >= this.limit && !this.param.objects.some(item => item.key === data.key)) {
Message.error(this.t('h.categoryPicker.limitWords', {
size: this.limit
}));
return;
}
utils.toggleValueByKey(this.objects, 'key', data);
} else {
this.object = data;
}
if (this.multiple) {
this.dropdownUpdate();
} else if (!(data.children && data.children.length)) {
this.dropdown.hide();
}
this.setvalue('picker');
},
dropdownUpdate() {tipError(result) {
if (result && !result.result) {
let m = result.messages[0];
if (this.showErrorTip) {
if (m.type == 'base') {
Message.error(`${m.label}${m.message}`);
} else {
Message.error(`${m.message}`);
}
}
this.$nextTick(() => {
let firstError = this.$el.querySelector(`.h-form-item-valid-error[prop='${m.prop}']`);
if (firstError) {
ScrollIntoView(firstError, {
time: 500,
align: {
top: this.top,
topOffset: this.topOffset
}
});
}
});const wordlimit = function (el, total) {
let v = el.value.length;
if (v > total) {
el.value = el.value.substring(0, total);
if (el.getAttribute('data-alerted') == '0') {
Message.error(locale.t('h.wordlimit.warn', [total]));
}
el.setAttribute('data-alerted', '1');
}
};change(data, event) {
if (event) {
event.stopPropagation();
event.preventDefault();
}
if (data.status.checkable === false) {
return;
}
if (this.param.multiple) {
if (this.param.objects.length >= this.param.limit && !this.param.objects.some(item => item.key === data.key)) {
Message.error(this.t('h.categoryModal.limitWords', {
size: this.param.limit
}));
return;
}
utils.toggleValueByKey(this.param.objects, 'key', data);
} else {
this.param.object = data;
}
},
openNew(data) {