villianjs-pro 1.0.0
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/README.md +69 -0
- package/dist/Button/Button.d.ts +4 -0
- package/dist/Button/Button.js +1 -0
- package/dist/Button/index.d.ts +3 -0
- package/dist/Button/index.js +1 -0
- package/dist/Button/styles.d.ts +6 -0
- package/dist/Button/styles.js +1 -0
- package/dist/Button/types.d.ts +5 -0
- package/dist/Button/types.js +1 -0
- package/dist/ButtonGroup/ButtonGroup.d.ts +45 -0
- package/dist/ButtonGroup/ButtonGroup.js +1 -0
- package/dist/ButtonGroup/index.d.ts +4 -0
- package/dist/ButtonGroup/index.js +1 -0
- package/dist/ButtonGroup/styles.d.ts +6 -0
- package/dist/ButtonGroup/styles.js +1 -0
- package/dist/ButtonGroup/types.d.ts +2 -0
- package/dist/ButtonGroup/types.js +1 -0
- package/dist/Card/card.d.ts +4 -0
- package/dist/Card/card.js +1 -0
- package/dist/Card/index.d.ts +2 -0
- package/dist/Card/index.js +1 -0
- package/dist/Card/types.d.ts +11 -0
- package/dist/Card/types.js +1 -0
- package/dist/CheckCard/CheckCard.d.ts +3 -0
- package/dist/CheckCard/CheckCard.js +1 -0
- package/dist/CheckCard/index.d.ts +2 -0
- package/dist/CheckCard/index.js +1 -0
- package/dist/CheckCard/types.d.ts +12 -0
- package/dist/CheckCard/types.js +1 -0
- package/dist/ConfirmButton/ConfirmButton.d.ts +4 -0
- package/dist/ConfirmButton/ConfirmButton.js +1 -0
- package/dist/ConfirmButton/index.d.ts +4 -0
- package/dist/ConfirmButton/index.js +1 -0
- package/dist/ConfirmButton/types.d.ts +55 -0
- package/dist/ConfirmButton/types.js +1 -0
- package/dist/Form/Form.d.ts +3 -0
- package/dist/Form/Form.js +1 -0
- package/dist/Form/index.d.ts +2 -0
- package/dist/Form/index.js +1 -0
- package/dist/Form/types.d.ts +8 -0
- package/dist/Form/types.js +1 -0
- package/dist/Modal/Modal.d.ts +10 -0
- package/dist/Modal/Modal.js +1 -0
- package/dist/Modal/components/antd/index.d.ts +31 -0
- package/dist/Modal/components/antd/index.js +1 -0
- package/dist/Modal/index.d.ts +2 -0
- package/dist/Modal/index.js +1 -0
- package/dist/Modal/styles.d.ts +1 -0
- package/dist/Modal/styles.js +1 -0
- package/dist/Modal/types.d.ts +28 -0
- package/dist/Modal/types.js +1 -0
- package/dist/ProTable/context.d.ts +59 -0
- package/dist/ProTable/context.js +1 -0
- package/dist/ProTable/form-footer.d.ts +26 -0
- package/dist/ProTable/form-footer.js +1 -0
- package/dist/ProTable/index.d.ts +2 -0
- package/dist/ProTable/index.js +1 -0
- package/dist/ProTable/list.d.ts +5 -0
- package/dist/ProTable/list.js +1 -0
- package/dist/ProTable/styles.d.ts +7 -0
- package/dist/ProTable/styles.js +1 -0
- package/dist/ProTable/table.d.ts +3 -0
- package/dist/ProTable/table.js +1 -0
- package/dist/ProTable/types.d.ts +121 -0
- package/dist/ProTable/types.js +1 -0
- package/dist/ProTable/update/index.d.ts +1 -0
- package/dist/ProTable/update/index.js +1 -0
- package/dist/ProTable/update/update.d.ts +3 -0
- package/dist/ProTable/update/update.js +1 -0
- package/dist/ProTable2/components/search.d.ts +2 -0
- package/dist/ProTable2/components/search.js +1 -0
- package/dist/ProTable2/index.d.ts +2 -0
- package/dist/ProTable2/index.js +1 -0
- package/dist/ProTable2/styles.d.ts +7 -0
- package/dist/ProTable2/styles.js +1 -0
- package/dist/ProTable2/table.d.ts +2 -0
- package/dist/ProTable2/table.js +1 -0
- package/dist/ProTable2/types.d.ts +23 -0
- package/dist/ProTable2/types.js +1 -0
- package/dist/ProTable3/components/index.d.ts +2 -0
- package/dist/ProTable3/components/index.js +1 -0
- package/dist/ProTable3/components/list/index.d.ts +19 -0
- package/dist/ProTable3/components/list/index.js +1 -0
- package/dist/ProTable3/components/search/index.d.ts +2 -0
- package/dist/ProTable3/components/search/index.js +1 -0
- package/dist/ProTable3/container.d.ts +3 -0
- package/dist/ProTable3/container.js +1 -0
- package/dist/ProTable3/context.d.ts +13 -0
- package/dist/ProTable3/context.js +1 -0
- package/dist/ProTable3/hooks/types.d.ts +72 -0
- package/dist/ProTable3/hooks/types.js +1 -0
- package/dist/ProTable3/hooks/useBatchRemoveButton.d.ts +38 -0
- package/dist/ProTable3/hooks/useBatchRemoveButton.js +1 -0
- package/dist/ProTable3/hooks/useCreateButton.d.ts +34 -0
- package/dist/ProTable3/hooks/useCreateButton.js +1 -0
- package/dist/ProTable3/hooks/useExtraButtons.d.ts +26 -0
- package/dist/ProTable3/hooks/useExtraButtons.js +1 -0
- package/dist/ProTable3/hooks/useOptionRender.d.ts +30 -0
- package/dist/ProTable3/hooks/useOptionRender.js +1 -0
- package/dist/ProTable3/hooks/usePagination.d.ts +3 -0
- package/dist/ProTable3/hooks/usePagination.js +1 -0
- package/dist/ProTable3/hooks/utils.d.ts +12 -0
- package/dist/ProTable3/hooks/utils.js +1 -0
- package/dist/ProTable3/index.d.ts +2 -0
- package/dist/ProTable3/index.js +1 -0
- package/dist/ProTable3/styles.d.ts +7 -0
- package/dist/ProTable3/styles.js +1 -0
- package/dist/ProTable3/table.d.ts +2 -0
- package/dist/ProTable3/table.js +1 -0
- package/dist/ProTable3/types.d.ts +106 -0
- package/dist/ProTable3/types.js +1 -0
- package/dist/Switch/index.d.ts +2 -0
- package/dist/Switch/index.js +1 -0
- package/dist/Switch/switch.d.ts +3 -0
- package/dist/Switch/switch.js +1 -0
- package/dist/Switch/types.d.ts +40 -0
- package/dist/Switch/types.js +1 -0
- package/dist/Text/components/Basic.d.ts +4 -0
- package/dist/Text/components/Basic.js +1 -0
- package/dist/Text/components/Link.d.ts +5 -0
- package/dist/Text/components/Link.js +1 -0
- package/dist/Text/components/Paragraph.d.ts +5 -0
- package/dist/Text/components/Paragraph.js +1 -0
- package/dist/Text/components/Text.d.ts +5 -0
- package/dist/Text/components/Text.js +1 -0
- package/dist/Text/components/Title.d.ts +5 -0
- package/dist/Text/components/Title.js +1 -0
- package/dist/Text/components/common.d.ts +9 -0
- package/dist/Text/components/common.js +1 -0
- package/dist/Text/components/index.d.ts +4 -0
- package/dist/Text/components/index.js +1 -0
- package/dist/Text/index.d.ts +10 -0
- package/dist/Text/index.js +1 -0
- package/dist/forwardRef.d.js +1 -0
- package/dist/hooks/commonStyles.d.ts +6 -0
- package/dist/hooks/commonStyles.js +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useFormatPlaceholder.d.ts +3 -0
- package/dist/hooks/useFormatPlaceholder.js +1 -0
- package/dist/images/images.d.ts +3 -0
- package/dist/images/images.js +1 -0
- package/dist/images/index.d.ts +2 -0
- package/dist/images/index.js +1 -0
- package/dist/images/types.d.ts +20 -0
- package/dist/images/types.js +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +1 -0
- package/dist/library/db.d.ts +2 -0
- package/dist/library/db.js +1 -0
- package/dist/library/file.d.ts +4 -0
- package/dist/library/file.js +1 -0
- package/dist/library/form.d.ts +3 -0
- package/dist/library/form.js +1 -0
- package/dist/library/index.d.ts +11 -0
- package/dist/library/index.js +1 -0
- package/dist/library/is.d.ts +1 -0
- package/dist/library/is.js +1 -0
- package/dist/library/string.d.ts +1 -0
- package/dist/library/string.js +1 -0
- package/dist/locale/index.d.ts +10 -0
- package/dist/locale/index.js +1 -0
- package/dist/locale/langs/en-us/index.d.ts +2 -0
- package/dist/locale/langs/en-us/index.js +1 -0
- package/dist/locale/langs/zh-cn/index.d.ts +2 -0
- package/dist/locale/langs/zh-cn/index.js +1 -0
- package/dist/locale/locale.d.ts +2 -0
- package/dist/locale/locale.js +1 -0
- package/package.json +68 -0
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## Expanding the ESLint configuration
|
|
11
|
+
|
|
12
|
+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
export default tseslint.config([
|
|
16
|
+
globalIgnores(['dist']),
|
|
17
|
+
{
|
|
18
|
+
files: ['**/*.{ts,tsx}'],
|
|
19
|
+
extends: [
|
|
20
|
+
// Other configs...
|
|
21
|
+
|
|
22
|
+
// Remove tseslint.configs.recommended and replace with this
|
|
23
|
+
...tseslint.configs.recommendedTypeChecked,
|
|
24
|
+
// Alternatively, use this for stricter rules
|
|
25
|
+
...tseslint.configs.strictTypeChecked,
|
|
26
|
+
// Optionally, add this for stylistic rules
|
|
27
|
+
...tseslint.configs.stylisticTypeChecked,
|
|
28
|
+
|
|
29
|
+
// Other configs...
|
|
30
|
+
],
|
|
31
|
+
languageOptions: {
|
|
32
|
+
parserOptions: {
|
|
33
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
34
|
+
tsconfigRootDir: import.meta.dirname,
|
|
35
|
+
},
|
|
36
|
+
// other options...
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
])
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
// eslint.config.js
|
|
46
|
+
import reactX from 'eslint-plugin-react-x'
|
|
47
|
+
import reactDom from 'eslint-plugin-react-dom'
|
|
48
|
+
|
|
49
|
+
export default tseslint.config([
|
|
50
|
+
globalIgnores(['dist']),
|
|
51
|
+
{
|
|
52
|
+
files: ['**/*.{ts,tsx}'],
|
|
53
|
+
extends: [
|
|
54
|
+
// Other configs...
|
|
55
|
+
// Enable lint rules for React
|
|
56
|
+
reactX.configs['recommended-typescript'],
|
|
57
|
+
// Enable lint rules for React DOM
|
|
58
|
+
reactDom.configs.recommended,
|
|
59
|
+
],
|
|
60
|
+
languageOptions: {
|
|
61
|
+
parserOptions: {
|
|
62
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
63
|
+
tsconfigRootDir: import.meta.dirname,
|
|
64
|
+
},
|
|
65
|
+
// other options...
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
])
|
|
69
|
+
```
|
|
@@ -0,0 +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 asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}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)}function _ts_generator(thisArg,body){var f,y,t,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},g=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return g.next=verb(0),g["throw"]=verb(1),g["return"]=verb(2),typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(g&&(g=0,op[0]&&(_=0)),_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}}import React,{useState}from"react";import{Button as AntdButton}from"antd";import{useComponentConfig}from"antd/es/config-provider/context";import useStyle from"./styles";import classNames from"classnames";var Button=function(_param){var children=_param.children,_param_enableLoading=_param.enableLoading,enableLoading=_param_enableLoading===void 0?true:_param_enableLoading,loading=_param.loading,className=_param.className,style=_param.style,onClick=_param.onClick,restProps=_object_without_properties(_param,["children","enableLoading","loading","className","style","onClick"]);var _useState=_sliced_to_array(useState(false),2),innerLoading=_useState[0],setInnerLoading=_useState[1];var getPrefixCls=useComponentConfig("vlian-button").getPrefixCls;var prefixCls=getPrefixCls("vlian-button");var _useStyle=_sliced_to_array(useStyle(prefixCls),3),wrapCSSVar=_useStyle[0],hashId=_useStyle[1],cssVarCls=_useStyle[2];var currentLoading=React.useMemo(function(){if(!enableLoading){return loading}return loading||innerLoading},[loading,enableLoading,innerLoading]);var handleClick=React.useCallback(function(e){return _async_to_generator(function(){var result,e1;return _ts_generator(this,function(_state){switch(_state.label){case 0:if(!onClick){return[2]}_state.label=1;case 1:_state.trys.push([1,3,,4]);if(enableLoading){setInnerLoading(true)}return[4,onClick(e)];case 2:result=_state.sent();setInnerLoading(false);return[2,result];case 3:e1=_state.sent();setInnerLoading(false);return[2,false];case 4:return[2]}})})()},[enableLoading]);return wrapCSSVar(React.createElement(React.Fragment,null,React.createElement(AntdButton,_object_spread({loading:currentLoading,className:classNames(prefixCls,className,cssVarCls,hashId),style:style,onClick:handleClick},restProps),children)))};export default Button;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as Button}from"./Button.tsx";export*from"./Button.tsx";export*from"./types.ts";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FullToken, GenerateStyle, GetDefaultToken } from 'antd/es/theme/internal';
|
|
2
|
+
type ButtonToken = FullToken<'VlianButton'> & {};
|
|
3
|
+
export declare const genBaseStyle: GenerateStyle<ButtonToken>;
|
|
4
|
+
export declare const prepareComponentToken: GetDefaultToken<'VlianButton'>;
|
|
5
|
+
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +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{genStyleHooks}from"antd/es/theme/internal";export var genBaseStyle=function(token){var componentCls=token.componentCls;return _define_property({},componentCls,{})};export var prepareComponentToken=function(){return{}};export default genStyleHooks("VlianButton",function(token){return[genBaseStyle(token)]},prepareComponentToken);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ButtonProps } from 'antd';
|
|
3
|
+
export interface ButtonGroupItem {
|
|
4
|
+
key: string;
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
onClick?: () => any;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
type?: ButtonProps["type"];
|
|
11
|
+
variant?: ButtonProps["variant"];
|
|
12
|
+
size?: ButtonProps['size'];
|
|
13
|
+
color?: ButtonProps['color'];
|
|
14
|
+
order?: number;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
className?: string;
|
|
17
|
+
isCustom?: boolean;
|
|
18
|
+
component?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export interface ButtonGroupProps {
|
|
21
|
+
/**
|
|
22
|
+
* @description 按钮项列表
|
|
23
|
+
* @default []
|
|
24
|
+
*/
|
|
25
|
+
items: ButtonGroupItem[];
|
|
26
|
+
/**
|
|
27
|
+
* @description 显示按钮个数,超过这个个数的按钮将被放入下拉菜单中
|
|
28
|
+
* @default 3
|
|
29
|
+
*/
|
|
30
|
+
maxCount?: number;
|
|
31
|
+
/**
|
|
32
|
+
* @description 自定义类名
|
|
33
|
+
*/
|
|
34
|
+
className?: string;
|
|
35
|
+
/**
|
|
36
|
+
* @description 自定义样式
|
|
37
|
+
*/
|
|
38
|
+
style?: React.CSSProperties;
|
|
39
|
+
/**
|
|
40
|
+
* @description 自定义样式
|
|
41
|
+
*/
|
|
42
|
+
moreProps?: ButtonProps;
|
|
43
|
+
}
|
|
44
|
+
export declare const ButtonGroup: React.FC<ButtonGroupProps>;
|
|
45
|
+
export default ButtonGroup;
|
|
@@ -0,0 +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 _array_without_holes(arr){if(Array.isArray(arr))return _array_like_to_array(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(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}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 _non_iterable_spread(){throw new TypeError("Invalid attempt to spread 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 _to_consumable_array(arr){return _array_without_holes(arr)||_iterable_to_array(arr)||_unsupported_iterable_to_array(arr)||_non_iterable_spread()}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 from"react";import{Dropdown}from"antd";import{Button}from"../Button";import{MoreOutlined}from"@ant-design/icons";import classNames from"classnames";import useStyle from"./styles.ts";import{useComponentConfig}from"antd/es/config-provider/context";export var ButtonGroup=function(param){var _param_items=param.items,items=_param_items===void 0?[]:_param_items,_param_maxCount=param.maxCount,maxCount=_param_maxCount===void 0?3:_param_maxCount,className=param.className,style=param.style,moreProps=param.moreProps;var getPrefixCls=useComponentConfig("button-group").getPrefixCls;var prefixCls=getPrefixCls("vlian-button-group");var _useStyle=_sliced_to_array(useStyle(prefixCls),3),wrapCSSVar=_useStyle[0],hashId=_useStyle[1],cssVarCls=_useStyle[2];var sortedItems=React.useMemo(function(){return _to_consumable_array(items).sort(function(a,b){var _a_order,_b_order;return((_a_order=a.order)!==null&&_a_order!==void 0?_a_order:99)-((_b_order=b.order)!==null&&_b_order!==void 0?_b_order:99)})},[items]);var visibleItems=sortedItems.slice(0,maxCount);var dropdownItems=sortedItems.slice(maxCount);var dropdownMenu=dropdownItems.map(function(item){return{key:item.key,label:item.label,onClick:item.onClick,disabled:item.disabled,icon:item.icon}});return wrapCSSVar(React.createElement("div",{className:classNames(prefixCls,className,cssVarCls,hashId),style:style},visibleItems.map(function(config){var isCustom=config.isCustom,component=config.component,item=_object_without_properties(config,["isCustom","component"]);if(!isCustom){var _item_type;return React.createElement(Button,{key:item.key,onClick:item.onClick,disabled:item.disabled,loading:item.loading,icon:item.icon,type:(_item_type=item.type)!==null&&_item_type!==void 0?_item_type:"default",variant:item.variant,size:item.size,color:item.color,style:item.style,className:item.className},item.label)}return component||null}),dropdownItems.length>0&&React.createElement(Dropdown,{menu:{items:dropdownMenu},trigger:["click"]},React.createElement(Button,_object_spread({icon:React.createElement(MoreOutlined,null)},moreProps)))))};export default ButtonGroup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ButtonGroup}from"./ButtonGroup.tsx";export{ButtonGroup};export default ButtonGroup;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FullToken, GenerateStyle, GetDefaultToken } from 'antd/es/theme/internal';
|
|
2
|
+
type ButtonGroupToken = FullToken<'ButtonGroup'> & {};
|
|
3
|
+
export declare const genBaseStyle: GenerateStyle<ButtonGroupToken>;
|
|
4
|
+
export declare const prepareComponentToken: GetDefaultToken<'ButtonGroup'>;
|
|
5
|
+
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +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{genStyleHooks}from"antd/es/theme/internal";export var genBaseStyle=function(token){var componentCls=token.componentCls;return _define_property({},componentCls,{display:"flex",gap:token.paddingXS,alignItems:"center",".ant-btn":{display:"flex",alignItems:"center"},".ant-dropdown-trigger":{display:"flex",alignItems:"center"}})};export var prepareComponentToken=function(){return{}};export default genStyleHooks("ButtonGroup",function(token){return[genBaseStyle(token)]},prepareComponentToken);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +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*as React from"react";import classnames from"classnames";import{theme,Flex}from"antd";import{useStyleRegister}from"@ant-design/cssinjs";import classNames from"classnames";export var Card=function(param){var title=param.title,extra=param.extra,fixedHeader=param.fixedHeader,children=param.children,_param_headerHeight=param.headerHeight,headerHeight=_param_headerHeight===void 0?48:_param_headerHeight,bodyStyle=param.bodyStyle,_param_border=param.border,border=_param_border===void 0?true:_param_border,style=param.style,className=param.className;var _theme_useToken=theme.useToken(),token=_theme_useToken.token,GlobalToken=_theme_useToken.theme,hashId=_theme_useToken.hashId;var cls="vlian-card";var prefixCls=".".concat(cls);var wrapSSR=useStyleRegister({theme:GlobalToken,token:token,path:["VaCard"],hashId:hashId},function(){var _obj,_obj1,_obj2;return _obj2={},_define_property(_obj2,prefixCls,(_obj1={margin:0,padding:0,color:token.colorText,fontSize:token.fontSize,lineHeight:token.lineHeight,listStyle:"none",position:"relative",backgroundColor:token.colorBgContainer,borderRadius:token.borderRadius,boxSizing:"border-box"},_define_property(_obj1,"".concat(prefixCls,"_header"),_define_property({minHeight:"".concat(headerHeight,"px"),padding:"0 ".concat(token.paddingSM,"px"),display:"flex",flexDirection:"column",flexShrink:0,justifyContent:"center",color:token.colorTextHeading,fontSize:token.fontSize,fontWeight:token.fontWeightStrong,borderBottom:"".concat(token.lineWidth,"px ").concat(token.lineType," ").concat(token.colorBorderSecondary)},"".concat(prefixCls,"_head-wrapper"),(_obj={width:"100%",display:"flex",alignItems:"center"},_define_property(_obj,"".concat(prefixCls,"_head-title"),{flex:1,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",display:"inline-block"}),_define_property(_obj,"".concat(prefixCls,"_head-extra"),{marginInlineStart:"auto",color:token.colorTextHeading,flexShrink:0}),_obj))),_define_property(_obj1,"".concat(prefixCls,"_content"),{padding:token.paddingSM}),_define_property(_obj1,"".concat(prefixCls,"_content.vafixed"),{height:0,flexGrow:1,overflowY:"hidden"}),_obj1)),_define_property(_obj2,"".concat(prefixCls,".border"),{border:"".concat(token.lineWidth,"px ").concat(token.lineType," ").concat(token.colorBorderSecondary)}),_obj2});return wrapSSR(React.createElement(Flex,{className:classnames(hashId,cls,border?"border":"",className),vertical:true,gap:0,style:style},extra||title?React.createElement("div",{className:classNames(hashId,"".concat(cls,"_header"))},React.createElement("div",{className:classNames(hashId,"".concat(cls,"_head-wrapper"))},title&&React.createElement("div",{className:classNames(hashId,"".concat(cls,"_head-title"))},title),extra&&React.createElement("div",{className:classNames(hashId,"".concat(cls,"_head-extra"))},extra))):null,React.createElement("div",{className:classNames(hashId,"".concat(cls,"_content"),fixedHeader?"vafixed":""),style:bodyStyle},fixedHeader?React.createElement("div",{style:{height:"100%",overflow:"auto"}},children):children)))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./types";export*from"./card";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type CardProps = {
|
|
3
|
+
title?: React.ReactNode;
|
|
4
|
+
extra?: React.ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
fixedHeader?: boolean;
|
|
8
|
+
headerHeight?: number;
|
|
9
|
+
bodyStyle?: React.CSSProperties;
|
|
10
|
+
border?: boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +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}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 ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(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}import{CheckCard as AntdCheckCard}from"@ant-design/pro-components";import*as React from"react";import{Flex}from"antd";export var CheckCard=function(_param){var options=_param.options,gap=_param.gap,suffix=_param.suffix,_param_itemStyle=_param.itemStyle,itemStyle=_param_itemStyle===void 0?{}:_param_itemStyle,_param_readonly=_param.readonly,readonly=_param_readonly===void 0?false:_param_readonly,props=_object_without_properties(_param,["options","gap","suffix","itemStyle","readonly"]);return React.createElement(AntdCheckCard.Group,props,React.createElement(Flex,{justify:"start",align:"center",wrap:true,gap:gap!==null&&gap!==void 0?gap:"middle"},(options||[]).map(function(option,index){var _option_style=option.style,style=_option_style===void 0?{}:_option_style,other=_object_without_properties(option,["style"]);var currentStyle=_object_spread({},itemStyle,style);return React.createElement(AntdCheckCard,_object_spread_props(_object_spread({key:index},other),{style:_object_spread_props(_object_spread({margin:0},currentStyle),{pointerEvents:readonly?"none":undefined})}))}),suffix))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./types";export*from"./CheckCard";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CheckCardGroupProps } from "@ant-design/pro-components";
|
|
2
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
3
|
+
import type { FlexProps } from "antd";
|
|
4
|
+
export type CheckCardProps = CheckCardGroupProps & {
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
suffix?: ReactNode;
|
|
7
|
+
itemStyle?: CSSProperties;
|
|
8
|
+
/**
|
|
9
|
+
* @description 权限
|
|
10
|
+
*/
|
|
11
|
+
gap?: FlexProps['gap'];
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +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 asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}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 ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(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)}function _ts_generator(thisArg,body){var f,y,t,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},g=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return g.next=verb(0),g["throw"]=verb(1),g["return"]=verb(2),typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(g&&(g=0,op[0]&&(_=0)),_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}}import React,{useState}from"react";import{Button,Popconfirm,Modal}from"antd";var ConfirmButton=function(props){var _useState=_sliced_to_array(useState(false),2),open=_useState[0],setOpen=_useState[1];var _useState1=_sliced_to_array(useState(false),2),loading=_useState1[0],setLoading=_useState1[1];var _Modal_useModal=_sliced_to_array(Modal.useModal(),2),modalApi=_Modal_useModal[0],contextHolder=_Modal_useModal[1];var _props_mode=props.mode,mode=_props_mode===void 0?"popconfirm":_props_mode,title=props.title,content=props.content,onConfirm=props.onConfirm,onCancel=props.onCancel,children=props.children,triggerBtnProps=props.triggerBtnProps,modalProps=props.modalProps;var handleConfirm=function(){return _async_to_generator(function(){var res,_tmp,error;return _ts_generator(this,function(_state){switch(_state.label){case 0:setLoading(true);_state.label=1;case 1:_state.trys.push([1,5,,6]);if(!onConfirm)return[3,3];return[4,onConfirm()];case 2:_tmp=_state.sent();return[3,4];case 3:_tmp=true;_state.label=4;case 4:res=_tmp;if(!res){return[2]}setTimeout(function(){setOpen(false);setLoading(false)},100);return[3,6];case 5:error=_state.sent();console.error(error);setLoading(false);return[3,6];case 6:return[2]}})})()};var handleCancel=function(){setOpen(false);onCancel===null||onCancel===void 0?void 0:onCancel()};var currentTriggerBtnProps=React.useMemo(function(){if(!triggerBtnProps)return{};var _=triggerBtnProps.key,restTriggerProps=_object_without_properties(triggerBtnProps,["key"]);void _;return restTriggerProps},[triggerBtnProps]);var handleTriggerBtnClick=function(){if(mode==="modal"){modalApi.confirm(_object_spread_props(_object_spread({title:title,content:content},modalProps),{onOk:function onOk(){return new Promise(function(resolve,reject){onConfirm===null||onConfirm===void 0?void 0:onConfirm().then(function(res){if(res){resolve(true)}else{reject()}})}).catch(function(){return console.log("Oops errors!")})},onCancel:handleCancel}));return}setOpen(true)};return React.createElement(React.Fragment,null,contextHolder,React.createElement(Popconfirm,{title:title,description:content,open:mode==="popconfirm"?open:false,okButtonProps:{loading:loading},onCancel:handleCancel,onConfirm:handleConfirm},React.createElement(Button,_object_spread_props(_object_spread({},currentTriggerBtnProps),{onClick:handleTriggerBtnClick}),children)))};export default ConfirmButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import ConfirmButton from"./ConfirmButton";export{ConfirmButton};export default ConfirmButton;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ButtonProps, ModalProps } from 'antd';
|
|
2
|
+
export type ConfirmMode = 'popconfirm' | 'modal';
|
|
3
|
+
export interface ConfirmButtonProps {
|
|
4
|
+
/**
|
|
5
|
+
* 确认方式:弹窗或确认框
|
|
6
|
+
* @default 'popconfirm'
|
|
7
|
+
*/
|
|
8
|
+
mode?: ConfirmMode;
|
|
9
|
+
/**
|
|
10
|
+
* 确认标题
|
|
11
|
+
*/
|
|
12
|
+
title?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* 确认提示内容
|
|
15
|
+
*/
|
|
16
|
+
content?: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* 确认按钮文字
|
|
19
|
+
* @default '确定'
|
|
20
|
+
*/
|
|
21
|
+
okText?: string;
|
|
22
|
+
/**
|
|
23
|
+
* 取消按钮文字
|
|
24
|
+
* @default '取消'
|
|
25
|
+
*/
|
|
26
|
+
cancelText?: string;
|
|
27
|
+
/**
|
|
28
|
+
* 确认按钮的props
|
|
29
|
+
*/
|
|
30
|
+
okButtonProps?: ButtonProps;
|
|
31
|
+
/**
|
|
32
|
+
* 取消按钮的props
|
|
33
|
+
*/
|
|
34
|
+
cancelButtonProps?: ButtonProps;
|
|
35
|
+
/**
|
|
36
|
+
* 确认回调
|
|
37
|
+
*/
|
|
38
|
+
onConfirm?: () => Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* 取消回调
|
|
41
|
+
*/
|
|
42
|
+
onCancel?: () => void;
|
|
43
|
+
/**
|
|
44
|
+
* 子节点
|
|
45
|
+
*/
|
|
46
|
+
children?: React.ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* 弹窗配置,只有mode为 modal 生效
|
|
49
|
+
*/
|
|
50
|
+
modalProps?: Omit<ModalProps, "open">;
|
|
51
|
+
/**
|
|
52
|
+
* 触发器按钮的属性
|
|
53
|
+
*/
|
|
54
|
+
triggerBtnProps?: Omit<ButtonProps, "children" | "onClick">;
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +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}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 ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(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}import{BetaSchemaForm}from"@ant-design/pro-components";import{useFormatPlaceholder}from"../hooks";import{useMemo}from"react";var ProForm=function(props){var columns=props.columns,_props_layoutType=props.layoutType,layoutType=_props_layoutType===void 0?"Form":_props_layoutType,_props_layout=props.layout,layout=_props_layout===void 0?"horizontal":_props_layout,rest=_object_without_properties(props,["columns","layoutType","layout"]);var formatPlaceholder=useFormatPlaceholder().formatPlaceholder;var formattedColumns=useMemo(function(){return columns.map(function(_param){var valueMode=_param.valueMode,column=_object_without_properties(_param,["valueMode"]);return _object_spread_props(_object_spread({},column),{fieldProps:_object_spread_props(_object_spread({},column.fieldProps),{placeholder:formatPlaceholder(_object_spread_props(_object_spread({},column),{valueMode:valueMode}))})})})},[columns,formatPlaceholder]);return React.createElement(BetaSchemaForm,_object_spread({layout:layout,columns:formattedColumns,layoutType:layoutType},rest))};export default ProForm;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./types";export{default as ProForm}from"./Form";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ProFormColumnsType as AntdProFormColumnsType } from "@ant-design/pro-components";
|
|
2
|
+
import type { FormSchema } from "@ant-design/pro-form/es/components/SchemaForm/typing";
|
|
3
|
+
export type ProFormColumnsType<T, ValueType extends string = 'text'> = AntdProFormColumnsType<T, ValueType> & {
|
|
4
|
+
valueMode?: 'string' | 'select';
|
|
5
|
+
};
|
|
6
|
+
export type ProFormProps<T, ValueType extends string = 'text'> = Omit<FormSchema<T, ValueType>, 'columns'> & {
|
|
7
|
+
columns: ProFormColumnsType<T, ValueType>[];
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ModalProps } from "./types";
|
|
3
|
+
import AntdCustomModal from "./components/antd";
|
|
4
|
+
declare const Modal: React.FC<ModalProps>;
|
|
5
|
+
type ModalType = typeof Modal & {
|
|
6
|
+
CustomModal: (props: any) => ReturnType<typeof AntdCustomModal>;
|
|
7
|
+
};
|
|
8
|
+
declare const ModalWithStaticMethods: ModalType;
|
|
9
|
+
export { ModalWithStaticMethods as Modal };
|
|
10
|
+
export default ModalWithStaticMethods;
|
|
@@ -0,0 +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}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 ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(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}import*as React from"react";import{Modal as AntdModal}from"antd";import{useStyle}from"./styles";import AntdCustomModal from"./components/antd";var Modal=function(_param){var children=_param.children,_param_maxHeight=_param.maxHeight,maxHeight=_param_maxHeight===void 0?"90vh":_param_maxHeight,minHeight=_param.minHeight,_param_className=_param.className,className=_param_className===void 0?"":_param_className,_param_centered=_param.centered,centered=_param_centered===void 0?true:_param_centered,_param_bodyOverflowY=_param.bodyOverflowY,bodyOverflowY=_param_bodyOverflowY===void 0?"auto":_param_bodyOverflowY,_param_styles=_param.styles,styles=_param_styles===void 0?{}:_param_styles,style=_param.style,_param_top=_param.top,top=_param_top===void 0?"100px":_param_top,props=_object_without_properties(_param,["children","maxHeight","minHeight","className","centered","bodyOverflowY","styles","style","top"]);useStyle();var _styles_body=styles.body,body=_styles_body===void 0?{}:_styles_body,_styles_content=styles.content,content=_styles_content===void 0?{}:_styles_content,_styles_header=styles.header,header=_styles_header===void 0?{}:_styles_header,_styles_footer=styles.footer,footer=_styles_footer===void 0?{}:_styles_footer;return React.createElement(AntdModal,_object_spread_props(_object_spread({centered:centered},props),{className:"scrollable-modal ".concat(className),styles:{body:_object_spread_props(_object_spread({padding:"10px 0",height:minHeight},body),{maxHeight:"calc(".concat(maxHeight," - 110px)"),overflowY:bodyOverflowY}),content:_object_spread_props(_object_spread({},content),{maxHeight:maxHeight,display:"flex",flexDirection:"column"}),header:_object_spread_props(_object_spread({},header),{flexShrink:0}),footer:_object_spread_props(_object_spread({},footer),{flexShrink:0})},style:_object_spread({top:top},style)}),children)};var ModalWithStaticMethods=Modal;ModalWithStaticMethods.CustomModal=AntdCustomModal;export{ModalWithStaticMethods as Modal};export default ModalWithStaticMethods;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Modal as AntModal, type ModalProps as AntModalProps } from 'antd';
|
|
3
|
+
import type { ModalFuncProps } from 'antd/es/modal';
|
|
4
|
+
export interface ModalProps extends Omit<AntModalProps, 'style'> {
|
|
5
|
+
/**
|
|
6
|
+
* 最大高度限制,支持 CSS height 属性值
|
|
7
|
+
* 当设置了 maxHeight 且内容超过最大高度时,Modal 会垂直居中显示
|
|
8
|
+
* 并且只有内容区域可以滚动,header 和 footer 会固定在顶部和底部
|
|
9
|
+
*/
|
|
10
|
+
maxHeight?: string | number;
|
|
11
|
+
/** 自定义样式 */
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Modal 组件
|
|
16
|
+
* 基于 Ant Design Modal 组件封装,支持最大高度限制功能
|
|
17
|
+
* 当设置 maxHeight 时,Modal 会垂直居中显示,并且只有内容区域可以滚动
|
|
18
|
+
* header 和 footer 会固定在顶部和底部
|
|
19
|
+
*/
|
|
20
|
+
declare const Modal: React.FC<ModalProps>;
|
|
21
|
+
type ModalType = typeof Modal & {
|
|
22
|
+
info: (props: ModalFuncProps) => ReturnType<typeof AntModal.info>;
|
|
23
|
+
success: (props: ModalFuncProps) => ReturnType<typeof AntModal.success>;
|
|
24
|
+
error: (props: ModalFuncProps) => ReturnType<typeof AntModal.error>;
|
|
25
|
+
warning: (props: ModalFuncProps) => ReturnType<typeof AntModal.warning>;
|
|
26
|
+
confirm: (props: ModalFuncProps) => ReturnType<typeof AntModal.confirm>;
|
|
27
|
+
destroyAll: () => void;
|
|
28
|
+
};
|
|
29
|
+
declare const ModalWithStaticMethods: ModalType;
|
|
30
|
+
export { ModalWithStaticMethods as Modal };
|
|
31
|
+
export default ModalWithStaticMethods;
|
|
@@ -0,0 +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}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}import*as React from"react";import{useMemo,useRef,useEffect}from"react";import{Modal as AntModal,theme}from"antd";import{useStyleRegister}from"@ant-design/cssinjs";import classNames from"classnames";var useToken=theme.useToken;var Modal=function(_param){var maxHeight=_param.maxHeight,_param_className=_param.className,className=_param_className===void 0?"":_param_className,style=_param.style,centered=_param.centered,props=_object_without_properties(_param,["maxHeight","className","style","centered"]);var modalClassName=useMemo(function(){return"vlian-modal".concat(maxHeight!==undefined?" vlian-modal--max-height":""," ").concat(className).trim()},[className,maxHeight]);var prefixCls="vlian-modal";var _useToken=useToken(),token=_useToken.token,_$theme=_useToken.theme,hashId=_useToken.hashId;var wrapSSR=useStyleRegister({theme:_$theme,token:token,hashId:hashId,path:[prefixCls]},function(){var _obj,_obj1;return _obj1={},_define_property(_obj1,".".concat(prefixCls),{}),_define_property(_obj1,"&& .".concat(prefixCls,"--max-height"),(_obj={},_define_property(_obj,"& .ant-modal-content",{display:"flex",flexDirection:"column",maxHeight:"100%",overflow:"hidden"}),_define_property(_obj,"& .ant-modal-header",{flexShrink:0}),_define_property(_obj,"& .ant-modal-body",{flex:1,overflowY:"scroll",minHeight:0}),_define_property(_obj,"& .ant-modal-footer",{flexShrink:0}),_define_property(_obj,"& > div",{height:"var(--max-height)"}),_obj)),_obj1});var modalRef=useRef(null);useEffect(function(){if(maxHeight!==undefined&&modalRef.current){var _modalRef_current;var modalContent=(_modalRef_current=modalRef.current)===null||_modalRef_current===void 0?void 0:_modalRef_current.querySelector(".ant-modal-content");if(modalContent&&modalContent.parentElement){var heightValue=typeof maxHeight==="number"?"".concat(maxHeight,"px"):maxHeight;modalContent.parentElement.style.height=heightValue;modalContent.parentElement.style.maxHeight=heightValue}}},[maxHeight]);var modalStyle=useMemo(function(){if(maxHeight===undefined)return style;return _object_spread({maxHeight:typeof maxHeight==="number"?"".concat(maxHeight,"px"):maxHeight,paddingBottom:0,display:"flex",top:"calc((100vh - ".concat(typeof maxHeight==="number"?"".concat(maxHeight,"px"):maxHeight,") / 2)"),overflow:"hidden",flexDirection:"column","--max-height":typeof maxHeight==="number"?"".concat(maxHeight,"px"):maxHeight},style)},[maxHeight,style]);return wrapSSR(React.createElement("div",{ref:modalRef},React.createElement(AntModal,_object_spread({className:classNames(modalClassName,hashId,className),style:modalStyle,centered:maxHeight!==undefined?false:centered},props))))};var ModalWithStaticMethods=Modal;ModalWithStaticMethods.info=AntModal.info;ModalWithStaticMethods.success=AntModal.success;ModalWithStaticMethods.error=AntModal.error;ModalWithStaticMethods.warning=AntModal.warning;ModalWithStaticMethods.confirm=AntModal.confirm;ModalWithStaticMethods.destroyAll=AntModal.destroyAll;export{ModalWithStaticMethods as Modal};export default ModalWithStaticMethods;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as Modal}from"./Modal";export*from"./types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyle: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useStyleRegister}from"@ant-design/cssinjs";import{theme}from"antd";export var useStyle=function(){var _theme_useToken=theme.useToken(),hashId=_theme_useToken.hashId,token=_theme_useToken.token,GlobalToken=_theme_useToken.theme;useStyleRegister({theme:GlobalToken,token:token,path:["ScrollableModal"],hashId:hashId},function(){return{".max-height: 90vh":{".ant-modal-content":{maxHeight:"90vh",display:"flex",flexDirection:"column"},".ant-modal-header":{flexShrink:0,borderBottom:"1px solid ".concat(token.colorBorderSecondary)},".ant-modal-body":{flex:1,overflowY:"auto",paddingTop:"20px, 24"},".ant-modal-footer":{flexShrink:0,borderTop:"1px solid ".concat(token.colorBorderSecondary)}}}})};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type ModalProps as AntdModalProps } from "antd";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export interface ModalProps extends Omit<AntdModalProps, "children"> {
|
|
5
|
+
/**
|
|
6
|
+
* @description 子元素
|
|
7
|
+
*/
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* @description 最大高度
|
|
11
|
+
* @default 90vh
|
|
12
|
+
*/
|
|
13
|
+
maxHeight?: string;
|
|
14
|
+
/**
|
|
15
|
+
* @description 最小高度
|
|
16
|
+
*/
|
|
17
|
+
minHeight?: string;
|
|
18
|
+
/**
|
|
19
|
+
* @description body是否滚动
|
|
20
|
+
* @default scroll
|
|
21
|
+
*/
|
|
22
|
+
bodyOverflowY?: "auto" | 'scroll' | 'hidden';
|
|
23
|
+
/**
|
|
24
|
+
* @description 离顶部的偏移量
|
|
25
|
+
* @default ‘100px
|
|
26
|
+
*/
|
|
27
|
+
top?: React.CSSProperties['top'];
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type Dispatch, type SetStateAction } from "react";
|
|
2
|
+
import type { VlianTableMode, OperateType, TablePermissionMap, HasPermissionFn } from "./types";
|
|
3
|
+
import type { ConfirmMode } from "../ConfirmButton";
|
|
4
|
+
import type { SizeType } from "antd/es/config-provider/SizeContext";
|
|
5
|
+
export interface VlianTableContextType {
|
|
6
|
+
size?: SizeType;
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
/**
|
|
9
|
+
* @description 模式
|
|
10
|
+
*/
|
|
11
|
+
mode: VlianTableMode;
|
|
12
|
+
/**
|
|
13
|
+
* @description 是否显示搜索
|
|
14
|
+
*/
|
|
15
|
+
visibleSearch: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @description 设置是否显示搜索
|
|
18
|
+
*/
|
|
19
|
+
setVisibleSearch: Dispatch<SetStateAction<boolean>>;
|
|
20
|
+
/**
|
|
21
|
+
* @description 当前操作
|
|
22
|
+
*/
|
|
23
|
+
operateType: OperateType;
|
|
24
|
+
/**
|
|
25
|
+
* @description 设置当前操作
|
|
26
|
+
*/
|
|
27
|
+
setOperateType: Dispatch<SetStateAction<OperateType>>;
|
|
28
|
+
/**
|
|
29
|
+
* @description 当前记录
|
|
30
|
+
*/
|
|
31
|
+
currentRecord?: any;
|
|
32
|
+
/**
|
|
33
|
+
* @description 设置当前记录
|
|
34
|
+
*/
|
|
35
|
+
setCurrentRecord: Dispatch<SetStateAction<any>>;
|
|
36
|
+
removeMode: ConfirmMode;
|
|
37
|
+
currentIndex: number;
|
|
38
|
+
onViewClick: (record: any, index: number, action: any) => Promise<any>;
|
|
39
|
+
onUpdateClick: (record: any, index: number, action: any) => Promise<any>;
|
|
40
|
+
onRemoveClick: (record: any, index: number, action: any) => Promise<any>;
|
|
41
|
+
handleOpenPopup: () => Promise<any>;
|
|
42
|
+
/**
|
|
43
|
+
* @description 权限
|
|
44
|
+
*/
|
|
45
|
+
permission?: TablePermissionMap;
|
|
46
|
+
/**
|
|
47
|
+
* @description 判断权限
|
|
48
|
+
*/
|
|
49
|
+
hasPermission?: HasPermissionFn;
|
|
50
|
+
/**
|
|
51
|
+
* 设置当前信息
|
|
52
|
+
* @param type
|
|
53
|
+
* @param record
|
|
54
|
+
* @param index
|
|
55
|
+
*/
|
|
56
|
+
setCurrentInfo: (type: OperateType, record: any, index: number) => Promise<void>;
|
|
57
|
+
closePopup: () => Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
export declare const VlianTableContext: import("react").Context<VlianTableContextType | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext}from"react";export var VlianTableContext=createContext(undefined);
|