villianjs-pro 1.0.46 → 1.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
function _array_like_to_array(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes(arr){if(Array.isArray(arr))return arr}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _iterable_to_array_limit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target=_object_without_properties_loose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}function _sliced_to_array(arr,i){return _array_with_holes(arr)||_iterable_to_array_limit(arr,i)||_unsupported_iterable_to_array(arr,i)||_non_iterable_rest()}function _unsupported_iterable_to_array(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array(o,minLen)}import React,{useState,useContext}from"react";import{useCommonStyles}from"../hooks/commonStyles";import useStyle from"../styles";import classNames from"classnames";import{Modal}from"../../Modal";import{Typography}from"../../Text";import{TreeSelectContent}from"./content";import{TreeSelectContext}from"../context";import{Tag}from"antd";import{DownOutlined}from"@ant-design/icons";var CustomModal=Modal.CustomModal;var Text=Typography.Text;export var TreeSelectContainer=function(props){var _props_mode=props.mode,mode=_props_mode===void 0?"modal":_props_mode,_props_value=props.value,value=_props_value===void 0?[]:_props_value,onChange=props.onChange,className=props.className,style=props.style,_props_placeholder=props.placeholder,placeholder=_props_placeholder===void 0?"请选择":_props_placeholder,_props_maxDisplayCount=props.maxDisplayCount,maxDisplayCount=_props_maxDisplayCount===void 0?3:_props_maxDisplayCount,modalProps=props.modalProps,restProps=_object_without_properties(props,["mode","value","onChange","className","style","placeholder","maxDisplayCount","modalProps"]);var context=useContext(TreeSelectContext);var _useCommonStyles=useCommonStyles("vlian-tree-select",props,useStyle),prefixCls=_useCommonStyles.prefixCls,wrapCSS=_useCommonStyles.wrapCSS,hashId=_useCommonStyles.hashId;var _useState=_sliced_to_array(useState(false),2),modalOpen=_useState[0],setModalOpen=_useState[1];var handleOpenModal=function(){if(mode==="modal"){var _context_setTempSelectedRows,_context_setTempSelectedKeys;var currentSelected=(context===null||context===void 0?void 0:context.selectedRows)||value;context===null||context===void 0?void 0:(_context_setTempSelectedRows=context.setTempSelectedRows)===null||_context_setTempSelectedRows===void 0?void 0:_context_setTempSelectedRows.call(context,currentSelected);context===null||context===void 0?void 0:(_context_setTempSelectedKeys=context.setTempSelectedKeys)===null||_context_setTempSelectedKeys===void 0?void 0:_context_setTempSelectedKeys.call(context,(context===null||context===void 0?void 0:context.selectedKeys)||currentSelected.map(function(row){return row.key}))}setModalOpen(true)};var handleModalOk=function(){if(mode==="modal"){var _context_setSelectedRows;var tempRows=(context===null||context===void 0?void 0:context.tempSelectedRows)||(context===null||context===void 0?void 0:context.selectedRows)||value;context===null||context===void 0?void 0:(_context_setSelectedRows=context.setSelectedRows)===null||_context_setSelectedRows===void 0?void 0:_context_setSelectedRows.call(context,tempRows);onChange===null||onChange===void 0?void 0:onChange(tempRows)}setModalOpen(false)};var handleModalCancel=function(){if(mode==="modal"){var _context_setTempSelectedRows,_context_setTempSelectedKeys;var confirmedRows=(context===null||context===void 0?void 0:context.selectedRows)||value;context===null||context===void 0?void 0:(_context_setTempSelectedRows=context.setTempSelectedRows)===null||_context_setTempSelectedRows===void 0?void 0:_context_setTempSelectedRows.call(context,confirmedRows);context===null||context===void 0?void 0:(_context_setTempSelectedKeys=context.setTempSelectedKeys)===null||_context_setTempSelectedKeys===void 0?void 0:_context_setTempSelectedKeys.call(context,(context===null||context===void 0?void 0:context.selectedKeys)||confirmedRows.map(function(row){return row.key}))}setModalOpen(false)};var renderTrigger=function(){var selectedRows=(context===null||context===void 0?void 0:context.selectedRows)||value;var hasSelected=selectedRows.length>0;var displayTags=selectedRows.slice(0,maxDisplayCount);var remainingCount=selectedRows.length-maxDisplayCount;return React.createElement("div",{className:classNames("".concat(prefixCls,"-trigger"),hashId),onClick:handleOpenModal},React.createElement("div",{className:classNames("".concat(prefixCls,"-trigger-content"),hashId)},!hasSelected?React.createElement("span",{className:classNames("".concat(prefixCls,"-trigger-placeholder"),hashId)},placeholder):React.createElement("div",{className:classNames("".concat(prefixCls,"-trigger-tags"),hashId)},displayTags.map(function(row){return React.createElement(Tag,{key:row.key,className:classNames("".concat(prefixCls,"-trigger-tag"),hashId),closable:false},React.createElement(Text,{className:classNames("".concat(prefixCls,"-trigger-tag-text"),hashId),ellipsis:true},row.label))}),remainingCount>0&&React.createElement(Tag,{className:classNames("".concat(prefixCls,"-trigger-tag"),"".concat(prefixCls,"-trigger-tag-more"),hashId),closable:false},"+",remainingCount))),React.createElement(DownOutlined,{className:classNames("".concat(prefixCls,"-trigger-arrow"),hashId)}))};if(mode==="inline"){return wrapCSS(React.createElement("div",{className:classNames(prefixCls,className,hashId),style:style},React.createElement(TreeSelectContent,props)))}return wrapCSS(React.createElement("div",{className:classNames(prefixCls,className,hashId),style:style},renderTrigger(),React.createElement(CustomModal,_object_spread({open:modalOpen,onCancel:handleModalCancel,onOk:handleModalOk,maskClosable:false},modalProps),React.createElement(TreeSelectContent,_object_spread({},props,restProps)))))};
|
|
1
|
+
function _array_like_to_array(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes(arr){if(Array.isArray(arr))return arr}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _iterable_to_array_limit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target=_object_without_properties_loose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}function _sliced_to_array(arr,i){return _array_with_holes(arr)||_iterable_to_array_limit(arr,i)||_unsupported_iterable_to_array(arr,i)||_non_iterable_rest()}function _unsupported_iterable_to_array(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array(o,minLen)}import React,{useState,useContext}from"react";import{useCommonStyles}from"../hooks/commonStyles";import useStyle from"../styles";import classNames from"classnames";import{Modal}from"../../Modal";import{Typography}from"../../Text";import{TreeSelectContent}from"./content";import{TreeSelectContext}from"../context";import{Tag}from"antd";import{DownOutlined}from"@ant-design/icons";var CustomModal=Modal.CustomModal;var Text=Typography.Text;export var TreeSelectContainer=function(props){var _props_mode=props.mode,mode=_props_mode===void 0?"modal":_props_mode,_props_value=props.value,value=_props_value===void 0?[]:_props_value,onChange=props.onChange,className=props.className,style=props.style,_props_placeholder=props.placeholder,placeholder=_props_placeholder===void 0?"请选择":_props_placeholder,_props_maxDisplayCount=props.maxDisplayCount,maxDisplayCount=_props_maxDisplayCount===void 0?3:_props_maxDisplayCount,modalProps=props.modalProps,restProps=_object_without_properties(props,["mode","value","onChange","className","style","placeholder","maxDisplayCount","modalProps"]);var context=useContext(TreeSelectContext);var _useCommonStyles=useCommonStyles("vlian-tree-select",props,useStyle),prefixCls=_useCommonStyles.prefixCls,wrapCSS=_useCommonStyles.wrapCSS,hashId=_useCommonStyles.hashId;var _useState=_sliced_to_array(useState(false),2),modalOpen=_useState[0],setModalOpen=_useState[1];var handleOpenModal=function(){if(mode==="modal"){var _context_setTempSelectedRows,_context_setTempSelectedKeys;var currentSelected=(context===null||context===void 0?void 0:context.selectedRows)||value;context===null||context===void 0?void 0:(_context_setTempSelectedRows=context.setTempSelectedRows)===null||_context_setTempSelectedRows===void 0?void 0:_context_setTempSelectedRows.call(context,currentSelected);context===null||context===void 0?void 0:(_context_setTempSelectedKeys=context.setTempSelectedKeys)===null||_context_setTempSelectedKeys===void 0?void 0:_context_setTempSelectedKeys.call(context,(context===null||context===void 0?void 0:context.selectedKeys)||currentSelected.map(function(row){return row.key}))}setModalOpen(true)};var handleModalOk=function(){if(mode==="modal"){var _context_setSelectedRows;var tempRows=(context===null||context===void 0?void 0:context.tempSelectedRows)||(context===null||context===void 0?void 0:context.selectedRows)||value;context===null||context===void 0?void 0:(_context_setSelectedRows=context.setSelectedRows)===null||_context_setSelectedRows===void 0?void 0:_context_setSelectedRows.call(context,tempRows);onChange===null||onChange===void 0?void 0:onChange(tempRows)}setModalOpen(false)};var handleModalCancel=function(){if(mode==="modal"){var _context_setTempSelectedRows,_context_setTempSelectedKeys;var confirmedRows=(context===null||context===void 0?void 0:context.selectedRows)||value;context===null||context===void 0?void 0:(_context_setTempSelectedRows=context.setTempSelectedRows)===null||_context_setTempSelectedRows===void 0?void 0:_context_setTempSelectedRows.call(context,confirmedRows);context===null||context===void 0?void 0:(_context_setTempSelectedKeys=context.setTempSelectedKeys)===null||_context_setTempSelectedKeys===void 0?void 0:_context_setTempSelectedKeys.call(context,(context===null||context===void 0?void 0:context.selectedKeys)||confirmedRows.map(function(row){return row.key}))}setModalOpen(false)};var renderTrigger=function(){var selectedRows=(context===null||context===void 0?void 0:context.selectedRows)||value;var hasSelected=selectedRows.length>0;var displayTags=selectedRows.slice(0,maxDisplayCount);var remainingCount=selectedRows.length-maxDisplayCount;return React.createElement("div",{className:classNames("".concat(prefixCls,"-trigger"),hashId),onClick:handleOpenModal},React.createElement("div",{className:classNames("".concat(prefixCls,"-trigger-content"),hashId)},!hasSelected?React.createElement("span",{className:classNames("".concat(prefixCls,"-trigger-placeholder"),hashId)},placeholder):React.createElement("div",{className:classNames("".concat(prefixCls,"-trigger-tags"),hashId)},displayTags.map(function(row){return React.createElement(Tag,{key:row.key,className:classNames("".concat(prefixCls,"-trigger-tag"),hashId),closable:false},React.createElement(Text,{className:classNames("".concat(prefixCls,"-trigger-tag-text"),hashId),ellipsis:true},row.label))}),remainingCount>0&&React.createElement(Tag,{className:classNames("".concat(prefixCls,"-trigger-tag"),"".concat(prefixCls,"-trigger-tag-more"),hashId),closable:false},"+",remainingCount))),React.createElement(DownOutlined,{className:classNames("".concat(prefixCls,"-trigger-arrow"),hashId)}))};if(mode==="inline"){return wrapCSS(React.createElement("div",{className:classNames(prefixCls,className,hashId),style:style},React.createElement(TreeSelectContent,props)))}return wrapCSS(React.createElement("div",{className:classNames(prefixCls,className,hashId),style:style},renderTrigger(),React.createElement(CustomModal,_object_spread({open:modalOpen,onCancel:handleModalCancel,onOk:handleModalOk,maskClosable:false,width:900},modalProps),React.createElement(TreeSelectContent,_object_spread({},props,restProps)))))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}import React from"react";import classNames from"classnames";import{RightOutlined,DeleteOutlined,CheckOutlined}from"@ant-design/icons";import{Checkbox,Avatar,Spin}from"antd";import{Button}from"../../Button";import{Typography}from"../../Text";var Text=Typography.Text;export var TreeNodeItem=function(param){var node=param.node,treeSelectProps=param.props,prefixCls=param.prefixCls,hashId=param.hashId,onClick=param.onClick,onSelect=param.onSelect,_param_isSelected=param.isSelected,isSelected=_param_isSelected===void 0?false:_param_isSelected,_param_showExpandIcon=param.showExpandIcon,showExpandIcon=_param_showExpandIcon===void 0?false:_param_showExpandIcon,_param_isExpanded=param.isExpanded,isExpanded=_param_isExpanded===void 0?false:_param_isExpanded,_param_isRootLevel=param.isRootLevel,isRootLevel=_param_isRootLevel===void 0?true:_param_isRootLevel,_param_showCheckbox=param.showCheckbox,showCheckbox=_param_showCheckbox===void 0?true:_param_showCheckbox,_param_showSelectedState=param.showSelectedState,showSelectedState=_param_showSelectedState===void 0?true:_param_showSelectedState,_param_showDeleteIcon=param.showDeleteIcon,showDeleteIcon=_param_showDeleteIcon===void 0?false:_param_showDeleteIcon;var renderTreeNode=treeSelectProps.renderTreeNode,renderSelectTreeNode=treeSelectProps.renderSelectTreeNode,renderExpandIcon=treeSelectProps.renderExpandIcon,_treeSelectProps_showAvatar=treeSelectProps.showAvatar,showAvatar=_treeSelectProps_showAvatar===void 0?true:_treeSelectProps_showAvatar,renderAvatar=treeSelectProps.renderAvatar,renderNodeContent=treeSelectProps.renderNodeContent;var hasChildren=node.children&&node.children.length>0||node.hasChildren;var handleClick=function(e){e.stopPropagation();onClick===null||onClick===void 0?void 0:onClick(node)};var handleSelect=function(e){e.stopPropagation();onSelect===null||onSelect===void 0?void 0:onSelect(node)};var handleCheckboxChange=function(e){e.stopPropagation();onSelect===null||onSelect===void 0?void 0:onSelect(node)};var renderExpand=function(){if(!hasChildren&&!showExpandIcon){return null}if(renderExpandIcon){return renderExpandIcon(isExpanded,node)}return React.createElement("span",{className:classNames("".concat(prefixCls,"-node-expand-icon"),hashId,_define_property({},"".concat(prefixCls,"-node-expand-icon-expanded"),isExpanded))},React.createElement(RightOutlined,null))};var renderAvatarContent=function(){if(!showAvatar)return null;if(renderAvatar){return renderAvatar(node)}var avatarSrc=node.avatar;var labelText=node.label||"";var firstChar=labelText.charAt(0);var displayText=firstChar?firstChar.match(/[a-zA-Z]/)?firstChar.toUpperCase():firstChar:"?";return React.createElement(Avatar,{src:avatarSrc,className:classNames("".concat(prefixCls,"-node-avatar"),hashId)},!avatarSrc&&displayText)};var renderContent=function(){if(renderNodeContent){return renderNodeContent(node,classNames("".concat(prefixCls,"-node-content"),hashId))}var shouldShowPath=!hasChildren||!isRootLevel;var pathValue=node.path;return React.createElement("div",{className:classNames("".concat(prefixCls,"-node-content"),hashId)},React.createElement("div",{className:classNames("".concat(prefixCls,"-node-label-wrapper"),hashId)},React.createElement(Text,{className:classNames("".concat(prefixCls,"-node-label"),hashId),ellipsis:true},node.label)),shouldShowPath&&pathValue&&React.createElement("div",{className:classNames("".concat(prefixCls,"-node-description-wrapper"),hashId)},React.createElement(Text,{className:classNames("".concat(prefixCls,"-node-description"),hashId),ellipsis:true,type:"secondary"},pathValue)))};if(renderTreeNode){return React.createElement(React.Fragment,null,renderTreeNode(node))}if(renderSelectTreeNode){return React.createElement(React.Fragment,null,renderSelectTreeNode(node))}var _obj;return React.createElement("div",{className:classNames("".concat(prefixCls,"-node"),hashId,(_obj={},_define_property(_obj,"".concat(prefixCls,"-node-selected"),showSelectedState&&isSelected),_define_property(_obj,"".concat(prefixCls,"-node-has-children"),hasChildren),_obj)),onClick:handleClick},React.createElement("div",{className:classNames("".concat(prefixCls,"-node-inner"),hashId)},hasChildren&&onSelect&&showCheckbox&&React.createElement("span",{className:classNames("".concat(prefixCls,"-node-checkbox-wrapper"),hashId),onClick:function(e){return e.stopPropagation()}},React.createElement(Checkbox,{checked:isSelected,onChange:handleCheckboxChange,className:classNames("".concat(prefixCls,"-node-checkbox"),hashId)})),renderAvatarContent(),renderContent(),hasChildren&&showExpandIcon&&renderExpand(),node.isLoading&&React.createElement("span",{className:classNames("".concat(prefixCls,"-node-loading"),hashId)},React.createElement(Spin,{size:"small"})),showDeleteIcon&&onSelect&&React.createElement(Button,{variant:"link",type:"text",className:classNames("".concat(prefixCls,"-node-delete"),hashId),icon:React.createElement(DeleteOutlined,null),onClick:handleSelect}),!hasChildren&&onSelect&&isSelected&&!showDeleteIcon&&React.createElement("div",{className:classNames("".concat(prefixCls,"-node-select"),hashId),onClick:handleSelect},React.createElement(CheckOutlined,null))))};
|
|
1
|
+
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}import React from"react";import classNames from"classnames";import{RightOutlined,DeleteOutlined,CheckOutlined}from"@ant-design/icons";import{Checkbox,Avatar,Spin}from"antd";import{Button}from"../../Button";import{Typography}from"../../Text";var Text=Typography.Text;export var TreeNodeItem=function(param){var node=param.node,treeSelectProps=param.props,prefixCls=param.prefixCls,hashId=param.hashId,onClick=param.onClick,onSelect=param.onSelect,_param_isSelected=param.isSelected,isSelected=_param_isSelected===void 0?false:_param_isSelected,_param_showExpandIcon=param.showExpandIcon,showExpandIcon=_param_showExpandIcon===void 0?false:_param_showExpandIcon,_param_isExpanded=param.isExpanded,isExpanded=_param_isExpanded===void 0?false:_param_isExpanded,_param_isRootLevel=param.isRootLevel,isRootLevel=_param_isRootLevel===void 0?true:_param_isRootLevel,_param_showCheckbox=param.showCheckbox,showCheckbox=_param_showCheckbox===void 0?true:_param_showCheckbox,_param_showSelectedState=param.showSelectedState,showSelectedState=_param_showSelectedState===void 0?true:_param_showSelectedState,_param_showDeleteIcon=param.showDeleteIcon,showDeleteIcon=_param_showDeleteIcon===void 0?false:_param_showDeleteIcon;var _treeSelectProps_isCheckboxDisabled;var renderTreeNode=treeSelectProps.renderTreeNode,renderSelectTreeNode=treeSelectProps.renderSelectTreeNode,renderExpandIcon=treeSelectProps.renderExpandIcon,_treeSelectProps_showAvatar=treeSelectProps.showAvatar,showAvatar=_treeSelectProps_showAvatar===void 0?true:_treeSelectProps_showAvatar,renderAvatar=treeSelectProps.renderAvatar,renderNodeContent=treeSelectProps.renderNodeContent;var hasChildren=node.children&&node.children.length>0||node.hasChildren;var handleClick=function(e){e.stopPropagation();onClick===null||onClick===void 0?void 0:onClick(node)};var handleSelect=function(e){e.stopPropagation();onSelect===null||onSelect===void 0?void 0:onSelect(node)};var handleCheckboxChange=function(e){e.stopPropagation();if(isCheckboxDisabled)return;onSelect===null||onSelect===void 0?void 0:onSelect(node)};var renderExpand=function(){if(!hasChildren&&!showExpandIcon){return null}if(renderExpandIcon){return renderExpandIcon(isExpanded,node)}return React.createElement("span",{className:classNames("".concat(prefixCls,"-node-expand-icon"),hashId,_define_property({},"".concat(prefixCls,"-node-expand-icon-expanded"),isExpanded))},React.createElement(RightOutlined,null))};var renderAvatarContent=function(){if(!showAvatar)return null;if(renderAvatar){return renderAvatar(node)}var avatarSrc=node.avatar;var labelText=node.label||"";var firstChar=labelText.charAt(0);var displayText=firstChar?firstChar.match(/[a-zA-Z]/)?firstChar.toUpperCase():firstChar:"?";return React.createElement(Avatar,{src:avatarSrc,className:classNames("".concat(prefixCls,"-node-avatar"),hashId)},!avatarSrc&&displayText)};var renderContent=function(){if(renderNodeContent){return renderNodeContent(node,classNames("".concat(prefixCls,"-node-content"),hashId))}var shouldShowPath=!hasChildren||!isRootLevel;var pathValue=node.path;return React.createElement("div",{className:classNames("".concat(prefixCls,"-node-content"),hashId)},React.createElement("div",{className:classNames("".concat(prefixCls,"-node-label-wrapper"),hashId)},React.createElement(Text,{className:classNames("".concat(prefixCls,"-node-label"),hashId),ellipsis:true},node.label)),shouldShowPath&&pathValue&&React.createElement("div",{className:classNames("".concat(prefixCls,"-node-description-wrapper"),hashId)},React.createElement(Text,{className:classNames("".concat(prefixCls,"-node-description"),hashId),ellipsis:true,type:"secondary"},pathValue)))};if(renderTreeNode){return React.createElement(React.Fragment,null,renderTreeNode(node))}if(renderSelectTreeNode){return React.createElement(React.Fragment,null,renderSelectTreeNode(node))}var _treeSelectProps_isCheckboxDisabled1;var isCheckboxDisabled=(_treeSelectProps_isCheckboxDisabled1=(_treeSelectProps_isCheckboxDisabled=treeSelectProps.isCheckboxDisabled)===null||_treeSelectProps_isCheckboxDisabled===void 0?void 0:_treeSelectProps_isCheckboxDisabled.call(treeSelectProps,node))!==null&&_treeSelectProps_isCheckboxDisabled1!==void 0?_treeSelectProps_isCheckboxDisabled1:false;var _obj;return React.createElement("div",{className:classNames("".concat(prefixCls,"-node"),hashId,(_obj={},_define_property(_obj,"".concat(prefixCls,"-node-selected"),showSelectedState&&isSelected),_define_property(_obj,"".concat(prefixCls,"-node-has-children"),hasChildren),_obj)),onClick:handleClick},React.createElement("div",{className:classNames("".concat(prefixCls,"-node-inner"),hashId)},hasChildren&&onSelect&&showCheckbox&&React.createElement("span",{className:classNames("".concat(prefixCls,"-node-checkbox-wrapper"),hashId),onClick:function(e){return e.stopPropagation()}},React.createElement(Checkbox,{checked:isSelected,onChange:handleCheckboxChange,className:classNames("".concat(prefixCls,"-node-checkbox"),hashId),disabled:isCheckboxDisabled})),renderAvatarContent(),renderContent(),hasChildren&&showExpandIcon&&renderExpand(),node.isLoading&&React.createElement("span",{className:classNames("".concat(prefixCls,"-node-loading"),hashId)},React.createElement(Spin,{size:"small"})),showDeleteIcon&&onSelect&&React.createElement(Button,{variant:"link",type:"text",className:classNames("".concat(prefixCls,"-node-delete"),hashId),icon:React.createElement(DeleteOutlined,null),onClick:handleSelect}),!hasChildren&&onSelect&&isSelected&&!showDeleteIcon&&React.createElement("div",{className:classNames("".concat(prefixCls,"-node-select"),hashId),onClick:handleSelect},React.createElement(CheckOutlined,null))))};
|