@ccs-ui/rc-pro 1.0.2 → 1.0.4

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.
@@ -0,0 +1,25 @@
1
+ import { CascaderProps } from 'antd';
2
+ import React from 'react';
3
+ import { HttpResult, RecordType } from '..';
4
+ type CacheType = {
5
+ /** 缓存key,同一个key将共享数据 */
6
+ cacheKey?: string;
7
+ /** 设置数据保持新鲜时间,在该时间内,我们认为数据是新鲜的,不会重新发起请求 */
8
+ staleTime?: number;
9
+ /** 设置数据缓存时间,超过该时间,我们会清空该条缓存数据 */
10
+ cacheTime?: number;
11
+ };
12
+ type ApiCascaderProps = CascaderProps & {
13
+ cache?: CacheType;
14
+ /** 依赖参数 */
15
+ defaultParams?: RecordType;
16
+ /** 查询请求 */
17
+ onQuery?: (dependParams?: RecordType) => Promise<HttpResult<any[]>>;
18
+ };
19
+ /**
20
+ * 基于接口查询的select组件
21
+ * @param CcsSelectProps
22
+ * @returns
23
+ */
24
+ export default function CcsApiCascader({ onQuery, cache, defaultParams, ...restProps }: ApiCascaderProps): React.JSX.Element;
25
+ export {};
@@ -0,0 +1,72 @@
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
+ 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
+ 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); }
9
+ 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
10
+ 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); } }
11
+ 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); }); }; }
12
+ 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; }
13
+ 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; }
14
+ import { useRequest } from 'ahooks';
15
+ import { Cascader } from 'antd';
16
+ import _isArray from 'lodash/isArray';
17
+ import React, { useEffect } from 'react';
18
+ /**
19
+ * 基于接口查询的select组件
20
+ * @param CcsSelectProps
21
+ * @returns
22
+ */
23
+ export default function CcsApiCascader(_ref) {
24
+ var onQuery = _ref.onQuery,
25
+ cache = _ref.cache,
26
+ _ref$defaultParams = _ref.defaultParams,
27
+ defaultParams = _ref$defaultParams === void 0 ? {} : _ref$defaultParams,
28
+ restProps = _objectWithoutProperties(_ref, _excluded);
29
+ var _useRequest = useRequest( /*#__PURE__*/function () {
30
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
31
+ var result;
32
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
33
+ while (1) switch (_context.prev = _context.next) {
34
+ case 0:
35
+ _context.next = 2;
36
+ return onQuery(params);
37
+ case 2:
38
+ result = _context.sent;
39
+ if (!(result !== null && result !== void 0 && result.success && result.data && _isArray(result.data))) {
40
+ _context.next = 5;
41
+ break;
42
+ }
43
+ return _context.abrupt("return", result.data);
44
+ case 5:
45
+ return _context.abrupt("return", []);
46
+ case 6:
47
+ case "end":
48
+ return _context.stop();
49
+ }
50
+ }, _callee);
51
+ }));
52
+ return function (_x) {
53
+ return _ref2.apply(this, arguments);
54
+ };
55
+ }(), _objectSpread({
56
+ manual: true
57
+ }, cache || {})),
58
+ loading = _useRequest.loading,
59
+ _useRequest$data = _useRequest.data,
60
+ data = _useRequest$data === void 0 ? [] : _useRequest$data,
61
+ run = _useRequest.run;
62
+ useEffect(function () {
63
+ if (onQuery) run(defaultParams);
64
+ }, []);
65
+ return /*#__PURE__*/React.createElement(Cascader, _extends({
66
+ options: data,
67
+ loading: loading,
68
+ style: {
69
+ width: '100%'
70
+ }
71
+ }, restProps));
72
+ }
@@ -1,12 +1,15 @@
1
1
  import React, { CSSProperties } from 'react';
2
+ import { RGBColor } from 'react-color';
2
3
  import './index.less';
3
4
  export interface PropsType {
4
5
  /** 指定选中项 */
5
- value?: any;
6
- /** 选择完成后的回调 */
7
- onChange?: Function;
6
+ value?: RGBColor;
7
+ /** 占位 */
8
+ placeholder?: string;
8
9
  /** 内部样式 */
9
10
  style?: CSSProperties;
11
+ /** 选择完成后的回调 */
12
+ onChange?: (value: RGBColor) => void;
10
13
  }
