@ccs-ui/rc-pro 2.3.6-alpha-31 → 2.3.6-alpha-33
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/package.json +6 -27
- package/LICENSE +0 -21
- package/README.md +0 -37
- package/es/aj-captcha/index.d.ts +0 -34
- package/es/aj-captcha/index.js +0 -302
- package/es/aj-captcha/index.less +0 -89
- package/es/auth/index.d.ts +0 -15
- package/es/auth/index.js +0 -38
- package/es/breadcrumb.d.ts +0 -8
- package/es/breadcrumb.js +0 -40
- package/es/button/dropdown.d.ts +0 -6
- package/es/button/dropdown.js +0 -72
- package/es/button/group.d.ts +0 -2
- package/es/button/group.js +0 -176
- package/es/button/index.d.ts +0 -65
- package/es/button/index.js +0 -133
- package/es/cascader/index.d.ts +0 -33
- package/es/cascader/index.js +0 -120
- package/es/ccs.d.ts +0 -131
- package/es/ccs.js +0 -1
- package/es/color-picker/index.d.ts +0 -7
- package/es/color-picker/index.js +0 -142
- package/es/color-picker/index.less +0 -8
- package/es/config.d.ts +0 -6
- package/es/config.js +0 -126
- package/es/context/index.d.ts +0 -115
- package/es/context/index.js +0 -6
- package/es/date-picker/index.d.ts +0 -19
- package/es/date-picker/index.js +0 -72
- package/es/dialog/HookDrawer.d.ts +0 -9
- package/es/dialog/HookDrawer.js +0 -156
- package/es/dialog/HookModal.d.ts +0 -10
- package/es/dialog/HookModal.js +0 -213
- package/es/dialog/button.d.ts +0 -24
- package/es/dialog/button.js +0 -256
- package/es/dialog/context.d.ts +0 -25
- package/es/dialog/context.js +0 -13
- package/es/dialog/drawer-footer.d.ts +0 -16
- package/es/dialog/drawer-footer.js +0 -43
- package/es/dialog/form.d.ts +0 -16
- package/es/dialog/form.js +0 -53
- package/es/dialog/hook.d.ts +0 -80
- package/es/dialog/hook.js +0 -234
- package/es/dialog/index.d.ts +0 -19
- package/es/dialog/index.js +0 -14
- package/es/dialog/usePatchElement.d.ts +0 -5
- package/es/dialog/usePatchElement.js +0 -35
- package/es/editor/index.d.ts +0 -22
- package/es/editor/index.js +0 -18
- package/es/editor/index.less +0 -19
- package/es/editor/javascript.d.ts +0 -2
- package/es/editor/javascript.js +0 -56
- package/es/editor/json.d.ts +0 -7
- package/es/editor/json.js +0 -82
- package/es/editor/sql.d.ts +0 -2
- package/es/editor/sql.js +0 -54
- package/es/ellipsis/index.d.ts +0 -22
- package/es/ellipsis/index.js +0 -129
- package/es/ellipsis/index.less +0 -5
- package/es/ellipsis/useMeasure.d.ts +0 -9
- package/es/ellipsis/useMeasure.js +0 -142
- package/es/ellipsis/useResizeEffect.d.ts +0 -2
- package/es/ellipsis/useResizeEffect.js +0 -14
- package/es/ellipsis/withStopPropagation.d.ts +0 -4
- package/es/ellipsis/withStopPropagation.js +0 -38
- package/es/full-screen/index.d.ts +0 -3
- package/es/full-screen/index.js +0 -49
- package/es/group-form-item/index.d.ts +0 -11
- package/es/group-form-item/index.js +0 -124
- package/es/hooks/use-app.d.ts +0 -25
- package/es/hooks/use-app.js +0 -52
- package/es/hooks/use-event.d.ts +0 -10
- package/es/hooks/use-event.js +0 -69
- package/es/hooks/use-once-event.d.ts +0 -2
- package/es/hooks/use-once-event.js +0 -16
- package/es/hooks/use-page.d.ts +0 -10
- package/es/hooks/use-page.js +0 -10
- package/es/hooks/use-selection.d.ts +0 -17
- package/es/hooks/use-selection.js +0 -172
- package/es/hooks/use-tabs.d.ts +0 -2
- package/es/hooks/use-tabs.js +0 -10
- package/es/hooks/use-window.d.ts +0 -8
- package/es/hooks/use-window.js +0 -15
- package/es/index.d.ts +0 -37
- package/es/index.js +0 -37
- package/es/interval-button/index.d.ts +0 -14
- package/es/interval-button/index.js +0 -128
- package/es/layout-keep-alive/index.d.ts +0 -29
- package/es/layout-keep-alive/index.js +0 -400
- package/es/layout-keep-alive/index.less +0 -79
- package/es/layout-keep-alive/page.d.ts +0 -14
- package/es/layout-keep-alive/page.js +0 -53
- package/es/layout-single-page/index.d.ts +0 -14
- package/es/layout-single-page/index.js +0 -71
- package/es/layout-single-page/index.less +0 -15
- package/es/layout-single-page/page.d.ts +0 -13
- package/es/layout-single-page/page.js +0 -41
- package/es/loading/index.d.ts +0 -14
- package/es/loading/index.js +0 -43
- package/es/pro-grid/index.d.ts +0 -15
- package/es/pro-grid/index.js +0 -58
- package/es/pro-table/_utils.d.ts +0 -12
- package/es/pro-table/_utils.js +0 -94
- package/es/pro-table/form-item.d.ts +0 -9
- package/es/pro-table/form-item.js +0 -44
- package/es/pro-table/head.d.ts +0 -16
- package/es/pro-table/head.js +0 -225
- package/es/pro-table/index.d.ts +0 -23
- package/es/pro-table/index.js +0 -37
- package/es/pro-table/index.less +0 -82
- package/es/pro-table/operation.d.ts +0 -14
- package/es/pro-table/operation.js +0 -194
- package/es/pro-table/selection-alert.d.ts +0 -20
- package/es/pro-table/selection-alert.js +0 -64
- package/es/pro-table/size.d.ts +0 -10
- package/es/pro-table/size.js +0 -17
- package/es/pro-table/summary.d.ts +0 -8
- package/es/pro-table/summary.js +0 -32
- package/es/pro-table/table.d.ts +0 -104
- package/es/pro-table/table.js +0 -712
- package/es/pro-table/tree.d.ts +0 -24
- package/es/pro-table/tree.js +0 -197
- package/es/pro-tabs/index.d.ts +0 -9
- package/es/pro-tabs/index.js +0 -174
- package/es/resize-observer.d.ts +0 -15
- package/es/resize-observer.js +0 -37
- package/es/result/icon.d.ts +0 -3
- package/es/result/icon.js +0 -3
- package/es/result/index.d.ts +0 -12
- package/es/result/index.js +0 -68
- package/es/select/ modal.d.ts +0 -10
- package/es/select/ modal.js +0 -141
- package/es/select/api.d.ts +0 -25
- package/es/select/api.js +0 -67
- package/es/select/customize.d.ts +0 -25
- package/es/select/customize.js +0 -139
- package/es/select/index.d.ts +0 -31
- package/es/select/index.js +0 -108
- package/es/status-tag/index.d.ts +0 -13
- package/es/status-tag/index.js +0 -31
- package/es/table/index.d.ts +0 -19
- package/es/table/index.js +0 -253
- package/es/table/index.less +0 -29
- package/es/theme-dialog.d.ts +0 -28
- package/es/theme-dialog.js +0 -81
- package/es/time-picker/index.d.ts +0 -15
- package/es/time-picker/index.js +0 -49
- package/es/trigger/index.d.ts +0 -43
- package/es/trigger/index.js +0 -298
- package/es/trigger/index.less +0 -42
- package/es/types.d.ts +0 -0
- package/es/types.js +0 -0
- package/es/upload/index.d.ts +0 -42
- package/es/upload/index.js +0 -167
- package/es/upload/upload-image.d.ts +0 -6
- package/es/upload/upload-image.js +0 -205
- package/es/virtual-list/index.d.ts +0 -51
- package/es/virtual-list/index.js +0 -132
- package/es/water-mark/index.d.ts +0 -65
- package/es/water-mark/index.js +0 -141
- package/es/water-mark/relative.d.ts +0 -62
- package/es/water-mark/relative.js +0 -130
package/es/hooks/use-event.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
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); } }
|
|
3
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
4
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
import _cloneDeep from 'lodash.clonedeep';
|
|
9
|
-
import _uniqueId from 'lodash.uniqueid';
|
|
10
|
-
import { useEffect, useRef } from 'react';
|
|
11
|
-
export var EventInstance = /*#__PURE__*/_createClass(function EventInstance() {
|
|
12
|
-
var _this = this;
|
|
13
|
-
_classCallCheck(this, EventInstance);
|
|
14
|
-
_defineProperty(this, "subscriptions", []);
|
|
15
|
-
// 发布通知
|
|
16
|
-
_defineProperty(this, "emit", function (val, actionType) {
|
|
17
|
-
_this.subscriptions.forEach(function (subscription) {
|
|
18
|
-
// 未传入actionType 全部执行
|
|
19
|
-
if (actionType === undefined) {
|
|
20
|
-
var values = _cloneDeep(val);
|
|
21
|
-
subscription.record = values;
|
|
22
|
-
subscription.func(values);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// 仅执行匹配的方法
|
|
27
|
-
if (actionType === subscription.type) {
|
|
28
|
-
var _values = _cloneDeep(val);
|
|
29
|
-
subscription.record = _values;
|
|
30
|
-
subscription.func(_values);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
// 订阅
|
|
35
|
-
_defineProperty(this, "useSubscription", function (callback, actionType) {
|
|
36
|
-
var _this$subscriptions$f;
|
|
37
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
38
|
-
var callbackRef = useRef(_uniqueId("_Subscription"));
|
|
39
|
-
|
|
40
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
41
|
-
useEffect(function () {
|
|
42
|
-
_this.subscriptions.push({
|
|
43
|
-
id: callbackRef.current,
|
|
44
|
-
func: callback,
|
|
45
|
-
type: actionType
|
|
46
|
-
});
|
|
47
|
-
return function () {
|
|
48
|
-
_this.subscriptions = _this.subscriptions.filter(function (sub) {
|
|
49
|
-
return sub.id !== callbackRef.current;
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
}, []);
|
|
53
|
-
return ((_this$subscriptions$f = _this.subscriptions.find(function (s) {
|
|
54
|
-
return s.id === callbackRef.current;
|
|
55
|
-
})) === null || _this$subscriptions$f === void 0 ? void 0 : _this$subscriptions$f.record) || {};
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* 组件消息订阅方式传值
|
|
61
|
-
* @returns
|
|
62
|
-
*/
|
|
63
|
-
export default function Event() {
|
|
64
|
-
var ref = useRef();
|
|
65
|
-
if (!ref.current) {
|
|
66
|
-
ref.current = new EventInstance();
|
|
67
|
-
}
|
|
68
|
-
return ref.current;
|
|
69
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
-
import { useRef } from 'react';
|
|
3
|
-
var useOnceEvent = function useOnceEvent(fn) {
|
|
4
|
-
var ref = useRef(false);
|
|
5
|
-
var fnc = function fnc() {
|
|
6
|
-
if (!ref.current) {
|
|
7
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8
|
-
args[_key] = arguments[_key];
|
|
9
|
-
}
|
|
10
|
-
fn(args);
|
|
11
|
-
ref.current = true;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
return fnc;
|
|
15
|
-
};
|
|
16
|
-
export default useOnceEvent;
|
package/es/hooks/use-page.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
declare const usePage: () => {
|
|
3
|
-
id: string;
|
|
4
|
-
location: import("react-router").Location<any>;
|
|
5
|
-
isActive: boolean;
|
|
6
|
-
dialogHolderRef: import("react").RefObject<import("../dialog/hook").ElementsHolderRef>;
|
|
7
|
-
onDestroy: (path: string) => void;
|
|
8
|
-
onAuth: (code: string) => boolean;
|
|
9
|
-
};
|
|
10
|
-
export default usePage;
|
package/es/hooks/use-page.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { PageContext } from "../context";
|
|
3
|
-
var usePage = function usePage() {
|
|
4
|
-
var context = useContext(PageContext);
|
|
5
|
-
if (context === undefined) {
|
|
6
|
-
throw new Error('PageContext not found');
|
|
7
|
-
}
|
|
8
|
-
return context;
|
|
9
|
-
};
|
|
10
|
-
export default usePage;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { SelectProps } from 'antd';
|
|
2
|
-
import { TableRowSelection } from 'antd/es/table/interface';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
type PropsType<T> = Pick<SelectProps, 'value' | 'onChange'> & Omit<TableRowSelection<T>, 'value' | 'onChange' | 'renderCell'> & {
|
|
5
|
-
/** rowKey 字段,选中key值 */
|
|
6
|
-
keyField: string;
|
|
7
|
-
/** 默认选择行数据,一般用于回显数据 */
|
|
8
|
-
defaultRows?: T[];
|
|
9
|
-
/** 选中行数据回调 */
|
|
10
|
-
onChangeRows?: (options: any[]) => void;
|
|
11
|
-
};
|
|
12
|
-
interface ReturnType<T> extends Omit<TableRowSelection<T>, 'renderCell'> {
|
|
13
|
-
selectedRows?: T[];
|
|
14
|
-
onClear: (key?: React.Key) => void;
|
|
15
|
-
}
|
|
16
|
-
export default function useTableSelection<T = any>(props: PropsType<T>): ReturnType<T>;
|
|
17
|
-
export {};
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
var _excluded = ["value", "type", "defaultRows", "keyField", "onChangeRows", "onChange"];
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
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; }
|
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
-
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."); }
|
|
9
|
-
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); }
|
|
10
|
-
function _arrayLikeToArray(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; }
|
|
11
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
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; }
|
|
14
|
-
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; }
|
|
15
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
16
|
-
import { useMemoizedFn, useUpdateEffect } from 'ahooks';
|
|
17
|
-
import { useEffect, useRef, useState } from 'react';
|
|
18
|
-
// 判断相对
|
|
19
|
-
function isEq(obj1, obj2) {
|
|
20
|
-
var o1 = obj1 !== null && obj1 !== void 0 ? obj1 : [];
|
|
21
|
-
var o2 = obj2 !== null && obj2 !== void 0 ? obj2 : [];
|
|
22
|
-
if (!Array.isArray(o1)) {
|
|
23
|
-
o1 = [o1];
|
|
24
|
-
}
|
|
25
|
-
return JSON.stringify(o1) !== JSON.stringify(o2);
|
|
26
|
-
}
|
|
27
|
-
function onGetKeys(value, keyField) {
|
|
28
|
-
if (value === undefined) return value;
|
|
29
|
-
if (Array.isArray(value)) {
|
|
30
|
-
return value.map(function (item) {
|
|
31
|
-
return _typeof(item) === 'object' ? item[keyField] : item;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
if (_typeof(value) === 'object') {
|
|
35
|
-
return value[keyField];
|
|
36
|
-
}
|
|
37
|
-
return [value];
|
|
38
|
-
}
|
|
39
|
-
export default function useTableSelection(props) {
|
|
40
|
-
var _ref = props || {},
|
|
41
|
-
value = _ref.value,
|
|
42
|
-
_ref$type = _ref.type,
|
|
43
|
-
type = _ref$type === void 0 ? 'checkbox' : _ref$type,
|
|
44
|
-
defaultRows = _ref.defaultRows,
|
|
45
|
-
_ref$keyField = _ref.keyField,
|
|
46
|
-
keyField = _ref$keyField === void 0 ? 'key' : _ref$keyField,
|
|
47
|
-
onChangeRows = _ref.onChangeRows,
|
|
48
|
-
onChangeValue = _ref.onChange,
|
|
49
|
-
rowSelectionProps = _objectWithoutProperties(_ref, _excluded);
|
|
50
|
-
var _useState = useState({}),
|
|
51
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
-
setUpdate = _useState2[1];
|
|
53
|
-
var selectionRef = useRef({
|
|
54
|
-
selectedRowKeys: onGetKeys(value, keyField),
|
|
55
|
-
selectedRows: defaultRows,
|
|
56
|
-
info: {
|
|
57
|
-
type: 'none'
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
var isMultiple = type === 'checkbox';
|
|
61
|
-
var handleOnChange = useMemoizedFn(function () {
|
|
62
|
-
var _selectionRef$current = selectionRef.current,
|
|
63
|
-
_selectionRef$current2 = _selectionRef$current.selectedRowKeys,
|
|
64
|
-
selectedRowKeys = _selectionRef$current2 === void 0 ? [] : _selectionRef$current2,
|
|
65
|
-
_selectionRef$current3 = _selectionRef$current.selectedRows,
|
|
66
|
-
selectedRows = _selectionRef$current3 === void 0 ? [] : _selectionRef$current3;
|
|
67
|
-
if (isMultiple) {
|
|
68
|
-
// 受控调用onChange
|
|
69
|
-
onChangeValue === null || onChangeValue === void 0 || onChangeValue(selectedRowKeys, selectedRows);
|
|
70
|
-
} else {
|
|
71
|
-
onChangeValue === null || onChangeValue === void 0 || onChangeValue(selectedRowKeys[0], selectedRows[0]);
|
|
72
|
-
}
|
|
73
|
-
onChangeRows === null || onChangeRows === void 0 || onChangeRows(selectedRows || []);
|
|
74
|
-
if (!onChangeValue) setUpdate({});
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// 生成默认选中数据
|
|
78
|
-
useEffect(function () {
|
|
79
|
-
if (defaultRows && !selectionRef.current.selectedRows) {
|
|
80
|
-
selectionRef.current.selectedRows = defaultRows;
|
|
81
|
-
|
|
82
|
-
// 生成选项
|
|
83
|
-
if (onChangeRows) onChangeRows(defaultRows);
|
|
84
|
-
setUpdate({});
|
|
85
|
-
}
|
|
86
|
-
}, [defaultRows]);
|
|
87
|
-
|
|
88
|
-
// value 变更,与当前选中数据不匹配
|
|
89
|
-
useUpdateEffect(function () {
|
|
90
|
-
var newValue = onGetKeys(value, keyField);
|
|
91
|
-
if (isEq(newValue, selectionRef.current.selectedRowKeys)) {
|
|
92
|
-
var _selectionRef$current4;
|
|
93
|
-
var rows = (_selectionRef$current4 = selectionRef.current.selectedRows) === null || _selectionRef$current4 === void 0 ? void 0 : _selectionRef$current4.filter(function () {
|
|
94
|
-
var _ref2;
|
|
95
|
-
var row = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
96
|
-
return (_ref2 = newValue || []) === null || _ref2 === void 0 ? void 0 : _ref2.includes(row[keyField]);
|
|
97
|
-
});
|
|
98
|
-
selectionRef.current = {
|
|
99
|
-
selectedRowKeys: newValue === undefined && isMultiple ? [] : newValue,
|
|
100
|
-
selectedRows: rows,
|
|
101
|
-
info: {
|
|
102
|
-
type: 'none'
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
setUpdate({});
|
|
106
|
-
}
|
|
107
|
-
}, [value]);
|
|
108
|
-
|
|
109
|
-
// 选中改变
|
|
110
|
-
var onChange = useMemoizedFn(function (keys, rows, info) {
|
|
111
|
-
selectionRef.current = {
|
|
112
|
-
selectedRowKeys: keys,
|
|
113
|
-
selectedRows: rows,
|
|
114
|
-
info: info
|
|
115
|
-
};
|
|
116
|
-
// 未知选中数据,在初始化传入数据中匹配
|
|
117
|
-
if (defaultRows && defaultRows.length > 0) {
|
|
118
|
-
rows.forEach(function (row, index) {
|
|
119
|
-
if (!row) {
|
|
120
|
-
var defaultRow = defaultRows.find(function (r) {
|
|
121
|
-
return r[keyField] === keys[index];
|
|
122
|
-
});
|
|
123
|
-
if (defaultRow) rows[index] = defaultRow;
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
handleOnChange();
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
// 删除
|
|
131
|
-
var onClear = useMemoizedFn(function (key) {
|
|
132
|
-
// 未传入key,删除全部
|
|
133
|
-
if (!key) {
|
|
134
|
-
selectionRef.current = {
|
|
135
|
-
selectedRowKeys: [],
|
|
136
|
-
selectedRows: [],
|
|
137
|
-
info: {
|
|
138
|
-
type: 'none'
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
} else {
|
|
142
|
-
var _selectionRef$current5 = selectionRef.current,
|
|
143
|
-
_selectionRef$current6 = _selectionRef$current5.selectedRowKeys,
|
|
144
|
-
selectedRowKeys = _selectionRef$current6 === void 0 ? [] : _selectionRef$current6,
|
|
145
|
-
_selectionRef$current7 = _selectionRef$current5.selectedRows,
|
|
146
|
-
selectedRows = _selectionRef$current7 === void 0 ? [] : _selectionRef$current7;
|
|
147
|
-
var newRows = selectedRows.filter(function () {
|
|
148
|
-
var r = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
149
|
-
return r[keyField] !== key;
|
|
150
|
-
});
|
|
151
|
-
var newKey = selectedRowKeys.filter(function (k) {
|
|
152
|
-
return k !== key;
|
|
153
|
-
});
|
|
154
|
-
selectionRef.current = {
|
|
155
|
-
selectedRowKeys: newKey,
|
|
156
|
-
selectedRows: newRows,
|
|
157
|
-
info: {
|
|
158
|
-
type: 'none'
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
handleOnChange();
|
|
163
|
-
});
|
|
164
|
-
return _objectSpread(_objectSpread(_objectSpread({}, selectionRef.current), {}, {
|
|
165
|
-
onChange: onChange,
|
|
166
|
-
onClear: onClear,
|
|
167
|
-
type: type
|
|
168
|
-
}, rowSelectionProps), {}, {
|
|
169
|
-
// @ts-ignore
|
|
170
|
-
onClearByProTable: onClear
|
|
171
|
-
});
|
|
172
|
-
}
|
package/es/hooks/use-tabs.d.ts
DELETED
package/es/hooks/use-tabs.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { TabsContext } from "../context";
|
|
3
|
-
var useTabs = function useTabs() {
|
|
4
|
-
var context = useContext(TabsContext);
|
|
5
|
-
if (context === undefined) {
|
|
6
|
-
throw new Error('TabsContext not found');
|
|
7
|
-
}
|
|
8
|
-
return context;
|
|
9
|
-
};
|
|
10
|
-
export default useTabs;
|
package/es/hooks/use-window.d.ts
DELETED
package/es/hooks/use-window.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { DrawerAndModalContext } from "../context";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated
|
|
6
|
-
* @returns
|
|
7
|
-
*/
|
|
8
|
-
var useCcsWindow = function useCcsWindow() {
|
|
9
|
-
var context = useContext(DrawerAndModalContext);
|
|
10
|
-
if (context === undefined) {
|
|
11
|
-
throw new Error('DrawerAndModalContext not found');
|
|
12
|
-
}
|
|
13
|
-
return context;
|
|
14
|
-
};
|
|
15
|
-
export default useCcsWindow;
|
package/es/index.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export { default as CcsAjCaptcha } from './aj-captcha';
|
|
2
|
-
export { default as CcsAuth } from './auth';
|
|
3
|
-
export { default as CcsButton } from './button';
|
|
4
|
-
export { default as CcsApiCascader } from './cascader';
|
|
5
|
-
export { default as CcsColorPicker } from './color-picker';
|
|
6
|
-
export { default as CcsAppConfig } from './config';
|
|
7
|
-
export { default as CcsDatePicker } from './date-picker';
|
|
8
|
-
export { default as CcsDialog } from './dialog';
|
|
9
|
-
export { default as CcsEditor } from './editor';
|
|
10
|
-
export { default as CcsEllipsis } from './ellipsis';
|
|
11
|
-
export { default as CcsFullScreenButton } from './full-screen';
|
|
12
|
-
export { default as CcsGroupFormItem } from './group-form-item';
|
|
13
|
-
export { default as useAppConfig } from './hooks/use-app';
|
|
14
|
-
export { default as useCcsOnceEvent } from './hooks/use-once-event';
|
|
15
|
-
export { default as useCcsPage } from './hooks/use-page';
|
|
16
|
-
export { default as useTableSelection } from './hooks/use-selection';
|
|
17
|
-
export { default as useCcsTabs } from './hooks/use-tabs';
|
|
18
|
-
export { default as useCcsWindow } from './hooks/use-window';
|
|
19
|
-
export { default as CcsIntervalButton } from './interval-button';
|
|
20
|
-
export { default as CcsKeepAliveTabs } from './layout-keep-alive';
|
|
21
|
-
export { default as CcsSinglePage } from './layout-single-page';
|
|
22
|
-
export { default as CcsLoading } from './loading';
|
|
23
|
-
export { default as CcsProGrid } from './pro-grid';
|
|
24
|
-
export { default as CcsProTable } from './pro-table';
|
|
25
|
-
export { default as CcsProTabs } from './pro-tabs';
|
|
26
|
-
export { default as CcsResizeObserver } from './resize-observer';
|
|
27
|
-
export { default as CcsResult } from './result';
|
|
28
|
-
export { default as CcsSelect } from './select';
|
|
29
|
-
export { default as CcsStatusTag } from './status-tag';
|
|
30
|
-
export { default as CcsTable } from './table';
|
|
31
|
-
export { default as CcsTimePicker } from './time-picker';
|
|
32
|
-
export { default as CcsTrigger } from './trigger';
|
|
33
|
-
export { default as CcsUpload } from './upload';
|
|
34
|
-
export { default as CcsVirtualList } from './virtual-list';
|
|
35
|
-
export { default as CcsWaterMark } from './water-mark';
|
|
36
|
-
import * as CCS from './ccs';
|
|
37
|
-
export default CCS;
|
package/es/index.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export { default as CcsAjCaptcha } from "./aj-captcha";
|
|
2
|
-
export { default as CcsAuth } from "./auth";
|
|
3
|
-
export { default as CcsButton } from "./button";
|
|
4
|
-
export { default as CcsApiCascader } from "./cascader";
|
|
5
|
-
export { default as CcsColorPicker } from "./color-picker";
|
|
6
|
-
export { default as CcsAppConfig } from "./config";
|
|
7
|
-
export { default as CcsDatePicker } from "./date-picker";
|
|
8
|
-
export { default as CcsDialog } from "./dialog";
|
|
9
|
-
export { default as CcsEditor } from "./editor";
|
|
10
|
-
export { default as CcsEllipsis } from "./ellipsis";
|
|
11
|
-
export { default as CcsFullScreenButton } from "./full-screen";
|
|
12
|
-
export { default as CcsGroupFormItem } from "./group-form-item";
|
|
13
|
-
export { default as useAppConfig } from "./hooks/use-app";
|
|
14
|
-
export { default as useCcsOnceEvent } from "./hooks/use-once-event";
|
|
15
|
-
export { default as useCcsPage } from "./hooks/use-page";
|
|
16
|
-
export { default as useTableSelection } from "./hooks/use-selection";
|
|
17
|
-
export { default as useCcsTabs } from "./hooks/use-tabs";
|
|
18
|
-
export { default as useCcsWindow } from "./hooks/use-window";
|
|
19
|
-
export { default as CcsIntervalButton } from "./interval-button";
|
|
20
|
-
export { default as CcsKeepAliveTabs } from "./layout-keep-alive";
|
|
21
|
-
export { default as CcsSinglePage } from "./layout-single-page";
|
|
22
|
-
export { default as CcsLoading } from "./loading";
|
|
23
|
-
export { default as CcsProGrid } from "./pro-grid";
|
|
24
|
-
export { default as CcsProTable } from "./pro-table";
|
|
25
|
-
export { default as CcsProTabs } from "./pro-tabs";
|
|
26
|
-
export { default as CcsResizeObserver } from "./resize-observer";
|
|
27
|
-
export { default as CcsResult } from "./result";
|
|
28
|
-
export { default as CcsSelect } from "./select";
|
|
29
|
-
export { default as CcsStatusTag } from "./status-tag";
|
|
30
|
-
export { default as CcsTable } from "./table";
|
|
31
|
-
export { default as CcsTimePicker } from "./time-picker";
|
|
32
|
-
export { default as CcsTrigger } from "./trigger";
|
|
33
|
-
export { default as CcsUpload } from "./upload";
|
|
34
|
-
export { default as CcsVirtualList } from "./virtual-list";
|
|
35
|
-
export { default as CcsWaterMark } from "./water-mark";
|
|
36
|
-
import * as CCS from "./ccs";
|
|
37
|
-
export default CCS;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ButtonProps } from 'antd';
|
|
3
|
-
export type IntervalBtnInstance = {
|
|
4
|
-
onStart: () => void;
|
|
5
|
-
};
|
|
6
|
-
declare const _default: import("react").ForwardRefExoticComponent<ButtonProps & {
|
|
7
|
-
/** 计时数 */
|
|
8
|
-
num?: number | undefined;
|
|
9
|
-
/** 包含字符串`num`的文本内容 */
|
|
10
|
-
disabledText?: string | undefined;
|
|
11
|
-
/** 缓存key */
|
|
12
|
-
cacheKey?: string | undefined;
|
|
13
|
-
} & import("react").RefAttributes<IntervalBtnInstance>>;
|
|
14
|
-
export default _default;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["num", "cacheKey", "disabledText", "children"];
|
|
3
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
9
|
-
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); } }
|
|
10
|
-
function _asyncToGenerator(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); }); }; }
|
|
11
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
-
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."); }
|
|
13
|
-
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); }
|
|
14
|
-
function _arrayLikeToArray(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; }
|
|
15
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
-
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; }
|
|
18
|
-
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; }
|
|
19
|
-
import { useInterval } from 'ahooks';
|
|
20
|
-
import { Button } from 'antd';
|
|
21
|
-
import { forwardRef, useImperativeHandle, useLayoutEffect, useMemo, useState } from 'react';
|
|
22
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
-
/**
|
|
24
|
-
* 倒计时按钮组件
|
|
25
|
-
* @param PropsType
|
|
26
|
-
* @param IntervalInstance
|
|
27
|
-
* @returns
|
|
28
|
-
*/
|
|
29
|
-
function IntervalButton(_ref, ref) {
|
|
30
|
-
var _ref$num = _ref.num,
|
|
31
|
-
num = _ref$num === void 0 ? 60 : _ref$num,
|
|
32
|
-
cacheKey = _ref.cacheKey,
|
|
33
|
-
disabledText = _ref.disabledText,
|
|
34
|
-
children = _ref.children,
|
|
35
|
-
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
36
|
-
var _useState = useState(-1),
|
|
37
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
38
|
-
count = _useState2[0],
|
|
39
|
-
setCount = _useState2[1];
|
|
40
|
-
var _useState3 = useState(null),
|
|
41
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
42
|
-
codeInterval = _useState4[0],
|
|
43
|
-
setCodeInterval = _useState4[1];
|
|
44
|
-
var key = useMemo(function () {
|
|
45
|
-
return cacheKey || window.location.host;
|
|
46
|
-
}, []);
|
|
47
|
-
|
|
48
|
-
// 判断是否有未完成的倒计时
|
|
49
|
-
useLayoutEffect(function () {
|
|
50
|
-
var initNum = /*#__PURE__*/function () {
|
|
51
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
52
|
-
var s, currentTime, time;
|
|
53
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
54
|
-
while (1) switch (_context.prev = _context.next) {
|
|
55
|
-
case 0:
|
|
56
|
-
_context.next = 2;
|
|
57
|
-
return localStorage.getStroage(key);
|
|
58
|
-
case 2:
|
|
59
|
-
s = _context.sent;
|
|
60
|
-
if (!s) {
|
|
61
|
-
_context.next = 10;
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
currentTime = new Date().getTime();
|
|
65
|
-
time = Math.round((currentTime - s.time) / 1000);
|
|
66
|
-
if (!(time < s.num)) {
|
|
67
|
-
_context.next = 10;
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
setCount(s.num - time);
|
|
71
|
-
setCodeInterval(1000);
|
|
72
|
-
return _context.abrupt("return");
|
|
73
|
-
case 10:
|
|
74
|
-
setCount(num);
|
|
75
|
-
case 11:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context.stop();
|
|
78
|
-
}
|
|
79
|
-
}, _callee);
|
|
80
|
-
}));
|
|
81
|
-
return function initNum() {
|
|
82
|
-
return _ref2.apply(this, arguments);
|
|
83
|
-
};
|
|
84
|
-
}();
|
|
85
|
-
initNum();
|
|
86
|
-
}, []);
|
|
87
|
-
|
|
88
|
-
// ahooks useInterval
|
|
89
|
-
useInterval(function () {
|
|
90
|
-
if (count - 1 === 0) {
|
|
91
|
-
setCodeInterval(null);
|
|
92
|
-
setCount(num);
|
|
93
|
-
if (key) localStorage.removeStroage(key);
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
setCount(count - 1);
|
|
97
|
-
}, codeInterval, {
|
|
98
|
-
immediate: true
|
|
99
|
-
});
|
|
100
|
-
var disabled = count !== 0 && count !== num;
|
|
101
|
-
|
|
102
|
-
// 开始计时
|
|
103
|
-
var onStart = function onStart() {
|
|
104
|
-
setCodeInterval(1000);
|
|
105
|
-
if (key) {
|
|
106
|
-
localStorage.setStroage(key, {
|
|
107
|
-
num: num,
|
|
108
|
-
time: new Date().getTime()
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
useImperativeHandle(ref, function () {
|
|
113
|
-
return {
|
|
114
|
-
onStart: onStart
|
|
115
|
-
};
|
|
116
|
-
});
|
|
117
|
-
return count === -1 ? null : /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
118
|
-
type: "primary"
|
|
119
|
-
}, restProps), {}, {
|
|
120
|
-
onClick: restProps.onClick ? restProps.onClick : onStart,
|
|
121
|
-
disabled: restProps.disabled ? true : disabled,
|
|
122
|
-
children: disabled ? "".concat(count, "\u79D2").concat(disabledText) : "".concat(children)
|
|
123
|
-
}));
|
|
124
|
-
}
|
|
125
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
126
|
-
IntervalButton.displayName = 'CcsIntervalButton';
|
|
127
|
-
}
|
|
128
|
-
export default /*#__PURE__*/forwardRef(IntervalButton);
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { BreadcrumbProps } from 'antd';
|
|
2
|
-
import { JSXElementConstructor, ReactElement } from 'react';
|
|
3
|
-
import { Location } from 'react-router';
|
|
4
|
-
import CCS from '..';
|
|
5
|
-
import { MenuType } from '../ccs';
|
|
6
|
-
import './index.less';
|
|
7
|
-
export type CacheRouter = {
|
|
8
|
-
key: string;
|
|
9
|
-
menuKey: string;
|
|
10
|
-
label: string;
|
|
11
|
-
urlAuthList: string[];
|
|
12
|
-
outlet: ReactElement<any, string | JSXElementConstructor<any>> | null;
|
|
13
|
-
children?: ReactElement<any, string | JSXElementConstructor<any>> | null;
|
|
14
|
-
breadcrumb: BreadcrumbProps['items'];
|
|
15
|
-
pageLocation: Location;
|
|
16
|
-
};
|
|
17
|
-
type PropsType = {
|
|
18
|
-
maxLen?: number;
|
|
19
|
-
appName: string;
|
|
20
|
-
menuItems: CCS.MenuType[];
|
|
21
|
-
className?: string;
|
|
22
|
-
history: any;
|
|
23
|
-
};
|
|
24
|
-
export declare function findMenusByUrl(tree: MenuType | MenuType[], targetUrl: string, parents?: MenuType[]): MenuType[] | null;
|
|
25
|
-
declare function KeepAliveTabs({ maxLen, appName, history, menuItems, className, }: PropsType): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
declare namespace KeepAliveTabs {
|
|
27
|
-
var displayName: string;
|
|
28
|
-
}
|
|
29
|
-
export default KeepAliveTabs;
|