tdesign-mobile-vue
Version:
tdesign-mobile-vue
151 lines (141 loc) • 5.39 kB
JavaScript
/**
* tdesign v1.13.2
* (c) 2026 TDesign Group
* @license MIT
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
var Vue = require('vue');
var _arrayMap = require('../../_chunks/dep-e1cc657b.js');
var _cacheHas = require('../../_chunks/dep-0659f7fe.js');
var _arrayIncludesWith = require('../../_chunks/dep-f1321e96.js');
var _baseUnary = require('../../_chunks/dep-a9fd9906.js');
var isArrayLikeObject = require('../../_chunks/dep-412d3c4b.js');
require('../../_chunks/dep-d2416277.js');
require('../../_chunks/dep-4a0acbaa.js');
require('../../_chunks/dep-abe9931d.js');
require('../../_chunks/dep-d16bf091.js');
require('@babel/runtime/helpers/typeof');
require('../../_chunks/dep-c041cd95.js');
require('../../_chunks/dep-f5894bc3.js');
require('../../_chunks/dep-644f5d6a.js');
require('../../_chunks/dep-bd009758.js');
require('../../_chunks/dep-591548d1.js');
require('../../_chunks/dep-a8725fec.js');
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin = Math.min;
/**
* The base implementation of methods like `_.intersection`, without support
* for iteratee shorthands, that accepts an array of arrays to inspect.
*
* @private
* @param {Array} arrays The arrays to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of shared values.
*/
function baseIntersection(arrays, iteratee, comparator) {
var includes = comparator ? _arrayIncludesWith.arrayIncludesWith : _arrayIncludesWith.arrayIncludes,
length = arrays[0].length,
othLength = arrays.length,
othIndex = othLength,
caches = Array(othLength),
maxLength = Infinity,
result = [];
while (othIndex--) {
var array = arrays[othIndex];
if (othIndex && iteratee) {
array = _arrayMap.arrayMap(array, _baseUnary.baseUnary(iteratee));
}
maxLength = nativeMin(array.length, maxLength);
caches[othIndex] = !comparator && (iteratee || length >= 120 && array.length >= 120) ? new _cacheHas.SetCache(othIndex && array) : undefined;
}
array = arrays[0];
var index = -1,
seen = caches[0];
outer: while (++index < length && result.length < maxLength) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
value = comparator || value !== 0 ? value : 0;
if (!(seen ? _cacheHas.cacheHas(seen, computed) : includes(result, computed, comparator))) {
othIndex = othLength;
while (--othIndex) {
var cache = caches[othIndex];
if (!(cache ? _cacheHas.cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) {
continue outer;
}
}
if (seen) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}
/**
* Casts `value` to an empty array if it's not an array like object.
*
* @private
* @param {*} value The value to inspect.
* @returns {Array|Object} Returns the cast array-like object.
*/
function castArrayLikeObject(value) {
return isArrayLikeObject.isArrayLikeObject(value) ? value : [];
}
/**
* Creates an array of unique values that are included in all given arrays
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. The order and references of result values are
* determined by the first array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of intersecting values.
* @example
*
* _.intersection([2, 1], [2, 3]);
* // => [2]
*/
var intersection = isArrayLikeObject.baseRest(function (arrays) {
var mapped = _arrayMap.arrayMap(arrays, castArrayLikeObject);
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
});
var intersection$1 = intersection;
var setCheckAllStatus = function setCheckAllStatus(optionList, innerValue, checkedSet) {
var isArray = Array.isArray;
var validValues = Vue.computed(function () {
var _optionList$value$fil, _optionList$value;
return (_optionList$value$fil = (_optionList$value = optionList.value) === null || _optionList$value === void 0 ? void 0 : _optionList$value.filter(function (item) {
return !item.checkAll && item.value !== void 0;
}).map(function (item) {
return item.value;
})) !== null && _optionList$value$fil !== void 0 ? _optionList$value$fil : [];
});
var intersectionLen = Vue.computed(function () {
if (isArray(innerValue.value)) {
return intersection$1(innerValue.value, validValues.value).length;
}
return 0;
});
var isAllChecked = Vue.computed(function () {
var validLen = validValues.value.length;
if (validLen === 0) return false;
return intersectionLen.value === validLen;
});
var indeterminate = Vue.computed(function () {
var validLen = validValues.value.length;
if (validLen === 0) return false;
return !isAllChecked.value && intersectionLen.value > 0;
});
return Vue.computed(function () {
if (isAllChecked.value) return "checked";
if (indeterminate.value) return "indeterminate";
return "uncheck";
});
};
exports.setCheckAllStatus = setCheckAllStatus;
//# sourceMappingURL=setCheckAllStatus.js.map