This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/vuetify/es5/mixins/dependent/index.js

83 lines
2.5 KiB
JavaScript
Raw Normal View History

2019-08-11 18:48:02 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _mixins = _interopRequireDefault(require("../../util/mixins"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function searchChildren(children) {
var results = [];
for (var index = 0; index < children.length; index++) {
var child = children[index];
if (child.isActive && child.isDependent) {
results.push(child);
} else {
results.push.apply(results, _toConsumableArray(searchChildren(child.$children)));
}
}
return results;
}
/* @vue/component */
var _default = (0, _mixins.default)().extend({
name: 'dependent',
data: function data() {
return {
closeDependents: true,
isActive: false,
isDependent: true
};
},
watch: {
isActive: function isActive(val) {
if (val) return;
var openDependents = this.getOpenDependents();
for (var index = 0; index < openDependents.length; index++) {
openDependents[index].isActive = false;
}
}
},
methods: {
getOpenDependents: function getOpenDependents() {
if (this.closeDependents) return searchChildren(this.$children);
return [];
},
getOpenDependentElements: function getOpenDependentElements() {
var result = [];
var openDependents = this.getOpenDependents();
for (var index = 0; index < openDependents.length; index++) {
result.push.apply(result, _toConsumableArray(openDependents[index].getClickableDependentElements()));
}
return result;
},
getClickableDependentElements: function getClickableDependentElements() {
var result = [this.$el];
if (this.$refs.content) result.push(this.$refs.content);
if (this.overlay) result.push(this.overlay);
result.push.apply(result, _toConsumableArray(this.getOpenDependentElements()));
return result;
}
}
});
exports.default = _default;
//# sourceMappingURL=index.js.map