11
14
  /**
12
15
  * 颜色选择组件
@@ -1,2 +1,2 @@
1
- declare const destroyDrawerFns: Array<Function>;
1
+ declare const destroyDrawerFns: Array<() => void>;
2
2
  export default destroyDrawerFns;
@@ -1,2 +1,2 @@
1
- declare const useOnceEvent: (fn: Function) => (...args: any) => void;
1
+ declare const useOnceEvent: (fn: (...params: any) => void) => (...args: any) => void;
2
2
  export default useOnceEvent;
package/es/index.d.ts CHANGED
@@ -129,6 +129,7 @@ interface RouteHistoryType {
129
129
  time: Date;
130
130
  }
131
131
  export { default as CcsAuth } from './auth';
132
+ export { default as CcsApiCascader } from './cascader';
132
133
  export { default as CCS } from './ccs';
133
134
  export { default as CcsColorPicker } from './color-picker';
134
135
  export { default as CcsConfigProvider } from './config';
@@ -138,7 +139,7 @@ export { default as CcsFullScreenButton } from './full-screen';
138
139
  export { default as useCcsGlobal } from './hooks/use-global';
139
140
  export { default as useCcsOnceEvent } from './hooks/use-once-event';
140
141
  export { default as useCcsPage } from './hooks/use-page';
141
- export { default as useCcsTabsChange } from './hooks/use-tabs';
142
+ export { default as useCcsTabs } from './hooks/use-tabs';
142
143
  export { default as useCcsWindow } from './hooks/use-window';
143
144
  export { default as CcsIntervalButton } from './interval-button';
144
145
  export { default as CcsKeepAliveTabs } from './keep-alive-tabs';
package/es/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // any param
2
2
 
3
3
  export { default as CcsAuth } from "./auth";
4
+ export { default as CcsApiCascader } from "./cascader";
4
5
  export { default as CCS } from "./ccs";
5
6
  export { default as CcsColorPicker } from "./color-picker";
6
7
  export { default as CcsConfigProvider } from "./config";
@@ -10,7 +11,7 @@ export { default as CcsFullScreenButton } from "./full-screen";
10
11
  export { default as useCcsGlobal } from "./hooks/use-global";
11
12
  export { default as useCcsOnceEvent } from "./hooks/use-once-event";
12
13
  export { default as useCcsPage } from "./hooks/use-page";
13
- export { default as useCcsTabsChange } from "./hooks/use-tabs";
14
+ export { default as useCcsTabs } from "./hooks/use-tabs";
14
15
  export { default as useCcsWindow } from "./hooks/use-window";
15
16
  export { default as CcsIntervalButton } from "./interval-button";
16
17
  export { default as CcsKeepAliveTabs } from "./keep-alive-tabs";
@@ -1,15 +1,18 @@
1
1
  import { ButtonProps } from 'antd';
2
2
  import React from 'react';
3
- interface PropsType extends ButtonProps {
3
+ interface CcsIntervalButton extends ButtonProps {
4
4
  /** 计时数 */
5
- num: number;
5
+ num?: number;
6
6
  /** 包含字符串`num`的文本内容 */
7
- disabledText: string;
7
+ disabledText?: string;
8
8
  /** 缓存key */
9
9
  cacheKey?: string;
10
10
  }
11
- export type IntervalInstance = {
12
- start: () => void;
13
- };
14
- declare const _default: React.ForwardRefExoticComponent<PropsType & React.RefAttributes<IntervalInstance>>;
15
- export default _default;
11
+ /**
12
+ * 倒计时按钮组件
13
+ * @param PropsType
14
+ * @param IntervalInstance
15
+ * @returns
16
+ */
17
+ declare function IntervalButton({ num, cacheKey, disabledText, children, ...restProps }: CcsIntervalButton): React.JSX.Element | null;
18
+ export default IntervalButton;
@@ -14,7 +14,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
14
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
15
  import { useInterval } from 'ahooks';
16
16
  import { Button } from 'antd';
17
- import React, { forwardRef, useImperativeHandle, useLayoutEffect, useState } from 'react';
17
+ import React, { useLayoutEffect, useMemo, useState } from 'react';
18
18
  import { CcsUtils } from "../";
19
19
  /**
20
20
  * 倒计时按钮组件
@@ -22,8 +22,9 @@ import { CcsUtils } from "../";
22
22
  * @param IntervalInstance
23
23
  * @returns
24
24
  */
