linkmore-design
Version:
🌈 🚀lm组件库。🚀
153 lines (152 loc) • 3.56 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getOpetatorGroup = exports.default = void 0;
// 关系组中的每一项Props
// type类型
var operatorType; // 关系组Props
(function (operatorType) {
operatorType[operatorType["input"] = 0] = "input";
operatorType[operatorType["enum"] = 1] = "enum";
operatorType[operatorType["select"] = 2] = "select";
operatorType[operatorType["checkbox"] = 3] = "checkbox";
operatorType[operatorType["cascader"] = 4] = "cascader";
operatorType[operatorType["date"] = 5] = "date";
operatorType[operatorType["range"] = 6] = "range";
operatorType[operatorType["number"] = 7] = "number";
operatorType[operatorType["code"] = 8] = "code";
})(operatorType || (operatorType = {}));
const getOpetatorGroup = (locale, fieldValueSource, fieldValueType) => {
const isContains = fieldValueType === 'string' && fieldValueSource !== 4;
const contains = isContains ? 'contains' : 'in';
const notContains = isContains ? 'not_contains' : 'not_in';
const enumOptions = [{
label: locale.equal,
value: 'equal'
}, {
label: locale.notEqual,
value: 'not_equal'
}, {
label: locale.contains,
value: contains
}, {
label: locale.notContains,
value: notContains
}, {
label: locale.empty,
value: 'empty'
}, {
label: locale.notEmpty,
value: 'not_empty'
}];
const dateOptions = [{
label: locale.equal,
value: 'equal'
}, {
label: locale.notEqual,
value: 'not_equal'
}, {
label: locale.lessThan,
value: 'less_than'
}, {
label: locale.greaterThan,
value: 'greater_than'
}, {
label: locale.between,
value: 'between'
}, {
label: locale.empty,
value: 'empty'
}, {
label: locale.notEmpty,
value: 'not_empty'
}];
return {
// 名称类型
input: [{
label: locale.equal,
value: 'equal'
}, {
label: locale.notEqual,
value: 'not_equal'
}, {
label: locale.contains,
value: contains
}, {
label: locale.notContains,
value: notContains
}, {
label: locale.empty,
value: 'empty'
}, {
label: locale.notEmpty,
value: 'not_empty'
}],
// 枚举类型
enum: enumOptions,
select: enumOptions,
checkbox: enumOptions,
cascader: enumOptions,
// 日期类型
date: dateOptions,
range: dateOptions,
// 金额类型
number: [{
label: '=',
value: 'equal'
}, {
label: '≠',
value: 'not_equal'
}, {
label: '>',
value: 'greater_than'
}, {
label: '≧',
value: 'greater_than_or_equal'
}, {
label: '<',
value: 'less_than'
}, {
label: '≦',
value: 'less_than_or_equal'
}, {
label: locale.empty,
value: 'empty'
}, {
label: locale.notEmpty,
value: 'not_empty'
}],
// 单号类型
code: [{
label: locale.equal,
value: 'equal'
}, {
label: locale.notEqual,
value: 'not_equal'
}, {
label: locale.startsWith,
value: 'starts_with'
}, {
label: locale.endsWith,
value: 'ends_with'
}, {
label: locale.contains,
value: contains
}, {
label: locale.notContains,
value: notContains
}, {
label: locale.empty,
value: 'empty'
}, {
label: locale.notEmpty,
value: 'not_empty'
}]
};
};
exports.getOpetatorGroup = getOpetatorGroup;
var _default = {
getOpetatorGroup
};
exports.default = _default;