@ccs-ui/rc-pro 2.2.2 → 2.2.4-beta-1
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/es/button/index.js +0 -1
- package/es/config.js +6 -21
- package/es/context/index.d.ts +3 -1
- package/es/dialog/HookModal.js +4 -3
- package/es/dialog/button.d.ts +1 -1
- package/es/dialog/hook.d.ts +2 -2
- package/es/dialog/hook.js +7 -20
- package/es/hooks/use-page.d.ts +2 -0
- package/es/layout-keep-alive/page.js +6 -1
- package/es/layout-single-page/page.js +6 -1
- package/es/upload/index.js +0 -1
- package/es/upload/upload-image.d.ts +0 -1
- package/package.json +1 -1
package/es/button/index.js
CHANGED
package/es/config.js
CHANGED
|
@@ -15,27 +15,12 @@ import { theme as antTheme, App, ConfigProvider, message, Modal, notification }
|
|
|
15
15
|
import zhCN from 'antd/locale/zh_CN';
|
|
16
16
|
import React, { useState } from 'react';
|
|
17
17
|
import { AppConfigContext } from "./context";
|
|
18
|
-
import
|
|
18
|
+
import { DialogElementsHolder } from "./dialog/hook";
|
|
19
19
|
import ThemeDialog from "./theme-dialog";
|
|
20
20
|
import WaterMarkRelative from "./water-mark/relative";
|
|
21
21
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
22
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
-
|
|
25
|
-
var _usePatchElement = usePatchElement(),
|
|
26
|
-
_usePatchElement2 = _slicedToArray(_usePatchElement, 2),
|
|
27
|
-
elements = _usePatchElement2[0],
|
|
28
|
-
patchElement = _usePatchElement2[1];
|
|
29
|
-
React.useImperativeHandle(ref, function () {
|
|
30
|
-
return {
|
|
31
|
-
patchElement: patchElement
|
|
32
|
-
};
|
|
33
|
-
}, []);
|
|
34
|
-
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
35
|
-
return /*#__PURE__*/_jsx(_Fragment, {
|
|
36
|
-
children: elements
|
|
37
|
-
});
|
|
38
|
-
}));
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
39
24
|
function AppDialog() {
|
|
40
25
|
var _message$useMessage = message.useMessage(),
|
|
41
26
|
_message$useMessage2 = _slicedToArray(_message$useMessage, 2),
|
|
@@ -69,7 +54,7 @@ function AppConfig(_ref) {
|
|
|
69
54
|
watermark = _ref.watermark,
|
|
70
55
|
themeConfig = _ref.themeConfig,
|
|
71
56
|
fieldNames = _ref.fieldNames;
|
|
72
|
-
var
|
|
57
|
+
var dialogHolderRef = React.useRef(null);
|
|
73
58
|
// 主题
|
|
74
59
|
var appTheme = theme === 'dark' ? darkTheme : defaultTheme;
|
|
75
60
|
var algorithm = function algorithm() {
|
|
@@ -96,11 +81,11 @@ function AppConfig(_ref) {
|
|
|
96
81
|
value: {
|
|
97
82
|
theme: theme,
|
|
98
83
|
themeConfig: themeConfig,
|
|
99
|
-
|
|
84
|
+
dialogHolderRef: dialogHolderRef,
|
|
100
85
|
fieldNames: fieldNames
|
|
101
86
|
},
|
|
102
|
-
children: [children, /*#__PURE__*/_jsx(AppDialog, {}), /*#__PURE__*/_jsx(
|
|
103
|
-
ref:
|
|
87
|
+
children: [children, /*#__PURE__*/_jsx(AppDialog, {}), /*#__PURE__*/_jsx(DialogElementsHolder, {
|
|
88
|
+
ref: dialogHolderRef
|
|
104
89
|
}, "modal-drawer-holder"), (watermark === null || watermark === void 0 ? void 0 : watermark.content) && /*#__PURE__*/_jsx(WaterMarkRelative, {
|
|
105
90
|
content: watermark.content,
|
|
106
91
|
fontColor: "rgba(0,0,0,.15)",
|
package/es/context/index.d.ts
CHANGED
|
@@ -38,6 +38,8 @@ type PageContextType = {
|
|
|
38
38
|
location: Location;
|
|
39
39
|
/** 当前页面是否选中 */
|
|
40
40
|
isActive: boolean;
|
|
41
|
+
/** dialog holder */
|
|
42
|
+
dialogHolderRef: React.RefObject<ElementsHolderRef>;
|
|
41
43
|
/** 销毁页面 */
|
|
42
44
|
onDestroy: (path: string) => void;
|
|
43
45
|
/** 获取按钮权限 */
|
|
@@ -70,7 +72,7 @@ type CssAppConfigType = {
|
|
|
70
72
|
/** 全局水印 */
|
|
71
73
|
watermark?: WaterMarkProps;
|
|
72
74
|
/** modal or drawer holder */
|
|
73
|
-
|
|
75
|
+
dialogHolderRef?: React.RefObject<ElementsHolderRef>;
|
|
74
76
|
/** 接口字段指定 */
|
|
75
77
|
fieldNames?: {
|
|
76
78
|
/** CcsProTable 组件字段全局指定 */
|
package/es/dialog/HookModal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["auth", "form", "title", "content", "extraBtn", "className", "
|
|
1
|
+
var _excluded = ["auth", "form", "title", "content", "extraBtn", "className", "footer", "preventRequestHandle", "requestFieldNames", "onOk", "request", "onClose"];
|
|
2
2
|
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); }
|
|
3
3
|
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; }
|
|
4
4
|
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); } }
|
|
@@ -100,7 +100,7 @@ var HookModal = function HookModal(props) {
|
|
|
100
100
|
content = innerConfig.content,
|
|
101
101
|
extraBtn = innerConfig.extraBtn,
|
|
102
102
|
className = innerConfig.className,
|
|
103
|
-
|
|
103
|
+
footer = innerConfig.footer,
|
|
104
104
|
preventRequestHandle = innerConfig.preventRequestHandle,
|
|
105
105
|
requestFieldNames = innerConfig.requestFieldNames,
|
|
106
106
|
onOk = innerConfig.onOk,
|
|
@@ -155,12 +155,13 @@ var HookModal = function HookModal(props) {
|
|
|
155
155
|
requestFieldNames: requestFieldNames
|
|
156
156
|
});
|
|
157
157
|
}, []);
|
|
158
|
+
console.log('footer', footer);
|
|
158
159
|
return /*#__PURE__*/_jsx(Modal, _objectSpread(_objectSpread({
|
|
159
160
|
onCancel: onHandleClose,
|
|
160
161
|
afterClose: afterClose
|
|
161
162
|
}, otherInnerConfig), {}, {
|
|
162
163
|
className: classNames('ccs-dialog-modal', className),
|
|
163
|
-
footer:
|
|
164
|
+
footer: footer === null ? null : renderFooter,
|
|
164
165
|
title: /*#__PURE__*/_jsx("div", {
|
|
165
166
|
style: {
|
|
166
167
|
width: '100%',
|
package/es/dialog/button.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type DialogButtonsProps<T> = Pick<CcsDialogModalProps, 'okText' | 'onClos
|
|
|
16
16
|
export type DialogButtonRef = {
|
|
17
17
|
onSetButtons: (e: React.ReactElement) => void;
|
|
18
18
|
};
|
|
19
|
-
export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "
|
|
19
|
+
export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "onClose" | "auth" | "onOk" | "extraBtn" | "request" | "requestFieldNames" | "preventRequestHandle"> & {
|
|
20
20
|
formRef: React.RefObject<DialogFormRef<TParams>>;
|
|
21
21
|
formInitialValues: FormProps['initialValues'];
|
|
22
22
|
buttonRef: RefObject<DialogButtonRef>;
|
package/es/dialog/hook.d.ts
CHANGED
|
@@ -47,10 +47,9 @@ type DialogProps<TParams, TData> = {
|
|
|
47
47
|
/** 弹框关闭回调 */
|
|
48
48
|
onClose?: () => void;
|
|
49
49
|
};
|
|
50
|
-
export type CcsDialogModalProps<TParams = any, TData = any> = DialogProps<TParams, TData> & Omit<ModalFuncProps, 'onCancel' | 'afterOpenChange' | 'onOk'
|
|
50
|
+
export type CcsDialogModalProps<TParams = any, TData = any> = DialogProps<TParams, TData> & Omit<ModalFuncProps, 'onCancel' | 'afterOpenChange' | 'onOk'> & {
|
|
51
51
|
/** 关闭后销毁组件,默认true */
|
|
52
52
|
destroyOnClose?: boolean;
|
|
53
|
-
hideFooter?: boolean;
|
|
54
53
|
};
|
|
55
54
|
export type CcsDialogDrawerProps<TParams = any, TData = any> = DialogProps<TParams, TData> & Omit<DrawerProps, 'onClose' | 'onOk' | 'afterOpenChange' | 'footer'> & {
|
|
56
55
|
/** 抽屉内容 */
|
|
@@ -66,5 +65,6 @@ export type CcsDialogType = {
|
|
|
66
65
|
export type ElementsHolderRef = {
|
|
67
66
|
patchElement: ReturnType<typeof usePatchElement>[1];
|
|
68
67
|
};
|
|
68
|
+
export declare const DialogElementsHolder: React.MemoExoticComponent<React.ForwardRefExoticComponent<React.RefAttributes<ElementsHolderRef>>>;
|
|
69
69
|
export default function useCcsDialog(): CcsDialogType;
|
|
70
70
|
export {};
|
package/es/dialog/hook.js
CHANGED
|
@@ -14,7 +14,6 @@ import _debounce from 'lodash.debounce';
|
|
|
14
14
|
import React from 'react';
|
|
15
15
|
import { createRoot } from 'react-dom/client';
|
|
16
16
|
import { useCcsPage } from '..';
|
|
17
|
-
import { PageContext } from "../context";
|
|
18
17
|
import useAppConfig from "../hooks/use-app";
|
|
19
18
|
import HookDrawer from "./HookDrawer";
|
|
20
19
|
import HookModal from "./HookModal";
|
|
@@ -30,7 +29,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
30
29
|
// update: (configUpdate: ModalFuncProps) => void;
|
|
31
30
|
// };
|
|
32
31
|
|
|
33
|
-
var
|
|
32
|
+
export var DialogElementsHolder = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (_props, ref) {
|
|
34
33
|
var _usePatchElement = usePatchElement(),
|
|
35
34
|
_usePatchElement2 = _slicedToArray(_usePatchElement, 2),
|
|
36
35
|
elements = _usePatchElement2[0],
|
|
@@ -56,6 +55,7 @@ export default function useCcsDialog() {
|
|
|
56
55
|
setActionQueue = _React$useState2[1];
|
|
57
56
|
var appConfig = useAppConfig() || {};
|
|
58
57
|
var CcsPageContext = useCcsPage();
|
|
58
|
+
var dialogHolderRef = CcsPageContext.dialogHolderRef || appConfig.dialogHolderRef;
|
|
59
59
|
React.useEffect(function () {
|
|
60
60
|
if (actionQueue.length) {
|
|
61
61
|
var cloneQueue = _toConsumableArray(actionQueue);
|
|
@@ -80,16 +80,9 @@ export default function useCcsDialog() {
|
|
|
80
80
|
},
|
|
81
81
|
dialogRef: modalRef
|
|
82
82
|
}, "modal-".concat(modalUuid));
|
|
83
|
-
|
|
84
|
-
// if (CcsPageContext && CcsPageContext.id) {
|
|
85
|
-
// dialog = (
|
|
86
|
-
// <PageContext.Provider value={CcsPageContext}>
|
|
87
|
-
// {dialog}
|
|
88
|
-
// </PageContext.Provider>
|
|
89
|
-
// );
|
|
90
|
-
// }
|
|
83
|
+
|
|
91
84
|
// 优先使用自定义contextHolder、其次使用全局contextHolder
|
|
92
|
-
var $holderRef = holderRef.current ? holderRef :
|
|
85
|
+
var $holderRef = holderRef.current ? holderRef : dialogHolderRef;
|
|
93
86
|
if ($holderRef !== null && $holderRef !== void 0 && $holderRef.current) {
|
|
94
87
|
// 加载了contextHolder
|
|
95
88
|
closeFunc = $holderRef.current.patchElement(dialog);
|
|
@@ -154,14 +147,8 @@ export default function useCcsDialog() {
|
|
|
154
147
|
dialogRef: dialogRef
|
|
155
148
|
}, "drawer-".concat(drawerUuid));
|
|
156
149
|
|
|
157
|
-
//
|
|
158
|
-
|
|
159
|
-
dialog = /*#__PURE__*/_jsx(PageContext.Provider, {
|
|
160
|
-
value: CcsPageContext,
|
|
161
|
-
children: dialog
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
var $holderRef = holderRef.current ? holderRef : appConfig.holderRef;
|
|
150
|
+
// 优先使用自定义contextHolder、其次使用全局contextHolder
|
|
151
|
+
var $holderRef = holderRef.current ? holderRef : dialogHolderRef;
|
|
165
152
|
if ($holderRef !== null && $holderRef !== void 0 && $holderRef.current) {
|
|
166
153
|
var _$holderRef$current;
|
|
167
154
|
// 加载了contextHolder
|
|
@@ -240,7 +227,7 @@ export default function useCcsDialog() {
|
|
|
240
227
|
return {
|
|
241
228
|
openDrawer: fns.openDrawer,
|
|
242
229
|
openModal: fns.openModal,
|
|
243
|
-
contextHolder: /*#__PURE__*/_jsx(
|
|
230
|
+
contextHolder: /*#__PURE__*/_jsx(DialogElementsHolder, {
|
|
244
231
|
ref: holderRef
|
|
245
232
|
}, "modal-holder")
|
|
246
233
|
};
|
package/es/hooks/use-page.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
declare const usePage: () => {
|
|
2
3
|
id: string;
|
|
3
4
|
location: import("react-router").Location<any>;
|
|
4
5
|
isActive: boolean;
|
|
6
|
+
dialogHolderRef: import("react").RefObject<import("../dialog/hook").ElementsHolderRef>;
|
|
5
7
|
onDestroy: (path: string) => void;
|
|
6
8
|
onAuth: (code: string) => boolean;
|
|
7
9
|
};
|
|
@@ -3,6 +3,7 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { memo, useRef } from 'react';
|
|
4
4
|
import Scrollbars from 'react-custom-scrollbars';
|
|
5
5
|
import { PageContext } from "../context";
|
|
6
|
+
import { DialogElementsHolder } from "../dialog/hook";
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
9
|
export default /*#__PURE__*/memo(function (props) {
|
|
@@ -13,9 +14,11 @@ export default /*#__PURE__*/memo(function (props) {
|
|
|
13
14
|
onDestroy = props.onDestroy,
|
|
14
15
|
breadcrumb = props.breadcrumb;
|
|
15
16
|
var id = "_tab_content_".concat(locationRef.current.key);
|
|
17
|
+
var dialogHolderRef = useRef(null);
|
|
16
18
|
return /*#__PURE__*/_jsx(PageContext.Provider, {
|
|
17
19
|
value: {
|
|
18
20
|
id: id,
|
|
21
|
+
dialogHolderRef: dialogHolderRef,
|
|
19
22
|
isActive: active,
|
|
20
23
|
location: locationRef.current,
|
|
21
24
|
onDestroy: onDestroy,
|
|
@@ -38,7 +41,9 @@ export default /*#__PURE__*/memo(function (props) {
|
|
|
38
41
|
children: [/*#__PURE__*/_jsx(Breadcrumb, {
|
|
39
42
|
items: breadcrumb,
|
|
40
43
|
className: "ccs-breadcrumb"
|
|
41
|
-
}), children
|
|
44
|
+
}), children, /*#__PURE__*/_jsx(DialogElementsHolder, {
|
|
45
|
+
ref: dialogHolderRef
|
|
46
|
+
}, "modal-drawer-holder")]
|
|
42
47
|
})
|
|
43
48
|
})
|
|
44
49
|
});
|
|
@@ -2,6 +2,7 @@ import { Breadcrumb } from 'antd';
|
|
|
2
2
|
import { memo, useRef } from 'react';
|
|
3
3
|
import Scrollbars from 'react-custom-scrollbars';
|
|
4
4
|
import { PageContext } from "../context";
|
|
5
|
+
import { DialogElementsHolder } from "../dialog/hook";
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
8
|
export default /*#__PURE__*/memo(function (props) {
|
|
@@ -11,10 +12,12 @@ export default /*#__PURE__*/memo(function (props) {
|
|
|
11
12
|
urlAuthList = _props$urlAuthList === void 0 ? [] : _props$urlAuthList,
|
|
12
13
|
_props$breadcrumb = props.breadcrumb,
|
|
13
14
|
breadcrumb = _props$breadcrumb === void 0 ? [] : _props$breadcrumb;
|
|
15
|
+
var dialogHolderRef = useRef(null);
|
|
14
16
|
return /*#__PURE__*/_jsx(PageContext.Provider, {
|
|
15
17
|
value: {
|
|
16
18
|
id: '',
|
|
17
19
|
isActive: true,
|
|
20
|
+
dialogHolderRef: dialogHolderRef,
|
|
18
21
|
location: locationRef.current,
|
|
19
22
|
onDestroy: function onDestroy() {
|
|
20
23
|
console.error('单页模式不支持');
|
|
@@ -29,7 +32,9 @@ export default /*#__PURE__*/memo(function (props) {
|
|
|
29
32
|
children: [/*#__PURE__*/_jsx(Breadcrumb, {
|
|
30
33
|
items: breadcrumb,
|
|
31
34
|
className: "ccs-breadcrumb"
|
|
32
|
-
}), children
|
|
35
|
+
}), children, /*#__PURE__*/_jsx(DialogElementsHolder, {
|
|
36
|
+
ref: dialogHolderRef
|
|
37
|
+
}, "modal-drawer-holder")]
|
|
33
38
|
})
|
|
34
39
|
});
|
|
35
40
|
});
|
package/es/upload/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CcsUploadProps } from './index';
|
|
2
2
|
type CcsImageUploadProps = CcsUploadProps & {
|
|
3
3
|
crop?: boolean;
|
|
4
|
-
tokenKey?: string;
|
|
5
4
|
};
|
|
6
5
|
export declare function ImageUpload({ uploadText, maxCount, maxFileSize, crop, uploadRequest, onChange, ...otherProps }: CcsImageUploadProps): import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export {};
|