ebaoferc 2.0.2 → 2.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,12 @@
1
+ import type { CSSProperties, ReactNode } from 'react';
2
+ import './style.less';
3
+ interface Props {
4
+ title: string;
5
+ tag?: ReactNode;
6
+ collapse?: boolean;
7
+ children?: ReactNode;
8
+ fontSize?: CSSProperties['fontSize'];
9
+ contentMargin?: boolean;
10
+ }
11
+ export default function BlockHeader({ title, tag, collapse, fontSize, children, contentMargin, }: Props): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,69 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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); }
4
+ 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; }
5
+ 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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useToggle } from 'ahooks';
8
+ import cls from 'classnames';
9
+ import icon from "./block-header-icon2x.png";
10
+ import "./style.less";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ export default function BlockHeader(_ref) {
14
+ var title = _ref.title,
15
+ tag = _ref.tag,
16
+ _ref$collapse = _ref.collapse,
17
+ collapse = _ref$collapse === void 0 ? true : _ref$collapse,
18
+ fontSize = _ref.fontSize,
19
+ children = _ref.children,
20
+ _ref$contentMargin = _ref.contentMargin,
21
+ contentMargin = _ref$contentMargin === void 0 ? true : _ref$contentMargin;
22
+ var _useToggle = useToggle(false),
23
+ _useToggle2 = _slicedToArray(_useToggle, 2),
24
+ collapsed = _useToggle2[0],
25
+ toggle = _useToggle2[1].toggle;
26
+ var renderTitle = function renderTitle() {
27
+ return /*#__PURE__*/_jsx("div", {
28
+ className: cls('title', 'titleRibbon'),
29
+ children: /*#__PURE__*/_jsxs("div", {
30
+ className: cls('titleInner'),
31
+ children: [/*#__PURE__*/_jsxs("div", {
32
+ className: 'titleWithTag',
33
+ children: [/*#__PURE__*/_jsx("div", {
34
+ className: cls('titleText'),
35
+ style: {
36
+ fontSize: fontSize
37
+ },
38
+ children: title
39
+ }), tag && /*#__PURE__*/_jsx("div", {
40
+ className: 'tagContainer',
41
+ children: tag
42
+ })]
43
+ }), collapse && /*#__PURE__*/_jsx("div", {
44
+ className: 'iconContainer',
45
+ onClick: toggle,
46
+ children: /*#__PURE__*/_jsx("img", {
47
+ src: icon,
48
+ style: {
49
+ transform: "rotate(".concat(collapsed ? 180 : 0, "deg)")
50
+ }
51
+ })
52
+ })]
53
+ })
54
+ });
55
+ };
56
+ var renderChildren = function renderChildren() {
57
+ return /*#__PURE__*/_jsx("div", {
58
+ className: cls({
59
+ contentCollapsed: collapsed,
60
+ content: contentMargin
61
+ }, 'blockHeader__children'),
62
+ children: children
63
+ });
64
+ };
65
+ return /*#__PURE__*/_jsxs("div", {
66
+ className: cls('blockHeader', collapsed && 'blockHeaderClose'),
67
+ children: [renderTitle(), renderChildren()]
68
+ });
69
+ }
@@ -0,0 +1,52 @@
1
+ .blockHeader {
2
+ &.blockHeaderClose {
3
+ margin-bottom: 20px;
4
+ }
5
+
6
+ .title {
7
+ display: flex;
8
+ align-items: center;
9
+ padding-bottom: 10px;
10
+ border-bottom: 1px solid #e6e6e6;
11
+ }
12
+
13
+ .titleInner {
14
+ display: flex;
15
+ align-content: center;
16
+ justify-content: space-between;
17
+ width: 100%;
18
+ }
19
+
20
+ .titleWithTag {
21
+ display: flex;
22
+ align-items: center;
23
+ }
24
+
25
+ .titleText {
26
+ color: #000;
27
+ font-weight: bold;
28
+ font-size: 14px;
29
+ }
30
+
31
+ .tagContainer {
32
+ margin-left: 5px;
33
+ }
34
+
35
+ .iconContainer {
36
+ display: flex;
37
+ align-items: center;
38
+ cursor: pointer;
39
+
40
+ img {
41
+ width: 24px;
42
+ }
43
+ }
44
+
45
+ .content {
46
+ padding: 20px 0 0;
47
+ }
48
+
49
+ .contentCollapsed {
50
+ display: none;
51
+ }
52
+ }
@@ -87,5 +87,5 @@ export declare namespace Process {
87
87
  const Orientation: typeof OrientationProcess;
88
88
  const Anchor: typeof AnchorProcess;
89
89
  const NodeValid: typeof NodeValidProcess;
90
- const getLayoutProcess: (options: Required<Mind.Options>) => (new () => Mind.Process.Lifecycle) | typeof HeirCenterLayoutProcess | typeof DescendantCenterLayoutProcess | typeof StructuredLayoutProcess;
90
+ const getLayoutProcess: (options: Required<Mind.Options>) => typeof DescendantCenterLayoutProcess | (new () => Mind.Process.Lifecycle) | typeof HeirCenterLayoutProcess | typeof StructuredLayoutProcess;
91
91
  }
