Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
}
}
this.setObjects();
},
getValue(value) {
function notice(param, timeout) {
if (utils.isString(param)) {
return Notice({ content: param, timeout });
} else if (utils.isObject(param)) {
if (this) {
if (this.$router) {
param.$router = this.$router;
}
if (this.$i18n) {
param.$i18n = this.$i18n;
}
if (this.$store) {
param.$store = this.$store;
}
}
return Notice(param);
}
console.error('Notice params are incorrect:', param);
}
function noticeWithType(type, param, timeout) {
if (utils.isString(param)) {
return Notice({ content: param, timeout, type });
} else if (utils.isObject(param)) {
if (type) param.type = type;
return Notice(param);
}
console.error('Notice params are incorrect:', param);
}
const genData = param => {
let { date, type, show, vm, isNowDays, view } = param;
let disabled = false;
if (utils.isObject(vm.option)) {
if (vm.option.start) disabled = date.distance(vm.option.start, type) < 0;
if (vm.option.end && !disabled) disabled = date.distance(vm.option.end, type) > 0;
if (vm.option.disabled && !disabled) disabled = vm.option.disabled.call(null, date);
}
let dis = date.distance(vm.today, type);
let isToday = dis == 0;
if (view == 'quarter') {
isToday = dis >= -2 && dis <= 0;
}
return {
date,
show,
string: date.format(vm.format),
disabled,
isToday,
isNowDays
parseSingle(value, range) {
if (utils.isObject(value) && value[this.paramName[range]]) {
try {
let nowValue = manba(value[this.paramName[range]], this.nowFormat);
this.nowDate[range] = nowValue.format(this.nowFormat);
return;
} catch (evt) {
}
}
this.nowDate[range] = '';
},
parse(value) {
parseSingle(value, range) {
if (utils.isObject(value) && value[this.paramName[range]]) {
try {
let nowValue = manba(value[this.paramName[range]]);
if (range == 'end') {
nowValue = nowValue.add(-1);
}
this.nowDate[range] = nowValue.format(this.nowFormat);
return;
} catch (evt) {}
}
this.nowDate[range] = '';
},
parse(value) {
tooltipParam() {
if (this.tooltip === true) {
return {
enable: true,
content: this.content,
placement: this.placement
};
} else if (utils.isObject(this.tooltip)) {
return {
enable: true,
content: this.tooltip.content,
placement: this.tooltip.placement
};
}
return {
enable: false
};
},
cls() {
let result = value.map((ele) => {
if (utils.isObject(ele)) {
return ele[titleField];
}
const d = dict[ele];
if (utils.isObject(d)) {
return d[titleField];
}
return d;
});
return result.filter(ele => (ele && ele !== '')).join(connector || ', ');
show() {
if (!utils.isObject(this.value)) {
return '';
}
return `${this.value.start || this.t('h.datepicker.start')} - ${this.value.end || this.t('h.datepicker.end')}`;
},
shortcuts() {