25
- var IntervalButton = function IntervalButton(_ref, ref) {
26
- var num = _ref.num,
25
+ function IntervalButton(_ref) {
26
+ var _ref$num = _ref.num,
27
+ num = _ref$num === void 0 ? 60 : _ref$num,
27
28
  cacheKey = _ref.cacheKey,
28
29
  disabledText = _ref.disabledText,
29
30
  children = _ref.children,
@@ -36,6 +37,9 @@ var IntervalButton = function IntervalButton(_ref, ref) {
36
37
  _useState4 = _slicedToArray(_useState3, 2),
37
38
  codeInterval = _useState4[0],
38
39
  setCodeInterval = _useState4[1];
40
+ var key = useMemo(function () {
41
+ return cacheKey || window.location.host;
42
+ }, []);
39
43
 
40
44
  // 判断是否有未完成的倒计时
41
45
  useLayoutEffect(function () {
@@ -45,30 +49,26 @@ var IntervalButton = function IntervalButton(_ref, ref) {
45
49
  return _regeneratorRuntime().wrap(function _callee$(_context) {
46
50
  while (1) switch (_context.prev = _context.next) {
47
51
  case 0:
48
- if (!cacheKey) {
49
- _context.next = 11;
50
- break;
51
- }
52
- _context.next = 3;
53
- return CcsUtils.getStroage(cacheKey);
54
- case 3:
52
+ _context.next = 2;
53
+ return CcsUtils.getStroage(key);
54
+ case 2:
55
55
  s = _context.sent;
56
56
  if (!s) {
57
- _context.next = 11;
57
+ _context.next = 10;
58
58
  break;
59
59
  }
60
60
  currentTime = new Date().getTime();
61
61
  time = Math.round((currentTime - s.time) / 1000);
62
62
  if (!(time < s.num)) {
63
- _context.next = 11;
63
+ _context.next = 10;
64
64
  break;
65
65
  }
66
66
  setCount(s.num - time);
67
67
  setCodeInterval(1000);
68
68
  return _context.abrupt("return");
69
- case 11:
69
+ case 10:
70
70
  setCount(num);
71
- case 12:
71
+ case 11:
72
72
  case "end":
73
73
  return _context.stop();
74
74
  }
@@ -86,33 +86,28 @@ var IntervalButton = function IntervalButton(_ref, ref) {
86
86
  if (count - 1 === 0) {
87
87
  setCodeInterval(null);
88
88
  setCount(num);
89
- if (cacheKey) CcsUtils.removeStroage(cacheKey);
89
+ if (key) CcsUtils.removeStroage(key);
90
90
  return;
91
91
  }
92
92
  setCount(count - 1);
93
93
  }, codeInterval, {
94
94
  immediate: true
95
95
  });
96
-
97
- // ref start interval
98
- useImperativeHandle(ref, function () {
99
- return {
100
- start: function start() {
101
- setCodeInterval(1000);
102
- if (cacheKey) {
103
- CcsUtils.setStroage(cacheKey, {
104
- num: num,
105
- time: new Date().getTime()
106
- });
107
- }
108
- }
109
- };
110
- });
111
96
  var disabled = count !== 0 && count !== num;
97
+ var onStart = function onStart() {
98
+ setCodeInterval(1000);
99
+ if (key) {
100
+ CcsUtils.setStroage(key, {
101
+ num: num,
102
+ time: new Date().getTime()
103
+ });
104
+ }
105
+ };
112
106
  return count === -1 ? null : /*#__PURE__*/React.createElement(Button, _extends({
113
107
  type: "primary"
114
108
  }, restProps, {
109
+ onClick: onStart,
115
110
  disabled: disabled
116
- }), disabled ? disabledText.replace('num', count) : "".concat(children));
117
- };
118
- export default /*#__PURE__*/forwardRef(IntervalButton);
111
+ }), disabled ? "".concat(count, "\u79D2").concat(disabledText) : "".concat(children));
112
+ }
113
+ export default IntervalButton;
@@ -1,8 +1,12 @@
1
- import React, { ReactNode } from 'react';
2
- interface PropsType {
3
- loading: boolean;
1
+ import React from 'react';
2
+ interface CcsLoadingProps {
3
+ /**
4
+ * loading 状态
5
+ * @default false
6
+ */
7
+ loading?: boolean;
8
+ /** loading 文字说明 */
4
9
  loadingTip?: string;
5
- children?: ReactNode;
6
10
  }
7
- declare const LoadingComponent: ({ loading, loadingTip, children, }: PropsType) => React.JSX.Element | null;
8
- export default LoadingComponent;
11
+ declare const Loading: ({ loading, loadingTip }: CcsLoadingProps) => React.JSX.Element | null;
12
+ export default Loading;
@@ -1,10 +1,10 @@
1
+ import { LoadingOutlined } from '@ant-design/icons';
1
2
  import { Spin } from 'antd';
2
3
  import React from 'react';
3
- var LoadingComponent = function LoadingComponent(_ref) {
4
+ var Loading = function Loading(_ref) {
4
5
  var loading = _ref.loading,
5
6
  _ref$loadingTip = _ref.loadingTip,
6
- loadingTip = _ref$loadingTip === void 0 ? '加载中...' : _ref$loadingTip,
7
- children = _ref.children;
7
+ loadingTip = _ref$loadingTip === void 0 ? '加载中...' : _ref$loadingTip;
8
8
  return loading ? /*#__PURE__*/React.createElement("div", {
9
9
  style: {
10
10
  position: 'absolute',
@@ -20,8 +20,17 @@ var LoadingComponent = function LoadingComponent(_ref) {
20
20
  transform: 'translate(-50%, -50%)',
21
21
  position: 'absolute'
22
22
  }
23
- }, children || /*#__PURE__*/React.createElement(Spin, {
24
- tip: loadingTip
25
- }))) : null;
23
+ }, /*#__PURE__*/React.createElement(Spin, {
24
+ indicator: /*#__PURE__*/React.createElement(LoadingOutlined, {
25
+ style: {
26
+ fontSize: 24
27
+ }
28
+ })
29
+ }), /*#__PURE__*/React.createElement("a", {
30
+ style: {
31
+ fontSize: 14,
32
+ paddingLeft: 10
33
+ }
34
+ }, loadingTip))) : null;
26
35
  };
27
- export default LoadingComponent;
36
+ export default Loading;
@@ -4,6 +4,7 @@
4
4
  padding: 20px 24px 10px;
5
5
  box-sizing: border-box;
6
6
  }
