@ccs-ui/rc-pro 1.1.1-rc8 → 1.1.2

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.
Files changed (63) hide show
  1. package/es/auth/auth-button.js +2 -3
  2. package/es/auth/auth-dropdown.js +16 -12
  3. package/es/auth/index.d.ts +2 -12
  4. package/es/auth/index.js +3 -5
  5. package/es/cascader/index.d.ts +3 -3
  6. package/es/cascader/index.js +3 -3
  7. package/es/ccs.d.ts +207 -25
  8. package/es/ccs.js +1 -79
  9. package/es/color-picker/index.js +30 -26
  10. package/es/context/index.d.ts +5 -5
  11. package/es/date-picker/index.js +9 -3
  12. package/es/dialog/HookDrawer.js +24 -8
  13. package/es/dialog/HookModal.d.ts +4 -0
  14. package/es/dialog/HookModal.js +93 -29
  15. package/es/dialog/button.d.ts +6 -2
  16. package/es/dialog/button.js +45 -13
  17. package/es/dialog/context.d.ts +8 -2
  18. package/es/dialog/drawer-footer.d.ts +12 -0
  19. package/es/dialog/drawer-footer.js +62 -0
  20. package/es/dialog/form.d.ts +7 -4
  21. package/es/dialog/form.js +9 -2
  22. package/es/dialog/hook.d.ts +9 -2
  23. package/es/dialog/hook.js +16 -4
  24. package/es/dialog/index.d.ts +9 -2
  25. package/es/dialog/index.js +4 -1
  26. package/es/dialog/index.less +12 -15
  27. package/es/hooks/use-global.d.ts +1 -1
  28. package/es/index.d.ts +3 -133
  29. package/es/index.js +4 -4
  30. package/es/interval-button/index.js +12 -6
  31. package/es/keep-alive-tabs/index.d.ts +4 -3
  32. package/es/keep-alive-tabs/index.js +5 -10
  33. package/es/keep-alive-tabs/page.d.ts +2 -2
  34. package/es/keep-alive-tabs/page.js +20 -16
  35. package/es/pro-grid/index.d.ts +0 -1
  36. package/es/pro-grid/index.js +51 -39
  37. package/es/pro-table/index.d.ts +11 -57
  38. package/es/pro-table/index.js +13 -13
  39. package/es/pro-table/index.less +17 -9
  40. package/es/pro-table/search.d.ts +5 -2
  41. package/es/pro-table/search.js +32 -9
  42. package/es/pro-table/tree.d.ts +5 -5
  43. package/es/pro-table/tree.js +1 -2
  44. package/es/pro-tabs/index.d.ts +0 -1
  45. package/es/pro-tabs/index.js +25 -8
  46. package/es/select/index.d.ts +3 -3
  47. package/es/select/index.js +3 -3
  48. package/es/theme-dialog.d.ts +24 -0
  49. package/es/theme-dialog.js +70 -0
  50. package/es/theme.d.ts +17 -0
  51. package/es/theme.js +66 -0
  52. package/es/time-picker/index.js +10 -4
  53. package/es/trigger/index.d.ts +0 -12
  54. package/es/trigger/index.js +78 -68
  55. package/es/upload/index.js +16 -7
  56. package/es/utils/index.d.ts +0 -15
  57. package/es/utils/index.js +3 -47
  58. package/es/virtual-list/index.js +34 -29
  59. package/es/water-mark/index.js +20 -17
  60. package/package.json +3 -1
  61. package/es/drawer.zip +0 -0
  62. package/es/modal.zip +0 -0
  63. package/es/pro-tabs/index.less +0 -5
@@ -11,7 +11,7 @@ import { ExclamationCircleOutlined } from '@ant-design/icons';
11
11
  import { Button } from 'antd';
12
12
  import { useRef } from 'react';
13
13
  import { ModalConfirm } from '.';
