villianjs-pro 1.0.55 → 1.0.56
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.
package/dist/ProTable/types.d.ts
CHANGED
|
@@ -94,6 +94,9 @@ export type GridCardRender<T = any> = (params: GridCardRenderParams<T>) => React
|
|
|
94
94
|
* 提取 FormSchema 的 submitter 类型
|
|
95
95
|
*/
|
|
96
96
|
type FormSchemaSubmitter<T, ValueType extends string = 'text'> = FormSchema<T, ValueType>['submitter'];
|
|
97
|
+
export type ProTableColumn<T = Record<string, any>, ValueType extends string = 'text'> = ProColumns<T, ValueType> & {
|
|
98
|
+
valueMode?: 'string' | 'select';
|
|
99
|
+
};
|
|
97
100
|
/**
|
|
98
101
|
* ProTableSearch 组件属性
|
|
99
102
|
* 继承 FormSchema 的所有属性,并扩展自定义属性
|
|
@@ -108,7 +111,7 @@ export type ProTableSearchProps<T = Record<string, any>, ValueType extends strin
|
|
|
108
111
|
* @description 表单列配置(支持 ProColumns 和 ProFormColumnsType)
|
|
109
112
|
* @default []
|
|
110
113
|
*/
|
|
111
|
-
columns?:
|
|
114
|
+
columns?: ProTableColumn<T, ValueType>[];
|
|
112
115
|
/**
|
|
113
116
|
* @description 标签宽度
|
|
114
117
|
* @default auto
|
|
@@ -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,_props_size=props.size,size=_props_size===void 0?"middle":_props_size,restProps=_object_without_properties(props,["mode","value","onChange","className","style","placeholder","maxDisplayCount","modalProps","size"]);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)}))};var sizeClass=size==="small"?"".concat(prefixCls,"-small"):size==="large"?"".concat(prefixCls,"-large"):"";if(mode==="inline"){return wrapCSS(React.createElement("div",{className:classNames(prefixCls,sizeClass,className,hashId),style:style},React.createElement(TreeSelectContent,props)))}return wrapCSS(React.createElement("div",{className:classNames(prefixCls,sizeClass,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
|
+
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,_props_size=props.size,size=_props_size===void 0?"middle":_props_size,restProps=_object_without_properties(props,["mode","value","onChange","className","style","placeholder","maxDisplayCount","modalProps","size"]);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)}))};var sizeClass=size==="small"?"".concat(prefixCls,"-small"):size==="large"?"".concat(prefixCls,"-large"):"";if(mode==="inline"){return wrapCSS(React.createElement("div",{className:classNames(prefixCls,sizeClass,className,hashId),style:style},React.createElement(TreeSelectContent,props)))}return wrapCSS(React.createElement("div",{className:classNames(prefixCls,sizeClass,className,hashId),style:style},renderTrigger(),React.createElement(CustomModal,_object_spread({open:modalOpen,onCancel:handleModalCancel,onOk:handleModalOk,maskClosable:false,destroyOnHidden:true,width:900},modalProps),React.createElement(TreeSelectContent,_object_spread({},props,restProps)))))};
|