7
+
7
8
  margin-bottom: 0;
8
9
  }
9
10
 
@@ -1,2 +1,2 @@
1
- declare const destroyModalFns: Array<Function>;
1
+ declare const destroyModalFns: Array<() => void>;
2
2
  export default destroyModalFns;
@@ -1,10 +1,11 @@
1
+ import { CardProps } from 'antd';
1
2
  import React, { CSSProperties, FC, ReactNode } from 'react';
2
3
  import './index.less';
3
4
  interface ClassProps {
4
5
  className?: string;
5
6
  style?: CSSProperties;
6
7
  }
7
- interface GridProps extends ClassProps {
8
+ interface CcsProGridProps extends ClassProps {
8
9
  title?: string;
9
10
  titleStyle?: CSSProperties;
10
11
  titleExtra?: ReactNode;
@@ -12,16 +13,14 @@ interface GridProps extends ClassProps {
12
13
  hideTitle?: boolean;
13
14
  children?: ReactNode;
14
15
  }
15
- interface ColProps extends ClassProps {
16
- title?: string;
17
- titleStyle?: CSSProperties;
18
- titleExtra?: ReactNode;
16
+ interface ColProps extends CardProps {
19
17
  colSpan?: string | number;
20
- children?: ReactNode;
18
+ colStyle?: CSSProperties;
19
+ colClassName?: string;
21
20
  }
22
- interface GridInstance extends FC<GridProps> {
21
+ interface GridInstance extends FC<CcsProGridProps> {
23
22
  Col: typeof GridCol;
24
23
  }
25
- declare const GridCol: ({ colSpan, children, title, titleStyle, titleExtra, className, style, }: ColProps) => React.JSX.Element;
24
+ declare const GridCol: ({ colSpan, colClassName, colStyle, ...otherProps }: ColProps) => React.JSX.Element;
26
25
  declare const ProGrid: GridInstance;
27
26
  export default ProGrid;
@@ -1,49 +1,36 @@
1
- var _excluded = ["title", "titleStyle", "titleExtra", "hideTitle", "bordered", "children"];
2
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
+ var _excluded = ["colSpan", "colClassName", "colStyle"],
3
+ _excluded2 = ["title", "titleStyle", "titleExtra", "hideTitle", "bordered", "children"];
3
4
  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 _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; }
5
- 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; }
6
5
  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; }
7
6
  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; }
8
7
  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; }