@@ -61,6 +61,11 @@ var OverflowTooltip = function OverflowTooltip(_ref) {
61
61
  checkOverflow();
62
62
  };
63
63
 
64
+ // 初始化和文案变更时也计算一次,避免首次悬浮时未展示
65
+ useEffect(function () {
66
+ checkOverflow();
67
+ }, [text, maxLines]);
68
+
64
69
  // 动态生成行数限制样式
65
70
  var lineClampStyle = {
66
71
  display: '-webkit-box',
@@ -0,0 +1,34 @@
1
+ import type { ModalFormProps } from '@ant-design/pro-components';
2
+ import type { ButtonProps } from 'antd';
3
+ import type { ReactNode, Ref } from 'react';
4
+ import './index.less';
5
+ export type StyledModaType = 'add' | 'edit' | 'preview';
6
+ export interface StyledModalFormProps<T = any, TData = any> extends Omit<ModalFormProps<T>, 'open' | 'onFinish' | 'submitter' | 'children'> {
7
+ modalName?: string;
8
+ defaultType?: StyledModaType;
9
+ maxHeight?: boolean;
10
+ cancelButtonProps?: ButtonProps;
11
+ confirmButtonProps?: ButtonProps;
12
+ closeButtonProps?: ButtonProps;
13
+ confirmText?: string;
14
+ cancelText?: string;
15
+ closeText?: string;
16
+ onFinish?: (values: T, context: {
17
+ type: StyledModaType;
18
+ data?: TData;
19
+ }) => Promise<boolean | void | undefined> | boolean | void | undefined;
20
+ children?: ReactNode | ((context: {
21
+ type: StyledModaType;
22
+ data?: TData;
23
+ }) => ReactNode);
24
+ submitter?: ModalFormProps<T>['submitter'];
25
+ }
26
+ export type StyledModalFormRef<TData = any> = {
27
+ openModal: (data?: TData, type?: StyledModaType) => void;
28
+ closeModal: () => void;
29
+ getType: () => StyledModaType;
30
+ getData: () => TData | undefined;
31
+ };
32
+ export declare const StyledModalForm: <T = any, TData = any>(props: StyledModalFormProps<T, TData> & {
33
+ ref?: Ref<StyledModalFormRef<TData>>;
34
+ }) => JSX.Element;
@@ -0,0 +1,201 @@
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 = ["modalName", "defaultType", "maxHeight", "cancelButtonProps", "confirmButtonProps", "closeButtonProps", "confirmText", "cancelText", "closeText", "title", "submitter", "onFinish", "children", "modalProps", "disabled"];
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 { ModalForm } from '@ant-design/pro-components';
20
+ import { Button, Flex } from 'antd';
21
+ import classNames from 'classnames';
22
+ import { forwardRef, useImperativeHandle, useMemo, useState } from 'react';
23
+ import "./index.less";
24
+ import { jsx as _jsx } from "react/jsx-runtime";
25
+ import { jsxs as _jsxs } from "react/jsx-runtime";
26
+ function StyledModalFormCpn(props, ref) {
27
+ var modalName = props.modalName,
28
+ _props$defaultType = props.defaultType,
29
+ defaultType = _props$defaultType === void 0 ? 'add' : _props$defaultType,
30
+ _props$maxHeight = props.maxHeight,
31
+ maxHeight = _props$maxHeight === void 0 ? false : _props$maxHeight,
32
+ cancelButtonProps = props.cancelButtonProps,
33
+ confirmButtonProps = props.confirmButtonProps,
34
+ closeButtonProps = props.closeButtonProps,
35
+ _props$confirmText = props.confirmText,
36
+ confirmText = _props$confirmText === void 0 ? '确认' : _props$confirmText,
37
+ _props$cancelText = props.cancelText,
38
+ cancelText = _props$cancelText === void 0 ? '取消' : _props$cancelText,
39
+ _props$closeText = props.closeText,
40
+ closeText = _props$closeText === void 0 ? '关闭' : _props$closeText,
41
+ title = props.title,
42
+ submitter = props.submitter,
43
+ onFinish = props.onFinish,
44
+ children = props.children,
45
+ modalProps = props.modalProps,
46
+ disabled = props.disabled,
47
+ rest = _objectWithoutProperties(props, _excluded);
48
+ var _useState = useState(defaultType),
49
+ _useState2 = _slicedToArray(_useState, 2),
50
+ type = _useState2[0],
51
+ setType = _useState2[1];
52
+ var _useState3 = useState(false),
53
+ _useState4 = _slicedToArray(_useState3, 2),
54
+ open = _useState4[0],
55
+ setOpen = _useState4[1];
56
+ var _useState5 = useState(),
57
+ _useState6 = _slicedToArray(_useState5, 2),
58
+ data = _useState6[0],
59
+ setData = _useState6[1];
60
+ useImperativeHandle(ref, function () {
61
+ return {
62
+ openModal: function openModal(nextData, nextType) {
63
+ setData(nextData);
64
+ setType(nextType || defaultType);
65
+ setOpen(true);
66
+ },
67
+ closeModal: function closeModal() {
68
+ return setOpen(false);
69
+ },
70
+ getType: function getType() {
71
+ return type;
72
+ },
73
+ getData: function getData() {
74
+ return data;
75
+ }
76
+ };
77
+ }, [type, data, defaultType]);
78
+ var isPreview = useMemo(function () {
79
+ return type === 'preview';
80
+ }, [type]);
81
+ var handleFinish = /*#__PURE__*/function () {
82
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
83
+ var result;
84
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
85
+ while (1) switch (_context.prev = _context.next) {
86
+ case 0:
87
+ if (onFinish) {
88
+ _context.next = 3;
89
+ break;
90
+ }
91
+ setOpen(false);
92
+ return _context.abrupt("return", true);
93
+ case 3:
94
+ _context.next = 5;
95
+ return onFinish(values, {
96
+ type: type,
97
+ data: data
98
+ });
99
+ case 5:
100
+ result = _context.sent;
101
+ if (result !== false) {
102
+ setOpen(false);
103
+ }
104
+ return _context.abrupt("return", result);
105
+ case 8:
106
+ case "end":
107
+ return _context.stop();
108
+ }
109
+ }, _callee);
110
+ }));
111
+ return function handleFinish(_x) {
112
+ return _ref.apply(this, arguments);
113
+ };
114
+ }();
115
+ var handleCancel = function handleCancel(e) {
116
+ var _modalProps$onCancel;
117
+ modalProps === null || modalProps === void 0 || (_modalProps$onCancel = modalProps.onCancel) === null || _modalProps$onCancel === void 0 || _modalProps$onCancel.call(modalProps, e);
118
+ setOpen(false);
119
+ };
120
+ var mergedModalProps = _objectSpread(_objectSpread({
121
+ centered: true,
122
+ destroyOnHidden: true
123
+ }, modalProps), {}, {
124
+ wrapClassName: classNames('modal-custom-wrapper', maxHeight && 'max-height-modal-custom-wrapper', modalProps === null || modalProps === void 0 ? void 0 : modalProps.wrapClassName),
125
+ onCancel: handleCancel
126
+ });
127
+ var mergedSubmitter = submitter || {
128
+ render: function render() {
129
+ var _mergedCancelProps$ch, _mergedConfirmProps$c;
130
+ var mergedCancelProps = _objectSpread({
131
+ disabled: false
132
+ }, cancelButtonProps || {});
133
+ var mergedConfirmProps = _objectSpread({
134
+ disabled: false
135
+ }, confirmButtonProps || {});
136
+ var mergedCloseProps = _objectSpread({
137
+ disabled: false
138
+ }, closeButtonProps || {});
139
+ var handleCancelClick = function handleCancelClick(e) {
140
+ var _mergedCancelProps$on;
141
+ mergedCancelProps === null || mergedCancelProps === void 0 || (_mergedCancelProps$on = mergedCancelProps.onClick) === null || _mergedCancelProps$on === void 0 || _mergedCancelProps$on.call(mergedCancelProps, e);
142
+ if (e !== null && e !== void 0 && e.defaultPrevented) return;
143
+ handleCancel(e);
144
+ };
145
+ var handleConfirmClick = function handleConfirmClick(e) {
146
+ var _mergedConfirmProps$o, _rest$form, _rest$form$submit;
147
+ mergedConfirmProps === null || mergedConfirmProps === void 0 || (_mergedConfirmProps$o = mergedConfirmProps.onClick) === null || _mergedConfirmProps$o === void 0 || _mergedConfirmProps$o.call(mergedConfirmProps, e);
148
+ if (e !== null && e !== void 0 && e.defaultPrevented) return;
149
+ rest === null || rest === void 0 || (_rest$form = rest.form) === null || _rest$form === void 0 || (_rest$form$submit = _rest$form.submit) === null || _rest$form$submit === void 0 || _rest$form$submit.call(_rest$form);
150
+ };
151
+ var handleCloseClick = function handleCloseClick(e) {
152
+ var _mergedCloseProps$onC;
153
+ mergedCloseProps === null || mergedCloseProps === void 0 || (_mergedCloseProps$onC = mergedCloseProps.onClick) === null || _mergedCloseProps$onC === void 0 || _mergedCloseProps$onC.call(mergedCloseProps, e);
154
+ if (e !== null && e !== void 0 && e.defaultPrevented) return;
155
+ handleCancel(e);
156
+ };
157
+ if (isPreview) {
158
+ var _mergedCloseProps$chi;
159
+ return /*#__PURE__*/_jsx(Flex, {
160
+ gap: 8,
161
+ children: /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, mergedCloseProps), {}, {
162
+ onClick: handleCloseClick,
163
+ children: (_mergedCloseProps$chi = mergedCloseProps === null || mergedCloseProps === void 0 ? void 0 : mergedCloseProps.children) !== null && _mergedCloseProps$chi !== void 0 ? _mergedCloseProps$chi : closeText
164
+ }))
165
+ });
166
+ }
167
+ return /*#__PURE__*/_jsxs(Flex, {
168
+ gap: 8,
169
+ children: [/*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, mergedCancelProps), {}, {
170
+ onClick: handleCancelClick,
171
+ children: (_mergedCancelProps$ch = mergedCancelProps === null || mergedCancelProps === void 0 ? void 0 : mergedCancelProps.children) !== null && _mergedCancelProps$ch !== void 0 ? _mergedCancelProps$ch : cancelText
172
+ })), /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
173
+ type: "primary"
174
+ }, mergedConfirmProps), {}, {
175
+ onClick: handleConfirmClick,
176
+ children: (_mergedConfirmProps$c = mergedConfirmProps === null || mergedConfirmProps === void 0 ? void 0 : mergedConfirmProps.children) !== null && _mergedConfirmProps$c !== void 0 ? _mergedConfirmProps$c : confirmText
177
+ }))]
178
+ });
179
+ }
180
+ };
181
+ var renderChildren = typeof children === 'function' ? children({
182
+ type: type,
183
+ data: data
184
+ }) : children;
185
+ var typeTitleMap = {
186
+ add: '新增',
187
+ edit: '编辑',
188
+ preview: '查看'
189
+ };
190
+ var mergedTitle = title || (modalName ? "".concat(typeTitleMap[type]).concat(modalName) : undefined);
191
+ return /*#__PURE__*/_jsx(ModalForm, _objectSpread(_objectSpread({}, rest), {}, {
192
+ title: mergedTitle,
193
+ disabled: isPreview ? true : disabled,
194
+ open: open,
195
+ onFinish: handleFinish,
196
+ modalProps: mergedModalProps,
197
+ submitter: mergedSubmitter,
198
+ children: renderChildren
199
+ }));
200
+ }
201
+ export var StyledModalForm = /*#__PURE__*/forwardRef(StyledModalFormCpn);
@@ -0,0 +1,51 @@
1
+ .modal-custom-wrapper {
2
+ .ant-modal-content {
3
+ padding: 0 !important;
4
+
5
+ .ant-modal-header {
6
+ height: 56px;
7
+ border-bottom: 1px solid #f0f0f0;
8
+ display: flex;
9
+ align-items: center;
10
+ margin: 0;
11
+ padding-left: 24px;
12
+ }
13
+
14
+ .ant-modal-body {
15
+ padding: 24px 24px 0;
16
+ max-height: calc(90vh - 200px);
17
+ overflow-y: auto;
18
+ overflow-x: hidden;
19
+ }
20
+
21
+ .ant-modal-footer {
22
+ height: 56px;
23
+ border-top: 1px solid #f0f0f0;
24
+ display: flex;
25
+ gap: 10px;
26
+ flex-direction: row-reverse;
27
+ align-items: center;
28
+ margin: 0;
29
+ padding-right: 24px;
30
+ }
31
+ }
32
+
33
+ &.no-padding-top {
34
+ .ant-modal-content {
35
+ .ant-modal-body {
36
+ padding-top: 0;
37
+ }
38
+ }
39
+ }
40
+ }
41
+
42
+ .max-height-modal-custom-wrapper {
43
+ .ant-modal-content {
44
+ .ant-modal-body {
45
+ padding: 24px 24px 0;
46
+ max-height: calc(95vh - 100px);
47
+ overflow-y: auto;
48
+ overflow-x: hidden;
49
+ }
50
+ }
51
+ }
@@ -10,7 +10,7 @@ export declare const PaginationCommonProps: {
10
10
  showQuickJumper: boolean;
11
11
  showTotal: (total: number) => string;
12
12
  };
13
- export declare const TableCellText: (text: string | number, maxTooltipWidth: any, maxTooltipHeight: any) => "-" | import("react/jsx-runtime").JSX.Element;
13
+ export declare const TableCellText: (text: string | number, maxTooltipWidth: any, maxTooltipHeight: any) => import("react/jsx-runtime").JSX.Element | "-";
14
14
  export default function (props: StyledTableProps): import("react/jsx-runtime").JSX.Element;
15
15
  export declare const useRowSelection: () => {
16
16
  selectedRowKeys: any[];
@@ -1,3 +1,4 @@
1
+ export { default as BlockHeader } from './BlockHeader';
1
2
  export { default as FlexRowCol } from './FlexRowCol';
2
3
  export * from './ImageViewTrigger';
3
4
  export * from './MindGraph';
@@ -5,6 +6,7 @@ export { default as OverflowTooltip } from './OverflowTooltip';
5
6
  export { default as QueryProCard } from './QueryProCard';
6
7
  export * from './SectionTitleBar';
7
8
  export { default as SliderVerify } from './SliderVerify';
9
+ export * from './StyledModalForm';
8
10
  export { default as StyledQueryFilter } from './StyledQueryFilter';
9
11
  export { default as StyledTable } from './StyledTable';
10
12
  export { default as TabSearchTools } from './TabSearchTools';
@@ -1,3 +1,4 @@
1
+ export { default as BlockHeader } from "./BlockHeader";
1
2
  export { default as FlexRowCol } from "./FlexRowCol";
2
3
  export * from "./ImageViewTrigger";
3
4
  export * from "./MindGraph";
@@ -5,6 +6,7 @@ export { default as OverflowTooltip } from "./OverflowTooltip";
5
6
  export { default as QueryProCard } from "./QueryProCard";
6
7
  export * from "./SectionTitleBar";
7
8
  export { default as SliderVerify } from "./SliderVerify";
9
+ export * from "./StyledModalForm";
8
10
  export { default as StyledQueryFilter } from "./StyledQueryFilter";
9
11
  export { default as StyledTable } from "./StyledTable";
10
12
  export { default as TabSearchTools } from "./TabSearchTools";
@@ -1,3 +1,5 @@
1
1
  export * from './useBIHooks';
2
2
  export * from './useEnhancePagination';
3
+ export * from './usePathname';
4
+ export * from './useRefreshForTab';
3
5
  export * from './useTabsTablePagination/index';
@@ -1,3 +1,5 @@
1
1
  export * from "./useBIHooks";
2
2
  export * from "./useEnhancePagination";
3
+ export * from "./usePathname";
4
+ export * from "./useRefreshForTab";
3
5
  export * from "./useTabsTablePagination/index";
@@ -0,0 +1,7 @@
1
+ export type CloseTabFn = (path: string) => void;
2
+ /**
3
+ * 提供当前路径相关的小工具,如关闭当前标签页。
4
+ */
5
+ export declare const usePathname: (closeTab?: CloseTabFn) => {
6
+ closeCurrentTab: () => void;
7
+ };
@@ -0,0 +1,14 @@
1
+ import { useMemo, useRef } from 'react';
2
+ /**
3
+ * 提供当前路径相关的小工具,如关闭当前标签页。
4
+ */
5
+ export var usePathname = function usePathname(closeTab) {
6
+ var pathname = useRef(window.location.pathname);
7
+ return useMemo(function () {
8
+ return {
9
+ closeCurrentTab: function closeCurrentTab() {
10
+ closeTab === null || closeTab === void 0 || closeTab(pathname.current);
11
+ }
12
+ };
13
+ }, []);
14
+ };
@@ -0,0 +1,5 @@
1
+ export type RefreshCallback = () => void | Promise<void>;
2
+ /**
3
+ * 当路由返回到当前 tab 时触发回调,用于刷新当前页数据。
4
+ */
5
+ export declare const useRefreshForTab: (fn?: RefreshCallback) => void;
@@ -0,0 +1,24 @@
1
+ import { history } from '@umijs/max';
2
+ import { useEffect, useRef } from 'react';
3
+ /**
4
+ * 当路由返回到当前 tab 时触发回调,用于刷新当前页数据。
5
+ */
6
+ export var useRefreshForTab = function useRefreshForTab(fn) {
7
+ var pathname = useRef(window.location.pathname);
8
+ useEffect(function () {
9
+ var unlisten = history.listen(function (_ref) {
10
+ var location = _ref.location;
11
+ if (location.pathname === pathname.current) {
12
+ try {
13
+ if (fn) fn();
14
+ } catch (error) {
15
+ console.error(error);
16
+ }
17
+ }
18
+ });
19
+ return function () {
20
+ unlisten();
21
+ };
22
+ // eslint-disable-next-line react-hooks/exhaustive-deps
23
+ }, []);
24
+ };
@@ -0,0 +1,20 @@
1
+ declare module '*.less' {
2
+ const content: { [className: string]: string };
3
+ export default content;
4
+ }
5
+
6
+ // 图片资源声明
7
+ declare module '*.png' {
8
+ const content: string;
9
+ export default content;
10
+ }
11
+
12
+ declare module '*.jpg' {
13
+ const content: string;
14
+ export default content;
15
+ }
16
+
17
+ declare module '*.jpeg' {
18
+ const content: string;
19
+ export default content;
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ebaoferc",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "A react library developed with dumi",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -85,14 +85,15 @@
85
85
  "peerDependencies": {
86
86
  "@ant-design/icons": "^5.3.7",
87
87
  "@ant-design/pro-components": "^2.7.1",
88
+ "@umijs/max": "^4.3.6",
88
89
  "ahooks": "^3.7.10",
89
- "antd": "^5.17.0",
90
+ "antd": "^5.24.7",
90
91
  "classnames": "^2.5.1",
91
92
  "cross-env": "^7.0.3",
92
93
  "dayjs": "^1.11.10",
93
94
  "lodash": "^4.17.21",
94
- "react": "^18.0.0",
95
- "react-dom": "^18.0.0"
95
+ "react": "^18.3.0",
96
+ "react-dom": "^18.3.0"
96
97
  },
97
98
  "publishConfig": {
98
99
  "access": "public",