UNPKG

@aplus-frontend/ui

Version:

185 lines (184 loc) 4.11 kB
import { isVNode as h, defineComponent as g, computed as B, createVNode as l, Fragment as c, createBlock as x, openBlock as w, resolveDynamicComponent as C } from "vue"; import { Space as N, Tag as S } from "@aplus-frontend/antdv"; import { isArray as T } from "lodash-unified"; function s(a) { return typeof a == "function" || Object.prototype.toString.call(a) === "[object Object]" && !h(a); } const I = /* @__PURE__ */ g({ name: "ApFieldTreeSelectRead", __name: "read", props: { mode: { default: "edit" }, class: {}, style: {}, suffixIcon: {}, size: {}, bordered: { type: Boolean }, treeLine: {}, replaceFields: {}, placement: {}, status: {}, popupClassName: {}, dropdownClassName: {}, "onUpdate:value": {}, "onUpdate:treeExpandedKeys": {}, "onUpdate:searchValue": {}, variant: {}, switcherLoadingIcon: {}, value: {}, children: {}, listHeight: {}, onMouseenter: {}, onMouseleave: {}, tabindex: {}, onClick: {}, onFocus: {}, onBlur: {}, onChange: {}, onKeydown: {}, onKeyup: {}, onMousedown: {}, onSelect: {}, open: { type: Boolean }, animation: {}, direction: {}, multiple: { type: Boolean }, disabled: { type: Boolean }, prefixCls: {}, id: {}, autofocus: { type: Boolean }, getPopupContainer: {}, virtual: { type: Boolean }, dropdownMatchSelectWidth: {}, placeholder: {}, loading: { type: Boolean }, defaultValue: {}, prefix: {}, clearIcon: {}, allowClear: { type: Boolean }, getRawInputElement: {}, fieldNames: {}, inputValue: {}, searchValue: {}, onSearch: {}, autoClearSearchValue: { type: Boolean }, onDeselect: {}, listItemHeight: {}, labelInValue: { type: Boolean }, maxCount: {}, showSearch: { type: Boolean }, tagRender: {}, optionLabelRender: {}, notFoundContent: {}, onClear: {}, choiceTransitionName: {}, defaultOpen: { type: Boolean }, onDropdownVisibleChange: {}, maxTagTextLength: {}, maxTagCount: {}, maxTagPlaceholder: {}, tokenSeparators: {}, removeIcon: {}, transitionName: {}, dropdownStyle: {}, dropdownRender: {}, dropdownAlign: {}, showAction: {}, onPopupScroll: {}, onInputKeyDown: {}, showArrow: { type: Boolean }, showCheckedStrategy: {}, filterTreeNode: {}, treeNodeFilterProp: {}, treeNodeLabelProp: {}, treeCheckable: { type: Boolean }, treeCheckStrictly: { type: Boolean }, treeData: {}, treeDataSimpleMode: {}, treeLoadedKeys: {}, onTreeLoad: {}, treeDefaultExpandAll: { type: Boolean }, treeExpandedKeys: {}, treeDefaultExpandedKeys: {}, onTreeExpand: {}, treeIcon: {}, switcherIcon: {}, treeExpandAction: {}, dropdownPopupAlign: {}, emptyText: { default: "--" }, request: {}, lazy: { type: Boolean }, params: {}, loadData: { type: Boolean } }, setup(a) { const e = a, u = B(() => { let r; const p = e.value, d = T(p) ? p : [p].filter(Boolean); if (!d.length) return l(c, null, [e.emptyText]); const o = [], m = e.fieldNames?.label || "label", y = e.fieldNames?.value || "value"; function i(t) { for (const n of t) { if (d.find((f) => f === n[y]) && o.push(n[m]), o.length === d.length) return; n.children?.length && i(n.children); } } return i(e.treeData), o.length ? o.length === 1 ? l("span", null, [o[0]]) : l(N, { size: 4 }, s(r = o.map((t, n) => l(S, { style: "margin-right: 0px", key: `${t}-${n}` }, s(t) ? t : { default: () => [t] }))) ? r : { default: () => [r] }) : l(c, null, [e.emptyText]); }); return (r, p) => (w(), x(C(u.value))); } }); export { I as default };