9
8
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
9
  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); }
10
+ 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; }
11
+ 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; }
12
+ import { Card } from 'antd';
11
13
  import classNames from 'classnames';
12
14
  import React from 'react';
13
- import { CCS } from "../";
14
15
  import { GridContext } from "./context";
15
16
  import "./index.less";
16
17
  var GridCol = function GridCol(_ref) {
17
18
  var colSpan = _ref.colSpan,
18
- children = _ref.children,
19
- title = _ref.title,
20
- _ref$titleStyle = _ref.titleStyle,
21
- titleStyle = _ref$titleStyle === void 0 ? {} : _ref$titleStyle,
22
- titleExtra = _ref.titleExtra,
23
- className = _ref.className,
24
- style = _ref.style;
25
- var renderContent = /*#__PURE__*/React.createElement(React.Fragment, null, title ? /*#__PURE__*/React.createElement("div", {
26
- className: "ccs-pl-title ",
27
- style: _objectSpread({
28
- display: 'flex',
29
- justifyContent: 'space-between',
30
- fontSize: 15
31
- }, titleStyle)
32
- }, /*#__PURE__*/React.createElement("div", null, title), /*#__PURE__*/React.createElement("div", {
33
- className: "ccs-pg-extra"
34
- }, titleExtra)) : null, children);
19
+ colClassName = _ref.colClassName,
20
+ colStyle = _ref.colStyle,
21
+ otherProps = _objectWithoutProperties(_ref, _excluded);
35
22
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
36
- className: classNames('ccs-pg-col', className),
23
+ className: classNames('ccs-pg-col', colClassName),
37
24
  style: colSpan ? _objectSpread({
38
25
  width: colSpan,
39
26
  flexShrink: 0
40
- }, style) : _objectSpread({
27
+ }, colStyle) : _objectSpread({
41
28
  display: 'flex',
42
29
  width: 0,
43
30
  flex: 'auto',
44
31
  flexDirection: 'column'
45
- }, style)
46
- }, renderContent));
32
+ }, colStyle)
33
+ }, /*#__PURE__*/React.createElement(Card, otherProps)));
47
34
  };