14
- import { CCS, useCcsPage } from "../";
14
+ import { useCcsPage } from "../";
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
17
17
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -28,7 +28,6 @@ export default (function (_ref) {
28
28
  restProps = _objectWithoutProperties(_ref, _excluded);
29
29
  var _ref2 = useCcsPage() || {},
30
30
  onAuth = _ref2.onAuth;
31
- var IsAuthButton = CCS.GlobalConfig.IsAuthButton;
32
31
  var modalRef = useRef(null);
33
32
  var button = /*#__PURE__*/_jsxs(Button, _objectSpread(_objectSpread({}, restProps), {}, {
34
33
  onClick: function onClick(e) {
@@ -54,7 +53,7 @@ export default (function (_ref) {
54
53
  }));
55
54
 
56
55
  // 不控制权限或没有传auth
57
- if (!IsAuthButton || !auth) {
56
+ if (!auth) {
58
57
  return /*#__PURE__*/_jsxs(_Fragment, {
59
58
  children: [button, !!confirm ? /*#__PURE__*/_jsx(ModalConfirm, {
60
59
  modalRef: modalRef
@@ -1,10 +1,17 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1
2
  var _excluded = ["auth", "menus", "children", "onClick"];
2
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3
8
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(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; }
4
9
  function _objectWithoutPropertiesLoose(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; }
5
10
  import { Dropdown } from 'antd';
6
11
  import React, { useMemo } from 'react';
7
- import { CCS, useCcsPage } from "../";
12
+ import { useCcsPage } from "../";
13
+ import { Fragment as _Fragment } from "react/jsx-runtime";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
8
15
  /**
9
16
  * 带权限的Dropdown组件
10
17
  */
@@ -17,7 +24,6 @@ export default (function (_ref) {
17
24
  restProps = _objectWithoutProperties(_ref, _excluded);
18
25
  var _ref2 = useCcsPage() || {},
19
26
  onAuth = _ref2.onAuth;
20
- var IsAuthButton = CCS.GlobalConfig.IsAuthButton;
21
27
  var items = useMemo(function () {
22
28
  function filterTreeArray(menuItems) {
23
29
  var mis = menuItems.filter(function (item) {
@@ -39,29 +45,27 @@ export default (function (_ref) {
39
45
  return m.children !== null;
40
46
  });
41
47
  }
42
- if (IsAuthButton) {
43
- return filterTreeArray(menus);
44
- }
45
- return menus;
48
+ return filterTreeArray(menus);
46
49
  }, [menus.map(function (m) {
47
50
  return m === null || m === void 0 ? void 0 : m.key;
48
51
  }).join(',')]);
49
52
  var renderChildren = useMemo(function () {
50
- if (!auth || !IsAuthButton) {
53
+ if (!auth) {
51
54
  return children;
52
55
  }
53
56
  var btn = onAuth && onAuth(auth);
54
57
  if (btn) {
55
58
  return children;
56
59
  }
57
- return /*#__PURE__*/React.createElement(React.Fragment, null);
60
+ return /*#__PURE__*/_jsx(_Fragment, {});
58
61
  }, []);
59
62
  return items.filter(function (i) {
60
63
  return i.type !== 'divider';
61
- }).length ? /*#__PURE__*/React.createElement(Dropdown, _extends({}, restProps, {
64
+ }).length ? /*#__PURE__*/_jsx(Dropdown, _objectSpread(_objectSpread({}, restProps), {}, {
62
65
  menu: {
63
66
  items: items,
64
67
  onClick: onClick
65
- }
66
- }), renderChildren) : /*#__PURE__*/React.createElement(React.Fragment, null);
68
+ },
69
+ children: renderChildren
70
+ })) : /*#__PURE__*/_jsx(_Fragment, {});
67
71
  });
@@ -1,16 +1,6 @@
1
1
  import { ButtonProps } from 'antd';
2
2
  import { ReactElement, ReactNode } from 'react';
3
- export interface ButtonItem {
4
- key: string;
5
- label: string;
6
- auth?: string;
7
- type?: ButtonProps['type'];
8
- disabled?: boolean;
9
- hidden?: boolean;
10
- danger?: boolean;
11
- icon?: ReactNode;
12
- confirm?: string;
13
- }
3
+ import CCS from '..';
14
4
  export interface CcsAuthGroupProps {
15
5
  /** 按钮尺寸 */
16
6
  size?: ButtonProps['size'];
@@ -19,7 +9,7 @@ export interface CcsAuthGroupProps {
19
9
  /** 全部显示成link样式 */
20
10
  isLink?: boolean;
21
11
  /** 按钮数据 */
22
- items?: ButtonItem[];
12
+ items?: CCS.AuthButtonItem[];
23
13
  /** 更多icon */
24
14
  moreIcon?: ReactNode;
25
15
  /** 更多文字 */
package/es/auth/index.js CHANGED
@@ -17,7 +17,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  import { EllipsisOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
18
18
  import { Button, Dropdown, Modal, Space } from 'antd';
19
19
  import { useEffect, useRef } from 'react';
20
- import { CCS, useCcsPage } from '..';
20
+ import { useCcsPage } from '..';
21
21
  import AuthButton from "./auth-button";
22
22
  import AuthDropdown from "./auth-dropdown";
23
23
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -41,8 +41,7 @@ function CcsAuth(_ref2) {
41
41
  children = _ref2.children;
42
42
  var _ref3 = useCcsPage() || {},
43
43
  onAuth = _ref3.onAuth;
44
- var IsAuthButton = CCS.GlobalConfig.IsAuthButton;
45
- if (IsAuthButton && onAuth && auth) {
44
+ if (onAuth && auth) {
46
45
  return onAuth(auth) ? children : null;
47
46
  }
48
47
  return children;
@@ -58,7 +57,6 @@ function AuthGroup(_ref4) {
58
57
  onClick = _ref4.onClick;
59
58
  var _ref5 = useCcsPage() || {},
60
59
  onAuth = _ref5.onAuth;
61
- var IsAuthButton = CCS.GlobalConfig.IsAuthButton;
62
60
  var modalRef = useRef(null);
63
61
  var authButtons = [];
64
62
 
@@ -68,7 +66,7 @@ function AuthGroup(_ref4) {
68
66
  });
69
67
 
70
68
  // 需要判断权限
71
- if (IsAuthButton && onAuth) {
69
+ if (onAuth) {
72
70
  authButtons = authButtons.filter(function (b) {
73
71
  if (b.auth) return onAuth(b.auth);
74
72
  return true;
@@ -1,5 +1,5 @@
1
1
  import { CascaderProps } from 'antd';
2
- import { HttpResult, RecordType } from '..';
2
+ import CCS from '..';
3
3
  type CacheType = {
4
4
  /** 缓存key,同一个key将共享数据 */
5
5
  cacheKey?: string;
@@ -11,9 +11,9 @@ type CacheType = {
11
11
  type ApiCascaderProps = CascaderProps & {
12
12
  cache?: CacheType;
13
13
  /** 依赖参数 */
14
- defaultParams?: RecordType;
14
+ defaultParams?: CCS.RecordType;
15
15
  /** 查询请求 */
16
- onQuery?: (params?: any) => Promise<HttpResult<any[]>>;
16
+ onQuery?: (params?: any) => Promise<CCS.HttpResult<any[]>>;
17
17
  };
18
18
  /**
19
19
  * 基于接口查询的select组件
@@ -1,6 +1,5 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
  var _excluded = ["onQuery", "cache", "defaultParams"];
3
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -14,7 +13,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
14
13
  import { useRequest } from 'ahooks';
15
14
  import { Cascader } from 'antd';
16
15
  import _isArray from 'lodash/isArray';
17
- import React, { useEffect } from 'react';
16
+ import { useEffect } from 'react';
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
18
  /**
19
19
  * 基于接口查询的select组件
20
20
  * @param CcsSelectProps
@@ -62,7 +62,7 @@ export default function CcsApiCascader(_ref) {
62
62
  useEffect(function () {
63
63
  if (onQuery) run(defaultParams);
64
64
  }, [JSON.stringify(defaultParams)]);
65
- return /*#__PURE__*/React.createElement(Cascader, _extends({
65
+ return /*#__PURE__*/_jsx(Cascader, _objectSpread({
66
66
  options: data,
67
67
  loading: loading,
68
68
  style: {
package/es/ccs.d.ts CHANGED
@@ -1,25 +1,207 @@
1
- import { ReactNode } from 'react';
2
- import { CcsGlobalConfigType } from './';
3
- interface CcsCustomIconType {
4
- name: 'TableFilter' | string;
5
- node: ReactNode;
6
- }
7
- export default class ccs {
8
- /** 自定义按钮 */
9
- static CustomIcon: CcsCustomIconType[];
10
- /** 按钮权限 */
11
- static UrlAuth: Record<string, string[]>;
12
- /** 全局配置 */
13
- static GlobalConfig: CcsGlobalConfigType;
14
- /** 添加自定义icon */
15
- static setCustomIcon(_icons: CcsCustomIconType[]): void;
16
- /** 设置全局配置 */
17
- static setGlobalConfig(e: CcsGlobalConfigType): void;
18
- /** 添加权限数据 */
19
- static setAuthList(e: string, auths: string[]): void;
20
- /** 清空权限 */
21
- static clearAuthList(): void;
22
- /** 系统配置 */
23
- static setDefaultConfig(config: any): any;
24
- }
25
- export {};
1
+ import { ButtonProps, MenuProps, ThemeConfig } from 'antd';
2
+ import { Rule } from 'antd/es/form';
3
+ import { ColumnsType } from 'antd/es/table';
4
+ import { MutableRefObject, ReactElement, ReactNode } from 'react';
5
+ interface MenuTreeNodeData {
6
+ buttonUrlId: number;
7
+ createTime: string;
8
+ icon?: string;
9
+ menuCode: string;
10
+ menuDesc: string;
11
+ menuName: string;
12
+ menuType: number;
13
+ menuUrl: string;
14
+ parentMenuCode: string;
15
+ sortId: number;
16
+ state: number;
17
+ updateTime: string;
18
+ urlName: string;
19
+ urlPath: string;
20
+ }
21
+ interface MenuParentType {
22
+ key: string;
23
+ url: string;
24
+ name: string;
25
+ }
26
+ interface MenuTreeNode {
27
+ nodeId: string;
28
+ nodeName: string;
29
+ icon: string;
30
+ leaf: boolean;
31
+ nodeData: MenuTreeNodeData;
32
+ children?: MenuTreeNode[];
33
+ topUrl?: string;
34
+ parents?: MenuParentType[];
35
+ }
36
+ interface UserDetail {
37
+ /** 头像 */
38
+ avatar?: string;
39
+ /** 用户名 */
40
+ workerName: string;
41
+ }
42
+ interface TableData<T> {
43
+ /** loading */
44
+ loading?: boolean;
45
+ /** 总条数 */
46
+ totalNum?: number;
47
+ /** 单页记录数 */
48
+ pageSize?: number;
49
+ /** 页码 */
50
+ pageNo?: number;
51
+ /** Array List 数据 */
52
+ result?: T[];
53
+ }
54
+ interface HttpResult<T = any> {
55
+ code: string;
56
+ success: boolean;
57
+ data: T;
58
+ msg: string;
59
+ }
60
+ interface PageType<T> {
61
+ hasNext: boolean;
62
+ totalNum: number;
63
+ pageNo: number;
64
+ pageSize: number;
65
+ result: T[];
66
+ }
67
+ interface HttpPageResult<T = any> extends Omit<HttpResult<T>, 'data'> {
68
+ data: PageType<T>;
69
+ }
70
+ interface HttpListResult<T = any> extends Omit<HttpResult<T>, 'data'> {
71
+ data: T[];
72
+ }
73
+ interface OrderProp {
74
+ ascending: boolean;
75
+ prop: string;
76
+ }
77
+ interface QueryLimit {
78
+ fetchSize: number;
79
+ startIndex: number;
80
+ }
81
+ interface PageQuery<T = any> {
82
+ /** 查询的开始行数和取多少行,从0开始 */
83
+ limit?: QueryLimit;
84
+ /** 排序字段,一般前端不传,由后端指定 */
85
+ orderProps?: OrderProp[];
86
+ /** 页码 */
87
+ pageNo?: number;
88
+ /** 页长 */
89
+ pageSize?: number;
90
+ /** 查询条件 */
91
+ query: T;
92
+ }
93
+ interface ListQuery<T = any> {
94
+ /** 查询的开始行数和取多少行,从0开始 */
95
+ limit?: QueryLimit;
96
+ /** 排序字段,一般前端不传,由后端指定 */
97
+ orderProps?: OrderProp[];
98
+ /** 查询条件 */
99
+ query: T;
100
+ }
101
+ type RecordType = Record<string, any>;
102
+ interface RouteHistory {
103
+ menuName: string;
104
+ pathName: string;
105
+ time: Date;
106
+ }
107
+ interface TableDataType<T> {
108
+ /** loading */
109
+ loading?: boolean;
110
+ /** 总条数 */
111
+ totalNum?: number;
112
+ /** 单页记录数 */
113
+ pageSize?: number;
114
+ /** 页码 */
115
+ pageNo?: number;
116
+ /** Array List 数据 */
117
+ result?: T[];
118
+ }
119
+ interface TableInstance<T = any> {
120
+ /** 获取form表单数据 */
121
+ formValues: Record<string, any>;
122
+ /** 获取当前表单数据 */
123
+ data: TableDataType<T>;
124
+ /** 查询数据,根据条件,从第一页开始显示 */
125
+ onSearch: () => void;
126
+ /** 刷新数据、根据条件,当前页 */
127
+ onReload: () => void;
128
+ /** 异步树、局部刷新方法 */
129
+ onPartialReload: (id: React.Key) => void;
130
+ /** 重置数据,清空选择 */
131
+ onReset: () => void;
132
+ /** 改变data 数据 */
133
+ onChangeData: React.Dispatch<React.SetStateAction<TableDataType<T>>>;
134
+ }
135
+ interface AuthButtonItem {
136
+ key: string;
137
+ label: string;
138
+ auth?: string;
139
+ type?: ButtonProps['type'];
140
+ disabled?: boolean;
141
+ hidden?: boolean;
142
+ danger?: boolean;
143
+ icon?: ReactNode;
144
+ confirm?: string;
145
+ }
146
+ interface TriggerChildrenProps<T = any> {
147
+ /** 选中值 */
148
+ value?: T;
149
+ /** 选择框loading状态 */
150
+ onLoading?: (loading: boolean) => void;
151
+ /** 关闭弹框 */
152
+ onVisible?: (visible: boolean) => void;
153
+ /** 选中值改变事件 */
154
+ onChange?: ({}: T) => void;
155
+ /** 选择框显示名称 */
156
+ onChangeLabel?: (text: string | undefined) => void;
157
+ }
158
+ type ShowDependType = {
159
+ name: string;
160
+ value: any;
161
+ };
162
+ type TableFormItem = {
163
+ /** label 标题 */
164
+ label?: string;
165
+ /** form name */
166
+ name: string;
167
+ /** form item element */
168
+ value: ReactElement;
169
+ /** 主条件 */
170
+ isMain?: boolean;
171
+ /** 数据依赖、依赖项对应的name数组 */
172
+ depends?: string[];
173
+ /** 显示依赖 */
174
+ showDepends?: ShowDependType[];
175
+ /** 必填规则 */
176
+ rules?: Rule[];
177
+ /** 格式化值 */
178
+ onFormat?: (e: any) => any;
179
+ };
180
+ type GlobalConfig = {
181
+ /** 项目名称 */
182
+ AppName: string;
183
+ /** 主题 */
184
+ AppTheme: 'default' | 'dark';
185
+ /** ant组件配置 */
186
+ AppThemeConfig: ThemeConfig;
187
+ /** 菜单展开模式 */
188
+ MenuExpandMode: MenuProps['mode'];
189
+ /** 菜单展开宽度 */
190
+ MenuExpandWidth: number;
191
+ /** 菜单收起宽度 */
192
+ MenuCollapsedWidth: number;
193
+ /** tabs缓存页 */
194
+ IsTabsPage: boolean;
195
+ /** http 请求通用前缀 */
196
+ Api: string;
197
+ /** 路由上下文 */
198
+ Context: string;
199
+ /** 图片上传地址 */
200
+ UploadUrl: string;
201
+ /** 图片下载地址 */
202
+ DownloadUrl: string;
203
+ };
204
+ type TableFormItems = TableFormItem[];
205
+ type TableInstanceRef<T = any> = MutableRefObject<TableInstance<T> | undefined> | React.RefObject<TableInstance<T>>;
206
+ type TableColumns<T = any> = ColumnsType<T>;
207
+ export type { PageType, RecordType, MenuTreeNode, PageQuery, ListQuery, HttpResult, GlobalConfig, HttpListResult, HttpPageResult, AuthButtonItem, MenuTreeNodeData, UserDetail, RouteHistory, TableData, TableFormItems, TableColumns, TableInstance, TableInstanceRef, TriggerChildrenProps, };
package/es/ccs.js CHANGED
@@ -1,79 +1 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
- var defaultConfig = {
9
- theme: {
10
- token: {
11
- colorPrimary: '#1677ff',
12
- borderRadius: 3
13
- },
14
- hashed: true
15
- },
16
- classPrefix: 'ccs'
17
- };
18
- var ccs = /*#__PURE__*/function () {
19
- function ccs() {
20
- _classCallCheck(this, ccs);
21
- }
22
- _createClass(ccs, null, [{
23
- key: "setCustomIcon",
24
- value: /** 添加自定义icon */
25
- function setCustomIcon(_icons) {
26
- console.log('_icons', _icons);
27
-
28
- // this.icons = this.icons.concat(icons);
29
- // icons.forEach((icon) => {
30
- // if (['TableFilter', 'TableReset', 'TableColumn'].includes(icon.name)) {
31
- // this.proTableIcon[icon.name] = icon.node;
32
- // } else {
33
- // this.icons.push(icon);
34
- // }
35
- // });
36
- }
37
-
38
- /** 设置全局配置 */
39
- }, {
40
- key: "setGlobalConfig",
41
- value: function setGlobalConfig(e) {
42
- this.GlobalConfig = e;
43
- }
44
-
45
- /** 添加权限数据 */
46
- }, {
47
- key: "setAuthList",
48
- value: function setAuthList(e, auths) {
49
- this.UrlAuth[e] = auths;
50
- }
51
-
52
- /** 清空权限 */
53
- }, {
54
- key: "clearAuthList",
55
- value: function clearAuthList() {
56
- this.UrlAuth = {};
57
- }
58
-
59
- /** 系统配置 */
60
- }, {
61
- key: "setDefaultConfig",
62
- value: function setDefaultConfig(config) {
63
- Object.keys(defaultConfig).forEach(function (key) {
64
- if (config[key] === undefined) {
65
- config[key] = defaultConfig[key];
66
- }
67
- });
68
- return config;
69
- }
70
- }]);
71
- return ccs;
72
- }();
73
- /** 自定义按钮 */
74
- _defineProperty(ccs, "CustomIcon", []);
75
- /** 按钮权限 */
76
- _defineProperty(ccs, "UrlAuth", {});
77
- /** 全局配置 */
78
- _defineProperty(ccs, "GlobalConfig", {});
79
- export { ccs as default };
1
+ export {};
@@ -15,6 +15,7 @@ import { Popover } from 'antd';
15
15
  import React, { useState } from 'react';
16
16
  import { SketchPicker } from 'react-color';
17
17
  import "./index.less";
18
+ import { jsx as _jsx } from "react/jsx-runtime";
18
19
  /**
19
20
  * 颜色选择组件
20
21
  */
@@ -30,34 +31,37 @@ var ColorPicker = function ColorPicker(_ref) {
30
31
  if (onChange) onChange(e.rgb);
31
32
  setOpen(false);
32
33
  };
33
- return /*#__PURE__*/React.createElement("div", {
34
+ return /*#__PURE__*/_jsx("div", {
34
35
  style: {
35
36
  position: 'relative'
36
- }
37
- }, /*#__PURE__*/React.createElement(Popover, {
38
- open: open,
39
- content: /*#__PURE__*/React.createElement(SketchPicker, {
40
- color: value,
41
- onChange: handleChange
42
- })
43
- }, /*#__PURE__*/React.createElement("div", {
44
- style: _objectSpread({
45
- height: 32,
46
- padding: '4px 11px',
47
- border: '1px solid #d9d9d9',
48
- borderRadius: 3,
49
- display: 'flex'
50
- }, style)
51
- }, /*#__PURE__*/React.createElement("div", {
52
- onClick: function onClick() {
53
- return setOpen(!open);
54
37
  },
55
- style: {
56
- border: '1px solid #777',
57
- background: "rgb(".concat(value === null || value === void 0 ? void 0 : value.r, ",").concat(value === null || value === void 0 ? void 0 : value.g, ",").concat(value === null || value === void 0 ? void 0 : value.b, ",").concat(value === null || value === void 0 ? void 0 : value.a, ")"),
58
- width: '100%',
59
- margin: '4px 0'
60
- }
61
- }))));
38
+ children: /*#__PURE__*/_jsx(Popover, {
39
+ open: open,
40
+ content: /*#__PURE__*/_jsx(SketchPicker, {
41
+ color: value,
42
+ onChange: handleChange
43
+ }),
44
+ children: /*#__PURE__*/_jsx("div", {
45
+ style: _objectSpread({
46
+ height: 32,
47
+ padding: '4px 11px',
48
+ border: '1px solid #d9d9d9',
49
+ borderRadius: 3,
50
+ display: 'flex'
51
+ }, style),
52
+ children: /*#__PURE__*/_jsx("div", {
53
+ onClick: function onClick() {
54
+ return setOpen(!open);
55
+ },
56
+ style: {
57
+ border: '1px solid #777',
58
+ background: "rgb(".concat(value === null || value === void 0 ? void 0 : value.r, ",").concat(value === null || value === void 0 ? void 0 : value.g, ",").concat(value === null || value === void 0 ? void 0 : value.b, ",").concat(value === null || value === void 0 ? void 0 : value.a, ")"),
59
+ width: '100%',
60
+ margin: '4px 0'
61
+ }
62
+ })
63
+ })
64
+ })
65
+ });
62
66
  };
63
67
  export default ColorPicker;
@@ -2,7 +2,7 @@ import { TabPaneProps } from 'antd';
2
2
  import { Store } from 'antd/es/form/interface';
3
3
  import { Location } from 'history';
4
4
  import React from 'react';
5
- import { CcsUserDetailType, RecordType } from '..';
5
+ import CCS from '..';
6
6
  type CcsTabsChangeProps = {
7
7
  /** 当前激活tab面板的key */
8
8
  activeKey?: string;
@@ -11,7 +11,7 @@ type CcsTabsChangeProps = {
11
11
  /** 禁用tab keys */
12
12
  disableKeys?: string[];
13
13
  /** tab间传递的参数 */
14
- options?: RecordType;
14
+ options?: CCS.RecordType;
15
15
  };
16
16
  export type CcsTabProps = Omit<TabPaneProps, 'tab'> & {
17
17
  key: string;
@@ -21,9 +21,9 @@ interface CcsTabsContextType {
21
21
  /** 当前激活tab面板的key */
22
22
  activeKey: string;
23
23
  /** tab间传递的参数 */
24
- options: RecordType;
24
+ options: CCS.RecordType;
25
25
  /** 添加tab */
26
- onAddTabs: (tab: CcsTabProps | CcsTabProps[]) => void;
26
+ onAddTabs: (tab: CcsTabProps | CcsTabProps[], activeKey?: string) => void;
27
27
  /** 移除tab */
28
28
  onRemoveTabs: (key: string | string[]) => void;
29
29
  /** 改变tab间传递的参数 */
@@ -42,7 +42,7 @@ type PageContextType = {
42
42
  onAuth: (code: string) => boolean;
43
43
  };
44
44
  interface GlobalContextPropsType {
45
- userDetail: CcsUserDetailType;
45
+ userDetail: CCS.UserDetail;
46
46
  children: React.ReactElement;
47
47
  }
48
48
  type GlobalContextType = Omit<GlobalContextPropsType, 'children'>;
@@ -1,6 +1,11 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1
2
  var _excluded = ["value", "onChange"],
2
3
  _excluded2 = ["value", "onChange"];
3
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
10
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
11
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(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(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -13,6 +18,7 @@ import { DatePicker } from 'antd';
13
18
  import dayjs from 'dayjs';
14
19
  import _isArray from 'lodash/isArray';
15
20
  import React, { useState } from 'react';
21
+ import { jsx as _jsx } from "react/jsx-runtime";
16
22
  function CcsDatePicker(_ref) {
17
23
  var value = _ref.value,
18
24
  onChange = _ref.onChange,
@@ -29,7 +35,7 @@ function CcsDatePicker(_ref) {
29
35
  setDateValue(date || undefined);
30
36
  if (onChange) onChange(dateString);
31
37
  };
32
- return /*#__PURE__*/React.createElement(DatePicker, _extends({
38
+ return /*#__PURE__*/_jsx(DatePicker, _objectSpread({
33
39
  value: dateValue,
34
40
  onChange: handleOnChange
35
41
  }, restProps));
@@ -50,7 +56,7 @@ function RangePicker(_ref2) {
50
56
  setDateValue(date);
51
57
  if (onChange) onChange(dateString);
52
58
  };
53
- return /*#__PURE__*/React.createElement(DatePicker.RangePicker, _extends({
59
+ return /*#__PURE__*/_jsx(DatePicker.RangePicker, _objectSpread({
54
60
  value: dateValue,
55
61
  onChange: handleOnChange
56
62
  }, restProps));