| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- 'use strict';
- Object.defineProperty(exports, '__esModule', { value: true });
- var vue = require('vue');
- var lodashUnified = require('lodash-unified');
- var token = require('./token.js');
- var shared = require('@vue/shared');
- var ElOptions = vue.defineComponent({
- name: "ElOptions",
- setup(_, { slots }) {
- const select = vue.inject(token.selectKey);
- let cachedValueList = [];
- return () => {
- var _a, _b;
- const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
- const valueList = [];
- function filterOptions(children2) {
- if (!shared.isArray(children2))
- return;
- children2.forEach((item) => {
- var _a2, _b2, _c, _d;
- const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
- if (name === "ElOptionGroup") {
- filterOptions(!shared.isString(item.children) && !shared.isArray(item.children) && shared.isFunction((_b2 = item.children) == null ? void 0 : _b2.default) ? (_c = item.children) == null ? void 0 : _c.default() : item.children);
- } else if (name === "ElOption") {
- valueList.push((_d = item.props) == null ? void 0 : _d.value);
- } else if (shared.isArray(item.children)) {
- filterOptions(item.children);
- }
- });
- }
- if (children.length) {
- filterOptions((_b = children[0]) == null ? void 0 : _b.children);
- }
- if (!lodashUnified.isEqual(valueList, cachedValueList)) {
- cachedValueList = valueList;
- if (select) {
- select.states.optionValues = valueList;
- }
- }
- return children;
- };
- }
- });
- exports["default"] = ElOptions;
- //# sourceMappingURL=options.js.map
|