48
35
  var Grid = function Grid(_ref2) {
49
36
  var title = _ref2.title,
@@ -53,11 +40,7 @@ var Grid = function Grid(_ref2) {
53
40
  hideTitle = _ref2.hideTitle,
54
41
  bordered = _ref2.bordered,
55
42
  children = _ref2.children,
56
- restProps = _objectWithoutProperties(_ref2, _excluded);
57
- var IsTabsPage = CCS.GlobalConfig.IsTabsPage;
58
- var menu = {
59
- nodeName: ''
60
- };
43
+ restProps = _objectWithoutProperties(_ref2, _excluded2);
61
44
  return /*#__PURE__*/React.createElement(GridContext.Provider, {
62
45
  value: {
63
46
  inProGrid: true
@@ -66,13 +49,13 @@ var Grid = function Grid(_ref2) {
66
49
  className: classNames({
67
50
  'ccs-pg-border': bordered
68
51
  })
69
- }), !hideTitle && (title || IsTabsPage && menu !== null && menu !== void 0 && menu.nodeName) ? /*#__PURE__*/React.createElement("div", {
52
+ }), !hideTitle && title ? /*#__PURE__*/React.createElement("div", {
70
53
  style: _objectSpread({
71
54
  display: 'flex',
72
55
  justifyContent: 'space-between'
73
56
  }, titleStyle),
74
57
  className: "ccs-pl-title"
75
- }, /*#__PURE__*/React.createElement("div", null, " ", title || (menu === null || menu === void 0 ? void 0 : menu.nodeName)), /*#__PURE__*/React.createElement("div", {
58
+ }, /*#__PURE__*/React.createElement("div", null, title), /*#__PURE__*/React.createElement("div", {
76
59
  className: "ccs-pg-extra"
77
60
  }, titleExtra)) : null, /*#__PURE__*/React.createElement("div", {
78
61
  className: "ccs-pl-table-content"
@@ -57,7 +57,7 @@ export interface FormItemType {
57
57
  /** 格式化值 */
58
58
  onFormat?: (e: any) => any;
59
59
  }
60
- interface CcsTableProps<T> extends TableProps<T> {
60
+ export interface CcsTableProps<T> extends TableProps<T> {
61
61
  data?: TableDataType<T>;
62
62
  /** request 方法 */
63
63
  request?: (params: any) => void;
@@ -93,6 +93,8 @@ export interface CcsProTableProps<T> {
93
93
  formInitValues?: ParamType;
94
94
  /** 按钮 操作部分 */
95
95
  toolbar?: ReactElement;
96
+ /** 展开查询条件,默认false */
97
+ expandForm?: boolean;
96
98
  /** table 数据区域 */
97
99
  table?: CcsTableProps<T>;
98
100
  /** table style */
@@ -95,6 +95,7 @@ var ProTable = function ProTable(props) {
95
95
  children = props.children,
96
96
  watermark = props.watermark,
97
97
  className = props.className,
98
+ expandForm = props.expandForm,
98
99
  tableStyle = props.tableStyle,
99
100
  searchEvent = props.searchEvent,
100
101
  _props$formItems = props.formItems,
@@ -556,6 +557,7 @@ var ProTable = function ProTable(props) {
556
557
  toolbar: toolbar,
557
558
  columns: columns,
558
559
  formItems: formItems,
560
+ expandForm: expandForm,
559
561
  hasMore: formItems.length > 1,
560
562
  formInitValues: formInitValues,
561
563
  isInModalOrDrawer: isInModalOrDrawer,
@@ -1,8 +1,8 @@
1
1
  import { EventEmitter } from 'ahooks/lib/useEventEmitter';
2
2
  import { FormInstance } from 'antd/lib/form';
3
3
  import React from 'react';
4
- import { CcsProTableType } from './';
5
- interface PropsType<T> extends Pick<CcsProTableType<T>, 'toolbar' | 'formItems' | 'formInitValues'> {
4
+ import { CcsProTableProps } from './';
5
+ interface PropsType<T> extends Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formInitValues' | 'expandForm'> {
6
6
  columns?: any;
7
7
  /** 更多查询条件 */
8
8
  hasMore?: boolean;
@@ -14,5 +14,5 @@ interface PropsType<T> extends Pick<CcsProTableType<T>, 'toolbar' | 'formItems'
14
14
  event$: EventEmitter<any>;
15
15
  }
16
16
  /** 操作按钮、查询,重置、列筛选、 */
17
- declare function SearchComponent<T>({ form, toolbar, columns, hasMore, formItems, formInitValues, isInModalOrDrawer, event$, onReset, onSearch, }: PropsType<T>): React.JSX.Element;
17
+ declare function SearchComponent<T>({ form, toolbar, columns, hasMore, expandForm, formItems, formInitValues, isInModalOrDrawer, event$, onReset, onSearch, }: PropsType<T>): React.JSX.Element;
18
18
  export default SearchComponent;
@@ -43,6 +43,7 @@ function SearchComponent(_ref) {
43
43
  toolbar = _ref.toolbar,
44
44
  columns = _ref.columns,
45
45
  hasMore = _ref.hasMore,
46
+ expandForm = _ref.expandForm,
46
47
  _ref$formItems = _ref.formItems,
47
48
  formItems = _ref$formItems === void 0 ? [] : _ref$formItems,
48
49
  formInitValues = _ref.formInitValues,
@@ -58,7 +59,7 @@ function SearchComponent(_ref) {
58
59
  _useState4 = _slicedToArray(_useState3, 2),
59
60
  filterColumns = _useState4[0],
60
61
  setFilterColumns = _useState4[1];
61
- var _useState5 = useState(false),
62
+ var _useState5 = useState(expandForm),
62
63
  _useState6 = _slicedToArray(_useState5, 2),
63
64
  isShowMore = _useState6[0],
64
65
  setIsShowMore = _useState6[1];
@@ -9,7 +9,7 @@ type CacheType = {
9
9
  /** 设置数据缓存时间,超过该时间,我们会清空该条缓存数据 */
10
10
  cacheTime?: number;
11
11
  };
12
- type CcsSelectProps = SelectProps & {
12
+ type ApiSelectProps = SelectProps & {
13
13
  cache?: CacheType;
14
14
  /** 依赖参数 */
15
15
  defaultParams?: RecordType;
@@ -21,5 +21,5 @@ type CcsSelectProps = SelectProps & {
21
21
  * @param CcsSelectProps
22
22
  * @returns
23
23
  */
24
- export default function CcsApiSelect({ onQuery, cache, defaultParams, ...restProps }: CcsSelectProps): React.JSX.Element;
24
+ export default function CcsApiSelect({ onQuery, cache, defaultParams, ...restProps }: ApiSelectProps): React.JSX.Element;
25
25
  export {};
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { CcsProTableProps } from '../types';
2
+ import { CcsTableProps } from '../pro-table';
3
3
  import './index.less';
4
- export type CcsTableProps<T> = Omit<CcsProTableProps<T>, 'request' | 'requestParam' | 'fillSpace'>;
5
- declare const CustomTable: <T extends object = any>(props: CcsTableProps<T>) => React.JSX.Element;
4
+ type TableProps<T> = Omit<CcsTableProps<T>, 'request' | 'requestParam'>;
5
+ declare const CustomTable: <T extends object = any>(props: TableProps<T>) => React.JSX.Element;
6
6
  export default CustomTable;
@@ -13,7 +13,7 @@ export interface CcsTriggerChildrenProps<T = any> {
13
13
  /** 选择框显示名称 */
14
14
  onChangeLabel?: (text: string | undefined) => void;
15
15
  }
16
- export interface CcsTriggerPropsType {
16
+ export interface CcsTriggerProps {
17
17
  /** 下拉框宽度 */
18
18
  width?: number;
19
19
  /** 下拉框高度 */
@@ -56,5 +56,5 @@ export interface CcsTriggerPropsType {
56
56
  * @param CcsTriggerPropsType
57
57
  * @returns
58
58
  */
59
- declare const TriggerComponent: (props: CcsTriggerPropsType) => React.JSX.Element;
59
+ declare const TriggerComponent: (props: CcsTriggerProps) => React.JSX.Element;
60
60
  export default TriggerComponent;
@@ -1,5 +1,5 @@
1
1
  import dayjs from 'dayjs';
2
- import { HttpResult } from './';
2
+ import { HttpResult } from '..';
3
3
  interface DayjsType extends dayjs.Dayjs {
4
4
  fromNow(withoutSuffix?: boolean): string;
5
5
  from(compared: dayjs.ConfigType, withoutSuffix?: boolean): string;
@@ -7,14 +7,46 @@ interface DayjsType extends dayjs.Dayjs {
7
7
  to(compared: dayjs.ConfigType, withoutSuffix?: boolean): string;
8
8
  }
9
9
  export default class utils {
10
+ /**
11
+ * 是函数?
12
+ * @param obj
13
+ * @returns
14
+ */
10
15
  static isFunction(obj: any): obj is Function;
16
+ /**
17
+ * 获取stroage
18
+ * @param key
19
+ * @returns
20
+ */
11
21
  static getStroage(key: string): Promise<unknown>;
22
+ /**
23
+ * 设置stroage
24
+ * @param key
25
+ * @param value
26
+ * @returns
27
+ */
12
28
  static setStroage(key: string, value: any): Promise<any>;
29
+ /** 删除stroage */
13
30
  static removeStroage(key: string): Promise<void>;
14
31
  static showLogWarning(message: string): void;
32
+ /**
33
+ * 开发环境抛警告
34
+ * @param valid
35
+ * @param message
36
+ */
15
37
  static showWarning(valid: boolean, message: string): void;
38
+ /** nodejs 环境 */
16
39
  static isNode: boolean;
40
+ /**
41
+ * 浏览器环境
42
+ * @returns
43
+ */
17
44
  static isBrowser(): boolean;
45
+ /**
46
+ * 格式化成dayjs
47
+ * @param date
48
+ * @returns
49
+ */
18
50
  static dayjs(date?: string | number | Date | dayjs.Dayjs | null | undefined): DayjsType;
19
51
  /**
20
52
  * 空判断
@@ -52,7 +84,7 @@ export default class utils {
52
84
  */
53
85
  static stringToHex(str: string): string;
54
86
  /**
55
- * http result msg
87
+ * 根据HttpResult返回结果提示成功或失败
56
88
  * @param result
57
89
  * @param successText
58
90
  * @param failText
@@ -5,7 +5,6 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
5
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
6
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
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
- /* eslint-disable @typescript-eslint/ban-types */
9
8
  import { message, Modal } from 'antd';
10
9
  import _dayjs from 'dayjs';
11
10
  import zhCn from 'dayjs/locale/zh-cn';
@@ -23,19 +22,40 @@ var utils = /*#__PURE__*/function () {
23
22
  }
24
23
  _createClass(utils, null, [{
25
24
  key: "isFunction",
26
- value: function isFunction(obj) {
25
+ value:
26
+ /**
27
+ * 是函数?
28
+ * @param obj
29
+ * @returns
30
+ */
31
+ function isFunction(obj) {
27
32
  return typeof obj === 'function';
28
33
  }
34
+
35
+ /**
36
+ * 获取stroage
37
+ * @param key
38
+ * @returns
39
+ */
29
40
  }, {
30
41
  key: "getStroage",
31
42
  value: function getStroage(key) {
32
43
  return localForage.getItem(key);
33
44
  }
45
+
46
+ /**
47
+ * 设置stroage
48
+ * @param key
49
+ * @param value
50
+ * @returns
51
+ */
34
52
  }, {
35
53
  key: "setStroage",
36
54
  value: function setStroage(key, value) {
37
55
  return localForage.setItem(key, value);
38
56
  }
57
+
58
+ /** 删除stroage */
39
59
  }, {
40
60
  key: "removeStroage",
41
61
  value: function removeStroage(key) {
@@ -48,19 +68,38 @@ var utils = /*#__PURE__*/function () {
48
68
  console.log("%c ".concat(message), 'color:#ff5722');
49
69
  }
50
70
  }
71
+
72
+ /**
73
+ * 开发环境抛警告
74
+ * @param valid
75
+ * @param message
76
+ */
51
77
  }, {
52
78
  key: "showWarning",
53
79
  value: function showWarning(valid, message) {
54
80
  devWarning(valid, message);
55
81
  }
82
+
83
+ /** nodejs 环境 */
56
84
  }, {
57
85
  key: "isBrowser",
58
- value: function isBrowser() {
86
+ value:
87
+ /**
88
+ * 浏览器环境
89
+ * @returns
90
+ */
91
+ function isBrowser() {
59
92
  if (process.env.NODE_ENV === 'TEST') {
60
93
  return true;
61
94
  }
62
95
  return typeof window !== 'undefined' && typeof window.document !== 'undefined' && !this.isNode;
63
96
  }
97
+
98
+ /**
99
+ * 格式化成dayjs
100
+ * @param date
101
+ * @returns
102
+ */
64
103
  }, {
65
104
  key: "dayjs",
66
105
  value: function dayjs(date) {
@@ -136,7 +175,7 @@ var utils = /*#__PURE__*/function () {
136
175
  }
137
176
 
138
177
  /**
139
- * http result msg
178
+ * 根据HttpResult返回结果提示成功或失败
140
179
  * @param result
141
180
  * @param successText
142
181
  * @param failText
@@ -11,15 +11,16 @@ export interface VirtualInstance {
11
11
  scrollTop: (top: number) => void;
12
12
  }
13
13
  export interface VirtualListProps {
14
- className?: string;
15
- style?: CSSProperties;
16
14
  /** 容器高度 */
17
15
  height?: number;
18
16
  /** 记录条数 */
19
17
  rowCount: number;
20
18
  /** 行高 */
21
19
  rowHeight: number;
22
- /** 自动隐藏滚动条 default true */
20
+ /**
21
+ * 自动隐藏滚动条
22
+ * @default true
23
+ */
23
24
  autoHideScroll?: boolean;
24
25
  /** 显示条数 */
25
26
  overscanRowCount: number;
@@ -27,6 +28,8 @@ export interface VirtualListProps {
27
28
  rowCountChangeScrollTop?: boolean;
28
29
  /** instance */
29
30
  virtualRef?: RefObject<VirtualInstance>;
31
+ style?: CSSProperties;
32
+ className?: string;
30
33
  /** 渲染row */
31
34
  rowRenderer: ({ rowHeight, index }: RowRendererProps) => ReactNode;
32
35
  /** scroll event */
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  export type WaterMarkProps = {
3
3
  /** 水印文字内容 */
4
4
  content?: string;
@@ -55,7 +55,10 @@ export type WaterMarkProps = {
55
55
  * @default 16
56
56
  */
57
57
  fontSize?: number | string;
58
- children?: React.ReactElement;
58
+ /**
59
+ * 组件 children
60
+ */
61
+ children?: ReactNode;
59
62
  };
60
63
  /**
61
64
  * 水印组件
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "es/index.js",
@@ -48,7 +48,6 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@ant-design/icons": "^5.1.4",
51
- "@ccs-ui/rc-pro": "^1.0.0",
52
51
  "ahooks": "^3.7.7",
53
52
  "antd": "^5.5.2",
54
53
  "classnames": "^2.3.2",