@yuku123/z-schedule-frontend-component 0.1.0
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/README.md +25 -0
- package/dist/z-schedule-frontend-component.es.js +292 -0
- package/dist/z-schedule-frontend-component.umd.js +22 -0
- package/package.json +42 -0
- package/src/CronDisplay.tsx +44 -0
- package/src/dev.tsx +22 -0
- package/src/index.ts +2 -0
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @yuku123/z-schedule-frontend-component
|
|
2
|
+
|
|
3
|
+
> ��抽自 z-opc 对应 _frontend)
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @yuku123/z-schedule-frontend-component
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
import { CronDisplay } from '@yuku123/z-schedule-frontend-component'
|
|
15
|
+
|
|
16
|
+
<CronDisplay prop="value"/>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 仓库
|
|
20
|
+
|
|
21
|
+
https://github.com/yuku123/z-opc-frontend/tree/main/packages/z-schedule-frontend-component
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
|
|
25
|
+
MIT
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import re from "react";
|
|
2
|
+
import { Tag as I, Tooltip as te } from "antd";
|
|
3
|
+
var p = { exports: {} }, _ = {};
|
|
4
|
+
/**
|
|
5
|
+
* @license React
|
|
6
|
+
* react-jsx-runtime.production.js
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the MIT license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
var D;
|
|
14
|
+
function ne() {
|
|
15
|
+
if (D) return _;
|
|
16
|
+
D = 1;
|
|
17
|
+
var s = Symbol.for("react.transitional.element"), l = Symbol.for("react.fragment");
|
|
18
|
+
function i(f, o, u) {
|
|
19
|
+
var d = null;
|
|
20
|
+
if (u !== void 0 && (d = "" + u), o.key !== void 0 && (d = "" + o.key), "key" in o) {
|
|
21
|
+
u = {};
|
|
22
|
+
for (var c in o)
|
|
23
|
+
c !== "key" && (u[c] = o[c]);
|
|
24
|
+
} else u = o;
|
|
25
|
+
return o = u.ref, {
|
|
26
|
+
$$typeof: s,
|
|
27
|
+
type: f,
|
|
28
|
+
key: d,
|
|
29
|
+
ref: o !== void 0 ? o : null,
|
|
30
|
+
props: u
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return _.Fragment = l, _.jsx = i, _.jsxs = i, _;
|
|
34
|
+
}
|
|
35
|
+
var E = {};
|
|
36
|
+
/**
|
|
37
|
+
* @license React
|
|
38
|
+
* react-jsx-runtime.development.js
|
|
39
|
+
*
|
|
40
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
41
|
+
*
|
|
42
|
+
* This source code is licensed under the MIT license found in the
|
|
43
|
+
* LICENSE file in the root directory of this source tree.
|
|
44
|
+
*/
|
|
45
|
+
var F;
|
|
46
|
+
function ae() {
|
|
47
|
+
return F || (F = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
48
|
+
function s(e) {
|
|
49
|
+
if (e == null) return null;
|
|
50
|
+
if (typeof e == "function")
|
|
51
|
+
return e.$$typeof === Q ? null : e.displayName || e.name || null;
|
|
52
|
+
if (typeof e == "string") return e;
|
|
53
|
+
switch (e) {
|
|
54
|
+
case v:
|
|
55
|
+
return "Fragment";
|
|
56
|
+
case J:
|
|
57
|
+
return "Profiler";
|
|
58
|
+
case q:
|
|
59
|
+
return "StrictMode";
|
|
60
|
+
case X:
|
|
61
|
+
return "Suspense";
|
|
62
|
+
case B:
|
|
63
|
+
return "SuspenseList";
|
|
64
|
+
case Z:
|
|
65
|
+
return "Activity";
|
|
66
|
+
}
|
|
67
|
+
if (typeof e == "object")
|
|
68
|
+
switch (typeof e.tag == "number" && console.error(
|
|
69
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
70
|
+
), e.$$typeof) {
|
|
71
|
+
case U:
|
|
72
|
+
return "Portal";
|
|
73
|
+
case z:
|
|
74
|
+
return e.displayName || "Context";
|
|
75
|
+
case V:
|
|
76
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
77
|
+
case G:
|
|
78
|
+
var r = e.render;
|
|
79
|
+
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
80
|
+
case H:
|
|
81
|
+
return r = e.displayName || null, r !== null ? r : s(e.type) || "Memo";
|
|
82
|
+
case T:
|
|
83
|
+
r = e._payload, e = e._init;
|
|
84
|
+
try {
|
|
85
|
+
return s(e(r));
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
function l(e) {
|
|
92
|
+
return "" + e;
|
|
93
|
+
}
|
|
94
|
+
function i(e) {
|
|
95
|
+
try {
|
|
96
|
+
l(e);
|
|
97
|
+
var r = !1;
|
|
98
|
+
} catch {
|
|
99
|
+
r = !0;
|
|
100
|
+
}
|
|
101
|
+
if (r) {
|
|
102
|
+
r = console;
|
|
103
|
+
var t = r.error, n = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
104
|
+
return t.call(
|
|
105
|
+
r,
|
|
106
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
107
|
+
n
|
|
108
|
+
), l(e);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function f(e) {
|
|
112
|
+
if (e === v) return "<>";
|
|
113
|
+
if (typeof e == "object" && e !== null && e.$$typeof === T)
|
|
114
|
+
return "<...>";
|
|
115
|
+
try {
|
|
116
|
+
var r = s(e);
|
|
117
|
+
return r ? "<" + r + ">" : "<...>";
|
|
118
|
+
} catch {
|
|
119
|
+
return "<...>";
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function o() {
|
|
123
|
+
var e = k.A;
|
|
124
|
+
return e === null ? null : e.getOwner();
|
|
125
|
+
}
|
|
126
|
+
function u() {
|
|
127
|
+
return Error("react-stack-top-frame");
|
|
128
|
+
}
|
|
129
|
+
function d(e) {
|
|
130
|
+
if (g.call(e, "key")) {
|
|
131
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
132
|
+
if (r && r.isReactWarning) return !1;
|
|
133
|
+
}
|
|
134
|
+
return e.key !== void 0;
|
|
135
|
+
}
|
|
136
|
+
function c(e, r) {
|
|
137
|
+
function t() {
|
|
138
|
+
x || (x = !0, console.error(
|
|
139
|
+
"%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://react.dev/link/special-props)",
|
|
140
|
+
r
|
|
141
|
+
));
|
|
142
|
+
}
|
|
143
|
+
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
144
|
+
get: t,
|
|
145
|
+
configurable: !0
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function M() {
|
|
149
|
+
var e = s(this.type);
|
|
150
|
+
return N[e] || (N[e] = !0, console.error(
|
|
151
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
152
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
153
|
+
}
|
|
154
|
+
function W(e, r, t, n, b, A) {
|
|
155
|
+
var a = t.ref;
|
|
156
|
+
return e = {
|
|
157
|
+
$$typeof: w,
|
|
158
|
+
type: e,
|
|
159
|
+
key: r,
|
|
160
|
+
props: t,
|
|
161
|
+
_owner: n
|
|
162
|
+
}, (a !== void 0 ? a : null) !== null ? Object.defineProperty(e, "ref", {
|
|
163
|
+
enumerable: !1,
|
|
164
|
+
get: M
|
|
165
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
166
|
+
configurable: !1,
|
|
167
|
+
enumerable: !1,
|
|
168
|
+
writable: !0,
|
|
169
|
+
value: 0
|
|
170
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
171
|
+
configurable: !1,
|
|
172
|
+
enumerable: !1,
|
|
173
|
+
writable: !0,
|
|
174
|
+
value: null
|
|
175
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
176
|
+
configurable: !1,
|
|
177
|
+
enumerable: !1,
|
|
178
|
+
writable: !0,
|
|
179
|
+
value: b
|
|
180
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
181
|
+
configurable: !1,
|
|
182
|
+
enumerable: !1,
|
|
183
|
+
writable: !0,
|
|
184
|
+
value: A
|
|
185
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
186
|
+
}
|
|
187
|
+
function y(e, r, t, n, b, A) {
|
|
188
|
+
var a = r.children;
|
|
189
|
+
if (a !== void 0)
|
|
190
|
+
if (n)
|
|
191
|
+
if (K(a)) {
|
|
192
|
+
for (n = 0; n < a.length; n++)
|
|
193
|
+
P(a[n]);
|
|
194
|
+
Object.freeze && Object.freeze(a);
|
|
195
|
+
} else
|
|
196
|
+
console.error(
|
|
197
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
198
|
+
);
|
|
199
|
+
else P(a);
|
|
200
|
+
if (g.call(r, "key")) {
|
|
201
|
+
a = s(e);
|
|
202
|
+
var m = Object.keys(r).filter(function(ee) {
|
|
203
|
+
return ee !== "key";
|
|
204
|
+
});
|
|
205
|
+
n = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", $[a + n] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
206
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
207
|
+
let props = %s;
|
|
208
|
+
<%s {...props} />
|
|
209
|
+
React keys must be passed directly to JSX without using spread:
|
|
210
|
+
let props = %s;
|
|
211
|
+
<%s key={someKey} {...props} />`,
|
|
212
|
+
n,
|
|
213
|
+
a,
|
|
214
|
+
m,
|
|
215
|
+
a
|
|
216
|
+
), $[a + n] = !0);
|
|
217
|
+
}
|
|
218
|
+
if (a = null, t !== void 0 && (i(t), a = "" + t), d(r) && (i(r.key), a = "" + r.key), "key" in r) {
|
|
219
|
+
t = {};
|
|
220
|
+
for (var h in r)
|
|
221
|
+
h !== "key" && (t[h] = r[h]);
|
|
222
|
+
} else t = r;
|
|
223
|
+
return a && c(
|
|
224
|
+
t,
|
|
225
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
226
|
+
), W(
|
|
227
|
+
e,
|
|
228
|
+
a,
|
|
229
|
+
t,
|
|
230
|
+
o(),
|
|
231
|
+
b,
|
|
232
|
+
A
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
function P(e) {
|
|
236
|
+
j(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === T && (e._payload.status === "fulfilled" ? j(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
237
|
+
}
|
|
238
|
+
function j(e) {
|
|
239
|
+
return typeof e == "object" && e !== null && e.$$typeof === w;
|
|
240
|
+
}
|
|
241
|
+
var R = re, w = Symbol.for("react.transitional.element"), U = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), J = Symbol.for("react.profiler"), V = Symbol.for("react.consumer"), z = Symbol.for("react.context"), G = Symbol.for("react.forward_ref"), X = Symbol.for("react.suspense"), B = Symbol.for("react.suspense_list"), H = Symbol.for("react.memo"), T = Symbol.for("react.lazy"), Z = Symbol.for("react.activity"), Q = Symbol.for("react.client.reference"), k = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, g = Object.prototype.hasOwnProperty, K = Array.isArray, O = console.createTask ? console.createTask : function() {
|
|
242
|
+
return null;
|
|
243
|
+
};
|
|
244
|
+
R = {
|
|
245
|
+
react_stack_bottom_frame: function(e) {
|
|
246
|
+
return e();
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
var x, N = {}, C = R.react_stack_bottom_frame.bind(
|
|
250
|
+
R,
|
|
251
|
+
u
|
|
252
|
+
)(), Y = O(f(u)), $ = {};
|
|
253
|
+
E.Fragment = v, E.jsx = function(e, r, t) {
|
|
254
|
+
var n = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
255
|
+
return y(
|
|
256
|
+
e,
|
|
257
|
+
r,
|
|
258
|
+
t,
|
|
259
|
+
!1,
|
|
260
|
+
n ? Error("react-stack-top-frame") : C,
|
|
261
|
+
n ? O(f(e)) : Y
|
|
262
|
+
);
|
|
263
|
+
}, E.jsxs = function(e, r, t) {
|
|
264
|
+
var n = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
265
|
+
return y(
|
|
266
|
+
e,
|
|
267
|
+
r,
|
|
268
|
+
t,
|
|
269
|
+
!0,
|
|
270
|
+
n ? Error("react-stack-top-frame") : C,
|
|
271
|
+
n ? O(f(e)) : Y
|
|
272
|
+
);
|
|
273
|
+
};
|
|
274
|
+
})()), E;
|
|
275
|
+
}
|
|
276
|
+
var L;
|
|
277
|
+
function oe() {
|
|
278
|
+
return L || (L = 1, process.env.NODE_ENV === "production" ? p.exports = ne() : p.exports = ae()), p.exports;
|
|
279
|
+
}
|
|
280
|
+
var S = oe();
|
|
281
|
+
function se(s) {
|
|
282
|
+
const l = s.split(/\s+/);
|
|
283
|
+
if (l.length < 6 || l.length > 7) return s;
|
|
284
|
+
const [i, f, o, u, d, c] = l;
|
|
285
|
+
return i === "0" && f === "0" && o !== "*" && u === "*" && d === "*" && c === "?" ? `每天 ${o}点整` : i === "0" && f === "0" && o === "*" && u === "*" && d === "*" && c === "?" ? "每小时整点" : i === "0" && f === "0" && o === "*" && u === "*" && d === "*" && c !== "?" ? `每周${c}的每小时整点` : s;
|
|
286
|
+
}
|
|
287
|
+
function ce({ cron: s, showDescription: l = !0 }) {
|
|
288
|
+
return l ? /* @__PURE__ */ S.jsx(te, { title: `原始: ${s}`, children: /* @__PURE__ */ S.jsx(I, { color: "blue", children: se(s) }) }) : /* @__PURE__ */ S.jsx(I, { color: "blue", children: s });
|
|
289
|
+
}
|
|
290
|
+
export {
|
|
291
|
+
ce as CronDisplay
|
|
292
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(function(m,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react"),require("antd")):typeof define=="function"&&define.amd?define(["exports","react","antd"],E):(m=typeof globalThis<"u"?globalThis:m||self,E(m.ZScheduleFrontendComponent={},m.React,m.antd))})(this,(function(m,E,k){"use strict";var b={exports:{}},p={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var g;function U(){if(g)return p;g=1;var s=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function c(f,a,u){var d=null;if(u!==void 0&&(d=""+u),a.key!==void 0&&(d=""+a.key),"key"in a){u={};for(var i in a)i!=="key"&&(u[i]=a[i])}else u=a;return a=u.ref,{$$typeof:s,type:f,key:d,ref:a!==void 0?a:null,props:u}}return p.Fragment=l,p.jsx=c,p.jsxs=c,p}var R={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var w;function q(){return w||(w=1,process.env.NODE_ENV!=="production"&&(function(){function s(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case y:return"Fragment";case H:return"Profiler";case B:return"StrictMode";case re:return"Suspense";case te:return"SuspenseList";case oe:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case Z:return"Portal";case K:return e.displayName||"Context";case Q:return(e._context.displayName||"Context")+".Consumer";case ee:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ne:return r=e.displayName||null,r!==null?r:s(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return s(e(r))}catch{}}return null}function l(e){return""+e}function c(e){try{l(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,n=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",n),l(e)}}function f(e){if(e===y)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===O)return"<...>";try{var r=s(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function a(){var e=S.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function d(e){if(D.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function i(e,r){function t(){F||(F=!0,console.error("%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://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function G(){var e=s(this.type);return I[e]||(I[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function X(e,r,t,n,T,j){var o=t.ref;return e={$$typeof:$,type:e,key:r,props:t,_owner:n},(o!==void 0?o:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:G}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:T}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:j}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function N(e,r,t,n,T,j){var o=r.children;if(o!==void 0)if(n)if(se(o)){for(n=0;n<o.length;n++)C(o[n]);Object.freeze&&Object.freeze(o)}else console.error("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 C(o);if(D.call(r,"key")){o=s(e);var _=Object.keys(r).filter(function(ue){return ue!=="key"});n=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",W[o+n]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
+
let props = %s;
|
|
19
|
+
<%s {...props} />
|
|
20
|
+
React keys must be passed directly to JSX without using spread:
|
|
21
|
+
let props = %s;
|
|
22
|
+
<%s key={someKey} {...props} />`,n,o,_,o),W[o+n]=!0)}if(o=null,t!==void 0&&(c(t),o=""+t),d(r)&&(c(r.key),o=""+r.key),"key"in r){t={};for(var P in r)P!=="key"&&(t[P]=r[P])}else t=r;return o&&i(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),X(e,o,t,a(),T,j)}function C(e){Y(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===O&&(e._payload.status==="fulfilled"?Y(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function Y(e){return typeof e=="object"&&e!==null&&e.$$typeof===$}var v=E,$=Symbol.for("react.transitional.element"),Z=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),Q=Symbol.for("react.consumer"),K=Symbol.for("react.context"),ee=Symbol.for("react.forward_ref"),re=Symbol.for("react.suspense"),te=Symbol.for("react.suspense_list"),ne=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),ae=Symbol.for("react.client.reference"),S=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D=Object.prototype.hasOwnProperty,se=Array.isArray,A=console.createTask?console.createTask:function(){return null};v={react_stack_bottom_frame:function(e){return e()}};var F,I={},M=v.react_stack_bottom_frame.bind(v,u)(),L=A(f(u)),W={};R.Fragment=y,R.jsx=function(e,r,t){var n=1e4>S.recentlyCreatedOwnerStacks++;return N(e,r,t,!1,n?Error("react-stack-top-frame"):M,n?A(f(e)):L)},R.jsxs=function(e,r,t){var n=1e4>S.recentlyCreatedOwnerStacks++;return N(e,r,t,!0,n?Error("react-stack-top-frame"):M,n?A(f(e)):L)}})()),R}var x;function J(){return x||(x=1,process.env.NODE_ENV==="production"?b.exports=U():b.exports=q()),b.exports}var h=J();function V(s){const l=s.split(/\s+/);if(l.length<6||l.length>7)return s;const[c,f,a,u,d,i]=l;return c==="0"&&f==="0"&&a!=="*"&&u==="*"&&d==="*"&&i==="?"?`每天 ${a}点整`:c==="0"&&f==="0"&&a==="*"&&u==="*"&&d==="*"&&i==="?"?"每小时整点":c==="0"&&f==="0"&&a==="*"&&u==="*"&&d==="*"&&i!=="?"?`每周${i}的每小时整点`:s}function z({cron:s,showDescription:l=!0}){return l?h.jsx(k.Tooltip,{title:`原始: ${s}`,children:h.jsx(k.Tag,{color:"blue",children:V(s)})}):h.jsx(k.Tag,{color:"blue",children:s})}m.CronDisplay=z,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yuku123/z-schedule-frontend-component",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "z-schedule 模块共享前端组件(TypeScript)",
|
|
6
|
+
"keywords": ["react", "antd", "schedule", "z-opc"],
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": { "name": "zifang", "email": "1340947819@qq.com" },
|
|
9
|
+
"homepage": "https://github.com/yuku123/z-opc-frontend/tree/main/packages/z-schedule-frontend-component#readme",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/yuku123/z-opc-frontend.git",
|
|
13
|
+
"directory": "packages/z-schedule-frontend-component"
|
|
14
|
+
},
|
|
15
|
+
"bugs": { "url": "https://github.com/yuku123/z-opc-frontend/issues" },
|
|
16
|
+
"main": "./dist/z-schedule-frontend-component.umd.js",
|
|
17
|
+
"module": "./dist/z-schedule-frontend-component.es.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/z-schedule-frontend-component.es.js",
|
|
22
|
+
"require": "./dist/z-schedule-frontend-component.umd.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": ["dist", "src", "README.md"],
|
|
26
|
+
"publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" },
|
|
27
|
+
"scripts": {
|
|
28
|
+
"dev": "vite --port 3092",
|
|
29
|
+
"build": "vite build",
|
|
30
|
+
"preview": "vite preview"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": "^19.2.0",
|
|
34
|
+
"react-dom": "^19.2.0",
|
|
35
|
+
"antd": "^6.3.3"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
39
|
+
"typescript": "^5.3.3",
|
|
40
|
+
"vite": "^6.2.0"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Tag, Tooltip} from 'antd'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Cron 表达式展示 + 简单的人类可读转换
|
|
6
|
+
* <p>
|
|
7
|
+
* 抽自 z-schedule/_frontend/src/pages/JobList/index.tsx
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <CronDisplay cron="0 0 2 * * ?"/> // "每天凌晨2点"
|
|
11
|
+
*/
|
|
12
|
+
function describeCron(expr: string): string {
|
|
13
|
+
const parts = expr.split(/\s+/)
|
|
14
|
+
if (parts.length < 6 || parts.length > 7) return expr
|
|
15
|
+
|
|
16
|
+
const [sec, min, hour, day, month, week] = parts
|
|
17
|
+
|
|
18
|
+
// 简单规则匹配(够 80% 场景)
|
|
19
|
+
if (sec === '0' && min === '0' && hour !== '*' && day === '*' && month === '*' && week === '?') {
|
|
20
|
+
return `每天 ${hour}点整`
|
|
21
|
+
}
|
|
22
|
+
if (sec === '0' && min === '0' && hour === '*' && day === '*' && month === '*' && week === '?') {
|
|
23
|
+
return '每小时整点'
|
|
24
|
+
}
|
|
25
|
+
if (sec === '0' && min === '0' && hour === '*' && day === '*' && month === '*' && week !== '?') {
|
|
26
|
+
return `每周${week}的每小时整点`
|
|
27
|
+
}
|
|
28
|
+
return expr
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface CronDisplayProps {
|
|
32
|
+
cron: string
|
|
33
|
+
showDescription?: boolean
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default function CronDisplay({cron, showDescription = true}: CronDisplayProps) {
|
|
37
|
+
if (!showDescription) return <Tag color="blue">{cron}</Tag>
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Tooltip title={`原始: ${cron}`}>
|
|
41
|
+
<Tag color="blue">{describeCron(cron)}</Tag>
|
|
42
|
+
</Tooltip>
|
|
43
|
+
)
|
|
44
|
+
}
|
package/src/dev.tsx
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import ReactDOM from 'react-dom/client'
|
|
3
|
+
import CronDisplay from './CronDisplay'
|
|
4
|
+
|
|
5
|
+
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
|
|
6
|
+
root.render(
|
|
7
|
+
<div style={{padding: 40, display: 'flex', flexDirection: 'column', gap: 8}}>
|
|
8
|
+
<CronDisplay cron="0 0 2 * * ?"/>
|
|
9
|
+
<CronDisplay cron="0 0 * * * ?"/>
|
|
10
|
+
<CronDisplay cron="0 0 0/2 * * ?"/>
|
|
11
|
+
<CronDisplay cron="0 30 9 * * MON-FRI"/>
|
|
12
|
+
</div>
|
|
13
|
+
)
|
|
14
|
+
EOF
|
|
15
|
+
|
|
16
|
+
echo "✓ z-oss + z-schedule 写好"
|
|
17
|
+
echo ""
|
|
18
|
+
echo "=== 6 个新包 src 内容总览 ==="
|
|
19
|
+
for pkg in z-config-frontend-component z-meta-frontend-component z-mist-frontend-component z-ext-frontend-component z-oss-frontend-component z-schedule-frontend-component; do
|
|
20
|
+
echo "--- $pkg ---"
|
|
21
|
+
ls /Users/zifang/workplace/idea_workplace/z/z-opc-frontend/packages/$pkg/src/
|
|
22
|
+
done
|
package/src/index.ts
ADDED