yg-my-lib
Version:
这是一个测试的库,未正式使用
703 lines (700 loc) • 23.5 kB
JavaScript
import './index.css'
import Ce, { forwardRef as Pe, useState as hr, useImperativeHandle as ke } from "react";
import { Button as mr, Modal as gr, Select as yr, Table as br, Form as B, Input as je } from "antd";
var U = { exports: {} }, $ = {};
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Oe;
function Rr() {
if (Oe) return $;
Oe = 1;
var o = Ce, d = Symbol.for("react.element"), y = Symbol.for("react.fragment"), R = Object.prototype.hasOwnProperty, T = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, C = { key: !0, ref: !0, __self: !0, __source: !0 };
function E(_, v, P) {
var g, x = {}, O = null, Y = null;
P !== void 0 && (O = "" + P), v.key !== void 0 && (O = "" + v.key), v.ref !== void 0 && (Y = v.ref);
for (g in v) R.call(v, g) && !C.hasOwnProperty(g) && (x[g] = v[g]);
if (_ && _.defaultProps) for (g in v = _.defaultProps, v) x[g] === void 0 && (x[g] = v[g]);
return { $$typeof: d, type: _, key: O, ref: Y, props: x, _owner: T.current };
}
return $.Fragment = y, $.jsx = E, $.jsxs = E, $;
}
var W = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Se;
function Er() {
return Se || (Se = 1, process.env.NODE_ENV !== "production" && function() {
var o = Ce, d = Symbol.for("react.element"), y = Symbol.for("react.portal"), R = Symbol.for("react.fragment"), T = Symbol.for("react.strict_mode"), C = Symbol.for("react.profiler"), E = Symbol.for("react.provider"), _ = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), x = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), Y = Symbol.for("react.offscreen"), Q = Symbol.iterator, De = "@@iterator";
function Fe(e) {
if (e === null || typeof e != "object")
return null;
var r = Q && e[Q] || e[De];
return typeof r == "function" ? r : null;
}
var k = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function p(e) {
{
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
t[n - 1] = arguments[n];
Ae("error", e, t);
}
}
function Ae(e, r, t) {
{
var n = k.ReactDebugCurrentFrame, u = n.getStackAddendum();
u !== "" && (r += "%s", t = t.concat([u]));
var s = t.map(function(i) {
return String(i);
});
s.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, s);
}
}
var Ie = !1, $e = !1, We = !1, Ye = !1, Ne = !1, ee;
ee = Symbol.for("react.module.reference");
function Ve(e) {
return !!(typeof e == "string" || typeof e == "function" || e === R || e === C || Ne || e === T || e === P || e === g || Ye || e === Y || Ie || $e || We || typeof e == "object" && e !== null && (e.$$typeof === O || e.$$typeof === x || e.$$typeof === E || e.$$typeof === _ || e.$$typeof === v || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
e.$$typeof === ee || e.getModuleId !== void 0));
}
function Le(e, r, t) {
var n = e.displayName;
if (n)
return n;
var u = r.displayName || r.name || "";
return u !== "" ? t + "(" + u + ")" : t;
}
function re(e) {
return e.displayName || "Context";
}
function j(e) {
if (e == null)
return null;
if (typeof e.tag == "number" && p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
return e.displayName || e.name || null;
if (typeof e == "string")
return e;
switch (e) {
case R:
return "Fragment";
case y:
return "Portal";
case C:
return "Profiler";
case T:
return "StrictMode";
case P:
return "Suspense";
case g:
return "SuspenseList";
}
if (typeof e == "object")
switch (e.$$typeof) {
case _:
var r = e;
return re(r) + ".Consumer";
case E:
var t = e;
return re(t._context) + ".Provider";
case v:
return Le(e, e.render, "ForwardRef");
case x:
var n = e.displayName || null;
return n !== null ? n : j(e.type) || "Memo";
case O: {
var u = e, s = u._payload, i = u._init;
try {
return j(i(s));
} catch {
return null;
}
}
}
return null;
}
var S = Object.assign, A = 0, te, ne, ae, ie, oe, ue, se;
function le() {
}
le.__reactDisabledLog = !0;
function Me() {
{
if (A === 0) {
te = console.log, ne = console.info, ae = console.warn, ie = console.error, oe = console.group, ue = console.groupCollapsed, se = console.groupEnd;
var e = {
configurable: !0,
enumerable: !0,
value: le,
writable: !0
};
Object.defineProperties(console, {
info: e,
log: e,
warn: e,
error: e,
group: e,
groupCollapsed: e,
groupEnd: e
});
}
A++;
}
}
function Ue() {
{
if (A--, A === 0) {
var e = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: S({}, e, {
value: te
}),
info: S({}, e, {
value: ne
}),
warn: S({}, e, {
value: ae
}),
error: S({}, e, {
value: ie
}),
group: S({}, e, {
value: oe
}),
groupCollapsed: S({}, e, {
value: ue
}),
groupEnd: S({}, e, {
value: se
})
});
}
A < 0 && p("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var J = k.ReactCurrentDispatcher, q;
function N(e, r, t) {
{
if (q === void 0)
try {
throw Error();
} catch (u) {
var n = u.stack.trim().match(/\n( *(at )?)/);
q = n && n[1] || "";
}
return `
` + q + e;
}
}
var K = !1, V;
{
var Be = typeof WeakMap == "function" ? WeakMap : Map;
V = new Be();
}
function ce(e, r) {
if (!e || K)
return "";
{
var t = V.get(e);
if (t !== void 0)
return t;
}
var n;
K = !0;
var u = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var s;
s = J.current, J.current = null, Me();
try {
if (r) {
var i = function() {
throw Error();
};
if (Object.defineProperty(i.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(i, []);
} catch (m) {
n = m;
}
Reflect.construct(e, [], i);
} else {
try {
i.call();
} catch (m) {
n = m;
}
e.call(i.prototype);
}
} else {
try {
throw Error();
} catch (m) {
n = m;
}
e();
}
} catch (m) {
if (m && n && typeof m.stack == "string") {
for (var a = m.stack.split(`
`), h = n.stack.split(`
`), l = a.length - 1, f = h.length - 1; l >= 1 && f >= 0 && a[l] !== h[f]; )
f--;
for (; l >= 1 && f >= 0; l--, f--)
if (a[l] !== h[f]) {
if (l !== 1 || f !== 1)
do
if (l--, f--, f < 0 || a[l] !== h[f]) {
var b = `
` + a[l].replace(" at new ", " at ");
return e.displayName && b.includes("<anonymous>") && (b = b.replace("<anonymous>", e.displayName)), typeof e == "function" && V.set(e, b), b;
}
while (l >= 1 && f >= 0);
break;
}
}
} finally {
K = !1, J.current = s, Ue(), Error.prepareStackTrace = u;
}
var F = e ? e.displayName || e.name : "", w = F ? N(F) : "";
return typeof e == "function" && V.set(e, w), w;
}
function Je(e, r, t) {
return ce(e, !1);
}
function qe(e) {
var r = e.prototype;
return !!(r && r.isReactComponent);
}
function L(e, r, t) {
if (e == null)
return "";
if (typeof e == "function")
return ce(e, qe(e));
if (typeof e == "string")
return N(e);
switch (e) {
case P:
return N("Suspense");
case g:
return N("SuspenseList");
}
if (typeof e == "object")
switch (e.$$typeof) {
case v:
return Je(e.render);
case x:
return L(e.type, r, t);
case O: {
var n = e, u = n._payload, s = n._init;
try {
return L(s(u), r, t);
} catch {
}
}
}
return "";
}
var I = Object.prototype.hasOwnProperty, fe = {}, de = k.ReactDebugCurrentFrame;
function M(e) {
if (e) {
var r = e._owner, t = L(e.type, e._source, r ? r.type : null);
de.setExtraStackFrame(t);
} else
de.setExtraStackFrame(null);
}
function Ke(e, r, t, n, u) {
{
var s = Function.call.bind(I);
for (var i in e)
if (s(e, i)) {
var a = void 0;
try {
if (typeof e[i] != "function") {
var h = Error((n || "React class") + ": " + t + " type `" + i + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[i] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw h.name = "Invariant Violation", h;
}
a = e[i](r, i, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch (l) {
a = l;
}
a && !(a instanceof Error) && (M(u), p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, i, typeof a), M(null)), a instanceof Error && !(a.message in fe) && (fe[a.message] = !0, M(u), p("Failed %s type: %s", t, a.message), M(null));
}
}
}
var Ge = Array.isArray;
function G(e) {
return Ge(e);
}
function ze(e) {
{
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
return t;
}
}
function Xe(e) {
try {
return ve(e), !1;
} catch {
return !0;
}
}
function ve(e) {
return "" + e;
}
function pe(e) {
if (Xe(e))
return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ze(e)), ve(e);
}
var he = k.ReactCurrentOwner, He = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, me, ge;
function Ze(e) {
if (I.call(e, "ref")) {
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
if (r && r.isReactWarning)
return !1;
}
return e.ref !== void 0;
}
function Qe(e) {
if (I.call(e, "key")) {
var r = Object.getOwnPropertyDescriptor(e, "key").get;
if (r && r.isReactWarning)
return !1;
}
return e.key !== void 0;
}
function er(e, r) {
typeof e.ref == "string" && he.current;
}
function rr(e, r) {
{
var t = function() {
me || (me = !0, p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
};
t.isReactWarning = !0, Object.defineProperty(e, "key", {
get: t,
configurable: !0
});
}
}
function tr(e, r) {
{
var t = function() {
ge || (ge = !0, p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
};
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
get: t,
configurable: !0
});
}
}
var nr = function(e, r, t, n, u, s, i) {
var a = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: d,
// Built-in properties that belong on the element
type: e,
key: r,
ref: t,
props: i,
// Record the component responsible for creating this element.
_owner: s
};
return a._store = {}, Object.defineProperty(a._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(a, "_self", {
configurable: !1,
enumerable: !1,
writable: !1,
value: n
}), Object.defineProperty(a, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: u
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
};
function ar(e, r, t, n, u) {
{
var s, i = {}, a = null, h = null;
t !== void 0 && (pe(t), a = "" + t), Qe(r) && (pe(r.key), a = "" + r.key), Ze(r) && (h = r.ref, er(r, u));
for (s in r)
I.call(r, s) && !He.hasOwnProperty(s) && (i[s] = r[s]);
if (e && e.defaultProps) {
var l = e.defaultProps;
for (s in l)
i[s] === void 0 && (i[s] = l[s]);
}
if (a || h) {
var f = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
a && rr(i, f), h && tr(i, f);
}
return nr(e, a, h, u, n, he.current, i);
}
}
var z = k.ReactCurrentOwner, ye = k.ReactDebugCurrentFrame;
function D(e) {
if (e) {
var r = e._owner, t = L(e.type, e._source, r ? r.type : null);
ye.setExtraStackFrame(t);
} else
ye.setExtraStackFrame(null);
}
var X;
X = !1;
function H(e) {
return typeof e == "object" && e !== null && e.$$typeof === d;
}
function be() {
{
if (z.current) {
var e = j(z.current.type);
if (e)
return `
Check the render method of \`` + e + "`.";
}
return "";
}
}
function ir(e) {
return "";
}
var Re = {};
function or(e) {
{
var r = be();
if (!r) {
var t = typeof e == "string" ? e : e.displayName || e.name;
t && (r = `
Check the top-level render call using <` + t + ">.");
}
return r;
}
}
function Ee(e, r) {
{
if (!e._store || e._store.validated || e.key != null)
return;
e._store.validated = !0;
var t = or(r);
if (Re[t])
return;
Re[t] = !0;
var n = "";
e && e._owner && e._owner !== z.current && (n = " It was passed a child from " + j(e._owner.type) + "."), D(e), p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), D(null);
}
}
function _e(e, r) {
{
if (typeof e != "object")
return;
if (G(e))
for (var t = 0; t < e.length; t++) {
var n = e[t];
H(n) && Ee(n, r);
}
else if (H(e))
e._store && (e._store.validated = !0);
else if (e) {
var u = Fe(e);
if (typeof u == "function" && u !== e.entries)
for (var s = u.call(e), i; !(i = s.next()).done; )
H(i.value) && Ee(i.value, r);
}
}
}
function ur(e) {
{
var r = e.type;
if (r == null || typeof r == "string")
return;
var t;
if (typeof r == "function")
t = r.propTypes;
else if (typeof r == "object" && (r.$$typeof === v || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
r.$$typeof === x))
t = r.propTypes;
else
return;
if (t) {
var n = j(r);
Ke(t, e.props, "prop", n, e);
} else if (r.PropTypes !== void 0 && !X) {
X = !0;
var u = j(r);
p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", u || "Unknown");
}
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
}
function sr(e) {
{
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
var n = r[t];
if (n !== "children" && n !== "key") {
D(e), p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), D(null);
break;
}
}
e.ref !== null && (D(e), p("Invalid attribute `ref` supplied to `React.Fragment`."), D(null));
}
}
var xe = {};
function Te(e, r, t, n, u, s) {
{
var i = Ve(e);
if (!i) {
var a = "";
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
var h = ir();
h ? a += h : a += be();
var l;
e === null ? l = "null" : G(e) ? l = "array" : e !== void 0 && e.$$typeof === d ? (l = "<" + (j(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : l = typeof e, p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", l, a);
}
var f = ar(e, r, t, u, s);
if (f == null)
return f;
if (i) {
var b = r.children;
if (b !== void 0)
if (n)
if (G(b)) {
for (var F = 0; F < b.length; F++)
_e(b[F], e);
Object.freeze && Object.freeze(b);
} else
p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
else
_e(b, e);
}
if (I.call(r, "key")) {
var w = j(e), m = Object.keys(r).filter(function(pr) {
return pr !== "key";
}), Z = m.length > 0 ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}";
if (!xe[w + Z]) {
var vr = m.length > 0 ? "{" + m.join(": ..., ") + ": ...}" : "{}";
p(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`, Z, w, vr, w), xe[w + Z] = !0;
}
}
return e === R ? sr(f) : ur(f), f;
}
}
function lr(e, r, t) {
return Te(e, r, t, !0);
}
function cr(e, r, t) {
return Te(e, r, t, !1);
}
var fr = cr, dr = lr;
W.Fragment = R, W.jsx = fr, W.jsxs = dr;
}()), W;
}
var we;
function _r() {
return we || (we = 1, process.env.NODE_ENV === "production" ? U.exports = Rr() : U.exports = Er()), U.exports;
}
var c = _r();
const xr = (o) => {
const { accessible: d, fallback: y } = o;
return d ? /* @__PURE__ */ c.jsx(c.Fragment, { children: o.children }) : /* @__PURE__ */ c.jsx(c.Fragment, { children: y });
};
function Tr({ label: o, ...d }) {
return /* @__PURE__ */ c.jsx(mr, { ...d, children: o || "按钮" });
}
const jr = (o, d) => {
const [y, R] = hr(!1);
return ke(d, () => ({
openDialog() {
R(!0);
},
closeDialog() {
R(!1);
}
})), /* @__PURE__ */ c.jsx(gr, { ...o, open: y, children: o.children });
}, Dr = Pe(jr);
function Or(o) {
return /* @__PURE__ */ c.jsx(yr, { ...o, style: { width: 200 } });
}
const Fr = (o) => /* @__PURE__ */ c.jsxs("div", { children: [
/* @__PURE__ */ c.jsx("div", { className: "flex", children: /* @__PURE__ */ c.jsx(xr, { accessible: !!o.rightNode, children: /* @__PURE__ */ c.jsx("div", { className: "ml-auto mb-10", children: o.rightNode }) }) }),
/* @__PURE__ */ c.jsx(br, { ...o })
] }), Sr = (o) => {
const d = (y) => {
switch (y) {
case "input":
return /* @__PURE__ */ c.jsx(je, { placeholder: o.placeholder });
case "select":
return /* @__PURE__ */ c.jsx(
Or,
{
placeholder: o.placeholder,
options: o.options
}
);
default:
return /* @__PURE__ */ c.jsx(je, { placeholder: o.placeholder });
}
};
return /* @__PURE__ */ c.jsx(B.Item, { label: o.label, name: o.name, children: d(o.type) });
}, wr = ({ onSearch: o, isShowRightNode: d = !0, ...y }, R) => {
const [T] = B.useForm();
ke(R, () => ({
...T
}));
const C = async () => {
try {
const E = await T.validateFields();
o && o(E);
} catch (E) {
console.log(E);
}
};
return /* @__PURE__ */ c.jsxs(B, { ...y, form: T, children: [
y.widgetlist.map((E, _) => /* @__PURE__ */ c.jsx(Sr, { ...E }, _)),
o && /* @__PURE__ */ c.jsx(B.Item, { children: /* @__PURE__ */ c.jsx(Tr, { type: "primary", label: "搜索", onClick: C }) }),
d
] });
}, Cr = Pe(wr), Ar = ({ ...o }) => /* @__PURE__ */ c.jsx(Cr, { className: "mt-8 mb-8", ...o, layout: "inline" });
export {
xr as DynamicAccess,
Tr as DynamicButton,
Dr as DynamicDialog,
Cr as DynamicForm,
Ar as DynamicSearch,
Or as DynamicSelect,
Fr as DynamicTable
};